-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.aii
188 lines (137 loc) · 2.1 KB
/
debug.aii
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
string asis
include 'gsos.equ'
include 'M16.Debug'
include 'fst.macros'
entry debugs16
MACRO
&lab _Long2Hex
&lab ldx #$230B
jsl $E10000
MEND
MACRO
&lab _Int2Hex
&lab ldx #$220B
jsl $E10000
MEND
MACRO
&lab s16_puts &str
&lab ldx #^(&str)
ldy #(&str)
cop $84
MEND
debug procname export
pha
phx
phy
; dump info to sweet 16.
lda sweet_status
bmi exit
bne sweet_active
; check sweet status
; see tn 201
lda #0
short m
sta >$00c04f
lda >$00c04f ; emu id
tax
lda >$00c04f ; emu version
long m
cpx #$16
beq @ok
; not sweet 16
dec sweet_status
bra exit
@ok
inc sweet_status
sweet_active
jsr debugs16
exit
ply
plx
pla
rts
sweet_status
dc.w 0
endp
debugs16 procname
with fst_parms
; debugger logging:
; x=^str
; y=str
; cop $84
; hex2string @ offset 12.
~Int2Hex <call_number,#p1+12,#4
~Long2Hex <param_blk_ptr,#p2+12,#8
~Int2Hex <dev1_num,#p3+12,#4
~Int2Hex <dev2_num,#p4+12,#4
~Long2Hex <fcr_ptr,#p5+12,#8
~Long2Hex <vcr_ptr,#p6+12,#8
~Int2Hex <path_flag,#p7+12,#4
~Int2Hex <span1,#p8+12,#4
~Int2Hex <span2,#p9+12,#4
s16_puts p1
s16_puts p2
s16_puts p3
s16_puts p4
s16_puts p5
s16_puts p6
s16_puts p7
s16_puts p8
s16_puts p9
; special case for strings...
lda path_flag
and #$4000
beq path2
path1
; path 1 is valid
s16_puts s1
;brk $42
lda [path1_ptr]
beq path2
cmp #255
blt @ok
lda #255
@ok
; copy to tmp
; a = count
phb
pha
lda <path1_ptr+2 ; src bank
and #$00ff
xba
ora #tmp>>16
sta |@m+1
; restore the length.
lda 1,s
;x = src
ldx <path1_ptr
inx
inx
; skip the length word.
; y = dest
ldy #tmp
@m mvn 0,0
plx
plb
; store the $0d, $00 terminator.
lda #$000a
sta tmp,x
s16_puts tmp
path2
; ... later
rts
p1 dc.b 'Call : $xxxx',$0a,0
p2 dc.b 'Block : $xxxxxxxx',$0a,0
p3 dc.b 'Dev 1 : $xxxx',$0a,0
p4 dc.b 'Dev 2 : $xxxx',$0a,0
p5 dc.b 'FCR : $xxxxxxxx',$0a,0
p6 dc.b 'VCR : $xxxxxxxx',$0a,0
p7 dc.b 'Path Flag: $xxxx',$0a,0
p8 dc.b 'Span1 : $xxxx',$0a,0
p9 dc.b 'Span2 : $xxxx',$0a,0
s1 dc.b 'Path 1 : ',0
s2 dc.b 'Path 2 : ',0
cr dc.b $0a,0
tmp ds 257
endp
end