mirror of
https://github.com/A2osX/A2osX.git
synced 2024-07-13 13:29:04 +00:00
Kernel 0.93+
This commit is contained in:
parent
9269809d3e
commit
f3a26b40a4
Binary file not shown.
@ -50,7 +50,7 @@ CSH.Quit.RTS rts
|
|||||||
CSH.Run jsr CSH.GetCharNB
|
CSH.Run jsr CSH.GetCharNB
|
||||||
bcs CSH.Quit.RTS
|
bcs CSH.Quit.RTS
|
||||||
|
|
||||||
cmp #'}' End of block ?
|
CSH.Run.1 cmp #'}' End of block ?
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
jsr CSH.CheckStack must be something on stack....
|
jsr CSH.CheckStack must be something on stack....
|
||||||
@ -63,7 +63,7 @@ CSH.Run jsr CSH.GetCharNB
|
|||||||
.1 cmp #C.CR
|
.1 cmp #C.CR
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
jmp CSH.GetNextCharNB Skip CR and exit
|
jmp CSH.GetNextChar Skip CR and exit
|
||||||
|
|
||||||
.2 pha
|
.2 pha
|
||||||
jsr CSH.SavePtr Save Ptr, in case of while,for....
|
jsr CSH.SavePtr Save Ptr, in case of while,for....
|
||||||
@ -84,7 +84,10 @@ CSH.Run jsr CSH.GetCharNB
|
|||||||
txa
|
txa
|
||||||
>STA.G CSH.CmdSave
|
>STA.G CSH.CmdSave
|
||||||
|
|
||||||
jmp (J.CSH.KW,x)
|
jsr CSH.KW.JMP
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
bra .7
|
||||||
|
|
||||||
.4 jsr CSH.GetVar
|
.4 jsr CSH.GetVar
|
||||||
bcs .5
|
bcs .5
|
||||||
@ -94,7 +97,7 @@ CSH.Run jsr CSH.GetCharNB
|
|||||||
cmp #'='
|
cmp #'='
|
||||||
bne .99
|
bne .99
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB Skip =
|
jsr CSH.GetNextChar Skip =
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
jsr CSH.ExpEval
|
jsr CSH.ExpEval
|
||||||
@ -107,13 +110,19 @@ CSH.Run jsr CSH.GetCharNB
|
|||||||
cmp #';'
|
cmp #';'
|
||||||
bne .99
|
bne .99
|
||||||
|
|
||||||
jmp CSH.GetNextCharNB Skip ;
|
bra .7
|
||||||
|
|
||||||
.5 lda #0 no return value type check required
|
.5 lda #0 no return value type check required
|
||||||
jsr CSH.FnEval X = function index
|
jsr CSH.FnEval X = function index
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
jmp CSH.GetNextCharNB Skip ;
|
.7 jsr CSH.GetNextCharNB Skip ;
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
cmp #C.CR
|
||||||
|
bne CSH.Run.1
|
||||||
|
|
||||||
|
jmp CSH.GetNextChar Skip CR
|
||||||
|
|
||||||
.99 lda #CSH.E.SYNTAX
|
.99 lda #CSH.E.SYNTAX
|
||||||
sec
|
sec
|
||||||
@ -126,11 +135,12 @@ CSH.Run jsr CSH.GetCharNB
|
|||||||
cmp #C.CR
|
cmp #C.CR
|
||||||
bne .80
|
bne .80
|
||||||
|
|
||||||
clc
|
jmp CSH.GetNextChar Skip CR
|
||||||
rts
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Built in Keywords
|
* Built in Keywords
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
CSH.KW.JMP jmp (J.CSH.KW,x)
|
||||||
|
|
||||||
CSH.WHILE
|
CSH.WHILE
|
||||||
CSH.IF jsr CSH.GetCharNB
|
CSH.IF jsr CSH.GetCharNB
|
||||||
bcs .9
|
bcs .9
|
||||||
@ -314,7 +324,7 @@ CSH.TYPE stx ZPVarType
|
|||||||
cmp #'='
|
cmp #'='
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB
|
jsr CSH.GetNextCharNB Skip =
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
lda ZPVarType
|
lda ZPVarType
|
||||||
@ -329,8 +339,7 @@ CSH.TYPE stx ZPVarType
|
|||||||
cmp #';'
|
cmp #';'
|
||||||
bne .9
|
bne .9
|
||||||
|
|
||||||
.8 jsr CSH.GetNextCharNB Skip ;
|
.8 clc
|
||||||
clc
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.90 lda #CSH.E.DUP
|
.90 lda #CSH.E.DUP
|
||||||
@ -418,10 +427,17 @@ CSH.FnEval ldx ZPPtr1
|
|||||||
cmp #')'
|
cmp #')'
|
||||||
bne .90
|
bne .90
|
||||||
|
|
||||||
jsr CSH.GetNextCharNB Skip )
|
jsr CSH.GetNextChar Skip )
|
||||||
|
|
||||||
|
plx restore X = function index
|
||||||
|
|
||||||
|
pla
|
||||||
|
sta ZPPtr2
|
||||||
|
pla
|
||||||
|
sta ZPPtr1+1
|
||||||
|
pla
|
||||||
|
sta ZPPtr1
|
||||||
|
|
||||||
jsr .9
|
|
||||||
|
|
||||||
jmp (J.CSH.EXEC,x)
|
jmp (J.CSH.EXEC,x)
|
||||||
|
|
||||||
.90 lda #CSH.E.SYNTAX
|
.90 lda #CSH.E.SYNTAX
|
||||||
@ -445,7 +461,11 @@ CSH.FnEval ldx ZPPtr1
|
|||||||
* CS, A = EC
|
* CS, A = EC
|
||||||
* CC, A, Y,A or x bytes on Stack
|
* CC, A, Y,A or x bytes on Stack
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.ExpEval ldx ZPPtr2
|
CSH.ExpEval ldx ZPPtr1
|
||||||
|
phx
|
||||||
|
ldx ZPPtr1+1
|
||||||
|
phx
|
||||||
|
ldx ZPPtr2
|
||||||
phx
|
phx
|
||||||
ldx ZPPtr2+1 One local : BOP1
|
ldx ZPPtr2+1 One local : BOP1
|
||||||
phx
|
phx
|
||||||
@ -456,14 +476,15 @@ CSH.ExpEval ldx ZPPtr2
|
|||||||
sta ZPPtr2+1 Reset BOP1
|
sta ZPPtr2+1 Reset BOP1
|
||||||
|
|
||||||
jsr CSH.GetCharNB
|
jsr CSH.GetCharNB
|
||||||
bcs .9
|
bcs .33
|
||||||
|
|
||||||
.20 jsr CSH.IsLetter Fnc or Var ?
|
.20 jsr CSH.IsLetter Fnc or Var ?
|
||||||
bcs .2
|
bcs .2
|
||||||
|
|
||||||
|
lda ZPPtr2 var type
|
||||||
jsr CSH.GetVar
|
jsr CSH.GetVar
|
||||||
bcs .1
|
bcs .1
|
||||||
|
|
||||||
jsr CSH.GetVarValue Get value on stack
|
jsr CSH.GetVarValue Get value on stack
|
||||||
bra .11
|
bra .11
|
||||||
|
|
||||||
@ -475,10 +496,10 @@ CSH.ExpEval ldx ZPPtr2
|
|||||||
bcs .3
|
bcs .3
|
||||||
|
|
||||||
jsr CSH.GetNumOnStack
|
jsr CSH.GetNumOnStack
|
||||||
bcs .9
|
bcs .99
|
||||||
|
|
||||||
.11 jsr CSH.GetCharNB
|
.11 jsr CSH.GetCharNB
|
||||||
bcs .9
|
bcs .90
|
||||||
|
|
||||||
cmp #','
|
cmp #','
|
||||||
beq .8
|
beq .8
|
||||||
@ -488,11 +509,11 @@ CSH.ExpEval ldx ZPPtr2
|
|||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
jsr CSH.IsOPChar
|
jsr CSH.IsOPChar
|
||||||
bcs .9
|
.33 bcs .90
|
||||||
|
|
||||||
>LDYA L.CSH.BOPS
|
>LDYA L.CSH.BOPS
|
||||||
jsr CSH.LookupOP
|
jsr CSH.LookupOP
|
||||||
bcs .9
|
bcs .90
|
||||||
|
|
||||||
lda ZPPtr2+1 previous OP...
|
lda ZPPtr2+1 previous OP...
|
||||||
bpl .5 go check precedence
|
bpl .5 go check precedence
|
||||||
@ -503,27 +524,15 @@ CSH.ExpEval ldx ZPPtr2
|
|||||||
|
|
||||||
jsr CSH.GetCharNB
|
jsr CSH.GetCharNB
|
||||||
bcc .20 go check for an ARG
|
bcc .20 go check for an ARG
|
||||||
bra .9
|
bra .90
|
||||||
|
|
||||||
.3 cmp #'"' String literal
|
.3 cmp #'"' String literal
|
||||||
bne .9
|
bne .90
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
jsr CSH.AddContCharP
|
jsr CSH.AddContCharP
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
jmp .11
|
jmp .11
|
||||||
|
|
||||||
|
|
||||||
.9 plx
|
|
||||||
stx ZPPtr2+1
|
|
||||||
plx
|
|
||||||
stx ZPPtr2
|
|
||||||
|
|
||||||
lda #CSH.E.SYNTAX
|
|
||||||
sec
|
|
||||||
.99 rts
|
|
||||||
|
|
||||||
.5 cpx ZPPtr2+1
|
.5 cpx ZPPtr2+1
|
||||||
bcs .6
|
bcs .6
|
||||||
@ -537,23 +546,34 @@ CSH.ExpEval ldx ZPPtr2
|
|||||||
* Old OP has precedence, compute ACC=ARG <BOP> ACC
|
* Old OP has precedence, compute ACC=ARG <BOP> ACC
|
||||||
.6 lda ZPPtr2+1
|
.6 lda ZPPtr2+1
|
||||||
jsr CSH.Compute
|
jsr CSH.Compute
|
||||||
bcs .9
|
bcs .99
|
||||||
|
|
||||||
jsr CSH.GetCharNB
|
jsr CSH.GetCharNB
|
||||||
bcs .9
|
bcs .90
|
||||||
jmp .10
|
jmp .10
|
||||||
|
|
||||||
.8 lda ZPPtr2+1
|
.8 lda ZPPtr2+1
|
||||||
bmi .80
|
bmi .80
|
||||||
|
|
||||||
jmp CSH.Compute
|
jsr CSH.Compute
|
||||||
|
bcc .80
|
||||||
|
bcs .99
|
||||||
|
|
||||||
.80 plx
|
.90 lda #CSH.E.SYNTAX
|
||||||
|
|
||||||
|
.99 sec
|
||||||
|
.HS 90 BCC
|
||||||
|
.80 clc
|
||||||
|
|
||||||
|
plx
|
||||||
stx ZPPtr2+1
|
stx ZPPtr2+1
|
||||||
plx
|
plx
|
||||||
stx ZPPtr2
|
stx ZPPtr2
|
||||||
|
plx
|
||||||
|
stx ZPPtr1+1
|
||||||
|
plx
|
||||||
|
stx ZPPtr1
|
||||||
|
|
||||||
clc
|
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.AddContCharP
|
CSH.AddContCharP
|
||||||
@ -570,18 +590,12 @@ CSH.AddContCharP
|
|||||||
iny
|
iny
|
||||||
bra .1
|
bra .1
|
||||||
|
|
||||||
.2 lda #0
|
.2 lda #0
|
||||||
sta (ZPCSHConst),y
|
sta (ZPCSHConst),y
|
||||||
|
|
||||||
phy
|
>PUSHW ZPCSHConst Push PTR on stack
|
||||||
|
|
||||||
lda #CSH.Q.CONST+CSH.Q.POINTER+CSH.T.CHAR
|
|
||||||
sta ZPVarType
|
|
||||||
|
|
||||||
>LDYA ZPCSHConst
|
tya
|
||||||
>STYA ZPVarData
|
|
||||||
|
|
||||||
pla
|
|
||||||
sec
|
sec
|
||||||
adc ZPCSHConst
|
adc ZPCSHConst
|
||||||
sta ZPCSHConst
|
sta ZPCSHConst
|
||||||
@ -589,7 +603,7 @@ CSH.AddContCharP
|
|||||||
|
|
||||||
inc ZPCSHConst+1
|
inc ZPCSHConst+1
|
||||||
|
|
||||||
.3 jsr CSH.GetNextCharNB Skip "
|
.3 jsr CSH.GetNextChar Skip "
|
||||||
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
@ -698,8 +712,8 @@ CSH.GetNumOnStack
|
|||||||
|
|
||||||
>PUSHWI ZPFileBufPtr
|
>PUSHWI ZPFileBufPtr
|
||||||
>LDYA ZPFileBufPtr
|
>LDYA ZPFileBufPtr
|
||||||
|
|
||||||
>SYSCALL StrToF
|
>SYSCALL StrToF
|
||||||
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.1 >PUSHBI 10
|
.1 >PUSHBI 10
|
||||||
@ -758,7 +772,7 @@ CSH.AddVar sta ZPVarType
|
|||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.GetVar sta ZPVarType
|
CSH.GetVar sta ZPVarType
|
||||||
|
>DEBUG
|
||||||
>PUSHW ZPFileBufPtr
|
>PUSHW ZPFileBufPtr
|
||||||
>LDA.G CSH.hSymbols
|
>LDA.G CSH.hSymbols
|
||||||
>SYSCALL SListLookup
|
>SYSCALL SListLookup
|
||||||
@ -1021,8 +1035,6 @@ CSH.GetNextCharNB.RTS
|
|||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CSH.CheckCharNB cmp #C.SPACE
|
CSH.CheckCharNB cmp #C.SPACE
|
||||||
beq .9
|
|
||||||
cmp #C.CR
|
|
||||||
beq .9
|
beq .9
|
||||||
cmp #C.LF
|
cmp #C.LF
|
||||||
beq .9
|
beq .9
|
||||||
|
111
BIN/CSH.S.txt
111
BIN/CSH.S.txt
@ -67,7 +67,10 @@ CS.INIT clc
|
|||||||
* Called until exit with CS
|
* Called until exit with CS
|
||||||
* if RUN exits with CC, RN entered again
|
* if RUN exits with CC, RN entered again
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN >PUSHWI K.VER
|
CS.RUN lda #$ff
|
||||||
|
>STA.G bTrace
|
||||||
|
|
||||||
|
>PUSHWI K.VER
|
||||||
>PUSHBI 2
|
>PUSHBI 2
|
||||||
>LDYA L.MSG.GREETINGS
|
>LDYA L.MSG.GREETINGS
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
@ -95,11 +98,19 @@ CS.RUN >PUSHWI K.VER
|
|||||||
>STYA ZPFileBufPtr
|
>STYA ZPFileBufPtr
|
||||||
|
|
||||||
.1 >SLEEP
|
.1 >SLEEP
|
||||||
jsr CSH.Run
|
|
||||||
|
>LDA.G bTrace
|
||||||
|
bpl .2
|
||||||
|
|
||||||
|
>LDYA ZPFileBufPtr
|
||||||
|
jsr PrintTraceMsg
|
||||||
|
|
||||||
|
.2 jsr CSH.Run
|
||||||
bcc .1
|
bcc .1
|
||||||
|
|
||||||
cmp #MLI.E.EOF
|
cmp #MLI.E.EOF
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
pha
|
pha
|
||||||
jsr PrintErrMsg
|
jsr PrintErrMsg
|
||||||
pla
|
pla
|
||||||
@ -130,26 +141,25 @@ CS.QUIT jsr CSH.Quit
|
|||||||
PrintErrMsg >LDYA ZPFileBuf
|
PrintErrMsg >LDYA ZPFileBuf
|
||||||
>STYA ZPPtr1
|
>STYA ZPPtr1
|
||||||
|
|
||||||
lda #1
|
stz ZPPtr2
|
||||||
sta ZPPtr3
|
stz ZPPtr2+1 Line counter
|
||||||
stz ZPPtr3+1
|
|
||||||
|
|
||||||
.1 >LDYA ZPPtr1
|
.1 inc ZPPtr2
|
||||||
>STYA ZPPtr2 Save actual line start
|
|
||||||
|
|
||||||
inc ZPPtr3
|
|
||||||
bne .2
|
bne .2
|
||||||
inc ZPPtr3+1
|
inc ZPPtr2+1
|
||||||
|
|
||||||
.2 lda (ZPPtr1)
|
.2 >LDYA ZPPtr1
|
||||||
beq .6 EoF
|
>STYA ZPPtr3 save line start
|
||||||
|
|
||||||
|
.20 lda (ZPPtr1)
|
||||||
|
beq .4 EoF
|
||||||
|
|
||||||
inc ZPPtr1
|
inc ZPPtr1
|
||||||
bne .3
|
bne .3
|
||||||
inc ZPPtr1+1
|
inc ZPPtr1+1
|
||||||
|
|
||||||
.3 cmp #C.CR
|
.3 cmp #C.CR
|
||||||
bne .2 Scan until EoL
|
bne .20 Scan until EoL
|
||||||
|
|
||||||
ldx ZPPtr1
|
ldx ZPPtr1
|
||||||
cpx ZPFileBufPtr
|
cpx ZPFileBufPtr
|
||||||
@ -157,47 +167,67 @@ PrintErrMsg >LDYA ZPFileBuf
|
|||||||
sbc ZPFileBufPtr+1
|
sbc ZPFileBufPtr+1
|
||||||
bcc .1 not this line....
|
bcc .1 not this line....
|
||||||
|
|
||||||
|
.4 >LDA.G bTrace
|
||||||
|
bmi .5
|
||||||
|
|
||||||
|
jsr PrintTraceMsg.3
|
||||||
|
|
||||||
|
.5 lda ZPPtr3
|
||||||
|
cmp ZPFileBufPtr
|
||||||
|
bne .6
|
||||||
|
|
||||||
|
lda ZPPtr3+1
|
||||||
|
cmp ZPFileBufPtr+1
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
.6 >PUSHBI '-'
|
||||||
|
ldy #S.PS.hStdErr
|
||||||
|
lda (pPS),y
|
||||||
|
>SYSCALL fputc
|
||||||
|
|
||||||
|
inc ZPPtr3
|
||||||
|
bne .5
|
||||||
|
inc ZPPtr3+1
|
||||||
|
bra .5
|
||||||
|
|
||||||
|
.8 >PUSHW ZPPtr2 Line counter
|
||||||
|
|
||||||
|
>PUSHBI 2
|
||||||
|
>PUSHW L.MSG.ERR
|
||||||
|
ldy #S.PS.hStdErr
|
||||||
|
lda (pPS),y
|
||||||
|
>SYSCALL fprintf
|
||||||
|
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
PrintTraceMsg >STYA ZPPtr3
|
||||||
|
|
||||||
|
PrintTraceMsg.3 >PUSHBI '>'
|
||||||
|
ldy #S.PS.hStdErr
|
||||||
|
lda (pPS),y
|
||||||
|
>SYSCALL fputc
|
||||||
|
|
||||||
ldy #$ff
|
ldy #$ff
|
||||||
|
|
||||||
.5 iny
|
.1 iny
|
||||||
lda (ZPPtr2),y
|
lda (ZPPtr3),y
|
||||||
beq .6
|
beq .8
|
||||||
cmp #C.CR
|
cmp #C.CR
|
||||||
beq .6
|
beq .8
|
||||||
|
|
||||||
phy
|
phy
|
||||||
>PUSHA
|
>PUSHA
|
||||||
ldy #S.PS.hStdErr
|
ldy #S.PS.hStdErr
|
||||||
lda (pPS),y
|
lda (pPS),y
|
||||||
>SYSCALL fputc
|
>SYSCALL fputc
|
||||||
ply
|
ply
|
||||||
bra .5
|
bra .1
|
||||||
|
|
||||||
.6 phy
|
.8 >PUSHBI 0
|
||||||
>PUSHBI 0
|
|
||||||
>PUSHW L.MSG.ECHOCRLF
|
>PUSHW L.MSG.ECHOCRLF
|
||||||
ldy #S.PS.hStdErr
|
ldy #S.PS.hStdErr
|
||||||
lda (pPS),y
|
lda (pPS),y
|
||||||
>SYSCALL fprintf
|
>SYSCALL fprintf
|
||||||
ply
|
|
||||||
beq .8
|
|
||||||
|
|
||||||
.7 phy
|
|
||||||
>PUSHBI '-'
|
|
||||||
ldy #S.PS.hStdErr
|
|
||||||
lda (pPS),y
|
|
||||||
>SYSCALL fputc
|
|
||||||
ply
|
|
||||||
dey
|
|
||||||
bne .7
|
|
||||||
|
|
||||||
.8 >PUSHW ZPPtr3
|
|
||||||
|
|
||||||
>PUSHBI 2
|
|
||||||
>PUSHW L.MSG.ERR
|
|
||||||
ldy #S.PS.hStdErr
|
|
||||||
lda (pPS),y
|
|
||||||
>SYSCALL fprintf
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -216,6 +246,7 @@ MSG.ERR .AZ "^\r\nLine #%D:"
|
|||||||
.DUMMY
|
.DUMMY
|
||||||
.OR 0
|
.OR 0
|
||||||
DS.START .INB USR/SRC/BIN/CSH.D
|
DS.START .INB USR/SRC/BIN/CSH.D
|
||||||
|
bTrace .BS 1
|
||||||
DS.END
|
DS.END
|
||||||
.ED
|
.ED
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user