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.
 
 
 
 

78 lines
1.3 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
print::
; hl: String
; de: Tilemap position
ld a, [hli]
cp "$"
ret z
call lcd_blank_wait ; TODO: Really hackish.
ld [de], a
inc de
jr print
print_num_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
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