OSWORD &FE
Single density disk access (Z80 Tube OS)
This OSWORD call is installed by the Z80 v2 Tube client.
On entry: XY?0 = &10 (send block length) XY?1 = &03 (receive block length) The rest of the block is a SCSI command block similar to OSWORD &72 XY?2 = returned result, 0=ok, &00+n=HDD error, &40+n=FDD error XY!3 = data address XY?7 = command XY?8 = drive number in b5-b7, sector b16-b20 in b0-b4 XY?9 = sector number b8-b15 XY?10 = sector number b0-b7 XY?11 = number of sectors (what does &00 mean?) XY?12 = drive flags, b7=drive 0, b6=drive 1, etc. XY?13 = drive 0 settings XY?14 = drive 1 settings XY?15 = etc. XY?20 = drive 7 settings
This is loaded by the Z80 Tube v2 client code from $.CPM.X (for BBC B/B+) or $.CPM.Y (for Master) from ADFS. It provides FM (single-density) disk access when DFS OSWORD &7F is not available. MFM (double-density) disk access is provided by OSWORD &72 on the assumption that if ADFS is present, which is implied by being able to load $.CPM.X from ADFS, then ADFS's OSWORD &72 is available.
The floppy disk layout used is 2 sides x 80 tracks x 10 sectors x 256 bytes FM.
Commands
&08 Read data &09 Read Verify &0A Write data &0B Seek track
If the drive flag is set in XY?12, the drive setting in XY+13 onwards is used, and the drive seeks for track 0 before the operation.
Known code only implements command &08, &0A and &0B.
Results
&00 Ok &40 FDD Write protected &08 CRC error in data (FDC status &08) &10 Sector not found (FDC status &10) &18 CRC error in ID (FDC status &18) &20 Invalid command to controller &60 Bad SCSI command &21 Illegal disc address - beyond end of disk &61 Bad disc address &22 unused &62 unused &23 Volume error &63 Volume error &24 Invalid parameter to controller &64 Bad arguments &25 Illegal drive number &65 Bad drive &26 Invalid field in parameter list/Timeout &66 Drive timed out &27 Unsupported controller command &67 Unsupported SCSI command &2F Abort &6F Abort
Bit 6 of the result is used to indicate if the error is from the hard drive controller or the floppy controller. Floppy errors are the same as hard drive errors, ORed with &40. Floppy errors are also the 1770 status byte ORed with &40.
However, the known OSWORD &FE driver omits setting &40 when returning the result.
Notes
- The default code fails if called from the I/O processor with the control block at &xxFE or &xxFF due to incrementing X without carrying the overflow into Y.
DOS Hard disk control (80x86 DOS)
The 6502 host support code in 6502.SYS installed by the 80x86 DOS just returns from OSWORD &FE.
See also
Jgharston 14:29, 26 May 2009 (UTC) Jgharston 03:29, 20 July 2020 (CEST) Jgharston (talk)