pokecrystal-board/engine/overworld/load_overworld_tilemap.asm

38 lines
452 B
NASM
Raw Normal View History

2024-02-10 15:16:00 -08:00
_LoadOverworldTilemap::
ld hl, wSurroundingTiles
ld a, [wPlayerMetatileY]
and a
jr z, .top_row
ld bc, SURROUNDING_WIDTH * 2
add hl, bc
.top_row
ld a, [wPlayerMetatileX]
and a
jr z, .left_column
inc hl
inc hl
.left_column
decoord 0, 0
ld b, SCREEN_HEIGHT
.loop
ld c, SCREEN_WIDTH
.loop2
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .loop2
ld a, l
add METATILE_WIDTH
ld l, a
jr nc, .carry
inc h
.carry
dec b
jr nz, .loop
2023-08-29 09:33:20 -07:00
ret