debug_routines:
dw dbg_nop
dw dbg_rect_draw
+debug_routines_end:
dbg_nop:
ret
; keys:
; down + select: cycle next debug function
dbg_update:
+ ld a, [dbg_delay]
+ cp a, 0
+ jp nz, @debug_delay
+
+ ; check if dbg swap to next function is needed
+ ld b, BTNDOWN | BTNSELECT
+ input_held
+ cp a, BTNDOWN | BTNSELECT
+ jr nz, @no_switch REL
+ ; set a timer
+ ld a, 16
+ ld [dbg_delay], a
+
+ ; next function
+ ld a, [dbg_fn]
+ inc a
+
+ ; loop around if > max functions
+ cp a, (debug_routines_end - debug_routines) / 2
+ jr nz, @no_reset REL
+ xor a, a
+@no_reset:
+ ld [dbg_fn], a
+@no_switch:
+
ld a, [dbg_fn]
add a, a ; * 2 for table offset
ld l, d
jp hl
+@debug_delay:
+
+ dec a
+ ld [dbg_delay], a
+ ret
; draws a marker obj at
; the edge of a rectangle