Some shit software I was messing with on gb
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

113 lines
1.8 KiB

include "charmap.inc"
include "video.inc"
section "home/text.asm@data", rom0
gfx_font:
incbin "assets/tetrisfont.1bpp"
.end
section "home/text.asm@vram", vram
ds $2D tiles
v_font_dash_period: ds 2 tiles
ds $1 tiles
v_font_numbers: ds 10 tiles
ds $7 tiles
v_font_uppercase: ds 26 tiles
ds $6 tiles
v_font_lowercase: ds 26 tiles
section "home/text.asm", rom0
prints::
; hl: String
; de: Tilemap position
ld a, [hli]
cp "$"
ret z
call lcd_blank_wait ; TODO: Really hackish.
ld [de], a
inc de
jr prints
print_dec_3digit::
; a: Number
; de: Tilemap positon
push af
call lcd_blank_wait
xor a
ld [de], a
inc de
ld [de], a
inc de
ld [de], a
pop af
ld l, 3
.loop
ld c, 10
call divide
add "0"
call lcd_blank_wait
ld [de], a
ld a, b
and a
ret z
dec de
dec l
jr nz, .loop
ret
print_hex_4digit::
; hl: Number
; de: Tilemap position
ld a, h
swap a
call print_hex_1digit
ld a, h
call print_hex_1digit
ld a, l
swap a
call print_hex_1digit
ld a, l
jr print_hex_1digit
print_hex_2digit::
; a: Number
; de: Tilemap position
ld b, a
swap a
call print_hex_1digit
ld a, b
jr print_hex_1digit
print_hex_1digit:
and $f
add "0"
cp "9" + 1
jr c, .skip
add "A" - "0" - $a
.skip
call lcd_blank_wait
ld [de], a
inc de
ret
font_load::
ld hl, gfx_font
ld de, v_font_numbers
ld bc, (10 tiles) / 2
call memcpy_double
ld de, v_font_uppercase
ld bc, (26 tiles) / 2
call memcpy_double
ld hl, gfx_font + (10 tiles) / 2
ld de, v_font_lowercase
ld bc, (26 tiles) / 2
call memcpy_double
ld de, v_font_dash_period + (1 tiles)
ld bc, (1 tiles) / 2
call memcpy_double
ld de, v_font_dash_period
ld bc, (1 tiles) / 2
jp memcpy_double