]> git.sur5r.net Git - cc65/commitdiff
Replaced Apple II specific solution with implementation of recently introduced device...
authorol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 10 Oct 2012 20:55:56 +0000 (20:55 +0000)
committerol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 10 Oct 2012 20:55:56 +0000 (20:55 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5846 b7a2c559-68d2-44c3-8de9-860c34a00d81

doc/apple2.sgml
doc/apple2enh.sgml
include/apple2.h
libsrc/apple2/Makefile
libsrc/apple2/devicedir.s [new file with mode: 0644]
libsrc/apple2/rootdir.s [deleted file]
libsrc/apple2enh/Makefile

index 3d55f6f96c7321b5553b58a113c8063f0150135d..c01c5bda74f4c09bf6c555cf66ff1b39434c6990 100644 (file)
@@ -296,7 +296,6 @@ usage.
 <item>_filetype
 <item>get_ostype
 <item>rebootafterexit
-<item>rootdir
 <item>ser_apple2_slot
 <item>tgi_apple2_mix
 </itemize>
index 075811236efa7695db193c305cb7754d3ab0bf1a..8d80002a236c2880ba0c802a833fc20aeb73859f 100644 (file)
@@ -296,7 +296,6 @@ usage.
 <item>_filetype
 <item>get_ostype
 <item>rebootafterexit
-<item>rootdir
 <item>ser_apple2_slot
 <item>textframe
 <item>textframexy
index b7826a764381f1fe3ef9241fb633f978855b439f..b81e6bedd3b93de35bdf62d9fed46fc0cd732640 100644 (file)
@@ -155,11 +155,6 @@ unsigned char get_ostype (void);
 void rebootafterexit (void);
 /* Reboot machine after program termination has completed. */
 
-int __fastcall__ rootdir (unsigned char drive, char* buf);
-/* Fill buffer with root directory name of ProDOS 8 disk in
- * ProDOS 8 drive. Returns 0 on success and -1 on error.
- */
-
 #define ser_apple2_slot(num)  ser_ioctl (0, (void*) (num))
 /* Select a slot number from 1 to 7 prior to ser_open.
  * The default slot number is 2.
index a8e92f467c8b7604e88f6bdd96c5a79d0ffdc3d3..3896f290365840e4ee0beeac21b597d56ad0a75e 100644 (file)
@@ -62,6 +62,7 @@ S_OBJS=       _scrsize.o      \
        crt0.o          \
        ctype.o         \
        cvline.o        \
+       devicedir.o     \
        dioclose.o      \
        diocommon.o     \
        dioopen.o       \
@@ -95,7 +96,6 @@ S_OBJS=       _scrsize.o      \
        read.o          \
        reboot.o        \
        revers.o        \
-       rootdir.o       \
        rwcommon.o      \
        syschdir.o      \
        sysmkdir.o      \
diff --git a/libsrc/apple2/devicedir.s b/libsrc/apple2/devicedir.s
new file mode 100644 (file)
index 0000000..3572eee
--- /dev/null
@@ -0,0 +1,82 @@
+;
+; Oliver Schmidt, 2010-05-24
+;
+; char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);
+;
+
+        .export                _getdevicedir
+        .import                popax, popa
+
+        .include       "zeropage.inc"
+        .include       "errno.inc"
+        .include       "mli.inc"
+
+_getdevicedir:
+        ; Save size
+        sta    ptr2
+        stx    ptr2+1
+
+        ; Save buf
+        jsr    popax
+        sta    ptr1
+        stx    ptr1+1
+
+        ; Set buf
+        sta    mliparam + MLI::ON_LINE::DATA_BUFFER
+        stx    mliparam + MLI::ON_LINE::DATA_BUFFER+1
+
+        ; Set device
+        jsr    popa
+        sta    mliparam + MLI::ON_LINE::UNIT_NUM
+
+        ; Check for valid slot
+        tax
+        and    #$0F
+        bne    erange
+        txa
+        and    #$70
+        beq    erange
+
+        ; Check for sufficient buf size
+        lda    ptr2+1
+        bne    :++             ; Buf >= 256
+        lda    ptr2
+        cmp    #17
+        bcs    :++             ; Buf >= 17
+
+        ; Handle errors
+erange: lda    #<ERANGE
+        jsr    __directerrno
+        bne    :+              ; Branch always
+oserr:  jsr    __mappederrno
+:       lda    #$00            ; Return NULL
+        tax
+        rts
+
+        ; Get volume name
+:       lda    #ON_LINE_CALL
+        ldx    #ON_LINE_COUNT
+        jsr    callmli
+        bcs    oserr
+
+        ; Get volume name length
+        ldy    #$00
+        lda    (ptr1),y
+        and    #15             ; Max volume name length
+        sta    tmp1
+        
+        ; Add leading slash
+        lda    #'/'
+        sta    (ptr1),y
+
+        ; Add terminating zero
+        ldy    tmp1
+        iny
+        lda    #$00
+        sta    (ptr1),y
+        sta    __oserror       ; Clear _oserror
+
+        ; Success, return buf
+        lda    ptr1
+        ldx    ptr1+1
+        rts
diff --git a/libsrc/apple2/rootdir.s b/libsrc/apple2/rootdir.s
deleted file mode 100644 (file)
index 064e0e3..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-;
-; Oliver Schmidt, 2010-05-24
-;
-; int __fastcall__ rootdir (unsigned char drive, char* buf);
-;
-
-        .export        _rootdir
-        .import                popa
-
-        .include       "zeropage.inc"
-        .include       "errno.inc"
-        .include       "mli.inc"
-
-_rootdir:
-        ; Save buf
-        sta    ptr1
-        stx    ptr1+1
-
-        ; Set buf
-        sta    mliparam + MLI::ON_LINE::DATA_BUFFER
-        stx    mliparam + MLI::ON_LINE::DATA_BUFFER+1
-
-        ; Set drive
-        jsr    popa
-        sta    mliparam + MLI::ON_LINE::UNIT_NUM
-
-        ; Get volume name
-        lda    #ON_LINE_CALL
-        ldx    #ON_LINE_COUNT
-        jsr    callmli
-        bcs    oserr
-
-        ; Get volume name length
-        ldy    #$00
-        lda    (ptr1),y
-        and    #15             ; Max volume name length
-        sta    tmp1
-        
-        ; Add leading slash
-        lda    #'/'
-        sta    (ptr1),y
-
-       ; Add terminating zero
-        ldy    tmp1
-        iny        
-        lda    #$00
-        sta    (ptr1),y
-        
-        ; Return success       ; A = 0
-        
-        ; Set __oserror
-oserr:  jmp    __mappederrno
index 7b0cb08b954a788602db5fb57c0668e89d1017f4..44165604be944e71df2a12df73cc2c754fbb0fd2 100644 (file)
@@ -65,6 +65,7 @@ S_OBJS=       _scrsize.o      \
        crt0.o          \
        ctype.o         \
        cvline.o        \
+       devicedir.o     \
        dioclose.o      \
        diocommon.o     \
        dioopen.o       \
@@ -98,7 +99,6 @@ S_OBJS=       _scrsize.o      \
        read.o          \
        reboot.o        \
        revers.o        \
-       rootdir.o       \
        rwcommon.o      \
        syschdir.o      \
        sysmkdir.o      \