From 786ff8b5c80e56cfe1f519d64caeae57be8db389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20GIBERT?= Date: Sat, 26 Jan 2019 16:33:03 +0000 Subject: [PATCH] Kernel 0.92 --- BIN/CSH.D.txt | 36 +++++++++ BIN/CSH.E.txt | 31 +++++++ BIN/CSH.I.txt | 103 ++++++++++++++++++++++++ BIN/{SHELL.R.CSH.txt => CSH.R.txt} | 4 +- BIN/{SHELL.S.CSH.txt => CSH.S.CORE.txt} | 35 +------- BIN/CSH.S.txt | 24 +++--- 6 files changed, 188 insertions(+), 45 deletions(-) create mode 100644 BIN/CSH.D.txt create mode 100644 BIN/CSH.E.txt create mode 100644 BIN/CSH.I.txt rename BIN/{SHELL.R.CSH.txt => CSH.R.txt} (90%) rename BIN/{SHELL.S.CSH.txt => CSH.S.CORE.txt} (89%) diff --git a/BIN/CSH.D.txt b/BIN/CSH.D.txt new file mode 100644 index 00000000..d89b4348 --- /dev/null +++ b/BIN/CSH.D.txt @@ -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 diff --git a/BIN/CSH.E.txt b/BIN/CSH.E.txt new file mode 100644 index 00000000..98d0d59d --- /dev/null +++ b/BIN/CSH.E.txt @@ -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 diff --git a/BIN/CSH.I.txt b/BIN/CSH.I.txt new file mode 100644 index 00000000..6517c033 --- /dev/null +++ b/BIN/CSH.I.txt @@ -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 diff --git a/BIN/SHELL.R.CSH.txt b/BIN/CSH.R.txt similarity index 90% rename from BIN/SHELL.R.CSH.txt rename to BIN/CSH.R.txt index 83342291..4e4a74d1 100644 --- a/BIN/SHELL.R.CSH.txt +++ b/BIN/CSH.R.txt @@ -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 diff --git a/BIN/SHELL.S.CSH.txt b/BIN/CSH.S.CORE.txt similarity index 89% rename from BIN/SHELL.S.CSH.txt rename to BIN/CSH.S.CORE.txt index 50895e5b..8cd99bf7 100644 --- a/BIN/SHELL.S.CSH.txt +++ b/BIN/CSH.S.CORE.txt @@ -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 diff --git a/BIN/CSH.S.txt b/BIN/CSH.S.txt index 1e81f53d..8ab35aad 100644 --- a/BIN/CSH.S.txt +++ b/BIN/CSH.S.txt @@ -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 *--------------------------------------