annotate level2/modules/ram.asm @ 2152:74fb212cb659

Changelog comes from higher up
author boisy
date Wed, 14 May 2008 02:13:22 +0000
parents dbc5e82a3127
children b77c7bb3d757
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * RAM - RAM Disk driver
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
1348
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 1347
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 1347
diff changeset
7 * Comment
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
1348
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 1347
diff changeset
9 * 4 1998/10/10 Boisy G. Pitre
8e804211cb25 Fixed sources to have new style change logs at top
boisy
parents: 1347
diff changeset
10 * Given to me by Gene Heskett.
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 opt d68
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 opt w110
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 * set printer to 15 cpi!
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
15 *h6309 set 0 now uses NitrOS9's H6309 flag
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 nam RAM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 ttl RAM Disk driver
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 **********************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 * A version of MyRam that can be asm to run on either
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 * cpu. To switch to 6309 coding, use "h6309 set 1"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 * As no irq's are handled here, compensatory
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 * changes to register offsets vs stack are not
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 * required, therefore not used as defines either.
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
26 * This does require an "os9defs" that can switch
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 * register offsets etc according to the value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 * assigned to "h6309" and "TRUE", and a late
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 * copy of Chris Burkes "xsm" assembler
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
31 IFP1
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 use defsfile
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
33 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 rev set $02
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 edition set 4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 ****************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39 * this is required because regular
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 * os-9 doesn't treat a native mode
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 * marked module correctly, result
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 * crash at worst, device table full
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 * and nothing else works at best.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
45 IFNE H6309
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
46 tylg set Drivr+Obj6309
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
47 atrv set ReEnt+ModNat+rev
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
48 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 tylg set Drivr+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 atrv set ReEnt+rev
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
51 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 RD.MAP set -2 ,x of course!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 FDlocat set -3 loc for root FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 DIRloca set -4 loc for root
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 mod eom,name,tylg,atrv,start,size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 org 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 u0000 rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 u0002 rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 u0004 rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 u0006 rmb 5
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 u000B rmb 2
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
63 u000D rmb 2 is RD.MAP & FDlocat
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64 u000F rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 u0010 rmb 32
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 OurDesc rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 OurLink rmb 1 to control our self link
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 Initstt rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 u0035 rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 u0036 rmb 2 number of 8k ramblocks needed
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 u0038 rmb 2 only 2 used
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 u003A rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 FatScra rmb 2 define FatScratch pad areas
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 MP.SIZ rmb 2 ditto
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 u0040 rmb 6
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 u0046 rmb 10 actually 1, our tasknum
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 u0050 rmb $C0-.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 u00C0 rmb $100-.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 size equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 mode fcb $BF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 name fcs /RAM/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 start equ * the usual jump table for drivers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 lbra Init
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 lbra Read
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 lbra Write
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 lbra SGtat these return errors
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 lbra SGtat
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 lbra Term
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 Init equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 lbsr Initchk have we been init'd?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 bcs DoInit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 andcc #$FE clr the carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 rts don't do twice
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 DoInit inc OurLink,u so it'll get relinked
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 andcc #$FE kill the carry if set
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 leax u000F,u U is mem assigned area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100 sty OurDesc,u save for later recovery
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 pshs u,x building stack image -4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 * sp+2=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 * sp =x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 ldu #$0028 location of time packet
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106 leax DD.DAT,x set x to target location
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
107 IFNE H6309
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
108 ldw #$0005 we want to move 5 bytes
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
109 tfm u+,x+ do it
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
110 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 ldb #$05 number of byte to move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112 GTime lda ,u+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 sta ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115 bne GTime
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
116 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 ldu 2,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 ldx ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119 ldb #$01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 stb u0006,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121 ldx <D.Proc <$50 current process ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122 ldd P$User,x $08,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123 ldx ,s get x back
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124 * building a dummy sector zero's first $33 bytes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 * which is all assembled starting at offset $0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 * of our initial scratchpad assignment
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127 std $0B,x DD.OWNer of dummy sector zero
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128 ldd #$0001
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 std $06,x DD.BIT sectors per cluster
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 lda $0D,y DD.ATT disk attributes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 sta $0D,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132 ldd <$1B,y IT.SCT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133 std $01,x put totsecs in DD.TOT+1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 * this could be simplicated to straight 6809 code
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
136 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 lsrd /2 but this is one cycle quicker at 3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 lsrd /4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 lsrd /8 8 sectors per byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
142 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 lsra where this is 2 per 8 bit register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 rorb or 4 cycles for full 16 bit shift
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
151 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 std RD.MAP,x s/b at $400D-E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 subd #$0001 it grabs extra page otherwise
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154 std $04,x DD.MAP (size) addr $13&14
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 ****************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 * set the location of the root FD.SCT intelligently!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 * this is where the devpack version failed miserably,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 * it was fixed at $0002, whole thing dead at 512k & up
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 * furinstance, with sct=1300, d=$0260 right here,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 * therefore the FAT occupies 3 full sectors starting
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 * at sector $01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 tfr a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 incb to next page so it skips sector zero
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 incb and point to sector AFTER the FAT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 clra simplicating it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 std $09,x DD.DIR+1 fd location!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 * save a copy to locate the root FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 stb FDlocat,x save copy for FD loc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
169 * save a copy to locate the root dir
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 incb to next sector
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171 stb DIRloca,x s/b @ $400B-C
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 *****************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 * now lets go get enough memory to build the FAT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 lda RD.MAP,x get msb, maybe $00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 * if over $800 sectors, regs.a won't be zero!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 inca round up increment to cover all
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 clrb make even page boundary
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 os9 F$SRqMem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 lbcs L0178
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 ldx 2,s get U back
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 std MP.SIZ,x and save it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182 stu FatScra,x save FAT loc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 ldx ,s and get x back
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184 pshs u U is new mem area start -6
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
185 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 * sp+4=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 * sp+2=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 * sp = usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189 ldu $04,s get orig $4D00 u back
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 * How many 8k blocks of mem do we need?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191 ldd RD.MAP,x already been /8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 addd #$0003 we'll shift out, but need d2 carry
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
193 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 lsrd /16
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 lsrd /32 but its 5 cycles faster!
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
196 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 rorb /16
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 rorb /32
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
201 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 * D is now how many blocks we need
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 std <u0036,u 8k blocks ram needed
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205 leax >u00C0,u if <$20 blocks we
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 cmpd #$0020 allow 512k in this map
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 bls L008D if go, fits this page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 * else table of blocks won't fit from $C0-$FF,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209 * ask for another (d*2) pages
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
211 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212 asld else ask for more memory
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
213 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 lslb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 rola
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
216 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 os9 F$SRqMem get new U
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 lbcs L017C no more avail!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219 * we'll use this instead of $xxC0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 * sp+4=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 * sp+2=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 * sp = usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 * save for later release
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 leax ,u ok ,set x to new mem ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 ldu $04,s and get old u back
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 L008D equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 stx <u0038,u $4EC0 for small disk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
230 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 ldw <u0036,u number of blocks req
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
232 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 ldy <u0036,u
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
234 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 * Where did we start?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 L0094 ldb #$01 ask for one 8K block
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 os9 F$AllRAM os9 manual doesn't say but
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239 lbcs L017C returns B=# of blk allocated
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 std ,x++ make list of blocks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
242 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243 decw that we own for later release
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
244 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245 leay -1,y
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
246 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 bne L0094
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
250 IFEQ H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 ldy <OurDesc,u we destroyed our descriptor pointer
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
252 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254 leax <u0040,u orig U here
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255 ldd [u0038,u] addr of # of blocks we own
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 std <$40,x save at 4E80-81
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257 os9 F$AllTsk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 * this reserves a task #, then sets hardware
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 * and DAT ram to this processes addr info
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260 lbcs L017C
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261 lda <D.SysTsk from dp reference
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 ldb $06,x x our task number!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 * now we can move the dummy sector zero
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264 * to the first sector
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 * the stack image now is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266 * sp+4=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 * sp+2=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 * sp = usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 ldx $02,s get source ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 ldy #$001F byte count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 pshs u save this puppy, simplicates
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 * sp+6=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 * sp+4=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 * sp+2= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 * sp = our current U, $4D00?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
277 ldu #$0000 destination ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
278 os9 F$Move our dummy sector 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
279 leax >L018A,pcr devices volume name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
280 leau ,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
281 ldy #$000E length of name string etc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
282 * write 10 zeros for DD.BT-DD.NAM & the name section
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
283 os9 F$Move and move that into sector zero
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
284 puls u get our reference back
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
285 * now lets make RBF a bit happier by copying
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
286 * the opts section of the descriptor into
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
287 * sector zero too.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
288 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
289 * sp+4=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
290 * sp+2=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
291 * sp+0= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
292 ldx OurDesc,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
293 leax $12,x point to opts in desc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
294 ldu #$003F point to start of opts in sector 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
295 ldy #$000F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
296 os9 F$Move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 ldu 4,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 * That moved enough info into what RBF thinks is sector
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
299 * zero of this device to tell RBF what it is & how big,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
300 * where root dir is located etc.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
301 FatLoop equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
302 * Now lets move the FAT into ramdisk space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
303 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
304 * sp+4=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
305 * sp+2=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
306 * sp = usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
307 ldx $02,s test valid
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
308 ldd RD.MAP,x saved bitmap siz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
309 * using size of bitmap for fat, save it in w
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
310
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
311 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
312 tfr d,w there is a method
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
313 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
314 std <u0002,u
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
315 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
316
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
317 * now add enough for even page boundary
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
318 inca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
319 clrb now D is overall size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
320 ldx ,s bitmap addr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
321 * now we know how big it is
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
322 leay d,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
323 pshs y save ending addr (page)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
324 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
325 * sp+6=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
326 * sp+4=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
327 * sp+2= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
328 * sp = top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
329 L00DC equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
330
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
331 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
332 leay w,x set y=where active fat ends
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
333 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
334 pshs d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
335 ldd <u0002,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
336 leay d,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
337 puls d
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
338 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
339
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
340 pshs y stack the end of active
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
341 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
342 * sp+8=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
343 * sp+6=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
344 * sp+4= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
345 * sp+2= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
346 * sp = end of active fat, $403D?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
347 ldx $04,s s/b the fat workspace base addr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
348 ldb #$FF allocate 1st 8 'sectors'
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
349 L00E2 stb ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
350 stb ,x+ make basic alloc $10 sectors
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
351 L00E5 clr ,x+ and mark the rest clear
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
352 cmpx ,s to end of active
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
353 bcs L00E5 (was bcs)till the end of the fat
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
354 * should show the end of the fat in x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
355 L00EA stb ,x+ then mark full
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
356 cmpx $02,s for remainder of last page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
357 bcs L00EA (wonder if this s/b bls too!)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
358 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
359 * sp+8=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
360 * sp+6=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
361 * sp+4= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
362 * sp+2= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
363 * sp = end of active fat, $403D?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
364 ldu $08,s get our base page back
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
365 lda <D.SysTsk u00D0 note dp, is D.SysTsk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
366 ldb <u0046,u assigned P$Task
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
367 pshs d save it for following move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
368 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
369 * sp+A=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
370 * sp+8=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
371 * sp+6= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
372 * sp+4= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
373 * sp+2= end of active fat, $403D?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
374 * sp = our task numbers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
375 ldd $04,s get end of fat
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
376 subd $06,s should leave fatsize in d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
377 tfr d,y size to y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
378 puls d restore our tsknums
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
379 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
380 * sp+8=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
381 * sp+6=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
382 * sp+4= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
383 * sp+2= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
384 * sp = end of active fat, $403D?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
385 ldu #$0100 start of FAT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
386 ldx $04,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
387 os9 F$Move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
388 * we're done with the fat, its moved into the space
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
389 * for the device. Now make a dummy FD in the same
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
390 * memory area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
391 leas $02,s don't need end of active fat anymore
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
392 MkRoot1 clr ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
393 cmpx ,s clearing the mem,done w/fat
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
394 bcs MkRoot1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
395 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
396 * sp+6=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
397 * sp+4=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
398 * sp+2= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
399 * sp+0= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
400 ldx $02,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
401 ldu $04,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
402 * Ok, now lets make an FD sector for the root dir
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
403 FDmaker equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
404 lda u000D,u DD.ATT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
405 sta ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
406 ldd u000B,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
407 std $01,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
408 ldb #$01 this is the link count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
409 stb $08,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
410 ldd #$0040
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
411 std $0B,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
412 ldb DIRloca,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
413 stb <$12,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
414 ldd #$0010
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
415 * Now a bit more intelligence applied
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
416 subb DIRloca,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
417 std <$13,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
418 lda <D.SysTsk u00D0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
419 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
420 * sp+6=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
421 * sp+4=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
422 * sp+2= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
423 * sp+0= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
424 ldu $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
425 ldb <u0046,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
426 pshs x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
427 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
428 * sp+8=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
429 * sp+6=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
430 * sp+4= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
431 * sp+2= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
432 * sp = saved bottom of work area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
433 ldx $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
434 * now set u to actual offset of FDlocation
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
435
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
436 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
437 lde FDlocat,x this is why we saved it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
438 clrf
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
439 tfr w,u neat huh?
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
440 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
441 pshs d
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
442 lda FDlocat,x
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
443 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
444 tfr d,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
445 puls d
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
446 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
447
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
448 puls x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
449 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
450 * sp+6=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
451 * sp+4=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
452 * sp+2= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
453 * sp+0= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
454 ldy #$0100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
455 os9 F$Move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
456 leay <$16,x why only $16, the dir is $40!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
457 pshs y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
458 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
459 * sp+8=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
460 * sp+6=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
461 * sp+4= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
462 * sp+2= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
463 * sp = saved top of work area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
464 L0144 clr ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
465 cmpx ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
466 bcs L0144
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
467 leas $02,s get rid of that
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
468 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
469 * sp+6=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
470 * sp+4=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
471 * sp+2= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
472 * sp+0= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
473 ldx $02,s s/b right
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
474 leay $40,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
475 pshs y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
476 DClr clr ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
477 cmpx ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
478 bcs DClr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
479 leas $02,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
480 ldx $02,s get it back again
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
481 ldd #$2EAE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
482 std ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
483 stb <$20,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
484 * again, I've gotta apply some smarts to locating it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
485 ldx $04,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
486 ldb FDlocat,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
487 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
488 ldx $02,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
489 std <$1E,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
490 std <$3E,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
491 lda <D.SysTsk u00D0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
492 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
493 * sp+6=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
494 * sp+4=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
495 * sp+2= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
496 * sp+0= top of fat, $4100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
497 ldu $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
498 ldb <u0046,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
499 ldy #$0040
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
500 ldx $04,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
501
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
502 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
503 lde DIRloca,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
504 clrf
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
505 tfr w,u
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
506 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
507 pshs d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
508 lda DIRloca,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
509 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
510 tfr d,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
511 puls d
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
512 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
513
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
514 ldx $02,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
515 os9 F$Move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
516 ldx $04,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
517 lda RD.MAP,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
518 inca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
519 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
520 leas $02,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
521 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
522 * sp+4=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
523 * sp+2=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
524 * sp+0= usually $4000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
525 puls u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
526 * the stack image is:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
527 * sp+2=u, usually $4D00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
528 * sp+0=x, usually $4D0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
529 os9 F$SRtMem give back FatScra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
530 L0178 leas $02,s skip the x offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
531 puls u get orig assignment back!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
532
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
533 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
534 ldw <L018A,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
535 stw Initstt,u crash time?
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
536 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
537 pshs d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
538 ldd <L018A,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
539 std Initstt,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
540 puls d
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
541 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
542
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
543 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
544 rts puls pc,u U allready pulled, use rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
545
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
546 L017C leas $04,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
547 puls pc,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
548 L018A fcs /Gene's RamDisk/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
549 Initchk equ *
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
550 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
551 ldw Initstt,u <L018A,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
552 cmpw <L018A,pcr Initstt,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
553 beq InitOk
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
554 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
555 pshs d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
556 ldd Initstt,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
557 cmpd <L018A,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
558 puls d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
559 beq InitOk
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
560 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
561 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
562 ldb E$NotRdy else report error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
563 InitOk equ * relocated to give exit report
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
564 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
565
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
566 Read equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
567 * First, have we been assigned any memory?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
568 bsr Initchk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
569 * Now, if carry is clear, we have some memory, go
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
570 bcc ReadOk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
571 rts return the error condition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
572
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
573 ReadOk tst OurLink,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
574 beq ReadOk1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
575 bsr Linkus bsr ChkLink
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
576 ReadOk1 pshs u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
577 bsr L01C2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
578 bcs L01C0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
579 tfr d,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
580 lda <u0046,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
581 ldb <D.SysTsk u00D0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
582 ldu $08,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
583 bra L01B9
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
584 ************ A separate linker
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
585 Linkus pshs x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
586 ldx PD.DVT,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
587 inc V$USRS,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
588 * ldy OurDesc,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
589 * ldd M$Name,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
590 * leax d,y point to device name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
591 * ldd <D.Proc this is temp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
592 * pshs d save it as no time slicing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
593 * ldd <D.SysPrc takes place while
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
594 * std <D.Proc this is in effect!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
595 * clra any type/lang
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
596 * os9 I$Attach
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
597 * puls d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
598 * std <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
599 * bcc LinkusOK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
600 * os9 F$Exit take error with us
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
601 LinkusOK puls x and restore our entry values
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
602 clr OurLink,u so we don't re-attach us again
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
603 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
604
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
605 Write equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
606 bsr Initchk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
607 bcc WriteOk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
608 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
609 WriteOk tst OurLink,u has it been done?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
610 beq WriteOk1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
611 bsr Linkus
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
612 WriteOk1 pshs u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
613 bsr L01C2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
614 bcs L01C0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
615 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
616 lda <D.SysTsk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
617 ldb <u0046,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
618 ldx $08,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
619 puls u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
620 L01B9 ldy #$0100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
621 os9 F$Move
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
622 L01C0 puls pc,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
623 L01C2 pshs x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
624 tstb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
625 bne L01F1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
626 L01C7 cmpx <u0010,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
627 bcc L01F1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
628 tfr x,d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
629
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
630 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
631 lsrd /2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
632 lsrd /4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
633 lsrd /8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
634 lsrd /16
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
635 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
636 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
637 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
638 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
639 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
640 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
641 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
642 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
643 rorb
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
644 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
645
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
646 andb #$FE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
647 L01D8 ldx <u0038,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
648 beq L01F5
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
649 ldd d,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
650 beq L01F5
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
651 leax <u0040,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
652 std <$40,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
653 os9 F$SetTsk
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
654 lda $01,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
655 anda #$1F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
656 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
657 puls pc,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
658 L01F1 ldb #$F1 load the error code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
659 bra L01F7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
660 L01F5 ldb #$F4 load the error code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
661 L01F7 orcc #$01 set the carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
662 puls pc,x and go home with the error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
663 SGtat comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
664 ldb #$D0 #E$IllMode
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
665 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
666 Term equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
667 pshs u
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
668 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
669 ldw <u0036,u
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
670 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
671 ldy <u0036,u
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
672 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
673
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
674 ldu <u0038,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
675 beq L022A
1347
89572d423498 Made case fixes
boisy
parents: 0
diff changeset
676 L020A ldb #$01 is now the same as F$AllRAM loop in
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
677 ldx ,u++ the Init routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
678 beq L0213 this fixed some loose
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
679 os9 F$DelRAM ends mmap showed
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
680 L0213 equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
681
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
682 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
683 decw was leay -$01,y
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
684 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
685 leay -1,y
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
686 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
687
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
688 bne L020A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
689 ldu ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
690 ldd <u0036,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
691 cmpd #$0020
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
692 bls L022A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
693
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
694 IFNE H6309
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
695 lsld
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
696 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
697 lslb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
698 rora
1529
e6cc61505ca7 Rodney does it again!
boisy
parents: 1348
diff changeset
699 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
700
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
701 ldu <u0038,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
702 os9 F$SRtMem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
703 L022A clra to remove, clrb here
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
704 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
705 puls u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
706 std Initstt,u and "comment" us out
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
707 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
708
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
709 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
710 eom equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
711 end
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
712
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
713 * a parking place for the snoop code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
714 * pshs cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
715 * os9 F$RegDmp lets take a look
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
716 * puls cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
717 * end of the snoop code, 4 %&$# lines!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
718