comparison 3rdparty/utils/sleuth3/cssshowc3.asm @ 3149:afd0f7d9b514

Add the Sleuth multipass disassembler from Bud Pass Added new directory "3rdparty/utiles/sleuth3" and source files to build "sleuth3" and its utilities. Also added "sleuth3" to the Directories section of "3rdparty/utils/makefile" to faciliate the inclusion of the sleuth3 build.
author Bill Pierce <merlinious999@gmail.com>
date Sat, 04 Feb 2017 18:55:39 +0100
parents
children
comparison
equal deleted inserted replaced
3148:ffa4b0273cc7 3149:afd0f7d9b514
1 ***************************************
2 **
3 showaa ldx faddr,u show object program
4 stx saddr,u
5 leax $01,x
6 bne showab
7 rts
8 showab lbsr stopin clear aux input
9 clr saddr+1,u
10 lda #$04
11 sta inst1+scrnwd,u
12 sta flisw,u
13 showac lbsr csctty set tty parameters
14 showad lbsr wlftty change function code
15 lbsr xcrlf print heading
16 leax oarea-1,u init pointers
17 stx iaddr,u
18 leax harea-1,u
19 stx gaddr,u
20 leax clrscn,pcr
21 lbsr outcur clear screen
22 ldb #scrwid format screen
23 cmpb #$08
24 blt showa2
25 leax shotab,pcr
26 lbsr xpdat
27 cmpb #$08
28 beq showa1
29 lbsr xpdat
30 showa1 leax shota1,pcr
31 lbsr xpdat
32 cmpb #$08
33 beq showa2
34 lbsr xpdat
35 showa2 leax shota2,pcr
36 stx eaddr,u
37 showae ldx eaddr,u get next byte
38 lda ,x
39 bne showaf
40 lbsr wtftty change function code
41 lbra showba null=end
42 showaf leax $01,x
43 stx eaddr,u
44 cmpa #$2f
45 beq showaj /=line
46 cmpa #$3c
47 bne showag <=start
48 leax faddr,u
49 bra showah
50 showag cmpa #$3e
51 bne showai >=end
52 leax taddr,u
53 showah lbsr xot4h xxxx
54 bra showae
55 showai lbsr xoute
56 bra showae
57 showaj leax shota2+1,pcr print data line
58 cmpx eaddr,u
59 bne showja
60 ldb #scrwid
61 cmpb #$04
62 beq showjj
63 showja lbsr xcrlf
64 showjj leax saddr,u
65 lbsr xot4s
66 leax inst1,u
67 stx raddr,u
68 ldb #scrwid loop scrwid times
69 showak pshs b print hex
70 lbsr getin
71 ldx gaddr,u
72 leax $01,x
73 sta ,x
74 stx gaddr,u
75 leax instr,u
76 lbsr xot2h
77 lda insty,u
78 ora #$40
79 suba #$20
80 cmpa #$32 chk for rmb
81 bne showal
82 lda #$22 change to "
83 showal lbsr xoute
84 lda instr,u
85 anda #$7f
86 ldx raddr,u
87 cmpa #$1f
88 bls showam
89 cmpa #maxprn
90 bls showao
91 showam lda #$2e .
92 showao sta ,x+
93 stx raddr,u
94 puls b
95 decb
96 bne showak
97 lbsr xouts
98 leax inst1,u
99 lbsr xpdat print alpha
100 lbsr xouts
101 lbra showae
102 showba lbsr xinee get command
103 cmpa #$5f
104 bls showby
105 anda #$5f fix case
106 showby cmpa #$51
107 bne showbc q=quit
108 showbz clr flisw,u clear switch
109 lbra inrtty reset paras and exit
110 showbc cmpa #$50
111 bne showbd p=prev
112 ldd saddr,u
113 subd #(scrbyt*2)
114 bra showbq
115 showbd cmpa #$53
116 bne showbg s=screen
117 ldd saddr,u
118 subd #scrbyt
119 std saddr,u
120 leax toblok,u force output
121 lbsr fob
122 lbsr fulscr full screen edit
123 lbra showac
124 showbg cmpa #$2f
125 bhi showbj space=next
126 showbi ldd saddr,u chk for end
127 cmpd taddr,u
128 bhi showbz
129 lbra showad back for more
130 showbj cmpa #$3a
131 blo showbl num
132 cmpa #$41
133 blo showbi :-@
134 cmpa #$47
135 blo showbl alpha
136 showbk bra showbi rest
137 showbl lbsr xnhe9 addr
138 asla
139 asla
140 asla
141 asla
142 tfr a,b
143 lbsr xnhex
144 pshs b
145 adda ,s+
146 showbq cmpa faddr,u chk addr
147 bcs showbi
148 cmpa taddr,u
149 bhi showbi
150 sta saddr,u change addr
151 lbra showad back for more
152 **
153 * output cursor control string (1-3 chars)
154 outcur pshs b,x save b
155 ldb #$03 set counter
156 outcr1 lda ,x+ get char
157 lbsr xoutet output char
158 decb dec the count
159 bne outcr1 loop til done
160 leax clrscn,pcr chk clr screen
161 cmpx $01,s
162 bne outcr2
163 lda ,x chk for adm-3
164 cmpa #$1a
165 bne outcr2
166 lda #$80 delay
167 lbsr xoutet
168 lbsr xoutet
169 lbsr xoutet
170 lbsr xoutet
171 outcr2 leax toblok,u force output
172 lbsr fob
173 puls b,x,pc restore and return
174 **
175 * find start of cursor control string
176 cmpcur pshs b save b-reg
177 leax clrscn+leadin,pcr point into table
178 cmp1 cmpa ,x correct entry?
179 beq cmp2 yes
180 leax $03,x no, bump to next entry
181 bra cmp1 and try again
182 cmp2 ldb #leadin
183 beq cmp4
184 cmp3 leax -$01,x backup to 1st byte
185 decb
186 bne cmp3
187 cmp4 puls b,pc restore and return
188 **
189 fulscr lbsr scstty full screen edit
190 fulsc1 clr horptr,u reset parameters
191 clr vrtptr,u
192 leax harea,u init screen
193 stx adrptr,u
194 leax homeup,pcr
195 bsr outcur
196 leax rtcur,pcr
197 bsr outcur
198 bsr outcur
199 bsr outcur
200 bsr outcur
201 bsr outcur
202 ldb #scrwid
203 cmpb #$04
204 beq fulsrc
205 leax dncur,pcr
206 bsr outcur
207 fulsrc leax curson,pcr turn on cursor if off
208 lbsr outcur
209 fulbel lda beeps,pcr bell
210 fulout lbsr xoutet
211 fulgnx clrb use b as flag register
212 fulg1 lbsr inchrt get a character
213 sta cchar,u save it
214 cmpa #lead1 is it leadin char #1
215 bne fulg2 no, see if it's 2nd or 3rd char in sequence
216 incb count as first char
217 bra fulg1 and go get another
218 fulg2 tstb is this the 1st char?
219 beq fulg4 yes, then it's not an escape sequence
220 cmpa #lead2 no, then is it 2nd leadin char
221 bne fulctl no, then it must bea 2-char control sequence
222 incb count as 2nd char
223 bra fulg1 and go geta 3rd char
224 fulg4 cmpa #$80 is it an 8-bit control character?
225 bls fulg5 no, check for 7-bit control char
226 bra fulctl go process
227 fulg5 cmpa #$1f is it a 7-bit control char
228 bls fulctl yes, go process
229 lbra fulnct no, then process as alpha
230 fulctl cmpa homeup+leadin,pcr check home
231 beq fulsc1
232 fulnhm cmpa clrscn+leadin,pcr check clear
233 beq fulsc1
234 fulncl ldb vrtptr,u
235 cmpa upcur+leadin,pcr check up-cursor
236 bne fulnup
237 tstb
238 beq fulbel
239 dec vrtptr,u
240 ldd adrptr,u
241 subd #scrwid
242 std adrptr,u
243 leax upcur,pcr point to cursor string
244 bra fulecc
245 fulnup cmpa dncur+leadin,pcr check down-cursor
246 bne fulndn
247 cmpb #$0e
248 bhi fulbeb
249 inc vrtptr,u
250 ldd adrptr,u
251 addd #scrwid
252 std adrptr,u
253 leax dncur,pcr point to string
254 fulecc lbsr outcur
255 bra fulgnx
256 fulbeb bra fulbel bell
257 fulndn ldb horptr,u
258 cmpa lfcur+leadin,pcr check left-cursor
259 bne fulnlf
260 fullf1 tstb
261 beq fulbeb
262 decb
263 pshs b
264 stb horptr,u
265 cmpb #scrhex
266 bne fullf3
267 ldd adrptr,u
268 addd #scrwid
269 fullf2 std adrptr,u
270 fullf3 puls b
271 cmpb #scrhex
272 bhi fulinx
273 bitb #$01
274 bne fulecb
275 lbsr cmpcur get start of cursor string to x
276 bra fulecc
277 fulecb lda cchar,u
278 lbsr cmpcur find table entry
279 lbsr outcur
280 cmpb #scrhex
281 bne fulinx
282 lbsr outcur
283 fulinx ldx adrptr,u
284 lda cchar,u
285 cmpa rtcur+leadin,pcr
286 bne fuldex
287 leax $01,x
288 bra fulxix
289 fuldex leax -$01,x
290 fulxix stx adrptr,u
291 lbsr cmpcur get start of cursor string to x
292 fulech bra fulecc
293 fulnlf cmpa rtcur+leadin,pcr check right-cursor
294 bne fulnrt
295 fulrt1 cmpb #scrale
296 bhi fulbeb
297 pshs b
298 incb
299 stb horptr,u
300 cmpb #scrals
301 bne fullf3
302 ldd adrptr,u
303 subd #scrwid
304 bra fullf2
305 fulnrt cmpa #$0d
306 beq fulcre chk cr
307 fulbec lbra fulbel bell
308 fulcre ldx saddr,u chk for changes
309 stx eaddr,u
310 ldx #scrbyt
311 stx savew,u
312 leax harea,u
313 stx daddr,u
314 leax oarea-1,u
315 stx iaddr,u
316 fulnxc ldx daddr,u
317 lda ,x+
318 stx daddr,u
319 ldx iaddr,u
320 leax $01,x
321 stx iaddr,u
322 cmpa ,x
323 beq fulnxn
324 ldx typee,u
325 ldb #$5a z
326 stb ,x+
327 ldy eaddr,u
328 sty ,x++ xxxx
329 sty ,x++ xxxx
330 sta ,x+ cc
331 ldd #$0000
332 std ,x++
333 stx typee,u
334 fulnxn inc eaddr+1,u next byte
335 ldx savew,u
336 leax -$01,x
337 stx savew,u
338 bne fulnxc
339 leax toblok,u force output
340 lbra fob and exit
341 fulbed lbra fulbel bell
342 fulnct ldx adrptr,u non-controls
343 anda #$7f remove parity
344 ldb horptr,u
345 cmpb #scrhex
346 bhi fulalp
347 cmpa #$5f
348 bls fullow
349 anda #$5f change case
350 fullow suba #$30 chk hex
351 blo fulbed
352 cmpa #$09
353 bls fulhex
354 cmpa #$11
355 blo fulbed
356 cmpa #$16
357 bgt fulbed
358 suba #$07
359 fulhex andb #$01
360 beq fulhev
361 ldb ,x
362 andb #$f0
363 bra fulhez
364 fulhev ldb ,x
365 andb #$0f
366 asla
367 asla
368 asla
369 asla
370 fulhez pshs b
371 adda ,s+
372 fulalp sta ,x store char
373 lda cchar,u
374 lbsr xoutet echo it
375 leax lfcur,pcr cursor left
376 lbsr outcur
377 lda rtcur+leadin,pcr correct cursor
378 sta cchar,u
379 ldb horptr,u
380 lbra fulrt1
381 **
382 inchrt pshs x input routine
383 leax toblok,u force output
384 lbsr fob
385 leax tiblok,u get a char
386 lbsr gnc
387 bcc inchr1
388 lda #$0d cr if error
389 inchr1 equ *
390 **** delete next line if terminal requires 8 bit ascii
391 anda #$7f masks parity
392 puls x,pc