Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; refresh screen
- ld I, $FFF
- ld (I), #1
- ; ---------------------
- ; set screen text color to black
- ld I, $FFD
- ld (I), $F
- ; ---------------------
- ; set screen X pos to 0
- ld I, $FFA
- ld (I), #0
- ; ---------------------
- ld X, text ; set register X to memory location of the text
- call print ; call print
- ; refresh screen
- ld I, $FFF
- ld (I), #1
- ; ---------------------
- .loop jmp loop ; infinite loop
- .print ; zero terminated print function
- ld X, I ; load X value to I
- ld A, (I) ; load the char
- eql A, #0 ; check if its not 0
- jmp printEnd ; if its 0 goto END
- ; put char on screen
- ld I, $FFE
- ld (I), A
- ; ---------------------
- sub X, #1 ; move to the next char
- ; update screen X pos
- ld I, $FFA
- ld A, (I)
- add A, #1
- ld (I), A
- ; ---------------------
- jmp print ; loop until zero
- .printEnd
- ; fix the double chars at the end of the string
- ; simply replaces the end char with a space
- ld A, $20
- ld I, $FFE
- ld (I), A
- ret ; get back from function
- .text db "Hello, world!"
Advertisement
Add Comment
Please, Sign In to add comment