1 /*****************************************************************************/
5 /* Low-Level diskette I/O functions */
9 /* (C) 2005 Christian Groessler <cpg@aladdin.de> */
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 /*****************************************************************************/
40 /*****************************************************************************/
44 typedef unsigned char driveid_t;
45 typedef unsigned int sectnum_t;
46 typedef unsigned int sectsize_t;
47 typedef struct __dhandle_t *dhandle_t;
57 /*****************************************************************************/
59 /*****************************************************************************/
63 sectsize_t __fastcall__ dio_query_sectsize(dhandle_t handle);
64 /* queries sector size, currently hardcoded */
66 sectnum_t __fastcall__ dio_query_sectcount(dhandle_t handle);
67 /* Return the sector count for a disk. */
69 dhandle_t __fastcall__ dio_open(driveid_t drive_id);
70 /* open drive for subsequent dio access */
72 unsigned char __fastcall__ dio_close(dhandle_t handle);
73 /* close drive, returns oserror (0 for success) */
75 unsigned char __fastcall__ dio_read(dhandle_t handle,
78 /* read sector <sect_num> from drive <handle> to memory at <buffer> */
79 /* the number of bytes transferred depends on the sector size */
80 /* returns oserror (0 for success) */
82 unsigned char __fastcall__ dio_write(dhandle_t handle,
85 /* write memory at <buffer> to sector <sect_num> on drive <handle>, no verify */
86 /* the number of bytes transferred depends on the sector size */
87 /* returns oserror (0 for success) */
89 unsigned char __fastcall__ dio_write_verify(dhandle_t handle,
92 /* write memory at <buffer> to sector <sect_num> on drive <handle>, verify after write */
93 /* the number of bytes transferred depends on the sector size */
94 /* returns oserror (0 for success) */
97 unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle,
98 const dio_phys_pos *physpos, /* input */
99 sectnum_t *sectnum); /* output */
100 /* convert physical sector address (head/track/sector) to logical sector number */
101 /* returns oserror (0 for success) */
103 unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle,
104 const sectnum_t *sectnum, /* input */
105 dio_phys_pos *physpos); /* output */
106 /* convert logical sector number to physical sector address (head/track/sector) */
107 /* returns oserror (0 for success) */
109 #endif /* #ifndef _DIO_H */