annotate level1/modules/boot_d64.asm @ 2720:482a547d5155 lwtools-port

Fixed so OP_DWINIT puts response in globals OP_SETTIME not sent unless response from OP_DWINIT from server is 128
author Boisy Pitre <boisy.pitre@nuance.com>
date Thu, 26 Jul 2012 12:19:43 -0500
parents 58bb6cac8939
children f3179a938345
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
19 *
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
20 * 2005-06-16, P.Harvey-Smith.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
21 * Added NMI enable/disable code, as I know know how to enable/disable
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
22 * NMI on the Alpha, having disasembled the Alpha's OS9's ddisk.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
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
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
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
2e37b5a0d4b3 set PORT var
boisy
parents: 1975
diff changeset
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
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
50 IFNE dalpha
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
56 DPPIADA EQU DPPIA2DA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
57 DPPIACRA EQU DPPIA2CRA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
58 DPPIADB EQU DPPIA2DB
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
59 DPPIACRB EQU DPPIA2CRB
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
60
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
61 PIADA EQU DPPIADA+IO ; Side A Data/DDR
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
62 PIACRA EQU DPPIACRA+IO ; Side A Control.
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
63 PIADB EQU DPPIADB+IO ; Side A Data/DDR
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
67 DPCMDREG EQU DPCmdRegA ; command/status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
68 DPTRKREG EQU DPTrkRegA ; Track register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
69 DPSECREG EQU DPSecRegA ; Sector register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
72 CMDREG EQU DPCMDREG+IO ; command/status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
73 TRKREG EQU DPTRKREG+IO ; Track register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
74 SECREG EQU DPSECREG+IO ; Sector register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
77 ; Disk IO bitmasks
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
78
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
79 NMIEn EQU NMIEnA
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
80 WPCEn EQU WPCEnA
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
81 SDensEn EQU SDensEnA
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
93 DPPIADA EQU DPPIA1DA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
94 DPPIACRA EQU DPPIA1CRA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
95 DPPIADB EQU DPPIA1DB
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
96 DPPIACRB EQU DPPIA1CRB
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
97
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
98 PIADA EQU DPPIADA+IO ; Side A Data/DDR
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
99 PIACRA EQU DPPIACRA+IO ; Side A Control.
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
100 PIADB EQU DPPIADB+IO ; Side A Data/DDR
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
104 DPCMDREG EQU DPCmdRegD ; command/status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
105 DPTRKREG EQU DPTrkRegD ; Track register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
106 DPSECREG EQU DPSecRegD ; Sector register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
109 CMDREG EQU DPCMDREG+IO ; command/status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
110 TRKREG EQU DPTRKREG+IO ; Track register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
111 SECREG EQU DPSECREG+IO ; Sector register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
114 ; Disk IO bitmasks
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
115
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
116 NMIEn EQU NMIEnD
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
117 WPCEn EQU WPCEnD
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
118 SDensEn EQU SDensEnD
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
119 MotorOn EQU MotorOnD
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
144
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
145 tylg set Systm+Objct
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
146 atrv set ReEnt+rev
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
147 rev set $01
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
148
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
168 size equ .
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
169
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
170 name equ *
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
171 fcs /Boot/
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
179
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
180 HWInit clra
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
181 ldx #CMDREG ; Force inturrupt
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
182 lda #FrcInt
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
183 sta ,x
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
184 lbsr Delay ; Wait for command to complete
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
188 IFNE dalpha
1896
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
193 lda #$FF
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
194 sta CurrentTrack,u
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
195 leax >NMIService,pcr ; Setup NMI Handler.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
196 stx >D.XNMI+1
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
197 lda #$7E ; $7E=JMP
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
198 sta >D.XNMI
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
199
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
204 IFNE dalpha
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
205 lbsr AlphaDskCtl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
206 ELSE
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
207 sta >DSKCTL
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
208 ENDC
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
209
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
210 ldd #$C350 ; Delay while motors spin up
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
211 MotorOnDelay
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
212 nop
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
213 nop
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
214 subd #$0001
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
2049
0cf8513d33d7 Updated for new structure
boisy
parents: 2037
diff changeset
220 use boot_common.asm
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
221
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
222 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
223 ; Reset disk heads to track 0
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
224 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
225
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
226 ResetTrack0
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
227 clr CurrentTrack,u ; Zero current track
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
228 lda #$05
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
229 L00A9 ldb #StpICmnd+StepRate ; Step in
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
230 pshs a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
231 lbsr CommandWaitReady
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
232 puls a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
233 deca
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
236 lbra CommandWaitReady
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
237
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
238 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
239 ; Read a sector off disk.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
250 lda #$91 ; Retry count
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
251 bsr ReadDataWithRetry ; Yes read sector
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
254 clrb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
255 ReadDataExit
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1838
diff changeset
256 rts
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
257
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
258 ReadDataRetry
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
259 bcc ReadDataWithRetry ; Retry data read if error
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
260 pshs x,b,a
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
261 bsr ResetTrack0 ; Recal drive
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
262 puls x,b,a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
263
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
266 bsr DoReadData ; Try reading data
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
267 puls x,b,a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
270 bne ReadDataRetry ; retry read on error
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
271
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
272 DoReadData
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
273 bsr SeekTrack ; Seek to correct track
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
277 orcc #$50 ; Enable FIRQ=DRQ from WD
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
292 IFNE dalpha
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1838
diff changeset
293 lbsr AlphaDskCtl
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
294 ELSE
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1838
diff changeset
295 sta <dpdskctl
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
296 ENDIF
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
297
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
300 stb <dpcmdreg
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1838
diff changeset
301
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
302 IFNE dalpha
1896
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
307 ReadDataWait
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
310 lda <dpdatareg ; in memory at X
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
311 ldb <dppiadb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
312 sta ,x+
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
313 bra ReadDataWait ; We break out with an NMI
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
314 ;
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
315 ; NMI service routine.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
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
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
320 leas R$Size,s ; Drop saved Regs from stack
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
321 lda #MotorOn
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
322
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
323 IFNE dalpha
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
327 ELSE
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
328 sta <dpdskctl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
329 ENDIF
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
330
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
331 lda #$34 ; Disable FIRQ inturrupt
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
332 sta <dppiacrb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
333 ldb <dpcmdreg
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
334 puls y,dp,cc
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1838
diff changeset
335
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
336 bitb #$04 ; Check for error
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
337 lbeq L015A
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
338 L011A comb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
339 ldb #$F4
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
340 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
341
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
342 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
343 ; Seek to a track, at this point Y still points to
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
344 ; in memory copy of LSN0 (if not reading LSN0 !).
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
345 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
349 tfr x,d
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
350 cmpd #$0000 ; LSN0 ?
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
351 beq SeekCalcSkip
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
352 clr ,-s ; Zero track counter
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
353 bra L012E
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
354
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
359 addd DD.Spt,Y ; Compensate for over-loop
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
362 ; At this point the A contains the track number,
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
363 ; and B contains the sector number on that track.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
364
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
365 SeekCalcSkip
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
366 pshs b ; Save sector number
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
367
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
368 LDB DD.Fmt,Y ; Is the media double sided ?
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
369 LSRB
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
370 BCC DiskSide0 ; skip if not
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
373 BCC DiskSide0 ; Even track no so it's on side 0
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
374 ldb #Sid2Sel ; Odd track so on side 1, flag it
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
375 bra SetSide
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
376
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
381
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
382 puls b ; Get sector number
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
383 incb
1963
4b599621c682 Moved to using new boot_common/hardware dependent boot system
afra
parents: 1896
diff changeset
384 stb SECREG
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
387 cmpa CurrentTrack,u
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
388 beq L0158
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
391 ldb #SeekCmnd+3 ; Seek command+ step rate code $13
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
392 bsr CommandWaitReady
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
393 pshs x
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
394
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
395 ldx #$222E ; Wait for head to settle.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
396 SettleWait
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
397 leax -$01,x
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
398 bne SettleWait
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
399
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
400 puls x
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
401 L0158 clrb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
402 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
408
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
409 CommandWaitReady
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
410 bsr MotorOnCmdBDelay ; Turn on motor and give command to WD
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
411 CommandWait
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
412 ldb >CMDREG ; Get command status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
413 bitb #$01 ; finished ?
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
414 bne CommandWait ; nope : continue waiting.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
415 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
416
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
420 IFNE dalpha
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
421 bsr AlphaDskCtl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
422 ELSE
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
423 sta >DSKCTL
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
424 ENDIF
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
425
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
426 stb >CMDREG ; Give command from B
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
427 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
428
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
429 MotorOnCmdBDelay
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
430 bsr MotorOnCmdB
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
431 Delay lbsr Delay2
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
432 Delay2 lbsr Delay3
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
433 Delay3 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
434
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
435 IFNE dalpha
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
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
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
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
451 sta -1,s
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1838
diff changeset
452
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
453 orcc #$50 ; disable inturrupts
1896
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
2103
58bb6cac8939 Update for new build system
afra
parents: 2049
diff changeset
463 lda -1,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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
470 PULS x,A,B,CC
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
471 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
472
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
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