Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/boot_1773.asm @ 2879:531841047512 lwtools-port
boot_scsi.asm: Fix SCSI ID when booting from SCSI
Due to a typo it would probe for SCSI ID 4 instead
of default 0 (or 8 for HDBDOS/SuperDriver).
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 24 Nov 2013 16:08:53 +0100 |
parents | bfe3de781ddf |
children | e0614e08fa5e |
rev | line source |
---|---|
230 | 1 ******************************************************************** |
1287 | 2 * Boot - WD1773 Boot module |
230 | 3 * |
4 * $Id$ | |
5 * | |
1287 | 6 * Edt/Rev YYYY/MM/DD Modified by |
7 * Comment | |
230 | 8 * ------------------------------------------------------------------ |
1287 | 9 * 4 1985/??/?? |
10 * Original Tandy distribution version. | |
11 * | |
12 * 6 1998/10/12 Boisy G. Pitre | |
13 * Obtained from L2 Upgrade archive, has 6ms step rate and disk timeout | |
14 * changes. | |
15 * | |
16 * 6r2 2003/05/18 Boisy G. Pitre | |
17 * Added '.' output for each sector for OS-9 L2 and NitrOS9 for | |
18 * Mark Marlette (a special request :). | |
1291
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
19 * |
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
20 * 6r3 2003/08/31 Robert Gault |
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
21 * Put BLOB-stop code in place, changed orb #$30 to orb #$28 |
1520 | 22 * |
23 * 6r4 2004/02/17 Rodney Hamilton | |
24 * Minor optimizations, improvements in source comments | |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
25 * |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
26 * 7 2005/10/10 Boisy G. Pitre |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
27 * Added fragmented bootfile support |
2007
ee587586c0ab
Drive motor now shut off before boot module returns to kernel
boisy
parents:
1965
diff
changeset
|
28 * |
1891 | 29 * 7 2005/10/13 Robert Gault |
30 * Changed timing loops for H6309L2 so that code shortened enough to | |
31 * fit within the $1D0 boundary. | |
2007
ee587586c0ab
Drive motor now shut off before boot module returns to kernel
boisy
parents:
1965
diff
changeset
|
32 * |
ee587586c0ab
Drive motor now shut off before boot module returns to kernel
boisy
parents:
1965
diff
changeset
|
33 * 8 2006/03/03 Boisy G. Pitre |
ee587586c0ab
Drive motor now shut off before boot module returns to kernel
boisy
parents:
1965
diff
changeset
|
34 * Drive motors now turned off before returning to kernel. |
2065 | 35 * |
36 * 9 2006/05/05 Boisy G. Pitre | |
37 * Fixed bug where single sided booting was broken | |
2068 | 38 * |
39 * 2006/06/04 Boisy G. Pitre | |
40 * Removed hard-coded value of #18 when adding back sectors per track and replaced | |
41 * with the appropriate value: ddtks,u | |
230 | 42 |
210
6bf55704c623
Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents:
201
diff
changeset
|
43 nam Boot |
1287 | 44 ttl WD1773 Boot module |
0 | 45 |
1287 | 46 IFP1 |
0 | 47 use defsfile |
1287 | 48 ENDC |
0 | 49 |
1520 | 50 * FDC Control Register bits at $FF40 |
51 HALTENA equ %10000000 | |
52 SIDESEL equ %01000000 DRVSEL3 if no DS drives | |
53 DDEN equ %00100000 | |
54 READY equ %00010000 READY for Tandy WD1773-based controllers | |
1516 | 55 MOTON equ %00001000 |
1520 | 56 DRVSEL2 equ %00000100 |
1516 | 57 DRVSEL1 equ %00000010 |
58 DRVSEL0 equ %00000001 | |
59 | |
1709 | 60 * Default Boot is from drive 0 |
1520 | 61 BootDr set DRVSEL0 |
1709 | 62 IFEQ DNum-1 |
63 BootDr set DRVSEL1 Alternate boot from drive 1 | |
64 ENDC | |
65 IFEQ DNum-2 | |
66 BootDr set DRVSEL2 Alternate boot from drive 2 | |
67 ENDC | |
68 IFEQ DNum-3 | |
69 BootDr set SIDESEL Alternate boot from drive 3 | |
70 ENDC | |
1520 | 71 |
72 * WD17x3 DPort offsets | |
73 CONTROL equ 0 | |
74 CMDREG equ 8+0 write-only | |
75 STATREG equ CMDREG read-only | |
1516 | 76 TRACKREG equ 8+1 |
77 SECTREG equ 8+2 | |
78 DATAREG equ 8+3 | |
79 | |
1515 | 80 * Sector Size |
81 SECTSIZE equ 256 | |
82 | |
1520 | 83 * Step Rates: |
84 * $00 = 6ms | |
85 * $01 = 12ms | |
86 * $02 = 20ms | |
87 * $03 = 30ms | |
2770
bfe3de781ddf
Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2068
diff
changeset
|
88 IFNDEF STEP |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
1166
diff
changeset
|
89 STEP set $00 |
2770
bfe3de781ddf
Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2068
diff
changeset
|
90 ENDC |
210
6bf55704c623
Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents:
201
diff
changeset
|
91 |
1287 | 92 tylg set Systm+Objct |
0 | 93 atrv set ReEnt+rev |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
94 rev set $00 |
2065 | 95 edition set 9 |
230 | 96 |
0 | 97 mod eom,name,tylg,atrv,start,size |
230 | 98 |
1520 | 99 * NOTE: these are U-stack offsets, not DP |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
100 seglist rmb 2 pointer to segment list |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
101 blockloc rmb 2 pointer to memory requested |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
102 blockimg rmb 2 duplicate of the above |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
103 bootsize rmb 2 size in bytes |
1965 | 104 LSN0Ptr rmb 2 In memory LSN0 pointer |
1515 | 105 drvsel rmb 1 |
1514 | 106 currtrak rmb 1 |
1894 | 107 * Note, for optimization purposes, the following two variables |
108 * should be adjacent!! | |
1514 | 109 ddtks rmb 1 no. of sectors per track |
1893
1827bb446188
Modified booters to use new boot strategy with boot_common.asm
boisy
parents:
1891
diff
changeset
|
110 ddfmt rmb 1 |
1520 | 111 side rmb 1 side 2 flag |
0 | 112 size equ . |
113 | |
114 name fcs /Boot/ | |
230 | 115 fcb edition |
0 | 116 |
1894 | 117 * Common booter-required defines |
118 LSN24BIT equ 0 | |
1893
1827bb446188
Modified booters to use new boot strategy with boot_common.asm
boisy
parents:
1891
diff
changeset
|
119 FLOPPY equ 1 |
1827bb446188
Modified booters to use new boot strategy with boot_common.asm
boisy
parents:
1891
diff
changeset
|
120 |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
121 * HWInit - Initialize the device |
1894 | 122 * Entry: Y = hardware address |
123 * Exit: Carry Clear = OK, Set = Error | |
124 * B = error (Carry Set) | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
125 HWInit |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
126 lda #%11010000 ($D0) Force Interrupt (stops any command in progress) |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
127 sta CMDREG,y write command to command register |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
128 lbsr Delay2 delay 54~ |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
129 lda STATREG,y clear status register |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
130 lda #$FF |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
131 sta currtrak,u set current track to 255 |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
132 leax >NMIRtn,pcr point to NMI routine |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
133 IFGT Level-1 |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
134 stx <D.NMI save address |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
135 ELSE |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
136 stx >D.XNMI+1 save address |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
137 lda #$7E |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
138 sta >D.XNMI |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
139 ENDC |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
140 lda #MOTON turn on drive motor |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
141 ora WhichDrv,pcr |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
142 sta CONTROL,y |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
143 * MOTOR ON spin-up delay loop (~307 mSec) |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
144 IFGT Level-1 |
1891 | 145 IFNE H6309 |
146 ldd #$F000 3 cycles | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
147 ELSE |
1891 | 148 ldd #50000 |
149 ENDC | |
150 ELSE | |
151 ldd #25000 | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
152 ENDC |
1891 | 153 * IFNE H6309 |
154 * nop | |
155 * ENDC | |
156 L003A nop 1 cycles | |
157 nop 1 cycles | |
158 * IFNE H6309 | |
159 * nop | |
160 * nop | |
161 * nop | |
162 * ENDC | |
163 subd #$0001 4 cycles | |
164 bne L003A 3 cycles | |
1894 | 165 * HWTerm - Terminate the device |
166 * Entry: Y = hardware address | |
167 * Exit: Carry Clear = OK, Set = Error | |
168 * B = error (Carry Set) | |
169 HWTerm clrb | |
2007
ee587586c0ab
Drive motor now shut off before boot module returns to kernel
boisy
parents:
1965
diff
changeset
|
170 stb CONTROL,y turn off all drive motors (BGP) |
1894 | 171 rts |
172 | |
1893
1827bb446188
Modified booters to use new boot strategy with boot_common.asm
boisy
parents:
1891
diff
changeset
|
173 |
2049 | 174 use boot_common.asm |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
175 |
210
6bf55704c623
Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents:
201
diff
changeset
|
176 |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
177 DoDDns lda #DDEN+MOTON double density enable and motor on |
1893
1827bb446188
Modified booters to use new boot strategy with boot_common.asm
boisy
parents:
1891
diff
changeset
|
178 ora WhichDrv,pcr OR in selected drive |
1516 | 179 sta drvsel,u save drive selection byte |
180 clr currtrak,u clear current track | |
0 | 181 lda #$05 |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
182 lbsr SetTrak Set the track to the head we want |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
183 ldb #0+STEP RESTORE cmd |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
184 lbra Talk2FDC send command and wait for it to complete |
0 | 185 |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
186 * HWRead - Read a 256 byte sector from the device |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
187 * Entry: Y = hardware address |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
188 * B = bits 23-16 of LSN |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
189 * X = bits 15-0 of LSN |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
190 * blockloc,u = ptr to 256 byte sector |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
191 * Exit: X = ptr to data (i.e. ptr in blockloc,u) |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
192 HWRead lda #$91 |
1515 | 193 bsr L00DF else branch subroutine |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
194 bcs HWRRts branch if error |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
195 ldx blockloc,u get buffer pointer in X for caller |
1287 | 196 clrb |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
197 HWRRts rts |
1287 | 198 |
199 L00D7 bcc L00DF | |
0 | 200 pshs x,b,a |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
201 bsr DoDDns |
0 | 202 puls x,b,a |
1515 | 203 L00DF pshs x,b,a save LSN, command |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
204 bsr ReadSect |
1520 | 205 puls x,b,a restore LSN, command |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
206 bcc HWRRts branch if OK |
1287 | 207 lsra |
208 bne L00D7 | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
209 ReadSect bsr Seek2Sect seek to the sector stored in X |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
210 bcs HWRRts if error, return to caller |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
211 ldx blockloc,u get address of buffer to fill |
1515 | 212 orcc #IntMasks mask interrupts |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
213 pshs x save X |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
214 ldx #$FFFF |
1516 | 215 ldb #%10000000 ($80) READ SECTOR command |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
216 stb CMDREG,y write to command register |
1520 | 217 ldb drvsel,u (DDEN+MOTORON+BootDr) |
218 * NOTE: The 1773 FDC multiplexes the write precomp enable and ready | |
219 * signals on the ENP/RDY pin, so the READY bit must always be ON for | |
220 * read and seek commands. (from the FD502 FDC Service Manual) | |
221 orb #DDEN+READY set DDEN+READY bits ($30) | |
222 tst side,u are we on side 2? | |
1287 | 223 beq L0107 |
1520 | 224 orb #SIDESEL set side 2 bit |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
225 L0107 stb CONTROL,y |
1520 | 226 lbsr Delay2 delay 54~ |
227 orb #HALTENA HALT enable ($80) | |
228 * lda #%00000010 RESTORE cmd ($02) | |
1516 | 229 *L0111 bita >DPort+STATREG |
1291
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
230 * bne L0123 |
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
231 * leay -$01,y |
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
232 * bne L0111 |
1515 | 233 * lda drvsel,u |
1520 | 234 * sta >DPort+CONTROL |
1291
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
235 * puls y |
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
236 * bra L0138 |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
237 stb CONTROL,y |
1291
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
238 nop |
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
239 nop |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
240 * bra L0123 |
1516 | 241 |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
242 ldx ,s get X saved earlier |
1516 | 243 * Sector READ Loop |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
244 L0123 lda DATAREG,y read from WD DATA register |
0 | 245 sta ,x+ |
1520 | 246 * stb >DPort+CONTROL |
1291
92e9f7416fc9
Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents:
1287
diff
changeset
|
247 nop |
1287 | 248 bra L0123 |
1520 | 249 * RVH NOTE: This ONLY works for double density boot disks! The Tandy |
250 * controllers internally gate HALT enable with the DDEN bit, which | |
251 * means that reading a single-density boot disk will not generate the | |
252 * NMI signal needed to exit the read loop! Single-density disks must | |
253 * use a polled I/O loop instead. | |
1515 | 254 NMIRtn leas R$Size,s adjust stack |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
255 puls x |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
256 ldb STATREG,y read WD STATUS register |
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
257 bitb #$9C any errors? |
1516 | 258 * bitb #$04 LOST DATA bit set? |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
259 beq r@ branch if not |
1516 | 260 * beq ChkErr branch if not |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
261 L0138 comb else we will return error |
210
6bf55704c623
Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents:
201
diff
changeset
|
262 ldb #E$Read |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
263 r@ rts |
0 | 264 |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
265 Seek2Sect |
2065 | 266 lda #MOTON permit alternate drives |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
267 ora WhichDrv,pcr permit alternate drives |
1516 | 268 sta drvsel,u save byte to static mem |
1520 | 269 clr side,u start on side 1 |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
270 tfr x,d move LSN into D |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
271 cmpd #$0000 zero? |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
272 beq L016C branch if so |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
273 clr ,-s else clear space on stack |
2065 | 274 pshs a |
275 lda ddfmt,u | |
276 bita #FMT.SIDE double sided disk? | |
277 puls a | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
278 beq SnglSid branch if not |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
279 bra DblSid |
1515 | 280 * Double-sided code |
1520 | 281 L0152 com side,u flag side 2 |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
282 bne DblSid |
210
6bf55704c623
Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents:
201
diff
changeset
|
283 inc ,s |
2065 | 284 DblSid subb ddtks,u |
210
6bf55704c623
Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents:
201
diff
changeset
|
285 sbca #$00 |
1287 | 286 bcc L0152 |
287 bra L0168 | |
288 L0160 inc ,s | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
289 SnglSid subb ddtks,u subtract sectors per track from B |
210
6bf55704c623
Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents:
201
diff
changeset
|
290 sbca #$00 |
1287 | 291 bcc L0160 |
2068 | 292 L0168 addb ddtks,u add sectors per track |
293 puls a get current track indicator off of stack | |
1287 | 294 L016C incb |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
295 stb SECTREG,y save in sector register |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
296 SetTrak ldb currtrak,u get current track in B |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
297 stb TRACKREG,y save in track register |
1520 | 298 cmpa currtrak,u same as A? |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
299 beq rtsok branch if so |
1514 | 300 sta currtrak,u |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
301 sta DATAREG,y |
1516 | 302 ldb #$10+STEP SEEK command |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
303 bsr Talk2FDC send command to controller |
0 | 304 pshs x |
1520 | 305 * Seek Delay |
306 ldx #$222E delay ~39 mSec (78mS L1) | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
307 SeekDly leax -$01,x |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
308 bne SeekDly |
0 | 309 puls x |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
310 rtsok clrb |
1287 | 311 rts |
1516 | 312 |
313 *ChkErr bitb #$98 evaluate WD status (READY, RNF, CRC err) | |
314 * bne L0138 | |
315 * clrb | |
316 * rts | |
317 | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
318 Talk2FDC bsr DoCMD issue FDC cmd, wait 54~ |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
319 FDCLoop ldb STATREG,y get status |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
320 bitb #$01 still BUSY? |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
321 bne FDCLoop loop until command completes |
1287 | 322 rts |
1516 | 323 |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
324 * Issue command and wait 54 clocks |
1520 | 325 * Controller requires a min delay of 14uS (DD) or 28uS (SD) |
326 * following a command write before status register is valid | |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
327 DoCMD bsr SelNSend |
1515 | 328 * Delay branches |
1520 | 329 * 54 clock delay including bsr (=30uS/L2,60us/L1) |
1891 | 330 * H6309 code changed to reduce code size, RG |
331 IFEQ H6309 | |
1515 | 332 Delay2 |
333 lbsr Delay3 | |
334 Delay3 | |
335 lbsr Delay4 | |
336 Delay4 | |
1891 | 337 ELSE |
338 Delay2 lda #5 3 cycles | |
339 Delay3 exg a,a 5 cycles | 10*5 | |
340 deca 2 cycles | | |
341 bne Delay3 3 cycles | | |
1287 | 342 ENDC |
343 rts | |
210
6bf55704c623
Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents:
201
diff
changeset
|
344 |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
345 * Select And Send |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
346 * Entry: B = command byte |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
347 SelNSend lda drvsel,u |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
348 sta CONTROL,y |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
349 stb CMDREG,y |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
350 rts |
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
351 |
1166 | 352 IFGT Level-1 |
1287 | 353 * Filler to get $1D0 |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
354 Filler fill $39,$1D0-3-2-1-* |
1166 | 355 ENDC |
0 | 356 |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
357 Address fdb DPort |
1886
b151cc54904e
Added fragmented bootfile support. Added more labels and comments
boisy
parents:
1882
diff
changeset
|
358 WhichDrv fcb BootDr |
1882
c96f594fe098
Added fragmented boot support... needs additional testing.
boisy
parents:
1709
diff
changeset
|
359 |
0 | 360 emod |
361 eom equ * | |
48 | 362 end |