finish implementing printf function
This commit is contained in:
1 parent
e1462ae989
commit
e04a648044
1 file changed
+27
@@ -5,6 +5,10 @@
|
|||||||
;; printing of hex byte and word values stored at the indicated
|
;; printing of hex byte and word values stored at the indicated
|
||||||
;; addresses.
|
;; addresses.
|
||||||
|
|
||||||
|
;; .byte 1,$byte = display byte as hex
|
||||||
|
;; .byte 2,$low,$hi = display word as hex
|
||||||
|
;; .byte $f0+n,$low,$hi = display byte at $hi$lo+n as hex
|
||||||
|
|
||||||
printf:
|
printf:
|
||||||
;; Temporary storage is between end of screen at $0400
|
;; Temporary storage is between end of screen at $0400
|
||||||
;; and the sprite pointers at $7f8
|
;; and the sprite pointers at $7f8
|
||||||
@@ -84,6 +88,29 @@ not_hexbyte:
|
|||||||
jmp printf_nextchar
|
jmp printf_nextchar
|
||||||
|
|
||||||
not_hexword:
|
not_hexword:
|
||||||
|
cmp #$f0
|
||||||
|
bcc not_pointer
|
||||||
|
|
||||||
|
;; Treat two-byte arg as base address
|
||||||
|
;; and lower 4 bits of token as offset from
|
||||||
|
;; that location.
|
||||||
|
|
||||||
|
;; Get offset
|
||||||
|
and #$0f
|
||||||
|
tay
|
||||||
|
|
||||||
|
jsr printf_advance
|
||||||
|
jsr $7f4
|
||||||
|
sta $fd
|
||||||
|
jsr printf_advance
|
||||||
|
jsr $7f4
|
||||||
|
sta $fe
|
||||||
|
|
||||||
|
lda ($fd),y
|
||||||
|
jsr printf_printhexbyte
|
||||||
|
jmp printf_nextchar
|
||||||
|
|
||||||
|
not_pointer:
|
||||||
;; Print character
|
;; Print character
|
||||||
jsr $ffd2
|
jsr $ffd2
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user