annotate 3rdparty/utils/sleuth3/cssgetcd3.asm @ 3295:6b7a7b233925 default tip

makefile: Allow PORTS with level1/2 mix https://sourceforge.net/p/nitros9/feature-requests/10/
author Tormod Volden <debian.tormod@gmail.com>
date Tue, 19 Apr 2022 18:12:17 +0200 (2022-04-19)
parents afd0f7d9b514
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3149
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
1
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
2 ***************************************
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
3 **
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
4 getin pshs y get next instr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
5 ldx #$ffff
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
6 stx maddr,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
7 lbsr getty get type
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
8 clra clear instr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
9 cmpb #$4b chk ign
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
10 lbeq getjk
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
11 cmpb #$52 chk rmb
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
12 lbeq getjk
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
13 ldx maddr,u chk for m/z
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
14 tst disif,u chk source
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
15 bne getdk
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
16 cmpx #$ffff from memory
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
17 beq getmz
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
18 lda $05,x get desired data
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
19 ldb ,x chk type
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
20 cmpb #$5a for z
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
21 lbeq getjk
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
22 getmz ldd saddr,u compute addr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
23 addd oaddr,u offset
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
24 lbra getid
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
25 getdk cmpx #$ffff from disk
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
26 lbeq getjk
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
27 lda $05,x get desired locn/data
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
28 ldb ,x chk type
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
29 cmpb #$5a
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
30 lbeq getjk skip if z
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
31 ldd saddr,u data addr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
32 subd $01,x start addr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
33 addd $06,x add extent byte address
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
34 tfr a,b
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
35 lda $05,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
36 adca #$00
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
37 andb #$fe truncate to 512 bytes
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
38 cmpd inlrec,u chk curr locn
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
39 beq getsl
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
40 getss std inlrec,u set curr locn
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
41 pshs y,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
42 exg a,b
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
43 tfr d,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
44 clrb byte addr=0
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
45 tfr d,y
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
46 tfr x,d
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
47 clra
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
48 tfr d,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
49 lda inblok+iobfd+1,u file desc
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
50 tfr y,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
51 os9 I$Seek seek
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
52 puls u,y reset stack
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
53 bcc getts
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
54 geter lda #$02 return error
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
55 leax errirz,pcr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
56 ldy #errirl
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
57 os9 I$WritLn
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
58 lbsr ende3 close files
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
59 lbsr stopin stop input
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
60 clr escswt,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
61 lbra askin abort
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
62 getts ldx inblok+iobba,u read the block
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
63 ldy #buflen
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
64 lda inblok+iobfd+1,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
65 os9 I$Read
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
66 bcs geter error
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
67 cmpy #$0000
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
68 bcs geter eof
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
69 ldx maddr,u restore map ptr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
70 getsl ldd saddr,u data addr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
71 subd $01,x start addr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
72 addd $06,x disk byte address
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
73 anda #$01 mask to 512 bytes
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
74 leax inbuff,u input buffer addr
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
75 pshs x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
76 addd ,s++
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
77 getid std maddr,u disk and memory
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
78 lda [maddr,u]
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
79 getjk ldx saddr,u update pointers
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
80 stx daddr,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
81 leax $01,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
82 stx saddr,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
83 sta instr,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
84 inc fllth,u update length
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
85 tst flisw,u save instrs?
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
86 beq getxx
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
87 ldx iaddr,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
88 leax $01,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
89 sta ,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
90 stx iaddr,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
91 getxx puls y,pc
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
92 **
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
93 getty pshs y return memory type
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
94 ldx types,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
95 lda defalt,u default type
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
96 sta insty,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
97 ldd saddr,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
98 getnx cmpx typee,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
99 beq gettx
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
100 cmpd $01,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
101 beq getn4
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
102 getn1 bls getix
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
103 getn2 cmpd $03,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
104 beq getn4
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
105 getn3 bhi getix
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
106 getn4 pshs b have table hit
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
107 ldb ,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
108 cmpb #$4d chk m
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
109 bne getn5
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
110 stx maddr,u save table location
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
111 clrb and set type
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
112 bra getn9
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
113 getn5 cmpb #$5a chk z
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
114 bne getn9
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
115 stx maddr,u save table location
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
116 ldb insty,u chk type
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
117 cmpb #$4b
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
118 bne getn9
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
119 clrb
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
120 getn9 stb insty,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
121 puls b
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
122 getix leax $08,x
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
123 bra getnx
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
124 gettx ldb insty,u
afd0f7d9b514 Add the Sleuth multipass disassembler from Bud Pass
Bill Pierce <merlinious999@gmail.com>
parents:
diff changeset
125 puls y,pc