call outchar
ret
-outhl: ; prints HL in hex. Destroys AF.
+outhl: ; prints HL in hex.
+ push af
ld a, h
call outcharhex
ld a, l
call outcharhex
+ pop af
ret
-outbc: ; prints BC in hex. Destroys AF.
+outbc: ; prints BC in hex.
+ push af
ld a, b
call outcharhex
ld a, c
call outcharhex
+ pop af
ret
-outde: ; prints DE in hex. Destroys AF.
+outde: ; prints DE in hex.
+ push af
ld a, d
call outcharhex
ld a, e
call outcharhex
+ pop af
ret
; print the byte in A as a two-character hex value
outcharhex:
push bc
+ push af
ld c, a ; copy value
; print the top nibble
rra
; print the bottom nibble
ld a, c
call outnibble
+ pop af
pop bc
ret
jr c, numeral ; less than 10?
add a, #0x07 ; start at 'A' (10+7+0x30=0x41='A')
numeral:add a, #0x30 ; start at '0' (0x30='0')
- call outchar
- ret
+ jp outchar
;
; Pull in the CPU specific workarounds
map_current: .db 0, 0, 0, 0
; outchar: Wait for UART TX idle, then print the char in A
-; destroys: AF
outchar:
push bc
+ push af
ld b, a
; wait for transmitter to be idle
ocloop: in a, (UART0_STATUS)
; now output the char to serial port
ld a, b
out (UART0_DATA), a
+ pop af
pop bc
ret