<tag/Drive ID/
   The function <htmlurl url="dio-1.html" name="dio_open()"> has the single
-  parameter <tt/drive_id/ to identify the drive to be opened. Therefore an
-  Apple II slot and drive pair is mapped to that <tt/drive_id/ according
+  parameter <tt/device/ to identify the device to be opened. Therefore an
+  Apple II slot and drive pair is mapped to that <tt/device/ according
   to the formula
 
   <tscreen>
-    drive_id = slot * 16 + (drive - 1) * 128
+    device = slot * 0x10 + (drive - 1) * 0x80
   </tscreen>
 
-  so that for example slot 6 drive 2 is mapped to <tt/drive_id/ 224.
+  so that for example slot 6 drive 2 is mapped to <tt/device/ 0xE0.
 
   <tag/Sector count/
   The function <htmlurl url="dio-3.html" name="dio_query_sectcount()"> returns
 
 
   <tag/Drive ID/
   The function <htmlurl url="dio-1.html" name="dio_open()"> has the single
-  parameter <tt/drive_id/ to identify the drive to be opened. Therefore an
+  parameter <tt/device/ to identify the device to be opened. Therefore an
   Apple II slot and drive pair is mapped to that <tt/drive_id/ according
   to the formula
 
   <tscreen>
-    drive_id = slot * 16 + (drive - 1) * 128
+    device = slot * 0x10 + (drive - 1) * 0x80
   </tscreen>
 
-  so that for example slot 6 drive 2 is mapped to <tt/drive_id/ 224.
+  so that for example slot 6 drive 2 is mapped to <tt/device/ 0xE0.
 
   <tag/Sector count/
   The function <htmlurl url="dio-3.html" name="dio_query_sectcount()"> returns
 
 
 <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, with 0 being the first
+device, 1 the second, and so on.
 
 <tscreen><verb>
     unsigned char __fastcall__ dio_close (dhandle_t handle);
 
 <tscreen><verb>
     unsigned char __fastcall__ dio_read (dhandle_t handle,
-                                        sectnum_t sect_num,
+                                         unsigned sect_num,
                                          void *buffer);
 </verb></tscreen>
 
 
 <tscreen><verb>
     unsigned char __fastcall__ dio_write (dhandle_t handle,
-                                         sectnum_t sect_num,
+                                          unsigned sect_num,
                                           const void *buffer);
 </verb></tscreen>
 
 
 <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
 The following function returns the sector size of the currently inserted disk:
 
 <tscreen><verb>
-    sectsize_t __fastcall__ dio_query_sectsize (dhandle_t handle);
+    unsigned __fastcall__ dio_query_sectsize (dhandle_t handle);
 </verb></tscreen>
 
 On the Atari platform, the sector size is handled specially. Please refer
 The following function returns the sector count of the currently inserted disk:
 
 <tscreen><verb>
-    sectnum_t __fastcall__ dio_query_sectcount (dhandle_t handle);
+    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.
 <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>
 
 
 
 </article>
-
-
-                                                                      
 
 
 
 /*****************************************************************************/
-/*                                   Data                                   */
+/*                                   Data                                    */
 /*****************************************************************************/
 
 
 
-typedef unsigned char       driveid_t;
-typedef unsigned int        sectnum_t;
-typedef unsigned int        sectsize_t;
 typedef struct __dhandle_t *dhandle_t;
 
 typedef struct {
 
 
 /*****************************************************************************/
-/*                                   Code                                   */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
 
-sectsize_t __fastcall__ dio_query_sectsize(dhandle_t handle);
+unsigned __fastcall__ dio_query_sectsize (dhandle_t handle);
 /* returns sector size */
 
-sectnum_t __fastcall__ dio_query_sectcount(dhandle_t handle);
+unsigned __fastcall__ dio_query_sectcount (dhandle_t handle);
 /* returns sector count */
 
-dhandle_t __fastcall__ dio_open(driveid_t drive_id);
-/* open drive for subsequent dio access */
+dhandle_t __fastcall__ dio_open (unsigned char device);
+/* open device for subsequent dio access */
 
-unsigned char __fastcall__ dio_close(dhandle_t handle);
-/* close drive, returns oserror (0 for success) */
+unsigned char __fastcall__ dio_close (dhandle_t handle);
+/* close device, returns oserror (0 for success) */
 
-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_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) */
 
-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) */
 
-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) */
 
-
-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) */
 
-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) */
 
 
 ;
 ; Oliver Schmidt, 24.03.2005
 ;
-; dhandle_t __fastcall__ dio_open (driveid_t drive_id);
+; dhandle_t __fastcall__ dio_open (unsigned char device);
 ;
 
         .export        _dio_open
 
 ;
 ; Oliver Schmidt, 24.03.2005
 ;
-; unsigned char __fastcall__ dio_read (dhandle_t handle, sectnum_t sect_num, void *buffer);
+; unsigned char __fastcall__ dio_read (dhandle_t handle, unsigned sect_num, void *buffer);
 ;
 
         .export        _dio_read
 
 ;
 ; Oliver Schmidt, 31.03.2005
 ;
-; sectnum_t __fastcall__ dio_query_sectcount (dhandle_t handle);
+; unsigned __fastcall__ dio_query_sectcount (dhandle_t handle);
 ;
 
         .export        _dio_query_sectcount
 
 ;
 ; Oliver Schmidt, 31.03.2005
 ;
-; sectsize_t __fastcall__ dio_query_sectsize (dhandle_t handle);
+; unsigned __fastcall__ dio_query_sectsize (dhandle_t handle);
 ;
 
         .export        _dio_query_sectsize
 
 ;
 ; Oliver Schmidt, 24.03.2005
 ;
-; unsigned char __fastcall__ dio_write (dhandle_t handle, sectnum_t sect_num, const void *buffer);
+; unsigned char __fastcall__ dio_write (dhandle_t handle, unsigned sect_num, const void *buffer);
 ;
 
         .export        _dio_write
 
 ;
 ; unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle,
 ;                                           dio_phys_pos *physpos,     /* input */
-;                                           sectnum_t *sectnum);       /* output */
+;                                           unsigned *sectnum);        /* output */
 ;
 ; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
 ;
 
        .export         _dio_phys_to_log
 
 ; cylinder and head 0 and as sector the sectnum it got
 ;
 ; unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle,
-;                                           sectnum_t *sectnum,        /* input */
+;                                           unsigned *sectnum,         /* input */
 ;                                           dio_phys_pos *physpos);    /* output */
 ;
 ; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
 ;
 
        .export         _dio_log_to_phys
 
 ; _dio_write functions. To query the sector size, the _dio_open
 ; accesses the disk drive.
 ;
-; dhandle_t    __fastcall__ dio_open  (driveid_t drive_id);
+; dhandle_t    __fastcall__ dio_open  (unsigned char device);
 ; unsigned char __fastcall__ dio_close (dhandle_t handle);
 ;
 
 
 ;
 ; Christian Groessler, February 2005
 ;
-; sectsize_t __fastcall__ dio_query_sectsize(dhandle_t handle);
+; unsigned __fastcall__ dio_query_sectsize(dhandle_t handle);
 ;
 
        .include        "atari.inc"
 
 ;
 ; this file provides the _dio_read function
 ;
-; unsigned char __fastcall__ dio_read(dhandle_t handle,sectnum_t sect_num,void *buffer);
+; unsigned char __fastcall__ dio_read(dhandle_t handle,unsigned sect_num,void *buffer);
 ; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
 ;
 
        .import         __sio_call,pushax
-       .export         _dio_read
+       .export         _dio_read
        .include        "atari.inc"
 
 .proc  _dio_read
 
 ;
 ; this file provides the _dio_write function
 ;
-; unsigned char __fastcall__ dio_write(dhandle_t handle,sectnum_t sect_num,const void *buffer);
+; unsigned char __fastcall__ dio_write(dhandle_t handle,unsigned sect_num,const void *buffer);
 ; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
 ;
 
        .import         __sio_call,pushax
 
 ;
 ; this file provides the _dio_write_verify function
 ;
-; unsigned char __fastcall__ dio_write_verify(dhandle_t handle,sectnum_t sect_num,const void *buffer);
+; unsigned char __fastcall__ dio_write_verify(dhandle_t handle,unsigned sect_num,const void *buffer);
 ; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
 ;
 
        .import         __sio_call,pushax
 
 ; to save space with _dio_read and _dio_write functions.
 ;
 ; unsigned char __fastcall__ _sio_call(dhandle_t handle,
-;                                     sectnum_t sect_num,
+;                                     unsigned sect_num,
 ;                                     void *buffer,
-;                                     unsigned int sio_val);
+;                                     unsigned sio_val);
 ; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
 ; sio_val is (sio_command | sio_direction << 8)
 ;
 
 
 ; 2.7.2001
 ;
 ;
-; unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle,
-;                                           dio_phys_pos *physpos,     /* input */
-;                                           sectnum_t *sectnum);       /* output */
-;
-; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
+; unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle,
+;                                            dio_phys_pos *physpos,    /* input */
+;                                            unsigned *sectnum);       /* output */
 ;
 
            .export _dio_phys_to_log
            .importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4
 
            .include "dio.inc"
-            .include "geossym.inc"
+           .include "geossym.inc"
            .include "const.inc"
 
 _dio_phys_to_log:
 
 ; based on Atari version by Christian Groessler
 ; 2.7.2001
 ;
-; dhandle_t     __fastcall__ dio_open  (driveid_t drive_id);
+; dhandle_t     __fastcall__ dio_open  (unsigned char device);
 ; unsigned char __fastcall__ dio_close (dhandle_t handle);
 ;
 ; dio_open sets given device as current and initializes disk
 
 ;
 ; this file provides the _dio_read function
 ;
-; unsigned char __fastcall__ dio_read(dhandle_t handle,sectnum_t sect_num,void *buffer);
-; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
+; unsigned char __fastcall__ dio_read (dhandle_t handle, unsigned sect_num, void *buffer);
 ;
 
            .import dio_params, __oserror
-           .export _dio_read
+           .export _dio_read
 
            .include "geossym.inc"
            .include "jumptab.inc"
 
 ; Maciej 'YTM/Elysium' Witkowiak
 ; 2.7.2001
 ;
-; unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle,
-;                                           sectnum_t *sectnum,        /* input */
-;                                           dio_phys_pos *physpos);    /* output */
-;
-; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
+; unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle,
+;                                            unsigned *sectnum,        /* input */
+;                                            dio_phys_pos *physpos);   /* output */
 ;
 
            .export _dio_log_to_phys
            .import sectab_1541_l, sectab_1541_h
 
            .include "dio.inc"
-            .include "geossym.inc"
+           .include "geossym.inc"
            .include "const.inc"
 
 _dio_log_to_phys:
 
 ;
 ; this file provides the _dio_write function
 ;
-; unsigned char __fastcall__ dio_write(dhandle_t handle,sectnum_t sect_num,const void *buffer);
-; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
+; unsigned char __fastcall__ dio_write (dhandle_t handle, unsigned sect_num, const void *buffer);
 ;
 
            .import dio_params, setoserror
-           .export _dio_write
+           .export _dio_write
 
            .include "geossym.inc"
            .include "jumptab.inc"
 
 ;
 ; this file provides the _dio_write function
 ;
-; unsigned char __fastcall__ dio_write_verify(dhandle_t handle,sectnum_t sect_num,const void *buffer);
-; dhandle_t - 16bit (ptr)
-; sectnum_t - 16bit
+; unsigned char __fastcall__ dio_write_verify (dhandle_t handle, unsigned sect_num, const void *buffer);
 ;
 
            .import dio_params, __oserror
-           .export _dio_write_verify
+           .export _dio_write_verify
 
            .include "geossym.inc"
            .include "jumptab.inc"
 
 }
 
 
-static driveid_t AskForDrive (const char* Name)
+static unsigned char AskForDrive (const char* Name)
 /* Ask for a drive id and return it */
 {
-    driveid_t Drive = 0;
-    char      Char;
+    unsigned char Drive = 0;
+    char          Char;
 
     cprintf ("\r\n%s Drive ID ?", Name);
 
 }
 
 
-static void AskForDisk (const char* Name, driveid_t Drive)
+static void AskForDisk (const char* Name, unsigned char Drive)
 /* Ask the user to insert a specific disk */
 {
     ClearLine ();
 }
 
 
-static char* AllocBuffer (sectsize_t SectSize, sectnum_t SectCount, sectnum_t* ChunkCount)
+static char* AllocBuffer (unsigned int SectSize, unsigned int SectCount, unsigned int* ChunkCount)
 /* Allocate a copy buffer on the heap and return a pointer to it */
 {
     char*         Buffer = NULL;
     /* Increase number of chunks resp. decrease size */
     /* of one chunk until buffer allocation succeeds */
     do {
-        *ChunkCount = (sectnum_t) ((SectCount + Chunks - 1) / Chunks);
+        *ChunkCount = (unsigned int) ((SectCount + Chunks - 1) / Chunks);
         BufferSize = *ChunkCount * (unsigned long) SectSize;
         if (BufferSize < UINT_MAX) {
             Buffer = malloc ((size_t) BufferSize);
 
 int main (int argc, const char* argv[])
 {
-    driveid_t  SourceId;
-    driveid_t  TargetId;
-    dhandle_t  Source = NULL;
-    dhandle_t  Target = NULL;
-    sectsize_t SectSize;
-    sectnum_t  SectCount;
-    char*      Buffer;
-    sectnum_t  Sector;
-    sectnum_t  ChunkCount;
-    sectnum_t  ChunkOffset = 0;
+    unsigned char SourceId;
+    unsigned char TargetId;
+    dhandle_t     Source = NULL;
+    dhandle_t     Target = NULL;
+    unsigned int  SectSize;
+    unsigned int  SectCount;
+    char*         Buffer;
+    unsigned int  Sector;
+    unsigned int  ChunkCount;
+    unsigned int  ChunkOffset = 0;
 
     clrscr ();
     screensize (&ScreenX, &ScreenY);
 
     cur_addr = *(unsigned*)(&dirent->d_mtime.hour + 1);
 
     /* DEV_NUM is set to the drive accessed above */
-    dhandle = dio_open(*(driveid_t*)0xBF30);
+    dhandle = dio_open(*(unsigned char*)0xBF30);
     if (!dhandle) {
         err_exit("dio_open", 1);
     }
     for (index = 0; index < sizeof(info_signature); ++index) {
         if (header_block.content.info_block[index] != info_signature[index]) {
             err_exit("file signature mismatch", 0);
-        }   
+        }
     }
 
     /* Check ProDOS storage type in directory entry template */