home *** CD-ROM | disk | FTP | other *** search
- ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ==========================
- Zeridajh IDEFS 0.90 reference guide This program is FREEWARE
- ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ==========================
-
-
- -----------------
- - SWI interface -
- -----------------
-
- Following is a detailed description of the SWIs provided by the Zeridajh IDEFS
- module. Note that SWI numbers are mostly incompatible with the ones in the
- original software, though the same SWI chunk is used.
-
-
- IDEFS_DiscOp (&41FC0)
- ---------------------
- See FileCore_DiscOp (RISCOS 3 PRMs pages 2-221..).
-
- Reason codes 0,1,2,5 and 6 are implemented. Note that background transfers are
- (still) unsupported.
-
-
- IDEFS_NOP (&41FC1 and &41FC4)
- -----------------------------
- These do nothing.
-
- They exist because the matching FileCore SWIs (at the same offsets relative to
- the FileCore SWI chunk) do not have a corresponding IDEFS implementation (the
- ones that do are FileCore_DiscOp, FileCore_Drives, FileCore_FreeSpace and
- FileCore_DescribeDisc).
-
-
- IDEFS_Drives (&41FC2)
- ---------------------
- See FileCore_Drives (RISCOS 3 PRMs page 2-228).
-
-
- IDEFS_FreeSpace (&41FC3)
- ------------------------
- See FileCore_FreeSpace (RISCOS 3 PRMs page 2-229).
-
-
- IDEFS_DescribeDisc (&41FC5)
- ---------------------------
- See FileCore_DescribeDisc (RISCOS 3 PRMs page 2-232).
-
-
- IDEFS_Execute (&41FC6)
- ----------------------
- This is a very powerful (and therefore dangerous) SWI. It enables direct
- access to an IDE harddisc. Relevant IDE controller registers may be read and
- written, commands may be issued and data blocks may be directly read/written.
-
- WARNING !!! DO NOT USE THIS SWI UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING. It
- is quite possible to corrupt data on your harddisc, or even make it forever
- unusable by destroying its internal harddisc information. You have been
- warned !!! If you don't fully understand the gobbledegook below, you shouldn't
- even be reading this !
-
- The SWI executes a sequence of 'IDE operations'. The operations are supplied
- as a list of word-wide 'instructions', terminated by -1. A data buffer
- supplies data to be written and/or is used to return data that has been read.
-
- On entry
-
- - r1 points to a list of IDE operations (word-aligned)
- - r2 points to a data buffer
- - r3 contains size of data buffer
-
- On exit
-
- - r1 points to last executed IDE operation
- - r2 points to first unused data buffer byte
- - r3 contains number of unused data buffer bytes
- if <0, the data buffer was prematurely exhausted
- - V set if error (r0 contains error pointer), else clear
-
- IDE operations
- ~~~~~~~~~~~~~~
- bit 24-31 - operation code
- bit 0-23 - operation argument
-
- -1 marks the end of the list.
-
- Operation codes
- ~~~~~~~~~~~~~~~
- 0 - Issue IDE command
-
- Issues the IDE command in bits 0-7 of the argument. This waits for ~BSY, sinks
- any pending data, issues the command, waits for ~BSY, and finally checks for
- an error.
-
- 1/3/4/5 - Write 8 bits to an IDE register
-
- Writes bits 0-7 of the argument to an IDE register. 1=Device/Head, 3=Sector
- Number, 4=Sector Count, 5=Features.
-
- 2 - Write Cylinder Low/High registers
-
- Writes bits 0-7 of the argument to the Cylinder Low register, and bits 8-15 to
- the Cylinder High register.
-
- 8/9/11/12/13 - Read 8 bits from an IDE register
-
- Writes bits 0-7 of an IDE register to the data buffer. 8=Status,
- 9=Device/Head, 11=Sector Number, 12=Sector Count, 13=Error.
-
- 10 - Read Cylinder Low/High registers
-
- Writes bits 0-7 of the Cylinder Low register to the data buffer, followed by
- bits 0-7 of the Cylinder High register.
-
- 16 - Read bytes
-
- Waits for DRQ, then reads <argument> bytes (written to the data buffer), then
- checks for an error. <argument> must be a multiple of 2. The data buffer
- pointer must be 2-byte-aligned before this operation. You *must* read as many
- bytes as the last issued command generates. This can not be more than one
- sector (i.e. 512 bytes plus, optionally, 4 or 7 ECC bytes).
-
- 17 - Write bytes
-
- See 'Read bytes', except this one writes <argument> bytes (read from the data
- buffer).
-
- Example
- ~~~~~~~
- Reading a device's identity (IDE 'Identify Device' command) :
-
- R1 -> 1<<24 OR %10100000 ; Set Device/Head register for Device 0, Head 0
- 0<<24 OR &EC ; Issue 'Identify Device' command
- 16<<24 OR 512 ; Read the 512 info bytes
- -1 ; End of list
- R2 -> 512 byte buffer
- R3 = 512
-
-
- IDEFS_DriveOptions (&41FC7)
- ---------------------------
- This reads and/or writes the 'option bits' of a drive.
-
- On entry
-
- - r0 contains drive number
- - r1 contains option bits AND mask
- - r2 contains option bits EOR mask
-
- On exit
-
- - r1 contains old option bits
- bit 0 - set if write protected
- bit 1 - set if transfer address validation enabled
- bit 2-31 - unused (are and must remain 0)
- - V set if error (r0 contains error pointer), else clear
-
-
- IDEFS_DriveInfo (&41FC8)
- ------------------------
- Do not use this SWI. It is only for internal use and may change radically or
- even disappear in the future. Its main (and currently only) use is to provide
- some involved information for the patched !HForm, used to initialise drives.
-
-
- ----------
- - Errors -
- ----------
-
- Low level DiscOp and MiscOp (and therefore FileCore and SWI IDEFS_DiscOp)
- either directly return FileCore errors (e.g. a write operation to a write-
- protected drive gives 'Write protected'), or translate any IDE errors to an
- appropriate FileCore disc error (see RISCOS 3 PRMs page 276, i.e. look up the
- xx code in issued 'Disc error xx at :d/yyyy' type errors there).
-
- Other specific ZIDEFS errors are :
-
- &41FC1 'Invalid drive or drive number'
-
- Either the drive number supplied is invalid (i.e. <4 or >7), or the drive is
- not valid (e.g. is not configured or partitioned, or is on a harddisc which
- has been found to be absent or malfunctioning).
-
- &41FC2 'Error during IDE operation (code xxxx)'
-
- Issued by the _Execute SWI when an IDE error has occured. The code indicates
- the type of error. Codes from &000-&00FF have the IDE error register contents
- in their low byte. Code &0100 indicates that a timeout has occured waiting for
- a synchronisation signal (e.g. ~BSY or DRQ).
-
- &41FC3 'Bad IDE operation'
-
- Issued by the _Execute SWI when an invalid IDE operation code is encountered.
-
-