ld [hl+], a
+ ret
+
+ ; debug draws a tile based on player position
+ ; inputs:
+ ; $1: y offset
+ ; $2: x offset
+ ; hl: oam ptr
+ ; returns:
+ ; hl: next oam ptr
+#macro debug_draw_tile
+ ld de, player+act_pos_y
+ ld a, [de]
+ inc de
+ add a, $1 & 0xFF
+
+ ld b, a ; b = y
+ ld a, [de]
+ add a, $2 & 0xFF
+ ld c, a ; c = x
+
+ push hl
+ call map_get_tile
+ push hl
+ pop de ; de = tile
+ inc de ; de = tile flags
+
+ pop hl ; hl = oam
+
+ ; y pos
+ ld a, 136 + $1 * 8
+ ld [hl+], a
+
+ ; x pos
+ ld a, 136 + $2 * 8
+ ld [hl+], a
+
+ ; tile
+ ld a, [de]
+ add a, 0x60 ; tile offset for debug tiles
+ ld [hl+], a
+
+ ; flags
+ xor a, a
+ ld [hl+], a
+
+#endmacro
+
+ ; draws the tiles around the player
+ ; only draws the exit flags
+debug_draw_map:
+ ld a, 9
+ call oamalloc
+
+ debug_draw_tile -1, 0
+ debug_draw_tile 0, 0
+ debug_draw_tile 1, 0
+
+ debug_draw_tile 0, -1
+ debug_draw_tile 0, 1
+
+ debug_draw_tile 1, 1
+ debug_draw_tile -1, 1
+
+ debug_draw_tile -1, -1
+ debug_draw_tile 1, -1
+
ret