sys7.1-doc-wip/Internal/Asm/EDiskEqu.a
2019-07-27 22:37:48 +08:00

226 lines
10 KiB
Plaintext

;
; File: EDiskEqu.a
;
; Contains: Equates and Data structures used internally by the EDisk Driver.
;
; Copyright: © 1988-1991, 1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM7> 11/9/93 SAM Roll in <MC5> from mc900ftjesus.
; <MC4> 11/9/93 SAM Reducing the max edisk size to 255 MB. Tough.
; <SM6> 11/8/93 SAM Roll in <MC3> from mc900ftjesus.
; <MC3> 11/8/93 SAM Added MaxRamDiskSize. Currently set to 256MB -1.
; <SM5> 10/28/93 CCH Just checking to see if you were paying attention.. Really added
; EDiskProtect equate to EDiskDriveInfo record.
; <SM4> 10/28/93 CCH Added EDiskProtect equate to EDiskDriveInfo record.
; <SM3> 6/17/93 kc Roll in Ludwig.
; <LW5> 6/16/93 KW Ok mess with MinHeapSize again. now equal to 0x00260000, which
; is the current value of the mnrm resource in the memory control
; panel. Power users will be able to open the memory control
; panel and lower the mnrm resource to this value and still have a
; ram disk.
; <SM1> 11/01/92 HY Added GintyHeader record to support ROM disks.
; <5> 10/28/91 SAM/KSM Rolled in Regatta file.
;
; Terror Change History:
;
; <7> 6/26/91 CCH Moved RAM disk base to slot 7 space so as not to conflict with
; DB Lite's frame buffer,.
; <6> 6/25/91 CCH Moved RAM disk base to $60000000 and added MinRamDiskSize
; equate.
; <5> 6/13/91 CCH Moved RamDiskSize to EDiskDriveInfo record.
; <4> 6/13/91 CCH Moved bRamDisk equate in from MMUTables.a.
; <3> 4/2/91 CCH Reduced minimum heap size to allow for space used by BootGlobs.
; <2> 12/20/90 CCH Added memory allocation equates for Edisk driver.
; ———————————————————————————————————————————————————————————————————————————————————————
; Pre-TERROR ROM comments begin here.
; ———————————————————————————————————————————————————————————————————————————————————————
; <2> 5/16/90 JJ Modify parameter ram byte address. Merged two bytes ($75-76)
; into one ($AF) since only 1 bit was used from $75.
; <1.2> 5/26/89 GMR Changed RomSpaceEnd from $F00000 to $E00000, added new RAM disk
; size status code (drvSizeCode)
; <1.1> 2/21/89 GGD Added support for SLIM interface adapter. Changed origin in
; EDiskDriveInfo record to be DriveQElement.
; <1.0> 11/9/88 CCH Adding to EASE.
;
; To Do:
;
IF &TYPE('__INCLUDINGEDISKPRIVEQU__') = 'UNDEFINED' THEN
__INCLUDINGEDISKPRIVEQU__ SET 1
EDiskDriveInfo record {DriveQElement},increment ; drive specific variables
SLIMRegPtr ds.l 1 ; pointer to hardware polling regs (SLIMs only)
HWDepProcPtr ds.l 1 ; pointer to HW dependent function handler proc
HeaderInfoPtr ds.l 1 ; pointer to header info if present
FormatTime ds.l 1 ; time when disk last formatted
FormatTicks ds.l 1 ; ticks when last formatted
CheckSumPtr ds.l 1 ; pointer to CheckSum table if present
DataStartPtr ds.l 1 ; pointer to first byte of data storage
DataEndPtr ds.l 1 ; pointer to last byte+1 of data storage
MediaIconPtr ds.l 1 ; pointer to media Icon and Mask
DriveIconPtr ds.l 1 ; pointer to drive Icon and Mask
WhereStringPtr ds.l 1 ; pointer to GetInfo Where: string
DriveInfo ds.l 1 ; longword for Return Drive Info call
MountedFlag equ 0 ; disk inserted event successfully posted
CreateWithXSums equ 1 ; create RAM EDisk with checksums by default
EDiskProtect equ 2 ; EDisk data buffer is protected
Flags ds.b 1 ; state flags
DiskInPlaceInit ds.b 1 ; $02, $08, $48. Value for DiskInPlace when inserted
InsertedMask equ (1<<3)-1 ; last 3 polls are relevant
InsertedStatus ds.b 1 ; inserted status from last 8 polls
align 4 ; long word align
RamDiskSize ds.l 1 ; size of memory for RAM disk, in bytes <T5>
WriteProtected ds.b 1 ; bit7=1=write protected
DiskInPlace ds.b 1 ; 0 = no disk place, 1 or 2 = disk in place
Installed ds.b 1 ; 0 = don't know, 1=installed, $FF=not installed
Sides ds.b 1 ; bit7=0=single sided, bit7=1=double sided
; record origin is here (fields above have negative offsets)
DriveQElement ds.b dQDrvSz2+2 ; standard drive queue element
DQE equ DriveQElement ; just a shorter name
EDiskDriveInfoSize equ *-EDiskDriveInfo; size of drive specific variables
endr
EDiskVars record 0,increment ; global variables used by driver
FindDqePatch ds.w 3 ; either an RTS or JMP.L $xxxxxxxx
PrimePatch ds.w 3 ; either an RTS or JMP.L $xxxxxxxx
DCEpointer ds.l 1 ; pointer to device control entry
Active ds.b 1 ; Indicates request in progress
align 2
VTask ds.b vblPhase+2 ; Virtical Retrace Task info
IconAndMaskSize equ ((32*32)/8)*2 ; room for Icon data and mask
WhereStringSize equ 32 ; room for name string
IconBuffer ds.b IconAndMaskSize
WhereStringBuff ds.b WhereStringSize
align 2
EDiskVarsSize equ * ; size of global variables used by driver
endr
eDiskPollRate equ 17 ; 17 ticks = 0.2833333 seconds
ejectPolls equ 11 ; give up on eject after about 3 seconds
; EDisk Drive Types (for Return Drive Info control call)
ramDiskType equ 16 ; EDisk allocated in system RAM space
romDiskType equ 17 ; EDisk in expansion ROM space
slimDiskType equ 18 ; EDisk on SLIM card
; EDisk header block
EDiskHeader record 0,increment ; layout of the slim signature block
HdrScratch ds.b 128 ; scratch space for r/w testing and vendor info
HdrBlockSize ds.w 1 ; size of header block (512 bytes for version 1)
HdrVersion ds.w 1 ; header version number (this is version 1)
HdrSignature ds.b 12 ; 'EDisk Gary D'
HdrDeviceSize ds.l 1 ; size of device, in bytes
HdrFormatTime ds.l 1 ; time when last formatted (pseudo unique ID)
HdrFormatTicks ds.l 1 ; ticks when last formatted (pseudo unique ID)
HdrCheckSumOff ds.l 1 ; offset to CheckSum table if present
HdrDataStartOff ds.l 1 ; offset to first byte of data storage
HdrDataEndOff ds.l 1 ; offset to last byte+1 of data storage
HdrMediaIconOff ds.l 1 ; offset to media Icon and Mask if present
HdrDriveIconOff ds.l 1 ; offset to drive Icon and Mask if present
HdrWhereStrOff ds.l 1 ; offset to GetInfo Where: string if present
HdrDriveInfo ds.l 1 ; longword for Return Drive Info call if present
ds.b 512-* ; rest of block is reserved
EDiskHeaderSize equ * ; size of EDisk header block
endr
; <SM1><Begin>
;•••••••••••••••••••••••••••• Ginty ROM Header ••••••••••••••••••••••••••••
GintyHeader record 0,increment ; layout of the slim signature block
HdrScratch ds.b 128 ; scratch space for r/w testing and vendor info
HdrBlockSize ds.w 1 ; size of header block (512 bytes for version 1)
HdrVersion ds.w 1 ; header version number (this is version 1)
HdrSignature ds.b 12 ; 'Ginty HYGWGA'
HdrDeviceSize ds.l 1 ; size of device, in bytes
HdrFormatTime ds.l 1 ; time when last formatted (pseudo unique ID)
HdrFormatTicks ds.l 1 ; ticks when last formatted (pseudo unique ID)
HdrCheckSumOff ds.l 1 ; offset to CheckSum table if present
HdrDataStartOff ds.l 1 ; offset to first byte of data storage
HdrDataEndOff ds.l 1 ; offset to last byte+1 of data storage
HdrMediaIconOff ds.l 1 ; offset to media Icon and Mask if present
HdrDriveIconOff ds.l 1 ; offset to drive Icon and Mask if present
HdrWhereStrOff ds.l 1 ; offset to GetInfo Where: string if present
HdrDriveInfo ds.l 1 ; longword for Return Drive Info call if present
HdrEDiskOffset ds.l 1 ; offset to EDisk driver
HdrBootCode ds.l 1 ; offset to Patch code for loading EDisk driver and boot process
ds.b 512-* ; rest of block is reserved
GintyHdrSize equ * ; size of Ginty header block
endr ; <SM1><End>
; Internal ROM disks are aligned on 64KB boundarys starting in the system ROM
; and running up to the beginning of I/O space
RomDiskAlign equ $00010000 ; aligned on 64K byte boundarys
RomSpaceEnd equ $00E00000 ; don't search I/O space <1.2>
ROMSize equ $00400000 ; search a 4mb ROM space <SM1>
; EDisk parameter RAM usage
slimsExist equ 7 ; bit 7 = 0, slims have never been seen
; bit 7 = 1, slims have been seen
ramDiskPramAddr equ $AF ; PRam byte (bits 0-6) is RamDisk size / 64KB
drvSizeCode equ $4544 ; Status code for drive size call <1.2>
; Function codes passed to HWDepProcPtr in register D0
CheckEDiskInserted equ 0
CheckEDiskReadOnly equ 1
EnableEDiskWrites equ 2
DisableEDiskWrites equ 3
EjectEDisk equ 4
; SLIMs are mapped into RAM as follows
slim0RamBase equ $00500000 ; SLIM 0 is mapped here in the address space
slim1RamBase equ $00700000 ; SLIM 1 is mapped here in the address space
; SLIM register addresses, eventually move to HardwareEqu.a
slimAdapterROM equ $00E00000 ; base of 64K rom on slim adapter
slimAdapterInfo equ $00FC0200 ; address of slim adapter status reg
slimsInstalled equ 3 ; bit 3 = 1 if slim adapter installed
slim0RegBase equ $00F00000 ; register base for slim 0 (upper)
slim1RegBase equ $00F00030 ; register base for slim 1 (lower)
slimStatusReg equ $00000000 ; offset to slim status register
*slimInserted equ 3 ; bit 3 = 1 if slim is inserted
slimReadOnly equ 2 ; bit 2 = 1 if slim is ROM or Write Protected
slimEjectReg equ $00000010 ; offset to slim eject control register
slimNotEjecting equ 3 ; bit 3 = 1 if slim is not ejecting
; (buffers enabled)
; bit 3 = 0 to start eject and disable
; buffers (on falling edge)
slimProtectReg equ $00000020 ; offset to slim write protect register
slimNoWrites equ 3 ; bit 3 = 1 if software write protected
; Memory allocation equates for Edisk
bRamDisk EQU $70000000 ; base of Ram Disk area (32 bit mode) <T7>
MinRamDiskSize EQU $00030000 ; minimum disk size is 192k <T6>
MaxRamDiskSize EQU $0FF00000 ; maximum disk size is 255MB <MC4>
MinHeapSize EQU $00260000 ; must have at least ≈2.5 megs free for heap <LW5>
ENDIF ; Already Included.