annotate level2/modules/ram.asm @ 1348:8e804211cb25

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