2005-04-19 11:31:00 +00:00
|
|
|
;
|
|
|
|
; Oliver Schmidt, 18.04.2005
|
|
|
|
;
|
|
|
|
|
|
|
|
.export initcwd
|
2023-08-18 09:12:16 +00:00
|
|
|
.import __cwd, __dos_type
|
2005-04-19 11:31:00 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "zeropage.inc"
|
2023-08-18 09:12:16 +00:00
|
|
|
.include "apple2.inc"
|
2005-04-19 11:31:00 +00:00
|
|
|
.include "mli.inc"
|
|
|
|
|
2023-08-18 09:12:16 +00:00
|
|
|
initcwd:
|
|
|
|
; Check for ProDOS 8
|
|
|
|
lda __dos_type
|
2023-08-18 12:36:52 +00:00
|
|
|
beq done
|
2023-08-18 09:12:16 +00:00
|
|
|
|
|
|
|
; Save random counter
|
|
|
|
lda RNDL
|
|
|
|
pha
|
|
|
|
lda RNDH
|
|
|
|
pha
|
|
|
|
|
|
|
|
; Call MLI
|
2023-08-18 12:36:52 +00:00
|
|
|
; We're not using mli.s' callmli because its
|
|
|
|
; mliparam is in BSS and this will be called
|
|
|
|
; before LC code is moved to the Language Card.
|
|
|
|
|
2023-08-18 09:12:16 +00:00
|
|
|
jsr $BF00 ; MLI call entry point
|
|
|
|
.byte GET_PREFIX_CALL ; MLI command
|
|
|
|
.addr mli_parameters ; MLI parameter
|
|
|
|
|
|
|
|
; Restore random counter
|
|
|
|
pla
|
|
|
|
sta RNDH
|
|
|
|
pla
|
|
|
|
sta RNDL
|
2005-04-19 11:31:00 +00:00
|
|
|
|
2005-04-19 14:28:15 +00:00
|
|
|
; Check for null prefix
|
2015-10-14 22:15:38 +00:00
|
|
|
ldx __cwd
|
2013-05-09 11:56:54 +00:00
|
|
|
beq done
|
2006-05-29 16:27:39 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
; Remove length byte and trailing slash
|
2015-10-14 22:15:38 +00:00
|
|
|
dex
|
|
|
|
stx tmp1
|
|
|
|
ldx #$00
|
|
|
|
: lda __cwd + 1,x
|
|
|
|
sta __cwd,x
|
2013-05-09 11:56:54 +00:00
|
|
|
inx
|
|
|
|
cpx tmp1
|
|
|
|
bcc :-
|
2006-05-29 16:27:39 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
; Add terminating zero
|
|
|
|
lda #$00
|
2015-10-14 22:15:38 +00:00
|
|
|
sta __cwd,x
|
2018-09-08 21:14:54 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
done: rts
|
2023-08-18 09:12:16 +00:00
|
|
|
|
2023-08-18 12:36:52 +00:00
|
|
|
.rodata
|
|
|
|
|
|
|
|
mli_parameters:
|
|
|
|
.byte $01 ; Number of parameters
|
|
|
|
.addr __cwd ; Address of parameter
|