annotate level1/modules/ddisk.asm @ 2152:74fb212cb659

Changelog comes from higher up
author boisy
date Wed, 14 May 2008 02:13:22 +0000
parents 58bb6cac8939
children c505ae3120c4
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: 1533
diff changeset
1 ********************************************************************
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
2 * DDisk - Dragon Floppy driver
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
3 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
4 * $Id$
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
5 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
7 * Comment
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
8 * ------------------------------------------------------------------
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
9 * - ????/??/??
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
10 * Original Dragon Data distribution version
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
11 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
12 * Added Defines for IO ports.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
13 * 2004/11/09, P.Harvey-Smith
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
14 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
15 * Dragon Alpha code, 2004-11-09, P.Harvey-Smith.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
16 * I am not sure of how to disable NMI on the Alpha, it is
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
17 * simulated in software using the NMIFlag.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
18 *
1832
4ea2e417a48e Fix for non-booting Alpha port.
afra
parents: 1822
diff changeset
19 * The Dragon Alpha/Professional uses the same FDC chip as
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
20 * DragonDos, however it is mapped between FF2C and FF2F,
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
21 * also the register order is REVERSED, so command/status is at
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
22 * FF2F.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
23 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
24 * Drive Selects, motor and write precompensation is controled
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
25 * through the IO port of an AY-8912, which itself is connected
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
26 * to a 3rd PIA mapped at FF24 to FF27, this PIA also has it's
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
27 * inturrupt lines connected to the CPU's FIRQ.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
28 *
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
29 * 2004-11-15, P.Harvey-Smith.
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
30 * Fixed bug in inturrupt handling code that was making the
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
31 * Dragon Alpha crash if a disk was accessed with no disk
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
32 * in the drive. As the Alpha is using a simulated NMI disable
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
33 * we have to ensure that the NMI enabling routine has completed
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
34 * BEFORE isuing a command to the disk controler, or if the
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
35 * inturrupt happens in the middle of the enable routine it
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
36 * causes the machine to crash !
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
37 *
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
38 * 2004-11-24, P.Harvey-Smith.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
39 * Fixed up so that double sided disks now work, origional
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
40 * double sided code taken from Jon Bird's pages at :
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
41 * http://www.onastick.clara.net/dragon.html and modified
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
42 * for NitrOS9.
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
43 *
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
44 * 2004-11-27, P.Harvey-Smith.
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
45 * Reformatted with tab=8.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
46 *
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
47 * 2005-04-22, P.Harvey-Smith.
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
48 * Hopefully fixed a bug that was causing the Dragon 64 target to
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
49 * crash and burn when reading disks, this made a successfull boot
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
50 * almost imposible ! Fixed by writing disk command before writing
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
51 * disc control register, the Alpha target needs them the other way
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
52 * around. Still has a problem doing lots of retries.
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
53 *
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
54 * 2005-04-24, P.Harvey-Smith.
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
55 * Fixed constant lost data errors reading disks, again by slightly
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
56 * re-ordering the instructions in the read data loop.
1822
c074e97abf3d Removed debugging code/messages, tested successfully on real Dragons
afra
parents: 1821
diff changeset
57 *
c074e97abf3d Removed debugging code/messages, tested successfully on real Dragons
afra
parents: 1821
diff changeset
58 * 2005-04-24, P.Harvey-Smith.
c074e97abf3d Removed debugging code/messages, tested successfully on real Dragons
afra
parents: 1821
diff changeset
59 * Removed debugging code/messages.
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
60 *
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
61 * 2005-05-31, P.Harvey-Smith.
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
62 * Added ability to read, write and format standard OS-9 format disks
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
63 * including single denity, and disks with track 0 single denisity, but
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
64 * all other tracks double density.
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
65 *
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
66 * Added code to make step rates work as on the rb1773 driver, they where
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
67 * previously working back to front.
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
68 *
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
69 * 2005-06-06, P.Harvey-Smith.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
70 * Verified as working on a real Alpha, by Richard Harding.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
71 *
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
72 * 2005-06-16, P.Harvey-Smith.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
73 * Added NMI enable/disable code, as I know know how to enable/disable
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
74 * NMI on the Alpha, having disasembled the Alpha's OS9's ddisk.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
75 *
1842
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
76 * 2005-06-17, P.Harvey-Smith.
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
77 * Ok, this'll teach me to submit code before testing on the real hardware !
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
78 * Seperated NMI disable/drive select code on alpha, as above patches
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
79 * worked fine on Mess, but not on real hardware (timing problems).
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
80 *
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
81 * 2006-01-08, P.Harvey-Smith.
1970
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
82 * Added support for Dragon 32, that has had a memory upgraded to 64K,
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
83 * this is treated like the Dragon 64 EXCEPT that the code to manipulate
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
84 * the ACIA is not included. This is required due to the incomplete
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
85 * address decoding, writes to the non-existant ACIA would hit the PIA
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
86 * at FF00, and cause a crash.
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
87 *
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
88 * 2006-01-08, P.Harvey-Smith.
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
89 * Since I now have a genuine Dragon 5.25" drive, found that nitros format
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
90 * fell over accessing it, this was due to the step rate not being set
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
91 * correctly in the drive recalibrate routine, I ahve corrected this to
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
92 * use the value in the descriptor.
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
93 *
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
94
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
95 nam DDisk
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
96 ttl Dragon Floppy driver
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
97
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
98 * Disassembled 02/04/21 22:37:46 by Disasm v1.6 (C) 1988 by RML
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
99
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
100 ifp1
2037
2e37b5a0d4b3 set PORT var
boisy
parents: 1971
diff changeset
101 use defsfile
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
102 endc
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
103
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
104 IFNE dalpha
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
105
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
106 * 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: 1533
diff changeset
107 * Drive select / motor control, and provides FIRQ from the
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
108 * disk controler.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
109
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
110 DPPIADA EQU DPPIA2DA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
111 DPPIACRA EQU DPPIA2CRA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
112 DPPIADB EQU DPPIA2DB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
113 DPPIACRB EQU DPPIA2CRB
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
114
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
115 PIADA EQU DPPIADA+IO ; Side A Data/DDR
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
116 PIACRA EQU DPPIACRA+IO ; Side A Control.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
117 PIADB EQU DPPIADB+IO ; Side A Data/DDR
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
118 PIACRB EQU DPPIACRB+IO ; Side A Control.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
119
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
120 ;WD2797 Floppy disk controler, used in Alpha Note registers in reverse order !
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
121 DPCMDREG EQU DPCmdRegA ; command/status
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
122 DPTRKREG EQU DPTrkRegA ; Track register
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
123 DPSECREG EQU DPSecRegA ; Sector register
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
124 DPDATAREG EQU DPDataRegA ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
125
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
126 CMDREG EQU DPCMDREG+IO ; command/status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
127 TRKREG EQU DPTRKREG+IO ; Track register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
128 SECREG EQU DPSECREG+IO ; Sector register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
129 DATAREG EQU DPDATAREG+IO ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
130
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
131 ; Disk IO bitmasks
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
132
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
133 NMIEn EQU NMIEnA
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
134 WPCEn EQU WPCEnA
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
135 SDensEn EQU SDensEnA
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
136 MotorOn EQU MotorOnA
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
137
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
138 ; These are the bits that we know the function of on the Alpha interface
1832
4ea2e417a48e Fix for non-booting Alpha port.
afra
parents: 1822
diff changeset
139 KnownBits EQU Drive0A+Drive1A+Drive2A+Drive3A+MotorOnA+SDensEnA+WPCEnA
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
140
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
141 ELSE
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
142
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
143 DPPIADA EQU DPPIA1DA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
144 DPPIACRA EQU DPPIA1CRA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
145 DPPIADB EQU DPPIA1DB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
146 DPPIACRB EQU DPPIA1CRB
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
147
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
148 PIADA EQU DPPIADA+IO ; Side A Data/DDR
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
149 PIACRA EQU DPPIACRA+IO ; Side A Control.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
150 PIADB EQU DPPIADB+IO ; Side A Data/DDR
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
151 PIACRB EQU DPPIACRB+IO ; Side A Control.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
152
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
153 ;WD2797 Floppy disk controler, used in DragonDos.
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
154 DPCMDREG EQU DPCmdRegD ; command/status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
155 DPTRKREG EQU DPTrkRegD ; Track register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
156 DPSECREG EQU DPSecRegD ; Sector register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
157 DPDATAREG EQU DPDataRegD ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
158
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
159 CMDREG EQU DPCMDREG+IO ; command/status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
160 TRKREG EQU DPTRKREG+IO ; Track register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
161 SECREG EQU DPSECREG+IO ; Sector register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
162 DATAREG EQU DPDATAREG+IO ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
163
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
164 ; Disk IO bitmasks
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
165
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
166 NMIEn EQU NMIEnD
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
167 WPCEn EQU WPCEnD
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
168 SDensEn EQU SDensEnD
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
169 MotorOn EQU MotorOnD
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
170
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
171 ENDC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
172
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
173 tylg set Drivr+Objct
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
174 atrv set ReEnt+rev
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
175 rev set $00
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
176 edition set 3
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
177
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
178 MaxDrv set 4
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
179
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
180 mod eom,name,tylg,atrv,start,size
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
181
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
182 org DrvBeg
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
183 DrvTab RMB MaxDrv*DrvMem ; Drive tables, 1 per drive
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
184 CDrvTab rmb 2 ; Pointer to current drive table entry above
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
185 DrivSel rmb 1 ; Saved drive mask
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
186 Settle rmb 1 ; Head settle time
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
187 SavePIA0CRB rmb 1 ; Saved copy of PIA0 control reg b
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
188 SaveACIACmd rmb 1 ; Saved copy of ACIA command reg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
189 BuffPtr rmb 2 ; Buffer pointer
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
190 SideSel rmb 1 ; Side select.
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
191 Density rmb 1 ; Density 0=double, %00001000=single D64, %00100000=single Alpha
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
192
1822
c074e97abf3d Removed debugging code/messages, tested successfully on real Dragons
afra
parents: 1821
diff changeset
193 DskError rmb 1 ; hardware disk error
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
194
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
195 VIRQPak rmb 2 ; Vi.Cnt word for VIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
196 u00B3 rmb 2 ; Vi.Rst word for VIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
197 u00B5 rmb 1 ; Vi.Stat byte for VIRQ (drive motor timeout)
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
198
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
199 VIRQInstalled rmb 1 ; Is VIRQ Installed yet ?
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
200 size equ .
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
201
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
202 fcb $FF
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
203 name equ *
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
204 fcs /DDisk/
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
205 fcb edition
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
206
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
207 VIRQCnt fdb TkPerSec*4 Initial count for VIRQ (4 seconds)
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
208
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
209 start lbra Init ; Initialise Driver
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
210 lbra Read ; Read sector
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
211 lbra Write ; Write sector
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
212 lbra GetStat ; Get status
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
213 lbra SetStat ; Set status
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
214 lbra Term ; Terminate device
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
215
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
216 IRQPkt fcb $00 ; Normal bits (flip byte)
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
217 fcb $01 ; Bit 1 is interrupt request flag (Mask byte)
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
218 fcb 10 ; Priority byte
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
219
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
220
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
221 nop
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
222 nop
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
223 nop
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
224 lbsr ResetTrack0
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
225 * Init
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
226 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
227 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
228 * Y = address of device descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
229 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
230 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
231 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
232 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
233 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
234 *
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
235 DragonDebug EQU 0
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
236 Init
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
237 IFNE DragonDebug
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
238 pshs y ; This is here so I can find disk driver in mess
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
239 ldy #$AA55 ; by setting register breakpoint to y=$AA55 !
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
240 sty $8000
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
241 puls y
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
242 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
243
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
244 clra
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
245 sta >D.DskTmr ; Zero motor timer
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
246
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
247 IFNE dalpha ; Turn off all drives
1842
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
248 lbsr AlphaDskCtl
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
249
1842
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
250 lda #NMICA2Dis ; Set PIA2 CA2 as output & disable NMI
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
251 sta PIA2CRA
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
252
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
253 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
254 sta >DskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
255 ENDC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
256
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
257 ldx #CmdReg ; Reset controler
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
258 lda #FrcInt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
259 sta ,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
260 lbsr Delay
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
261 lda ,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
262 lda #$FF
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
263 ldb #MaxDrv
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
264 leax DrvBeg,u
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
265
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
266 InitDriveData
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
267 sta DD.Tot,x ; Set total sectors = $FF
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
268 sta <V.Trak,x ; Set current track = 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
269 leax <DrvMem,x ; Skip to next drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
270 decb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
271 bne InitDriveData
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
272
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
273 leax >NMIService,pcr ; Setup NMI handler
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
274 stx >D.XNMI+1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
275 lda #$7E ; $7E = JMP
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
276 sta >D.XNMI
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
277
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
278 clr VIRQInstalled,u ;flag not installed yet
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
279
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
280 pshs y ; save device dsc. ptr
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
281 leay >u00B5,u ; point to Vi.Stat in VIRQ packet
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
282 tfr y,d ; make it the status register ptr for IRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
283 leay >IRQSvc,pc ; point to IRQ service routine
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
284 leax >IRQPkt,pc ; point to IRQ packet
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
285 os9 F$IRQ ; install IRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
286 puls y ; Get back device dsc. ptr
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
287
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
288 ldd #$0100 ; Request a page of system ram
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
289 pshs u ; used to verify writes
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
290 os9 F$SRqMem
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
291 tfr u,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
292 puls u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
293 bcs Return
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
294 stx >BuffPtr,u ; Save verify page pointer
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
295 clrb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
296 Return rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
297
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
298
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
299 * GetStat
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
300 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
301 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
302 * A = function code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
303 * Y = address of path descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
304 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
305 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
306 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
307 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
308 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
309 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
310 GetStat
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
311
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
312 * Term
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
313 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
314 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
315 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
316 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
317 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
318 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
319 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
320 *
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
321 Term clrb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
322 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
323
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
324 * Read
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
325 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
326 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
327 * B = MSB of the disk's LSN
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
328 * X = LSB of the disk's LSN
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
329 * Y = address of path descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
330 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
331 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
332 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
333 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
334 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
335 *
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
336 Read
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
337 lda #$91 ; Retry count
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
338 cmpx #$0000 ; LSN ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
339 bne ReadDataWithRetry ; No : Just do read,
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
340 bsr ReadDataWithRetry ; Yes : do read and copy disk params
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
341 bcs ReadDataExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
342 ldx PD.Buf,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
343 pshs y,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
344 ldy >CDrvTab,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
345 ldb #DD.Siz-1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
346 L0082 lda b,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
347 sta b,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
348 decb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
349 bpl L0082
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
350 clrb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
351 puls pc,y,x
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
352 ReadDataExit
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
353 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
354
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
355 ; Read Retry
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
356
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
357 ReadDataRetry
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
358 bcc ReadDataWithRetry ; Retry entry point
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
359 pshs x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
360 lbsr ResetTrack0 ; Reset track 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
361 puls x,b,a
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
362
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
363 ReadDataWithRetry
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
364 pshs x,b,a ; Normal entry point
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
365 bsr DoReadData
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
366 puls x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
367 bcc ReadDataExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
368 lsra ; Check for retry
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
369 bne ReadDataRetry
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
370
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
371 DoReadData
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
372 lbsr SeekTrack
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
373 bcs ReadDataExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
374 ldx PD.Buf,y ; Target address for data
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
375 pshs y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
376 ldb #ReadCmnd ; Read command
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
377 bsr PrepDiskRW ; Prepare disk
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
378
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
379 DoReadDataLoop
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
380 lda <DPPIACRB ; Is data ready ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
381 bmi ReadDataReady ; Yes : read it
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
382
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
383 leay -1,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
384 bne DoReadDataLoop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
385 bsr RestoreSavedIO
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
386 puls y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
387 lbra RetReadError ; Return read error to caller
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
388
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
389 ReadDataWait
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
390 sync ; Sync to inturrupts, wait for data
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
391
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
392 ReadDataReady
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
393 lda <DPDataReg ; Read data from FDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
394 ldb <DPPIADB ; Clear PIA inturrupt status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
395 sta ,x+ ; save data in memory
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
396 bra ReadDataWait ; do next
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
397
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
398 ;
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
399 ; Prepare to do disk read/write.
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
400 ;
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
401
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
402 PrepDiskRW
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
403
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
404 clr DskError,u
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
405
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
406 lda #$FF ; Make DP=$FF, to make i/o faster
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
407 tfr a,dp
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
408
1970
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
409 ;
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
410 ; Do not attempt to talk to ACIA if this machine does not have one !
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
411 ;
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
412
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
413 IFEQ Upgraded32
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
414 lda <DPAciaCmd ; Save ACIA Command reg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
415 sta >SaveACIACmd,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
416 anda #$FE ; Disable ACIA inturrupt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
417 sta <DPAciaCmd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
418 bita #$40 ; Is Tx inturrupt enabled ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
419 beq L00DE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
420 L00D8 lda <DPAciaStat ; Yes, wait for Tx to complete
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
421 bita #$10
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
422 beq L00D8
1970
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
423 ENDC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
424
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
425 L00DE orcc #$50 ; Mask inturrupts
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
426 lda <DPPia0CRB ; Save PIA0 IRQ Status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
427 sta >SavePIA0CRB,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
428 lda #$34 ; Disable it.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
429 sta <DPPia0CRB
1970
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
430
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
431 IFEQ Upgraded32
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
432 lda <DPACIACmd ; Disable ACIA Inturrupt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
433 anda #$FE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
434 sta <DPACIACmd
1970
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
435 ENDC
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
436
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
437 lda <DPPIACRB ; Set PIA to generate FIRQ on FDC DRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
438 ora #$03
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
439 sta <DPPIACRB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
440 lda <DPPIADB ; Clear any outstanding inturrupt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
441 ldy #$FFFF
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
442
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
443 lda #NMIEn+MotorOn ; Enable NMI, and turn motor on
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
444 ora >DrivSel,u ; mask in drives
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
445 ora >Density,u ; mask in density
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
446
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
447 ORB >SideSel,U ; Set up Side
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
448
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
449 IFNE dalpha ; Turn on drives & NMI
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
450 lbsr AlphaDskCtl
1842
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
451 stb <DPCmdReg ; issue command to controler
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
452 lda #NMICA2En ; Enable NMI
50bdf0b95c85 Fix for non-booting on real hardware
afra
parents: 1838
diff changeset
453 sta <DPPIA2CRA
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
454 ELSE
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
455 stb <DPCmdReg ; issue command to controler
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
456 sta <DPDskCtl
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
457 ENDC
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
458
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
459
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
460 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
461
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
462 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
463 ; Restore saved iO states of peripherals.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
464 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
465
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
466 RestoreSavedIO
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
467 IFNE dalpha
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
468 lda #NMICA2Dis ; Disable NMI (Alpha)
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
469 sta <DPPIA2CRA
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
470 ENDC
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
471
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
472 lda >DrivSel,u ; Deselect drives, but leave motor on
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
473 ora #MotorOn
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
474
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
475 IFNE dalpha ; Turn off drives & NMI
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
476 lbsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
477 ELSE
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
478 sta <DPDskCtl
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
479 ENDC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
480
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
481 lda >SavePIA0CRB,u ; Recover PIA0 state
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
482 sta <DPPia0CRB
1970
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
483
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
484 lda <DPPIACRB ; Disable Drive FIRQ source.
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
485 anda #$FC
1970
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
486 sta <DPPIACRB
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
487
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
488 IFEQ Upgraded32
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
489 lda >SaveACIACmd,u ; Recover ACIA state
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
490 sta <DPAciaCmd
1970
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
491 ENDC
19b2c99a0b80 Patches to support upgraded Dragon 32.
afra
parents: 1896
diff changeset
492
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
493 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
494
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
495 * Write
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
496 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
497 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
498 * B = MSB of the disk's LSN
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
499 * X = LSB of the disk's LSN
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
500 * Y = address of path descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
501 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
502 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
503 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
504 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
505 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
506 *
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
507 Write lda #$91 ; Retry byte
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
508 L0124 pshs x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
509 bsr DoWrite ; Attempt to do write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
510 puls x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
511 bcs WriteDataRetry ; On error, retry
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
512 tst <PD.Vfy,y ; Written, should we verify ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
513 bne WriteDone ; no : return
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
514 lbsr WriteVerify ; yes : verify write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
515 bcs WriteDataRetry ; verify error, retry write
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
516 WriteDone
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
517 clrb ; Return status ok
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
518 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
519
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
520 WriteDataRetry
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
521 lsra ; Retry data write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
522 lbeq RetWriteError ; All retries exhausted ?, return error
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
523 bcc L0124
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
524 pshs x,b,a ; Reset to track 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
525 lbsr ResetTrack0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
526 puls x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
527 bra L0124
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
528
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
529 DoWrite lbsr SeekTrack ; Seek to correct track & sector
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
530 lbcs ReadDataExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
531 ldx PD.Buf,y ; Get data buffer in X
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
532 pshs y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
533 ldb #WritCmnd ; Write command
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
534
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
535 WriteTrackCmd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
536 lbsr PrepDiskRW ; Prepare for disk r/w
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
537 lda ,x+ ; get byte to write
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
538 L015A ldb <DPPIACRB ; Ready to write ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
539 bmi WriteDataReady ; Yes, do it.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
540 leay -1,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
541 bne L015A
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
542 bsr RestoreSavedIO ; Restore saved peripheral states
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
543 puls y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
544 lbra RetWriteError ; Return write error
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
545
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
546 WriteDataWait
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
547 lda ,x+ ; Get next byte to write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
548 sync ; Wait for drive
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
549 WriteDataReady
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
550 sta <DPDataReg ; Write data to FDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
551 ldb <DPPIADB ; Clear pending FDC inturrupt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
552 bra WriteDataWait
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
553
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
554
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
555 ;
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
556 ; NMI Handler code.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1833
diff changeset
557 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
558
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
559 NMIService
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
560 leas R$Size,s ; Drop regs from stack
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
561 bsr RestoreSavedIO ; Restore saved IO states
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
562 puls y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
563 ldb >CmdReg
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
564
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
565 stb DskError,u
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
566
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
567 bitb #LostMask ; check for lost record
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
568 lbne RetReadError ; yes : return read error
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
569 lbra TestForError ; esle test for other errors
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
570
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
571 ; Verify a written sector.
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
572 WriteVerify
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
573 pshs x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
574 ldx PD.Buf,y ; Swap buffer pointers
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
575 pshs x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
576 ldx >BuffPtr,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
577 stx PD.Buf,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
578 ldx 4,s
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
579 lbsr DoReadData ; Read data back in
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
580 puls x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
581 stx PD.Buf,y ; Swab buffer pointers back
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
582 bcs VerifyEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
583 lda #$20
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
584 pshs u,y,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
585 ldy >BuffPtr,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
586 tfr x,u
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
587 VerifyLoop
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
588 ldx ,u ; Compare every 4th word
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
589 cmpx ,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
590 bne VerifyErrorEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
591 leau 8,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
592 leay 8,y ; Increment pointers
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
593 dec ,s
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
594 bne VerifyLoop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
595 bra VerifyEndOk ; Verify succeeded.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
596 VerifyErrorEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
597 orcc #Carry ; Flag error
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
598 VerifyEndOk
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
599 puls u,y,a
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
600 VerifyEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
601 puls pc,x,b,a
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
602 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
603 ; Seek to a track
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
604 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
605 SeekTrack
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
606 CLR >Settle,U ; default no settle
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
607 LBSR SelectDrive ; select and start correct drive
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
608 TSTB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
609 BNE E.Sect
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
610
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
611 TFR X,D
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
612 LDX >CDrvTab,U
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
613 CMPD #0 ; Skip calculation of track 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
614 BEQ SeekT1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
615 CMPD DD.TOT+1,X ; Has an illegal LSN been
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
616 BLO SeekT2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
617 E.Sect COMB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
618 LDB #E$Sect
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
619 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
620
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
621 SeekT2 CLR ,-S ; Calculate track number
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
622 SUBD PD.T0S,Y ; subtract no. of sectors in track 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
623 BHS SeekT4
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
624 ADDD PD.T0S,Y ; if -ve we are on track 0, so add back on again
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
625 BRA SeekT3
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
626 SeekT4 INC ,S
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
627 SUBD DD.Spt,X ; sectors per track for rest of disk
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
628 BHS SeekT4 ; repeat, until -ve, incrementing track count
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
629 ADDD DD.Spt,X ; re add sectors/track to get sector number on track
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
630
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
631 ; At this point the byte on the top of the stack contains the track
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
632 ; number, and B contains the sector number on that track.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
633
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
634 SeekT3 PULS A ; retrieve track count
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
635 LBSR SetWPC ; set write precompensation
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
636 LBSR SetDensity ; Set density
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
637 PSHS B
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
638 LDB DD.Fmt,X ; Is the media double sided ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
639 LSRB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
640 BCC SingleSidedDisk ; skip if not
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
641 LDB PD.Sid,Y ; Is the drive double sided ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
642 DECB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
643 BNE SetupSideMask ; yes : deal with it.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
644 PULS B ; No then its an error
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
645 COMB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
646 LDB #E$BTyp
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
647 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
648
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
649 SetupSideMask
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
650 BSR SetSide ; Media & drive are double sided
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
651 BRA SeekT9
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
652
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
653 SingleSidedDisk
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
654 clr >SideSel,U ; Single sided, make sure sidesel set correctly
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
655 BRA SeekT9
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
656
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
657 SeekT1 LBSR SetDensity ; make sure density set correctly even for LSN0 !
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
658
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
659 clr >SideSel,U ; make sure sidesel is always 0 if lsn0
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
660 PSHS B
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
661 SeekT9 LDB PD.Typ,Y ; Dragon and Coco disks
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
662 BITB #TYP.CCF ; count sectors from 1 no
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
663 BEQ SeekT8
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
664 PULS B
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
665 INCB ; so increment sector number
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
666 BRA SeekT11
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
667 SeekT8 PULS B ; Count from 0 for other types
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
668
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
669 SeekT11 STB >SecReg ; Write sector number to controler
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
670 LBSR Delay
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
671 CMPB >SecReg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
672 BNE SeekT11
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
673
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
674 SeekTS LDB <V.Trak,X ; Entry point for SS.WTrk command
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
675 STB >TrkReg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
676 TST >Settle,U ; If settle has been flagged then wait for settle
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
677 BNE SeekT5
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
678 CMPA <V.Trak,X ; otherwise check if this is
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
679 BEQ SeekT6 ; track number to the last
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
680
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
681 SeekT5 STA <V.Trak,X ; Do the seek
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
682 STA >DataReg ; Write track no to controler
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
683 bsr GetStepInB ; get step rate
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
684 ORB #SeekCmnd ; add seek command
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
685 LBSR FDCCommand
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
686 PSHS X
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
687 LDX #$222E ; Wait for head to settle
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
688 SeekT7 LEAX -1,X
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
689 BNE SeekT7
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
690 PULS X
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
691
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
692 SeekT6 CLRB ; return no error to caller
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
693 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
694
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
695 ;
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
696 ; Get step rate in bottom 2 bits of B
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
697 ;
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
698 GetStepInB
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
699 ldb PD.Stp,Y ; Set Step Rate according to Parameter block
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
700 andb #%00000011 ; mask in only step rate bits
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
701 eorb #%00000011 ; flip bits to make correct encoding
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
702 rts
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
703
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
704 ; Set Side2 Mask
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
705 ; A contains the track number on entry
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
706 SetSide LSRA ; Get bit 0 into carry & devide track no by 2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
707 PSHS A
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
708 BCC Side0 ; Side 0 if even track no.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
709 LDA #Sid2Sel ; Odd track no. so side 2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
710 BRA Side
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
711 Side0 CLRA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
712 Side STA >SideSel,U
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
713 PULS A,PC
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
714
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
715 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
716 ; Select drive and start drive motors.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
717 ; On entry A=drive number.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
718 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
719
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
720 SelectDrive
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
721 lbsr StartMotor ; Start motor
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
722 lda <PD.Drv,y ; Check it's a valid drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
723 cmpa #MaxDrv
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
724 bcs SelectDriveValid ; yes : continue
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
725
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
726 RetErrorBadUnit
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
727 comb ; Return bad unit error
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
728 ldb #E$Unit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
729 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
730
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
731 SelectDriveValid
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
732 pshs x,b,a ; Unit valid so slect it
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
733 sta >DrivSel,u ; Get DD table address
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
734 leax DrvBeg,u ; Calculate offset into table
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
735 ldb #DrvMem
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
736 mul
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
737 leax d,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
738 cmpx >CDrvTab,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
739 beq SelectDriveEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
740 stx >CDrvTab,u ; Force seek if different drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
741 com >Settle,u
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
742 SelectDriveEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
743 puls pc,x,b,a
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
744
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
745 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
746 ; Analise device status return.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
747 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
748
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
749 TestForError
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
750 bitb #ErrMask
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
751 beq TestErrorEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
752 bitb #NotRMask ; not ready
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
753 bne RetErrorNotReady
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
754 bitb #WPMask ; Write protect
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
755 bne RetErrorWP
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
756 bitb #RTypMask ; Wrong type ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
757 bne RetWriteError
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
758 bitb #RNFMask ; Record Not found
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
759 bne RetErrorSeek
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
760 bitb #CRCMask
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
761 bne RetErrorCRC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
762 TestErrorEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
763 clrb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
764 rts
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
765 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
766 ; Return error code
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
767 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
768
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
769 RetErrorNotReady
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
770 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
771 ldb #E$NotRdy
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
772 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
773 RetErrorWP
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
774 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
775 ldb #E$WP
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
776 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
777 RetWriteError
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
778 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
779 ldb #E$Write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
780 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
781 RetErrorSeek
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
782 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
783 ldb #E$Seek
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
784 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
785 RetErrorCRC
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
786 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
787 ldb #E$CRC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
788 rts
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
789 RetReadError
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
790 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
791 ldb #E$Read
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
792 rts
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
793 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
794 ; Issue a command to FDC and wait till it's ready
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
795 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
796
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
797 FDCCommand
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
798 bsr FDCCmd
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
799 FDCCmdWait
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
800 ldb >CmdReg ; Poll until not busy
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
801 bitb #$01
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
802 beq Delay3
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
803 bra FDCCmdWait
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
804
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
805 FDCCmdMotorOn
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
806 lda #MotorOn ; Turn on motor
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
807 ora >DrivSel,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
808
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
809 IFNE dalpha
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
810 lbsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
811 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
812 sta >DskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
813 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
814
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
815 bsr SetupVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
816
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
817 stb >CmdReg ; Send Command to FDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
818 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
819
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
820 SetupVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
821 pshs D
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
822 ldd >VIRQCnt,pc ; Get VIRQ initial count value
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
823 std >VIRQPak,u ; Save it
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
824 lda VIRQInstalled,u ; Installed yet ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
825 beq DoInsVIRQ ; Not installed yet, try installing it
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
826 SetupVIRQExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
827 PULS D
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
828 rts
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
829
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
830 DoInsVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
831 bsr InsVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
832 bra SetupVIRQExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
833
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
834 InsVIRQ pshs D,y,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
835 lda #$01 ; Flag drive motor is up to speed
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
836 IFEQ Level-1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
837 sta >D.DskTmr
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
838 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
839 sta <D.MotOn
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
840 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
841
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
842 ldx #$0001 ; Install VIRQ entry
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
843 leay >VIRQPak,u ; Point to packet
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
844 clr Vi.Stat,y ; Reset Status byte
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
845 ldd >VIRQCnt,pc ; Get initial VIRQ count value
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
846 os9 F$VIRQ ; Install VIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
847 bcs VIRQOut ; Error, exit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
848 inc VIRQInstalled,u ; Flag it's installed
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
849 VIRQOut puls X,Y,D
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
850 rts
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
851
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
852 * IRQ service routine for VIRQ (drive motor time)
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
853 * Entry: U=Ptr to VIRQ memory area
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
854 IRQSvc pshs a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
855 lda <D.DMAReq
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
856 beq L0509
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
857 bsr InsVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
858 bra IRQOut
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
859 L0509
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
860 IFNE dalpha
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
861 lbsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
862 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
863 sta >DskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
864 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
865
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
866 clr u00B5,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
867 clr VIRQInstalled,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
868 IFEQ Level-1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
869 clr >D.DskTmr
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
870 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
871 clr <D.MotOn
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
872 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
873 IRQOut puls pc,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
874
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
875
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
876 FDCCmd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
877 bsr FDCCmdMotorOn
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
878
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
879 ; Delay routine !
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
880 Delay lbsr Delay2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
881 Delay2 lbsr Delay3
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
882 Delay3 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
883
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
884 * SetStat
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
885 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
886 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
887 * A = function code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
888 * Y = address of path descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
889 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
890 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
891 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
892 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
893 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
894 *
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
895 SetStat
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
896 ldx PD.Rgs,y ; Retrieve request
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
897 ldb R$B,x
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
898
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
899 cmpb #SS.Reset ; Restore to track 0.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
900 beq ResetTrack0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
901 cmpb #SS.Wtrk ; Write (format) a track
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
902 beq DoWriteTrack
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
903 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
904 ldb #E$UnkSvc
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
905 SetStatEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
906 rts
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
907 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
908 ; Write (format) a track
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
909 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
910
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
911 DoWriteTrack
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
912
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
913 lbsr SelectDrive ; Select drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
914 lda R$Y+1,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
915 LBSR SetSide ; Set Side 2 if appropriate
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
916 LDA R$U+1,X
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
917 BSR SetWPC ; Set WPC by disk type
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
918 bsr SetDensity ; Set density
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
919
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
920 ;L02D5
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
921 ldx >CDrvTab,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
922 lbsr SeekTS ; Move to correct track
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
923 bcs SetStatEnd
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
924
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
925 ldx PD.Rgs,y
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
926 ldx R$X,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
927 ldb #WtTkCmnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
928 pshs y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
929 lbra WriteTrackCmd
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
930
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
931 ; Reset track 0
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
932 ResetTrack0
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
933 lbsr SelectDrive ; Select drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
934 ldx >CDrvTab,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
935 clr <V.Trak,x ; Set current track as 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
936 lda #$05
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
937
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
938 ResetTrack0Loop
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
939 lbsr GetStepInB ; Get step rate for this drive
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
940 orb #StpICmnd ; Step away from track 0 5 times
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
941 pshs a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
942 lbsr FDCCommand
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
943 puls a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
944 deca
1971
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
945 bne ResetTrack0Loop
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
946
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
947 lbsr GetStepInB ; Get step rate for this drive
136a4e706aa6 Fixed step rate issues on recalibrate on original Dragon 5.25" drives
afra
parents: 1970
diff changeset
948 orb #RestCmnd ; Now issue a restore
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
949 lbra FDCCommand
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
950 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
951 ;Start drive motors
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
952 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
953
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
954 StartMotor
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
955 pshs x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
956 lda >D.DskTmr ; if timer <> 0 then skip as motor already on
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
957 bne MotorsRunning
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
958 lda #MotorOn ; else spin up
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
959
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
960 IFNE dalpha
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
961 bsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
962 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
963 sta >DskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
964 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
965
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
966 ldx #$A000 ; Wait a little while for motors to get up to speed
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
967 StartMotorLoop
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
968 nop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
969 nop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
970 leax -1,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
971 bne StartMotorLoop
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
972
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
973 MotorsRunning
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
974 lbsr SetupVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
975 ; lda #$F0 ; Start external motor timer
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
976 ; sta >D.DskTmr ; external to driver
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
977 puls pc,x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
978
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
979 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
980 ; Set Write Precompensation according to media type
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
981 ;
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
982 ; Entry :
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
983 ; A = Track no
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
984
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
985 SetWPC PSHS A,B
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
986 LDB PD.DNS,Y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
987 BITB #T80Mask ; Is it 96 tpi drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
988 BNE SetWP1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
989 ASLA ; no then double
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
990 SetWP1 CMPA #32 ; WPC needed ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
991 BLS SetWP2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
992 LDA >DrivSel,U
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
993 ORA #WPCEn
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
994 STA >DrivSel,U
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
995 SetWP2 PULS A,B,PC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
996
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
997
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
998 ;
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
999 ; Set density acording to disk type.
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1000 ;
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1001 ; Entry A = Track no
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1002 ;
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1003
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1004 SetDensity
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1005 PSHS A,B
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1006 ldb PD.TYP,Y ; Dragon/CoCo disk ?
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1007 bitb #TYP.CCF
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1008 bne SetDouble ; Always double density
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1009
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1010 LDB PD.DNS,Y ; Get density flags from Path descriptor
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1011
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1012 bitb #DNS.MFM ; Disk is MFM ?
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1013 beq SetSingle ; no : set single density
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1014
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1015 cmpa #0 ; track 0 ?
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1016 bne SetDouble ; not track 0, exit
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1017
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1018 tst SideSel,u ; is this side 0 ?
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1019 bne SetDouble ; no : use double density
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1020
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1021 bitb #DNS.MFM0 ; track 0 mfm ?
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1022 bne SetDouble
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1023
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1024 SetSingle
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1025 lda #SDensEn ; flag single density
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1026 sta Density,u
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1027 bra ExitDensity
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1028
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1029 SetDouble
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1030 clr Density,u ; flag double density
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1031
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1032 ExitDensity
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1033 puls a,b,pc
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1034
2103
58bb6cac8939 Update for new build system
afra
parents: 2037
diff changeset
1035 IFNE dalpha
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1036
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1037 ; Translate DragonDos Drive select mechinisim to work on Alpha
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1038 ; Takes byte that would be output to $FF48, reformats it and
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1039 ; outputs to Alpha AY-8912's IO port, which is connected to
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1040 ; Drive selects, motor on and enable precomp.
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
1041 ; This code now expects Alpha NMI/DDEN etc codes, as defined
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
1042 ; at top of this file (and dgndefs). The exception to this is
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
1043 ; the drive number is still passed in the bottom 2 bits and
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
1044 ; converted with a lookup table.
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
1045 ; We do not need to preserve the ROM select bit as this code
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
1046 ; operates in RAM only mode.
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
1047
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1048 ADrvTab FCB Drive0A,Drive1A,Drive2A,Drive3A
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1049
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1050 AlphaDskCtl
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1051 PSHS x,A,B,CC
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
1052
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1053 PSHS A
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
1054 anda #DDosDriveMask ; mask out dragondos format drive number
1833
ed9f51e468fa Added ability to read/write/format Single density disks.
afra
parents: 1832
diff changeset
1055 leax ADrvTab,pcr ; point at table
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1056 lda a,x ; get bitmap
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1057 ldb ,s
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
1058 andb #AlphaCtrlMask ; mask out drive number bits
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1059 stb ,s
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
1060 ora ,s ; recombine drive no & ctrl bits
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
1061 ; sta ,s
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1062
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1063 bita #MotorOn ; test motor on ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1064 bne MotorRunning
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1065
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1066 clra ; No, turn off other bits.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1067 MotorRunning
1832
4ea2e417a48e Fix for non-booting Alpha port.
afra
parents: 1822
diff changeset
1068 anda #Mask58 ; Mask out 5/8 bit to force the use of 5.25" clock
4ea2e417a48e Fix for non-booting Alpha port.
afra
parents: 1822
diff changeset
1069 sta ,s
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
1070
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
1071 orcc #$50 ; disable inturrupts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1072
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1073 lda #AYIOREG ; AY-8912 IO register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1074 sta PIA2DB ; Output to PIA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1075 ldb #AYREGLatch ; Latch register to modify
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1076 stb PIA2DA
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1077
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1078 clr PIA2DA ; Idle AY
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1079
1896
3826bfe7d2e5 Timing fixes for Dragon Alpha, should now boot more reliably
afra
parents: 1842
diff changeset
1080 lda ,s+ ; Fetch saved Drive Selects etc
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1081 sta PIA2DB ; output to PIA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1082 ldb #AYWriteReg ; Write value to latched register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1083 stb PIA2DA ; Set register
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
1084
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1085 clr PIA2DA ; Idle AY
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1086
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1087 PULS x,A,B,CC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1088 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1089
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1090 ENDC
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1091
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1092
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1093 emod
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1094 eom equ *
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1095 end