1 /*****************************************************************************/
5 /* Low-Level diskette I/O functions */
9 /* (C) 2005 Christian Groessler <chris@groessler.org> */
12 /* This software is provided 'as-is', without any expressed or implied */
13 /* warranty. In no event will the authors be held liable for any damages */
14 /* arising from the use of this software. */
16 /* Permission is granted to anyone to use this software for any purpose, */
17 /* including commercial applications, and to alter it and redistribute it */
18 /* freely, subject to the following restrictions: */
20 /* 1. The origin of this software must not be misrepresented; you must not */
21 /* claim that you wrote the original software. If you use this software */
22 /* in a product, an acknowledgment in the product documentation would be */
23 /* appreciated but is not required. */
24 /* 2. Altered source versions must be plainly marked as such, and must not */
25 /* be misrepresented as being the original software. */
26 /* 3. This notice may not be removed or altered from any source */
29 /*****************************************************************************/
38 /* Please note: All functions in this file will set _oserror *and* return its
39 * value. The only exception is dio_open, which will return NULL, but _oserror
40 * will be set. All function will also set _oserror in case of successful
41 * execution, effectively clearing it.
46 /*****************************************************************************/
48 /*****************************************************************************/
52 typedef struct __dhandle_t *dhandle_t;
62 /*****************************************************************************/
64 /*****************************************************************************/
68 unsigned __fastcall__ dio_query_sectsize (dhandle_t handle);
69 /* returns sector size */
71 unsigned __fastcall__ dio_query_sectcount (dhandle_t handle);
72 /* returns sector count */
74 dhandle_t __fastcall__ dio_open (unsigned char device);
75 /* open device for subsequent dio access */
77 unsigned char __fastcall__ dio_close (dhandle_t handle);
78 /* close device, returns oserror (0 for success) */
80 unsigned char __fastcall__ dio_read (dhandle_t handle,
83 /* read sector <sect_num> from device <handle> to memory at <buffer> */
84 /* the number of bytes transferred depends on the sector size */
85 /* returns oserror (0 for success) */
87 unsigned char __fastcall__ dio_write (dhandle_t handle,
90 /* write memory at <buffer> to sector <sect_num> on device <handle>, no verify */
91 /* the number of bytes transferred depends on the sector size */
92 /* returns oserror (0 for success) */
94 unsigned char __fastcall__ dio_write_verify (dhandle_t handle,
97 /* write memory at <buffer> to sector <sect_num> on device <handle>, verify after write */
98 /* the number of bytes transferred depends on the sector size */
99 /* returns oserror (0 for success) */
101 unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle,
102 const dio_phys_pos *physpos, /* input */
103 unsigned *sectnum); /* output */
104 /* convert physical sector address (head/track/sector) to logical sector number */
105 /* returns oserror (0 for success) */
107 unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle,
108 const unsigned *sectnum, /* input */
109 dio_phys_pos *physpos); /* output */
110 /* convert logical sector number to physical sector address (head/track/sector) */
111 /* returns oserror (0 for success) */
113 #endif /* #ifndef _DIO_H */