]> git.sur5r.net Git - cc65/commitdiff
Introduced getcurrentdevice() and implemented it for CBM and Apple.
authorol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 21 Oct 2012 14:35:17 +0000 (14:35 +0000)
committerol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 21 Oct 2012 14:35:17 +0000 (14:35 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5863 b7a2c559-68d2-44c3-8de9-860c34a00d81

include/device.h
libsrc/apple2/Makefile
libsrc/apple2/curdevice.s [new file with mode: 0644]
libsrc/apple2enh/Makefile
libsrc/cbm/Makefile
libsrc/cbm/curdevice.s [new file with mode: 0644]

index faf674665db60c0262d97dd9af8f6a9ccb3e9de1..68b1c807aa3f19f08ccd223a2159c9048ca5c037 100644 (file)
@@ -55,6 +55,8 @@ unsigned char getfirstdevice (void);
 
 unsigned char __fastcall__ getnextdevice (unsigned char device);
 
+unsigned char getcurrentdevice (void);
+
 char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);
 
 
index ad4573ac3133ee9ba7d4823466221b629e119270..9f14a081c97e325c30a9d640a2f10f2b8cb63669 100644 (file)
@@ -61,6 +61,7 @@ S_OBJS=       _scrsize.o      \
        cputc.o         \
        crt0.o          \
        ctype.o         \
+       curdevice.o     \
        cvline.o        \
        devicedir.o     \
        dioclose.o      \
diff --git a/libsrc/apple2/curdevice.s b/libsrc/apple2/curdevice.s
new file mode 100644 (file)
index 0000000..9781b8a
--- /dev/null
@@ -0,0 +1,27 @@
+;
+; Oliver Schmidt, 2012-10-21
+;
+; unsigned char getcurrentdevice (void);
+;
+
+        .export         _getcurrentdevice
+        .import         __dos_type
+
+        .include        "mli.inc"
+
+_getcurrentdevice:
+
+        ; Use unit number of most recent accessed device
+        lda     DEVNUM
+        lsr
+        lsr
+        lsr
+        lsr
+
+        ; Check for ProDOS 8
+        ldx     __dos_type
+        bne     :+
+        lda     #$FF            ; INVALID_DEVICE
+
+:       ldx     #$00
+        rts
index 0c564d465a210ce65de21883433cb39cc175d272..02c6abd6824848ab2a7ac5e569d1a203033214c0 100644 (file)
@@ -64,6 +64,7 @@ S_OBJS=       _scrsize.o      \
        cputc.o         \
        crt0.o          \
        ctype.o         \
+       curdevice.o     \
        cvline.o        \
        devicedir.o     \
        dioclose.o      \
index 99753dd979a795b401b50c430aaae37e6f1d6f6b..fa64e4f7cd50ae45088faae660488ca39cfe11ea 100644 (file)
@@ -68,6 +68,7 @@ S_OBJS =      c_acptr.o       \
                close.o         \
                closedir.o      \
                ctype.o         \
+               curdevice.o     \
                cvline.o        \
                devicedir.o     \
                dir.o           \
diff --git a/libsrc/cbm/curdevice.s b/libsrc/cbm/curdevice.s
new file mode 100644 (file)
index 0000000..8c2f7a8
--- /dev/null
@@ -0,0 +1,19 @@
+;
+; Oliver Schmidt, 2012-10-21
+;
+; unsigned char getcurrentdevice (void);
+;
+
+        .export         _getcurrentdevice
+        .import         curunit
+
+;------------------------------------------------------------------------------
+; _getcurrentdevice
+
+.proc   _getcurrentdevice
+
+        lda     curunit
+        ldx     #$00
+        rts
+
+.endproc