~nytpu/ankano unlisted

c993228bc57b458f79998f4aff1d7b8d3c1a0eae — nytpu 7 months ago 5636d36
load font from bank
2 files changed, 25 insertions(+), 10 deletions(-)

M src/loop.asm
M src/text.asm
M src/loop.asm => src/loop.asm +0 -10
@@ 39,14 39,6 @@ INCLUDE "res/spritemap.2bpp.pb16.size"
	PURGE NB_PB16_BLOCKS
	call pb16_unpack_block
	

	ld de, GameTiles.font
	ld hl, _VRAM8800
INCLUDE "res/font.2bpp.pb16.size"
	ld b, NB_PB16_BLOCKS
	PURGE NB_PB16_BLOCKS
	call pb16_unpack_block

	ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BG9800 | LCDCF_BG8800
	ldh [rLCDC], a



@@ 78,5 70,3 @@ INCBIN "res/game_map.2bpp.tilemap"
.bgTileMapEnd
.sprites
INCBIN "res/spritemap.2bpp.pb16"
.font
INCBIN "res/font.2bpp.pb16"

M src/text.asm => src/text.asm +25 -0
@@ 12,5 12,30 @@ REPT STRLEN("{FONTCHARS}")
CURCHAR = CURCHAR + 1
ENDR

SECTION "Font Tiles", ROMX
FontTiles:
INCBIN "res/font.2bpp.pb16"
.end

SECTION "Text Engine", ROM0
InitTextEngine::
	; save current bank then change
	ldh a, [hCurROMBank]
	ldh [hTempByte], a
	ld a, BANK(FontTiles)
	ldh [hCurROMBank], a
	ld [rROMB0], a

	ld de, FontTiles
	ld hl, _VRAM8800
INCLUDE "res/font.2bpp.pb16.size"
	ld bc, NB_PB16_BLOCKS
	PURGE NB_PB16_BLOCKS
	call pb16_unpack_block

	; restore old bank
	ldh a, [hTempByte]
	ldh [hCurROMBank], a
	ld [rROMB0], a
	ret