mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 22:54:59 +00:00
186 lines
3.4 KiB
Plaintext
186 lines
3.4 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
* In :
|
||
* X = #SYSCall
|
||
* Y,A = PATH (PSTR)
|
||
* Out :
|
||
* CC : Y,A = PTR to S.DIR
|
||
* CS : A = EC
|
||
*--------------------------------------
|
||
S.OPENDIRYA jsr S.PFTCHECKPATHYA
|
||
>STYA ZPQuickPtr2
|
||
>STYA MLICALL.PARAMS+1 For MLIOPEN
|
||
|
||
>PUSHWI S.DIR.PRODOS
|
||
>PUSHBI S.MEM.F.INIT0
|
||
jsr S.GetMem
|
||
bcs .9
|
||
|
||
>STYA ZPQuickPtr1
|
||
stx hDIR
|
||
|
||
lda (ZPQuickPtr2)
|
||
cmp #1 One char ?
|
||
bne .7 No, Go open dir....
|
||
tay Y=1
|
||
lda (ZPQuickPtr2),y
|
||
cmp #'/' Root required ?
|
||
beq .8 Yes, Go for ONLINE Call (S.DIR.PRODOS.REF=0)
|
||
|
||
lda #SYSMGR.ERRSYN
|
||
sec
|
||
.9 rts
|
||
|
||
.7 >PUSHWI 1024 get a ProDOS IOBUF
|
||
>PUSHBI S.MEM.F.ALIGN+S.MEM.F.NOMOVE
|
||
jsr S.GetMem
|
||
bcs .98
|
||
|
||
>STYA MLICALL.PARAMS+3 Save Ptr to IOBUF for MLIOPEN call
|
||
txa
|
||
ldy #S.DIR.PRODOS.IOBUF
|
||
sta (ZPQuickPtr1),y
|
||
|
||
>MLICALL MLIOPEN
|
||
bcs .98
|
||
|
||
lda MLICALL.PARAMS+5 get ref_num
|
||
ldy #S.DIR.PRODOS.REF
|
||
sta (ZPQuickPtr1),y
|
||
|
||
.8 lda hDIR
|
||
clc
|
||
rts
|
||
|
||
.98 pha save MLI error
|
||
jsr S.CLOSEDIRA.1
|
||
pla get back MLI error
|
||
sec
|
||
.99 rts
|
||
*--------------------------------------
|
||
hDIR .BS 1
|
||
*--------------------------------------
|
||
* In :
|
||
* A = hDIR
|
||
* Out :
|
||
* CC : X = hDIREND, Y,A = PTR to S.DIRENT
|
||
* CS : A = EC, A = 0 : no more entry
|
||
*--------------------------------------
|
||
S.READDIRA jsr S.PFTCHECKDIRA
|
||
jsr S.GetMemPtrA
|
||
>STYA ZPQuickPtr1
|
||
ldy #S.DIR.PRODOS.REF
|
||
lda (ZPQuickPtr1),y
|
||
beq S.READDIRA.ROOT
|
||
jmp S.READDIRA.DIR
|
||
|
||
S.READDIRA.ROOT >PUSHWI 256 Get Buffer for ONLINE call
|
||
>PUSHBI 0
|
||
jsr S.GetMem
|
||
bcs .99
|
||
>STYA ZPQuickPtr2
|
||
stx hONLINE
|
||
stz MLICALL.PARAMS+1
|
||
>STYA MLICALL.PARAMS+2
|
||
>MLICALL MLIONLINE
|
||
bcs .98
|
||
|
||
lda #1 Ending 0
|
||
sta BufSize
|
||
stz BufSize+1
|
||
|
||
ldy #0
|
||
|
||
.1 lda (ZPQuickPtr2),y
|
||
and #$0F
|
||
beq .2
|
||
|
||
sec Add Filelen +1
|
||
adc BufSize
|
||
sta BufSize
|
||
lda #0
|
||
adc BufSize
|
||
sta BufSize
|
||
|
||
lda #S.STAT
|
||
adc BufSize
|
||
sta BufSize
|
||
lda /S.STAT
|
||
adc BufSize+1
|
||
sta BufSize+1
|
||
|
||
inx
|
||
|
||
.2 tya
|
||
clc
|
||
adc #16
|
||
tay
|
||
bcc .1
|
||
|
||
txa
|
||
beq .99 A=0, CS no more DIRENT
|
||
|
||
>PUSHW BufSize
|
||
>PUSHBI 0
|
||
jsr S.GetMem
|
||
bcs .98
|
||
>STYA ZPQuickPtr3
|
||
>STYA ZPQuickPtr4
|
||
|
||
ldy #0
|
||
|
||
.1 lda (ZPQuickPtr2),y
|
||
and #$0F
|
||
beq .2
|
||
|
||
|
||
lda #0 A=0, CS no more DIRENT
|
||
|
||
.98 pha
|
||
lda hONLINE
|
||
jsr S.FreeMemA
|
||
pla
|
||
sec
|
||
.99 rts
|
||
|
||
S.READDIRA.DIR
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
* In :
|
||
* A = hDIR
|
||
*--------------------------------------
|
||
S.CLOSEDIRA jsr S.PFTCHECKDIRA
|
||
sta hDIR
|
||
jsr S.GetMemPtrA
|
||
>STYA ZPQuickPtr1
|
||
|
||
S.CLOSEDIRA.1 ldy #S.DIR.PRODOS.REF
|
||
lda (ZPQuickPtr1),y
|
||
beq .1
|
||
sta MLICALL.PARAMS+1
|
||
>MLICALL MLICLOSE
|
||
|
||
.1 ldy #S.DIR.PRODOS.IOBUF
|
||
lda (ZPQuickPtr1),y
|
||
beq .2
|
||
jsr S.FreeMemA
|
||
|
||
.2 lda hDIR
|
||
jsr S.FreeMemA
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
hONLINE .BS 1
|
||
BufSize .BS 2
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.DIR
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|