]> git.sur5r.net Git - cc65/blobdiff - doc/dio.sgml
Changed the wording of the doc/da65.sgml.
[cc65] / doc / dio.sgml
index efd9d23e1cd3f36fc7a0932984128506a7b43b3e..39aac251cf532d97316cbaa7cb27a69637cdf822 100644 (file)
@@ -2,8 +2,8 @@
 
 <article>
 <title>Diskette Sector I/O Routines
-<author>Christian Groessler, <htmlurl url="mailto:cpg@aladdin.de" name="cpg@aladdin.de">
-<date>21.11.2000
+<author><url url="mailto:chris@groessler.org" name="Christian Groessler">
+<date>2014-04-10
 
 <abstract>
 The cc65 library provides functions to read and write raw disk sectors.
@@ -17,16 +17,15 @@ Include the dio.h header file to get the necessary definitions.
 
 <sect>Opening the disk for low level I/O<p>
 
-Prior to using these functions a handle to the drive has to be obtained. This
+Prior to using these functions a handle to the device has to be obtained. This
 is done with the <tt>dio_open</tt> function. After use, the handle should be
 released with the <tt>dio_close</tt> function.
 
 <tscreen><verb>
-    dhandle_t __fastcall__ dio_open (driveid_t drive_id);
+    dhandle_t __fastcall__ dio_open (unsigned char device);
 </verb></tscreen>
 
-The <tt>drive_id</tt> specifies the drive to access, with 0 being the first
-disk drive, 1 the second, and so on.
+The <tt>device</tt> specifies the device to access.
 
 <tscreen><verb>
     unsigned char __fastcall__ dio_close (dhandle_t handle);
@@ -41,16 +40,16 @@ The read and write functions are:
 
 <tscreen><verb>
     unsigned char __fastcall__ dio_read (dhandle_t handle,
-                                        sectnum_t sect_num,
+                                         unsigned sect_num,
                                          void *buffer);
 </verb></tscreen>
 
-This function will read the sector specified by sect_num into the memory
+This function will read the sector specified by <tt>sect_num</tt> into the memory
 location at buffer.
 
 <tscreen><verb>
     unsigned char __fastcall__ dio_write (dhandle_t handle,
-                                         sectnum_t sect_num,
+                                          unsigned sect_num,
                                           const void *buffer);
 </verb></tscreen>
 
@@ -59,23 +58,50 @@ by <tt>sect_num</tt>. No verify is performed.
 
 <tscreen><verb>
     unsigned char __fastcall__ dio_write_verify (dhandle_t handle,
-                                                sectnum_t sect_num,
-                                                const void *buffer);
+                                                 unsigned sect_num,
+                                                 const void *buffer);
 </verb></tscreen>
 
 This function will write the memory contents at buffer to the sector specified
 by <tt>sect_num</tt>. A verification is performed.
 <p>
 
+Use the <tt><ref name="dio_query_sectsize" id="sectsizecount"></tt> function to query
+the size of a sector and the <tt><ref name="dio_query_sectcount" id="sectsizecount"></tt>
+function to query the number of available sectors.
+<p>
+
 All these functions will return 0 for success and an OS specific error code in
 case of failure.
 <p>
 
+<sect>Querying sector size and count<label id="sectsizecount"><p>
+
+Some systems support multiple diskette formats which have different sector sizes
+and/or different sector counts.
+<p>
+
+The following function returns the sector size of the currently inserted disk:
+
+<tscreen><verb>
+    unsigned __fastcall__ dio_query_sectsize (dhandle_t handle);
+</verb></tscreen>
+
+On the Atari platform, the sector size is handled specially. Please refer
+to the DIO section in the <url url="atari.html" name="Atari-specific
+platform documentation">.
+<p>
+
+The following function returns the sector count of the currently inserted disk:
+
+<tscreen><verb>
+    unsigned __fastcall__ dio_query_sectcount (dhandle_t handle);
+</verb></tscreen>
 
 <sect>Converting sector numbers<p>
 
 Since the read and write functions expect a sector number, for systems where
-the sectors aren't addressed by a logical sector number (e.g. CBM drives),
+the sectors aren't addressed by a logical sector number (e.g. CBM devices),
 there are 2 conversion functions. One of them converts a logical sector number
 to a head/track/sector triple. The other conversion function works the other
 way round.
@@ -83,14 +109,14 @@ way round.
 <tscreen><verb>
     unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle,
                                                 const dio_phys_pos *physpos,
-                                                sectnum_t *sectnum);
+                                                unsigned *sectnum);
 </verb></tscreen>
 
 This function converts track/head/sector to logical sector number.
 
 <tscreen><verb>
     unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle,
-                                                const _sectnum_t *sectnum,
+                                                const unsigned *sectnum,
                                                 dio_phys_pos *physpos);
 </verb></tscreen>
 
@@ -105,6 +131,3 @@ The logical sector number is returned as physical sector and vice versa.
 
 
 </article>
-
-
-