2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2019-05-25 19:24:07 +00:00
|
|
|
|
AUTO 3,1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
* # OpenDir
|
2018-07-20 11:51:08 +00:00
|
|
|
|
* ## C
|
2021-01-12 21:14:13 +00:00
|
|
|
|
* `short int hDIR opendir (const char * dirpath);`
|
2018-07-20 11:51:08 +00:00
|
|
|
|
* ## ASM
|
2020-03-16 06:50:15 +00:00
|
|
|
|
* `>LDYA dirpath`
|
2020-07-13 19:29:31 +00:00
|
|
|
|
* `>SYSCALL opendir`
|
|
|
|
|
* ## RETURN VALUE
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* CC : success
|
2016-10-26 20:51:06 +00:00
|
|
|
|
* A = hDIR
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* CS : error
|
|
|
|
|
* A = EC
|
|
|
|
|
*\--------------------------------------
|
2020-03-16 06:50:15 +00:00
|
|
|
|
K.OpenDir jsr PFT.CheckPathYA
|
2023-10-18 05:41:12 +00:00
|
|
|
|
bcs DIRENT.RTS
|
2020-02-14 07:21:56 +00:00
|
|
|
|
|
2021-07-24 20:42:23 +00:00
|
|
|
|
jsr FS.OPEN.DIR
|
2023-10-18 05:41:12 +00:00
|
|
|
|
bcs DIRENT.RTS
|
2021-07-24 20:42:23 +00:00
|
|
|
|
|
|
|
|
|
jmp K.FOpen.REGDIR
|
2019-10-03 06:25:27 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
* # ReadDir
|
2018-07-20 11:51:08 +00:00
|
|
|
|
* ## C
|
2023-01-17 06:31:23 +00:00
|
|
|
|
* `struct dirent *readdir (short int hDIR);`
|
2018-07-20 11:51:08 +00:00
|
|
|
|
* ## ASM
|
|
|
|
|
* `lda hDIR`
|
|
|
|
|
* `>SYSCALL readdir`
|
2020-07-13 19:29:31 +00:00
|
|
|
|
* ## RETURN VALUE
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* CC : success
|
|
|
|
|
* X = hDIRENT
|
|
|
|
|
* Y,A = PTR to S.DIRENT
|
|
|
|
|
* CS : error
|
|
|
|
|
* A = EC
|
|
|
|
|
* note : A = 0 means no more entry
|
|
|
|
|
*\--------------------------------------
|
2020-11-19 15:34:02 +00:00
|
|
|
|
.DUMMY ZPTMP,9
|
2020-07-13 19:29:31 +00:00
|
|
|
|
.OR ZPTMP 9 Bytes
|
2018-06-21 15:12:10 +00:00
|
|
|
|
K.ReadDir.ECIB .BS 1
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
K.ReadDir.EL .BS 1
|
|
|
|
|
K.ReadDir.EPB .BS 1
|
|
|
|
|
K.ReadDir.EC .BS 2
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-03-11 16:41:45 +00:00
|
|
|
|
K.ReadDir.BufSize .BS 2
|
|
|
|
|
K.ReadDir.hBuf .BS 1
|
2019-01-04 13:17:31 +00:00
|
|
|
|
.ED
|
2016-09-23 15:19:22 +00:00
|
|
|
|
*--------------------------------------
|
2018-06-22 14:59:24 +00:00
|
|
|
|
K.ReadDir jsr PFT.CheckNodeA
|
2021-05-04 17:31:21 +00:00
|
|
|
|
bcs DIRENT.RTS
|
2020-03-16 06:50:15 +00:00
|
|
|
|
|
2019-01-30 16:23:00 +00:00
|
|
|
|
ldy #S.FD.REG.REF
|
2018-08-11 10:57:57 +00:00
|
|
|
|
lda (pFD),y
|
2018-06-21 15:12:10 +00:00
|
|
|
|
beq K.ReadDir.ROOT
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-03-17 16:03:32 +00:00
|
|
|
|
bpl .1
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-03-16 06:50:15 +00:00
|
|
|
|
jmp K.ReadDir.DEV
|
|
|
|
|
|
|
|
|
|
.1 jmp K.ReadDir.DIR
|
2021-05-04 17:31:21 +00:00
|
|
|
|
|
|
|
|
|
DIRENT.EOF lda #MLI.E.EOF
|
2019-02-22 13:34:06 +00:00
|
|
|
|
sec
|
2021-05-04 17:31:21 +00:00
|
|
|
|
DIRENT.RTS rts
|
2016-09-23 15:19:22 +00:00
|
|
|
|
*--------------------------------------
|
2020-03-16 06:50:15 +00:00
|
|
|
|
K.ReadDir.ROOT ldy #S.FD.DIR.FC did we already returned something ?
|
2018-08-11 10:57:57 +00:00
|
|
|
|
lda (pFD),y
|
2021-05-04 17:31:21 +00:00
|
|
|
|
bne DIRENT.EOF
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
2019-06-24 15:32:22 +00:00
|
|
|
|
stz K.MLI.PARAMS+1 All Volumes
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>LDYAI K.Buf256
|
2017-03-28 15:46:12 +00:00
|
|
|
|
>STYA K.MLI.PARAMS+2
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr2
|
2021-02-17 16:15:43 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
>MLICALL MLI.ONLINE
|
2021-05-04 17:31:21 +00:00
|
|
|
|
bcs DIRENT.RTS
|
2019-11-27 22:04:55 +00:00
|
|
|
|
|
2021-01-12 21:14:13 +00:00
|
|
|
|
>LDYAI 16+S.STAT*18+1 14*(Vols+Stat) + 4*(PFT+Stat) + \0
|
2020-04-24 08:25:31 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
jsr K.ReadDir.GetBuf
|
2021-05-04 17:31:21 +00:00
|
|
|
|
bcs DIRENT.RTS
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-02-16 20:45:16 +00:00
|
|
|
|
.1 lda (ZPPtr2)
|
2016-09-02 06:09:44 +00:00
|
|
|
|
and #$0F
|
2021-01-12 21:14:13 +00:00
|
|
|
|
beq .4
|
2016-09-23 15:19:22 +00:00
|
|
|
|
|
2016-09-02 15:14:24 +00:00
|
|
|
|
tax
|
2016-10-30 07:58:08 +00:00
|
|
|
|
inc
|
2017-03-28 15:46:12 +00:00
|
|
|
|
sta K.MLI.PATH
|
2016-09-23 15:19:22 +00:00
|
|
|
|
lda #'/'
|
2017-03-28 15:46:12 +00:00
|
|
|
|
sta K.MLI.PATH+1
|
2016-09-23 15:19:22 +00:00
|
|
|
|
ldy #1
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-02-16 20:45:16 +00:00
|
|
|
|
.2 lda (ZPPtr2),y
|
2017-03-28 15:46:12 +00:00
|
|
|
|
sta K.MLI.PATH+1,y
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.ReadDir.AddToBuf
|
2016-09-23 15:19:22 +00:00
|
|
|
|
iny
|
|
|
|
|
dex
|
2020-02-16 20:45:16 +00:00
|
|
|
|
bne .2
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
|
|
|
|
txa Add ending 0 for C String
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.ReadDir.AddToBuf
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
jsr FS.ClrStat
|
2016-10-13 16:00:27 +00:00
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
lda /S.STAT.MODE.BDEV
|
|
|
|
|
sta K.S.STAT+S.STAT.MODE+1
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
lda (ZPPtr2)
|
2020-02-16 20:45:16 +00:00
|
|
|
|
asl DRIVE in Carry
|
2016-10-13 16:00:27 +00:00
|
|
|
|
pha
|
|
|
|
|
lda #0
|
|
|
|
|
rol
|
|
|
|
|
inc
|
2017-03-21 16:29:15 +00:00
|
|
|
|
sta K.S.STAT+S.STAT.P.DRIVE
|
2016-10-13 16:00:27 +00:00
|
|
|
|
pla
|
|
|
|
|
lsr CC
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
2017-03-21 16:29:15 +00:00
|
|
|
|
sta K.S.STAT+S.STAT.P.SLOT
|
2016-10-13 16:00:27 +00:00
|
|
|
|
|
2017-03-28 15:46:12 +00:00
|
|
|
|
>LDYAI K.MLI.PATH
|
|
|
|
|
>STYA K.MLI.PARAMS+1
|
2023-11-04 14:42:28 +00:00
|
|
|
|
>MLICALL MLI.GFINFO
|
2017-03-21 16:29:15 +00:00
|
|
|
|
sta K.S.STAT+S.STAT.P.DEVSTATUS
|
2016-10-13 16:00:27 +00:00
|
|
|
|
|
2020-02-16 20:45:16 +00:00
|
|
|
|
bcs .3
|
|
|
|
|
|
2017-03-28 15:46:12 +00:00
|
|
|
|
>LDYA K.MLI.PARAMS+5 AUXTYPE=TOTAL BLOCKS
|
2017-03-21 16:29:15 +00:00
|
|
|
|
>STYA K.S.STAT+S.STAT.P.DEVBLOCKS
|
2017-03-28 15:46:12 +00:00
|
|
|
|
>LDYA K.MLI.PARAMS+8
|
2017-03-21 16:29:15 +00:00
|
|
|
|
>STYA K.S.STAT+S.STAT.BLOCKS
|
2018-04-21 13:46:10 +00:00
|
|
|
|
|
2020-02-16 20:45:16 +00:00
|
|
|
|
.3 jsr K.ReadDir.AddStat
|
|
|
|
|
|
2021-01-12 21:14:13 +00:00
|
|
|
|
.4 lda ZPPtr2
|
2016-09-02 15:14:24 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #16
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta ZPPtr2
|
2020-07-13 19:29:31 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
2021-01-12 21:14:13 +00:00
|
|
|
|
jsr FS.ClrStat
|
|
|
|
|
|
|
|
|
|
lda /S.STAT.MODE.DIR
|
|
|
|
|
sta K.S.STAT+S.STAT.MODE+1
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
.6 lda PFTs.pHI,x
|
2021-01-12 21:14:13 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
sta ZPPtr2+1
|
2023-10-18 05:41:12 +00:00
|
|
|
|
lda PFTs.pLO,x
|
2021-01-12 21:14:13 +00:00
|
|
|
|
sta ZPPtr2
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.7 iny
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
jsr K.ReadDir.AddToBuf
|
|
|
|
|
eor #0
|
|
|
|
|
bne .7
|
|
|
|
|
|
|
|
|
|
jsr K.ReadDir.AddStat
|
|
|
|
|
|
|
|
|
|
.8 inx
|
2023-10-18 05:41:12 +00:00
|
|
|
|
cpx #K.PFT.MAX
|
2021-01-12 21:14:13 +00:00
|
|
|
|
bne .6
|
|
|
|
|
|
2018-05-04 14:55:29 +00:00
|
|
|
|
* lda #0 done by S.MEM.F.INIT0
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* sta (ZPPtr4) Ending 0
|
2020-02-16 20:45:16 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.FD.DIR.FC
|
2021-01-12 21:14:13 +00:00
|
|
|
|
lda #255
|
2020-07-13 19:29:31 +00:00
|
|
|
|
sta (pFD),y Flag that we returned something for next time
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jmp K.ReadDir.EXIT
|
2016-09-20 06:17:20 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-04 17:31:21 +00:00
|
|
|
|
K.ReadDir.DEV jmp DIRENT.EOF TODO : /dev
|
2020-03-16 06:50:15 +00:00
|
|
|
|
*--------------------------------------
|
2019-06-24 15:32:22 +00:00
|
|
|
|
K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
|
2016-09-02 06:09:44 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
stz K.MLI.PARAMS+2
|
|
|
|
|
lda /K.Buf256 read in Buf256+IOBuf
|
|
|
|
|
sta K.MLI.PARAMS+3
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
stz K.MLI.PARAMS+4
|
|
|
|
|
lda /512
|
|
|
|
|
sta K.MLI.PARAMS+5
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
>MLICALL MLI.READ Read A block from directory
|
2021-07-24 20:42:23 +00:00
|
|
|
|
bcs .99
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-07-10 15:33:13 +00:00
|
|
|
|
ldy #S.FD.DIR.EL Check if first run....
|
2018-08-11 10:57:57 +00:00
|
|
|
|
lda (pFD),y
|
2016-09-20 06:17:20 +00:00
|
|
|
|
bne .2 no, we have all we need....
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2016-09-23 06:00:00 +00:00
|
|
|
|
ldx #3
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
.1 lda K.Buf256+$23,x Get K.ReadDir.EL.... From Block
|
2018-06-21 15:12:10 +00:00
|
|
|
|
sta K.ReadDir.EL,x
|
2016-09-23 06:00:00 +00:00
|
|
|
|
dex
|
2016-09-20 06:17:20 +00:00
|
|
|
|
bpl .1
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
ldx #7
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
ldy #S.FD.DIR.ACL+7
|
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
.20 lda K.Buf256+$14,x
|
2020-07-13 19:29:31 +00:00
|
|
|
|
cpy #S.FD.DIR.MODE+1
|
|
|
|
|
bne .30
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
and #$0F
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
.30 sta (pFD),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
2021-07-28 16:50:59 +00:00
|
|
|
|
bpl .20
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
inc K.ReadDir.EC Add one to EC because we include VOL/DIR Header
|
2016-10-24 15:54:43 +00:00
|
|
|
|
bne .4
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
inc K.ReadDir.EC+1 ...and ProDOS does NOT include header entry in EC
|
2016-09-20 06:17:20 +00:00
|
|
|
|
bra .4
|
|
|
|
|
|
|
|
|
|
.99 rts
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-07-10 15:33:13 +00:00
|
|
|
|
.2 ldy #S.FD.DIR.EL+3
|
2016-09-22 15:46:01 +00:00
|
|
|
|
ldx #3
|
2016-09-20 06:17:20 +00:00
|
|
|
|
|
2018-08-11 10:57:57 +00:00
|
|
|
|
.3 lda (pFD),y get this session parameters from S.DIR
|
2018-06-21 15:12:10 +00:00
|
|
|
|
sta K.ReadDir.EL,x
|
2016-09-20 06:17:20 +00:00
|
|
|
|
dey
|
2016-09-22 15:46:01 +00:00
|
|
|
|
dex
|
2016-09-20 06:17:20 +00:00
|
|
|
|
bpl .3
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
.4 lda K.ReadDir.EC
|
2016-10-30 18:17:43 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
tax
|
2016-09-20 06:17:20 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
lda K.ReadDir.EC+1
|
2016-10-30 18:17:43 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
tay
|
2016-10-24 15:54:43 +00:00
|
|
|
|
|
2016-10-30 18:17:43 +00:00
|
|
|
|
inx Any entry remaining ?
|
|
|
|
|
bne .5
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2016-10-30 18:17:43 +00:00
|
|
|
|
iny
|
2021-07-28 16:50:59 +00:00
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
lda #MLI.E.EOF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2021-07-24 20:42:23 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* pass #1 compute BufSize...
|
2021-07-24 20:42:23 +00:00
|
|
|
|
*--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
.5 lda K.ReadDir.EPB
|
|
|
|
|
sta K.ReadDir.ECIB
|
2016-09-20 06:17:20 +00:00
|
|
|
|
|
|
|
|
|
lda #1 For Ending 0
|
2018-06-21 15:12:10 +00:00
|
|
|
|
sta K.ReadDir.BufSize
|
|
|
|
|
stz K.ReadDir.BufSize+1
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
jsr K.ReadDir.P3Init
|
|
|
|
|
|
|
|
|
|
K.ReadDir.DIR1 lda (ZPPtr3)
|
2016-09-20 06:17:20 +00:00
|
|
|
|
beq .7 Free slot....goto next
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2016-09-23 15:19:22 +00:00
|
|
|
|
and #$F0 get storage_type
|
|
|
|
|
cmp #$F0 Volume header ?
|
|
|
|
|
beq .1
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2016-09-23 15:19:22 +00:00
|
|
|
|
cmp #$E0 directory header ?
|
|
|
|
|
beq .2
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
lda (ZPPtr3) regular DIR or File, get LEN
|
2016-10-24 15:54:43 +00:00
|
|
|
|
and #$F compute filename len
|
2016-09-23 15:19:22 +00:00
|
|
|
|
sec add "#<filename>" + S.STAT
|
|
|
|
|
adc #S.STAT
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
.1 lda #2+S.STAT add "1." string + S.STAT
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
.2 lda #2+S.STAT+3+S.STAT add "1." + S.STAT + "2.." + S.STAT...
|
2016-09-20 06:17:20 +00:00
|
|
|
|
|
2016-09-23 15:19:22 +00:00
|
|
|
|
clc
|
2018-06-21 15:12:10 +00:00
|
|
|
|
adc K.ReadDir.BufSize
|
|
|
|
|
sta K.ReadDir.BufSize
|
2016-10-30 18:17:43 +00:00
|
|
|
|
bcc .3
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
inc K.ReadDir.BufSize+1
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
.3 inx X,Y = !Total entry Count
|
2016-10-30 18:17:43 +00:00
|
|
|
|
bne .7
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2016-10-30 18:17:43 +00:00
|
|
|
|
iny
|
2021-07-28 16:50:59 +00:00
|
|
|
|
beq K.ReadDir.DIR2 we reached last entry in whole DIR
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
.7 jsr K.ReadDir.P3Next
|
2018-06-21 15:12:10 +00:00
|
|
|
|
bne K.ReadDir.DIR1
|
2021-07-24 20:42:23 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* pass #2 Fill Buffer...(ZPPtr1 & Ptr2 can now be trashed)
|
2021-07-24 20:42:23 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.ReadDir.DIR2 lda K.ReadDir.EPB
|
2018-06-21 15:12:10 +00:00
|
|
|
|
sta K.ReadDir.ECIB
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
>LDYA K.ReadDir.BufSize Get a BufSize bytes buffer for storing results
|
2021-07-24 20:42:23 +00:00
|
|
|
|
jsr K.ReadDir.GetBuf
|
2021-07-28 16:50:59 +00:00
|
|
|
|
bcc .10
|
2021-07-24 20:42:23 +00:00
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
.10 jsr K.ReadDir.P3Init
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr3)
|
2016-10-30 18:17:43 +00:00
|
|
|
|
beq .7 Empty slot, skip
|
2016-10-14 15:39:49 +00:00
|
|
|
|
|
2016-09-23 15:19:22 +00:00
|
|
|
|
and #$F0
|
|
|
|
|
cmp #$F0 Vol Header ?
|
2016-10-30 18:17:43 +00:00
|
|
|
|
bne .2
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.ReadDir.ADD.
|
2020-02-16 20:45:16 +00:00
|
|
|
|
bra .4
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2016-10-30 18:17:43 +00:00
|
|
|
|
.2 cmp #$E0 Dir Header ?
|
|
|
|
|
bne .3
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.ReadDir.ADD.
|
2020-07-13 19:29:31 +00:00
|
|
|
|
jsr K.ReadDir.AddStatACL
|
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.ReadDir.ADD..
|
2020-02-16 20:45:16 +00:00
|
|
|
|
bra .4
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
.3 jsr K.ReadDir.AddFNToBuf
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
|
|
|
|
.4 jsr K.ReadDir.AddStatACL
|
2016-10-30 18:17:43 +00:00
|
|
|
|
|
2020-02-16 20:45:16 +00:00
|
|
|
|
lda K.ReadDir.EC decrease global counter...
|
2016-10-30 18:17:43 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc #1
|
2018-06-21 15:12:10 +00:00
|
|
|
|
sta K.ReadDir.EC
|
|
|
|
|
lda K.ReadDir.EC+1
|
2016-10-30 18:17:43 +00:00
|
|
|
|
sbc #0
|
2018-06-21 15:12:10 +00:00
|
|
|
|
sta K.ReadDir.EC+1
|
|
|
|
|
ora K.ReadDir.EC
|
2016-10-30 18:17:43 +00:00
|
|
|
|
beq .8 0! no more files in DIR
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
.7 jsr K.ReadDir.P3Next
|
|
|
|
|
bne .1
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
|
|
|
|
.8 ldx #3
|
2018-07-10 15:33:13 +00:00
|
|
|
|
ldy #S.FD.DIR.EL+3
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2020-03-11 16:41:45 +00:00
|
|
|
|
.81 lda K.ReadDir.EL,x Store back this session parameters to S.DIR
|
2018-08-11 10:57:57 +00:00
|
|
|
|
sta (pFD),y
|
2016-09-20 06:17:20 +00:00
|
|
|
|
dey
|
2016-09-22 15:46:01 +00:00
|
|
|
|
dex
|
2016-10-30 18:17:43 +00:00
|
|
|
|
bpl .81
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2020-03-11 16:41:45 +00:00
|
|
|
|
K.ReadDir.EXIT ldx K.ReadDir.hBuf
|
2017-09-29 06:36:27 +00:00
|
|
|
|
txa
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jmp K.GetMemPtr
|
2016-09-20 06:17:20 +00:00
|
|
|
|
*--------------------------------------
|
2021-07-28 16:50:59 +00:00
|
|
|
|
K.ReadDir.P3Init
|
|
|
|
|
ldy #4 Skip 4 bytes linked list
|
|
|
|
|
sty ZPPtr3
|
|
|
|
|
|
|
|
|
|
lda /K.Buf256
|
|
|
|
|
sta ZPPtr3+1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.ReadDir.P3Next
|
|
|
|
|
lda ZPPtr3
|
|
|
|
|
clc
|
|
|
|
|
adc K.ReadDir.EL
|
|
|
|
|
sta ZPPtr3
|
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
inc ZPPtr3+1
|
|
|
|
|
|
|
|
|
|
.8 dec K.ReadDir.ECIB 0! no more file in block
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
K.ReadDir.GetBuf
|
|
|
|
|
jsr K.GetMem0 make sure 0 filled
|
2016-09-23 15:19:22 +00:00
|
|
|
|
bcs .9
|
2021-07-24 20:42:23 +00:00
|
|
|
|
|
2020-03-11 16:41:45 +00:00
|
|
|
|
stx K.ReadDir.hBuf
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr4
|
2021-07-24 20:42:23 +00:00
|
|
|
|
|
2016-09-23 15:19:22 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2019-06-24 15:32:22 +00:00
|
|
|
|
K.ReadDir.ADD. ldx #1 filename="1."
|
2016-10-14 06:23:05 +00:00
|
|
|
|
.HS 2C bit abs
|
2018-06-21 15:12:10 +00:00
|
|
|
|
K.ReadDir.ADD..
|
2016-10-14 06:23:05 +00:00
|
|
|
|
ldx #2 filename="2.."
|
2016-10-14 15:39:49 +00:00
|
|
|
|
lda #'.'
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2018-06-21 15:12:10 +00:00
|
|
|
|
.1 jsr K.ReadDir.AddToBuf Add X dot(s)
|
2016-10-14 06:23:05 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2019-12-02 07:09:58 +00:00
|
|
|
|
|
2017-08-24 15:29:22 +00:00
|
|
|
|
txa
|
2020-02-16 20:45:16 +00:00
|
|
|
|
jmp K.ReadDir.AddToBuf Add Ending 0
|
2017-08-25 15:02:16 +00:00
|
|
|
|
*--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
K.ReadDir.AddFNToBuf
|
2020-07-23 10:18:11 +00:00
|
|
|
|
ldy #$1D version/min_version for lowercase bitmap
|
2017-06-21 15:46:43 +00:00
|
|
|
|
lda (ZPPtr3),y check bxxxxxxx.xxxxxxxx...
|
|
|
|
|
bpl .7 not set, no lowercase bitmap present
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
pha
|
2020-07-23 10:18:11 +00:00
|
|
|
|
dey
|
2017-06-21 15:46:43 +00:00
|
|
|
|
lda (ZPPtr3),y
|
|
|
|
|
pha
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
lda #$1
|
|
|
|
|
sta .2+1
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
ldy #15
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
.1 pla
|
|
|
|
|
.2 bit #$ff
|
|
|
|
|
pha
|
|
|
|
|
beq .3
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
lda (ZPPtr3),y
|
2020-07-13 19:29:31 +00:00
|
|
|
|
ora #$20 convert a-z to A-Z adding from $4x to $6x
|
2017-06-21 15:46:43 +00:00
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
|
|
|
|
|
.3 asl .2+1
|
|
|
|
|
bne .4
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
rol .2+1
|
|
|
|
|
pla
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
.4 dey
|
|
|
|
|
bne .1
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-06-21 15:46:43 +00:00
|
|
|
|
pla
|
|
|
|
|
.7 lda (ZPPtr3)
|
2016-09-22 15:46:01 +00:00
|
|
|
|
and #$0F get filename len
|
|
|
|
|
tax
|
|
|
|
|
ldy #1
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
.8 lda (ZPPtr3),y
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.ReadDir.AddToBuf
|
2016-09-22 15:46:01 +00:00
|
|
|
|
iny
|
|
|
|
|
dex
|
2017-06-21 15:46:43 +00:00
|
|
|
|
bne .8
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2017-08-24 15:29:22 +00:00
|
|
|
|
txa
|
2019-06-24 15:32:22 +00:00
|
|
|
|
* jsr K.ReadDir.AddToBuf
|
2017-08-24 15:29:22 +00:00
|
|
|
|
|
2019-06-24 15:32:22 +00:00
|
|
|
|
* rts
|
2016-09-22 15:46:01 +00:00
|
|
|
|
*--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
K.ReadDir.AddToBuf
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr4)
|
|
|
|
|
inc ZPPtr4
|
2016-09-20 06:17:20 +00:00
|
|
|
|
bne .8
|
2021-07-28 16:50:59 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr4+1
|
2021-07-28 16:50:59 +00:00
|
|
|
|
|
2016-09-20 06:17:20 +00:00
|
|
|
|
.8 rts
|
2020-02-16 20:45:16 +00:00
|
|
|
|
*--------------------------------------
|
2020-07-13 19:29:31 +00:00
|
|
|
|
K.ReadDir.AddStatACL
|
|
|
|
|
jsr FS.DirEnt2Stat
|
|
|
|
|
|
|
|
|
|
ldy #S.FD.DIR.UID
|
|
|
|
|
ldx #S.STAT.UID
|
|
|
|
|
|
|
|
|
|
.1 lda (pFD),y
|
|
|
|
|
sta K.S.STAT,x
|
|
|
|
|
iny
|
|
|
|
|
inx
|
|
|
|
|
cpx #S.STAT.GID+2
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
ldy #S.FD.DIR.MODE+1
|
|
|
|
|
ldx #1
|
2020-12-15 13:23:22 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
.2 lda (pFD),y
|
|
|
|
|
ora K.S.STAT+S.STAT.MODE,x
|
|
|
|
|
sta K.S.STAT+S.STAT.MODE,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
2020-02-16 20:45:16 +00:00
|
|
|
|
K.ReadDir.AddStat
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 lda K.S.STAT,y
|
|
|
|
|
jsr K.ReadDir.AddToBuf
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.STAT
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
rts
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*/-------------------------------------
|
2018-06-22 06:24:35 +00:00
|
|
|
|
* # CloseDir
|
2018-07-20 11:51:08 +00:00
|
|
|
|
* ## C
|
|
|
|
|
* `void closedir(hDIR);`
|
|
|
|
|
* ## ASM
|
|
|
|
|
* `lda hDIR`
|
|
|
|
|
* `>SYSCALL closedir`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2020-07-13 19:29:31 +00:00
|
|
|
|
* none, always succeed.
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*\-------------------------------------
|
2018-09-06 15:36:44 +00:00
|
|
|
|
*K.CloseDir .EQ K.FClose
|
2016-09-05 16:00:11 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-24 15:42:33 +00:00
|
|
|
|
MAN
|
2020-12-15 13:23:22 +00:00
|
|
|
|
SAVE usr/src/sys/kernel.s.dirent
|
|
|
|
|
LOAD usr/src/sys/kernel.s
|
2016-08-24 15:42:33 +00:00
|
|
|
|
ASM
|