-
Notifications
You must be signed in to change notification settings - Fork 2
/
debug.asm
95 lines (85 loc) · 1.07 KB
/
debug.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.ifndef DEBUG_INC
DEBUG_INC = 1
.macro CORNER_DEBUG
pha
phx
phy
phy
phx
ldx #0
ldy #0
jsr debug
pla
ldx #0
ldy #1
jsr debug
pla
ldx #0
ldy #2
jsr debug
ply
plx
pla
.endmacro
.macro DEBUG_BYTE addr, xpos, ypos
pha
phx
phy
lda addr
.ifnblank xpos
ldx #xpos
.else
ldx #0
.endif
.ifnblank ypos
ldy #ypos
.else
ldy #2
.endif
jsr debug
ply
plx
pla
.endmacro
.macro DEBUG_WORD word, xpos, ypos
DEBUG_BYTE word+1, xpos, ypos
DEBUG_BYTE word, xpos+2, ypos
.endmacro
.include "tilelib.asm"
debug: ; A: value to display
; X: tile x
; Y: tile y
pha
lda #1
jsr xy2vaddr
stz VERA_ctrl
ora #$10
sta VERA_addr_bank
stx VERA_addr_low
sty VERA_addr_high
pla
tax
lsr
lsr
lsr
lsr
cmp #$0A
bmi @tile1
clc
adc #7
@tile1:
adc #$30
sta VERA_data0
stz VERA_data0
txa
and #$0F
cmp #$0A
bmi @tile2
clc
adc #7
@tile2:
adc #$30
sta VERA_data0
stz VERA_data0
rts
.endif