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