A2osX/BIN/LS.S.txt

936 lines
16 KiB
Plaintext
Raw Normal View History

NEW
2019-09-19 15:22:14 +00:00
AUTO 3,1
2021-07-24 20:42:23 +00:00
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/ls
*--------------------------------------
2021-07-24 20:42:23 +00:00
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.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.COLW .EQ 20
MAX.COLC .EQ 4
COLOR.ENTER .EQ 32
COLOR.REG .EQ 93
COLOR.DIR .EQ 92
COLOR.BDEV .EQ 96
*--------------------------------------
2021-07-24 20:42:23 +00:00
.DUMMY
.OR ZPBIN
2018-12-19 16:45:09 +00:00
ZS.START
2021-07-25 14:03:41 +00:00
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPFileName .BS 2
ZPFileStat .BS 2
2021-07-25 14:03:41 +00:00
ZPPWBuf .BS 2
ArgCount .BS 1
2021-07-25 14:03:41 +00:00
ColCount .BS 1
2021-07-28 16:50:59 +00:00
hLineBuf .BS 1
hPWBuf .BS 1
bPass2 .BS 1
2021-07-25 14:03:41 +00:00
bPause .BS 1
bAllmostAll .BS 1
bColumn .BS 1
bFullPath .BS 1
bLong .BS 1
bRecurse .BS 1
bToFile .BS 1
ZPLineBuf .BS 2
ZPLineBufPtr .BS 2
2021-07-25 14:03:41 +00:00
ZS.END .ED
*--------------------------------------
2021-07-25 14:03:41 +00:00
* File Header (16 Bytes)
*--------------------------------------
2021-07-24 20:42:23 +00:00
CS.START cld
jmp (.1,x)
2021-07-25 14:03:41 +00:00
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #0 S.PS.F.EVENT
2021-07-24 20:42:23 +00:00
.DA #0
2021-07-25 14:03:41 +00:00
.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
2021-07-24 20:42:23 +00:00
.DA 0
2015-06-03 18:30:57 +00:00
*--------------------------------------
* Relocation Table
2019-10-03 06:25:27 +00:00
*--------------------------------------
2021-07-25 14:03:41 +00:00
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.ENTER .DA MSG.ENTER
L.MSG.REGEXT .DA MSG.REGEXT
L.MSG.DIREXT .DA MSG.DIREXT
L.MSG.BDEVEXT .DA MSG.BDEVEXT
L.MSG.SETCOLOR .DA MSG.SETCOLOR
2021-07-25 14:03:41 +00:00
L.PRODOS.FT.TXT .DA PRODOS.FT.TXT
L.MSG.NODATE .DA MSG.NODATE
2021-07-25 14:03:41 +00:00
L.FMT.Date .DA FMT.Date
L.FMT.Time .DA FMT.Time
L.FMT.int16 .DA FMT.int16
J.CS.RUN.PRINT .DA CS.RUN.PRINT.REG
2021-07-24 20:42:23 +00:00
.DA CS.RUN.PRINT.DIR
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.BDEV
.DA CS.RUN.PRINT.LNK
.DA CS.RUN.PRINT.DSOCK
.DA CS.RUN.PRINT.SSOCK
.DA CS.RUN.PRINT.PIPE
2021-07-24 20:42:23 +00:00
.DA 0
*--------------------------------------
2021-07-25 14:03:41 +00:00
CS.INIT clc
rts
2018-12-19 16:45:09 +00:00
*--------------------------------------
CS.RUN ldy #S.PS.hStdOut
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
lda (ZPPtr1)
* cmp #S.FD.T.REG
beq .10
cmp #S.FD.T.PIPE
bne .1
.10 dec bToFile
2021-07-25 14:03:41 +00:00
.1 inc ArgCount
2021-07-25 14:03:41 +00:00
lda ArgCount
>SYSCALL ArgV
bcs .6
2020-07-20 15:19:32 +00:00
2021-07-25 14:03:41 +00:00
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
2020-07-20 15:19:32 +00:00
2021-07-25 14:03:41 +00:00
ldy #1
lda (ZPPtr1),y
beq .99
.20 ldx #OptionVars-OptionList-1
2021-07-25 14:03:41 +00:00
.2 cmp OptionList,x
beq .3
2021-07-25 14:03:41 +00:00
dex
bpl .2
.99 >PUSHW L.MSG.USAGE
2021-07-25 14:03:41 +00:00
>PUSHBI 0
>SYSCALL PrintF
2021-07-25 14:03:41 +00:00
lda #E.SYN
sec
rts
.3 lda OptionVars,x
tax
* sec
ror $0,x
iny
lda (ZPPtr1),y
bne .20
2021-07-25 14:03:41 +00:00
bra .1
2021-07-25 14:03:41 +00:00
.4 >LDYA ZPPtr1
jsr InitSrcDirYA
bcc .1 scan for any other args
2021-07-25 14:03:41 +00:00
.9 rts
2019-10-03 06:25:27 +00:00
2021-07-25 14:03:41 +00:00
.6 >LDA.G index do we have a Source dir ?
bne .8
2019-11-29 15:36:54 +00:00
2021-07-25 14:03:41 +00:00
ldy #S.PS.hCWD
lda (pPS),y
>SYSCALL GetMemPtr
jsr InitSrcDirYA
bcs .9
2021-07-25 14:03:41 +00:00
.8 >PUSHEA.G TIME.SysTime
>SYSCALL Time
2021-07-25 14:03:41 +00:00
>LDYAI S.PW
>SYSCALL GetMem
bcs .9
2021-07-25 14:03:41 +00:00
>STYA ZPPWBuf
2021-07-28 16:50:59 +00:00
stx hPWBuf
2021-07-25 14:03:41 +00:00
>LDYAI 256
>SYSCALL GetMem
bcs .9
2021-07-25 14:03:41 +00:00
>STYA ZPLineBuf
>STYA ZPLineBufPtr
2021-07-28 16:50:59 +00:00
stx hLineBuf
2016-08-17 06:25:58 +00:00
*--------------------------------------
2021-07-25 14:03:41 +00:00
CS.RUN.LOOP stz bPass2
.1 >SLEEP
ldy #S.PS.hStdIn
2021-07-25 14:03:41 +00:00
lda (pPS),y
>SYSCALL FEOF
bcs .99 I/O error
2020-03-17 16:03:32 +00:00
2021-07-25 14:03:41 +00:00
tay
bne .2 no char
2020-03-17 16:03:32 +00:00
2021-07-25 14:03:41 +00:00
>SYSCALL GetChar
cmp #$03 Ctrl-C
beq .99 Abort....
2020-03-17 16:03:32 +00:00
2021-07-25 14:03:41 +00:00
cmp #$13 Ctrl-S
bne .2
2021-07-25 14:03:41 +00:00
lda bPause
eor #$ff
sta bPause
bne .1
2020-03-17 16:03:32 +00:00
2021-07-25 14:03:41 +00:00
.2 bit bPause
bmi .1
2020-03-17 16:03:32 +00:00
2021-07-25 14:03:41 +00:00
jsr GetEntry
2021-07-28 16:50:59 +00:00
bcs .6
2020-03-17 16:03:32 +00:00
2021-07-25 14:03:41 +00:00
jsr FilterMatch
bcs .5 no match, skip....
2021-07-25 14:03:41 +00:00
bit bAllmostAll
bmi .4
2020-03-17 16:03:32 +00:00
2021-07-25 14:03:41 +00:00
lda (ZPFileName)
cmp #'.'
2021-07-28 16:50:59 +00:00
beq .5
2018-12-19 16:45:09 +00:00
2021-07-25 14:03:41 +00:00
.4 ldy #S.STAT.MODE+1
lda (ZPFileStat),y
2020-07-13 19:29:31 +00:00
2021-07-25 14:03:41 +00:00
and #$70
lsr
lsr
lsr
tax
jsr CS.RUN.PRINT.JMP
bcs .99
2018-12-19 16:45:09 +00:00
2021-07-28 16:50:59 +00:00
.5 jsr GetNextEntry
2021-07-25 14:03:41 +00:00
bcc .1
2018-12-19 16:45:09 +00:00
2021-07-25 14:03:41 +00:00
bit bPass2
2021-07-28 16:50:59 +00:00
bmi .6
2018-12-19 16:45:09 +00:00
jsr CS.RUN.CheckRoot
beq .6
2021-07-25 14:03:41 +00:00
jsr ResetSrcDir
bcs .99
2021-07-25 14:03:41 +00:00
dec bPass2
bra .1
2021-07-28 16:50:59 +00:00
.6 bit bLong
bmi .7
jsr CS.RUN.LineBufFlush
2021-07-25 14:03:41 +00:00
bcs .99
2021-07-28 16:50:59 +00:00
.7 jsr LeaveSubDir
bcs .8
2016-10-30 18:19:43 +00:00
2021-07-25 14:03:41 +00:00
jsr BasePath..
2021-07-25 14:03:41 +00:00
jsr CS.RUN.ENTER.MSG
bcs .99
2021-07-25 14:03:41 +00:00
jsr GetNextEntry
jmp CS.RUN.LOOP
2021-07-28 16:50:59 +00:00
.8 lda #0
2021-07-25 14:03:41 +00:00
sec
.99 rts
*--------------------------------------
CS.RUN.CheckRoot
>LDA.G hSrcBasePath
>SYSCALL GetMemPtr
>STYA ZPPtr1
ldy #1
lda (ZPPtr1),y
rts
*--------------------------------------
2020-02-29 14:06:28 +00:00
CS.RUN.PRINT.JMP
2021-07-25 14:03:41 +00:00
jmp (J.CS.RUN.PRINT,x)
2020-02-29 14:06:28 +00:00
*--------------------------------------
CS.RUN.PRINT.REG
2021-07-25 14:03:41 +00:00
bit bPass2
bpl .8
2021-07-25 14:03:41 +00:00
bit bLong
bmi CS.RUN.PRINT.REGEXT
ldy #COLOR.REG
jsr CS.RUN.SetColorY
2020-02-29 14:06:28 +00:00
2021-07-25 14:03:41 +00:00
bit bColumn
bmi CS.RUN.PRINT.REG1
2021-07-25 14:03:41 +00:00
bit bFullPath
bpl .2
jsr CS.RUN.SrcPathOut
2020-02-14 07:21:56 +00:00
bra CS.RUN.PRINT.REG1
.2 ldx #MAX.COLW
clc
jsr CS.RUN.FN2LineBuf
jmp CS.RUN.IncColCnt
2021-07-25 14:03:41 +00:00
.8 clc
.9 rts
2020-02-29 14:06:28 +00:00
*--------------------------------------
CS.RUN.PRINT.REGEXT
jsr CS.RUN.PrintMod
jsr CS.RUN.PrintUidGid
>PUSHW ZPLineBufPtr
>PUSHW L.MSG.REGEXT
2020-02-29 14:06:28 +00:00
2021-07-25 14:03:41 +00:00
ldy #S.STAT.SIZE+3
ldx #4
2020-02-29 14:06:28 +00:00
2021-07-25 14:03:41 +00:00
.2 lda (ZPFileStat),y
>PUSHA
dey
dex
bne .2
2020-02-29 14:06:28 +00:00
>PUSHBI 4
jsr CS.RUN.ToLineBuf
2020-02-14 07:21:56 +00:00
jsr CS.RUN.PrintTypeAux
jsr CS.RUN.PrintDates
ldy #COLOR.REG
jsr CS.RUN.SetColorY
CS.RUN.PRINT.REG1
ldx #0
clc
jsr CS.RUN.FN2LineBuf
jmp CS.RUN.LineBufOut
*--------------------------------------
2018-12-19 16:45:09 +00:00
CS.RUN.PRINT.DIR
2021-07-25 14:03:41 +00:00
bit bPass2
bmi .8
2021-07-25 14:03:41 +00:00
bit bLong
bmi CS.RUN.PRINT.DIREXT
ldy #COLOR.DIR
jsr CS.RUN.SetColorY
2021-07-25 14:03:41 +00:00
bit bColumn
bmi CS.RUN.PRINT.DIR1
2021-07-25 14:03:41 +00:00
bit bFullPath
bpl .2
2020-02-14 07:21:56 +00:00
jsr CS.RUN.SrcPathOut
bra CS.RUN.PRINT.DIR1
2020-02-14 07:21:56 +00:00
.2 ldx #MAX.COLW-1
sec
jsr CS.RUN.FN2LineBuf
jsr CS.RUN.IncColCnt
2021-07-25 14:03:41 +00:00
bcs .9
jmp CS.RUN.PRINT.DIREND
2021-07-25 14:03:41 +00:00
.8 clc
.9 rts
2019-12-06 13:50:32 +00:00
*--------------------------------------
CS.RUN.PRINT.DIREXT
jsr CS.RUN.PrintMod
jsr CS.RUN.PrintUidGid
>LDYA L.MSG.DIREXT
jsr CS.RUN.LineBufYAOut
jsr CS.RUN.PrintDates
ldy #COLOR.DIR
jsr CS.RUN.SetColorY
CS.RUN.PRINT.DIR1
ldx #0
sec
jsr CS.RUN.FN2LineBuf
jsr CS.RUN.LineBufOut
bcs .9
jmp CS.RUN.PRINT.DIREND
2020-02-29 14:06:28 +00:00
.9 rts
*--------------------------------------
2020-02-29 14:06:28 +00:00
CS.RUN.PRINT.CDEV
2022-10-20 15:43:19 +00:00
lda #MLI.E.UNSUPST
sec
2021-07-25 14:03:41 +00:00
rts
2020-02-29 14:06:28 +00:00
*--------------------------------------
CS.RUN.PRINT.BDEV
clc
2021-07-25 14:03:41 +00:00
bit bPass2
bmi .9
2021-07-25 14:03:41 +00:00
bit bLong
bmi CS.RUN.PRINT.BDEVEXT
ldy #COLOR.BDEV
jsr CS.RUN.SetColorY
2020-02-29 14:06:28 +00:00
2021-07-25 14:03:41 +00:00
bit bColumn
bmi CS.RUN.PRINT.BDEV1
2021-07-25 14:03:41 +00:00
bit bFullPath
bpl .2
2020-02-29 14:06:28 +00:00
jsr CS.RUN.SrcPathOut
bra CS.RUN.PRINT.BDEV2
2020-02-29 14:06:28 +00:00
.2 lda #'/'
jsr CS.RUN.LineBufCOut
ldx #MAX.COLW-1
sec
jsr CS.RUN.FN2LineBuf
jsr CS.RUN.IncColCnt
bcc CS.RUN.PRINT.BDEVEND
2021-01-12 21:14:13 +00:00
2021-07-25 14:03:41 +00:00
.9 rts
2020-02-29 14:06:28 +00:00
*--------------------------------------
CS.RUN.PRINT.BDEVEXT
jsr CS.RUN.PrintMod
jsr CS.RUN.PrintUidGid
>PUSHW ZPLineBufPtr
>PUSHW L.MSG.BDEVEXT
2020-02-14 07:21:56 +00:00
2021-07-25 14:03:41 +00:00
ldy #S.STAT.BLOCKS+1
>PUSHB (ZPFileStat),y
dey
>PUSHB (ZPFileStat),y
2020-02-14 07:21:56 +00:00
2021-07-25 14:03:41 +00:00
ldy #S.STAT.P.DEVBLOCKS+1
>PUSHB (ZPFileStat),y
dey
>PUSHB (ZPFileStat),y
ldy #S.STAT.P.SLOT
>PUSHB (ZPFileStat),y
iny DRIVE
>PUSHB (ZPFileStat),y
>PUSHBI 6
jsr CS.RUN.ToLineBuf
2019-12-06 13:50:32 +00:00
jsr CS.RUN.PrintDates
ldy #COLOR.BDEV
jsr CS.RUN.SetColorY
2018-12-19 16:45:09 +00:00
CS.RUN.PRINT.BDEV1
lda #'/'
jsr CS.RUN.LineBufCOut
CS.RUN.PRINT.BDEV2
ldx #0
sec
jsr CS.RUN.FN2LineBuf
jsr CS.RUN.LineBufOut
bcc CS.RUN.PRINT.BDEVEND
rts
*--------------------------------------
CS.RUN.PRINT.LNK
CS.RUN.PRINT.DSOCK
CS.RUN.PRINT.SSOCK
CS.RUN.PRINT.PIPE
2022-10-20 15:43:19 +00:00
lda #MLI.E.UNSUPST
sec
rts
*--------------------------------------
CS.RUN.PRINT.DIREND
CS.RUN.PRINT.BDEVEND
2021-07-25 14:03:41 +00:00
bit bRecurse
bpl .8
lda (ZPFileName)
cmp #'.'
bne .7
ldy #1
lda (ZPFileName),y
beq .8
cmp #'.'
bne .7
iny
lda (ZPFileName),y
beq .8
bit bLong
bmi .7
jsr CS.RUN.LineBufFlush
bcs .9
.7 >LDYA ZPFileName
2021-07-25 14:03:41 +00:00
jsr EnterSubDirYA
bcs .9
2021-07-25 14:03:41 +00:00
jmp CS.RUN.ENTER.MSG
.8 clc
.9 rts
*--------------------------------------
CS.RUN.ENTER.MSG
ldy #COLOR.ENTER
jsr CS.RUN.SetColorY
>LDYA L.MSG.ENTER
jsr CS.RUN.LineBufYAOut
2021-07-25 14:03:41 +00:00
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtr
jsr CS.RUN.LineBufYAOut
ldy #0
jsr CS.RUN.SetColorY
jmp CS.RUN.LineBufOut
*--------------------------------------
CS.RUN.PrintMod ldy #S.STAT.MODE+1
lda (ZPFileStat),y
lsr
php C = RU
lsr
lsr
lsr
tax
lda TYPES,x
jsr CS.RUN.LineBufCOut
ldy #S.STAT.MODE
lda (ZPFileStat),y
ldx #8
plp C = RU
.1 pha
lda #'-'
bcc .2
lda ACCESS,x
.2 jsr CS.RUN.LineBufCOut
pla
asl
dex
bpl .1
2021-07-25 14:03:41 +00:00
rts
2020-02-14 07:21:56 +00:00
*--------------------------------------
CS.RUN.PrintUidGid
2021-07-25 14:03:41 +00:00
ldy #S.STAT.UID
lda (ZPFileStat),y
>PUSHA
>PUSHW ZPPWBuf
>SYSCALL GetPWUID
bcs .2
jsr .8
2021-07-25 14:03:41 +00:00
bra .3
.2 ldy #S.STAT.UID+1
jsr .7
*--------------------------------------
2021-07-25 14:03:41 +00:00
.3 ldy #S.STAT.GID
lda (ZPFileStat),y
>PUSHA
>PUSHW ZPPWBuf
>SYSCALL GetGRGID
bcc .8
2021-07-25 14:03:41 +00:00
ldy #S.STAT.GID+1
2021-07-25 14:03:41 +00:00
.7 >PUSHW ZPLineBufPtr
2021-07-25 14:03:41 +00:00
>PUSHW L.FMT.int16
lda (ZPFileStat),y
>PUSHA
dey
lda (ZPFileStat),y
>PUSHA
2021-07-25 14:03:41 +00:00
>PUSHBI 2
jmp CS.RUN.ToLineBuf
.8 >LDYA ZPPWBuf
ldx #5
jmp CS.RUN.LineBufYAOutX
2019-12-06 13:50:32 +00:00
*--------------------------------------
CS.RUN.PrintDates
ldy #S.STAT.MTIME+S.TIME.MONTH
lda (ZPFileStat),y
bne .1
2021-07-25 14:03:41 +00:00
jsr .8
bra .2
2021-07-25 14:03:41 +00:00
.1 lda #S.STAT.MTIME
jsr .5
.2 ldy #S.STAT.CTIME+S.TIME.MONTH
2021-07-25 14:03:41 +00:00
lda (ZPFileStat),y
beq .8
2021-07-25 14:03:41 +00:00
lda #S.STAT.CTIME
2021-07-25 14:03:41 +00:00
.5 clc
adc ZPFileStat
sta ZPPtr1
lda #0
adc ZPFileStat+1
sta ZPPtr1+1
>PUSHW ZPLineBufPtr
ldx #0
ldy #S.TIME.DAY
.6 lda (ZPPtr1),y
cmp (pData),y TIME.SysTime
bne .7
dey S.TIME.MONTH,S.TIME.YEAR,S.TIME.CENTURY
bpl .6
inx
inx Select L.FMT.Time
.7 >PUSHW L.FMT.Date,x
>PUSHW ZPPtr1
2021-07-25 14:03:41 +00:00
>SYSCALL StrFTime
lda #10
jmp CS.RUN.LineBufPtrAddA
.8 >LDYA L.MSG.NODATE
jmp CS.RUN.LineBufYAOut
*--------------------------------------
CS.RUN.PrintTypeAux
ldy #S.STAT.P.TYPE
2021-07-25 14:03:41 +00:00
lda (ZPFileStat),y
ldy #PRODOS.FT.TXT-PRODOS.FT.HEX-1
2021-07-25 14:03:41 +00:00
.1 cmp PRODOS.FT.HEX,y
beq .2
dey
bpl .1
pha
lda #'$'
jsr CS.RUN.LineBufCOut
pla
jsr CS.RUN.LineBufHOut
bra .3
.2 tya
asl
asl CC
adc L.PRODOS.FT.TXT
2021-07-25 14:03:41 +00:00
tay
lda L.PRODOS.FT.TXT+1
2021-07-25 14:03:41 +00:00
adc #0
jsr CS.RUN.LineBufYAOut
2021-07-25 14:03:41 +00:00
.3 lda #C.SPACE
jsr CS.RUN.LineBufCOut
2019-11-29 15:36:54 +00:00
ldy #S.STAT.P.AUXTYPE+1
lda (ZPFileStat),y
tax
dey
ora (ZPFileStat),y
beq .4
txa
jsr CS.RUN.LineBufHOut
2021-07-25 14:03:41 +00:00
lda (ZPFileStat),y
jsr CS.RUN.LineBufHOut
2021-07-25 14:03:41 +00:00
ldx #0
bra .5
2021-07-25 14:03:41 +00:00
.4 ldx #4
2021-07-25 14:03:41 +00:00
.5 lda #C.SPACE
2021-07-25 14:03:41 +00:00
.6 jsr CS.RUN.LineBufCOut
dex
bpl .6
2021-07-25 14:03:41 +00:00
rts
2019-11-29 15:36:54 +00:00
*--------------------------------------
CS.RUN.FN2LineBuf
phx X = MaxLen
php
2021-07-25 14:03:41 +00:00
>LDYA ZPFileName
jsr CS.RUN.LineBufYAOutX Y = output count
plp
bcc .1
lda #'/'
jsr CS.RUN.LineBufCOut
.1 pla MaxLen was 0, no extra SPACE needed
beq .3
txa
beq .3 all chars printed, no more SPACE
lda #C.SPACE
.2 jsr CS.RUN.LineBufCOut
dex
bne .2
.3 ldy #0 Reset Color
*--------------------------------------
CS.RUN.SetColorY
bit bToFile
bmi CS.RUN.IncColCnt.8
>PUSHW ZPLineBufPtr
>PUSHW L.MSG.SETCOLOR
tya
>PUSHA
>PUSHBI 1
*--------------------------------------
CS.RUN.ToLineBuf
>SYSCALL SPrintF
*--------------------------------------
CS.RUN.LineBufPtrAddY
tya
CS.RUN.LineBufPtrAddA
clc
adc ZPLineBufPtr
sta ZPLineBufPtr
bcc .8
inc ZPLineBufPtr+1
.8 rts
*--------------------------------------
CS.RUN.IncColCnt
inc ColCount
lda ColCount
cmp #MAX.COLC
beq CS.RUN.LineBufFlush1
2020-07-21 05:26:07 +00:00
CS.RUN.IncColCnt.8
2021-07-25 14:03:41 +00:00
clc
rts
*--------------------------------------
CS.RUN.LineBufFlush
lda ColCount
beq CS.RUN.IncColCnt.8
2021-07-24 20:42:23 +00:00
CS.RUN.LineBufFlush1
stz ColCount
*--------------------------------------
CS.RUN.LineBufOut
lda #C.CR
jsr CS.RUN.LineBufCOUT
bit bToFile
bmi .1
2019-12-06 13:50:32 +00:00
lda #C.LF
jsr CS.RUN.LineBufCOUT
2018-08-11 10:57:57 +00:00
.1 lda #0
sta (ZPLineBufPtr)
ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
>LDYA ZPLineBuf
>STYA ZPLineBufPtr
>PUSHYA
>SYSCALL fputs
2021-07-25 14:03:41 +00:00
rts
*--------------------------------------
CS.RUN.SrcPathOut
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtr
*--------------------------------------
CS.RUN.LineBufYAOut
ldx #0
*--------------------------------------
CS.RUN.LineBufYAOutX
>STYA ZPPtr1 X = MaxLen
ldy #$ff
.1 iny
lda (ZPPtr1),y
2021-07-25 14:03:41 +00:00
beq .8
jsr CS.RUN.LineBufCOut
dex
2021-07-25 14:03:41 +00:00
bne .1
.8 clc
rts
*--------------------------------------
CS.RUN.LineBufHOut
2021-07-25 14:03:41 +00:00
pha
lsr
lsr
lsr
lsr
jsr .1
2021-07-25 14:03:41 +00:00
pla
and #$0F
.1 ora #$30
2021-07-25 14:03:41 +00:00
cmp #'9'+1
bcc CS.RUN.LineBufCOut
2021-07-25 14:03:41 +00:00
adc #6
*--------------------------------------
CS.RUN.LineBufCOut
sta (ZPLineBufPtr)
inc ZPLineBufPtr
bne .8
inc ZPLineBufPtr+1
.8 rts
*--------------------------------------
CS.DOEVENT sec
2021-07-25 14:03:41 +00:00
rts
*--------------------------------------
CS.QUIT jsr LeaveSubDir
bcc CS.QUIT
2020-07-13 19:29:31 +00:00
ldy #hFilter
lda (pData),y
jsr .7
lda hPWBuf
jsr .7
2020-07-13 19:29:31 +00:00
lda hLineBuf
.7 beq .8
>SYSCALL FreeMem
.8 clc
2021-07-25 14:03:41 +00:00
rts
*--------------------------------------
2021-07-25 14:03:41 +00:00
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END
*--------------------------------------
2021-07-25 14:03:41 +00:00
OptionList .AS "ACFLRacflr"
OptionVars .DA #bAllmostAll,#bColumn,#bFullPath,#bLong,#bRecurse,#bAllmostAll,#bColumn,#bFullPath,#bLong,#bRecurse
*--------------------------------------
MSG.USAGE .CS "Usage : LS [-A] [-C] [-F] [-L] [-R] [filespec]\r\n"
.CS " -A : Show all files\r\n"
.CS " -C : List in one column\r\n"
.CS " -F : Show full paths\r\n"
.CS " -I <*,? wildcards allowed> : Ignore matching files\r\n"
.CS " -L : Use long listing format\r\n"
.CZ " -R : Recursively list subdirectories\r\n"
2021-07-25 14:03:41 +00:00
*--------------------------------------
MSG.ENTER .CZ "Directory:"
*--------------------------------------
MSG.REGEXT .CZ " %10u "
MSG.DIREXT .CZ " <dir> "
MSG.BDEVEXT .CZ " %5D/%5D s%dd%d "
*--------------------------------------
MSG.SETCOLOR .CZ "\e[1;%dm"
2021-07-28 16:50:59 +00:00
PRODOS.FT.HEX .HS 0406FAFCFDCBCCCFFF
PRODOS.FT.TXT .AZ "txt"
2021-07-25 14:03:41 +00:00
.AZ "bin"
.AZ "asm"
.AZ "bas"
.AZ "var"
.AZ "pix"
.AZ "fon"
.AZ "pak"
.AZ "sys"
MSG.NODATE .AZ "<no-date> "
FMT.Date .AZ "%d-%b-%y "
FMT.Time .AZ " %H:%M:%S "
2021-07-25 14:03:41 +00:00
FMT.int16 .AZ "%6D"
TYPES .AS "-dcblssp"
2021-07-25 14:03:41 +00:00
ACCESS .AS "xwrxwrxwr"
*--------------------------------------
.DUMMY
.OR 0
DS.START
TIME.SysTime .BS S.TIME
2021-07-25 14:03:41 +00:00
.INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------
MAN
2020-07-13 19:29:31 +00:00
SAVE usr/src/bin/ls.s
ASM