devnum.o                \
        fast.o                  \
         get_tv.o               \
-        getdevice.o            \
        joy_stddrv.o            \
        kbhit.o                 \
         kernal.o               \
         randomize.o            \
         revers.o               \
        slow.o                  \
+       status.o                \
         systime.o               \
         sysuname.o              \
         tgi_colors.o            \
 
         .import         RESTOR, BSOUT, CLRCH
        .import         __INTERRUPTOR_COUNT__
        .import         __RAM_START__, __RAM_SIZE__, __STACKSIZE__
+       .importzp       ST
 
         .include        "zeropage.inc"
        .include        "c128.inc"
 
+++ /dev/null
-;
-; Oliver Schmidt, 2012-09-04
-;
-; unsigned char getfirstdevice (void);
-; unsigned char __fastcall__ getnextdevice (unsigned char device);
-;
-
-        .export         _getfirstdevice
-        .export         _getnextdevice
-
-        .import         isdisk
-        .import         opencmdchannel
-        .import         closecmdchannel
-        .importzp       tmp2
-
-        .include        "c128.inc"
-
-;------------------------------------------------------------------------------
-; _getfirstdevice
-
-_getfirstdevice:
-        lda     #$FF
-        ; Fall through
-
-;------------------------------------------------------------------------------
-; _getnextdevice
-
-_getnextdevice:
-        tax
-next:  inx
-        cpx     #$FF
-        beq     done
-
-; [open|close]cmdchannel already call isdisk internally but they
-; interpret a non-disk as a no-op while we need to interpret it
-; as an error here
-
-        jsr     isdisk
-        bcs     next
-
-; [open|close]cmdchannel don't call into the Kernal at all if they
-; only [in|de]crement the reference count of the shared cmdchannel
-; so we need to explicitly initialize ST here
-
-        lda     #$00
-        sta     ST
-
-        stx     tmp2
-        jsr     opencmdchannel
-        ldx     tmp2
-        jsr     closecmdchannel
-        ldx     tmp2
-
-; As we had to reference ST above anyway we can as well do so
-; here too (instead of calling READST)
-
-        lda     ST
-
-; Either the Kernal calls above were successfull or there was
-; already a cmdchannel to the device open - which is a pretty
-; good indication of its existence ;-)
-
-        bmi     next
-
-done:   txa
-        ldx     #$00
-        rts
 
--- /dev/null
+;
+; Oliver Schmidt, 2012-09-30
+;
+
+       .exportzp       ST := $90       ; IEC status byte
 
         mainargs.o      \
         randomize.o     \
         revers.o        \
+       status.o        \
         systime.o       \
         sysuname.o
 
 
        .import         callmain, zerobss
         .import         MEMTOP, RESTOR, BSOUT, CLRCH
        .import         __INTERRUPTOR_COUNT__
+       .importzp       ST
 
         .include        "zeropage.inc"
        .include        "plus4.inc"
 
--- /dev/null
+;
+; Oliver Schmidt, 2012-09-30
+;
+
+       .exportzp       ST := $90       ; IEC status byte
 
                devnum.o                \
         get_ostype.o            \
         get_tv.o                \
-        getdevice.o             \
        joy_stddrv.o            \
                kbhit.o                 \
         kernal.o                \
         mouse_stddrv.o          \
         randomize.o             \
         revers.o                \
+        status.o                \
         systime.o               \
         sysuname.o              \
         tgi_colors.o            \
 
        .import         __INTERRUPTOR_COUNT__
        .import         __RAM_START__, __RAM_SIZE__     ; Linker generated
        .import         __STACKSIZE__                   ; Linker generated
+       .importzp       ST
 
         .include        "zeropage.inc"
        .include        "c64.inc"
 
+++ /dev/null
-;
-; Oliver Schmidt, 2012-09-04
-;
-; unsigned char getfirstdevice (void);
-; unsigned char __fastcall__ getnextdevice (unsigned char device);
-;
-
-        .export         _getfirstdevice
-        .export         _getnextdevice
-
-        .import         isdisk
-        .import         opencmdchannel
-        .import         closecmdchannel
-        .importzp       tmp2
-
-        .include        "c64.inc"
-
-;------------------------------------------------------------------------------
-; _getfirstdevice
-
-_getfirstdevice:
-        lda     #$FF
-        ; Fall through
-
-;------------------------------------------------------------------------------
-; _getnextdevice
-
-_getnextdevice:
-        tax
-next:  inx
-        cpx     #$FF
-        beq     done
-
-; [open|close]cmdchannel already call isdisk internally but they
-; interpret a non-disk as a no-op while we need to interpret it
-; as an error here
-
-        jsr     isdisk
-        bcs     next
-
-; [open|close]cmdchannel don't call into the Kernal at all if they
-; only [in|de]crement the reference count of the shared cmdchannel
-; so we need to explicitly initialize ST here
-
-        lda     #$00
-        sta     ST
-
-        stx     tmp2
-        jsr     opencmdchannel
-        ldx     tmp2
-        jsr     closecmdchannel
-        ldx     tmp2
-
-; As we had to reference ST above anyway we can as well do so
-; here too (instead of calling READST)
-
-        lda     ST
-
-; Either the Kernal calls above were successfull or there was
-; already a cmdchannel to the device open - which is a pretty
-; good indication of its existence ;-)
-
-        bmi     next
-
-done:   txa
-        ldx     #$00
-        rts
 
--- /dev/null
+;
+; Oliver Schmidt, 2012-09-30
+;
+
+       .exportzp       ST := $90       ; IEC status byte
 
                 filename.o      \
                 filetype.o      \
                 filevars.o      \
+                getdevice.o     \
                gotox.o         \
                gotoxy.o        \
                gotoy.o         \
 
--- /dev/null
+;
+; Oliver Schmidt, 2012-09-04
+;
+; unsigned char getfirstdevice (void);
+; unsigned char __fastcall__ getnextdevice (unsigned char device);
+;
+
+        .export         _getfirstdevice
+        .export         _getnextdevice
+
+        .import         isdisk
+        .import         opencmdchannel
+        .import         closecmdchannel
+        .importzp       ST
+        .importzp       tmp2
+
+;------------------------------------------------------------------------------
+; _getfirstdevice
+
+_getfirstdevice:
+        lda     #$FF
+        ; Fall through
+
+;------------------------------------------------------------------------------
+; _getnextdevice
+
+_getnextdevice:
+        tax
+next:  inx
+        cpx     #$FF
+        beq     done
+
+; [open|close]cmdchannel already call isdisk internally but they
+; interpret a non-disk as a no-op while we need to interpret it
+; as an error here
+
+        jsr     isdisk
+        bcs     next
+
+; [open|close]cmdchannel don't call into the Kernal at all if they
+; only [in|de]crement the reference count of the shared cmdchannel
+; so we need to explicitly initialize ST here
+
+        lda     #$00
+        sta     ST
+
+        stx     tmp2
+        jsr     opencmdchannel
+        ldx     tmp2
+        jsr     closecmdchannel
+        ldx     tmp2
+
+; As we had to reference ST above anyway we can as well do so
+; here too (instead of calling READST)
+
+        lda     ST
+
+; Either the Kernal calls above were successfull or there was
+; already a cmdchannel to the device open - which is a pretty
+; good indication of its existence ;-)
+
+        bmi     next
+
+done:   txa
+        ldx     #$00
+        rts
 
         mainargs.o      \
         randomize.o    \
        revers.o        \
+       status.o        \
         sysuname.o
 
 #--------------------------------------------------------------------------
 
 ;
 
         .export         checkst
-
-        .include        "pet.inc"
+        .importzp       ST
 
 
 .proc   checkst
         rts
 
 .endproc
-
-
 
        .import         callmain
         .import         CLRCH, BSOUT
        .import         __INTERRUPTOR_COUNT__
+       .importzp       ST
 
         .include        "zeropage.inc"
        .include        "pet.inc"
 
 ;
 
         .export         READST
-
-        .include        "pet.inc"
+        .importzp       ST
 
 
 .proc   READST
 
--- /dev/null
+;
+; Oliver Schmidt, 2012-09-30
+;
+
+       .exportzp       ST := $96       ; IEC status byte
 
         mainargs.o      \
         randomize.o     \
         revers.o        \
+        status.o        \
         systime.o       \
         sysuname.o
 
 
        .import         __INTERRUPTOR_COUNT__
        .import         __RAM_START__, __RAM_SIZE__     ; Linker generated
        .import         __STACKSIZE__                   ; Linker generated
+       .importzp       ST
 
         .include        "zeropage.inc"
        .include        "plus4.inc"
 
--- /dev/null
+;
+; Oliver Schmidt, 2012-09-30
+;
+
+       .exportzp       ST := $90       ; IEC status byte
 
         mainargs.o      \
         randomize.o     \
        revers.o        \
+       status.o        \
         sysuname.o
 
 #--------------------------------------------------------------------------
 
        .import         __INTERRUPTOR_COUNT__
        .import         __RAM_START__, __RAM_SIZE__     ; Linker generated
         .import                __STACKSIZE__                   ; Linker generated
+       .importzp       ST
 
         .include        "zeropage.inc"
        .include        "vic20.inc"
 
--- /dev/null
+;
+; Oliver Schmidt, 2012-09-30
+;
+
+       .exportzp       ST := $90       ; IEC status byte