annotate level1/modules/ddisk.asm @ 1821:82e134e51305

Fixed fatal read errors on the Dragon 64.
author afra
date Sun, 24 Apr 2005 02:16:01 +0000
parents 11f38ece79ef
children c074e97abf3d
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 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
19 * The Dragon Alpha/Professional uses the same FDC chip as
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.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
57 *
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
58
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
59 nam DDisk
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
60 ttl Dragon Floppy driver
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
61
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
62 * 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
63
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
64 ifp1
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
65 use defsfile.dragon
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
66 endc
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
67
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
68 IFNE DragonAlpha
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
69
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
70 * 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
71 * 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
72 * disk controler.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
73
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
74 DPPIADA EQU DPPIA2DA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
75 DPPIACRA EQU DPPIA2CRA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
76 DPPIADB EQU DPPIA2DB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
77 DPPIACRB EQU DPPIA2CRB
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
78
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
79 PIADA EQU DPPIADA+IO ; Side A Data/DDR
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
80 PIACRA EQU DPPIACRA+IO ; Side A Control.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
81 PIADB EQU DPPIADB+IO ; Side A Data/DDR
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
82 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
83
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
84 ;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
85 DPCMDREG EQU DPCmdRegA ; command/status
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
86 DPTRKREG EQU DPTrkRegA ; Track register
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
87 DPSECREG EQU DPSecRegA ; Sector register
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
88 DPDATAREG EQU DPDataRegA ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
89
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
90 CMDREG EQU DPCMDREG+IO ; command/status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
91 TRKREG EQU DPTRKREG+IO ; Track register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
92 SECREG EQU DPSECREG+IO ; Sector register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
93 DATAREG EQU DPDATAREG+IO ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
94
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
95 ; Disk IO bitmasks
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
96
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
97 NMIEn EQU NMIEnA
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
98 WPCEn EQU WPCEnA
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
99 SDensEn EQU SDensEnA
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
100 MotorOn EQU MotorOnA
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
101
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
102 ; These are the bits that we know the function of on the Alpha interface
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
103 KnownBits EQU Drive0A+Drive1A+Drive2A+Drive3A+MotorOnA+WPCEnA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
104
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
105 ELSE
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
106
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
107 DPPIADA EQU DPPIA1DA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
108 DPPIACRA EQU DPPIA1CRA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
109 DPPIADB EQU DPPIA1DB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
110 DPPIACRB EQU DPPIA1CRB
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
111
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
112 PIADA EQU DPPIADA+IO ; Side A Data/DDR
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
113 PIACRA EQU DPPIACRA+IO ; Side A Control.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
114 PIADB EQU DPPIADB+IO ; Side A Data/DDR
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
115 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
116
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
117 ;WD2797 Floppy disk controler, used in DragonDos.
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
118 DPCMDREG EQU DPCmdRegD ; command/status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
119 DPTRKREG EQU DPTrkRegD ; Track register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
120 DPSECREG EQU DPSecRegD ; Sector register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
121 DPDATAREG EQU DPDataRegD ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
122
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
123 CMDREG EQU DPCMDREG+IO ; command/status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
124 TRKREG EQU DPTRKREG+IO ; Track register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
125 SECREG EQU DPSECREG+IO ; Sector register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
126 DATAREG EQU DPDATAREG+IO ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
127
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
128 ; Disk IO bitmasks
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
129
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
130 NMIEn EQU NMIEnD
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
131 WPCEn EQU WPCEnD
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
132 SDensEn EQU SDensEnD
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
133 MotorOn EQU MotorOnD
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
134
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
135 ENDC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
136
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
137 tylg set Drivr+Objct
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
138 atrv set ReEnt+rev
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
139 rev set $00
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
140 edition set 3
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
141
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
142 MaxDrv set 4
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
143
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
144 mod eom,name,tylg,atrv,start,size
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
145
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
146 org DrvBeg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
147 RMB MaxDrv*DrvMem
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
148 CDrvTab rmb 2
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
149 DrivSel rmb 1 ; Saved drive mask
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
150 Settle rmb 1 ; Head settle time
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
151 SavePIA0CRB rmb 1 ; Saved copy of PIA0 control reg b
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
152 SaveACIACmd rmb 1 ; Saved copy of ACIA command reg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
153 BuffPtr rmb 2 ; Buffer pointer
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
154 SideSel rmb 1 ; Side select.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
155 NMIFlag rmb 1 ; Flag for Alpha, should this NMI do an RTI ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
156
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
157 DskError rmb 1
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
158
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
159 VIRQPak rmb 2 ; Vi.Cnt word for VIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
160 u00B3 rmb 2 ; Vi.Rst word for VIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
161 u00B5 rmb 1 ; Vi.Stat byte for VIRQ (drive motor timeout)
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
162
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
163 VIRQInstalled rmb 1 ; Is VIRQ Installed yet ?
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
164 size equ .
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 fcb $FF
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
167 name equ *
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
168 fcs /DDisk/
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
169 fcb edition
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
170
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
171 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
172
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
173 start lbra Init ; Initialise Driver
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
174 lbra Read ; Read sector
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
175 lbra Write ; Write sector
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
176 lbra GetStat ; Get status
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
177 lbra SetStat ; Set status
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
178 lbra Term ; Terminate device
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
179
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
180 IRQPkt fcb $00 ; Normal bits (flip byte)
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
181 fcb $01 ; Bit 1 is interrupt request flag (Mask byte)
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
182 fcb 10 ; Priority byte
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
183
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
184
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
185 * Init
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
186 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
187 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
188 * Y = address of device descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
189 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
190 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
191 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
192 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
193 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
194 *
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
195 DragonDebug EQU 1
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
196 Init
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
197 IFNE DragonDebug
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
198 pshs x ; This is here so I can find disk driver in mess
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
199 ldx #$AA55 ; by setting register breakpoint to X=$AA55 !
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
200 puls x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
201 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
202
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
203 clra
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
204 sta >D.DskTmr ; Zero motor timer
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
205
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
206 IFNE DragonAlpha ; Turn off all drives
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
207 lbsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
208 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
209 sta >DskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
210 ENDC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
211
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
212 ldx #CmdReg ; Reset controler
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
213 lda #FrcInt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
214 sta ,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
215 lbsr Delay
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
216 lda ,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
217 lda #$FF
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
218 ldb #MaxDrv
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
219 leax DrvBeg,u
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
220
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
221 InitDriveData
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
222 sta DD.Tot,x ; Set total sectors = $FF
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
223 sta <V.Trak,x ; Set current track = 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
224 leax <DrvMem,x ; Skip to next drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
225 decb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
226 bne InitDriveData
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
227
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
228 leax >NMIService,pcr ; Setup NMI handler
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
229 stx >D.XNMI+1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
230 lda #$7E ; $7E = JMP
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
231 sta >D.XNMI
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
232
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
233 clr VIRQInstalled,u ;flag not installed yet
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
234
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
235 pshs y ; save device dsc. ptr
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
236 leay >u00B5,u ; point to Vi.Stat in VIRQ packet
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
237 tfr y,d ; make it the status register ptr for IRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
238 leay >IRQSvc,pc ; point to IRQ service routine
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
239 leax >IRQPkt,pc ; point to IRQ packet
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
240 os9 F$IRQ ; install IRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
241 puls y ; Get back device dsc. ptr
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
242
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
243 ldd #$0100 ; Request a page of system ram
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
244 pshs u ; used to verify writes
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
245 os9 F$SRqMem
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
246 tfr u,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
247 puls u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
248 bcs Return
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
249 stx >BuffPtr,u ; Save verify page pointer
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
250 clrb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
251 Return rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
252
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
253
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
254 * GetStat
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
255 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
256 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
257 * A = function code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
258 * Y = address of path descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
259 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
260 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
261 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
262 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
263 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
264 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
265 GetStat
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
266
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
267 * Term
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
268 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
269 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
270 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
271 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
272 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
273 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
274 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
275 *
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
276 Term clrb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
277 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
278
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
279 * Read
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
280 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
281 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
282 * B = MSB of the disk's LSN
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
283 * X = LSB of the disk's LSN
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
284 * Y = address of path descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
285 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
286 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
287 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
288 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
289 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
290 *
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
291 Read
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
292 lda #$91 ; Retry count
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
293 cmpx #$0000 ; LSN ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
294 bne ReadDataWithRetry ; No : Just do read,
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
295 bsr ReadDataWithRetry ; Yes : do read and copy disk params
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
296 bcs ReadDataExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
297 ldx PD.Buf,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
298 pshs y,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
299 ldy >CDrvTab,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
300 ldb #DD.Siz-1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
301 L0082 lda b,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
302 sta b,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
303 decb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
304 bpl L0082
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
305 clrb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
306 puls pc,y,x
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
307 ReadDataExit
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
308 rts
1727
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 ; Read Retry
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 ReadDataRetry
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
313
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
314 lbsr RetryErrorDisplay
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
315
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
316 bcc ReadDataWithRetry ; Retry entry point
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
317 pshs x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
318 lbsr ResetTrack0 ; Reset track 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
319 puls x,b,a
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
320
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
321 ReadDataWithRetry
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
322 pshs x,b,a ; Normal entry point
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
323 bsr DoReadData
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
324 puls x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
325 bcc ReadDataExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
326 lsra ; Check for retry
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
327 bne ReadDataRetry
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
328
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
329 DoReadData
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
330 lbsr SeekTrack
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
331 bcs ReadDataExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
332 ldx PD.Buf,y ; Target address for data
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
333 pshs y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
334 ldb #ReadCmnd ; Read command
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
335 bsr PrepDiskRW ; Prepare disk
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
336
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
337 DoReadDataLoop
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
338 lda <DPPIACRB ; Is data ready ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
339 bmi ReadDataReady ; Yes : read it
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
340 leay -1,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
341 bne DoReadDataLoop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
342 bsr RestoreSavedIO
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
343 puls y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
344 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
345
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
346 ReadDataWait
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
347 sync ; Sync to inturrupts, wait for data
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
348
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
349 ReadDataReady
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
350 lda <DPDataReg ; Read data from FDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
351 ldb <DPPIADB ; Clear PIA inturrupt status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
352 sta ,x+ ; save data in memory
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
353 bra ReadDataWait ; do next
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
354
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
355 PrepDiskRW
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
356
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
357 clr DskError,u
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
358
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
359 lda #$FF ; Make DP=$FF, to make io easier
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
360 tfr a,dp
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
361 lda <DPAciaCmd ; Save ACIA Command reg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
362 sta >SaveACIACmd,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
363 anda #$FE ; Disable ACIA inturrupt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
364 sta <DPAciaCmd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
365 bita #$40 ; Is Tx inturrupt enabled ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
366 beq L00DE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
367 L00D8 lda <DPAciaStat ; Yes, wait for Tx to complete
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
368 bita #$10
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
369 beq L00D8
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
370
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
371 L00DE orcc #$50 ; Mask inturrupts
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
372 lda <DPPia0CRB ; Save PIA0 IRQ Status
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
373 sta >SavePIA0CRB,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
374 lda #$34 ; Disable it.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
375 sta <DPPia0CRB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
376 lda <DPACIACmd ; Disable ACIA Inturrupt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
377 anda #$FE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
378 sta <DPACIACmd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
379 lda <DPPIACRB ; Set PIA to generate FIRQ on FDC DRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
380 ora #$03
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
381 sta <DPPIACRB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
382 lda <DPPIADB ; Clear any outstanding inturrupt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
383 ldy #$FFFF
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
384 lda #NMIEn+MotorOn ; Enable NMI, and turn motor on
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
385 ora >DrivSel,u ; mask in drives
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
386 ORB >SideSel,U ; Set up Side
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
387
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
388 IFNE DragonAlpha ; Turn on drives & NMI
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
389 lbsr AlphaDskCtl
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
390 stb <DPCmdReg ; issue command to controler
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
391 ELSE
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
392 stb <DPCmdReg ; issue command to controler
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
393 sta <DPDskCtl
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
394 ENDC
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
395
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
396
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
397 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
398
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
399 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
400 ; Restore saved iO states of peripherals.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
401 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
402
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
403 RestoreSavedIO
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
404 lda >DrivSel,u ; Deselect drives, but leave motor on
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
405 ora #MotorOn
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
406 IFNE DragonAlpha ; Turn off drives & NMI
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
407 lbsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
408 ELSE
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
409 sta <DPDskCtl
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
410 ENDC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
411
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
412 lda >SavePIA0CRB,u ; Recover PIA0 state
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
413 sta <DPPia0CRB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
414 lda <DPPIACRB ; Recover ACIA state
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
415 anda #$FC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
416 sta <DPPIACRB ; Disable Drive FIRQ source.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
417 lda >SaveACIACmd,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
418 sta <DPAciaCmd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
419 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
420
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
421 * Write
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
422 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
423 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
424 * B = MSB of the disk's LSN
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
425 * X = LSB of the disk's LSN
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
426 * Y = address of path descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
427 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
428 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
429 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
430 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
431 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
432 *
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
433 Write lda #$91 ; Retry byte
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
434 L0124 pshs x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
435 bsr DoWrite ; Attempt to do write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
436 puls x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
437 bcs WriteDataRetry ; On error, retry
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
438 tst <PD.Vfy,y ; Written, should we verify ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
439 bne WriteDone ; no : return
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
440 lbsr WriteVerify ; yes : verify write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
441 bcs WriteDataRetry ; verify error, retry write
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
442 WriteDone
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
443 clrb ; Return status ok
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
444 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
445
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
446 WriteDataRetry
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
447 lsra ; Retry data write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
448 lbeq RetWriteError ; All retries exhausted ?, return error
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
449 bcc L0124
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
450 pshs x,b,a ; Reset to track 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
451 lbsr ResetTrack0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
452 puls x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
453 bra L0124
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
454
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
455 DoWrite lbsr SeekTrack ; Seek to correct track & sector
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
456 lbcs ReadDataExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
457 ldx PD.Buf,y ; Get data buffer in X
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
458 pshs y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
459 ldb #WritCmnd ; Write command
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
460
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
461 WriteTrackCmd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
462 lbsr PrepDiskRW ; Prepare for disk r/w
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
463 lda ,x+ ; get byte to write
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
464 L015A ldb <DPPIACRB ; Ready to write ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
465 bmi WriteDataReady ; Yes, do it.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
466 leay -1,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
467 bne L015A
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
468 bsr RestoreSavedIO ; Restore saved peripheral states
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
469 puls y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
470 lbra RetWriteError ; Return write error
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
471
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
472 WriteDataWait
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
473 lda ,x+ ; Get next byte to write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
474 sync ; Wait for drive
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
475 WriteDataReady
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
476 sta <DPDataReg ; Write data to FDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
477 ldb <DPPIADB ; Clear pending FDC inturrupt
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
478 bra WriteDataWait
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
479
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
480
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
481 ; The following block of code is needed for the Dragon Alpha, because
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
482 ; we currently do not know how to disable it's NMI in hardware,
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
483 ; So we check a flag here, and if set we simply return from inturrupt
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
484 ; as if nothing happened !
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
485
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
486 NMIService
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
487 IFNE DragonAlpha
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
488 pshs cc ; Save flags
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
489 tst >NMIFlag,u ; Check NMI enable flag
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
490 bne DoNMI ; if enabled, continue with handler
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
491 puls cc ; else restore flags and return
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
492 RTI
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
493
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
494 DoNMI puls cc ; restore flags
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
495 ENDC
1727
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 RealNMI
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
498 leas R$Size,s ; Drop regs from stack
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
499 bsr RestoreSavedIO ; Restore saved IO states
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
500 puls y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
501 ldb >CmdReg
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
502
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
503 stb DskError,u
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
504
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
505 bitb #LostMask ; check for lost record
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
506 lbne RetReadError ; yes : return read error
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
507 lbra TestForError ; esle test for other errors
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
508
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
509 ; Verify a written sector.
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
510 WriteVerify
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
511 pshs x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
512 ldx PD.Buf,y ; Swap buffer pointers
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
513 pshs x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
514 ldx >BuffPtr,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
515 stx PD.Buf,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
516 ldx 4,s
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
517 lbsr DoReadData ; Read data back in
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
518 puls x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
519 stx PD.Buf,y ; Swab buffer pointers back
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
520 bcs VerifyEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
521 lda #$20
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
522 pshs u,y,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
523 ldy >BuffPtr,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
524 tfr x,u
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
525 VerifyLoop
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
526 ldx ,u ; Compare every 4th word
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
527 cmpx ,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
528 bne VerifyErrorEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
529 leau 8,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
530 leay 8,y ; Increment pointers
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
531 dec ,s
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
532 bne VerifyLoop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
533 bra VerifyEndOk ; Verify succeeded.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
534 VerifyErrorEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
535 orcc #Carry ; Flag error
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
536 VerifyEndOk
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
537 puls u,y,a
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
538 VerifyEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
539 puls pc,x,b,a
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
540 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
541 ; Seek to a track
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
542 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
543 SeekTrack
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
544 CLR >Settle,U ; default no settle
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
545 LBSR SelectDrive ; select and start correct d
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
546 TSTB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
547 BNE E.Sect
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
548
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
549 TFR X,D
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
550 LDX >CDrvTab,U
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
551 CMPD #0 ; Skip calculation of track 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
552 BEQ SeekT1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
553 CMPD DD.TOT+1,X ; Has an illegal LSN been
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
554 BLO SeekT2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
555 E.Sect COMB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
556 LDB #E$Sect
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
557 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
558
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
559 SeekT2 CLR ,-S ; Calculate track number
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
560 SUBD PD.T0S,Y ; subtract no. of sectors in track 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
561 BHS SeekT4
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
562 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
563 BRA SeekT3
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
564 SeekT4 INC ,S
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
565 SUBD DD.Spt,X ; sectors per track for rest of disk
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
566 BHS SeekT4 ; repeat, until -ve, incrementing track count
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
567 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
568
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
569 ; 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
570 ; 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
571
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
572 SeekT3 PULS A ; retrieve track count
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
573 LBSR SetWPC ; set write precompensation
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
574 PSHS B
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
575 LDB DD.Fmt,X ; Is the media double sided ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
576 LSRB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
577 BCC SingleSidedDisk ; skip if not
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
578 LDB PD.Sid,Y ; Is the drive double sided ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
579 DECB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
580 BNE SetupSideMask ; yes : deal with it.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
581 PULS B ; No then its an error
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
582 COMB
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
583 LDB #E$BTyp
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
584 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
585
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
586 SetupSideMask
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
587 BSR SetSide ; Media & drive are double sided
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
588 BRA SeekT9
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
589
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
590 SingleSidedDisk
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
591 clr >SideSel,U ; Single sided, make sure sidesel set correctly
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
592 BRA SeekT9
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
593
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
594 SeekT1 clr >SideSel,U ; make sure sidesel is always 0 if lsn0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
595 PSHS B
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
596 SeekT9 LDB PD.Typ,Y ; Dragon and Coco disks
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
597 BITB #TYP.SBO ; count sectors from 1 no
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
598 BNE SeekT8
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
599 PULS B
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
600 INCB ; so increment sector number
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
601 BRA SeekT11
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
602 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
603
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
604 SeekT11 STB >SecReg ; Write sector number to controler
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
605 LBSR Delay
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
606 CMPB >SecReg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
607 BNE SeekT11
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
608
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
609 SeekTS LDB <V.Trak,X ; Entry point for SS.WTrk command
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
610 STB >TrkReg
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
611 TST >Settle,U ; If settle has been flagged then wait for settle
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
612 BNE SeekT5
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
613 CMPA <V.Trak,X ; otherwise check if this is
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
614 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
615
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
616 SeekT5 STA <V.Trak,X ; Do the seek
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
617 STA >DataReg ; Write track no to controler
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
618 LDB #SeekCmnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
619 ORB PD.Stp,Y ; Set Step Rate according to Parameter block
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
620 LBSR FDCCommand
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
621 PSHS X
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
622 LDX #$222E ; Wait for head to settle
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
623 SeekT7 LEAX -1,X
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
624 BNE SeekT7
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
625 PULS X
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
626
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
627 SeekT6 CLRB ; return no error to caller
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
628 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
629
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
630 ; Set Side2 Mask
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
631 ; A contains the track number on entry
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
632 SetSide LSRA ; Get bit 0 into carry & devide track no by 2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
633 PSHS A
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
634 BCC Side0 ; Side 0 if even track no.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
635 LDA #Sid2Sel ; Odd track no. so side 2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
636 BRA Side
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
637 Side0 CLRA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
638 Side STA >SideSel,U
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
639 PULS A,PC
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
640
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
641 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
642 ; Select drive and start drive motors.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
643 ; On entry A=drive number.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
644 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
645
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
646 SelectDrive
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
647 lbsr StartMotor ; Start motor
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
648 lda <PD.Drv,y ; Check it's a valid drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
649 cmpa #MaxDrv
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
650 bcs SelectDriveValid ; yes : continue
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
651
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
652 RetErrorBadUnit
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
653 comb ; Return bad unit error
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
654 ldb #E$Unit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
655 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
656
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
657 SelectDriveValid
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
658 pshs x,b,a ; Unit valid so slect it
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
659 sta >DrivSel,u ; Get DD table address
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
660 leax DrvBeg,u ; Calculate offset into table
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
661 ldb #DrvMem
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
662 mul
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
663 leax d,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
664 cmpx >CDrvTab,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
665 beq SelectDriveEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
666 stx >CDrvTab,u ; Force seek if different drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
667 com >Settle,u
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
668 SelectDriveEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
669 puls pc,x,b,a
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
670
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
671 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
672 ; Analise device status return.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
673 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
674
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
675 TestForError
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
676 bitb #ErrMask
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
677 beq TestErrorEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
678 bitb #NotRMask ; not ready
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
679 bne RetErrorNotReady
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
680 bitb #WPMask ; Write protect
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
681 bne RetErrorWP
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
682 bitb #RTypMask ; Wrong type ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
683 bne RetWriteError
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
684 bitb #RNFMask ; Record Not found
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
685 bne RetErrorSeek
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
686 bitb #CRCMask
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
687 bne RetErrorCRC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
688 TestErrorEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
689 clrb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
690 rts
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
691 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
692 ; Return error code
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
693 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
694
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
695 RetErrorNotReady
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
696 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
697 ldb #E$NotRdy
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
698 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
699 RetErrorWP
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
700 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
701 ldb #E$WP
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
702 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
703 RetWriteError
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
704 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
705 ldb #E$Write
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
706 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
707 RetErrorSeek
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
708 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
709 ldb #E$Seek
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
710 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
711 RetErrorCRC
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
712 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
713 ldb #E$CRC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
714 rts
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
715 RetReadError
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
716 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
717 ldb #E$Read
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
718 rts
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
719 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
720 ; Issue a command to FDC and wait till it's ready
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
721 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
722
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
723 FDCCommand
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
724 bsr FDCCmd
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
725 FDCCmdWait
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
726 ldb >CmdReg ; Poll until not busy
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
727 bitb #$01
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
728 beq Delay3
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
729 bra FDCCmdWait
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 FDCCmdMotorOn
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
732 lda #MotorOn ; Turn on motor
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
733 ora >DrivSel,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
734
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
735 IFNE DragonAlpha
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
736 lbsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
737 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
738 sta >DskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
739 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
740
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
741 bsr SetupVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
742
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
743 stb >CmdReg ; Send Command to FDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
744 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
745
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
746 SetupVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
747 pshs D
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
748 ldd >VIRQCnt,pc ; Get VIRQ initial count value
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
749 std >VIRQPak,u ; Save it
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
750 lda VIRQInstalled,u ; Installed yet ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
751 beq DoInsVIRQ ; Not installed yet, try installing it
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
752 SetupVIRQExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
753 PULS D
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
754 rts
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
755
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
756 DoInsVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
757 bsr InsVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
758 bra SetupVIRQExit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
759
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
760 InsVIRQ pshs D,y,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
761 lda #$01 ; Flag drive motor is up to speed
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
762 IFEQ Level-1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
763 sta >D.DskTmr
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
764 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
765 sta <D.MotOn
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
766 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
767
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
768 ldx #$0001 ; Install VIRQ entry
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
769 leay >VIRQPak,u ; Point to packet
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
770 clr Vi.Stat,y ; Reset Status byte
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
771 ldd >VIRQCnt,pc ; Get initial VIRQ count value
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
772 os9 F$VIRQ ; Install VIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
773 bcs VIRQOut ; Error, exit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
774 inc VIRQInstalled,u ; Flag it's installed
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
775 VIRQOut puls X,Y,D
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
776 rts
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
777
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
778 * IRQ service routine for VIRQ (drive motor time)
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
779 * Entry: U=Ptr to VIRQ memory area
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
780 IRQSvc pshs a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
781 lda <D.DMAReq
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
782 beq L0509
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
783 bsr InsVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
784 bra IRQOut
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
785 L0509
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
786 IFNE DragonAlpha
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
787 lbsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
788 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
789 sta >DskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
790 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
791
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
792 clr u00B5,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
793 clr VIRQInstalled,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
794 IFEQ Level-1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
795 clr >D.DskTmr
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
796 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
797 clr <D.MotOn
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
798 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
799 IRQOut puls pc,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
800
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
801
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
802 FDCCmd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
803 bsr FDCCmdMotorOn
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 ; Delay routine !
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
806 Delay lbsr Delay2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
807 Delay2 lbsr Delay3
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
808 Delay3 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
809
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
810 * SetStat
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
811 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
812 * Entry:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
813 * A = function code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
814 * Y = address of path descriptor
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
815 * U = address of device memory area
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
816 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
817 * Exit:
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
818 * CC = carry set on error
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
819 * B = error code
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
820 *
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
821 SetStat ldx PD.Rgs,y ; Retrieve request
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
822 ldb R$B,x
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
823
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
824 cmpb #SS.Reset ; Restore to track 0.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
825 beq ResetTrack0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
826 cmpb #SS.Wtrk ; Write (format) a track
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
827 beq DoWriteTrack
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
828 comb
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
829 ldb #E$UnkSvc
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
830 SetStatEnd
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
831 rts
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
832 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
833 ; Write (format) a track
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
834 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
835
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
836 DoWriteTrack
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
837 lbsr SelectDrive ; Select drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
838 lda R$Y+1,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
839 LBSR SetSide ; Set Side 2 if appropriate
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
840 LDA R$U+1,X
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
841 BSR SetWPC ; Set WPC by disk type
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
842
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
843 ;L02D5
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
844 ldx >CDrvTab,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
845 lbsr SeekTS ; Move to correct track
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
846 bcs SetStatEnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
847 ldx PD.Rgs,y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
848 ldx R$X,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
849 ldb #WtTkCmnd
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
850 pshs y,dp,cc
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
851 lbra WriteTrackCmd
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
852
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
853 ; Reset track 0
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
854 ResetTrack0
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
855 lbsr SelectDrive ; Select drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
856 ldx >CDrvTab,u
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
857 clr <V.Trak,x ; Set current track as 0
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
858 lda #$05
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
859 ResetTrack0Loop
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
860 ldb #StpICmnd ; Step away from track 0 5 times
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
861 pshs a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
862 lbsr FDCCommand
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
863 puls a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
864 deca
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
865 bne ResetTrack0Loop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
866 ldb #RestCmnd ; Now issue a restore
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
867 lbra FDCCommand
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
868 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
869 ;Start drive motors
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
870 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
871
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
872 StartMotor
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
873 pshs x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
874 lda >D.DskTmr ; if timer <> 0 then skip as motor already on
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
875 bne MotorsRunning
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
876 lda #MotorOn ; else spin up
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
877
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
878 IFNE DragonAlpha
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
879 bsr AlphaDskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
880 ELSE
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
881 sta >DskCtl
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
882 ENDC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
883
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
884 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
885 StartMotorLoop
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
886 nop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
887 nop
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
888 leax -1,x
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
889 bne StartMotorLoop
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
890
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
891 MotorsRunning
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
892 lbsr SetupVIRQ
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
893 ; lda #$F0 ; Start external motor timer
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
894 ; sta >D.DskTmr ; external to driver
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
895 puls pc,x,b,a
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
896
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
897 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
898 ; Set Write Precompensation according to media type
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
899 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
900
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
901 SetWPC PSHS A,B
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
902 LDB PD.DNS,Y
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
903 BITB #T80Mask ; Is it 96 tpi drive
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
904 BNE SetWP1
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
905 ASLA ; no then double
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
906 SetWP1 CMPA #32 ; WPC needed ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
907 BLS SetWP2
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
908 LDA >DrivSel,U
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
909 ORA #WPCEn
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
910 STA >DrivSel,U
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
911 SetWP2 PULS A,B,PC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
912
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
913
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
914 IFNE DragonAlpha
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
915
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
916 ; 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
917 ; 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
918 ; 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
919 ; Drive selects, motor on and enable precomp.
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
920 ; This code now expects Alpha NMI/DDEN etc codes, as defined
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
921 ; 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
922 ; 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
923 ; converted with a lookup table.
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
924 ; 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
925 ; operates in RAM only mode.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
926 ; Also sets NMIFlag.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
927
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
928
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
929 DrvTab FCB Drive0A,Drive1A,Drive2A,Drive3A
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 AlphaDskCtl
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
932 PSHS x,A,B,CC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
933
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
934 PSHS A
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
935 ANDA #NMIEn ; mask out nmi enable bit
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
936 sta >NMIFlag,u ; Save it for later use
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
937
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
938 lda ,s ; Convert drives
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
939 anda #%00000011 ; mask out drive number
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
940 leax DrvTab,pcr ; point at table
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
941 lda a,x ; get bitmap
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
942 ldb ,s
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
943 andb #%11111100 ; mask out drive number
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
944 stb ,s
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
945 ora ,s ; recombine
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
946 sta ,s
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
947
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
948 bita #MotorOn ; test motor on ?
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
949 bne MotorRunning
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
950
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
951 clra ; No, turn off other bits.
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
952 MotorRunning
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
953 anda #KnownBits ; Mask out bits we do not know the function of
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
954 sta ,s
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
955
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
956
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
957 lda #AYIOREG ; AY-8912 IO register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
958 sta PIA2DB ; Output to PIA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
959 ldb #AYREGLatch ; Latch register to modify
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
960 stb PIA2DA
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
961
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
962 clr PIA2DA ; Idle AY
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
963
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
964 lda ,s+ ; Fetch saved Drive Selects
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
965 sta PIA2DB ; output to PIA
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
966 ldb #AYWriteReg ; Write value to latched register
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
967 stb PIA2DA ; Set register
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
968
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
969 clr PIA2DA ; Idle AY
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
970
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
971 PULS x,A,B,CC
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
972 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
973
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
974 ENDC
1821
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
975
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
976
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
977 ShowReg
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
978 pshs d,x,y,cc,dp,u
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
979 pshs x
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
980 leax RegBuffD,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
981 bsr RegDToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
982
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
983 puls d
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
984 leax RegBuffX,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
985 bsr RegDToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
986
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
987 tfr Y,D
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
988 leax RegBuffY,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
989 bsr RegDToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
990
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
991 tfr u,d
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
992 leax RegBuffU,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
993 bsr RegDToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
994
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
995 tfr s,d
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
996 leax RegBuffS,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
997 bsr RegDToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
998
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
999 tfr cc,a
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1000 leax RegBuffCC,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1001 bsr RegAToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1002
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1003 tfr dp,a
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1004 leax RegBuffDP,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1005 bsr RegAToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1006
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1007 lda #1 * stdout
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1008 leax RegBuff,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1009 ldy #RegBuffEnd-RegBuff
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1010 os9 I$write
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1011
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1012 ShowRegEnd
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1013 puls d,x,y,cc,dp,u
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1014 rts
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1015
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1016 RegDtoHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1017 pshs d
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1018 bsr RegAToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1019 tfr b,a
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1020 bsr RegAToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1021 puls d
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1022 rts
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1023
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1024 RegAToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1025 pshs d,y
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1026
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1027 leay HexTable,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1028 tfr a,b
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1029 anda #$f0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1030 lsra
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1031 lsra
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1032 lsra
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1033 lsra
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1034 lda a,y
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1035 sta ,x+
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1036 tfr b,a
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1037 anda #$0f
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1038 lda a,y
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1039 sta ,x+
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1040
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1041 puls d,y
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1042 rts
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1043
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1044 RetryErrorDisplay
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1045 pshs a,x,cc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1046
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1047 lda DskError,u
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1048 leax ErrCode,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1049 bsr RegAToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1050
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1051 leax RetryMess,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1052 bsr PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1053 puls a,x,cc,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1054
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1055
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1056 PrintDot
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1057 pshs x,cc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1058 leax DotMess,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1059 bsr PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1060 puls x,cc,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1061
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1062
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1063 PrintReadDone
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1064 pshs x,cc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1065 leax ReadDoneMess,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1066 bsr PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1067 puls x,cc,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1068
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1069 PrintReadDoneFail
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1070 pshs x,cc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1071 leax ReadDoneFailMess,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1072 bsr PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1073 puls x,cc,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1074
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1075
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1076 PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1077 pshs d,x,y,u,cc,dp
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1078 leax -2,x
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1079 ldy ,x++
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1080 lda #1
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1081 os9 I$write
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1082 puls d,x,y,u,cc,dp,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1083
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1084 PrintCtrlByte
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1085 pshs a,cc,x
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1086
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1087 leax CtrlCode,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1088 bsr RegAToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1089
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1090 leax CtrlMess,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1091 ldy #CtrlMessLen
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1092 bsr PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1093 puls a,cc,x,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1094
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1095 PrintCmdByte
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1096 pshs a,cc,x
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1097
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1098 leax CmdCode,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1099 bsr RegAToHex
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1100
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1101 leax CmdMess,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1102 bsr PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1103 puls a,cc,x,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1104
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1105 PrintNMIMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1106 pshs x,cc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1107 leax NMIMess,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1108 bsr PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1109 puls x,cc,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1110
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1111
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1112 PrintTimeout
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1113 pshs x,cc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1114 leax TimeoutMess,pcr
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1115 bsr PrintStdOut
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1116 puls x,cc,pc
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1117
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1118 RegBuff
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1119 fcc "A B X Y U "
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1120 fcb C$CR,C$LF
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1121 RegBuffD
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1122 fcc "0000 "
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1123 RegBuffX
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1124 fcc "0000 "
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1125 RegBuffY
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1126 fcc "0000 "
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1127 RegBuffU
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1128 fcc "0000 "
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1129 RegBuffS
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1130 fcc "0000 "
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1131 RegBuffCC
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1132 fcc "00 "
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1133 RegBuffDP
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1134 fcc "00 "
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1135
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1136 fcb C$CR,C$LF,0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1137 RegBuffEnd
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1138
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1139 HexTable
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1140 fcc "0123456789ABCDEF"
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1141
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1142
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1143 fdb RetryMessLen
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1144 RetryMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1145 fcc "Read error: retry ("
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1146 ErrCode fcc "00)"
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1147 fcb C$CR,C$LF,0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1148
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1149 RetryMessLen EQU *-RetryMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1150
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1151
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1152 fdb CtrlMessLen
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1153 CtrlMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1154 fcc "Control byte ("
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1155 CtrlCode fcc "00)"
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1156 fcb C$CR,C$LF,0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1157 CtrlMessLen EQU *-CtrlMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1158
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1159
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1160
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1161 fdb CtrlMessLen
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1162 CmdMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1163 fcc "Command byte ("
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1164 CmdCode fcc "00)"
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1165 fcb C$CR,C$LF,0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1166 CmdMessLen EQU *-CmdMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1167
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1168 fdb 1
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1169 DotMess fcc "."
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1170 fcb 0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1171
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1172
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1173 fdb ReadDoneMessLen
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1174 ReadDoneMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1175 fcc "Read Succeded"
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1176 fcb C$CR,C$LF,0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1177 ReadDoneMessLen EQU *-ReadDoneMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1178
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1179 fdb ReadDoneFailMessLen
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1180 ReadDoneFailMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1181 fcc "Read Failed"
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1182 fcb C$CR,C$LF,0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1183 ReadDoneFailMessLen EQU *-ReadDoneFailMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1184
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1185
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1186 fdb NMIMessLen
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1187 NMIMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1188 fcc "In NMI"
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1189 fcb C$CR,C$LF,0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1190 NMIMessLen EQU *-NMIMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1191
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1192 fdb TimeoutMessLen
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1193 TimeoutMess
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1194 fcc "Timout !"
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1195 fcb C$CR,C$LF,0
82e134e51305 Fixed fatal read errors on the Dragon 64.
afra
parents: 1735
diff changeset
1196 TimeoutMessLen EQU *-TimeoutMess
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents: 1533
diff changeset
1197
1735
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1198 emod
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1199 eom equ *
11f38ece79ef More changes by Phill for Dragon
boisy
parents: 1734
diff changeset
1200 end