mirror of
https://github.com/cc65/cc65.git
synced 2025-01-14 16:33:00 +00:00
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
This commit is contained in:
parent
3ca0ddb1b0
commit
d99d5f3337
@ -296,7 +296,6 @@ usage.
|
||||
<item>_filetype
|
||||
<item>get_ostype
|
||||
<item>rebootafterexit
|
||||
<item>rootdir
|
||||
<item>ser_apple2_slot
|
||||
<item>tgi_apple2_mix
|
||||
</itemize>
|
||||
|
@ -296,7 +296,6 @@ usage.
|
||||
<item>_filetype
|
||||
<item>get_ostype
|
||||
<item>rebootafterexit
|
||||
<item>rootdir
|
||||
<item>ser_apple2_slot
|
||||
<item>textframe
|
||||
<item>textframexy
|
||||
|
@ -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.
|
||||
|
@ -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 \
|
||||
|
82
libsrc/apple2/devicedir.s
Normal file
82
libsrc/apple2/devicedir.s
Normal file
@ -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
|
@ -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
|
@ -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 \
|
||||
|
Loading…
x
Reference in New Issue
Block a user