PR#3 PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 .TF /A2OSX.BOOT/BIN/LS *-------------------------------------- .INB /A2OSX.DEV/INC/MACROS.I .INB /A2OSX.DEV/INC/A2OSX.I *-------------------------------------- MAX.COL .EQ 4 MAX.RECURSE .EQ 8 *-------------------------------------- ZPPtr1 .EQ ZPBIN ZPPtr2 .EQ ZPBIN+2 *-------------------------------------- * File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) .DA #$61 6502,Level 1 (65c02) .DA #1 BIN Layout Version 1 .DA 0 .DA CS.END-CS.START Code Length To Relocate .DA DS.END-DS.START Data Segment to Allocate .DA 0 .DA 0 *-------------------------------------- * Relocation Table *-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT .DA CS.QUIT L.MSG.DEV .DA MSG.DEV L.MSG.DIR .DA MSG.DIR L.MSG.DIREXT .DA MSG.DIREXT L.MSG.FILE .DA MSG.FILE L.MSG.FILEEXT .DA MSG.FILEEXT L.PRODOS.FT.TXT .DA PRODOS.FT.TXT L.STAT .DA STAT L.TIME.Format .DA TIME.Format L.TIME.Create .DA TIME.Create L.TIME.Mod .DA TIME.Mod .DA 0 *-------------------------------------- CS.INIT >SYSCALL GetArgC sta ArgCount .1 dec ArgCount beq .5 lda ArgCount >SYSCALL GetArgA >STYA ZPPtr1 lda (ZPPtr1) cmp #2 bne .4 ldy #1 lda (ZPPtr1),y cmp #'-' bne .4 iny lda (ZPPtr1),y ldx OptionList .2 cmp OptionList,x beq .3 dex bne .2 lda #SYSMGR.ERRSYN sec rts .3 ldy OptionVars-1,x lda #$80 sta (pData),y bra .1 .4 >LDYA ZPPtr1 jsr InitSrcDirYA bcs .9 bra .1 scan for any other args .5 ldy #hDIRs lda (pData),y bne .8 ldy #S.PS.hPREFIX lda (pPs),y >SYSCALL GetMemPtrA jsr InitSrcDirYA bcs .9 .8 lda (pPs) ora #S.PS.F.EVENT Now accept events sta (pPs) clc .9 rts *-------------------------------------- CS.RUN ldy #bCANCEL lda (pData),y beq .1 sec rts .1 ldy #bSTOP lda (pData),y beq .2 clc rts .2 ldy #hDIRs lda (pData),y tay lda (pData),y >SYSCALL READDIRA bcc .20 ldy #bLong lda (pData),y bmi .89 ldy #ColCount lda (pData),y beq .89 lda #13 >SYSCALL COutA .89 lda #0 sec rts .20 phx Save hDIRENT >STYA ZPPtr1 .3 lda (ZPPtr1) beq .8 No more entry..exit lda ZPPtr1 set Ptr2=Ptr1+LEN-> S.STAT sec adc (ZPPtr1) sta ZPPtr2 lda ZPPtr1+1 adc #0 sta ZPPtr2+1 ldy #hFilter lda (pData),y beq .4 No filter.... >SYSCALL GetMemPtrA >PUSHYA >PUSHW ZPPtr1 >SYSCALL PStrMatch bcs .7 no match, skip.... .4 ldy #S.STAT.PRODOS.DRIVE lda (ZPPtr2),y ProDOS Device ? beq .5 jsr CS.RUN.DEV bra .7 .5 ldy #S.STAT.PRODOS.TYPE lda (ZPPtr2),y cmp #$0F Directory ? bne .6 jsr CS.RUN.DIR bra .7 .6 jsr CS.RUN.FILE .7 lda ZPPtr2 clc adc #S.STAT sta ZPPtr1 lda ZPPtr2+1 adc #0 sta ZPPtr1+1 bra .3 .8 pla Discard hDIRENT >SYSCALL FreeMemA clc rts *-------------------------------------- CS.RUN.DEV ldy #S.STAT.PRODOS.DEVBLOCKS+1 >PUSHB (ZPPtr2),y dey >PUSHB (ZPPtr2),y ldy #S.STAT.BLOCKS+1 >PUSHB (ZPPtr2),y dey >PUSHB (ZPPtr2),y ldy #S.STAT.PRODOS.DRIVE >PUSHB (ZPPtr2),y dey SLOT >PUSHB (ZPPtr2),y >PUSHW ZPPtr1 >LDYA L.MSG.DEV >SYSCALL PrintFYA rts *-------------------------------------- CS.RUN.DIR ldy #bLong lda (pData),y bmi .8 >PUSHW ZPPtr1 >LDYA L.MSG.DIR >SYSCALL PrintFYA lda #80/MAX.COL-3 sec sbc (ZPPtr1) beq .2 tax .1 lda #' ' phx >SYSCALL COutA plx dex bne .1 .2 ldy #ColCount lda (pData),y inc sta (pData),y cmp #MAX.COL bne .7 lda #0 sta (pData),y lda #13 >SYSCALL COutA .7 rts .8 jsr CS.RUN.PUSHEXTRA ldy #S.STAT.MODE+1 lda (ZPPtr2),y >PUSHA dey lda (ZPPtr2),y >PUSHA File Mode >PUSHW ZPPtr1 >LDYA L.MSG.DIREXT >SYSCALL PrintFYA rts *-------------------------------------- CS.RUN.FILE ldy #bLong lda (pData),y bmi .8 ldy #S.STAT.PRODOS.TYPE lda (ZPPtr2),y jsr FileType2PSTR >PUSHYA Type >PUSHW ZPPtr1 >LDYA L.MSG.FILE >SYSCALL PrintFYA ldy #ColCount lda (pData),y inc sta (pData),y cmp #MAX.COL bne .7 lda #0 sta (pData),y lda #13 >SYSCALL COutA rts .7 lda #80/MAX.COL-5 sec sbc (ZPPtr1) beq .71 tax .70 lda #' ' phx >SYSCALL COutA plx dex bne .70 .71 rts .8 jsr CS.RUN.PUSHEXTRA lda ZPPtr2 clc adc #S.STAT.SIZE tay lda ZPPtr2+1 adc #0 >PUSHYA File Size ldy #S.STAT.MODE+1 lda (ZPPtr2),y >PUSHA dey lda (ZPPtr2),y >PUSHA File Mode ldy #S.STAT.PRODOS.AUXTYPE+1 lda (ZPPtr2),y >PUSHA dey lda (ZPPtr2),y >PUSHA AuxType dey lda (ZPPtr2),y jsr FileType2PSTR >PUSHYA Type >PUSHW ZPPtr1 >LDYA L.MSG.FILEEXT >SYSCALL PrintFYA rts *-------------------------------------- CS.RUN.PUSHEXTRA >PUSHW L.TIME.Mod >PUSHW L.TIME.Format lda ZPPtr2 clc adc #S.STAT.MTIME tay lda ZPPtr2+1 adc #0 >PUSHYA >SYSCALL PStrFTime >PUSHW L.TIME.Create >PUSHW L.TIME.Format lda ZPPtr2 clc adc #S.STAT.CTIME tay lda ZPPtr2+1 adc #0 >PUSHYA >SYSCALL PStrFTime >PUSHW L.TIME.Mod ModTime >PUSHW L.TIME.Create Create Time rts *-------------------------------------- CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device? lda (pEvent),y ldy #S.PS.hINDEV cmp (pPs),y bne .9 lda (pEvent) and #S.EVT.F.KEY is it a KEY event? beq .9 ldy #S.EVT.DATAHI is it an O or SAPPLE key ? lda (pEvent),y bne .9 ldy #S.EVT.DATALO lda (pEvent),y cmp #$03 Ctrl-C bne .1 lda #$FF ldy #bCANCEL sta (pData),y bra .8 .1 cmp #$13 Ctrl-S bne .8 ldy #bSTOP lda (pData),y eor #$FF sta (pData),y .8 clc rts .9 sec rts *-------------------------------------- CS.QUIT jsr LeaveSubDir bcc CS.QUIT ldy #hFilter lda (pData),y beq .3 >SYSCALL FreeMemA .3 clc rts *-------------------------------------- FileType2PSTR ldy #0 .1 cmp PRODOS.FT.HEX,y beq .2 iny cpy #PRODOS.FT.TXT-PRODOS.FT.HEX bne .1 pha lsr lsr lsr lsr tax lda HEXDIGIT,x sta PRODOS.FT.DFLT+2 pla and #$0F tax lda HEXDIGIT,x sta PRODOS.FT.DFLT+3 .2 tya asl asl CC adc L.PRODOS.FT.TXT tay lda L.PRODOS.FT.TXT+1 adc #0 rts *-------------------------------------- .INB BIN/X.CPLSMVRM.S *-------------------------------------- CS.END *-------------------------------------- OptionList >PSTR "LR" OptionVars .DA #bLong,bRecurse *-------------------------------------- MSG.DEV >CSTR "%15S S%d,D%d Blocks Used:%5D,Total:%5D\n" MSG.DIR >CSTR "%S/" MSG.DIREXT >CSTR "%16S