home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilst / zidefs090 / ZIDEFS090 / Reference < prev    next >
Text File  |  1994-10-01  |  6KB  |  193 lines

  1. ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤                 ==========================
  2. Zeridajh IDEFS 0.90 reference guide                  This program is FREEWARE
  3. ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤                 ==========================
  4.  
  5.  
  6. -----------------
  7. - SWI interface -
  8. -----------------
  9.  
  10. Following is a detailed description of the SWIs provided by the Zeridajh IDEFS
  11. module. Note that SWI numbers are mostly incompatible with the ones in the
  12. original software, though the same SWI chunk is used.
  13.  
  14.  
  15. IDEFS_DiscOp (&41FC0)
  16. ---------------------
  17. See FileCore_DiscOp (RISCOS 3 PRMs pages 2-221..).
  18.  
  19. Reason codes 0,1,2,5 and 6 are implemented. Note that background transfers are
  20. (still) unsupported.
  21.  
  22.  
  23. IDEFS_NOP (&41FC1 and &41FC4)
  24. -----------------------------
  25. These do nothing.
  26.  
  27. They exist because the matching FileCore SWIs (at the same offsets relative to
  28. the FileCore SWI chunk) do not have a corresponding IDEFS implementation (the
  29. ones that do are FileCore_DiscOp, FileCore_Drives, FileCore_FreeSpace and
  30. FileCore_DescribeDisc).
  31.  
  32.  
  33. IDEFS_Drives (&41FC2)
  34. ---------------------
  35. See FileCore_Drives (RISCOS 3 PRMs page 2-228).
  36.  
  37.  
  38. IDEFS_FreeSpace (&41FC3)
  39. ------------------------
  40. See FileCore_FreeSpace (RISCOS 3 PRMs page 2-229).
  41.  
  42.  
  43. IDEFS_DescribeDisc (&41FC5)
  44. ---------------------------
  45. See FileCore_DescribeDisc (RISCOS 3 PRMs page 2-232).
  46.  
  47.  
  48. IDEFS_Execute (&41FC6)
  49. ----------------------
  50. This is a very powerful (and therefore dangerous) SWI. It enables direct
  51. access to an IDE harddisc. Relevant IDE controller registers may be read and
  52. written, commands may be issued and data blocks may be directly read/written.
  53.  
  54. WARNING !!! DO NOT USE THIS SWI UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING. It
  55. is quite possible to corrupt data on your harddisc, or even make it forever
  56. unusable by destroying its internal harddisc information. You have been
  57. warned !!! If you don't fully understand the gobbledegook below, you shouldn't
  58. even be reading this !
  59.  
  60. The SWI executes a sequence of 'IDE operations'. The operations are supplied
  61. as a list of word-wide 'instructions', terminated by -1. A data buffer
  62. supplies data to be written and/or is used to return data that has been read.
  63.  
  64. On entry
  65.  
  66. - r1 points to a list of IDE operations (word-aligned)
  67. - r2 points to a data buffer
  68. - r3 contains size of data buffer
  69.  
  70. On exit
  71.  
  72. - r1 points to last executed IDE operation
  73. - r2 points to first unused data buffer byte
  74. - r3 contains number of unused data buffer bytes
  75.      if <0, the data buffer was prematurely exhausted
  76. - V set if error (r0 contains error pointer), else clear
  77.  
  78. IDE operations
  79. ~~~~~~~~~~~~~~
  80. bit 24-31 - operation code
  81. bit 0-23  - operation argument
  82.  
  83. -1 marks the end of the list.
  84.  
  85. Operation codes
  86. ~~~~~~~~~~~~~~~
  87. 0 - Issue IDE command
  88.  
  89. Issues the IDE command in bits 0-7 of the argument. This waits for ~BSY, sinks
  90. any pending data, issues the command, waits for ~BSY, and finally checks for
  91. an error.
  92.  
  93. 1/3/4/5 - Write 8 bits to an IDE register
  94.  
  95. Writes bits 0-7 of the argument to an IDE register. 1=Device/Head, 3=Sector
  96. Number, 4=Sector Count, 5=Features.
  97.  
  98. 2 - Write Cylinder Low/High registers
  99.  
  100. Writes bits 0-7 of the argument to the Cylinder Low register, and bits 8-15 to
  101. the Cylinder High register.
  102.  
  103. 8/9/11/12/13 - Read 8 bits from an IDE register
  104.  
  105. Writes bits 0-7 of an IDE register to the data buffer. 8=Status,
  106. 9=Device/Head, 11=Sector Number, 12=Sector Count, 13=Error.
  107.  
  108. 10 - Read Cylinder Low/High registers
  109.  
  110. Writes bits 0-7 of the Cylinder Low register to the data buffer, followed by
  111. bits 0-7 of the Cylinder High register.
  112.  
  113. 16 - Read bytes
  114.  
  115. Waits for DRQ, then reads <argument> bytes (written to the data buffer), then
  116. checks for an error. <argument> must be a multiple of 2. The data buffer
  117. pointer must be 2-byte-aligned before this operation. You *must* read as many
  118. bytes as the last issued command generates. This can not be more than one
  119. sector (i.e. 512 bytes plus, optionally, 4 or 7 ECC bytes).
  120.  
  121. 17 - Write bytes
  122.  
  123. See 'Read bytes', except this one writes <argument> bytes (read from the data
  124. buffer).
  125.  
  126. Example
  127. ~~~~~~~
  128. Reading a device's identity (IDE 'Identify Device' command) :
  129.  
  130. R1 -> 1<<24 OR %10100000 ; Set Device/Head register for Device 0, Head 0
  131.       0<<24 OR &EC       ; Issue 'Identify Device' command
  132.       16<<24 OR 512      ; Read the 512 info bytes
  133.       -1                 ; End of list
  134. R2 -> 512 byte buffer
  135. R3 = 512
  136.  
  137.  
  138. IDEFS_DriveOptions (&41FC7)
  139. ---------------------------
  140. This reads and/or writes the 'option bits' of a drive.
  141.  
  142. On entry
  143.  
  144. - r0 contains drive number
  145. - r1 contains option bits AND mask
  146. - r2 contains option bits EOR mask
  147.  
  148. On exit
  149.  
  150. - r1 contains old option bits
  151.      bit 0    - set if write protected
  152.      bit 1    - set if transfer address validation enabled
  153.      bit 2-31 - unused (are and must remain 0)
  154. - V set if error (r0 contains error pointer), else clear
  155.  
  156.  
  157. IDEFS_DriveInfo (&41FC8)
  158. ------------------------
  159. Do not use this SWI. It is only for internal use and may change radically or
  160. even disappear in the future. Its main (and currently only) use is to provide
  161. some involved information for the patched !HForm, used to initialise drives.
  162.  
  163.  
  164. ----------
  165. - Errors -
  166. ----------
  167.  
  168. Low level DiscOp and MiscOp (and therefore FileCore and SWI IDEFS_DiscOp)
  169. either directly return FileCore errors (e.g. a write operation to a write-
  170. protected drive gives 'Write protected'), or translate any IDE errors to an
  171. appropriate FileCore disc error (see RISCOS 3 PRMs page 276, i.e. look up the
  172. xx code in issued 'Disc error xx at :d/yyyy' type errors there).
  173.  
  174. Other specific ZIDEFS errors are :
  175.  
  176. &41FC1 'Invalid drive or drive number'
  177.  
  178. Either the drive number supplied is invalid (i.e. <4 or >7), or the drive is
  179. not valid (e.g. is not configured or partitioned, or is on a harddisc which
  180. has been found to be absent or malfunctioning).
  181.  
  182. &41FC2 'Error during IDE operation (code xxxx)'
  183.  
  184. Issued by the _Execute SWI when an IDE error has occured. The code indicates
  185. the type of error. Codes from &000-&00FF have the IDE error register contents
  186. in their low byte. Code &0100 indicates that a timeout has occured waiting for
  187. a synchronisation signal (e.g. ~BSY or DRQ).
  188.  
  189. &41FC3 'Bad IDE operation'
  190.  
  191. Issued by the _Execute SWI when an invalid IDE operation code is encountered.
  192.  
  193.