From: ol.sc
Date: Wed, 26 May 2010 21:02:35 +0000 (+0000)
Subject: Added function to find out the volume name of a ProDOS 8 disk in a ProDOS 8 device.
X-Git-Tag: V2.13.3~760
X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=05b23194d9b0ff765eb3e2a83bcef50bbe042e93;p=cc65
Added function to find out the volume name of a ProDOS 8 disk in a ProDOS 8 device.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4668 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
diff --git a/doc/apple2.sgml b/doc/apple2.sgml
index e07d716a3..6af74b3a5 100644
--- a/doc/apple2.sgml
+++ b/doc/apple2.sgml
@@ -292,8 +292,11 @@ usage.
- _dos_type
+
- drivecount
+
- drivelist
- get_ostype
- rebootafterexit
+
- rootdir
- ser_apple2_slot
- tgi_apple2_mix
diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml
index 1b2982bb4..1433abc67 100644
--- a/doc/apple2enh.sgml
+++ b/doc/apple2enh.sgml
@@ -292,8 +292,11 @@ usage.
- _dos_type
+
- drivecount
+
- drivelist
- get_ostype
- rebootafterexit
+
- rootdir
- ser_apple2_slot
- textframe
- textframexy
diff --git a/include/apple2.h b/include/apple2.h
index 1fbf181e7..d856c2840 100644
--- a/include/apple2.h
+++ b/include/apple2.h
@@ -137,24 +137,29 @@ extern unsigned char _dos_type;
+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. */
void rebootafterexit (void);
/* Reboot machine after program termination has completed. */
-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 __fastcall__ rootdir (unsigned char drive, char* buf);
+/* Fill buffer with root directory name of ProDOS 8 disk in ProDOS 8 drive.
+ * Returns 0 for success and an OS specific error code in case of failure.
+ */
-#define ser_apple2_slot(num) ser_ioctl (0, (void *) (num))
+#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.
*/
-#define tgi_apple2_mix(onoff) tgi_ioctl (0, (void *) (onoff))
+#define tgi_apple2_mix(onoff) tgi_ioctl (0, (void*) (onoff))
/* If onoff is 1, graphics/text mixed mode is enabled.
* If onoff is 0, graphics/text mixed mode is disabled.
*/
diff --git a/libsrc/apple2/Makefile b/libsrc/apple2/Makefile
index 8ecb7d5b7..9f5c08b4f 100644
--- a/libsrc/apple2/Makefile
+++ b/libsrc/apple2/Makefile
@@ -94,6 +94,7 @@ S_OBJS= _scrsize.o \
read.o \
reboot.o \
revers.o \
+ rootdir.o \
rwcommon.o \
syschdir.o \
sysmkdir.o \
diff --git a/libsrc/apple2/rootdir.s b/libsrc/apple2/rootdir.s
new file mode 100644
index 000000000..a64bf75bb
--- /dev/null
+++ b/libsrc/apple2/rootdir.s
@@ -0,0 +1,52 @@
+;
+; Oliver Schmidt, 2010-05-24
+;
+; unsigned char __fastcall__ rootdir (unsigned char drive, char* buf);
+;
+
+ .export _rootdir
+ .import popax
+
+ .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 popax
+ sta mliparam + MLI::ON_LINE::UNIT_NUM
+
+ ; Get volume name
+ lda #ON_LINE_CALL
+ ldx #ON_LINE_COUNT
+ jsr callmli
+ bcs :+
+
+ ; 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 or error
+: sta __oserror
+ ldx #$00
+ rts
diff --git a/libsrc/apple2enh/Makefile b/libsrc/apple2enh/Makefile
index d2ed51120..4ed14d989 100644
--- a/libsrc/apple2enh/Makefile
+++ b/libsrc/apple2enh/Makefile
@@ -97,6 +97,7 @@ S_OBJS= _scrsize.o \
read.o \
reboot.o \
revers.o \
+ rootdir.o \
rwcommon.o \
syschdir.o \
sysmkdir.o \