; ; 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): ; ; 6/14/93 kc Roll in Ludwig. ; 5/19/93 WS Changed reties to 25 except for verification, which stays as 3. ; 5/10/93 WS The PreComp value were correct, the measurement was wrong, ; changing it back to vakue in LW4. ; 5/1/93 WS Change the precom value since the Newage doc. specify them ; incorrectly. ; 3/24/93 WS Change the number of retries back to 3 since things are working ; reliably now. ; 3/8/93 WS Add allocation for DT queue in template. ; 12/14/92 WS Removed some flags that are no longer needed. ; 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. ; 10/7/92 WS Add NoBug for conditional assembling. This will be obsolete ; once NEC fix the bug in Read A Track. ; 10/7/92 WS Add a whole bunch of equates to be use with the driver. ; 9/23/92 WS Fix Buffersize so that MTMode flag determind how big it ought to ; be. ; 8/28/92 WS BufferSize is always twice the SectorsCylinder ; 7/24/92 RLM update to supermario ; 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 ; 4 extra bytes are need for DiskCopy. WaitTime EQU 3*60 ; 3 second timeout for motor. 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 ; VIA2IFR EQU $50f03a00 ; FloppyEntry EQU 5*4 ; Floppy is the five driver in table ; Each entry is a long word. EnableFDCInt EQU $A0 ; VIA2IER Newage interrupt enable. SM5> DisableFDCInt EQU $20 ; VIA2IER Newage interrupt flag. FDCInt EQU 5 ; Newage Interrupt bit ; 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. ApplePreComp EQU %011 ; For Apple MFM. NoPreComp EQU %111 ; 0 ns for precomp. ; Data rate valuesÉ DataRateOffset EQU 0 ; Data rate bits start with bit 0. dr500 EQU %00 ; 500 or 489.6 kbps. dr300 EQU %01 ; 300 kbps. dr250 EQU %10 ; 250 kbps. dr1000 EQU %11 ; 1000 or 1250 kbps. fMT EQU 7 ; Multi-track bit. fFM EQU 6 ; MFM/GCR bit. fHd EQU 2 ; Side 1 if set ; Cause of Newage InterruptÉ bits D7 and D6 of status 0 IntStatOffset EQU 6 ; Interrupt bits starts at bit 6. NrmlTrmnt EQU %00 ; Normal Termination of command. AbnrmlTrmnt EQU %01 ; Abnormal Termination of command. InvldCmnd EQU %10 ; Invalid commmand. CssttChng EQU %11 ; /CSTIN state change. ; Status Register 0É fSeek EQU 5 ; Status 0 - Set after seek or recal. fFDDErr EQU 4 ; Status 0 - Set if error at FDD occurs. fReady EQU 3 ; Status 0 - Set if FDD not ready. fDiskStatus EQU 1 ; Status 0 - Clear after disk insert. fDrive EQU 0 ; Status 0 - Drive select bit. ; Status Register 1É fEndOfCylndr EQU 7 ; Status 1 - Acess beyond last cylinder fDataErr EQU 5 ; Status 1 - Checksum error. fOvrRun EQU 4 ; Status 1 - Over or Under Run. fNoData EQU 2 ; Status 1 - Can't found sector. fWrtPrtct EQU 1 ; Status 1 - Write protected. fNoAddrMrk EQU 0 ; Status 1 - Missing Address Mark. ; Status Register 2É fCntrlMrk EQU 6 ; Status 2 - Detected delete data mark. fDataField EQU 5 ; Status 2 - Checksum error at data field. fNoCylndr EQU 4 ; Status 2 - Can't find cylinder. fBadCylndr EQU 1 ; Status 2 - Bad Cylinder. fNoDataAddrMrk EQU 0 ; Status 2 - Missing data address mark. ; Status Register 3É fWriteStatus EQU 6 ; Write Protect. fDriveStatus EQU 3 ; Set if 2MD 0r 4MD present. fMode EQU 2 ; Mode ID of FDD. ; Format CodeÉ formatGCR400K EQU $12 ; GCR format, 400K. formatGCR2_1 EQU $22 ; GCR format, 800K 2 to 1 interleave. formatGCR4_1 EQU $24 ; GCR format, 800K 4 to 1 interleave. formatMFM500 EQU $02 ; MFM format code, 500kbps. ; Format Table equatesÉ ftBlocks EQU 2 ; Offset to number of blocks. ftFlags EQU 4 ; Upper nibble is flags. ftSides EQU 4 ; Lower nibble is sides. ftSectors EQU 5 ; Offset to number of sectors per track. ftFormatByte EQU 8 ; ftGap3Length EQU 9 ; Offset to number of bytes in Gap 3. ftSyncGroups EQU 9 ; Offset to number of sync groups. ftFormatCode EQU 10 ; Offset to format code. ftNextTable EQU 12 ; Offset to next table (each entry 12 bytes). ; Interleave Table equatesÉ itNextZone EQU 12 ; Offset to next speed zone for GCR interleave table. itSectors EQU 10 ; Offset to sector/zone in GCR side tables. ;MiscÉ GCRCylndrs EQU 16 ; Number of Cylinders per GCR speed zone. MFMCylndrs EQU 80 ; Number of Cylinders in MFM speed zone. DiskCylndrs EQU 80 ; Number od cylinders per disk. GSL EQU $1B ; Gap skip lenght. vertical EQU $3 ; bits to set to enable vertical mode ; 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. pscEnable EQU 11 ; Status - PSC Channel Enable bit. pscCIRQ EQU 8 ; Control - PSC channel interrup request. pscFlush EQU 9 ; Control - PSC pause. pscPause EQU 10 ; Control - PSC flush. pscSWReset EQU 11 ; Control - PSC software reset. pscBErr EQU 13 ; Control - PSC bus error. pscFrozen EQU 14 ; Control - PSC frozen. pscSense EQU 15 ; Control - PSC Sense bit. ; 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