$SAVE /* * Name: wd120.lit -- for system 120 winchester device driver. */ DECLARE /* controller task register offsets */ WRPRECOMP LITERALLY '0', /* write precomp task register offset -1*/ SECTORCNT LITERALLY '1H', /* sector count task register offset -1 */ SECTORNUM LITERALLY '2H', /* sector number task register offset -1 */ LOWCYLNUM LITERALLY '3H', /* low byte of cyl num task reg offset -1 */ HICYLNUM LITERALLY '4H', /* hi byte of cyl num task reg offset -1 */ SDH LITERALLY '5H', /* sdh task register offset -1 */ COMMAND LITERALLY '6H', /* command task register offset -1 */ STATUSREG LITERALLY '7', /* status task register offset */ ERRORREG LITERALLY '1'; /* error task register offset */ DECLARE /* state */ RESTORESTATE LITERALLY '0', /* restore state */ LOFORMATSTATE LITERALLY '1', /* formatting low head tracks */ HIFORMATSTATE LITERALLY '2', /* formatting upper head tracks */ FSETUPSTATE1 LITERALLY '3', /* set params for unit being formatted */ FRESTORESTATE1 LITERALLY '4', /* restore state for unit formatted */ FSETUPSTATE2 LITERALLY '5', /* set params for unit not being formatted */ FRESTORESTATE2 LITERALLY '6', /* restore state for unit not formatted */ HIRDVERSTATE LITERALLY '7', /* upper head read verify state */ LORDVERSTATE LITERALLY '8', /* lower head read verify state */ SETUPSTATE LITERALLY '9', /* set paramters state */ PARTTABSTATE LITERALLY '10', /* getting partition table state */ FORMATSTATE LITERALLY '11', /* formatting a track state */ STARTSTATE LITERALLY '12'; DECLARE /* controller commands */ HREAD LITERALLY '20H', /* read command */ HWRITE LITERALLY '30H', /* write command */ HFORMAT LITERALLY '50H', /* format command */ HRESTORE LITERALLY '10H', /* restore command */ HSEEK LITERALLY '70H', /* seek command */ HREADVERIFY LITERALLY '40H', /* read verify command */ HSETPARAMS LITERALLY '91H'; /* set paramters command */ DECLARE /* unit literals */ NUMPHYSUNITS LITERALLY '2', /* number of physical units per controller */ NUMBEROFUNITS LITERALLY '12', /* number of units */ UNITSPERDRIVE LITERALLY '6', /* num logical units per drive */ WHOLEUNIT0 LITERALLY '0', /* number of non-partition unit 0 */ WHOLEUNIT1 LITERALLY '6', /* number of non-partition unit 1 */ AUTORECUNIT0 LITERALLY '5', /* generic duib unit number */ AUTORECUNIT1 LITERALLY '11'; /* generic duib unit number */ DECLARE /* partition table literals */ NUMPART LITERALLY '4', /* number of partition table entries */ NULLSYS LITERALLY '0', /* partition table code for null partition */ RMXSYS LITERALLY '52H', /* partition table code for rmx system */ ACTIVEPART LITERALLY '80H', /* indicates partition active */ PARTOFFSET LITERALLY '1BEH'; /* offset partition table */ DECLARE PARTSIGOFFSET LITERALLY '1FEH', /* offset to partition signature */ PARTITIONSIG LITERALLY '0AA55H', /* partition table signature */ GENATTACHED LITERALLY '0FEH', /* indicates unit already attached via generic att. */ GOODTRACK LITERALLY '0', /* indicates good block to controller */ BADTRACK LITERALLY '80H', /* indicates bad block to controller */ MAXBADTRKS LITERALLY '255', /* maximum number of bad tracks in map */ NUMTASKREGS LITERALLY '7', /* number of task registers */ EXTRAHDOPT LITERALLY '08H', HIBYTECYLMSK LITERALLY '3', /* masks low 2 bits */ UPNIBBLE LITERALLY '4', /* shift lower nibble to upper */ SDHSTART LITERALLY '0A0H'; /* SDH reg start value */ DECLARE WAITCOUNT LITERALLY '0FFFFFFFH', /* busy wait count */ NOTACTIVEBIT LITERALLY '4', /* drive not active error bit */ RESETBIT LITERALLY '4', /* reset bit in control reg */ DATAREQBIT LITERALLY '08H', /* controller ready for data bit */ BUSYBIT LITERALLY '80H', /* controller busy bit */ BADBLKBIT LITERALLY '80H', /* bad block bit in error reg */ ERRORBIT LITERALLY '01H', /* error during operation bit */ BYTELEN LITERALLY '8', /* number of bits in byte */ RETRYBIT LITERALLY '1', /* sets retry bit in r/w */ DEVSPECOFFSET LITERALLY '1B0H', /* offset of device special stuff on physical sector 1 */ LASTFORMATTEDMSK LITERALLY '03H', /* mask for unit last formatted */ FORMATFLGSMSK LITERALLY '0FCH', /* zeros last formatted bits in flags */ RESTOREREQUIRED LITERALLY '2'; /* restore necessary for both units if format is to be done */ /* * * Unit Information Block (common part) * */ /* Device Info Block ( Hard Disk Driver ) */ DECLARE HDC$DEVICE$INFO LITERALLY 'STRUCTURE ( RADEV$DEVICE$INFO, p_address WORD, control$reg WORD)'; /* Unit Information Block */ DECLARE HDCINFOBLOCK LITERALLY 'STRUCTURE ( RAD$UNIT$INFO, num_heads BYTE, sec_per_track BYTE, write_pre_comp BYTE, no_of_cylinders WORD)'; DECLARE bad_trk_info LITERALLY 'STRUCTURE( reserved WORD, count WORD, bad_tracks(MAXBADTRKS) DWORD)', b_tracks LITERALLY 'STRUCTURE( cylinder WORD, head BYTE, sector BYTE)'; DECLARE UNITDATA_PART1 LITERALLY 'rel_sec DWORD, /* number of sectors before partition */ n_sec DWORD, /* number of sectors in a partition */ no_of_cylinders WORD, /* num cylinders in rmx partition */ drive BYTE', /* unit num (0 or 1) and flags, 0A0H */ UNITDATA_PART2 LITERALLY 'heads BYTE, /* number of heads associated with unit */ pre_comp BYTE, /* write_pre_comp shifted right by 2 */ num_tracks WORD, /* number of tracks on disk, used by format */ attached BYTE', /* indicates whether unit attached */ UNITDATA_PART3 LITERALLY 'sec_per_track BYTE, /* sectors per track */ tot_cyl WORD, /* number of cylinders in physical drive */ bad_trks_ptr POINTER,/* points to bad track map */ state BYTE', /* state of request */ unit_data LITERALLY 'STRUCTURE( UNITDATA_PART1, UNITDATA_PART2, UNITDATA_PART3)', $IF r_32 UNITDATASIZE LITERALLY '312', /* number of bytes in u_data array, size(unit_data) * NUMBEROFUNITS */ $ELSE UNITDATASIZE LITERALLY '288', /* number of bytes in u_data array, size(unit_data) * NUMBEROFUNITS */ $ENDIF BUFSIZE LITERALLY '400H', /* sector buffer */ ddata_struc LITERALLY 'STRUCTURE( udata(UNITDATASIZE) BYTE, sec_per_track BYTE, flags BYTE, num_att(NUMPHYSUNITS) BYTE, buf(BUFSIZE) BYTE)', PARTITIONTABLEENTRY1 LITERALLY 'boot BYTE, s_head BYTE, s_sec BYTE, s_cyl BYTE, sys BYTE', PARTITIONTABLEENTRY2 LITERALLY 'e_head BYTE, e_sec BYTE, e_cyl BYTE, num_prec_sec DWORD, number_sec DWORD', part_entry LITERALLY 'STRUCTURE ( /* partition table entry */ PARTITIONTABLEENTRY1, PARTITIONTABLEENTRY2)'; $restore