Mercurial > hg > Members > kono > nitros9-code
comparison level1/modules/boot_1773.asm @ 1893:1827bb446188
Modified booters to use new boot strategy with boot_common.asm
author | boisy |
---|---|
date | Sat, 15 Oct 2005 15:32:45 +0000 |
parents | 5f8822fb42e0 |
children | 6d5bd8549d28 |
comparison
equal
deleted
inserted
replaced
1892:77d83b367eba | 1893:1827bb446188 |
---|---|
90 bootloc rmb 3 sector pointer; not byte pointer | 90 bootloc rmb 3 sector pointer; not byte pointer |
91 bootsize rmb 2 size in bytes | 91 bootsize rmb 2 size in bytes |
92 drvsel rmb 1 | 92 drvsel rmb 1 |
93 currtrak rmb 1 | 93 currtrak rmb 1 |
94 ddtks rmb 1 no. of sectors per track | 94 ddtks rmb 1 no. of sectors per track |
95 dblsided rmb 1 | 95 ddfmt rmb 1 |
96 side rmb 1 side 2 flag | 96 side rmb 1 side 2 flag |
97 size equ . | 97 size equ . |
98 | 98 |
99 name fcs /Boot/ | 99 name fcs /Boot/ |
100 fcb edition | 100 fcb edition |
101 | 101 |
102 start orcc #IntMasks ensure IRQs are off (necessary?) | 102 FLOPPY equ 1 |
103 leas -size,s | 103 |
104 tfr s,u get pointer to data area | |
105 pshs u save pointer to data area | |
106 | |
107 ************ START OF DEVICE-SPECIFIC INIT *********** | 104 ************ START OF DEVICE-SPECIFIC INIT *********** |
108 * HWInit - Initialize the device | 105 * HWInit - Initialize the device |
109 HWInit | 106 HWInit |
110 ldy Address,pcr get hardware address | 107 ldy Address,pcr get hardware address |
111 lda #%11010000 ($D0) Force Interrupt (stops any command in progress) | 108 lda #%11010000 ($D0) Force Interrupt (stops any command in progress) |
145 * nop | 142 * nop |
146 * nop | 143 * nop |
147 * ENDC | 144 * ENDC |
148 subd #$0001 4 cycles | 145 subd #$0001 4 cycles |
149 bne L003A 3 cycles | 146 bne L003A 3 cycles |
147 HWTerm rts | |
150 ************ END OF DEVICE-SPECIFIC INIT *********** | 148 ************ END OF DEVICE-SPECIFIC INIT *********** |
149 | |
150 use ../../6809l1/modules/boot_common.asm | |
151 | 151 |
152 * Request memory for LSN0 | |
153 ldd #256 get sector/fd buffer | |
154 os9 F$SRqMem get it! | |
155 bcs error2 | |
156 bsr getpntr restore U to point to our statics | |
157 | |
158 * Read LSN0 | |
159 clrb MSB sector | |
160 ldx #0 LSW sector | |
161 lbsr HWRead read LSN 0 | |
162 bcs error branch if error | |
163 | |
164 ifgt Level-1 | |
165 lda #'0 --- loaded in LSN0' | |
166 jsr <D.BtBug --- | |
167 endc | |
168 | |
169 * Pull relevant values from LSN0 | |
170 lda DD.TKS,x number of tracks on this disk | |
171 sta ddtks,u | |
172 lda DD.FMT,x disk format byte | |
173 sta dblsided,u | |
174 lda DD.BT,x os9boot pointer | |
175 sta bootloc,u | |
176 ldd DD.BT+1,x LSW of 24 bit address | |
177 std bootloc+1,u | |
178 ldd DD.BSZ,x os9boot size in bytes | |
179 beq FragBoot if zero, do frag boot | |
180 std bootsize,u | |
181 * Old style boot -- make a fake FD segment | |
182 leax FD.SEG,x | |
183 addd #$00FF round up to next page | |
184 * Important note: We are making an assumption that the upper 8 bits of the | |
185 * FDSL.B field will always be zero. That is a safe assumption, since an | |
186 * FDSL.B value of $00FF would mean the file is 65280 bytes. A bootfile | |
187 * under NitrOS-9 cannot be this large, and therefore this assumption | |
188 * is safe. | |
189 sta FDSL.B+1,x save file size | |
190 lda bootloc,u | |
191 sta FDSL.A,x | |
192 ldd bootloc+1,u | |
193 std FDSL.A+1,x save LSN of file (contiguous) | |
194 clr FDSL.S,x make next segment entry 0 | |
195 clr FDSL.S+1,x | |
196 clr FDSL.S+2,x | |
197 ldd bootsize,u | |
198 bra GrabBootMem | |
199 | |
200 Back2Krn ldx blockimg,u pointer to start of os9boot in memory | |
201 clrb clear carry | |
202 ldd bootsize,u | |
203 error2 leas 2+size,s reset the stack same as PULS U | |
204 rts return to kernel | |
205 | |
206 * Error point - return allocated memory and then return to kernel | |
207 error | |
208 * Return memory allocated for sector buffers | |
209 ldd #256 | |
210 ldu blockloc,u | |
211 os9 F$SRtMem | |
212 bra error2 | |
213 | |
214 * Routine to save off alloced mem from F$SRqMem into blockloc,u and restore | |
215 * the statics pointer in U | |
216 getpntr tfr u,d save pointer to requested memory | |
217 ldu 2,s recover pointer to data stack | |
218 std blockloc,u | |
219 rts | |
220 | |
221 * NEW! Fragmented boot support! | |
222 FragBoot ldb bootloc,u MSB fd sector location | |
223 ldx bootloc+1,u LSW fd sector location | |
224 lbsr HWRead get fd sector | |
225 ldd FD.SIZ+2,x get file size (we skip first two bytes) | |
226 std bootsize,u | |
227 leax FD.SEG,x point to segment table | |
228 | |
229 GrabBootMem | |
230 ifgt Level-1 | |
231 os9 F$BtMem | |
232 else | |
233 os9 F$SRqMem | |
234 endc | |
235 bcs error | |
236 bsr getpntr | |
237 std blockimg,u | |
238 | |
239 * Get os9boot into memory | |
240 BootLoop stx seglist,u update segment list | |
241 ldb FDSL.A,x MSB sector location | |
242 BL2 ldx FDSL.A+1,x LSW sector location | |
243 bne BL3 | |
244 tstb | |
245 beq Back2Krn | |
246 BL3 lbsr HWRead | |
247 inc blockloc,u point to next input sector in mem | |
248 | |
249 ifgt Level-1 | |
250 lda #'. Show .' | |
251 jsr <D.BtBug | |
252 endc | |
253 | |
254 ldx seglist,u get pointer to segment list | |
255 dec FDSL.B+1,x get segment size | |
256 beq NextSeg if <=0, get next segment | |
257 | |
258 ldd FDSL.A+1,x update sector location by one to 24bit word | |
259 addd #1 | |
260 std FDSL.A+1,x | |
261 ldb FDSL.A,x | |
262 adcb #0 | |
263 stb FDSL.A,x | |
264 bra BL2 | |
265 | |
266 NextSeg leax FDSL.S,x advance to next segment entry | |
267 bra BootLoop | |
268 | |
269 | |
270 | |
271 ************************************************************ | 152 ************************************************************ |
272 ************************************************************ | 153 ************************************************************ |
273 * Hardware-Specific Booter Area * | 154 * Hardware-Specific Booter Area * |
274 ************************************************************ | 155 ************************************************************ |
275 ************************************************************ | 156 ************************************************************ |
276 | 157 |
277 | 158 |
278 DoDDns lda #DDEN+MOTON double density enable and motor on | 159 DoDDns lda #DDEN+MOTON double density enable and motor on |
279 ora WhichDrv,pcr OR in selected drive | 160 ora WhichDrv,pcr OR in selected drive |
280 sta drvsel,u save drive selection byte | 161 sta drvsel,u save drive selection byte |
281 clr currtrak,u clear current track | 162 clr currtrak,u clear current track |
282 lda #$05 | 163 lda #$05 |
283 lbsr SetTrak Set the track to the head we want | 164 lbsr SetTrak Set the track to the head we want |
284 ldb #0+STEP RESTORE cmd | 165 ldb #0+STEP RESTORE cmd |
374 clr side,u start on side 1 | 255 clr side,u start on side 1 |
375 tfr x,d move LSN into D | 256 tfr x,d move LSN into D |
376 cmpd #$0000 zero? | 257 cmpd #$0000 zero? |
377 beq L016C branch if so | 258 beq L016C branch if so |
378 clr ,-s else clear space on stack | 259 clr ,-s else clear space on stack |
379 tst dblsided,u double sided disk? | 260 tst ddfmt,u double sided disk? |
380 beq SnglSid branch if not | 261 beq SnglSid branch if not |
381 bra DblSid | 262 bra DblSid |
382 * Double-sided code | 263 * Double-sided code |
383 L0152 com side,u flag side 2 | 264 L0152 com side,u flag side 2 |
384 bne DblSid | 265 bne DblSid |