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