2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* PUBLIC
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.CheckPrefixA jsr S.GetMemPtrA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.CheckPrefixYA >STYA MLICALL.PARAMS+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
lda (ZPQuickPtr1)
|
|
|
|
|
beq .98
|
|
|
|
|
tax
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .98
|
|
|
|
|
cpx #1 "/" allowed for listing online volumes
|
|
|
|
|
beq .8
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>MLICALL MLIGETFILEINFO
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .98 No, invalid path...
|
|
|
|
|
lda MLICALL.PARAMS+4 Check file type
|
|
|
|
|
cmp #$0F Directory?
|
|
|
|
|
bne .98
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
.98 lda #SYSMGR.ERRIDIR
|
|
|
|
|
.99 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.FileSearch
|
|
|
|
|
* in :
|
|
|
|
|
* PULLB = hMem to Search Path (PSTRING) %LIB%;/SYS/SLIB
|
|
|
|
|
* PULLB = hMem to File Name (PSTRING)
|
|
|
|
|
* out :
|
|
|
|
|
* A = hMem of FilePath (PSTRING)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.FileSearch >PULLA Get Search path
|
|
|
|
|
jsr S.ExpandPStrA Expand it
|
|
|
|
|
bcc .10
|
|
|
|
|
pha save error code
|
|
|
|
|
>PULLA discard file name
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.10 sta S.FileSearch.hSrch Store Expanded path list to search
|
|
|
|
|
|
|
|
|
|
>PULLB S.FileSearch.hFile Store Filename
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sta S.FileSearch.Idx Start At Token 1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.1 >PUSHB S.FileSearch.hSrch push expanded path list
|
|
|
|
|
>PUSHBI $3B Push SEP=';'
|
|
|
|
|
>PUSHB S.FileSearch.Idx Push Token IDX
|
|
|
|
|
jsr S.PStrGetTkn Get token in A
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .98
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sta S.FileSearch.hPath Store Token path
|
|
|
|
|
>PUSHB S.FileSearch.hFile push filename
|
|
|
|
|
>PUSHB S.FileSearch.hPath Push Token path
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.PStrCat
|
|
|
|
|
bcs .97
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sta S.FileSearch.hFull Store Full path (Token Path+filename)
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.MLIGetFileInfoA
|
|
|
|
|
bcc .8
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda S.FileSearch.hFull Discard this Full Path
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda S.FileSearch.hPath Discard Token path
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
inc S.FileSearch.Idx Try next Token
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .1
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq .98 go to discard Expanded path list
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.97 lda S.FileSearch.hPath Discard Token path
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.98 lda S.FileSearch.hSrch Discard Expanded hSrch list
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
lda #SYSMGR.ERRFNF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.8 jsr .97 Dicard all except Full Path
|
|
|
|
|
lda S.FileSearch.hFull
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
S.FileSearch.hSrch .BS 1
|
|
|
|
|
S.FileSearch.hFile .BS 1
|
|
|
|
|
S.FileSearch.Idx .BS 1
|
|
|
|
|
S.FileSearch.hPath .BS 1
|
|
|
|
|
S.FileSearch.hFull .BS 1
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* S.LoadFileA
|
|
|
|
|
* in :
|
|
|
|
|
* A = hMem of FilePath (PSTRING)
|
|
|
|
|
* out :
|
|
|
|
|
* Y,A = File Length
|
|
|
|
|
* X = hMem of Loaded File
|
|
|
|
|
*--------------------------------------
|
2016-01-09 22:40:19 +00:00
|
|
|
|
S.LoadFileA jsr S.GetMemPtrA
|
|
|
|
|
S.LoadFileYA jsr S.ExpandPStrYA
|
|
|
|
|
sta S.LoadFile.hExp
|
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
jsr S.MLIOpenYA
|
|
|
|
|
bcc .10
|
|
|
|
|
jmp .99
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-01-09 22:40:19 +00:00
|
|
|
|
.10 sta S.LoadFile.hRef save ref_num
|
|
|
|
|
stx S.LoadFile.hBuf save Prodos Buffer for freemem
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.MLIGetEOFA
|
|
|
|
|
bcs .98
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
phx Larger than 64k?
|
|
|
|
|
plx
|
|
|
|
|
beq .1 File too big!!!!
|
|
|
|
|
lda #SYSMGR.ERRFTB
|
|
|
|
|
bra .98
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-01-09 22:40:19 +00:00
|
|
|
|
.1 >STYA S.LoadFile.Len save Length
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>PUSHYA Push Length for S.GetMem
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
jsr S.GetMem
|
|
|
|
|
bcs .98
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-01-09 22:40:19 +00:00
|
|
|
|
phy save Ptr
|
|
|
|
|
pha
|
|
|
|
|
stx S.LoadFile.hMem save Segment hMem
|
|
|
|
|
>PUSHW S.LoadFile.Len Push Length for S.MLIRead
|
|
|
|
|
pla restore Dest PTR
|
|
|
|
|
ply
|
|
|
|
|
>PUSHYA and push for S.MLIRead
|
|
|
|
|
>PUSHB S.LoadFile.hRef Push ref_num
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.MLIRead
|
|
|
|
|
bcs .97
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-01-09 22:40:19 +00:00
|
|
|
|
lda S.LoadFile.hRef
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.MLICloseA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-01-09 22:40:19 +00:00
|
|
|
|
lda S.LoadFile.hBuf
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA Discard ProDOS IO Buffer
|
2016-03-13 21:47:19 +00:00
|
|
|
|
|
|
|
|
|
lda S.LoadFile.hExp Discard Expanded String
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
2016-01-09 22:40:19 +00:00
|
|
|
|
>LDYA S.LoadFile.Len Return File Length...
|
|
|
|
|
ldx S.LoadFile.hMem ...and hMem to Caller
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.97 pha
|
2016-01-09 22:40:19 +00:00
|
|
|
|
lda S.LoadFile.hMem
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA freemem because of failed load
|
|
|
|
|
pla
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.98 pha
|
2016-01-09 22:40:19 +00:00
|
|
|
|
lda S.LoadFile.hRef
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.MLICloseA
|
2016-01-09 22:40:19 +00:00
|
|
|
|
lda S.LoadFile.hBuf
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA ProDOS IO Buffer
|
|
|
|
|
pla
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-01-09 22:40:19 +00:00
|
|
|
|
.99 pha
|
|
|
|
|
lda S.LoadFile.hExp
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
sec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-01-09 22:40:19 +00:00
|
|
|
|
S.LoadFile.hRef .BS 1
|
|
|
|
|
S.LoadFile.hBuf .BS 1
|
|
|
|
|
S.LoadFile.hExp .BS 1
|
|
|
|
|
S.LoadFile.hMem .BS 1
|
|
|
|
|
S.LoadFile.Len .BS 2
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* S.ListDirInitA
|
|
|
|
|
* in :
|
|
|
|
|
* A = PATH (PSTR) /DIR,/DIR/*.?s
|
|
|
|
|
* out :
|
|
|
|
|
* A = hMem of Dir Listing
|
|
|
|
|
*--------------------------------------
|
2015-08-05 20:38:05 +00:00
|
|
|
|
S.ListDirInitA
|
|
|
|
|
* sta R.AL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
stz TmpFileName Reset File.Pattern
|
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
>STYA R.BX Store path
|
2015-08-05 20:38:05 +00:00
|
|
|
|
* jsr S.CheckPrefixYA is it a existing directory?
|
|
|
|
|
* bcc .4 yes, continue with empty pattern
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
lda (R.BX) no, get pattern at end of full path
|
|
|
|
|
tay
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda (R.BX),y
|
|
|
|
|
cmp #'/'
|
|
|
|
|
beq .2
|
|
|
|
|
inx
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.2 stx TmpFileName
|
|
|
|
|
txa
|
|
|
|
|
beq .4
|
|
|
|
|
|
|
|
|
|
lda (R.BX)
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.3 lda (R.BX),y
|
|
|
|
|
sta TmpFileName,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
sta (R.BX) remove pattern from path
|
|
|
|
|
|
2015-08-05 20:38:05 +00:00
|
|
|
|
.4 >PUSHWI S.LISTDIR.SIZE get LISTDIR Struct
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>PUSHBI S.MEM.F.INIT0 reset all bytes
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.GetMem
|
|
|
|
|
bcs .99
|
|
|
|
|
stx R.AH
|
|
|
|
|
>STYA R.CX Store LISTDIR Struct
|
|
|
|
|
|
2015-08-05 20:38:05 +00:00
|
|
|
|
>LDYA R.BX
|
|
|
|
|
jsr S.NewPStrYA
|
|
|
|
|
bcs .99
|
|
|
|
|
ldy #S.LISTDIR.hPATH
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy TmpFileName
|
|
|
|
|
beq .5
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
jsr S.GetMem
|
|
|
|
|
bcs .98
|
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
ldy #S.LISTDIR.hPATTERN
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
|
|
|
|
|
ldy TmpFileName
|
|
|
|
|
.40 lda TmpFileName,y
|
|
|
|
|
sta (ZPQuickPtr1),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .40
|
|
|
|
|
|
|
|
|
|
.5 lda (R.BX)
|
|
|
|
|
cmp #1 length = 1 ? ('/')
|
|
|
|
|
bne .6
|
|
|
|
|
jsr S.ListDirInitAV
|
|
|
|
|
bcs .98
|
|
|
|
|
lda R.AH
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.6 jsr S.ListDirInitAD
|
|
|
|
|
bcs .98
|
|
|
|
|
lda R.AH
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.98 pha
|
|
|
|
|
lda R.AH Discard S.LISTDIR
|
|
|
|
|
jsr S.ListDirCloseA
|
|
|
|
|
pla
|
|
|
|
|
.99 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.ListDirInitAV >PUSHWI 256
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
jsr S.GetMem
|
|
|
|
|
bcs .99
|
|
|
|
|
>PUSHYA push buffer for online call
|
|
|
|
|
txa
|
|
|
|
|
sta (R.CX) save hONLINE buffer
|
|
|
|
|
>PUSHBI 0 All devices
|
|
|
|
|
jsr S.MLIOnline
|
|
|
|
|
bcs .98
|
|
|
|
|
ldy #S.LISTDIR.ONLINEPTR
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
* lda #0 make index point first Entry
|
|
|
|
|
* sta (R.CX),y
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
.98 lda (R.CX)
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
.99 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
S.ListDirInitAD
|
|
|
|
|
* lda #0
|
|
|
|
|
* sta (R.CX) reset hONLINE
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
>LDYA R.BX Open DIR
|
2015-06-03 18:30:57 +00:00
|
|
|
|
jsr S.MLIOpenYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
ldy #S.LISTDIR.REFNUM
|
|
|
|
|
sta (R.CX),y save ref_num
|
|
|
|
|
txa
|
|
|
|
|
ldy #S.LISTDIR.hIOBUF
|
|
|
|
|
sta (R.CX),y save ProDOS IO buffer hMem
|
|
|
|
|
|
|
|
|
|
>PUSHWI 512 get Read buffer
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
jsr S.GetMem
|
|
|
|
|
bcs .99
|
|
|
|
|
txa
|
|
|
|
|
ldy #S.LISTDIR.hREADBUF save Read Buffer hMem
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
jsr S.ListDirReadBlock
|
|
|
|
|
bcs .99
|
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
|
|
|
|
|
ldy #$23 get entry_length
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
ldy #S.LISTDIR.EL
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
|
|
|
|
|
ldy #$24 get entry_per_block
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
ldy #S.LISTDIR.EPB
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
|
|
|
|
|
ldy #$25 get File_count LO
|
|
|
|
|
lda (ZPQuickPtr1),y
|
2015-06-24 20:48:53 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #1 Add 1 for VOL/DIR Header
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.LISTDIR.FC
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
|
|
|
|
|
ldy #$26 get File_count HI
|
|
|
|
|
lda (ZPQuickPtr1),y
|
2015-06-24 20:48:53 +00:00
|
|
|
|
adc #0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.LISTDIR.FC+1
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* ldy #S.LISTDIR.FI
|
|
|
|
|
* lda #0
|
|
|
|
|
* sta (R.CX),y
|
|
|
|
|
* iny
|
|
|
|
|
* sta (R.CX),y set FI to $0000
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.DirListNextA
|
|
|
|
|
* A = S.LISTDIR hMEM
|
|
|
|
|
* out :
|
|
|
|
|
* A = hMem To Dir Entry
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.ListDirNextA jsr S.GetMemPtrA Get PTR to S.LISTDIR
|
|
|
|
|
>STYA R.CX
|
|
|
|
|
lda (R.CX) Online Data?
|
|
|
|
|
beq S.ListDirNextAD no,list files
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.ListDirNextAV jsr S.GetMemPtrA
|
|
|
|
|
>STYA ZPQuickPtr1 ZPQuickPtr1 = Online DATA
|
|
|
|
|
.10 ldy #S.LISTDIR.ONLINEPTR
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
cmp #16
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
dec
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
and #$0F
|
|
|
|
|
beq .10
|
|
|
|
|
|
|
|
|
|
sta TmpFileName
|
|
|
|
|
ldx #0
|
|
|
|
|
.1 iny
|
|
|
|
|
inx
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
sta TmpFileName,x
|
|
|
|
|
cpx TmpFileName
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>PUSHWI 16
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
jsr S.GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPQuickPtr2
|
|
|
|
|
|
|
|
|
|
ldy #15
|
|
|
|
|
.2 lda TmpFileName,y
|
|
|
|
|
sta (ZPQuickPtr2),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
lda (ZPQuickPtr2) Mark Record as "VOL"
|
|
|
|
|
ora #$C0
|
|
|
|
|
sta (ZPQuickPtr2)
|
|
|
|
|
|
|
|
|
|
txa Get back hMem of Volume.Name
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.ListDirNextAD stz R.DL Reset Return Record hMem
|
|
|
|
|
ldy #S.LISTDIR.FI File Index = File count ?
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
ldy #S.LISTDIR.FC
|
|
|
|
|
cmp (R.CX),y
|
|
|
|
|
bne .1
|
|
|
|
|
ldy #S.LISTDIR.FI+1
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
ldy #S.LISTDIR.FC+1
|
|
|
|
|
cmp (R.CX),y
|
|
|
|
|
bne .1
|
|
|
|
|
sec yes, exit no more file
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 ldy #S.LISTDIR.EIB Entry Index in block = Entry per block ?
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
ldy #S.LISTDIR.EPB
|
|
|
|
|
cmp (R.CX),y
|
|
|
|
|
bne .2
|
|
|
|
|
jsr S.ListDirReadBlock
|
|
|
|
|
bcc .3
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.2 ldy #S.LISTDIR.hREADBUF
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
.3 >STYA R.AX R.AX = READ BUFFER
|
|
|
|
|
ldy #S.LISTDIR.BLKPTR
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
clc
|
|
|
|
|
adc R.AX
|
|
|
|
|
sta R.AX
|
|
|
|
|
iny
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
adc R.AX+1
|
|
|
|
|
sta R.AX+1
|
|
|
|
|
|
|
|
|
|
lda (R.AX) Is is a deleted file ? (storage_type=0)
|
|
|
|
|
and #$F0
|
2015-06-03 18:30:57 +00:00
|
|
|
|
beq .5
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
cmp #$F0 Volume header ?
|
|
|
|
|
beq .30 yes, do not filter
|
|
|
|
|
cmp #$E0 Directory header ?
|
|
|
|
|
beq .30 yes, do not filter
|
|
|
|
|
|
|
|
|
|
ldy #S.LISTDIR.hPATTERN any filter ?
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
beq .30
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.GetMemPtrA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>PUSHYA push Filter PTR
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
lda (R.AX)
|
|
|
|
|
and #$0F
|
|
|
|
|
sta TmpFileName
|
|
|
|
|
tay
|
|
|
|
|
.31 lda (R.AX),y
|
|
|
|
|
sta TmpFileName,y
|
|
|
|
|
dey
|
|
|
|
|
bne .31
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>PUSHWI TmpFileName push Filename PTR
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.PStrMatchP
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .5 no match
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
.30 ldy #S.LISTDIR.EL Get Entry length
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
>PUSHYA Get an entry_length buffer
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
jsr S.GetMem
|
|
|
|
|
bcs .99
|
|
|
|
|
>STYA R.BX R.BX = DEST RECORD
|
|
|
|
|
stx R.DL
|
|
|
|
|
|
|
|
|
|
ldy #S.LISTDIR.EL
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
tay
|
|
|
|
|
dey
|
|
|
|
|
.4 lda (R.AX),y
|
|
|
|
|
sta (R.BX),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .4
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.5 ldy #S.LISTDIR.EIB Set ENTRY INDEX IN BLOCK +=1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda (R.CX),y
|
|
|
|
|
inc
|
|
|
|
|
sta (R.CX),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #S.LISTDIR.EL Set BLOCK PTR +=entry_length
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
ldy #S.LISTDIR.BLKPTR
|
|
|
|
|
clc
|
|
|
|
|
adc (R.CX),y
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
iny
|
|
|
|
|
lda (R.CX),y
|
2015-06-03 18:30:57 +00:00
|
|
|
|
adc #0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta (R.CX),y
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (R.AX)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
and #$E0 is storage_type = $F or $E ?
|
|
|
|
|
cmp #$E0 yes, do NOT increase FI
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
ldy #S.LISTDIR.FI Increase FILE INDEX
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
inc
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
bne .6
|
|
|
|
|
iny
|
|
|
|
|
lda (R.CX),y
|
|
|
|
|
inc
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
|
|
|
|
|
.6 lda R.DL
|
|
|
|
|
bne .8
|
|
|
|
|
jmp S.ListDirNextAD Nothing to return, start over for next file entry
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.99 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.DirListCloseA
|
|
|
|
|
* in :
|
|
|
|
|
* A = hS.LISTDIR
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.ListDirCloseA pha
|
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
ldy #S.LISTDIR.REFNUM
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .1
|
|
|
|
|
jsr S.MLICloseA
|
|
|
|
|
bcs * If Close Failed, we cannot free IOBUF
|
|
|
|
|
|
|
|
|
|
.1 ldy #S.LISTDIR.hIOBUF
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .2
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
|
|
|
|
.2 ldy #S.LISTDIR.hREADBUF
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .3
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.3 ldy #S.LISTDIR.hONLINE
|
|
|
|
|
lda (ZPQuickPtr1),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
beq .4
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
|
|
|
|
.4 ldy #S.LISTDIR.hPATTERN
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .5
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
2015-06-24 20:48:53 +00:00
|
|
|
|
.5 ldy #S.LISTDIR.hPATH
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .6
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
|
|
|
|
.6 pla
|
2015-03-14 21:48:35 +00:00
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* PRIVATE
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.ListDirReadBlock
|
|
|
|
|
* In :
|
|
|
|
|
* CX = LISTDIR
|
|
|
|
|
* Out :
|
|
|
|
|
* Y,A = READ BUFFER
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.ListDirReadBlock
|
|
|
|
|
ldy #S.LISTDIR.REFNUM
|
|
|
|
|
lda (R.CX),y get ref_num
|
|
|
|
|
sta MLICALL.PARAMS+1
|
|
|
|
|
ldy #S.LISTDIR.hREADBUF
|
|
|
|
|
lda (R.CX),y get READ BUFFER
|
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
>STYA MLICALL.PARAMS+2
|
|
|
|
|
>LDYAI 512
|
|
|
|
|
>STYA MLICALL.PARAMS+4
|
2015-06-03 18:30:57 +00:00
|
|
|
|
>MLICALL MLIREAD
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
ldy #S.LISTDIR.BLKPTR set BLKPTR to $0004
|
|
|
|
|
lda #4
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
iny
|
|
|
|
|
lda #0
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
ldy #S.LISTDIR.EIB set EIB to 0
|
|
|
|
|
sta (R.CX),y
|
|
|
|
|
>LDYA MLICALL.PARAMS+2
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TmpFileName .BS 16
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2015-11-22 22:30:06 +00:00
|
|
|
|
SAVE SYS/KERNEL.S.FIO
|
2015-03-14 21:48:35 +00:00
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|