1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00
cc65/libsrc/apple2/initcwd.s

63 lines
1.2 KiB
ArmAsm
Raw Normal View History

;
; Oliver Schmidt, 18.04.2005
;
.export initcwd
2023-08-18 11:12:16 +02:00
.import __cwd, __dos_type
.include "zeropage.inc"
2023-08-18 11:12:16 +02:00
.include "apple2.inc"
.include "mli.inc"
2023-08-18 11:12:16 +02:00
mli_parameters:
.byte $01 ; number of parameters
.addr __cwd ; address of parameter
2023-08-18 11:12:16 +02:00
initcwd:
; Check for ProDOS 8
lda __dos_type
beq oserr
; Save random counter
lda RNDL
pha
lda RNDH
pha
; Call MLI
jsr $BF00 ; MLI call entry point
.byte GET_PREFIX_CALL ; MLI command
.addr mli_parameters ; MLI parameter
; Restore random counter
tax
pla
sta RNDH
pla
sta RNDL
txa
; Check for null prefix
ldx __cwd
beq done
; Remove length byte and trailing slash
dex
stx tmp1
ldx #$00
: lda __cwd + 1,x
sta __cwd,x
inx
cpx tmp1
bcc :-
; Add terminating zero
lda #$00
sta __cwd,x
2018-09-08 23:14:54 +02:00
done: rts
2023-08-18 11:12:16 +02:00
oserr: lda #$01 ; "Bad system call number"
sec
rts