NEW AUTO 3,1 .LIST OFF .OP 65C02 .OR $2000 .TF BIN/LS *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I .INB INC/MLI.I .INB INC/MLI.E.I *-------------------------------------- X.ENTER.SUBDIR .EQ 1 X.COPY.TO.DEST .EQ 0 X.DELETE.SOURCE .EQ 0 *-------------------------------------- MAX.COL .EQ 4 *-------------------------------------- .DUMMY .OR ZPBIN ZS.START ZPPtr1 .BS 2 ZPPtr2 .BS 2 ZPFileName .BS 2 ZPFileStat .BS 2 ZS.END .ED *-------------------------------------- * File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) .DA #$61 6502,Level 1 (65c02) .DA #1 BIN Layout Version 1 .DA #0 S.PS.F.EVENT .DA #0 .DA CS.END-CS.START Code Size (without Constants) .DA DS.END-DS.START Data SegmentSize .DA #64 Stack Size .DA #ZS.END-ZS.START Zero Page Size .DA 0 *-------------------------------------- * Relocation Table *-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT .DA CS.QUIT L.MSG.DEVEXT .DA MSG.DEVEXT L.MSG.DIR .DA MSG.DIR L.MSG.ENTER .DA MSG.ENTER L.MSG.DIREXT .DA MSG.DIREXT L.MSG.FILE .DA MSG.FILE L.MSG.FILEEXT .DA MSG.FILEEXT L.MSG.CRLF .DA MSG.CRLF L.PRODOS.FT.TXT .DA PRODOS.FT.TXT L.FMT.DateTime .DA FMT.DateTime .DA 0 *-------------------------------------- CS.INIT clc rts *-------------------------------------- CS.RUN .1 >INC.G ArgCount >SYSCALL ArgV bcs .6 >STYA ZPPtr1 lda (ZPPtr1) cmp #'-' bne .4 ldy #1 lda (ZPPtr1),y ldx OptionList .2 cmp OptionList,x beq .3 dex bne .2 lda #E.SYN sec rts .3 ldy OptionVars-1,x lda #$80 sta (pData),y bra .1 .4 >LDYA ZPPtr1 jsr InitSrcDirYA bcc .1 scan for any other args .9 rts .6 >LDA.G index do we have a Source dir ? bne CS.RUN.LOOP ldy #S.PS.hCWD lda (pPs),y >SYSCALL GetMemPtr jsr InitSrcDirYA bcs .9 *-------------------------------------- CS.RUN.LOOP ldy #S.PS.hStdIn lda (pPS),y >SYSCALL feof bcs .99 I/O error tay bne .2 no char >SYSCALL GetChar cmp #$03 Ctrl-C bne .1 Abort.... rts CS .1 cmp #$13 Ctrl-S bne .2 >LDA.G bPause eor #$ff sta (pData),y bne CS.RUN.LOOP .2 >LDA.G bPause bne CS.RUN.LOOP jsr GetEntry bcs .9 jsr FilterMatch bcs .8 no match, skip.... .4 ldy #S.STAT.P.DRIVE lda (ZPFileStat),y ProDOS Device ? bne .5 ldy #S.STAT.P.TYPE lda (ZPFileStat),y cmp #$0F Directory ? bne .6 jsr CS.RUN.PRINT.DIR bcs .99 bra .8 .5 jsr CS.RUN.PRINT.DEV bcs .99 bra .8 .6 jsr CS.RUN.PRINT.FILE bcs .99 .8 jsr GetNextEntry bcc .92 .9 ldy #bLong lda (pData),y bmi .91 jsr CS.RUN.NewLine bcs .99 .91 jsr LeaveSubDir bcs .98 jsr BasePath.. jsr GetNextEntry .92 jmp CS.RUN.LOOP .98 lda #0 sec .99 rts *-------------------------------------- CS.RUN.PRINT.DEV >LDA.G bLong bpl CS.RUN.PRINT.DIR ldy #S.STAT.P.DEVBLOCKS+1 >PUSHB (ZPFileStat),y dey >PUSHB (ZPFileStat),y ldy #S.STAT.BLOCKS+1 >PUSHB (ZPFileStat),y dey >PUSHB (ZPFileStat),y ldy #S.STAT.P.DRIVE >PUSHB (ZPFileStat),y dey SLOT >PUSHB (ZPFileStat),y >PUSHW ZPFileName >PUSHBI 8 >LDYA L.MSG.DEVEXT >SYSCALL printf bcs .9 ldy #bRecurse lda (pData),y bpl .8 >LDYA ZPFileName jsr EnterSubDirYA bcs .9 jmp CS.RUN.ENTER.MSG .8 clc.9 rts *-------------------------------------- CS.RUN.PRINT.DIR >LDA.G bAllmostAll bmi .10 lda (ZPFileName) cmp #'.' bne .10 jmp .5 .10 >LDA.G bLong bmi .4 >LDA.G bColumn bmi .23 >LDA.G bFullPath bpl .22 >PUSHBI 0 ldy #hSrcBasePath lda (pData),y >SYSCALL GetMemPtr >SYSCALL printf .23 >LDYA ZPFileName >SYSCALL puts bcs .9 >LDA.G bRecurse bpl .8 lda (ZPFileName) cmp #'.' beq .8 >LDYA ZPFileName jmp EnterSubDirYA .8 clc .9 rts .22 >PUSHW ZPFileName >PUSHBI 2 >LDYA L.MSG.DIR >SYSCALL printf bcs .9 ldy #0 .1 iny lda (ZPFileName),y bne .1 .11 iny cpy #19 bcs .2 lda #' ' phy >SYSCALL PutChar ply bcc .11 rts .2 jsr CS.RUN.UpdateColCnt bcc .5 rts .4 jsr CS.RUN.PUSHDATES jsr Mod2CSTR >PUSHEA.G MOD File Mod >PUSHW ZPFileName >PUSHBI 8 >LDYA L.MSG.DIREXT >SYSCALL printf bcs .90 .5 >LDA.G bRecurse bpl .80 lda (ZPFileName) cmp #'.' beq .80 jsr CS.RUN.NewLine bcs .90 >LDYA ZPFileName jsr EnterSubDirYA bcs .90 jmp CS.RUN.ENTER.MSG .80 clc .90 rts *-------------------------------------- CS.RUN.PRINT.FILE ldy #bLong lda (pData),y bmi .1 >LDA.G bColumn bmi .23 >LDA.G bFullPath bpl .22 >PUSHBI 0 ldy #hSrcBasePath lda (pData),y >SYSCALL GetMemPtr >SYSCALL printf .23 >LDYA ZPFileName >SYSCALL puts rts .22 >PUSHW ZPFileName >PUSHBI 2 >LDYA L.MSG.FILE >SYSCALL printf bcs .9 jmp CS.RUN.UpdateColCnt .1 jsr CS.RUN.PUSHDATES ldy #S.STAT.SIZE+3 ldx #4 .2 lda (ZPFileStat),y >PUSHA dey dex bne .2 jsr Mod2CSTR >PUSHEA.G MOD File Mod ldy #S.STAT.P.AUXTYPE+1 lda (ZPFileStat),y >PUSHA dey lda (ZPFileStat),y >PUSHA dey Type lda (ZPFileStat),y jsr FileType2PSTR >PUSHYA >PUSHW ZPFileName >PUSHBI 16 >LDYA L.MSG.FILEEXT >SYSCALL printf .9 rts *-------------------------------------- CS.RUN.PUSHDATES ldx #$ff ldy #TIME.Mod-1 Set NODATE as default .10 inx iny lda MSG.NODATE,x sta (pData),y bne .10 ldx #$ff ldy #TIME.Create-1 Set NODATE as default .11 inx iny lda MSG.NODATE,x sta (pData),y bne .11 ldy #S.STAT.MTIME+S.TIME.MONTH lda (ZPFileStat),y beq .1 Month=0.....invalid date/time lda ZPFileStat clc adc #S.STAT.MTIME tay lda ZPFileStat+1 adc #0 >PUSHYA >PUSHW L.FMT.DateTime >LEA.G TIME.Mod >SYSCALL StrFTime .1 ldy #S.STAT.CTIME+S.TIME.MONTH lda (ZPFileStat),y beq .2 Month=0.....invalid date/time lda ZPFileStat clc adc #S.STAT.CTIME tay lda ZPFileStat+1 adc #0 >PUSHYA >PUSHW L.FMT.DateTime >LEA.G TIME.Create >SYSCALL StrFTime .2 >PUSHEA.G TIME.Mod >PUSHEA.G TIME.Create rts *-------------------------------------- CS.RUN.UpdateColCnt >INC.G ColCount cmp #MAX.COL bne CS.RUN.NewLine.8 lda #0 sta (pData),y bra CS.RUN.NewLine.1 *-------------------------------------- CS.RUN.NewLine >LDA.G ColCount beq CS.RUN.NewLine.8 CS.RUN.NewLine.1 >PUSHBI 0 >LDYA L.MSG.CRLF >SYSCALL printf rts CS.RUN.NewLine.8 clc rts *-------------------------------------- CS.RUN.ENTER.MSG ldy #hSrcBasePath lda (pData),y >SYSCALL GetMemPtr >PUSHYA >PUSHBI 2 >LDYA L.MSG.ENTER >SYSCALL printf rts *-------------------------------------- CS.DOEVENT sec rts *-------------------------------------- CS.QUIT jsr LeaveSubDir bcc CS.QUIT >LDA.G hFilter beq .3 >SYSCALL FreeMem .3 clc rts *-------------------------------------- FileType2PSTR ldy #0 .1 cmp PRODOS.FT.HEX,y beq .8 iny cpy #PRODOS.FT.TXT-PRODOS.FT.HEX bne .1 pha lsr lsr lsr lsr ora #$30 cmp #$3A bcc .2 adc #6 .2 sta PRODOS.FT.DFLT+2 pla and #$0F ora #$30 cmp #$3A bcc .3 adc #6 .3 sta PRODOS.FT.DFLT+3 .8 tya asl asl CC adc L.PRODOS.FT.TXT tay lda L.PRODOS.FT.TXT+1 adc #0 rts *-------------------------------------- Mod2CSTR ldy #S.STAT.MODE+1 lda (ZPFileStat),y lsr lsr lsr lsr tax lda TYPES,x >STA.G MOD ldx #0 ldy #S.STAT.MODE lda (ZPFileStat),y ldy #MOD+1 .1 lsr pha lda #'-' bcc .2 lda ACCESS,x .2 sta (pData),y iny pla inx cpx #8 bne .1 .3 ldy #S.STAT.MODE+1 lda (ZPFileStat),y lsr lda #'-' bcc .4 lda ACCESS,x .4 >STA.G MOD+9 rts *-------------------------------------- .INB USR/SRC/BIN/X.FILEENUM.S *-------------------------------------- CS.END *-------------------------------------- OptionList >PSTR "ACFLRacflr" OptionVars .DA #bAllmostAll,#bColumn,#bFullPath,#bLong,#bRecurse,#bAllmostAll,#bColumn,#bFullPath,#bLong,#bRecurse *-------------------------------------- MSG.DEVEXT .AZ "/%15s S%dD%d Blocks Used:%5D Total:%5D\r\n" MSG.DIR .AZ "\e[32m%s/\e[0m" MSG.ENTER .AZ "Directory:%s\r\n" MSG.DIREXT .AZ "\e[32m%16s\e[0m