;------------------------------------------------ ; ; Copyright 1983 ; Morrow Designs, Inc. ; San Leandro, Ca. ; John Zalabak ; ; ; This module is included in all of the MD11 source files. It ; contains all of the definitions which a) need to be globally accessed, ; (e.g. the ASCII character equates) and/or b) definitions which need to ; be globally managed (e.g. address definitions). ; Address definitions deserve further comment. ALL address usage ; is declared in this module. This is done to make memory management ; easier. It is NOT done to facilitate the sharing of data between ; modules. This practice should be avoided within this piece of software. ; Parameters are passed by using the General Operations Data ; Area. Provisions have been made in the cbios to overlay the user ; application interface portion of the general operations data area. ; ; Index of Definition Module ;--------------------------- ; ; Identification Information ; ASCII character equates ; ; Module Starting Addresses ; General Address Definitions ; Disk Module Address Definitions ; ; I/O Registers - Serial Ports ; I/O Registers - Counter Timer Chip ; I/O Registers - Disk Read ; I/O Registers - Disk Write ; ; Lo-Level Disk Error Codes ; Bios Level Disk Error Codes ; ; General Operations Data Area Definitions ; offsets within the Applications Interface Area ; MTAB Table Format (there must be 1 MTAB for each logical drive) ; ; Identification Information (12_Dec_83) ;--------------------------------------- ; RomRev equ 14h ;Rom Revision Number Clevel equ 0 ;Compatibility Level BadID equ 4B6Fh ;Bad Map ID Word (in the boot sector) BadRev equ 10h ;Bad Map Revision Number (in the bad map header) ;---------------------------------------------------------------------- ; ASCII character equates ;------------------------ ; cr equ 0Dh ;carriage return lf equ 0Ah ;line feed bell equ 07h ;bell asc0 equ '0' ;ascii 0 asca equ 'A' ;ascii A asci equ 'I' ;ascii I ascr equ 'R' ;ascii R ; Module Starting Addresses (28_Nov_83) ;-------------------------------------- ; o_main equ 0 ;Main line (hd*main.mac) o_io equ 220h ;Rom Level I/O (hd*io.mac) o_bios equ 380h ;Rom Level Bios Support (hd*bios.mac) o_dsk1 equ 600h ;Hi-Level Disk Drivers (hd*dsk1.mac) o_dsk2 equ 0F00h ;Lo-Level Disk Drivers (hl*dsk2.mac_) o_test equ 1900h ;Test and Diagnostics (hd*test.mac) o_hirm equ 1E00h ;Code for hard disk drivers (hd*hirm.mac) ; General Address Definitions (14_Nov_83) ;---------------------------------------- ; rom equ 0 ;Start of the ROM Memtop equ 0FFFFh ;Top Most Address of memory CSboot equ 0FE00h ;Cold Start Boot loader execution location combuf equ 0FE00h ;Start of the Common Buffer for disk operations ramdat equ 0FC00h ;Start of the default IX, IY and MTABs stack equ 0FC00h ;Stack dskbuf equ 2800h ;Start of the Disk Buffer prebuf equ dskbuf - 20h ;Main Entry Point to the read/write routines postbuf equ dskbuf + 400h ;End of the disk buffer genbuf equ dskbuf + 440h ;Start of the Scratch buffer fmtbuf equ dskbuf + 480h ;Start of the Format Buffer altbuf equ dskbuf + 500h ;Start of memory image of the bad map ; Disk Module Address Definitions ;-------------------------------- ; ;Pre-Buffer Definitions (14_Nov_83) hdID1 equ prebuf+2 ;Hard Disk ID 1 (Sector Header Sync and ID) hngloc equ prebuf+3 ;Location of the PCHL (hang location) header equ prebuf+4 ;Header Image address hdID2 equ prebuf+0Ch ;Hard Disk ID 2 (Data Header Sync and ID) hdID3 equ prebuf+1Eh ;Hard Disk ID 3 (Data Header Sync and ID) ;General Buffer Definitions (13_Dec_83) cpydrv equ genbuf ;Copy of Drive Strobe Register (drvstb) cpymod equ genbuf+1 ;Copy of Mode Register (mode) premsk equ genbuf+2 ;Save loc for write precompensation mask lcmsk equ genbuf+3 ;Save loc for low current mask revs equ genbuf+4 ;Number of revolutions before index error error equ genbuf+5 ;Temp Error register for floppy disk operations RomErr equ genbuf+6 ;Rom Level Error Code rtycnt equ genbuf+7 ;Current Retry count blocks equ genbuf+8 ;Number 32 byte blocks for current sector size filchr equ genbuf+9 ;Fill byte (4E or FF) savpc equ genbuf+10 ;Save Location for the value of write pre-comp savlc equ genbuf+11 ;Save Location for the value of low current cyltbl equ genbuf+12 ;Table of drive's Current Cylinder positions badtrk equ genbuf+20 ;Bad Map Track Number (lo byte) ; " " " " (hi byte) badhd equ genbuf+22 ;Bad Map Head badsec equ genbuf+23 ;Bad Map Sector badoff equ genbuf+24 ;Offset to start of bad map (lo byte) ; " " " " " " (hi byte) badmap equ genbuf+26 ;Pointer to start of bad map buffer (lo byte) ; " " " " " " " (hi byte) piobuf equ genbuf+28 ;Swap buffer for phyical param. & I/O address ;Format Buffer Definitions (14_Nov_83) gaptbl equ fmtbuf ;Define the start of the format table gap1 equ fmtbuf ;Post index gap gap3 equ fmtbuf+1 ;Inter-Sector gap gap5 equ fmtbuf+2 ;Pre-ID-Index mark gap HDstbl equ fmtbuf+3 ;Hard Disk Sector Skew Table FDstbl equ fmtbuf+12 ;Floppy Disk Sector Skew Table ;Disk Interrupt Vector Locations IRQbase equ memtop and 0FF00h ;Page address of interrupt vector table FDIvct equ IRQbase or 0F0h ;Floppy Disk Index Vector FDMvct equ IRQbase or 0F2h ;Floppy Disk Match Vector HDIvct equ IRQbase or 0F4h ;Hard Disk Index Vector HDMvct equ IRQbase or 0F6h ;Hard Disk Match Vector ; I/O Registers - Serial Ports ;----------------------------- ; s1data equ 60h ;serial port 1 data (dart1 = console port) s1stat equ 61h ;serial port 1 status s2data equ 62h ;serial port 2 data (dart2 = printer port) s2stat equ 63h ;serial port 2 status s3data equ 70h ;serial port 3 data (sio) s3stat equ 71h ;serial port 3 status (sio) ; I/O Registers - Counter Timer Chip ;----------------------------------- ; 1) The labels baud0, baud1 and baud2 correspond to the schematic labels ; for the signals carrying the baud rate clocks to the dart/sio. baud0 ; is the clock for serial port 1. ; baudset equ 53h ;ctc channel select/mode port baud0 equ 52h ;baud rate control for serial port 1 (consol) baud1 equ 51h ;baud rate control for serial port 2 baud2 equ 50h ;baud rate control for serial port 3 ; I/O Registers - Disk Read ;-------------------------- ; drvsts equ 0C0h ;Drive Status $INDEX equ 10000000b ; Index active $TRK0 equ 01000000b ; Track Zero active ; Spare $CRCSET equ 00010000b ; In Sync Flag (CRC set) $WPROT equ 00001000b ; Write Protect asserted $FAULT equ 00000100b ; Disk Fault $SEEKC equ 00000010b ; Seek Complete $READY equ 00000001b ; Drive Ready cstat equ 0C1h ;Centronics status port $DIAGM equ 00001000b ; Select diagnostics mode $CFAULT equ 00000100b ; Printer Fault $MTR equ 00000010b ; Motor on (drive active) $CNTRDY equ 00000001b ; Centronics Ready line clrint equ 0C2h ;Clear interrupts rdshfH equ 0C7h ;Read shift register data ; I/O Registers - Disk Write ;--------------------------- ; drvstb equ 040h ;Drive Strobe (local copy => cpydrv) $STEP equ 10000000b ; Step one track $DIR equ 01000000b ; Direction of step (0=out[home], 1=in) $LC equ 00100000b ; Low Current $HD2 equ 00010000b ; Head Select 2 $HD1 equ 00001000b ; Head Select 1 $HD0 equ 00000100b ; Head Select 0 $DS1 equ 00000010b ; Drive Select 1 $DS0 equ 00000001b ; Drive Select 0 bnkstb equ 41h ;Bank Strobe $CNTIRQ equ 10000000b ; Centronics interrupt enable $XFER equ 01000000b ; Inter-bank transfer (1=true) $MTRON equ 00100000b ; Motor On $AUTOE equ 00010000b ; Hard Disk Read/Write $CNTSTB equ 00001000b ; Printer Strobe $CNTRST equ 00000100b ; Printer Restore $BANK1 equ 00000000b ; Select Bank 1 (dummy def for coding clarity) $BANK2 equ 00000010b ; Select Bank 2 (1=true) $_RMENB equ 00000001b ; Enable Rom (0=true) cdata equ 42h ;Centronics data port wrtshf equ 047h ;Write shift register data mode equ 04Bh ;Write mode register (local copy => cpymod) $OP1 equ 10000000b ; Hard Disk Operation 1 $OP2 equ 01000000b ; Hard Disk Operation 0 $N1 equ 00100000b ; Hard Disk Sector Size 1 $N0 equ 00010000b ; Hard Disk Sector Size0 1 $MFM equ 00001000b ; MFM/FM (Double/Single Density) $ALT equ 00000100b ; Alternate Mark Select for Compare $STD equ 00000010b ; Standard/Mini Floppy Select $PRECMP equ 00000001b ; Pre-compensation Assert ctlstb equ 04Fh ;Control Strobe $READ equ 10000000b ; Read Data $CMPR equ 01000000b ; Compare Data $WRITE equ 01000000b ; Write (synonym for Compare) $_CRC equ 00100000b ; Enable CRC Generation $MARK equ 00010000b ; Search For Mark Byte ; Spare $INTE equ 00000100b ; Enable Interrupts $SR equ 00000010b ; Source Shift Register $CRC equ 00000001b ; " CRC Generator $RAM equ 00000000b ; " RAM page ;---------------------------------------------------------------------- ; Lo_Level Disk Operation Error Codes (18_Dec_83) ;------------------------------------------------ ; 1) This is the table of the rom level error codes. These codes exist ; only in the disk module. The value placed in erflag and passed ; back up to the bios is remapped in ertran. ; 2) Notice that the two most signifigant bits are used to indicate ; errors that should NOT be retried and re:mappable errors. ; ;Special Error Flags $NOTRY equ 10000000b ;Do not attempt a retry of this operation $REMAP equ 01000000b ;Error can cause a re:mapping of current sector ;Rom Level Error Codes Eum equ 1 ;Unreadable Media Ehd equ 2 ;Header Error Eha equ 3 or $REMAP ;Mismatch: Header ID address mark Ehc equ 4 or $REMAP ;Mismatch: Header CRC Eda equ 5 or $REMAP ;Mismatch: Data address mark Edc equ 6 or $REMAP ;Mismatch: Data CRC Esk equ 7 ;Mismatch: Track Number (seek error) Ehn equ 8 or $NOTRY ;Mismatch: Head Number Esn equ 9 or $REMAP ;Mismatch: Sector Number Ess equ 10 or $NOTRY ;Mismatch: Sector Size Enh equ 11 ;Drive failed to find track 0 Emc equ 12 or $NOTRY ;Maximum Cylinder Number Exceeded Enr equ 13 ;Drive not ready Eto equ 14 or $NOTRY ;Motor Time-Out Failure Ewp equ 15 or $NOTRY ;Write Protected Ewf equ 16 or $NOTRY ;Write Fault Ebf equ 17 or $NOTRY ;Bad Map is Full Ebi equ 18 or $NOTRY ;Bad Map ID does not match Ebr equ 19 or $NOTRY ;Bad Map Revision Number Doesn't Match Ebn equ 20 or $NOTRY ;Bad Map not opened Euk equ 21 or $NOTRY ;Unknown Error Code ; Bios Level Disk Operation Error Codes (18_Dec_83) ;-------------------------------------------------- ; 1) This is a table of the error codes that are passed to the bios. ; ; MD-11 MD-3 ERwp equ 1 ;Write Protected write protect 1 ERsk equ 2 ;Seek Error seek error 2 ERdac equ 3 ;Data Address CRC data crc 3 ERidc equ 4 ;ID Address CRC id crc 4 ERnf equ 5 ;Not Found not found 5 ERnr equ 6 ;Not Ready drive not ready 6 ERmf equ 7 ;Media Failure sync 7 ERef equ 8 ;Equipment Failure equipment check 8 ; invalid command 9 ERuk equ 10 ;Unknown Error Code unknown error 10 ERbm equ 11 ;Unable to ReMap ----- page ; Offsets within the General Operations Data Area (21_Dec_83) ;------------------------------------------------------------ ;bytes 0 thru 14 not used in cp/m3 bios sekdsk equ 0 ;BDOS disk number sektrk equ 1 ;BDOS track number ; seksec equ 3 ;BDOS sector number ; sekhst equ 5 ;Sector number on the disk ; unacnt equ 7 ;unallocated rec count unadsk equ 8 ;unallocated disk unatrk equ 9 ;unallocated track ; unasec equ 11 ;unallocated sector ; unamax equ 13 ;sectors per allocation block sectrk equ 14 ;Logical Sectors per track ; physpt equ 16 ;Physical Sectors per track wrtype equ 17 ;write type wrall equ 0 ; write allocatted wrdir equ 1 ; write directroy wrual equ 2 ; write unallocatted cflag equ 18 ;Cflag: Bit @xl_in equ 0 ; 0 Translate input function keys @xl_out equ 1 ; 1 Translate output controls and escapes @funact equ 2 ; 2 Function key IMS flag (1=active) @siosyn equ 3 ; 3 Hardware handshake for SIO @hwsync equ 4 ; 4 Hardware handshake for list device @cenlst equ 5 ; 5 Centronics is list device @imsact equ 6 ; 6 In memory submit flag (1=sub active) @imswet equ 7 ; 7 IMS buffer full (1=buffer has chars) DFlag equ 19 ;Dflag: Bit @hstact equ 0 ; 0 host active flag (1=sector in buffer) @hstwrt equ 1 ; 1 host written flag (1=buffer written) @rsflag equ 2 ; 2 read sector flag (1=need a read) @readop equ 3 ; 3 read operation flag (1=read 0=write) @fmoton equ 4 ; 4 floppy disk motor has been turned on (1=true) @curbad equ 5 ; 5 currently selected drive has bad map @maper equ 6 ; 6 Error can cause remapping of the sector @maprd equ 7 ; 7 Bad Map has been read trsec equ 20 ;offset to logical sector within physical sector vmsgp equ 21 ;pointer to virt drive mesg. ; vdrvp equ 23 ;pointer to virt drive in mesg. ; cdsk equ 25 ;current drive vdsk equ 26 ;current virtual drive dmaadr equ 27 ;BDOS dma address ; cnout equ 29 ;pointer to current console output routine ; cnin equ 31 ;pointer to current console input routine ; cnsts equ 33 ;Pointer to the current console input status routine ; cpybnk equ 35 ;Copy of the Current value of the bnkstb (port 41h) GOleng equ 36 ;Define the length of the general operations area ; Offsets within the Application Interface Area (21_Dec_83) ;---------------------------------------------------------- ; AIoff equ 36 ;Define offset from start of IY to start of AI hstdsk equ 0 + AIoff ;host disk (forms pointer to MTAB) hsttrk equ 1 + AIoff ;host track ; hstsec equ 3 + AIoff ;host sector (physical sector) ; seccnt equ 5 + AIoff ;sector count is number of sectors to transfer retry equ 6 + AIoff ;retry count = retries for read/write operations hstbuf equ 7 + AIoff ;pointer to disk data buffer ; erflag equ 9 + AIoff ;Error Flag opflag equ 10 + AIoff ;Options Flag: @serd equ 7 ; 7 Suppress Error Display @serur equ 6 ; 6 Suppress User response to errors @nover equ 5 ; 5 Supress Verification of track on seek @recal equ 4 ; 4 Recalibrate the drive @BufOK equ 3 ; 3 Buffer data is Valid (1=true) @InMap equ 2 ; 2 Sector is in the bad map (1=true) @RomIO equ 1 ; 1 Bios has activated ROM for block device I/O ; 0 not used phytrk equ 11 + AIoff ;Physical Track ; phyhd equ 13 + AIoff ;Physical Head physec equ 14 + AIoff ;Physical Sector phydrv equ 15 + AIoff ;Physical Drive address ioadd equ 16 + AIoff ;execution address of disk i/o (rdio/wrio/fmtio) ;(high byte of execution address) AIleng equ 18 ;Define the length of the Application Interface page ; MTAB Table Format (there must be 1 MTAB for each logical drive) ;---------------------------------------------------------------- ; MToff equ 18 + AIoff ;Define offset from start of IY to start of MTAB dskdef0 equ 0 ;Flag Register (Active=True=Asserting=1) @VD equ 7 ; Virtual Drive (1) @FRGN equ 6 ; Foreign Drive (1) @SECZRO equ 5 ; Sector numbers start at zero (1) @DBLMED equ 2 ; Double(1)/Single Sided Media $HDMSK equ 00011100b ; Head Mask $PHYADR equ 00000011b ; Physical Drive Mask @HRDDSK equ 1 ; Hard Disk Flag dskdef1 equ 1 ;Flag Register (Active=True=Asserting=1) @DRVCAL equ 7 ; Drive Calibrated(1) @DRVRDY equ 6 ; Drive Has Ready Line(1) @DRVDEN equ 5 ; Double(1)/Single Density Media @DRVSIZ equ 4 ; Standard_8"(1)/Mini_5.25" Select @HASBAD equ 3 ; Drive Has a Bad Map @FSTSEK equ 2 ; Drive has Fast Seek capabilities $SIZMSK equ 00000011b ; Sector Mask ; 00 - 128 Bytes/sector ; 01 - 256 Bytes/sector ; 10 - 512 Bytes/sector ; 11 - 1024 Bytes/sector CRNCYL equ 2 ;Current Cylinder (lo) ; MAXCYL equ 4 ;Maximum Number of Cylinders (lo) ; STPRAT equ 6 ;Step Rate STPSET equ 7 ;Step Settling Time STPRCL equ 8 ;Recalibration Step Rate HLDDLY equ 9 ;Head Load delay time MOTDLY equ 10 ;Motor On delay time STRPRE equ 11 ;Starting Track of Write Pre-Compensation (lo) ; STRLOC equ 13 ;Starting Track of Lo-Current (lo) ; FMTTYP equ 15 ;Format Type