]> git.sur5r.net Git - cc65/blobdiff - include/dio.h
Remove trailings spaces from CBM-related asm files
[cc65] / include / dio.h
index e6fca58fe476432b56a4c2c814e2da1aa9003850..4201728cc9812045688c9de106ceaf966e518e4a 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000 Christian Groessler <cpg@aladdin.de>                             */
+/* (C) 2005 Christian Groessler <chris@groessler.org>                        */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 /*                                                                           */
 /*****************************************************************************/
 
+
+
 #ifndef _DIO_H
 #define _DIO_H
 
-typedef unsigned char       driveid_t;
-typedef unsigned int        sectnum_t;
-typedef unsigned int        sectsize_t;
+
+
+/* Please note: All functions in this file will set _oserror *and* return its
+** value. The only exception is dio_open, which will return NULL, but _oserror
+** will be set. All function will also set _oserror in case of successful
+** execution, effectively clearing it.
+*/
+
+
+
+/*****************************************************************************/
+/*                                   Data                                    */
+/*****************************************************************************/
+
+
+
 typedef struct __dhandle_t *dhandle_t;
 
 typedef struct {
@@ -43,50 +58,55 @@ typedef struct {
 } dio_phys_pos;
 
 
-#ifdef __ATARI__
-#define dio_query_sectsize(x) ((_sectsize_t)128)
-#else
-#define dio_query_sectsize(x) ((_sectsize_t)256)
-#endif
-/* queries sector size, currently hardcoded */
 
-extern dhandle_t     __fastcall__ dio_open(driveid_t drive_id);
-/* open drive for subsequent dio access */
+/*****************************************************************************/
+/*                                   Code                                    */
+/*****************************************************************************/
+
+
+
+unsigned __fastcall__ dio_query_sectsize (dhandle_t handle);
+/* returns sector size */
+
+unsigned __fastcall__ dio_query_sectcount (dhandle_t handle);
+/* returns sector count */
 
-extern unsigned char __fastcall__ dio_close(dhandle_t handle);
-/* close drive, returns oserror (0 for success) */
+dhandle_t __fastcall__ dio_open (unsigned char device);
+/* open device for subsequent dio access */
 
-extern unsigned char __fastcall__ dio_read(dhandle_t handle,
-                                           sectnum_t sect_num,
-                                           void *buffer);
-/* read sector <sect_num> from drive <handle> to memory at <buffer> */
+unsigned char __fastcall__ dio_close (dhandle_t handle);
+/* close device, returns oserror (0 for success) */
+
+unsigned char __fastcall__ dio_read (dhandle_t handle,
+                                     unsigned sect_num,
+                                     void *buffer);
+/* read sector <sect_num> from device <handle> to memory at <buffer> */
 /* the number of bytes transferred depends on the sector size */
 /* returns oserror (0 for success) */
 
-extern unsigned char __fastcall__ dio_write(dhandle_t handle,
-                                            sectnum_t sect_num,
-                                            const void *buffer);
-/* write memory at <buffer> to sector <sect_num> on drive <handle>, no verify */
+unsigned char __fastcall__ dio_write (dhandle_t handle,
+                                      unsigned sect_num,
+                                      const void *buffer);
+/* write memory at <buffer> to sector <sect_num> on device <handle>, no verify */
 /* the number of bytes transferred depends on the sector size */
 /* returns oserror (0 for success) */
 
-extern unsigned char __fastcall__ dio_write_verify(dhandle_t handle,
-                                                   sectnum_t sect_num,
-                                                   const void *buffer);
-/* write memory at <buffer> to sector <sect_num> on drive <handle>, verify after write */
+unsigned char __fastcall__ dio_write_verify (dhandle_t handle,
+                                             unsigned sect_num,
+                                             const void *buffer);
+/* write memory at <buffer> to sector <sect_num> on device <handle>, verify after write */
 /* the number of bytes transferred depends on the sector size */
 /* returns oserror (0 for success) */
 
-
-extern unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle,
-                                                  const dio_phys_pos *physpos, /* input */
-                                                  sectnum_t *sectnum);        /* output */
+unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle,
+                                            const dio_phys_pos *physpos, /* input */
+                                            unsigned *sectnum);          /* output */
 /* convert physical sector address (head/track/sector) to logical sector number */
 /* returns oserror (0 for success) */
 
-extern unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle,
-                                                  const sectnum_t *sectnum,    /* input */
-                                                  dio_phys_pos *physpos);     /* output */
+unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle,
+                                            const unsigned *sectnum, /* input */
+                                            dio_phys_pos *physpos);  /* output */
 /* convert logical sector number to physical sector address (head/track/sector) */
 /* returns oserror (0 for success) */