Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-09-05 08:43:09 +02:00
parent 4af39d70ad
commit b5068a2b60
5 changed files with 72 additions and 62 deletions

Binary file not shown.

View File

@ -3,7 +3,12 @@ NEW
.LIST OFF
*--------------------------------------
CSH.E.SYNTAX .EQ $C0
CSH.E.STACKERR .EQ $C2
CSH.E.SOVERFLW .EQ $C3
*E.NOWHILE .EQ $C4
*E.NOFOR .EQ $C5
*E.NOIF .EQ $C6
CSH.E.UNEXPEOF .EQ $C8
CSH.E.UNDEF .EQ $C9
*
CSH.E.NOVERFLW .EQ $D0

View File

@ -74,10 +74,7 @@ CSH.Run.1 cmp #'#'
tax
jmp (J.CSH.KW.END,x)
.4 pha
jsr CSH.SavePtr Save Ptr, in case of while,for....
pla
jsr CSH.IsLetter
.4 jsr CSH.IsLetter
bcc .5
@ -85,7 +82,8 @@ CSH.Run.1 cmp #'#'
bra .99 error, todo : PREOPS ++ --.....
.5 >LDYA L.CSH.KW
.5 jsr CSH.SavePtr Save Ptr, in case of while,for....
>LDYA L.CSH.KW
jsr CSH.LookupID
bcs .6 not an internal CSH keyword....
@ -169,14 +167,13 @@ CSH.IF jsr CSH.GetCharNB
cmp #'{'
bne .9
jsr CSH.IsValue0 X = var type from ExpEval
bcc .6 Value=0, skip {{....}}
jsr CSH.GetNextCharNB Skip '{'
bcs .99
jsr CSH.Keyword.start
bcs .99
jsr CSH.IsValue0 X = var type from ExpEval
bcc .6 Value=0, skip {{....}}
lda #'}' Tell '}' is expected at the end of block
jsr CSH.Push
@ -184,26 +181,7 @@ CSH.IF jsr CSH.GetCharNB
rts
.6 ldx #1 expecting 1 '}' for now....
.7 jsr CSH.GetNextCharNB
bcs .9
cmp #'{'
bne .71
inx
bra .7
.71 cmp #'}'
bne .7
txa
beq .9
dex
bne .7
jsr CSH.GetNextCharNB skip '}'
clc
rts
.6 jmp CSH.SkipBlock
.9 lda #CSH.E.SYNTAX
sec
@ -236,6 +214,7 @@ CSH.WHILE.END jsr CSH.Pop
rts
*--------------------------------------
CSH.ELSE
*--------------------------------------
CSH.DO
CSH.FOR
CSH.SWITCH
@ -943,7 +922,8 @@ CSH.GetVarValueOnStack
* Input : Value on Stack, X = Var Type
* Output : CC = true, CS = false
*--------------------------------------
CSH.IsValue0 cpx #CSH.T.FLOAT
CSH.IsValue0 >DEBUG
cpx #CSH.T.FLOAT
bcc .1 char,int,long
ldy CSH.TYPESIZE,x
@ -954,15 +934,13 @@ CSH.IsValue0 cpx #CSH.T.FLOAT
.8 clc
rts
.1 tax
lda CSH.TYPESIZE,x
.1 jsr CSH.SIZEOF
tax
lda #0
ldy #1
.2 ora ZPVarData,y
iny
.2 ora (pStack)
inc pStack
dex
bne .2
@ -1039,6 +1017,22 @@ CSH.BOPS.LOR
*--------------------------------------
* Stack
*--------------------------------------
CSH.CheckStack tax
>LDA.G CSH.StackPtr
beq .9
dec
tay
txa
cmp (ZPCSHStack),y
bne .9
clc
rts
.9 lda #CSH.E.SYNTAX
sec
rts
*--------------------------------------
CSH.Push pha
>LDA.G CSH.StackPtr
inc
@ -1065,25 +1059,6 @@ CSH.Pop >LDA.G CSH.StackPtr
clc
rts
.9 lda #CSH.E.SYNTAX
sec
rts
*--------------------------------------
CSH.CheckStack tax
>LDA.G CSH.StackPtr
beq .9
dec
tay
txa
cmp (ZPCSHStack),y
bne .9
tya
>STA.G CSH.StackPtr
clc
rts
.9 lda #CSH.E.SYNTAX
sec
rts
@ -1114,6 +1089,26 @@ CSH.GetIDLen ldy #0
.8 tya
rts
*--------------------------------------
CSH.SkipBlock ldx #1 expecting 1 '}' for now....
.1 jsr CSH.GetNextCharNB
bcs .9
cmp #'{'
bne .2
inx
bra .1
.2 cmp #'}'
bne .1
txa
beq .9
dex
bne .1
jmp CSH.GetNextCharNB skip '}'
.9 rts
*--------------------------------------
CSH.GetCharNB jsr CSH.GetChar
bcs CSH.GetNextCharNB.RTS
jsr CSH.CheckCharNB
@ -1212,8 +1207,6 @@ CSH.SIZEOF txa
*--------------------------------------
* EXEC
*--------------------------------------
CSH.EXEC jmp (J.CSH.EXEC,x)
*--------------------------------------
EXEC.printf >SYSCALL printf2
rts
*--------------------------------------

View File

@ -54,6 +54,7 @@ CS.START cld
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.GREETINGS .DA MSG.GREETINGS
L.MSG.USAGE .DA MSG.USAGE
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
L.MSG.HEXWORD .DA MSG.HEXWORD
L.MSG.ERR .DA MSG.ERR
@ -119,11 +120,15 @@ CS.RUN lda #$ff
sec
rts
.8 lda #0
.8 lda #0 Exit Code = Success
sec
rts
.90 lda #E.SYN Exit Code = Succes
.90 >PUSHBI 0
>LDYA L.MSG.USAGE
>SYSCALL printf
lda #E.SYN
sec QUIT Process
.99 rts
*--------------------------------------
@ -247,15 +252,22 @@ CS.END
* Initialized DATA
*--------------------------------------
MSG.Greetings .AZ "\r\nCSH-Shell %d.%d\r\n\r\n"
MSG.USAGE .AS "Usage : CSH file\r\n"
.AS " -D : Debug Mode\r\n"
.AS " -T : Trace On"
MSG.ECHOCRLF .AZ "\r\n"
MSG.HEXWORD .AZ "[%H]"
MSG.ERR .AZ " ^\r\nLine #%D:"
*--------------------------------------
OptionList >PSTR "DdTt"
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
*--------------------------------------
.INB USR/SRC/BIN/CSH.I
*--------------------------------------
.DUMMY
.OR 0
DS.START .INB USR/SRC/BIN/CSH.D
bDebug .BS 1
bTrace .BS 1
DS.END
.ED