Kernel 0.92

This commit is contained in:
Rémy GIBERT 2019-01-26 16:33:03 +00:00
parent 30687b8c52
commit 786ff8b5c8
6 changed files with 188 additions and 45 deletions

36
BIN/CSH.D.txt Normal file
View File

@ -0,0 +1,36 @@
NEW
PREFIX
AUTO 4,1
.LIST OFF
*--------------------------------------
hFileBuf .BS 1
CSH.BufPtrSave .BS 2
CSH.hSymbols .BS 1
CSH.SymbolsPtr .BS 1
CSH.hData .BS 1
CSH.DataPtr .BS 1
CSH.hStack .BS 1
CSH.StackPtr .BS 1
CSH.CmdSave .BS 1
CSH.ACCT .BS 1
CSH.ACC .BS 5
CSH.EXPBOP1 .BS 1
CSH.ARGT .BS 1
CSH.ARG .BS 5
CSH.EXPBOP2 .BS 1
CSH.LookupOpt .BS 1
*--------------------------------------
MAN
SAVE USR/SRC/BIN/CSH.D
LOAD USR/SRC/BIN/CSH.S
ASM

31
BIN/CSH.E.txt Normal file
View File

@ -0,0 +1,31 @@
NEW
PREFIX
AUTO 4,1
.LIST OFF
*--------------------------------------
CSH.E.SYNTAX .EQ $7F
CSH.E.SOVERFLW .EQ $7E
CSH.E.NOVERFLW .EQ $7D
CSH.E.OOM .EQ $7C
CSH.E.DUP .EQ $7B
CSH.E.UNDEF .EQ $7A
CSH.E.TMISMATCH .EQ $79
CSH.Q.CONST .EQ %11000000
CSH.Q.ARRAY .EQ %10001100 max 3 bounds
CSH.Q.POINTER1 .EQ %10000001 max 3 depth
CSH.Q.POINTER2 .EQ %10000010
CSH.Q.POINTER3 .EQ %10000011
CSH.T.CHAR .EQ 1
CSH.T.INT .EQ 2
CSH.T.LONG .EQ 3
CSH.T.UCHAR .EQ 4
CSH.T.UINT .EQ 5
CSH.T.ULONG .EQ 6
CSH.T.FLOAT .EQ 7
CSH.T.VARIADIC .EQ $F
*--------------------------------------
MAN
SAVE USR/SRC/BIN/CSH.E
LOAD USR/SRC/BIN/CSH.S
ASM

103
BIN/CSH.I.txt Normal file
View File

@ -0,0 +1,103 @@
NEW
PREFIX
AUTO 4,1
.LIST OFF
*--------------------------------------
CSH.OPChars .AS "!~+-*/%=&|^&<>"
*--------------------------------------
* Pre Operators: + - ! ~ ++ --
*--------------------------------------
CSH.PREOOPS >PSTR "+"
>PSTR "-"
>PSTR "!"
>PSTR "~"
*--------------------------------------
* Post Operators: ++ --
*--------------------------------------
CSH.POSTOPS >PSTR "++"
>PSTR "--"
.HS 00
*--------------------------------------
* Assignment Operators: = += -= *= /= %= <<= >>= &= ^= |=
*--------------------------------------
CSH.AOPS >PSTR "="
>PSTR "+="
>PSTR "-="
>PSTR "*="
>PSTR "/="
>PSTR "%="
>PSTR "<<="
>PSTR ">>="
>PSTR "&="
>PSTR "^="
>PSTR "!="
.HS 00
*-- Binary ---- H to L prececence -----
* Arithmetic Operators: * / %
* Arithmetic Operators: + -
* Shift Operators: << >>
* Relational Operators: < > >= < >= == !=
* Bitwise Operators: & | ^ ~
* Logical Operators: && ||
*--------------------------------------
CSH.BOPS >PSTR "+"
>PSTR "-"
>PSTR "*"
>PSTR "/"
>PSTR "%"
>PSTR "<<"
>PSTR ">>"
>PSTR "<"
>PSTR ">"
>PSTR "<="
>PSTR ">="
>PSTR "=="
>PSTR "!="
>PSTR "&"
>PSTR "|"
>PSTR "^"
>PSTR "&&"
>PSTR "||"
.HS 00
*--------------------------------------
* Reserved Keywords:
*--------------------------------------
CSH.KW >PSTR "if"
>PSTR "while"
>PSTR "else"
>PSTR "do"
>PSTR "for"
>PSTR "switch"
>PSTR "case"
>PSTR "break"
>PSTR "continue"
>PSTR "float"
>PSTR "signed" char,int,long
>PSTR "unsigned" char,int,long
CSH.STYPES >PSTR "char"
>PSTR "int"
>PSTR "long"
.HS 00
CSH.TSIZE .HS 0001020401020405 00,CHAR,INT,LONG,UCHAR,UINT,ULONG,FLOAT....
*--------------------------------------
* int printf ( const char * format, ... );
CSH.FN >PSTR "printf"
.DA #CSH.T.INT returned value
.DA #CSH.Q.CONST+CSH.Q.POINTER1
.DA #CSH.T.CHAR
.DA #CSH.T.VARIADIC
.DA #0
* float cos ( float x );
>PSTR "cos"
.DA #CSH.T.FLOAT returned value
.DA #CSH.T.FLOAT
.DA #0
* int getchar ( void );
>PSTR "getchar"
.DA #CSH.T.INT returned value
.DA #0
*--------------------------------------
MAN
SAVE USR/SRC/BIN/CSH.I
LOAD USR/SRC/BIN/CSH.S
ASM

View File

@ -49,6 +49,6 @@ J.CSH.KW.END .DA CSH.IF.END
.DA CSH.WHILE.END
*--------------------------------------
MAN
SAVE USR/SRC/BIN/SHELL.R.CSH
LOAD USR/SRC/BIN/SHELL.S
SAVE USR/SRC/BIN/CSH.R
LOAD USR/SRC/BIN/CSH.S
ASM

View File

@ -3,28 +3,6 @@ PREFIX
AUTO 4,1
.LIST OFF
*--------------------------------------
CSH.E.SYNTAX .EQ $7F
CSH.E.SOVERFLW .EQ $7E
CSH.E.NOVERFLW .EQ $7D
CSH.E.OOM .EQ $7C
CSH.E.DUP .EQ $7B
CSH.E.UNDEF .EQ $7A
CSH.E.TMISMATCH .EQ $79
CSH.Q.CONST .EQ %11000000
CSH.Q.ARRAY .EQ %10001100 max 3 bounds
CSH.Q.POINTER1 .EQ %10000001 max 3 depth
CSH.Q.POINTER2 .EQ %10000010
CSH.Q.POINTER3 .EQ %10000011
CSH.T.CHAR .EQ 1
CSH.T.INT .EQ 2
CSH.T.LONG .EQ 3
CSH.T.UCHAR .EQ 4
CSH.T.UINT .EQ 5
CSH.T.ULONG .EQ 6
CSH.T.FLOAT .EQ 7
CSH.T.VARIADIC .EQ $F
*--------------------------------------
CSH.Init lda #$0
>STA.G CSH.SymbolsPtr
>STA.G CSH.DataPtr
@ -100,7 +78,7 @@ CSH.Run jsr CSH.GetCharNB
bcc .3
cmp #'#'
beq .5 comments : pass line to shell
beq .80 comments ...
bra .9 error, todo : PREOPS ++ --.....
@ -115,7 +93,7 @@ CSH.Run jsr CSH.GetCharNB
jmp (J.CSH.KW,x)
.4 jsr CSH.GetVar
bcs .5
bcs .9
jsr CSH.GetCharNB
@ -142,12 +120,7 @@ CSH.Run jsr CSH.GetCharNB
sec
.9 rts
.5
jsr CSH.RestorePtr Restore ptr to get full cmd line to execute
jsr CL.GetLine
bcs .99
.80 clc
rts
@ -1095,6 +1068,6 @@ CSH.IsDigit10 cmp #'0'
rts
*--------------------------------------
MAN
SAVE USR/SRC/BIN/SHELL.S.CSH
LOAD USR/SRC/BIN/SHELL.S
SAVE USR/SRC/BIN/CSH.S.CORE
LOAD USR/SRC/BIN/CSH.S
ASM

View File

@ -8,12 +8,19 @@ AUTO 4,1 Enable MASM3 auto line num
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/MLI.E.I
*--------------------------------------
.INB USR/SRC/BIN/CSH.E
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPFileBufPtr .BS 2
ZPCSHSymbols .BS 2
ZPCSHData .BS 2
ZPCSHValue .BS 2
@ -40,11 +47,7 @@ CS.START cld
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
* Add any address you want be relocated by loader
* Usefull if you have to pass EFFECTIVE address to an API call...
* L.MSG.Test .DA Msg.Test
.INB USR/SRC/BIN/CSH.R
.DA 0
*--------------------------------------
* Called once at process creation
@ -81,21 +84,18 @@ CS.DOEVENT sec
*--------------------------------------
CS.QUIT clc
rts
*--------------------------------------
.INB USR/SRC/BIN/CSH.S.CORE
*--------------------------------------
CS.END
*--------------------------------------
* Initialized DATA
*--------------------------------------
* Put your constant here :
* MSG.TEST .AZ "Test Message"
*--------------------------------------
* Per Process DATA segement (0 filled before INIT)
.INB USR/SRC/BIN/CSH.I
*--------------------------------------
.DUMMY
.OR 0
DS.START
DS.START .INB USR/SRC/BIN/CSH.D
DS.END
.ED
*--------------------------------------