-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_display.h.asm
50 lines (47 loc) · 1.05 KB
/
debug_display.h.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.import MaybeDebugToggle
.import TintApplyToPpuMask
.macro SetTint color
.if (.xmatch({color}, blue))
lda #PPU_MASK_BLUE_TINT
.elseif (.xmatch({color}, green))
lda #PPU_MASK_GREEN_TINT
.elseif (.xmatch({color}, red))
lda #PPU_MASK_RED_TINT
.elseif (.xmatch({color}, red_green))
lda #(PPU_MASK_RED_TINT | PPU_MASK_GREEN_TINT)
.elseif (.xmatch({color}, red_blue))
lda #(PPU_MASK_RED_TINT | PPU_MASK_BLUE_TINT)
.elseif (.xmatch({color}, green_blue))
lda #(PPU_MASK_GREEN_TINT | PPU_MASK_BLUE_TINT)
.elseif (.xmatch({color}, red_green_blue))
lda #(PPU_MASK_RED_TINT | PPU_MASK_GREEN_TINT | PPU_MASK_BLUE_TINT)
.elseif (.xmatch({color}, 0))
lda #0
.else
.error "Could not find color"
.endif
jsr TintApplyToPpuMask
.endmacro
.macro DebugModeSetTint color
.local Ignore
bit debug_mode
bpl Ignore
SetTint color
Ignore:
.endmacro
.macro DebugModeWaitLoop num_loops
.local WaitLoop
bit debug_mode
bpl Ignore
ldx #num_loops
WaitLoop:
nop
nop
nop
nop
nop
nop
dex
bne WaitLoop
Ignore:
.endmacro