Last active
May 30, 2019 21:57
-
-
Save adamv/ade115b8e6f6c24e410c6c6010157872 to your computer and use it in GitHub Desktop.
This file contains 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
; Display the the byte in A as two hex digits at the current | |
; screen position | |
; | |
; Inputs: | |
; A byte to display | |
; | |
; Destroys A | |
display_hex: | |
pha | |
lsr | |
lsr | |
lsr | |
lsr | |
ora #$30 ; screen code for 0 | |
cmp #58 | |
bcc out3 | |
sbc #57 | |
out3: | |
jsr scr_output | |
pla | |
and #$0f | |
ora #$30 ; screen code for 0 | |
cmp #58 | |
bcc out4 | |
sbc #57 | |
out4: | |
jmp scr_output ; implicit rts |
This file contains 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
; Display the the byte in A as two hex digits at the current | |
; screen position | |
; | |
; Inputs: | |
; A byte to display | |
; | |
; Destroys A, X | |
display_hex: | |
pha | |
lsr | |
lsr | |
lsr | |
lsr | |
tax | |
lda hex_digits,x | |
jsr scr_output | |
pla | |
and #$0f | |
tax | |
lda hex_digits,x | |
jmp scr_output ; implicit rts | |
hex_digits: !scr "0123456789abcdef" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment