annotate level1/modules/boot_d64.asm @ 1890:1021c2fd0c67

virtual disk descriptor program for DragonPlus add-on
author afra
date Wed, 12 Oct 2005 01:09:22 +0000
parents 20adccef595a
children 3826bfe7d2e5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
1 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
2 * Boot_d64, bootfile for Dragon 64, Dragon Alpha/Professional.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
3 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
4 * First disasembly and porting 2004-11-07, P.Harvey-Smith.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
5 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
6 * Dragon Alpha code, 2004-11-09, P.Harvey-Smith.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
7 * 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:
diff changeset
8 * simulated in software using the NMIFlag.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
9 *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
10 * See DDisk.asm for a fuller discription of how Dragon Alpha
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
11 * interface works.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
12 *
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
13 * Double sided Disk code added 2004-11-25, P.Harvey-Smith.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
14 *
1832
4ea2e417a48e Fix for non-booting Alpha port.
afra
parents: 1820
diff changeset
15 * 2005-05-08, P.Harvey-Smith, added code to force 5/8 line low on
4ea2e417a48e Fix for non-booting Alpha port.
afra
parents: 1820
diff changeset
16 * Alpha so correct clock selected.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
17 *
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
18 * 2005-06-16, P.Harvey-Smith.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
19 * Added NMI enable/disable code, as I know know how to enable/disable
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
20 * NMI on the Alpha, having disasembled the Alpha's OS9's ddisk.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
21 *
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
22
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
23
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
24 nam Boot
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
25 ttl os9 system module
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
26
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
27 * Disassembled 1900/00/00 00:05:56 by Disasm v1.5 (C) 1988 by RML
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
28
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
29 ifp1
1729
7bdc60c48533 Additional Dragon changes from Phill Harvey-Smith
boisy
parents: 1727
diff changeset
30 use defsfile.dragon
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
31 endc
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
32
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
33 IFNE DragonAlpha
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
34
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
35 * Dragon Alpha has a third PIA at FF24, this is used for
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
36 * Drive select / motor control, and provides FIRQ from the
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
37 * disk controler.
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
38
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
39 DPPIADA EQU DPPIA2DA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
40 DPPIACRA EQU DPPIA2CRA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
41 DPPIADB EQU DPPIA2DB
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
42 DPPIACRB EQU DPPIA2CRB
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
43
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
44 PIADA EQU DPPIADA+IO ; Side A Data/DDR
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
45 PIACRA EQU DPPIACRA+IO ; Side A Control.
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
46 PIADB EQU DPPIADB+IO ; Side A Data/DDR
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
47 PIACRB EQU DPPIACRB+IO ; Side A Control.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
48
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
49 ;WD2797 Floppy disk controler, used in Alpha Note registers in reverse order !
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
50 DPCMDREG EQU DPCmdRegA ; command/status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
51 DPTRKREG EQU DPTrkRegA ; Track register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
52 DPSECREG EQU DPSecRegA ; Sector register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
53 DPDATAREG EQU DPDataRegA ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
54
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
55 CMDREG EQU DPCMDREG+IO ; command/status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
56 TRKREG EQU DPTRKREG+IO ; Track register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
57 SECREG EQU DPSECREG+IO ; Sector register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
58 DATAREG EQU DPDATAREG+IO ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
59
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
60 ; Disk IO bitmasks
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
61
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
62 NMIEn EQU NMIEnA
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
63 WPCEn EQU WPCEnA
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
64 SDensEn EQU SDensEnA
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
65 MotorOn EQU MotorOnA
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
66
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
67 ELSE
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
68
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
69 DPPIADA EQU DPPIA1DA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
70 DPPIACRA EQU DPPIA1CRA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
71 DPPIADB EQU DPPIA1DB
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
72 DPPIACRB EQU DPPIA1CRB
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
73
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
74 PIADA EQU DPPIADA+IO ; Side A Data/DDR
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
75 PIACRA EQU DPPIACRA+IO ; Side A Control.
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
76 PIADB EQU DPPIADB+IO ; Side A Data/DDR
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
77 PIACRB EQU DPPIACRB+IO ; Side A Control.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
78
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
79 ;WD2797 Floppy disk controler, used in DragonDos.
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
80 DPCMDREG EQU DPCmdRegD ; command/status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
81 DPTRKREG EQU DPTrkRegD ; Track register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
82 DPSECREG EQU DPSecRegD ; Sector register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
83 DPDATAREG EQU DPDataRegD ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
84
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
85 CMDREG EQU DPCMDREG+IO ; command/status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
86 TRKREG EQU DPTRKREG+IO ; Track register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
87 SECREG EQU DPSECREG+IO ; Sector register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
88 DATAREG EQU DPDATAREG+IO ; Data register
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
89
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
90 ; Disk IO bitmasks
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
91
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
92 NMIEn EQU NMIEnD
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
93 WPCEn EQU WPCEnD
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
94 SDensEn EQU SDensEnD
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
95 MotorOn EQU MotorOnD
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
96
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
97 ENDC
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
98
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
99 StepRate EQU %00000011
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
100
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
101 tylg set Systm+Objct
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
102 atrv set ReEnt+rev
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
103 rev set $01
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
104
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
105 mod eom,name,tylg,atrv,start,size
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
106 u0000 rmb 2
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
107 BuffPtr rmb 2
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
108 SideSel rmb 1 ; Side select mask
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
109 CurrentTrack rmb 1 ; Current track number
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
110 size equ .
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
111
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
112 name equ *
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
113 fcs /Boot/
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
114 fcb $00
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
115
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
116
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
117
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
118 start equ *
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
119
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
120 ldx #CMdReg
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
121 clra
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
122
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
123 IFNE DragonAlpha
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
124 lda #$30 ; Set PIA2 CA2 as output, as used to control NMI
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
125 ora PIA2CRA
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
126 sta PIA2CRA
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
127 ENDC
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
128
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
129 ldb #size
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
130 L0015 pshs a ; Clear size bytes on system stack
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
131 decb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
132 bne L0015
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
133
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
134 tfr s,u ; Point u to data area on s stack.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
135
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
136 ldx #CMDREG ; Force inturrupt
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
137 lda #FrcInt
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
138 sta ,x
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
139 lbsr Delay ; Wait for command to complete
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
140 lda ,x
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
141 lda >piadb ; Clear DRQ from WD.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
142
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
143 lda #$FF
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
144 sta CurrentTrack,u
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
145 leax >NMIService,pcr ; Setup NMI Handler.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
146 stx >D.XNMI+1
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
147 lda #$7E ; $7E=JMP
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
148 sta >D.XNMI
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
149
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
150 lda #MotorOn ; Turn on motor
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
151 IFNE DragonAlpha
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
152 lbsr AlphaDskCtl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
153 ELSE
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
154 sta >DSKCTL
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
155 ENDC
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
156
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
157 ldd #$C350 ; Delay while motors spin up
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
158 MotorOnDelay
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
159 nop
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
160 nop
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
161 subd #$0001
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
162 bne MotorOnDelay
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
163
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
164 pshs u,x,b,a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
165 clra
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
166 clrb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
167 ldy #$0001
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
168 ldx <D.FMBM
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
169 ldu <D.FMBM+2
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
170 os9 F$SchBit
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
171 bcs L009C
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
172 exg a,b ; Make bitmap into Memory pointer
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
173 ldu $04,s
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
174 std BuffPtr,u ; Save LSN0 pointer
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
175 clrb
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
176
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
177 ldx #$0000 ; Read LSN0 from boot disk.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
178 bsr ReadSec
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
179 bcs L009C ; Error : give up !
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
180 ldd <DD.BSZ,y ; Get size of boot data from LSN0
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
181 std ,s
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
182 os9 F$SRqMem ; Request memory
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
183 bcs L009C ; Error : give up
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
184 stu $02,s
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
185 ldu $04,s
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
186 ldx $02,s
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
187 stx BuffPtr,u
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
188 ldx <DD.BT+1,y ; Get LSN of start of boot
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
189 ldd <DD.BSZ,y ; Get size of boot.
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
190 beq L0095 ; Zero size boot ?, yes : exit
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
191 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
192 ; At this point X=start LSN of boot area, D=size of boot
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
193 ; BuffPtr,u=address to load next sector, Y=pointer to LSN0
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
194 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
195
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
196 LoadBootLoop
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
197 pshs x,b,a
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
198 clrb ; We are only interested in the number of full blocks
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
199 bsr ReadSec ; Read a sector of boot
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
200 bcs L009A ; Error : exit
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
201 puls x,b,a
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
202 inc BuffPtr,u ; Increment MSB of buffpointer, point to next page to load into
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
203 leax $01,x ; Increment sector number
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
204 subd #$0100 ; Decrement number of bytes left
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
205 bhi LoadBootLoop ; Any bytes left to load ?, yes : loop again
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
206
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
207 L0095 clrb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
208 puls b,a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
209 bra L009E
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
210
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
211 L009A leas $04,s
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
212 L009C leas $02,s
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
213 L009E puls u,x
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
214 leas Size,s ; Drop stacked vars.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
215 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
216
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
217 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
218 ; Reset disk heads to track 0
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
219 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
220
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
221 ResetTrack0
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
222 clr ,u
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
223 clr CurrentTrack,u ; Zero current track
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
224 lda #$05
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
225 L00A9 ldb #StpICmnd+StepRate ; Step in
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
226 pshs a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
227 lbsr CommandWaitReady
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
228 puls a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
229 deca
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
230 bne L00A9
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
231 ldb #RestCmnd ; Restore to track 0
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
232 lbra CommandWaitReady
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
233
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
234 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
235 ; Read a sector off disk.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
236 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
237
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
238 ReadSec
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
239 lda #$91 ; Retry count
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
240 cmpx #$0000 ; Reading LSN0 ?
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
241 bne ReadDataWithRetry ; No, just read sector
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
242 bsr ReadDataWithRetry ; Yes read sector
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
243 bcs ReadDataExit ; And restore Y=LSN0 pointer
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
244 ldy BuffPtr,u
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
245 clrb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
246 ReadDataExit
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
247 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
248
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
249 ReadDataRetry
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
250 bcc ReadDataWithRetry ; Retry data read if error
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
251 pshs x,b,a
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
252 bsr ResetTrack0 ; Recal drive
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
253 puls x,b,a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
254
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
255 ReadDataWithRetry
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
256 pshs x,b,a
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
257 bsr DoReadData ; Try reading data
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
258 puls x,b,a
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
259 bcc ReadDataExit ; No error, return to caller
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
260 lsra ; decrement retry count
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
261 bne ReadDataRetry ; retry read on error
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
262
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
263 DoReadData
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
264 bsr SeekTrack ; Seek to correct track
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
265 bcs ReadDataExit ; Error : exit
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
266 ldx BuffPtr,u ; Set X=Data load address
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
267 orcc #$50 ; Enable FIRQ=DRQ from WD
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
268 pshs y,dp,cc
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
269 lda #$FF ; Make DP=$FF, so access to WD regs easier
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
270 tfr a,dp
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
271 lda #$34
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
272 sta <dppia0crb ; Disable out PIA0 IRQ <u0003
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
273 lda #$37
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
274 sta <dppiacrb ; Enable FIRQ
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
275 lda <dppiadb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
276 ldb #NMIEn+MotorOn ; $24
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
277
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
278 IFNE DragonAlpha
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
279 lbsr AlphaDskCtlB
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
280 ELSE
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
281 stb <dpdskctl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
282 ENDIF
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
283
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
284 ldb #ReadCmnd ; Issue a read command
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
285 orb >SideSel,U ; mask in side select
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
286 stb <dpcmdreg
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
287
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
288 ReadDataWait
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
289 sync ; Read data from controler, save
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
290 lda <dpdatareg ; in memory at X
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
291 ldb <dppiadb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
292 sta ,x+
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
293 bra ReadDataWait ; We break out with an NMI
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
294 ;
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
295 ; NMI service routine.
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
296 ;
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
297
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
298 NMIService
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
299
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
300 leas R$Size,s ; Drop saved Regs from stack
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
301 lda #MotorOn
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
302
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
303 IFNE DragonAlpha
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
304 lbsr AlphaDskCtl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
305 ELSE
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
306 sta <dpdskctl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
307 ENDIF
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
308
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
309 lda #$34 ; Disable FIRQ inturrupt
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
310 sta <dppiacrb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
311 ldb <dpcmdreg
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
312 puls y,dp,cc
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
313 bitb #$04 ; Check for error
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
314 lbeq L015A
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
315 L011A comb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
316 ldb #$F4
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
317 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
318
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
319 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
320 ; Seek to a track, at this point Y still points to
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
321 ; in memory copy of LSN0 (if not reading LSN0 !).
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
322 ;
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
323
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
324 SeekTrack
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
325 clr ,u
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
326 tfr x,d
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
327 cmpd #$0000 ; LSN0 ?
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
328 beq SeekCalcSkip
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
329 clr ,-s ; Zero track counter
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
330 bra L012E
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
331
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
332 L012C inc ,s
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
333 L012E subd DD.Spt,Y ; Take sectors per track from LSN
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
334 bcc L012C ; still +ve ? keep looping
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
335 addd DD.Spt,Y ; Compensate for over-loop
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
336 puls a ; retrieve track count.
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
337
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
338 ; At this point the A contains the track number,
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
339 ; and B contains the sector number on that track.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
340
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
341 SeekCalcSkip
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
342 pshs b ; Save sector number
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
343
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
344 LDB DD.Fmt,Y ; Is the media double sided ?
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
345 LSRB
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
346 BCC DiskSide0 ; skip if not
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
347
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
348 LSRA ; Get bit 0 into CC, and devide track by 2
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
349 BCC DiskSide0 ; Even track no so it's on side 0
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
350 ldb #Sid2Sel ; Odd track so on side 1, flag it
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
351 bra SetSide
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
352
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
353 DiskSide0
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
354 clrb
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
355 SetSide
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
356 stb >SideSel,U ; Single sided, make sure sidesel set correctly
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
357
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
358 puls b ; Get sector number
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
359 incb
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
360 stb >SECREG
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
361 ldb CurrentTrack,u
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
362 stb >TRKREG
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
363 cmpa CurrentTrack,u
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
364 beq L0158
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
365 sta CurrentTrack,u
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
366 sta >DATAREG
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
367 ldb #SeekCmnd+3 ; Seek command+ step rate code $13
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
368 bsr CommandWaitReady
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
369 pshs x
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
370
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
371 ldx #$222E ; Wait for head to settle.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
372 SettleWait
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
373 leax -$01,x
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
374 bne SettleWait
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
375
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
376 puls x
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
377 L0158 clrb
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
378 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
379
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
380 L015A bitb #$98
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
381 bne L011A
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
382 clrb
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
383 rts
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
384
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
385 CommandWaitReady
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
386 bsr MotorOnCmdBDelay ; Turn on motor and give command to WD
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
387 CommandWait
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
388 ldb >CMDREG ; Get command status
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
389 bitb #$01 ; finished ?
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
390 bne CommandWait ; nope : continue waiting.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
391 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
392
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
393 MotorOnCmdB
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
394 lda #MotorOn ; Turn on motor
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
395
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
396 IFNE DragonAlpha
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
397 bsr AlphaDskCtl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
398 ELSE
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
399 sta >DSKCTL
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
400 ENDIF
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
401
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
402 stb >CMDREG ; Give command from B
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
403 rts
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
404
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
405 MotorOnCmdBDelay
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
406 bsr MotorOnCmdB
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
407 Delay lbsr Delay2
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
408 Delay2 lbsr Delay3
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
409 Delay3 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
410
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
411 IFNE DragonAlpha
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
412
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
413 ; Translate DragonDos Drive select mechinisim to work on Alpha
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
414 ; 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:
diff changeset
415 ; 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:
diff changeset
416 ; Drive selects, motor on and enable precomp.
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
417 ; This code now expects Alpha NMI/DDEN etc codes, as defined
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
418 ; at top of this file (and dgndefs). The exception to this is
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
419 ; the drive number is still passed in the bottom 2 bits and
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
420 ; converted with a lookup table.
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
421 ; We do not need to preserve the ROM select bit as this code
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
422 ; operates in RAM only mode.
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
423 ; Also sets PIA2 CA2 to enable/disable NMI
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
424
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
425 AlphaDskCtlB
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
426 pshs A
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
427 tfr b,a
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
428 bsr AlphaDskCtl
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
429 puls A
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
430 rts
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
431
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
432 DrvTab FCB Drive0A,Drive1A,Drive2A,Drive3A
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
433
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
434 AlphaDskCtl
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
435 PSHS x,A,B,CC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
436
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
437 PSHS A
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
438 ANDA #NMIEn ; mask out nmi enable bit
1838
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
439
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
440 beq NMIoff ; if zero switch off
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
441
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
442 lda #NMIEnA ; enable NMI
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
443 ora PIA2CRA
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
444 bra NMISave ; save it
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
445
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
446 NMIoff lda #NMIDisA ; disable NMI
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
447 anda PIA2CRA
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
448 NMISave
20adccef595a Added proper NMI disable for Alpha
afra
parents: 1832
diff changeset
449 sta PIA2CRA
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
450
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
451 lda ,s ; Convert drives
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
452 anda #%00000011 ; mask out drive number
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
453 leax DrvTab,pcr ; point at table
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
454 lda a,x ; get bitmap
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
455 ldb ,s
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
456 andb #%11111100 ; mask out drive number
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
457 stb ,s
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
458 ora ,s ; recombine
1832
4ea2e417a48e Fix for non-booting Alpha port.
afra
parents: 1820
diff changeset
459 anda #Mask58 ; make sure 5/8 bit forced low to select 5.25" clock
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
460 sta ,s
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
461
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
462 lda #AYIOREG ; AY-8912 IO register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
463 sta PIA2DB ; Output to PIA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
464 ldb #AYREGLatch ; Latch register to modify
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
465 stb PIA2DA
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
466
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
467 clr PIA2DA ; Idle AY
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
468
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
469 lda ,s+ ; Fetch saved Drive Selects
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
470 sta PIA2DB ; output to PIA
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
471 ldb #AYWriteReg ; Write value to latched register
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
472 stb PIA2DA ; Set register
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
473
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
474 clr PIA2DA ; Idle AY
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
475
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
476 PULS x,A,B,CC
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
477 RTS
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
478
1734
b992196e2ac9 Dragon updates by Phill
boisy
parents: 1729
diff changeset
479
1820
be7da2ee5fe8 Reformatted, corrected comments.
afra
parents: 1734
diff changeset
480 ENDC
1727
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
481
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
482 emod
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
483 eom equ *
78ce0a5ffc8e Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
diff changeset
484 end