Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/boot_d64.asm @ 2037:2e37b5a0d4b3
set PORT var
author | boisy |
---|---|
date | Sat, 22 Apr 2006 19:33:51 +0000 |
parents | 434d4bf3895b |
children | 0cf8513d33d7 |
rev | line source |
---|---|
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
1 * |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
2 * Boot_d64, bootfile for Dragon 32/64, Dragon Alpha/Professional. |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
3 * |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
4 * 2004-11-07, P.Harvey-Smith. |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
5 * First disasembly and porting |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
6 * |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
7 * 2004-11-09, P.Harvey-Smith. |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
8 * Dragon Alpha code, I am not sure of how to disable NMI |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
9 * on the Alpha, it is simulated in software using the NMIFlag. |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
10 * |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
11 * See DDisk.asm for a fuller discription of how Dragon Alpha |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
12 * interface works. |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
13 * |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
14 * 2004-11-25, P.Harvey-Smith. |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
15 * Double sided Disk code added |
1734 | 16 * |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
17 * 2005-05-08, P.Harvey-Smith, |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
18 * Added code to force 5/8 line low on Alpha so correct clock selected. |
1734 | 19 * |
1838 | 20 * 2005-06-16, P.Harvey-Smith. |
21 * Added NMI enable/disable code, as I know know how to enable/disable | |
22 * NMI on the Alpha, having disasembled the Alpha's OS9's ddisk. | |
23 * | |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
24 * 2005-10-22, P.Harvey-Smith. |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
25 * Removed unused user stack variable (u0000). |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
26 * |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
27 * 2005-12-31, P.Harvey-Smith. |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
28 * Converted to using new boot system which can support fragmented |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
29 * boot files. |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
30 * |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
31 * 2006-01-08, P.Harvey-Smith. |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
32 * Fixed up steprate so that it is the same as that specified as the |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
33 * default when building NitrOS9, currently the distribution sets |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
34 * this to 12ms, as this seems to be the default for both the |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
35 * Dragon Data original 5.25" floppies, and for the Sony 3.5" |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
36 * drives in the Alpha. This allows NitrOS9 to boot correctly |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
37 * on Dragon Data 5.25" drives, and should also make booting on |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
38 * the Alpha much more relaiable. |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
39 * |
1838 | 40 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
41 nam Boot |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
42 ttl os9 system module |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
43 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
44 * Disassembled 1900/00/00 00:05:56 by Disasm v1.5 (C) 1988 by RML |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
45 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
46 ifp1 |
2037 | 47 use defsfile |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
48 endc |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
49 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
50 IFNE DragonAlpha |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
51 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
52 * Dragon Alpha has a third PIA at FF24, this is used for |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
53 * Drive select / motor control, and provides FIRQ from the |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
54 * disk controler. |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
55 |
1820 | 56 DPPIADA EQU DPPIA2DA |
57 DPPIACRA EQU DPPIA2CRA | |
58 DPPIADB EQU DPPIA2DB | |
59 DPPIACRB EQU DPPIA2CRB | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
60 |
1820 | 61 PIADA EQU DPPIADA+IO ; Side A Data/DDR |
62 PIACRA EQU DPPIACRA+IO ; Side A Control. | |
63 PIADB EQU DPPIADB+IO ; Side A Data/DDR | |
64 PIACRB EQU DPPIACRB+IO ; Side A Control. | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
65 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
66 ;WD2797 Floppy disk controler, used in Alpha Note registers in reverse order ! |
1820 | 67 DPCMDREG EQU DPCmdRegA ; command/status |
68 DPTRKREG EQU DPTrkRegA ; Track register | |
69 DPSECREG EQU DPSecRegA ; Sector register | |
70 DPDATAREG EQU DPDataRegA ; Data register | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
71 |
1820 | 72 CMDREG EQU DPCMDREG+IO ; command/status |
73 TRKREG EQU DPTRKREG+IO ; Track register | |
74 SECREG EQU DPSECREG+IO ; Sector register | |
75 DATAREG EQU DPDATAREG+IO ; Data register | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
76 |
1734 | 77 ; Disk IO bitmasks |
78 | |
1820 | 79 NMIEn EQU NMIEnA |
1734 | 80 WPCEn EQU WPCEnA |
81 SDensEn EQU SDensEnA | |
82 MotorOn EQU MotorOnA | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
83 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
84 ; Drive selects for non default boot drives. |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
85 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
86 DRVSEL0 EQU Drive0A |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
87 DRVSEL1 EQU Drive1A |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
88 DRVSEL2 EQU Drive2A |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
89 DRVSEL3 EQU Drive3A |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
90 |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
91 ELSE |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
92 |
1820 | 93 DPPIADA EQU DPPIA1DA |
94 DPPIACRA EQU DPPIA1CRA | |
95 DPPIADB EQU DPPIA1DB | |
96 DPPIACRB EQU DPPIA1CRB | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
97 |
1820 | 98 PIADA EQU DPPIADA+IO ; Side A Data/DDR |
99 PIACRA EQU DPPIACRA+IO ; Side A Control. | |
100 PIADB EQU DPPIADB+IO ; Side A Data/DDR | |
101 PIACRB EQU DPPIACRB+IO ; Side A Control. | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
102 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
103 ;WD2797 Floppy disk controler, used in DragonDos. |
1820 | 104 DPCMDREG EQU DPCmdRegD ; command/status |
105 DPTRKREG EQU DPTrkRegD ; Track register | |
106 DPSECREG EQU DPSecRegD ; Sector register | |
107 DPDATAREG EQU DPDataRegD ; Data register | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
108 |
1820 | 109 CMDREG EQU DPCMDREG+IO ; command/status |
110 TRKREG EQU DPTRKREG+IO ; Track register | |
111 SECREG EQU DPSECREG+IO ; Sector register | |
112 DATAREG EQU DPDATAREG+IO ; Data register | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
113 |
1734 | 114 ; Disk IO bitmasks |
115 | |
1820 | 116 NMIEn EQU NMIEnD |
1734 | 117 WPCEn EQU WPCEnD |
118 SDensEn EQU SDensEnD | |
119 MotorOn EQU MotorOnD | |
120 | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
121 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
122 ; Drive selects for non default boot drives. |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
123 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
124 DRVSEL0 EQU Drive0D |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
125 DRVSEL1 EQU Drive1D |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
126 DRVSEL2 EQU Drive2D |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
127 DRVSEL3 EQU Drive3D |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
128 |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
129 ENDC |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
130 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
131 * Default Boot is from drive 0 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
132 BootDr set DRVSEL0 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
133 IFEQ DNum-1 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
134 BootDr set DRVSEL1 Alternate boot from drive 1 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
135 ENDC |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
136 IFEQ DNum-2 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
137 BootDr set DRVSEL2 Alternate boot from drive 2 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
138 ENDC |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
139 IFEQ DNum-3 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
140 BootDr set DRVSEL3 Alternate boot from drive 3 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
141 ENDC |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
142 |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
143 StepRate EQU 3-STEP Convert OS9 steprate code to WD. |
1734 | 144 |
1820 | 145 tylg set Systm+Objct |
146 atrv set ReEnt+rev | |
147 rev set $01 | |
1734 | 148 |
1820 | 149 mod eom,name,tylg,atrv,start,size |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
150 ;BuffPtr rmb 2 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
151 ;SideSel rmb 1 ; Side select mask |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
152 ;CurrentTrack rmb 1 ; Current track number |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
153 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
154 * NOTE: these are U-stack offsets, not DP |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
155 seglist rmb 2 pointer to segment list |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
156 blockloc rmb 2 pointer to memory requested |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
157 blockimg rmb 2 duplicate of the above |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
158 bootsize rmb 2 size in bytes |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
159 LSN0Ptr rmb 2 In memory LSN0 pointer |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
160 drvsel rmb 1 |
1820 | 161 CurrentTrack rmb 1 ; Current track number |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
162 * Note, for optimization purposes, the following two variables |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
163 * should be adjacent!! |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
164 ddtks rmb 1 no. of sectors per track |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
165 ddfmt rmb 1 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
166 side rmb 1 side 2 flag |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
167 |
1820 | 168 size equ . |
1734 | 169 |
1820 | 170 name equ * |
171 fcs /Boot/ | |
172 fcb $00 | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
173 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
174 * Common booter-required defines |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
175 LSN24BIT equ 0 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
176 FLOPPY equ 1 |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
177 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
178 ;start equ * |
1820 | 179 |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
180 HWInit clra |
1820 | 181 ldx #CMDREG ; Force inturrupt |
1734 | 182 lda #FrcInt |
183 sta ,x | |
1820 | 184 lbsr Delay ; Wait for command to complete |
1734 | 185 lda ,x |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
186 lda piadb ; Clear DRQ from WD. |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
187 |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
188 IFNE DragonAlpha |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
189 lda #NMICA2Dis ; Set PIA2 CA2 as output & disable NMI |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
190 sta PIA2CRA |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
191 ENDC |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
192 |
1734 | 193 lda #$FF |
194 sta CurrentTrack,u | |
195 leax >NMIService,pcr ; Setup NMI Handler. | |
196 stx >D.XNMI+1 | |
1820 | 197 lda #$7E ; $7E=JMP |
1734 | 198 sta >D.XNMI |
199 | |
1820 | 200 lda #MotorOn ; Turn on motor |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
201 ora WhichDrv,pcr ; OR in selected drive |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
202 sta drvsel,u ; save drive selection byte |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
203 |
1820 | 204 IFNE DragonAlpha |
205 lbsr AlphaDskCtl | |
206 ELSE | |
207 sta >DSKCTL | |
208 ENDC | |
1734 | 209 |
1820 | 210 ldd #$C350 ; Delay while motors spin up |
1734 | 211 MotorOnDelay |
1820 | 212 nop |
1734 | 213 nop |
214 subd #$0001 | |
215 bne MotorOnDelay | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
216 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
217 HWTerm clrb |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
218 rts |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
219 |
2037 | 220 use ../../modules/boot_common.asm |
1734 | 221 |
222 ; | |
223 ; Reset disk heads to track 0 | |
224 ; | |
225 | |
226 ResetTrack0 | |
1820 | 227 clr CurrentTrack,u ; Zero current track |
1734 | 228 lda #$05 |
229 L00A9 ldb #StpICmnd+StepRate ; Step in | |
230 pshs a | |
231 lbsr CommandWaitReady | |
232 puls a | |
233 deca | |
234 bne L00A9 | |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
235 ldb #RestCmnd+StepRate ; Restore to track 0 |
1734 | 236 lbra CommandWaitReady |
237 | |
238 ; | |
239 ; Read a sector off disk. | |
240 ; | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
241 * HWRead - Read a 256 byte sector from the device |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
242 * Entry: Y = hardware address |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
243 * B = bits 23-16 of LSN |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
244 * X = bits 15-0 of LSN |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
245 * blockloc,u = ptr to 256 byte sector |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
246 * Exit: X = ptr to data (i.e. ptr in blockloc,u) |
1734 | 247 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
248 ReadSec |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
249 HWRead |
1820 | 250 lda #$91 ; Retry count |
1734 | 251 bsr ReadDataWithRetry ; Yes read sector |
252 bcs ReadDataExit ; And restore Y=LSN0 pointer | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
253 ldx blockloc,u |
1734 | 254 clrb |
255 ReadDataExit | |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
256 rts |
1734 | 257 |
258 ReadDataRetry | |
1820 | 259 bcc ReadDataWithRetry ; Retry data read if error |
1734 | 260 pshs x,b,a |
1820 | 261 bsr ResetTrack0 ; Recal drive |
1734 | 262 puls x,b,a |
263 | |
264 ReadDataWithRetry | |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
265 pshs x,b,a |
1820 | 266 bsr DoReadData ; Try reading data |
1734 | 267 puls x,b,a |
268 bcc ReadDataExit ; No error, return to caller | |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
269 lsra ; decrement retry count |
1734 | 270 bne ReadDataRetry ; retry read on error |
271 | |
272 DoReadData | |
1820 | 273 bsr SeekTrack ; Seek to correct track |
1734 | 274 bcs ReadDataExit ; Error : exit |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
275 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
276 ldx blockloc,u ; Set X=Data load address |
1820 | 277 orcc #$50 ; Enable FIRQ=DRQ from WD |
1734 | 278 pshs y,dp,cc |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
279 lda #$FF ; Make DP=$FF, so access to WD regs faster |
1734 | 280 tfr a,dp |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
281 |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
282 lda #$34 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
283 sta <dppia0crb ; Disable out PIA0 IRQ |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
284 |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
285 lda #$37 |
1820 | 286 sta <dppiacrb ; Enable FIRQ |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
287 lda <dppiadb ; Clear any pending FIRQ |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
288 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
289 lda drvsel,u |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
290 ora #NMIEn |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
291 |
1820 | 292 IFNE DragonAlpha |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
293 lbsr AlphaDskCtl |
1820 | 294 ELSE |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
295 sta <dpdskctl |
1820 | 296 ENDIF |
1734 | 297 |
1820 | 298 ldb #ReadCmnd ; Issue a read command |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
299 orb side,u ; mask in side select |
1820 | 300 stb <dpcmdreg |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
301 |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
302 IFNE DragonAlpha |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
303 lda #NMICA2En ; Enable NMI |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
304 sta <DPPIA2CRA |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
305 ENDIF |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
306 |
1734 | 307 ReadDataWait |
1820 | 308 sync ; Read data from controler, save |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
309 ReadDataNow |
1820 | 310 lda <dpdatareg ; in memory at X |
1734 | 311 ldb <dppiadb |
312 sta ,x+ | |
313 bra ReadDataWait ; We break out with an NMI | |
1838 | 314 ; |
315 ; NMI service routine. | |
316 ; | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
317 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
318 NMIService |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
319 |
1838 | 320 leas R$Size,s ; Drop saved Regs from stack |
1734 | 321 lda #MotorOn |
322 | |
1820 | 323 IFNE DragonAlpha |
324 lbsr AlphaDskCtl | |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
325 lda #NMICA2Dis ; Disable NMI |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
326 sta <DPPIA2CRA |
1820 | 327 ELSE |
328 sta <dpdskctl | |
329 ENDIF | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
330 |
1820 | 331 lda #$34 ; Disable FIRQ inturrupt |
1734 | 332 sta <dppiacrb |
333 ldb <dpcmdreg | |
334 puls y,dp,cc | |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
335 |
1820 | 336 bitb #$04 ; Check for error |
1734 | 337 lbeq L015A |
338 L011A comb | |
339 ldb #$F4 | |
340 rts | |
341 | |
342 ; | |
343 ; Seek to a track, at this point Y still points to | |
344 ; in memory copy of LSN0 (if not reading LSN0 !). | |
345 ; | |
346 | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
347 SeekTrack |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
348 ldy LSN0Ptr,u ; Get LSN0 pointer |
1734 | 349 tfr x,d |
1820 | 350 cmpd #$0000 ; LSN0 ? |
1734 | 351 beq SeekCalcSkip |
1820 | 352 clr ,-s ; Zero track counter |
1734 | 353 bra L012E |
354 | |
355 L012C inc ,s | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
356 L012E |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
357 subd DD.Spt,Y ; Take sectors per track from LSN |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
358 bcc L012C ; still +ve ? keep looping |
1820 | 359 addd DD.Spt,Y ; Compensate for over-loop |
360 puls a ; retrieve track count. | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
361 |
1734 | 362 ; At this point the A contains the track number, |
363 ; and B contains the sector number on that track. | |
364 | |
365 SeekCalcSkip | |
1820 | 366 pshs b ; Save sector number |
1734 | 367 |
1820 | 368 LDB DD.Fmt,Y ; Is the media double sided ? |
1734 | 369 LSRB |
1820 | 370 BCC DiskSide0 ; skip if not |
1734 | 371 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
372 LSRA ; Get bit 0 into CC, and divide track by 2 |
1820 | 373 BCC DiskSide0 ; Even track no so it's on side 0 |
374 ldb #Sid2Sel ; Odd track so on side 1, flag it | |
375 bra SetSide | |
1734 | 376 |
377 DiskSide0 | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
378 clrb ; Single sided, make sure sidesel set correctly |
1734 | 379 SetSide |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
380 stb side,U ; Set side |
1734 | 381 |
1820 | 382 puls b ; Get sector number |
383 incb | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
384 stb SECREG |
1734 | 385 ldb CurrentTrack,u |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
386 stb TRKREG |
1734 | 387 cmpa CurrentTrack,u |
388 beq L0158 | |
389 sta CurrentTrack,u | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
390 sta DATAREG |
1820 | 391 ldb #SeekCmnd+3 ; Seek command+ step rate code $13 |
1734 | 392 bsr CommandWaitReady |
393 pshs x | |
394 | |
1820 | 395 ldx #$222E ; Wait for head to settle. |
1734 | 396 SettleWait |
1820 | 397 leax -$01,x |
1734 | 398 bne SettleWait |
399 | |
400 puls x | |
401 L0158 clrb | |
402 rts | |
403 | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
404 L015A bitb #$98 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
405 bne L011A |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
406 clrb |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
407 rts |
1734 | 408 |
409 CommandWaitReady | |
1820 | 410 bsr MotorOnCmdBDelay ; Turn on motor and give command to WD |
1734 | 411 CommandWait |
1820 | 412 ldb >CMDREG ; Get command status |
413 bitb #$01 ; finished ? | |
414 bne CommandWait ; nope : continue waiting. | |
1734 | 415 rts |
416 | |
417 MotorOnCmdB | |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
418 lda drvsel,u ; Turn on motor |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
419 |
1820 | 420 IFNE DragonAlpha |
421 bsr AlphaDskCtl | |
422 ELSE | |
423 sta >DSKCTL | |
1734 | 424 ENDIF |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
425 |
1820 | 426 stb >CMDREG ; Give command from B |
1734 | 427 rts |
428 | |
429 MotorOnCmdBDelay | |
1820 | 430 bsr MotorOnCmdB |
1734 | 431 Delay lbsr Delay2 |
432 Delay2 lbsr Delay3 | |
433 Delay3 rts | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
434 |
1820 | 435 IFNE DragonAlpha |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
436 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
437 |
1975
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
438 ; |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
439 ; Turn on drives/motor/nmi for The Dragon Alpha. |
434d4bf3895b
Fixed up step rate to be same as default specified for descriptors at build
afra
parents:
1963
diff
changeset
|
440 ; |
1734 | 441 |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
442 AlphaDskCtl |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
443 PSHS X,A,B,CC |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
444 |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
445 bita #MotorOn ; test motor on ? |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
446 bne MotorRunning |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
447 |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
448 clra ; No, turn off other bits. |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
449 MotorRunning |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
450 anda #Mask58 ; Mask out 5/8 bit to force the use of 5.25" clock |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
451 sta ,s |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
452 |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
453 orcc #$50 ; disable inturrupts |
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
454 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
455 ldx #PIA2DA |
1820 | 456 lda #AYIOREG ; AY-8912 IO register |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
457 sta 2,X ; Output to PIA |
1820 | 458 ldb #AYREGLatch ; Latch register to modify |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
459 stb ,x |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
460 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
461 clr ,x ; Idle AY |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
462 |
1896
3826bfe7d2e5
Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents:
1838
diff
changeset
|
463 lda ,s+ ; Fetch saved Drive Selects etc |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
464 sta 2,x ; output to PIA |
1820 | 465 ldb #AYWriteReg ; Write value to latched register |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
466 stb ,x |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
467 |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
468 clr ,x |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
469 |
1820 | 470 PULS x,A,B,CC |
471 RTS | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
472 |
1820 | 473 ENDC |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
474 |
1963
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
475 Address fdb DPort |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
476 WhichDrv fcb BootDr |
4b599621c682
Moved to using new boot_common/hardware dependent boot system
afra
parents:
1896
diff
changeset
|
477 |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
478 emod |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
479 eom equ * |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff
changeset
|
480 end |