From d99d5f3337f8427403b94953e57659bca4c845ef Mon Sep 17 00:00:00 2001 From: "ol.sc" Date: Wed, 10 Oct 2012 20:55:56 +0000 Subject: [PATCH] Replaced Apple II specific solution with implementation of recently introduced devicedir(). git-svn-id: svn://svn.cc65.org/cc65/trunk@5846 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- doc/apple2.sgml | 1 - doc/apple2enh.sgml | 1 - include/apple2.h | 5 --- libsrc/apple2/Makefile | 2 +- libsrc/apple2/devicedir.s | 82 +++++++++++++++++++++++++++++++++++++++ libsrc/apple2/rootdir.s | 52 ------------------------- libsrc/apple2enh/Makefile | 2 +- 7 files changed, 84 insertions(+), 61 deletions(-) create mode 100644 libsrc/apple2/devicedir.s delete mode 100644 libsrc/apple2/rootdir.s diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 3d55f6f96..c01c5bda7 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -296,7 +296,6 @@ usage. _filetype get_ostype rebootafterexit -rootdir ser_apple2_slot tgi_apple2_mix diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 075811236..8d80002a2 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -296,7 +296,6 @@ usage. _filetype get_ostype rebootafterexit -rootdir ser_apple2_slot textframe textframexy diff --git a/include/apple2.h b/include/apple2.h index b7826a764..b81e6bedd 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -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. diff --git a/libsrc/apple2/Makefile b/libsrc/apple2/Makefile index a8e92f467..3896f2903 100644 --- a/libsrc/apple2/Makefile +++ b/libsrc/apple2/Makefile @@ -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 index 000000000..3572eeeeb --- /dev/null +++ b/libsrc/apple2/devicedir.s @@ -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 #