Files
luckytyphlosion e1659ecd41 Introduce linkerscript.
Addresses of sections will now be added to the linkerscript via `org`, and the section name will be the path/to/file. If there is more than one section in the file, then add a @SectionName after the path/to/file to describe the section.
2018-07-03 17:07:05 -04:00

46 lines
698 B
NASM

INCLUDE "constants.asm"
; if DEBUG
SECTION "home/print_hex.asm", ROM0
; else
; SECTION "Print Hexadecimal functions", ROM0[$355B]
; endc
PrintHexBytes: ; 3597 (0:3597)
; Print c hex bytes located at de to hl
.loop
push bc
call PrintHexByte
pop bc
dec c
jr nz, .loop
ret
PrintHexByte:: ; 35a0 (0:35a0)
; Print one hex byte located at de to hl
ld a, [de]
swap a
and $0f
call GetHexDigit
ld [hli], a
ld a, [de]
and $0f
call GetHexDigit
ld [hli], a
inc de
ret
GetHexDigit: ; 35b2 (0:35b2)
; Get a hex digit tile number
; in a.
ld bc, .hexDigitTable
add c
ld c, a
ld a, $00
adc b
ld b, a
ld a, [bc]
ret
.hexDigitTable:
db "0123456789ABCDEF"