mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-12-11 08:50:50 +00:00
309 lines
13 KiB
Plaintext
309 lines
13 KiB
Plaintext
|
;
|
||
|
; File: NewAgeEqu.a
|
||
|
;
|
||
|
; Contains: This is the equate file for the NewAge Floppy Disk Controller.
|
||
|
;
|
||
|
; Written by: Robert Polic
|
||
|
;
|
||
|
; Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
|
||
|
;
|
||
|
; This file is used in these builds:
|
||
|
;
|
||
|
; Change History (most recent first):
|
||
|
;
|
||
|
; <SM8> 6/14/93 kc Roll in Ludwig.
|
||
|
; <LW7> 5/19/93 WS Changed reties to 25 except for verification, which stays as 3.
|
||
|
; <LW6> 5/10/93 WS The PreComp value were correct, the measurement was wrong,
|
||
|
; changing it back to vakue in LW4.
|
||
|
; <LW5> 5/1/93 WS Change the precom value since the Newage doc. specify them
|
||
|
; incorrectly.
|
||
|
; <LW4> 3/24/93 WS Change the number of retries back to 3 since things are working
|
||
|
; reliably now.
|
||
|
; <LW3> 3/8/93 WS Add allocation for DT queue in template.
|
||
|
; <LW2> 12/14/92 WS Removed some flags that are no longer needed.
|
||
|
; <SM7> 11/30/92 WS Added Mode32 flag which is use to conditional compile code that
|
||
|
; is need to switch between 24 and 32 bit mode. Since Cyclone is
|
||
|
; alway 32 bit these code are not necessary. Change the Gap Skip
|
||
|
; Length to $1B, the recommand value since NEC have fixed a bug
|
||
|
; for Newage 1.4 that load this value into the sector counter.
|
||
|
; Added some equ to remove more hard coded values.
|
||
|
; <SM6> 10/7/92 WS Add NoBug for conditional assembling. This will be obsolete
|
||
|
; once NEC fix the bug in Read A Track.
|
||
|
; <SM5> 10/7/92 WS Add a whole bunch of equates to be use with the driver.
|
||
|
; <SM4> 9/23/92 WS Fix Buffersize so that MTMode flag determind how big it ought to
|
||
|
; be.
|
||
|
; <SM3> 8/28/92 WS BufferSize is always twice the SectorsCylinder
|
||
|
; <SM2> 7/24/92 RLM update to supermario
|
||
|
; <P2> 7/2/92 RMP Added new equates.
|
||
|
; <1> 4/10/92 RMP first checked in
|
||
|
;
|
||
|
; To Do:
|
||
|
;
|
||
|
|
||
|
|
||
|
PolledMode EQU 0 ; Run driver in polled mode.
|
||
|
MTMode EQU 0 ; Run driver in multi-track mode.
|
||
|
RetryCount EQU 25 ; Number of retries.
|
||
|
VerifyRetry EQU 3 ; Number of retries during disk verification.
|
||
|
|
||
|
SectorsCylinder EQU 36 ; Max. number of sectors/side…
|
||
|
; …for the largest supported drive.
|
||
|
; For Typhoon (2.8): 36
|
||
|
; For SuperDrive (1.4): 18
|
||
|
; For 800K: 12
|
||
|
|
||
|
|
||
|
IF MTMode THEN
|
||
|
BufferSize EQU SectorsCylinder * 2 ; Size of buffer in blocks.
|
||
|
ELSE
|
||
|
BufferSize EQU SectorsCylinder ; Size of buffer in blocks.
|
||
|
ENDIF
|
||
|
BlockSize EQU 516 ; Actually block are 512 bytes <SM7>
|
||
|
; 4 extra bytes are need for DiskCopy. <SM7>
|
||
|
WaitTime EQU 3*60 ; 3 second timeout for motor. <SM5>
|
||
|
|
||
|
|
||
|
NewAge32 EQU $50F2A000 ; FDC address in 32 bit space.
|
||
|
pscControl32 EQU $50F31C30 ; PSC control register in 32 bit space.
|
||
|
pscSet032 EQU $50F32060 ; Base of DMA Set0 in 32 bit space.
|
||
|
NewAgeVars EQU $134 ; Storage for variables.
|
||
|
VIA2IER EQU $50f03c00 ; <SM5>
|
||
|
VIA2IFR EQU $50f03a00 ; <SM5>
|
||
|
FloppyEntry EQU 5*4 ; Floppy is the five driver in table <SM7>
|
||
|
; Each entry is a long word. <SM7>
|
||
|
|
||
|
EnableFDCInt EQU $A0 ; VIA2IER Newage interrupt enable. SM5>
|
||
|
DisableFDCInt EQU $20 ; VIA2IER Newage interrupt flag. <SM5>
|
||
|
FDCInt EQU 5 ; Newage Interrupt bit <SM5>
|
||
|
; FDC register offsets…
|
||
|
fdcMSR EQU $101 ; Main status register.
|
||
|
fdcDRR EQU $101 ; Data rate register.
|
||
|
fdcDATA EQU $141 ; Data register.
|
||
|
|
||
|
; Register bits…
|
||
|
fRQM EQU 7 ; MSR - Request for master.
|
||
|
fDIO EQU 6 ; MSR - Direction I/O.
|
||
|
fExecute EQU 5 ; MSR - For polled I/O.
|
||
|
fCmdBsy EQU 4 ; MSR - Command busy.
|
||
|
fDrv1In EQU 3 ; MSR - Drive 1 installed.
|
||
|
fDrv0In EQU 2 ; MSR - Drive 0 installed.
|
||
|
fDrv1Bsy EQU 1 ; MSR - Drive 1 busy.
|
||
|
fDrv0Bsy EQU 0 ; MSR - Drive 0 busy.
|
||
|
|
||
|
fReset EQU 7 ; DRR - Reset FDC.
|
||
|
fStandBy EQU 6 ; DRR - Enter stand by mode.
|
||
|
|
||
|
; Precomp values…
|
||
|
PreCompOffset EQU 2 ; Precomp bits starts with bit 2. <SM5>
|
||
|
ApplePreComp EQU %011 ; For Apple MFM. <SM5>
|
||
|
NoPreComp EQU %111 ; 0 ns for precomp. <SM5>
|
||
|
|
||
|
; Data rate values…
|
||
|
DataRateOffset EQU 0 ; Data rate bits start with bit 0. <SM5>
|
||
|
dr500 EQU %00 ; 500 or 489.6 kbps. <SM5>
|
||
|
dr300 EQU %01 ; 300 kbps. <SM5>
|
||
|
dr250 EQU %10 ; 250 kbps. <SM5>
|
||
|
dr1000 EQU %11 ; 1000 or 1250 kbps. <SM5>
|
||
|
|
||
|
fMT EQU 7 ; Multi-track bit.
|
||
|
fFM EQU 6 ; MFM/GCR bit.
|
||
|
fHd EQU 2 ; Side 1 if set <SM5>
|
||
|
|
||
|
; Cause of Newage Interrupt… bits D7 and D6 of status 0 <SM5>
|
||
|
IntStatOffset EQU 6 ; Interrupt bits starts at bit 6. <SM5>
|
||
|
NrmlTrmnt EQU %00 ; Normal Termination of command. <SM5>
|
||
|
AbnrmlTrmnt EQU %01 ; Abnormal Termination of command. <SM5>
|
||
|
InvldCmnd EQU %10 ; Invalid commmand. <SM5>
|
||
|
CssttChng EQU %11 ; /CSTIN state change. <SM5>
|
||
|
|
||
|
; Status Register 0… <SM5>
|
||
|
fSeek EQU 5 ; Status 0 - Set after seek or recal. <SM5>
|
||
|
fFDDErr EQU 4 ; Status 0 - Set if error at FDD occurs. <SM5>
|
||
|
fReady EQU 3 ; Status 0 - Set if FDD not ready. <SM5>
|
||
|
fDiskStatus EQU 1 ; Status 0 - Clear after disk insert. <SM5>
|
||
|
fDrive EQU 0 ; Status 0 - Drive select bit. <SM5>
|
||
|
|
||
|
; Status Register 1… <SM5>
|
||
|
fEndOfCylndr EQU 7 ; Status 1 - Acess beyond last cylinder <SM5>
|
||
|
fDataErr EQU 5 ; Status 1 - Checksum error. <SM5>
|
||
|
fOvrRun EQU 4 ; Status 1 - Over or Under Run. <SM5>
|
||
|
fNoData EQU 2 ; Status 1 - Can't found sector. <SM5>
|
||
|
fWrtPrtct EQU 1 ; Status 1 - Write protected. <SM5>
|
||
|
fNoAddrMrk EQU 0 ; Status 1 - Missing Address Mark. <SM5>
|
||
|
|
||
|
; Status Register 2… <SM5>
|
||
|
fCntrlMrk EQU 6 ; Status 2 - Detected delete data mark. <SM5>
|
||
|
fDataField EQU 5 ; Status 2 - Checksum error at data field. <SM5>
|
||
|
fNoCylndr EQU 4 ; Status 2 - Can't find cylinder. <SM5>
|
||
|
fBadCylndr EQU 1 ; Status 2 - Bad Cylinder. <SM5>
|
||
|
fNoDataAddrMrk EQU 0 ; Status 2 - Missing data address mark. <SM5>
|
||
|
|
||
|
; Status Register 3… <SM5>
|
||
|
fWriteStatus EQU 6 ; Write Protect. <SM5>
|
||
|
fDriveStatus EQU 3 ; Set if 2MD 0r 4MD present. <SM5>
|
||
|
fMode EQU 2 ; Mode ID of FDD. <SM5>
|
||
|
|
||
|
; Format Code…
|
||
|
formatGCR400K EQU $12 ; GCR format, 400K. <SM5>
|
||
|
formatGCR2_1 EQU $22 ; GCR format, 800K 2 to 1 interleave. <SM5>
|
||
|
formatGCR4_1 EQU $24 ; GCR format, 800K 4 to 1 interleave. <SM5>
|
||
|
formatMFM500 EQU $02 ; MFM format code, 500kbps. <SM5>
|
||
|
|
||
|
; Format Table equates…
|
||
|
ftBlocks EQU 2 ; Offset to number of blocks. <SM5>
|
||
|
ftFlags EQU 4 ; Upper nibble is flags. <SM5>
|
||
|
ftSides EQU 4 ; Lower nibble is sides. <SM5>
|
||
|
ftSectors EQU 5 ; Offset to number of sectors per track. <SM5>
|
||
|
ftFormatByte EQU 8 ; <SM5>
|
||
|
ftGap3Length EQU 9 ; Offset to number of bytes in Gap 3. <SM5>
|
||
|
ftSyncGroups EQU 9 ; Offset to number of sync groups. <SM5>
|
||
|
ftFormatCode EQU 10 ; Offset to format code. <SM5>
|
||
|
ftNextTable EQU 12 ; Offset to next table (each entry 12 bytes).<SM5>
|
||
|
|
||
|
; Interleave Table equates…
|
||
|
itNextZone EQU 12 ; Offset to next speed zone for GCR interleave table. <SM5>
|
||
|
itSectors EQU 10 ; Offset to sector/zone in GCR side tables. <SM5>
|
||
|
|
||
|
;Misc…
|
||
|
GCRCylndrs EQU 16 ; Number of Cylinders per GCR speed zone. <SM5>
|
||
|
MFMCylndrs EQU 80 ; Number of Cylinders in MFM speed zone. <SM5>
|
||
|
DiskCylndrs EQU 80 ; Number od cylinders per disk. <SM5>
|
||
|
GSL EQU $1B ; Gap skip lenght. <SM5>
|
||
|
vertical EQU $3 ; bits to set to enable vertical mode <SM7>
|
||
|
|
||
|
; PSC register offsets…
|
||
|
pscAddress EQU $00 ; Offset to address register.
|
||
|
pscCount EQU $04 ; Offset to count register.
|
||
|
pscStatus EQU $08 ; Offset to status register.
|
||
|
|
||
|
; PSC register bits…
|
||
|
pscTermCnt EQU 10 ; Status - Terminal count.
|
||
|
pscDir EQU 9 ; Status - PSC Channel Direction bit, set = read. <SM5>
|
||
|
pscEnable EQU 11 ; Status - PSC Channel Enable bit. <SM5>
|
||
|
|
||
|
pscCIRQ EQU 8 ; Control - PSC channel interrup request. <SM5>
|
||
|
pscFlush EQU 9 ; Control - PSC pause. <SM5>
|
||
|
pscPause EQU 10 ; Control - PSC flush. <SM5>
|
||
|
pscSWReset EQU 11 ; Control - PSC software reset. <SM5>
|
||
|
pscBErr EQU 13 ; Control - PSC bus error. <SM5>
|
||
|
pscFrozen EQU 14 ; Control - PSC frozen. <SM5>
|
||
|
pscSense EQU 15 ; Control - PSC Sense bit. <SM5>
|
||
|
|
||
|
; FDC commands… (* Available only in Apple mode)
|
||
|
Configure EQU %00010011 ; Configure FDC.
|
||
|
DisableDPLL EQU %00001011 ; Disable digital phase lock loop.*
|
||
|
DumpReg EQU %00001110 ; Dump registers.
|
||
|
EjectFloppy EQU %01010010 ; Eject disk.*
|
||
|
EnableDPLL EQU %10001011 ; Enable digital phase lock loop.*
|
||
|
Format EQU %01001101 ; Format a track.
|
||
|
FormatWrite EQU %01000001 ; Format and write track.*
|
||
|
PerpMode EQU %00010010 ; Perpendicular mode.
|
||
|
RawDump EQU %01011110 ; Raw track dump.*
|
||
|
IF MTMode THEN
|
||
|
ReadData EQU %11000110 ; Read data.
|
||
|
ELSE
|
||
|
ReadData EQU %01000110 ; Read data.
|
||
|
ENDIF
|
||
|
ReadDelData EQU %01001100 ; Read deleted data.
|
||
|
ReadGCRID EQU %00001010 ; Read ID.
|
||
|
ReadMFMID EQU %01001010 ; Read ID.
|
||
|
ReadTrack EQU %01000010 ; Read track.
|
||
|
Recalibrate EQU %00000111 ; Recalibrate.
|
||
|
RelSeek EQU %10001111 ; Relative seek.
|
||
|
Revision EQU %00100000 ; Firmware and hardware revision level.
|
||
|
ScanEqual EQU %01010001 ; Scan and compare equal.
|
||
|
ScanHighEqual EQU %01011101 ; Scan and compare greater or equal.
|
||
|
ScanLowEqual EQU %01011001 ; Scan and compare less or equal.
|
||
|
Seek EQU %00001111 ; Seek to a track.
|
||
|
SelectDriveType EQU %00110010 ; Select drive type.
|
||
|
SenseDrvStatus EQU %00000100 ; Sense drive status.
|
||
|
SenseIntStatus EQU %00001000 ; Sense interrupt status.
|
||
|
SetDriveGCR EQU %00011100 ; Enable GCR.*
|
||
|
SetDriveMFM EQU %01011100 ; Enable MFM.*
|
||
|
SetEnableOff EQU %00011011 ; Turn off drive enable.*
|
||
|
SetEnableOn EQU %10011011 ; Turn on drive enable.*
|
||
|
SetMotorOff EQU %00011010 ; Turn off drive motor.*
|
||
|
SetMotorOn EQU %10011010 ; Turn on drive motor.*
|
||
|
Specify EQU %00000011 ; Specify parameters.
|
||
|
Verify EQU %01110110 ; Verify sector.
|
||
|
Version EQU %00010000 ; Get FDC version.
|
||
|
WriteData EQU %01000101 ; Write data.
|
||
|
WriteDelData EQU %01001001 ; Write deleted data.
|
||
|
|
||
|
; Drive interface equates…
|
||
|
drvStandard EQU 0 ; Standard FDD interface.
|
||
|
drv13MB EQU 1 ; 13 megabyte FDD interface.
|
||
|
drvReserved EQU 2 ; Undefined.
|
||
|
drvApple EQU 3 ; Apple FDD interface.
|
||
|
|
||
|
; Drive type equates…
|
||
|
fddNone EQU 0 ; No drive.
|
||
|
fddUnknown EQU 1 ; Unknown drive.
|
||
|
fddMac400 EQU 2 ; Single sided 400K drive.
|
||
|
fddMac800 EQU 3 ; Double sided 800K drive.
|
||
|
fddSuperDrive EQU 4 ; 2-Meg SuperDrive.
|
||
|
fddTyphoon EQU 5 ; 4-Meg Typhoon.
|
||
|
fdd13Meg EQU 6 ; Reserved.
|
||
|
|
||
|
; Floppy media equates…
|
||
|
mNone EQU 0 ; No media.
|
||
|
mUnknown EQU 1 ; Unknown media.
|
||
|
mLD EQU 2 ; Low density.
|
||
|
mHD EQU 3 ; High density.
|
||
|
mED EQU 4 ; Extended density.
|
||
|
|
||
|
; Floppy format equates…
|
||
|
fNone EQU 0 ; No disk.
|
||
|
fBlank EQU 1 ; Unformatted.
|
||
|
f400K EQU 2 ; 400K GCR.
|
||
|
f800K EQU 3 ; 800K GCR.
|
||
|
fProDOS EQU 4 ; 800K GCR (ProDOS).
|
||
|
fUnknownGCR EQU 5 ; Unknown GCR.
|
||
|
f720K EQU 6 ; 720K MFM.
|
||
|
f1440K EQU 7 ; 1.4 MFM.
|
||
|
f2880K EQU 8 ; 2.8 MFM (Perpendicular).
|
||
|
f10Meg EQU 9 ; Reserved.
|
||
|
|
||
|
; Floppy info record…
|
||
|
FloppyRecord RECORD 0
|
||
|
fNextRecord DS.L 1 ; Pointer to next floppy info record.
|
||
|
fFormat DS.W 1 ; Format type (none,400,720,800,1440,2880).
|
||
|
fMediaType DS.W 1 ; Media type (LD, HD or ED).
|
||
|
fDriveType DS.W 1 ; Drive type (800K, SuperDrive, Typhoon).
|
||
|
fDriveNum DS.W 1 ; Drive number.
|
||
|
fDriveSelect DS.W 1 ; Drive select (0 or 1).
|
||
|
fDriveQueue DS.L 1 ; Drive queue element.
|
||
|
fBuffer DS.L 1 ; Pointer to sector buffer.
|
||
|
fStart DS.W 1 ; Starting sector of buffer.
|
||
|
fCount DS.W 1 ; Number of sectors in buffer.
|
||
|
fMotor DS.W 1 ; Motor on flag.
|
||
|
fLastAccess DS.L 1 ; Last time drive was accessed.
|
||
|
fSoftErrors DS.W 1 ; Number of soft errors since drvr opened.
|
||
|
fHardErrors DS.W 1 ; Number of hard errors since drvr opened.
|
||
|
fResult DS.W 1 ; I/O result.
|
||
|
fCompletion DS.L 1 ; Pointer to driver completion routine.
|
||
|
fDCE DS.L 1 ; Pointer to DCE.
|
||
|
fDataBfr DS.L 1 ; Data buffer.
|
||
|
fCounter DS.L 1 ; Counter.
|
||
|
fPosition DS.L 1 ; Current position.
|
||
|
fStatus0 DS.B 1 ; Status 0.
|
||
|
fStatus1 DS.B 1 ; Status 1.
|
||
|
fStatus2 DS.B 1 ; Status 2.
|
||
|
fStatus3 DS.B 1 ; Status 3.
|
||
|
fCylinder DS.B 1 ; Cylinder.
|
||
|
fHead DS.B 1 ; Head.
|
||
|
fSector DS.B 1 ; Sector.
|
||
|
fData DS.B 1 ; Data length code.
|
||
|
fCode DS.B 1 ; Format code.
|
||
|
fLastSector DS.B 1 ; High sector number.
|
||
|
fRetries DS.B 1 ; Number of retries.
|
||
|
fRetrySeed DS.B 1 ; Max. number of retries to perform.
|
||
|
fError1 DS.L 2 ; Last three errors.
|
||
|
fError2 DS.L 2
|
||
|
fError3 DS.L 2
|
||
|
DTQE DS.b 20 ; Deferred task queue element
|
||
|
DTInstalled DS.b 1 ; flag, non-zero if DT installed
|
||
|
fRecSize EQU * ; Size of record.
|
||
|
ENDR
|
||
|
|