Kernel 0.93

This commit is contained in:
Rémy GIBERT 2019-04-17 16:31:18 +01:00
parent 7df7823042
commit 7b9cacc21d
5 changed files with 492 additions and 91 deletions

Binary file not shown.

View File

@ -33,7 +33,7 @@ CS.START cld
.DA 0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #16 Stack Size
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
@ -86,11 +86,12 @@ CS.RUN >INC.G ArgIndex
*--------------------------------------
.4 >LDA.G ArcName
bne .5
>LDA.G ArgIndex
>STA.G ArcName
bra CS.RUN
bcc CS.RUN
rts
.5 >LDA.G hSrcFullPath
.5 >LDA.G hSrcBasePath
bne .9
>LDYA ZPPtr1
@ -98,7 +99,13 @@ CS.RUN >INC.G ArgIndex
bcc CS.RUN
rts
.8 >LDYAI 256
.8 >LDA.G ArcName
beq .9
>LDA.G hSrcBasePath
beq .9
>LDYAI 256
>SYSCALL getmem
bcs .99
>STYA ZPFullPath
@ -111,73 +118,69 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
bcs .99
tay
beq .10
beq .1
>SYSCALL GetChar
bcs .99
cmp #$03 Ctrl-C
beq .92 Abort....
beq .99 Abort....
cmp #$13 Ctrl-S
bne .10
bne .1
>LDA.G bPause
eor #$ff
sta (pData),y
bne .80
.10 >LDA.G bPause
bne .80 Pause...
bne CS.RUN.LOOP
.1 >LDA.G bPause
bne CS.RUN.LOOP Pause...
jsr GetEntry
bcs .9
>LDA.G hFilter
beq .4 No filter....
pha
ldy #S.STAT.FSID
lda (ZPFileStat),y
bne .11 not prodos...
pla
>SYSCALL GetMemPtr
>SYSCALL strupr
bra .12
.11 pla
>SYSCALL GetMemPtr
.12 jsr StrMatch
bcs .8 no match, skip....
.4 ldy #S.STAT.P.DRIVE
ldy #S.STAT.P.DRIVE
lda (ZPFileStat),y ProDOS Device ?
bne CS.RUN.DEV
beq .5
ldy #S.STAT.P.TYPE
jsr CS.RUN.DEV
bcc CS.RUN.LOOP
rts
.5 ldy #S.STAT.P.TYPE
lda (ZPFileStat),y
cmp #$0F Directory ?
bne CS.RUN.FILE
bne .6
jmp CS.RUN.DIR
jsr CS.RUN.DIR
bcs .99
bra .8
.6 jsr CS.RUN.FILE
bcs .99
bra .8
.9 jsr LeaveSubDir
bcs .92
bcs .90
jsr BasePath..
.8 jsr GetNextEntry
.80 clc
rts
jmp CS.RUN.LOOP
.92 lda #0
.90 lda #0
sec
.99 rts
*--------------------------------------
CS.RUN.DIR jsr CS.RUN.GetFilePath
CS.RUN.DEV lda #E.BADPATH
sec
rts
*--------------------------------------
CS.RUN.DIR lda (ZPFileName)
cmp #'.'
beq .8
jsr CS.RUN.GetFilePath
>PUSHW ZPFullPath
@ -186,16 +189,39 @@ CS.RUN.DIR jsr CS.RUN.GetFilePath
>SYSCALL printf
bcs .9
.8 jsr GetNextEntry
clc
jsr CS.RUN.CheckErr
>LDA.G bRecurse
bpl .8
>LDYA ZPFileName
jsr EnterSubDirYA
rts
.8 clc
.9 rts
*--------------------------------------
CS.RUN.DEV
.8 jsr GetNextEntry
clc
.9 rts
*--------------------------------------
CS.RUN.FILE jsr CS.RUN.GetFilePath
CS.RUN.FILE >LDA.G hFilter
beq .3 No filter....
pha
ldy #S.STAT.FSID
lda (ZPFileStat),y
bne .1 not prodos...
pla
>SYSCALL GetMemPtr
>SYSCALL strupr
bra .2
.1 pla
>SYSCALL GetMemPtr
.2 jsr StrMatch
bcs .8 no match, skip....
.3 jsr CS.RUN.GetFilePath
>PUSHW ZPFullPath
@ -204,21 +230,11 @@ CS.RUN.FILE jsr CS.RUN.GetFilePath
>SYSCALL printf
bcs .9
jsr CS.RUN.CheckErr
>LDA.G bRecurse
bpl .8
lda (ZPFileName)
cmp #'.'
beq .8
>LDYA ZPFileName
jsr EnterSubDirYA
rts
.8 jsr GetNextEntry
clc
.8 clc
.9 rts
*--------------------------------------
CS.RUN.CheckErr bcs .1
@ -282,13 +298,19 @@ MSG.USAGE .AS "Usage : PAK Archive [File *,? wildcards allowed]\r\n"
.AZ " -R : Recurse subdirectories\r\n"
MSG.OK .AZ "[OK]"
MSG.ERR .AZ "[%h]\r\n"
MSG.DIR .AZ "Adding Dir :%S..."
MSG.FILE .AZ "Adding File:%S..."
MSG.DIR .AZ "Reading Dir:%s..."
MSG.FILE .AZ "Adding File:%s..."
*--------------------------------------
.DUMMY
.OR 0
DS.START
ArgIndex .BS 1
bContinue .BS 1
bRecurse .BS 1
ArcName .BS 1
bPause .BS 1
hFullPath .BS 1
hSrcFullPath .BS 1
@ -299,10 +321,7 @@ hDIRENTs .BS X.MAX.RECURSE
oDIRENTs .BS X.MAX.RECURSE*2
hSrcBasePath .BS 1
hFilter .BS 1
bPause .BS 1
bContinue .BS 1
bRecurse .BS 1
ArcName .BS 1
DS.END
.ED
*--------------------------------------

View File

@ -55,6 +55,11 @@ L.MSG.ROOTPWD2 .DA MSG.ROOTPWD2
L.MSG.MISMATCH .DA MSG.MISMATCH
L.MSG.BS .DA MSG.BS
L.MSG.CRLF .DA MSG.CRLF
J.CS.RUN.CheckArg
.DA CS.RUN.CheckArg.C
.DA CS.RUN.CheckArg.D
.DA CS.RUN.CheckArg.P
.DA CS.RUN.CheckArg.S
.DA 0
*--------------------------------------
* Called once at process creation
@ -90,10 +95,25 @@ CS.RUN >LDYAI S.PW
jmp CS.RUN.ROOT
.1 jsr CS.RUN.CheckArg
bcs .99
.1 ldy #S.PW-1
.2 lda PW.DEFAULT,y
sta (pData),y
dey
bpl .2
jsr CS.RUN.CheckArg
bcs .9
>PUSHBI 0
jsr CS.RUN.CheckDir
bcs .99
>LDYA pData
>SYSCALL putpw
sec
rts
.9 >PUSHBI 0
>LDYA L.MSG.USAGE
>SYSCALL printf
@ -212,8 +232,7 @@ CS.RUN.GetStr stz ZPStrLen
.9 rts
*--------------------------------------
CS.RUN.CheckArg
.1 inc ArgCount
CS.RUN.CheckArg inc ArgCount
lda ArgCount
>SYSCALL ArgV
bcs .8
@ -236,28 +255,56 @@ CS.RUN.CheckArg
sec
rts
.3 ldy OptionVars-1,x
lda #$80
sta (pData),y
bra .1
.3 txa
and #$fe
tax
jmp (J.CS.RUN.CheckArg,x)
.4 lda ArgUsername
bne .9
ldy #$ff
lda pData
clc
adc #S.PW.DIR+11
sta ZPPWPtr
lda pData+1
adc /S.PW.DIR+11
sta ZPPWPtr+1
.5 iny
lda (ZPStrPtr),y
sta
lda ArgCount
ldy #0
.5 lda (ZPStrPtr),y
sta (PW),y
sta (ZPPWPtr),y
beq .6
iny
cpy #16
bne .5
bra .9
.6 lda ArgCount
sta ArgUsername
bra .1
bra CS.RUN.CheckArg
.8 lda ArgUsername
beq .9
clc
rts
.9 lda #E.SYN
sec
rts
CS.RUN.CheckArg.C
CS.RUN.CheckArg.D
CS.RUN.CheckArg.P
CS.RUN.CheckArg.S
jmp CS.RUN.CheckArg
*--------------------------------------
CS.RUN.CheckDir
clc
rts
*--------------------------------------
* Called if option S.PS.F.EVENT enabled in Header
* Timer Event : every 10th seconds
@ -288,7 +335,7 @@ CS.QUIT lda ZPhStr
*--------------------------------------
CS.END
*--------------------------------------
OptionList >PSTR "CDPScdps"
OptionList >PSTR "CcDdPpSs"
*--------------------------------------
* Initialized DATA
*--------------------------------------
@ -308,7 +355,7 @@ MSG.BS .DA #C.BS,#C.SPACE,#C.BS,#0
*--------------------------------------
PW.ROOT .AS "ROOT"
.BS 17-4
.BS 33 PASSWD
.HS D41D8CD98F00B204E9800998ECF8427E00
.DA #0 UID
.DA #0 GID
.AS "Root User"
@ -319,7 +366,7 @@ PW.ROOT .AS "ROOT"
.BS 65-13
*--------------------------------------
PW.DEFAULT .BS 17 NAME
.BS 33 PASSWD
.HS D41D8CD98F00B204E9800998ECF8427E00
.DA #0 UID
.DA #0 GID
.BS 65 GECOS

335
BIN/WC.S.txt Normal file
View File

@ -0,0 +1,335 @@
NEW
PREFIX
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/WC
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/MLI.I
.INB INC/MLI.E.I
*--------------------------------------
X.COPY.TO.DEST .EQ 0
X.DELETE.SOURCE .EQ 0
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPFileName .BS 2
ZPFileStat .BS 2
ZPFullPath .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
.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
L.MSG.DIR .DA MSG.DIR
L.MSG.FILE .DA MSG.FILE
L.MSG.OK .DA MSG.OK
L.MSG.ERR .DA MSG.ERR
.DA 0
*--------------------------------------
CS.INIT clc
rts
*--------------------------------------
CS.RUN >INC.G ArgIndex
>SYSCALL ArgV
bcs .8
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
ldy #1
lda (ZPPtr1),y
ldx OptionList
.2 cmp OptionList,x
beq .3
dex
bne .2
.9 >PUSHBI 0
>LDYA L.MSG.USAGE
>SYSCALL printf
lda #E.SYN
sec
.99 rts
.3 ldy OptionVars-1,x
lda #$80
sta (pData),y
bra CS.RUN
*--------------------------------------
.4 >LDA.G hSrcBasePath
bne .9
>LDYA ZPPtr1
jsr InitSrcDirYA
bcc CS.RUN
rts
.8 >LDA.G hSrcBasePath
beq .9
>LDYAI 256
>SYSCALL getmem
bcs .99
>STYA ZPFullPath
txa
>STA.G hSrcFullPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL feof
bcs .99
tay
beq .10
>SYSCALL GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .10
>LDA.G bPause
eor #$ff
sta (pData),y
bne CS.RUN.LOOP
.10 >LDA.G bPause
bne CS.RUN.LOOP Pause...
jsr GetEntry
bcs .9
ldy #S.STAT.P.DRIVE
lda (ZPFileStat),y ProDOS Device ?
bne .5
jsr CS.RUN.DEV
bcc CS.RUN.LOOP
rts
.5 ldy #S.STAT.P.TYPE
lda (ZPFileStat),y
cmp #$0F Directory ?
bne .6
jsr CS.RUN.DIR
bcc CS.RUN.LOOP
rts
.6 jsr CS.RUN.FILE
bcc CS.RUN.LOOP
rts
.9 jsr LeaveSubDir
bcs .90
jsr BasePath..
.8 jsr GetNextEntry
jmp CS.RUN.LOOP
.90 lda #0
sec
.99 rts
*--------------------------------------
CS.RUN.DIR jsr CS.RUN.GetFilePath
>PUSHW ZPFullPath
>PUSHBI 2
>LDYA L.MSG.DIR
>SYSCALL printf
bcs .9
.8 jsr GetNextEntry
clc
.9 rts
*--------------------------------------
CS.RUN.DEV
.8 jsr GetNextEntry
clc
.9 rts
*--------------------------------------
CS.RUN.FILE >LDA.G hFilter
beq .3 No filter....
pha
ldy #S.STAT.FSID
lda (ZPFileStat),y
bne .1 not prodos...
pla
>SYSCALL GetMemPtr
>SYSCALL strupr
bra .2
.1 pla
>SYSCALL GetMemPtr
.2 jsr StrMatch
bcs .8 no match, skip....
.3 jsr CS.RUN.GetFilePath
>PUSHW ZPFullPath
>PUSHBI 2
>LDYA L.MSG.FILE
>SYSCALL printf
bcs .9
jsr CS.RUN.CheckErr
>LDA.G bRecurse
bpl .8
lda (ZPFileName)
cmp #'.'
beq .8
>LDYA ZPFileName
jsr EnterSubDirYA
rts
.8 jsr GetNextEntry
clc
.9 rts
*--------------------------------------
CS.RUN.CheckErr bcs .1
>LDYA L.MSG.OK
>SYSCALL puts
rts
.1 pha
>PUSHA
>PUSHBI 1
>LDYA L.MSG.ERR
>SYSCALL printf
>LDA.G bContinue
eor #$80
asl
pla
rts
*--------------------------------------
CS.RUN.GetFilePath
>LDA.G hSrcBasePath
>SYSCALL GetMemPtr
>PUSHYA
>LDYA ZPFullPath
>SYSCALL StrCpy
>PUSHW ZPFileName
>LDYA ZPFullPath
>SYSCALL StrCat
rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
CS.QUIT jsr LeaveSubDir
bcc CS.QUIT
>LDA.G hFilter
beq .1
>SYSCALL FreeMem
.1 >LDA.G hSrcFullPath
beq .8
>SYSCALL FreeMem
.8 clc
rts
*--------------------------------------
.INB USR/SRC/BIN/X.FILEENUM.S
*--------------------------------------
CS.END
*--------------------------------------
OptionList >PSTR "CRMLWcrmlw"
OptionVars .DA #bContinue,#bRecurse,#bChar,#bLine,#bWord
.DA #bContinue,#bRecurse,#bChar,#bLine,#bWord
*--------------------------------------
MSG.USAGE .AS "Usage : PAK Archive [File *,? wildcards allowed]\r\n"
.AS " -C : Continue on error\r\n"
.AS " -R : Recurse subdirectories\r\n"
.AS " -M : Print the CHAR counts\r\n"
.AS " -L : Print the LINE counts\r\n"
.AZ " -W : Print the WORD counts\r\n"
MSG.OK .AZ "[OK]"
MSG.ERR .AZ "[%h]\r\n"
MSG.DIR .AZ "Adding Dir :%S..."
MSG.FILE .AZ "Adding File:%S..."
*--------------------------------------
.DUMMY
.OR 0
DS.START
ArgIndex .BS 1
bContinue .BS 1
bRecurse .BS 1
bChar .BS 1
bLine .BS 1
bWord .BS 1
bPrintTotal .BS 1
fCharCount .BS 4
fLineCount .BS 4
fWordCount .BS 4
tCharCount .BS 4
tLineCount .BS 4
tWordCount .BS 4
bPause .BS 1
hFullPath .BS 1
hSrcFullPath .BS 1
STAT .BS S.STAT
Index .BS 1
hDIRs .BS X.MAX.RECURSE
hDIRENTs .BS X.MAX.RECURSE
oDIRENTs .BS X.MAX.RECURSE*2
hSrcBasePath .BS 1
hFilter .BS 1
DS.END
.ED
*--------------------------------------
MAN
SAVE USR/SRC/BIN/WC.S
ASM

View File

@ -126,7 +126,7 @@ PWD.PutPW >LDYA ZPPtr2
jmp PWD.InitDB
.1
.1
.9 lda #E.IPWDDB
sec