<item>_auxtype
 <item>_dos_type
 <item>_filetype
-<item>drivecount
-<item>drivelist
 <item>get_ostype
 <item>rebootafterexit
 <item>rootdir
 
 
 
 
-unsigned char drivecount (void);
-/* Returns the number of ProDOS 8 drives. */
-
-unsigned char* drivelist (void);
-/* Returns a pointer to the list of ProDOS 8 drives. */
-
 unsigned char get_ostype (void);
 /* Get the machine type. Returns one of the APPLE_xxx codes. */
 
 
        diosectsize.o   \
        diowrite.o      \
        dosdetect.o     \
-       drives.o        \
        exec.o          \
        exehdr.o        \
        filedes.o       \
        filename.o      \
         get_ostype.o    \
+       getdevice.o     \
        gotoxy.o        \
        gotoy.o         \
         home.o          \
 
+++ /dev/null
-;
-; Oliver Schmidt, 2010-05-24
-;
-; unsigned char drivecount (void);
-; unsigned char* drivelist (void);
-;
-
-        .export         _drivecount, _drivelist
-        .import         __dos_type
-
-        .include        "mli.inc"
-
-_drivecount:
-        ldx     #$00
-
-        ; Check for ProDOS 8
-        lda     __dos_type
-        beq     :+
-
-        ; Number of on-line devices (minus 1)
-        ldy     DEVCNT
-        iny
-        tya
-:       rts
-
-_drivelist:
-        ldx     #$00
-
-        ; Check for ProDOS 8
-        lda     __dos_type
-        beq     :+
-
-        ; Up to 14 units may be active
-        lda     #<DEVLST
-        ldx     #>DEVLST
-:       rts
 
--- /dev/null
+;
+; Oliver Schmidt, 2012-09-04
+;
+; unsigned char getfirstdevice (void);
+; unsigned char __fastcall__ getnextdevice (unsigned char device);
+;
+
+        .export         _getfirstdevice
+        .export         _getnextdevice
+
+        .import         __dos_type
+
+        .include        "zeropage.inc"
+        .include        "mli.inc"
+
+_getfirstdevice:
+        lda     #$FF
+        ; Fall through
+
+_getnextdevice:
+next:   tax
+        inx
+        txa
+        cmp     #$FF
+        beq     done
+
+        ; Check for ProDOS 8
+        ldx     __dos_type
+        beq     next
+
+        ; Up to 14 units may be active
+        ldx     #<DEVLST
+        ldy     #>DEVLST
+        stx     ptr1
+        sty     ptr1+1
+
+        ; Number of on-line devices (minus 1)
+        ldy     DEVCNT
+
+       ; Does the list contain the device?
+:       cmp     (ptr1),y
+        beq    done
+        dey
+        bpl     :-
+        bmi     next            ; Branch always
+
+done:   ldx     #$00
+        rts
 
        diosectsize.o   \
        diowrite.o      \
        dosdetect.o     \
-       drives.o        \
        exec.o          \
        exehdr.o        \
        filedes.o       \
        filename.o      \
         get_ostype.o    \
+       getdevice.o     \
        gotoxy.o        \
        gotoy.o         \
         home.o          \