2016-10-18 06:26:24 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2016-10-18 06:26:24 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2017-02-24 16:34:02 +00:00
|
|
|
|
X.MAX.RECURSE .EQ 8
|
|
|
|
|
*--------------------------------------
|
2017-09-22 15:25:21 +00:00
|
|
|
|
* Uses: (pData)
|
|
|
|
|
* hDIRs .BS X.MAX.RECURSE+1
|
|
|
|
|
* hDIRENTs .BS X.MAX.RECURSE+1
|
|
|
|
|
* Index .BS 1
|
|
|
|
|
* hSrcBasePath .BS 1
|
|
|
|
|
* hDstBasePath .BS 1 (optional)
|
|
|
|
|
* STAT .BS S.STAT
|
|
|
|
|
*--------------------------------------
|
2017-10-03 15:33:30 +00:00
|
|
|
|
InitSrcDirYA >SYSCALL RealPath.YA
|
2016-10-20 16:04:35 +00:00
|
|
|
|
bcc .10
|
|
|
|
|
rts
|
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
.10 >STYA ZPPtr1
|
|
|
|
|
txa
|
|
|
|
|
>STA.G hFullPath
|
2017-09-28 15:39:12 +00:00
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
2017-10-03 15:33:30 +00:00
|
|
|
|
* beq .5 we have '/'
|
|
|
|
|
bne .55
|
|
|
|
|
jmp .5
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
.55 >PUSHEA.G STAT
|
2016-10-19 15:47:53 +00:00
|
|
|
|
>PUSHW ZPPtr1
|
2017-02-24 16:34:02 +00:00
|
|
|
|
>SYSCALL Stat
|
2017-09-22 15:25:21 +00:00
|
|
|
|
bcs .1 File/DIR does not exists, go extract pattern
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
>LDA.G STAT+S.STAT.P.TYPE
|
2016-10-19 15:47:53 +00:00
|
|
|
|
cmp #$0f
|
2017-09-22 15:25:21 +00:00
|
|
|
|
bne .4 TYPE not a DIR, extract....
|
|
|
|
|
beq .5 TYPE=DIR, do not extract pattern
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
.1 ldy #0 TYPE is not DIR, check if wc
|
2017-09-21 15:29:45 +00:00
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
.11 iny
|
2017-09-21 15:29:45 +00:00
|
|
|
|
lda (ZPPtr1),y Get Src Path Len
|
2017-10-03 15:33:30 +00:00
|
|
|
|
bne .11
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
dey
|
2017-09-22 15:25:21 +00:00
|
|
|
|
|
2017-07-05 14:45:19 +00:00
|
|
|
|
ldx #0 Init Wildcard count
|
|
|
|
|
|
2016-10-19 15:47:53 +00:00
|
|
|
|
.2 lda (ZPPtr1),y search backward for a /
|
|
|
|
|
cmp #'/'
|
|
|
|
|
beq .3
|
2017-09-22 15:25:21 +00:00
|
|
|
|
|
2017-07-05 14:45:19 +00:00
|
|
|
|
cmp #'?' Test if some wildcard chars....
|
|
|
|
|
beq .21
|
|
|
|
|
cmp #'*'
|
|
|
|
|
bne .22
|
|
|
|
|
|
|
|
|
|
.21 inx inc wildcard count
|
|
|
|
|
.22 dey
|
2016-10-19 15:47:53 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
2017-09-22 15:25:21 +00:00
|
|
|
|
.3 txa
|
|
|
|
|
beq .91 no wc, file not found....
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2017-09-22 15:25:21 +00:00
|
|
|
|
.4 ldy #0
|
|
|
|
|
|
|
|
|
|
.41 iny Search end of string.....
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .41
|
2017-07-05 14:45:19 +00:00
|
|
|
|
|
2017-09-22 15:25:21 +00:00
|
|
|
|
lda #'/'
|
|
|
|
|
|
|
|
|
|
.42 dey
|
|
|
|
|
cmp (ZPPtr1),y Search backward /
|
|
|
|
|
bne .42
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
|
|
|
|
tya
|
2017-10-03 15:33:30 +00:00
|
|
|
|
sec +1 to skip '/'
|
2017-09-21 15:29:45 +00:00
|
|
|
|
adc ZPPtr1
|
2017-09-22 15:25:21 +00:00
|
|
|
|
sta ZPPtr2
|
2017-09-21 15:29:45 +00:00
|
|
|
|
tay
|
|
|
|
|
lda ZPPtr1+1
|
|
|
|
|
adc #0
|
2017-09-22 15:25:21 +00:00
|
|
|
|
sta ZPPtr2+1
|
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
>SYSCALL Newstr.YA
|
2016-10-19 15:47:53 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
txa
|
2017-09-22 15:25:21 +00:00
|
|
|
|
>STA.G hFilter
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr2)
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2017-06-28 14:34:11 +00:00
|
|
|
|
.5 >LDYAI 256
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMem.YA Get a 256 buffer to store BasePath
|
2016-10-19 15:47:53 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
txa
|
2017-09-21 15:29:45 +00:00
|
|
|
|
>STA.G hSrcBasePath
|
2017-07-05 14:45:19 +00:00
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.6 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
sta (ZPPtr2),y
|
|
|
|
|
bne .6
|
|
|
|
|
|
2017-07-05 14:45:19 +00:00
|
|
|
|
>LDYA ZPPtr2
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL OpenDir.YA
|
2016-10-26 20:51:06 +00:00
|
|
|
|
|
2016-10-19 15:47:53 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
ldy #hDIRs
|
2016-10-28 09:37:57 +00:00
|
|
|
|
sta (pData),y set hDIRs[0] = Src Hdir
|
2016-10-20 16:04:35 +00:00
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
ldy #index
|
|
|
|
|
lda #1
|
2016-10-28 09:37:57 +00:00
|
|
|
|
sta (pData),y index=hDIRs[0]
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
|
|
|
|
jsr .9 Cleanup
|
|
|
|
|
|
|
|
|
|
clc
|
2016-10-20 16:04:35 +00:00
|
|
|
|
rts
|
2017-07-05 14:45:19 +00:00
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
.91 lda #MLI.E.FNOTFND
|
2017-09-22 15:25:21 +00:00
|
|
|
|
|
2016-10-19 15:47:53 +00:00
|
|
|
|
.9 pha
|
2017-09-22 15:25:21 +00:00
|
|
|
|
>LDA.G hFullPath
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2016-10-19 15:47:53 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
2016-10-28 09:37:57 +00:00
|
|
|
|
InitSrcDirYA.RTS
|
2016-10-19 15:47:53 +00:00
|
|
|
|
rts
|
2017-02-23 16:43:42 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DO X.COPY.TO.DEST=1
|
2017-10-04 15:12:03 +00:00
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
InitDstDirYA >SYSCALL RealPath.YA
|
2017-07-05 14:45:19 +00:00
|
|
|
|
bcs InitSrcDirYA.RTS
|
|
|
|
|
|
2017-02-23 16:43:42 +00:00
|
|
|
|
>STYA ZPPtr1
|
2017-10-03 15:33:30 +00:00
|
|
|
|
txa
|
|
|
|
|
>STA.G hFullPath
|
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>PUSHEA.G STAT
|
2017-06-26 15:28:18 +00:00
|
|
|
|
>PUSHW ZPPtr1
|
|
|
|
|
>SYSCALL Stat
|
|
|
|
|
bcs .1 File/DIR does not exists, go extract DstFileName
|
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
>LDA.G STAT+S.STAT.P.TYPE
|
2017-06-26 15:28:18 +00:00
|
|
|
|
cmp #$0f
|
|
|
|
|
beq .5 Dst is a directory...no destfilename
|
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
.1 ldy #0
|
|
|
|
|
|
|
|
|
|
.11 iny Search end of string.....
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .11
|
2017-06-26 15:28:18 +00:00
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
lda #'/'
|
2017-06-26 15:28:18 +00:00
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
.2 dey
|
|
|
|
|
cmp (ZPPtr1),y Search backward /
|
|
|
|
|
bne .2
|
2017-06-26 15:28:18 +00:00
|
|
|
|
|
|
|
|
|
tya
|
2017-10-03 15:33:30 +00:00
|
|
|
|
sec +1 to skip '/'
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr2
|
|
|
|
|
tay
|
|
|
|
|
lda ZPPtr1+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPtr2+1
|
|
|
|
|
|
|
|
|
|
>SYSCALL NewStr.YA
|
2017-06-26 15:28:18 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
txa
|
2017-10-03 15:33:30 +00:00
|
|
|
|
>STA.G hDstFileName
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr2)
|
2017-06-26 15:28:18 +00:00
|
|
|
|
|
2017-06-28 14:34:11 +00:00
|
|
|
|
.5 >LDYAI 256
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMem.YA Get a 256 buffer to store DstBasePath
|
2017-02-23 16:43:42 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
txa
|
2017-10-03 15:33:30 +00:00
|
|
|
|
>STA.G hDstBasePath
|
2017-02-23 16:43:42 +00:00
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
ldy #$ff
|
2017-02-23 16:43:42 +00:00
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
.6 iny
|
|
|
|
|
lda (ZPPtr1),y
|
2017-02-23 16:43:42 +00:00
|
|
|
|
sta (ZPPtr2),y
|
|
|
|
|
bne .6
|
|
|
|
|
|
2017-10-03 15:33:30 +00:00
|
|
|
|
dey
|
|
|
|
|
|
2017-02-23 16:43:42 +00:00
|
|
|
|
lda #'/'
|
|
|
|
|
cmp (ZPPtr2),y
|
|
|
|
|
beq .7
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPPtr2),y
|
2017-10-03 15:33:30 +00:00
|
|
|
|
iny
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr2),y
|
2017-02-23 16:43:42 +00:00
|
|
|
|
|
|
|
|
|
.7 jsr .9 Cleanup
|
2017-06-26 15:28:18 +00:00
|
|
|
|
|
2017-02-23 16:43:42 +00:00
|
|
|
|
clc
|
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
.9 pha
|
2017-10-03 15:33:30 +00:00
|
|
|
|
>LDA.G hFullPath
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-02-23 16:43:42 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.FIN
|
2016-10-19 15:47:53 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-26 18:34:00 +00:00
|
|
|
|
GetNextEntry jsr GetEntry
|
|
|
|
|
bcs .9
|
2016-10-25 06:58:15 +00:00
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.10 iny
|
|
|
|
|
lda (ZPFileName),y Save actual file len for setting up
|
|
|
|
|
bne .10
|
|
|
|
|
phy new offset later
|
2017-02-26 18:34:00 +00:00
|
|
|
|
|
|
|
|
|
lda ZPFileStat
|
2016-10-26 20:51:06 +00:00
|
|
|
|
clc
|
2017-02-26 18:34:00 +00:00
|
|
|
|
adc #S.STAT
|
|
|
|
|
sta ZPFileName
|
2016-10-25 06:58:15 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
lda ZPFileStat+1
|
|
|
|
|
adc /S.STAT
|
|
|
|
|
sta ZPFileName+1 Make nDIRENTs[i] point to next DIRENT
|
|
|
|
|
|
|
|
|
|
lda (ZPFileName) are we at end of this buffer ?
|
|
|
|
|
beq .1 yes, go read next one ...
|
2016-10-25 06:58:15 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
sec
|
|
|
|
|
adc ZPFileName
|
|
|
|
|
sta ZPFileStat
|
|
|
|
|
lda ZPFileName+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPFileStat+1
|
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
ldy #index
|
|
|
|
|
lda (pData),y
|
2017-02-26 18:34:00 +00:00
|
|
|
|
asl
|
2016-10-26 20:51:06 +00:00
|
|
|
|
clc
|
2017-02-26 18:34:00 +00:00
|
|
|
|
adc #oDIRENTs-1
|
2016-10-26 20:51:06 +00:00
|
|
|
|
tay
|
2017-02-26 18:34:00 +00:00
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
pla Get back previous file len
|
2016-10-25 06:58:15 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
sec
|
|
|
|
|
adc (pData),y
|
|
|
|
|
sta (pData),y
|
|
|
|
|
iny
|
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
lda #0
|
2017-02-26 18:34:00 +00:00
|
|
|
|
adc (pData),y
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
|
|
|
|
|
lda #S.STAT
|
|
|
|
|
clc
|
|
|
|
|
adc (pData),y
|
2016-10-26 20:51:06 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
iny
|
2017-02-26 18:34:00 +00:00
|
|
|
|
|
|
|
|
|
lda /S.STAT
|
|
|
|
|
adc (pData),y
|
2016-10-26 20:51:06 +00:00
|
|
|
|
sta (pData),y
|
2017-02-26 18:34:00 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
.1 pla
|
|
|
|
|
jsr GetEntry.ReadDir
|
2017-02-26 18:34:00 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
lda (ZPFileName)
|
|
|
|
|
beq .99
|
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.2 iny
|
|
|
|
|
lda (ZPFileName),y
|
|
|
|
|
bne .2
|
|
|
|
|
tya
|
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
sec
|
|
|
|
|
adc ZPFileName
|
|
|
|
|
sta ZPFileStat
|
|
|
|
|
lda ZPFileName+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPFileStat+1
|
2017-09-21 15:29:45 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.99 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
GetEntry ldy #index
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
|
|
|
|
adc #hDIRENTs-1
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bne .1 we have a buffer to scan
|
|
|
|
|
|
|
|
|
|
jsr GetEntry.ReadDir First run, get first block
|
|
|
|
|
bcs .9 ZPFileName = start of buffer
|
2016-10-26 20:51:06 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
lda (ZPFileName) Empty !!!
|
|
|
|
|
bne .8
|
2016-10-26 20:51:06 +00:00
|
|
|
|
|
2017-04-03 15:35:03 +00:00
|
|
|
|
* txa
|
2017-08-25 06:37:21 +00:00
|
|
|
|
* >SYSCALL FreeMem.A
|
2017-02-26 18:34:00 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
.1 >SYSCALL GetMemPtr.A
|
2017-02-24 16:34:02 +00:00
|
|
|
|
>STYA ZPFileName
|
2016-10-26 20:51:06 +00:00
|
|
|
|
|
|
|
|
|
ldy #index
|
|
|
|
|
lda (pData),y
|
|
|
|
|
asl
|
2017-02-26 18:34:00 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #oDIRENTs-1
|
2016-10-26 20:51:06 +00:00
|
|
|
|
tay
|
|
|
|
|
|
2017-02-24 16:34:02 +00:00
|
|
|
|
lda ZPFileName
|
|
|
|
|
clc
|
2016-10-26 20:51:06 +00:00
|
|
|
|
adc (pData),y
|
2017-02-24 16:34:02 +00:00
|
|
|
|
sta ZPFileName
|
2016-10-26 20:51:06 +00:00
|
|
|
|
|
|
|
|
|
iny
|
2017-02-24 16:34:02 +00:00
|
|
|
|
lda ZPFileName+1
|
2016-10-26 20:51:06 +00:00
|
|
|
|
adc (pData),y
|
2017-02-26 18:34:00 +00:00
|
|
|
|
sta ZPFileName+1 ZPFileName=ZPFileName+oDIRENT
|
2016-10-26 20:51:06 +00:00
|
|
|
|
|
2017-09-22 15:25:21 +00:00
|
|
|
|
.8 ldy #0
|
|
|
|
|
|
|
|
|
|
.81 iny
|
|
|
|
|
lda (ZPFileName),y
|
|
|
|
|
bne .81
|
|
|
|
|
tya
|
2017-02-26 18:34:00 +00:00
|
|
|
|
sec
|
2017-09-22 15:25:21 +00:00
|
|
|
|
adc ZPFileName
|
2017-02-26 18:34:00 +00:00
|
|
|
|
sta ZPFileStat
|
|
|
|
|
lda ZPFileName+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPFileStat+1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
GetEntry.ReadDir
|
2016-10-26 20:51:06 +00:00
|
|
|
|
ldy #index
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
|
|
|
|
adc #hDIRENTs-1
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
2017-02-26 18:34:00 +00:00
|
|
|
|
beq .1
|
2016-10-26 20:51:06 +00:00
|
|
|
|
pha
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y reset hDIRENT
|
|
|
|
|
pla
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A discard previous hDIRENT
|
2016-10-26 20:51:06 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
.1 ldy #index
|
2016-10-26 20:51:06 +00:00
|
|
|
|
lda (pData),y
|
2017-02-26 18:34:00 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #hDIRs-1
|
2016-10-26 20:51:06 +00:00
|
|
|
|
tay
|
2017-02-26 18:34:00 +00:00
|
|
|
|
lda (pData),y
|
2016-10-28 09:37:57 +00:00
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL ReadDir.A
|
2017-02-26 18:34:00 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
>STYA ZPFileName
|
2016-10-28 09:37:57 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
ldy #index
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
|
|
|
|
adc #hDIRENTs-1
|
|
|
|
|
tay
|
|
|
|
|
txa get hDIRENT in A
|
2016-10-26 20:51:06 +00:00
|
|
|
|
sta (pData),y
|
2017-02-24 16:34:02 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
ldy #index
|
2016-10-26 20:51:06 +00:00
|
|
|
|
lda (pData),y
|
2017-02-26 18:34:00 +00:00
|
|
|
|
asl
|
|
|
|
|
clc
|
|
|
|
|
adc #oDIRENTs-1 and reset offset for this buffer
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
iny
|
2016-10-26 20:51:06 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
2017-02-26 18:34:00 +00:00
|
|
|
|
.9 rts
|
2016-10-25 06:58:15 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-20 16:04:35 +00:00
|
|
|
|
EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat
|
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
ldy #index
|
2016-10-20 16:04:35 +00:00
|
|
|
|
lda (pData),y
|
2016-11-08 16:56:05 +00:00
|
|
|
|
cmp #X.MAX.RECURSE
|
2016-10-26 20:51:06 +00:00
|
|
|
|
beq .9
|
2016-10-20 16:04:35 +00:00
|
|
|
|
|
2016-11-08 16:56:05 +00:00
|
|
|
|
ldy #hSrcBasePath
|
2016-11-13 21:03:31 +00:00
|
|
|
|
jsr EnterSubDirYA.1
|
2016-10-26 20:51:06 +00:00
|
|
|
|
|
2016-10-20 16:04:35 +00:00
|
|
|
|
>LDYA ZPPtr1
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL OpenDir.YA
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
bcs .9
|
2016-10-20 16:04:35 +00:00
|
|
|
|
pha
|
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
ldy #index
|
2016-10-20 16:04:35 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
2016-10-26 20:51:06 +00:00
|
|
|
|
tax
|
|
|
|
|
* clc from BCS
|
|
|
|
|
adc #hDIRs-1
|
2016-10-20 16:04:35 +00:00
|
|
|
|
tay
|
|
|
|
|
pla
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
txa make sure hDIRENTs[i] is closed
|
|
|
|
|
adc #hDIRENTs-1
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2017-02-21 17:01:30 +00:00
|
|
|
|
.DO X.COPY.TO.DEST=1
|
2016-11-13 21:03:31 +00:00
|
|
|
|
ldy #hDstBasePath
|
|
|
|
|
jsr EnterSubDirYA.1
|
|
|
|
|
.FIN
|
2017-02-26 18:34:00 +00:00
|
|
|
|
|
|
|
|
|
clc
|
2016-10-26 20:51:06 +00:00
|
|
|
|
.9 rts
|
2016-11-13 21:03:31 +00:00
|
|
|
|
|
|
|
|
|
EnterSubDirYA.1 lda (pData),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2016-11-13 21:03:31 +00:00
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1 save full path
|
|
|
|
|
|
|
|
|
|
>PUSHW ZPPtr2
|
|
|
|
|
>PUSHW ZPPtr1
|
2017-09-21 15:29:45 +00:00
|
|
|
|
>SYSCALL StrCat
|
2016-11-13 21:03:31 +00:00
|
|
|
|
|
2017-09-22 15:25:21 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .1
|
|
|
|
|
|
2016-11-13 21:03:31 +00:00
|
|
|
|
lda #'/'
|
|
|
|
|
sta (ZPPtr1),y
|
2017-09-22 15:25:21 +00:00
|
|
|
|
iny
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
2016-11-13 21:03:31 +00:00
|
|
|
|
rts
|
2016-10-19 15:47:53 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-26 20:51:06 +00:00
|
|
|
|
LeaveSubDir ldy #index
|
2016-10-19 15:47:53 +00:00
|
|
|
|
lda (pData),y
|
2016-10-26 20:51:06 +00:00
|
|
|
|
beq .9
|
2017-02-23 16:43:42 +00:00
|
|
|
|
|
2017-02-26 18:34:00 +00:00
|
|
|
|
ldy #index
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
|
|
|
|
adc #hDIRENTs-1
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
pla
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-02-26 18:34:00 +00:00
|
|
|
|
|
|
|
|
|
.1 ldy #index
|
|
|
|
|
lda (pData),y
|
2016-10-26 20:51:06 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #hDIRs-1
|
2016-10-20 16:04:35 +00:00
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
2017-02-26 18:34:00 +00:00
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
pha
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
pla
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL CloseDir.A
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
ldy #index
|
|
|
|
|
lda (pData),y
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
2016-11-01 21:37:12 +00:00
|
|
|
|
bne .8
|
|
|
|
|
|
2016-11-08 16:56:05 +00:00
|
|
|
|
ldy #hSrcBasePath
|
2016-11-01 21:37:12 +00:00
|
|
|
|
lda (pData),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-02-23 16:43:42 +00:00
|
|
|
|
|
2017-02-27 14:18:03 +00:00
|
|
|
|
.DO X.COPY.TO.DEST=1
|
|
|
|
|
ldy #hDstBasePath
|
|
|
|
|
lda (pData),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-02-27 14:18:03 +00:00
|
|
|
|
.FIN
|
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2016-11-01 21:37:12 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2016-10-30 18:19:43 +00:00
|
|
|
|
*--------------------------------------
|
2017-02-21 17:01:30 +00:00
|
|
|
|
BasePath.. .DO X.COPY.TO.DEST=1
|
2017-10-04 15:12:03 +00:00
|
|
|
|
|
2016-11-13 21:03:31 +00:00
|
|
|
|
ldy #hDstBasePath
|
|
|
|
|
jsr BasePath..1
|
2017-10-04 15:12:03 +00:00
|
|
|
|
|
2016-11-13 21:03:31 +00:00
|
|
|
|
.FIN
|
2017-02-26 18:34:00 +00:00
|
|
|
|
|
2016-11-13 21:03:31 +00:00
|
|
|
|
ldy #hSrcBasePath
|
|
|
|
|
|
|
|
|
|
BasePath..1 lda (pData),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2016-10-30 18:19:43 +00:00
|
|
|
|
|
2016-10-20 16:04:35 +00:00
|
|
|
|
>STYA ZPPtr1 save full path
|
|
|
|
|
|
2017-09-22 15:25:21 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPPtr1),y get len
|
|
|
|
|
bne .1
|
|
|
|
|
|
2017-10-04 15:12:03 +00:00
|
|
|
|
dey discard ending /
|
2016-10-20 16:04:35 +00:00
|
|
|
|
|
2017-09-22 15:25:21 +00:00
|
|
|
|
.2 dey
|
2016-10-20 16:04:35 +00:00
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'/'
|
2017-09-22 15:25:21 +00:00
|
|
|
|
bne .2
|
2016-10-20 16:04:35 +00:00
|
|
|
|
|
2017-09-22 15:25:21 +00:00
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr1),y cut DIR2/ from /dir1/DIR2/
|
2016-10-19 15:47:53 +00:00
|
|
|
|
|
2016-10-26 20:51:06 +00:00
|
|
|
|
rts
|
2016-10-18 06:26:24 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/BIN/X.FILEENUM.S
|
2017-09-21 15:29:45 +00:00
|
|
|
|
LOAD /A2OSX.SRC/BIN/LS.S
|
|
|
|
|
ASM
|