Difference between revisions of "OSWORD &62"

From BeebWiki
Jump to: navigation, search
m
(More results found from FileStore tools.)
 
(6 intermediate revisions by one other user not shown)
Line 21: Line 21:
  
 
===Commands===
 
===Commands===
     &00=Test drive ready
+
     &00 Test drive ready *
     &01=Seek track 0
+
     &01 Restore to track zero *
     &03=Request status
+
    &02 reserved
     &08=Read data
+
     &03 Request sense status (SCSI result) *
     &0B=Seek track
+
    &04 Format drive
     &1B=Stop/Start drive; stop if XY?9=0, start if XY?9=1
+
    &05 Check track format
     &C8=Read F-code result from LVDOS
+
    &06 Format track
     &CA=Transmit F-code to LVDOS
+
    &07 Format bad track
 +
     &08 Read data *
 +
    &09 Read Verify
 +
    &0A Write data
 +
     &0B Seek track *
 +
    &0C Initialise drive characteristics
 +
    &0D Read ECC burst error length
 +
    &0E Format Alternative Track
 +
    &0F Write Sector Buffer
 +
    &10 Read Sector Buffer
 +
    &12 Read device identity string
 +
    &15 Write drive characteristics
 +
    &1A Read drive characteristics
 +
     &1B Park heads/Start/stop unit; stop if XY?9=0, start if XY?9=1 *
 +
    &2F Verify drive
 +
   
 +
    &70 RAM diagnostic
 +
    &71 reserved
 +
    &72 reserved
 +
    &73 Drive diagnostic
 +
    &74 Controller internal diagnostics
 +
    &75 Read long
 +
    &76 Write long
 +
   
 +
     &C8 Read F-code result from LVDOS *
 +
     &CA Transmit F-code to LVDOS *
 +
   
 +
    &E0 RAM Diagnostic
 +
    &E1 Reserved
 +
    &E2 Reserved
 +
    &E3 Drive Diagnostic
 +
    &E4 Controller Internal Diagnostics
 +
    &E5 Read Long
 +
    &E6 Write Long
 +
    &E7 Retry Statistics
 +
 
 +
Commands marked with * are listed in Acorn documentation.
 +
 
 +
Note that commands that would write data are not possible on read-only media
 +
used with LVFS.
  
 
===Results===
 
===Results===
     &00=Ok
+
     &00 Ok
     &02=Drive door open
+
    &01 No index - is drive formatted?
     &03=Media error, eg disk dirty
+
     &02 Drive door open/Seek error/Seek not completed
     &05=Bad SCSI command
+
     &03 Write fault/Media error (disc dirty)
     &04=Not ready
+
    &04 Drive not ready
     &40=Write protected
+
     &05 Malformed SCSI command
     &48=CRC error
+
     &06 Track 0 not found
     &50=Sector not found
+
 
     &60=Bad command
+
     &10 ID CRC error - sector not found
     &61=Bad address
+
     &11 Data CRC error
     &63=Volume error
+
     &12 ID address mark not found
     &65=Bad drive
+
    &13 Data address mark not found - sector found but no data
     &6F=Abort
+
    &14 Record not found - Sector not found
 +
     &15 Seek error - Track not found
 +
    &16 unused
 +
    &17 unused
 +
    &18 Correctable data error
 +
    &19 Verify error/Bad Track flag set in track accessed
 +
    &1A Interleave error/Format error
 +
    &1B unused
 +
    &1C Unformatted or bad format (eg no ADFS partitions)
 +
    &1D Self test failed
 +
    &1E Defective track
 +
    &1F unused
 +
   
 +
    &20 Invalid command to controller
 +
     &21 Illegal disc address - beyond end of disk
 +
    &22 unused
 +
     &23 Volume error
 +
     &24 Invalid parameter to controller
 +
    &25 Illegal drive number
 +
    &26 Invalid field in parameter list/Timeout
 +
    &27 Unsupported controller command
 +
    &28 Media changed
 +
    &29
 +
    &2A
 +
    &2B
 +
    &2C Error count overflow
 +
     &2D
 +
    &2E
 +
    &2F Abort
 +
   
 +
    &30 Controller RAM error
 +
    &31 Controller program memory CRC error
 +
    &33 Controller polynominal error
 +
   
 +
    &7F Unknown SCSI result
  
 
The result byte can be preloaded with a value to return if no OSWORD &62
 
The result byte can be preloaded with a value to return if no OSWORD &62
 
routine exists. For instance, preloading the result with &00 makes all such
 
routine exists. For instance, preloading the result with &00 makes all such
failed calls appear to succeed, preloading with &50 makes all calls appear
+
failed calls appear to succeed, preloading with &10 makes all calls appear
 
to return 'Sector not found'.
 
to return 'Sector not found'.
 +
 +
Acorn documentation is inconsistant about the range of returned SCSI
 +
results. What is not made clear is that bit 6 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. LVFS will only
 +
return errors with bit 6 clear as it has no floppy drivers.
  
 
===Coding===
 
===Coding===
Line 57: Line 136:
 
     fs%=FNfs:IFfs%<>10:*FX143,18,10
 
     fs%=FNfs:IFfs%<>10:*FX143,18,10
 
     X%?0=0:X%!1=addr%:X%?5=cmd%:X%?6=drv%*32+((sect%AND&1F0000)DIV65536)
 
     X%?0=0:X%!1=addr%:X%?5=cmd%:X%?6=drv%*32+((sect%AND&1F0000)DIV65536)
     X%?7=((sect%AND&FF00)DIV256):X%?8=sect%:X%!9=0:X%!11=num%
+
     X%?7=((sect%AND&FF00)DIV256):X%?8=sect%:X%!9=num%:X%!11=0
 
     A%=&62:CALL&FFF1:A%=?X%:IFfs%<>10:OSCLI"FX143,18,"+STR$fs%
 
     A%=&62:CALL&FFF1:A%=?X%:IFfs%<>10:OSCLI"FX143,18,"+STR$fs%
 
     =A%
 
     =A%
Line 66: Line 145:
 
* http://mdfs.net/Docs/Comp/BBC/Osword/Osword62
 
* http://mdfs.net/Docs/Comp/BBC/Osword/Osword62
 
* http://mdfs.net/Docs/Comp/BBC/Oswords
 
* http://mdfs.net/Docs/Comp/BBC/Oswords
 +
* http://mdfs.net/Docs/Comp/Disk/SCSICmds
  
[[User:Jgharston|Jgharston]] 14:00, 26 May 2009 (UTC)
+
[[User:WikiSysop|WikiSysop]] ([[User talk:WikiSysop|talk]]) 13:41, 8 March 2015 (UTC)

Latest revision as of 22:02, 15 January 2017

OSWORD &62 (98 ) - Access LVROM controller

Specification

   Same format as ADFS call &72 (114)
   On entry:
       XY?0  = 0, returned result
       XY!1  = data address
       XY?5  = command
       XY?6  = drive number in b5-b7, sector b16-b20 in b0-b4
       XY?7  = sector number b8-b15
       XY?8  = sector number b0-b7
       XY?9  = number of sectors or 0
       XY?10 = 0
       XY!11 = data length if X%?9=0

This is a standard SCSI command block. The drive number in XY?6 is ORed with the current drive. If VFS is not selected when the call is made, VFS is selected. Consequently, any code that calls OSWORD &62 must remember the current filing system and restore it afterwards. In practice it is easier to select VFS before calling OSWORD &62.

Commands

   &00 Test drive ready *
   &01 Restore to track zero *
   &02 reserved
   &03 Request sense status (SCSI result) *
   &04 Format drive
   &05 Check track format
   &06 Format track
   &07 Format bad track
   &08 Read data *
   &09 Read Verify
   &0A Write data
   &0B Seek track *
   &0C Initialise drive characteristics
   &0D Read ECC burst error length
   &0E Format Alternative Track
   &0F Write Sector Buffer
   &10 Read Sector Buffer
   &12 Read device identity string
   &15 Write drive characteristics
   &1A Read drive characteristics
   &1B Park heads/Start/stop unit; stop if XY?9=0, start if XY?9=1 *
   &2F Verify drive
   
   &70 RAM diagnostic
   &71 reserved
   &72 reserved
   &73 Drive diagnostic
   &74 Controller internal diagnostics
   &75 Read long
   &76 Write long
   
   &C8 Read F-code result from LVDOS *
   &CA Transmit F-code to LVDOS *
   
   &E0 RAM Diagnostic
   &E1 Reserved
   &E2 Reserved
   &E3 Drive Diagnostic
   &E4 Controller Internal Diagnostics
   &E5 Read Long
   &E6 Write Long
   &E7 Retry Statistics

Commands marked with * are listed in Acorn documentation.

Note that commands that would write data are not possible on read-only media used with LVFS.

Results

   &00 Ok
   &01 No index - is drive formatted?
   &02 Drive door open/Seek error/Seek not completed
   &03 Write fault/Media error (disc dirty)
   &04 Drive not ready
   &05 Malformed SCSI command
   &06 Track 0 not found
   &10 ID CRC error - sector not found
   &11 Data CRC error
   &12 ID address mark not found
   &13 Data address mark not found - sector found but no data
   &14 Record not found - Sector not found
   &15 Seek error - Track not found
   &16 unused
   &17 unused
   &18 Correctable data error
   &19 Verify error/Bad Track flag set in track accessed
   &1A Interleave error/Format error
   &1B unused
   &1C Unformatted or bad format (eg no ADFS partitions)
   &1D Self test failed
   &1E Defective track
   &1F unused
   
   &20 Invalid command to controller
   &21 Illegal disc address - beyond end of disk
   &22 unused
   &23 Volume error
   &24 Invalid parameter to controller
   &25 Illegal drive number
   &26 Invalid field in parameter list/Timeout
   &27 Unsupported controller command
   &28 Media changed
   &29
   &2A
   &2B
   &2C Error count overflow
   &2D
   &2E
   &2F Abort
   
   &30 Controller RAM error
   &31 Controller program memory CRC error
   &33 Controller polynominal error
   
   &7F Unknown SCSI result

The result byte can be preloaded with a value to return if no OSWORD &62 routine exists. For instance, preloading the result with &00 makes all such failed calls appear to succeed, preloading with &10 makes all calls appear to return 'Sector not found'.

Acorn documentation is inconsistant about the range of returned SCSI results. What is not made clear is that bit 6 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. LVFS will only return errors with bit 6 clear as it has no floppy drivers.

Coding

The following routine can be used to perform an OSWORD &62 call. It requires X%=>15-byte control block, Y%=X%DIV256.

   DEFFNlvfs(cmd%,addr%,num%,sect%,drv%):LOCALfs%
   fs%=FNfs:IFfs%<>10:*FX143,18,10
   X%?0=0:X%!1=addr%:X%?5=cmd%:X%?6=drv%*32+((sect%AND&1F0000)DIV65536)
   X%?7=((sect%AND&FF00)DIV256):X%?8=sect%:X%!9=num%:X%!11=0
   A%=&62:CALL&FFF1:A%=?X%:IFfs%<>10:OSCLI"FX143,18,"+STR$fs%
   =A%
   DEFFNfs:LOCALA%,E%,Y%:=(USR&FFDA)AND&FF

See Also

WikiSysop (talk) 13:41, 8 March 2015 (UTC)