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
This commit is contained in:
ol.sc
2010-05-26 21:02:35 +00:00
parent 096cb9c0a8
commit 05b23194d9
6 changed files with 73 additions and 8 deletions

View File

@@ -292,8 +292,11 @@ usage.
<itemize> <itemize>
<item>_dos_type <item>_dos_type
<item>drivecount
<item>drivelist
<item>get_ostype <item>get_ostype
<item>rebootafterexit <item>rebootafterexit
<item>rootdir
<item>ser_apple2_slot <item>ser_apple2_slot
<item>tgi_apple2_mix <item>tgi_apple2_mix
</itemize> </itemize>

View File

@@ -292,8 +292,11 @@ usage.
<itemize> <itemize>
<item>_dos_type <item>_dos_type
<item>drivecount
<item>drivelist
<item>get_ostype <item>get_ostype
<item>rebootafterexit <item>rebootafterexit
<item>rootdir
<item>ser_apple2_slot <item>ser_apple2_slot
<item>textframe <item>textframe
<item>textframexy <item>textframexy

View File

@@ -137,17 +137,22 @@ 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); unsigned char get_ostype (void);
/* Get the machine type. Returns one of the APPLE_xxx codes. */ /* Get the machine type. Returns one of the APPLE_xxx codes. */
void rebootafterexit (void); void rebootafterexit (void);
/* Reboot machine after program termination has completed. */ /* Reboot machine after program termination has completed. */
unsigned char drivecount (void); unsigned char __fastcall__ rootdir (unsigned char drive, char* buf);
/* Returns the number of ProDOS 8 drives. */ /* 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.
unsigned char* drivelist (void); */
/* Returns a pointer to the list of ProDOS 8 drives. */
#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. /* Select a slot number from 1 to 7 prior to ser_open.

View File

@@ -94,6 +94,7 @@ S_OBJS= _scrsize.o \
read.o \ read.o \
reboot.o \ reboot.o \
revers.o \ revers.o \
rootdir.o \
rwcommon.o \ rwcommon.o \
syschdir.o \ syschdir.o \
sysmkdir.o \ sysmkdir.o \

52
libsrc/apple2/rootdir.s Normal file
View File

@@ -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

View File

@@ -97,6 +97,7 @@ S_OBJS= _scrsize.o \
read.o \ read.o \
reboot.o \ reboot.o \
revers.o \ revers.o \
rootdir.o \
rwcommon.o \ rwcommon.o \
syschdir.o \ syschdir.o \
sysmkdir.o \ sysmkdir.o \