|
|
- INCLUDE "hardware.inc"
- INCLUDE "png/map/intro.inc"
-
- SECTION "BG Data", WRAM0
-
- BG_COLLISION_DATA:: dw
- BG_MAP_WIDTH:: db
-
- SECTION "BG Code", ROM0
-
- MACRO update_map_info
- ld hl, BG_COLLISION_DATA
- ld a, HIGH(\1)
- ld [hli], a
- ld a, LOW(\1)
- ld [hli], a
-
- ld a, \2
- ld [hli], a
- ENDM
-
- BG_Init::
- ; copy map
- ld e, intro_HEIGHT
- ld bc, _SCRN0
- ld hl, intro_MAP
- .copy_map_row:
- ld d, intro_WIDTH
- call memcpy
- dec e
- jr z, .done
- ld d, 32 - intro_WIDTH
- .skip:
- ; skip over trailing part in vram
- inc c
- jr nz, .nocarry
- inc b
- .nocarry:
- dec d
- jr nz, .skip
- jr .copy_map_row
- .done:
-
- ; copy tiles
- ld hl, intro_TILES
- ld bc, _VRAM
- ld d, intro_NUM_TILES
- call memcpy
-
- update_map_info intro_COLLISION, intro_WIDTH
-
- ret
|