2019-04-17 15:31:18 +00:00
|
|
|
|
NEW
|
2019-05-02 09:52:32 +00:00
|
|
|
|
AUTO 3,1
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2019-12-07 13:20:04 +00:00
|
|
|
|
.TF bin/wc
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
2020-05-25 21:03:11 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/kernel.i
|
|
|
|
|
.INB inc/mli.i
|
|
|
|
|
.INB inc/mli.e.i
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
2019-04-30 16:08:47 +00:00
|
|
|
|
X.ENTER.SUBDIR .EQ 0
|
2019-04-17 15:31:18 +00:00
|
|
|
|
X.COPY.TO.DEST .EQ 0
|
|
|
|
|
X.DELETE.SOURCE .EQ 0
|
2023-07-12 17:07:55 +00:00
|
|
|
|
X.RESET.SRC.DIR .EQ 0
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPPtr1 .BS 2
|
|
|
|
|
ZPPtr2 .BS 2
|
|
|
|
|
ZPFileName .BS 2
|
|
|
|
|
ZPFileStat .BS 2
|
2019-09-20 15:15:06 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
ZPFullPath .BS 2
|
2019-09-20 15:15:06 +00:00
|
|
|
|
ZPRelPath .BS 2
|
|
|
|
|
ZPLineBuf .BS 2
|
|
|
|
|
|
2020-08-02 12:19:43 +00:00
|
|
|
|
ArgIndex .BS 1
|
|
|
|
|
hSrcFullPath .BS 1
|
|
|
|
|
hFile .BS 1
|
|
|
|
|
hMem .BS 1
|
|
|
|
|
|
|
|
|
|
bTabbed .BS 1
|
2019-09-20 15:15:06 +00:00
|
|
|
|
|
2020-08-02 12:19:43 +00:00
|
|
|
|
bPause .BS 1
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bContinue .BS 1
|
|
|
|
|
bRecurse .BS 1
|
|
|
|
|
bChar .BS 1
|
|
|
|
|
bLine .BS 1
|
|
|
|
|
bWord .BS 1
|
|
|
|
|
bInWord .BS 1
|
|
|
|
|
bTotal .BS 1
|
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
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
|
|
|
|
|
.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.USAGE .DA MSG.USAGE
|
2022-12-23 16:50:50 +00:00
|
|
|
|
L.MSG.CRLF .DA MSG.CRLF
|
2019-04-17 15:31:18 +00:00
|
|
|
|
L.MSG.ERR .DA MSG.ERR
|
2020-08-02 12:19:43 +00:00
|
|
|
|
L.MSG.LONGTAB .DA MSG.LONGTAB
|
2020-05-25 21:03:11 +00:00
|
|
|
|
L.MSG.LONG .DA MSG.LONG
|
|
|
|
|
L.MSG.TOTAL .DA MSG.TOTAL
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-08-02 12:19:43 +00:00
|
|
|
|
CS.RUN inc ArgIndex
|
|
|
|
|
lda ArgIndex
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>SYSCALL ArgV
|
2019-12-07 13:20:04 +00:00
|
|
|
|
bcs .5
|
2020-08-02 12:19:43 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .4
|
2020-08-02 12:19:43 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
jsr CS.RUN.CheckOpt
|
|
|
|
|
bcc CS.RUN
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2022-11-02 06:54:30 +00:00
|
|
|
|
.9 >LDYA L.MSG.USAGE
|
|
|
|
|
>SYSCALL PutS
|
2019-04-17 15:31:18 +00:00
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec
|
2019-12-07 13:20:04 +00:00
|
|
|
|
rts
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.4 >LDA.G hSrcBasePath
|
|
|
|
|
bne .9
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>LDYA ZPPtr1
|
2023-07-12 17:07:55 +00:00
|
|
|
|
jsr X.InitSrcDirYA
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bcc CS.RUN
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-12-07 13:20:04 +00:00
|
|
|
|
.99 rts
|
2020-05-25 21:03:11 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.5 lda bChar
|
|
|
|
|
ora bLine
|
|
|
|
|
ora bWord
|
|
|
|
|
bne .51
|
|
|
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
|
sta bChar
|
|
|
|
|
sta bLine
|
|
|
|
|
sta bWord
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2020-05-25 21:03:11 +00:00
|
|
|
|
.51 >LDA.G hSrcBasePath
|
2019-12-07 13:20:04 +00:00
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
tax
|
2021-07-24 20:42:23 +00:00
|
|
|
|
lda hFDs-1,x
|
2019-12-07 13:20:04 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #S.FD.T.PIPE
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
jmp CS.RUN.PIPE
|
|
|
|
|
|
|
|
|
|
.6 >LDYAI 256
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMem
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bcs .99
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>STYA ZPFullPath
|
2020-08-02 12:19:43 +00:00
|
|
|
|
stx hSrcFullPath
|
2019-09-20 15:15:06 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G hSrcBasePath
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPPtr1
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
ldy #$ff
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.80 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .80
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
tya
|
|
|
|
|
clc
|
|
|
|
|
adc ZPFullPath
|
|
|
|
|
sta ZPRelPath
|
|
|
|
|
lda ZPFullPath+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPRelPath+1
|
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMem
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bcs .99
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>STYA ZPLineBuf
|
2020-08-02 12:19:43 +00:00
|
|
|
|
stx hMem
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.LOOP ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>SYSCALL FEOF
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bcs .99
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
tay
|
2019-05-02 09:52:32 +00:00
|
|
|
|
bne .10
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .99
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
beq .99 Abort....
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
cmp #$13 Ctrl-S
|
|
|
|
|
bne .10
|
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
lda bPause
|
2019-04-17 15:31:18 +00:00
|
|
|
|
eor #$ff
|
2019-09-20 15:15:06 +00:00
|
|
|
|
sta bPause
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bne CS.RUN.LOOP
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.10 lda bPause
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bne CS.RUN.LOOP Pause...
|
2019-09-20 15:15:06 +00:00
|
|
|
|
|
2023-07-12 17:07:55 +00:00
|
|
|
|
jsr X.GetEntry
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bcs .9
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
ldy #S.STAT.P.DRIVE
|
|
|
|
|
lda (ZPFileStat),y ProDOS Device ?
|
2019-09-20 15:15:06 +00:00
|
|
|
|
beq .5
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
jsr CS.RUN.DEV
|
|
|
|
|
bcc CS.RUN.LOOP
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
rts
|
2021-02-17 16:15:43 +00:00
|
|
|
|
|
|
|
|
|
.5 ldy #S.STAT.MODE+1
|
2019-04-17 15:31:18 +00:00
|
|
|
|
lda (ZPFileStat),y
|
2021-02-17 16:15:43 +00:00
|
|
|
|
and #$F0
|
|
|
|
|
cmp /S.STAT.MODE.DIR
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.DIR
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bcs .99
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bra .8
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.6 jsr CS.RUN.FILE
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bcs .99
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bra .8
|
2019-04-17 15:31:18 +00:00
|
|
|
|
|
2023-07-12 17:07:55 +00:00
|
|
|
|
.9 jsr X.LeaveSubDir
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bcs .90
|
|
|
|
|
|
2023-07-12 17:07:55 +00:00
|
|
|
|
jsr X.BasePath..
|
|
|
|
|
.8 jsr X.GetNextEntry
|
2019-04-17 15:31:18 +00:00
|
|
|
|
jmp CS.RUN.LOOP
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.90 jsr CS.RUN.PrintTstat
|
|
|
|
|
lda #0
|
2019-04-17 15:31:18 +00:00
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2019-12-07 13:20:04 +00:00
|
|
|
|
CS.RUN.PIPE >LDYAI 256
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMem
|
2019-12-07 13:20:04 +00:00
|
|
|
|
bcs .99
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-12-07 13:20:04 +00:00
|
|
|
|
>STYA ZPLineBuf
|
2020-08-02 12:19:43 +00:00
|
|
|
|
stx hMem
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
|
2020-08-02 12:19:43 +00:00
|
|
|
|
sta hFile
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
jsr CS.RUN.FILE.LOOP
|
|
|
|
|
jsr CS.RUN.PrintFstat
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2019-09-20 15:15:06 +00:00
|
|
|
|
CS.RUN.DIR lda bRecurse
|
|
|
|
|
bpl .8
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
lda (ZPFileName)
|
|
|
|
|
cmp #'.'
|
|
|
|
|
beq .8
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>LDYA ZPFileName
|
2023-07-12 17:07:55 +00:00
|
|
|
|
jsr X.EnterSubDirYA
|
2019-09-20 15:15:06 +00:00
|
|
|
|
jmp CS.RUN.CheckErr
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.DEV
|
2023-07-12 17:07:55 +00:00
|
|
|
|
.8 jsr X.GetNextEntry
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
CS.RUN.DEV.CLC.RTS
|
2019-10-03 06:25:27 +00:00
|
|
|
|
clc
|
2019-12-07 13:20:04 +00:00
|
|
|
|
rts
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
2023-07-12 17:07:55 +00:00
|
|
|
|
CS.RUN.FILE jsr X.IncludeMatch
|
2019-12-07 13:20:04 +00:00
|
|
|
|
bcs CS.RUN.DEV.CLC.RTS no match, skip....
|
2019-09-20 15:15:06 +00:00
|
|
|
|
|
2019-04-30 16:08:47 +00:00
|
|
|
|
jsr CS.RUN.GetFilePath
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
jsr CS.RUN.OpenFile
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bcs .9
|
2019-09-20 15:15:06 +00:00
|
|
|
|
|
2019-12-07 13:20:04 +00:00
|
|
|
|
jsr CS.RUN.FILE.LOOP
|
|
|
|
|
bcs .7
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.CloseFile
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.PrintFstat
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.AddFstat2Tstat
|
|
|
|
|
lda bTotal
|
|
|
|
|
bmi .8
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-12-07 13:20:04 +00:00
|
|
|
|
beq .61
|
|
|
|
|
|
|
|
|
|
lda #$fe
|
|
|
|
|
|
|
|
|
|
.61 inc
|
|
|
|
|
sta bTotal
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.7 pha
|
|
|
|
|
jsr CS.RUN.CloseFile
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
.9 jmp CS.RUN.CheckErr
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-12-07 13:20:04 +00:00
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.FILE.LOOP
|
2020-12-23 14:54:57 +00:00
|
|
|
|
.1 >PUSHB hFile
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PUSHW ZPLineBuf
|
2021-07-28 16:50:59 +00:00
|
|
|
|
>PUSHWI 255
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>SYSCALL FGetS
|
2019-12-07 13:20:04 +00:00
|
|
|
|
bcs .8
|
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
jsr CS.RUN.IncFLine
|
|
|
|
|
ldy #$ff
|
|
|
|
|
stz bInWord
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.2 iny
|
|
|
|
|
lda (ZPLineBuf),y
|
2019-12-07 13:20:04 +00:00
|
|
|
|
bne .21
|
|
|
|
|
|
|
|
|
|
lda bInWord
|
2019-09-20 15:15:06 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
2019-12-07 13:20:04 +00:00
|
|
|
|
jsr CS.RUN.IncFWord
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.21 cmp #C.SPACE
|
2019-09-20 15:15:06 +00:00
|
|
|
|
beq .3
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
cmp #C.TAB
|
|
|
|
|
bne .4
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.3 lda bInWord
|
|
|
|
|
beq .5
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.IncFWord
|
|
|
|
|
stz bInWord
|
|
|
|
|
bra .5
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.4 inc bInWord
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.5 jsr CS.RUN.IncFChar
|
|
|
|
|
bra .2
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
.8 cmp #MLI.E.EOF
|
|
|
|
|
bne .9
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-12-07 13:20:04 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
2019-09-20 15:15:06 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CheckErr bcc .9
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
pha
|
2020-05-19 13:00:17 +00:00
|
|
|
|
>PUSHW L.MSG.ERR
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2019-09-20 15:15:06 +00:00
|
|
|
|
lda bContinue
|
2019-04-17 15:31:18 +00:00
|
|
|
|
eor #$80
|
|
|
|
|
asl
|
|
|
|
|
pla
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.9 rts
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.GetFilePath
|
2021-05-04 17:31:21 +00:00
|
|
|
|
>PUSHW ZPFullPath
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>LDA.G hSrcBasePath
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>SYSCALL StrCpy
|
2021-05-04 17:31:21 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW ZPFullPath
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>PUSHW ZPFileName
|
|
|
|
|
>SYSCALL StrCat
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-09-20 15:15:06 +00:00
|
|
|
|
CS.RUN.OpenFile ldx #12
|
|
|
|
|
ldy #fCharCount
|
2020-05-19 13:00:17 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
lda #0
|
2020-05-19 13:00:17 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.1 sta (pData),y
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2020-05-19 13:00:17 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW ZPFullPath
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PUSHBI O.RDONLY+O.TEXT
|
2020-05-19 13:00:17 +00:00
|
|
|
|
>PUSHBI 0 Type
|
|
|
|
|
>PUSHWZ Aux type
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>SYSCALL FOpen
|
|
|
|
|
bcs .9
|
2020-05-19 13:00:17 +00:00
|
|
|
|
|
2020-08-02 12:19:43 +00:00
|
|
|
|
sta hFile
|
2019-09-20 15:15:06 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CloseFile
|
2020-08-02 12:19:43 +00:00
|
|
|
|
lda hFile
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FClose
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bcs .9
|
2020-08-02 12:19:43 +00:00
|
|
|
|
|
|
|
|
|
stz hFile
|
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.IncFChar phy
|
|
|
|
|
ldy #fCharCount
|
|
|
|
|
bra CS.RUN.IncF
|
|
|
|
|
|
|
|
|
|
CS.RUN.IncFLine phy
|
|
|
|
|
ldy #fLineCount
|
|
|
|
|
bra CS.RUN.IncF
|
|
|
|
|
|
|
|
|
|
CS.RUN.IncFWord phy
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
ldy #fWordCount
|
2021-07-28 16:50:59 +00:00
|
|
|
|
|
|
|
|
|
CS.RUN.IncF ldx #4
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
.1 lda (pData),y
|
2019-09-20 15:15:06 +00:00
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bne .8
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
iny
|
|
|
|
|
dex
|
2021-07-28 16:50:59 +00:00
|
|
|
|
bne .1
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.8 ply
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2019-09-20 15:15:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.AddFstat2Tstat
|
|
|
|
|
>PUSHL.G fWordCount
|
|
|
|
|
>PUSHL.G tWordCount
|
2021-05-19 12:44:47 +00:00
|
|
|
|
>FPU uADD
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PULLL.G tWordCount
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PUSHL.G fLineCount
|
|
|
|
|
>PUSHL.G tLineCount
|
2021-05-19 12:44:47 +00:00
|
|
|
|
>FPU uADD
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PULLL.G tLineCount
|
|
|
|
|
|
|
|
|
|
>PUSHL.G fCharCount
|
|
|
|
|
>PUSHL.G tCharCount
|
2021-05-19 12:44:47 +00:00
|
|
|
|
>FPU uADD
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PULLL.G tCharCount
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.PrintFstat
|
2020-08-02 12:19:43 +00:00
|
|
|
|
sec
|
|
|
|
|
bit bTotal
|
|
|
|
|
bmi .19
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
bit bWord
|
|
|
|
|
bpl .10
|
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
|
|
|
|
|
.10 bit bLine
|
|
|
|
|
bpl .11
|
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
|
|
|
|
|
.11 bit bChar
|
2022-12-23 16:50:50 +00:00
|
|
|
|
bpl .12
|
2020-08-02 12:19:43 +00:00
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
|
|
|
|
|
.12 cpx #2
|
2022-12-23 16:50:50 +00:00
|
|
|
|
|
2020-08-02 12:19:43 +00:00
|
|
|
|
.19 ror bTabbed
|
|
|
|
|
|
2019-12-07 13:20:04 +00:00
|
|
|
|
bit bWord
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2020-08-02 12:19:43 +00:00
|
|
|
|
jsr CS.RUN.PUSHFMT
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PUSHL.G fWordCount
|
2020-05-25 21:03:11 +00:00
|
|
|
|
>PUSHBI 4
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
bcs .9
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
.1 bit bLine
|
|
|
|
|
bpl .2
|
|
|
|
|
|
2020-08-02 12:19:43 +00:00
|
|
|
|
jsr CS.RUN.PUSHFMT
|
2019-12-07 13:20:04 +00:00
|
|
|
|
>PUSHL.G fLineCount
|
2020-05-25 21:03:11 +00:00
|
|
|
|
>PUSHBI 4
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
bcs .9
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
.2 bit bChar
|
|
|
|
|
bpl .3
|
|
|
|
|
|
2020-08-02 12:19:43 +00:00
|
|
|
|
jsr CS.RUN.PUSHFMT
|
2019-12-07 13:20:04 +00:00
|
|
|
|
>PUSHL.G fCharCount
|
2020-05-25 21:03:11 +00:00
|
|
|
|
>PUSHBI 4
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2020-05-25 21:03:11 +00:00
|
|
|
|
bcs .9
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
2022-12-23 16:50:50 +00:00
|
|
|
|
.3 bit bTabbed
|
|
|
|
|
bpl .4
|
|
|
|
|
|
|
|
|
|
>LDYA ZPRelPath
|
2020-05-25 21:03:11 +00:00
|
|
|
|
>SYSCALL PutS
|
2022-12-23 16:50:50 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.4 >PUSHW L.MSG.CRLF
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>SYSCALL PrintF
|
2020-05-25 21:03:11 +00:00
|
|
|
|
.9
|
|
|
|
|
CS.RUN.PrintFstat.RTS
|
2019-09-20 15:15:06 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-08-02 12:19:43 +00:00
|
|
|
|
CS.RUN.PUSHFMT bit bTabbed
|
|
|
|
|
bmi .1
|
|
|
|
|
|
|
|
|
|
>PUSHW L.MSG.LONG
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 >PUSHW L.MSG.LONGTAB
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-09-20 15:15:06 +00:00
|
|
|
|
CS.RUN.PrintTstat
|
2020-05-25 21:03:11 +00:00
|
|
|
|
clc
|
2020-08-02 12:19:43 +00:00
|
|
|
|
bit bTotal
|
2020-05-25 21:03:11 +00:00
|
|
|
|
bpl CS.RUN.PrintFstat.RTS
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
bit bWord
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
>PUSHW L.MSG.LONGTAB
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PUSHL.G tWordCount
|
2020-05-25 21:03:11 +00:00
|
|
|
|
>PUSHBI 4
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
bcs .9
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
.1 bit bLine
|
|
|
|
|
bpl .2
|
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
>PUSHW L.MSG.LONGTAB
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PUSHL.G tLineCount
|
2020-05-25 21:03:11 +00:00
|
|
|
|
>PUSHBI 4
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
bcs .9
|
2019-12-07 13:20:04 +00:00
|
|
|
|
|
|
|
|
|
.2 bit bChar
|
|
|
|
|
bpl .3
|
|
|
|
|
|
2021-07-28 16:50:59 +00:00
|
|
|
|
>PUSHW L.MSG.LONGTAB
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>PUSHL.G tCharCount
|
2020-05-25 21:03:11 +00:00
|
|
|
|
>PUSHBI 4
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2020-05-25 21:03:11 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
.3 >LDYA L.MSG.TOTAL
|
|
|
|
|
>SYSCALL PutS
|
|
|
|
|
.9 rts
|
2019-09-20 15:15:06 +00:00
|
|
|
|
*--------------------------------------
|
2019-04-17 15:31:18 +00:00
|
|
|
|
CS.DOEVENT sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2023-07-12 17:07:55 +00:00
|
|
|
|
CS.QUIT jsr X.LeaveSubDir
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bcc CS.QUIT
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2023-07-14 10:24:49 +00:00
|
|
|
|
>LDA.G hInclude
|
2019-04-17 15:31:18 +00:00
|
|
|
|
beq .1
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-08-02 12:19:43 +00:00
|
|
|
|
.1 lda hSrcFullPath
|
2019-09-20 15:15:06 +00:00
|
|
|
|
beq .2
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-08-02 12:19:43 +00:00
|
|
|
|
.2 lda hMem
|
2019-04-17 15:31:18 +00:00
|
|
|
|
beq .8
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2019-09-20 15:15:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CheckOpt ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
ldx #OptionVars-OptionList-1
|
|
|
|
|
|
|
|
|
|
.2 cmp OptionList,x
|
|
|
|
|
beq .3
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2020-05-25 21:03:11 +00:00
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.3 ldy OptionVars,x
|
|
|
|
|
lda #$ff
|
|
|
|
|
sta 0,y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-25 14:54:30 +00:00
|
|
|
|
.INB usr/src/shared/x.fileenum.s
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2019-09-20 15:15:06 +00:00
|
|
|
|
OptionList .AS "CRMLWcrmlw"
|
2019-04-17 15:31:18 +00:00
|
|
|
|
OptionVars .DA #bContinue,#bRecurse,#bChar,#bLine,#bWord
|
|
|
|
|
.DA #bContinue,#bRecurse,#bChar,#bLine,#bWord
|
|
|
|
|
*--------------------------------------
|
2022-11-02 06:54:30 +00:00
|
|
|
|
MSG.USAGE .CS "Usage : WC File(s) (*,? wildcards allowed)\r\n"
|
|
|
|
|
.CS " -C : Continue on error\r\n"
|
|
|
|
|
.CS " -R : Recurse subdirectories\r\n"
|
|
|
|
|
.CS " -M : Print the CHAR counts\r\n"
|
|
|
|
|
.CS " -L : Print the LINE counts\r\n"
|
2022-12-23 16:50:50 +00:00
|
|
|
|
.CS " -W : Print the WORD counts"
|
|
|
|
|
MSG.CRLF .CZ "\r\n"
|
2022-11-02 06:54:30 +00:00
|
|
|
|
MSG.ERR .CZ "[%h]\r\n"
|
|
|
|
|
MSG.LONG .CZ "%L"
|
|
|
|
|
MSG.LONGTAB .CZ "%10L "
|
|
|
|
|
MSG.TOTAL .CZ "(total)"
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
fCharCount .BS 4
|
|
|
|
|
fLineCount .BS 4
|
|
|
|
|
fWordCount .BS 4
|
|
|
|
|
|
|
|
|
|
tCharCount .BS 4
|
|
|
|
|
tLineCount .BS 4
|
|
|
|
|
tWordCount .BS 4
|
|
|
|
|
|
2020-08-25 14:54:30 +00:00
|
|
|
|
.INB usr/src/shared/x.fileenum.g
|
2019-04-17 15:31:18 +00:00
|
|
|
|
|
2020-08-25 14:54:30 +00:00
|
|
|
|
DS.END .ED
|
2019-04-17 15:31:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-08-02 12:19:43 +00:00
|
|
|
|
SAVE usr/src/bin/wc.s
|
2019-04-17 15:31:18 +00:00
|
|
|
|
ASM
|