Last active
December 19, 2020 10:35
-
-
Save JimmyDansbo/fd4f191e174ec002c4549607a8ba3e43 to your computer and use it in GitHub Desktop.
Random number between 0 and 9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*=$0801 | |
!word $080C ; Pointer to next BASIC line | |
!word $000A ; Line number $000A = 10 | |
!byte $9E ; SYS BASIC token | |
!pet " $810",0 ; Address where ASM starts | |
!word $0000 ; EOF BASIC program | |
*=$0810 | |
CHROUT = $FFD2 | |
SEED = $9F64 ; VIA timer low-byte | |
main: | |
lda SEED | |
and #$0F ; 10 is max so use $0F to get down to 15 | |
cmp #10 | |
bcs main ; Try again if .A is >= 10 | |
ora #$30 ; OR with $30 to get petscii character | |
jsr CHROUT ; Print character | |
lda #' ' ; Print a space | |
jsr CHROUT | |
jmp main | |
rts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment