push de
call map_tiles_load
pop de
+
+ call map_full_draw
call lcd_on
call vblank_wait
call enableinterrupts
- call map_full_draw
call player_init
call ui_init
#endmacro
+ ; draws a tile
+ ; to the screen
+ ; inputs:
+ ; hl: tile
+ ; b/c: y/x position
+map_draw_tile:
+ ; find tile to draw
+ ld de, t_tile
+ add hl, de
+
+ ; load tile into a
+ ld a, [hl] ; a = tile
+ push af ; save tile gfx
+
+ ld hl, SCRN0
+ ld de, MAP_W
+
+ ; skip y loop if b is 0
+ ld a, b
+ cp a, 0
+ jr z, @skip_y REL
+
+@y_loop:
+ add hl, de
+ dec b
+ jr nz, @y_loop REL
+@skip_y:
+
+ ld d, 0
+ ld e, c
+ add hl, de ; hl = SCRN location
+
+ pop af
+ ld [hl], a
+
+ ret
+
+ ; draws 16 tiles
+ ; inputs:
+ ; hl: start tile
+ ; b: y position
+map_draw_row:
+ ret
+
; draws a full page of the currently selected map
- ; waits for blank between each row
; inputs:
; [map]
map_full_draw:
+ ld bc, MAP_TILES
+ ld hl, tiles
+
+ push hl
+ ld bc, 0
+ call map_draw_tile
+ pop hl
+
ret
; nop map rotuine