Kernel 0.9.1 : KERNEL API, bugfix in Dec 2 Hex conversion

This commit is contained in:
Rémy GIBERT 2017-10-26 08:41:57 +02:00
parent cf29180a68
commit 50763e0f7a
8 changed files with 108 additions and 80 deletions

Binary file not shown.

Binary file not shown.

View File

@ -6,6 +6,22 @@ AUTO 6
.LIST OFF .LIST OFF
*-------------------------------------- *--------------------------------------
*-------------------------------------- *--------------------------------------
PrintPrompt >LDYA L.ENV.PS1
>SYSCALL GetEnv.YA
>SYSCALL ExpandStr.YA
phx
>SYSCALL PrintF.YA
>LDYA L.MSG.PROMPT
>SYSCALL PrintF.YA
plx
php
pha
txa
>SYSCALL FreeMem.A
pla
plp
rts
*--------------------------------------
CmdLine.CLR ldy #0 CmdLine.CLR ldy #0
.1 lda (ZPCMDBuf),y .1 lda (ZPCMDBuf),y

View File

@ -1,6 +1,6 @@
PR#3 PR#3
PREFIX /A2OSX.BUILD PREFIX /A2OSX.BUILD
NEW LOMEM $A00
INC 1 INC 1
AUTO 6 AUTO 6
.LIST OFF .LIST OFF

View File

@ -1,6 +1,6 @@
PR#3 PR#3
PREFIX /A2OSX.BUILD PREFIX /A2OSX.BUILD
NEW LOMEM $A00
INC 1 INC 1
AUTO 6 AUTO 6
.LIST OFF .LIST OFF
@ -57,7 +57,6 @@ CSH.Init lda #$FF
*-------------------------------------- *--------------------------------------
CSH.Run lda #0 CSH.Run lda #0
>STA.G CmdBuflen Reset Cmdline >STA.G CmdBuflen Reset Cmdline
jsr CSH.GetCharNB jsr CSH.GetCharNB
bcs .9 bcs .9
@ -74,7 +73,7 @@ CSH.Run lda #0
.1 cmp #$0D .1 cmp #$0D
bne .2 bne .2
jmp CSH.GetNextCharNB Skip CR jmp CSH.GetNextCharNB 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....
@ -109,13 +108,13 @@ CSH.Run lda #0
jsr CSH.GetNextCharNB Skip = jsr CSH.GetNextCharNB Skip =
bcs .99 bcs .99
phy
jsr CSH.ExpEval jsr CSH.ExpEval
ply
bcs .9 bcs .9
jsr CSH.StoreACCToVar jsr CSH.StoreACCToVar
bcs .9 bcs .9
jsr CSH.GetChar
cmp #';' cmp #';'
bne .99 bne .99
@ -142,23 +141,23 @@ CSH.Run lda #0
bne .6 bne .6
bra .99 Line Too long !!! bra .99 Line Too long !!!
.7 tya .7 lda #0
sta (ZPCMDBuf),y
tya
clc clc
adc ZPCSHBufPtr adc ZPCSHBufPtr
sta ZPCSHBufPtr sta ZPCSHBufPtr
bcc .8 bcc .8
inc ZPCSHBufPtr+1 inc ZPCSHBufPtr+1
.8 lda #0 .8 tya
sta (ZPCMDBuf),y
tya
>STA.G CmdBuflen >STA.G CmdBuflen
lda #$ff lda #$ff
>STA.G bCmdBufexec >STA.G bCmdBufexec
>LDA.G bEcho >LDA.G bEcho
beq .80 * beq .80
>PUSHW ZPCMDBuf >PUSHW ZPCMDBuf
>LDYA L.MSG.ECHO >LDYA L.MSG.ECHO
@ -294,7 +293,7 @@ CSH.LONG lda #CSH.TYPE.LONG
CSH.FLOAT lda #CSH.TYPE.FLOAT CSH.FLOAT lda #CSH.TYPE.FLOAT
CSH.TYPE >STA.G CSH.ACCT CSH.TYPE >STA.G CSH.ACCT
jsr CSH.GetChar jsr CSH.GetChar
bcs .9 bcs .9
cmp #' ' cmp #' '
@ -323,10 +322,8 @@ CSH.TYPE >STA.G CSH.ACCT
jsr CSH.GetNextCharNB jsr CSH.GetNextCharNB
bcs .9 bcs .9
phy Save Ptr To Value
jsr CSH.ExpEval jsr CSH.ExpEval
ply
bcs .9 bcs .9
jsr CSH.StoreACCToVar Update value to this var jsr CSH.StoreACCToVar Update value to this var
@ -362,7 +359,7 @@ CSH.LookupID >STYA ZPPtr1
CSH.LookupOP >STYA ZPPtr1 CSH.LookupOP >STYA ZPPtr1
jsr CSH.GetOPLen jsr CSH.GetOPLen
CSH.Lookup phy Y = len CSH.Lookup phy Y = len
ldx #0 ldx #0
@ -416,24 +413,33 @@ CSH.ExpEval jsr CSH.ZeroACC
jsr CSH.GetCharNB jsr CSH.GetCharNB
bcs .9 bcs .9
.10 jsr CSH.IsLetter Fnc or Var ?
bcs .2
jsr CSH.GetVar
bcs .1
jsr CSH.LoadACCFromVar
bcs .9
bra .11
.1 bra .9 TO DO : Functions
.2 jsr CSH.IsDigit10 number ?
bcs .9
jsr CSH.GetNumInACC
bcs .9
.11 jsr CSH.GetCharNB
bcs .9
cmp #')' cmp #')'
beq .8 beq .8
cmp #';' cmp #';'
beq .8 beq .8
.10 jsr CSH.IsLetter Fnc or Var ?
bcs .5
jsr CSH.GetVar
bcs .4
>DEBUG
jsr CSH.LoadACCFromVar
bcs .9
jsr CSH.GetCharNB
bcs .9
jsr CSH.IsOPChar jsr CSH.IsOPChar
bcs .9 bcs .9
@ -442,7 +448,7 @@ CSH.ExpEval jsr CSH.ZeroACC
bcs .9 bcs .9
>LDA.G CSH.EXPBOP1 previous OP... >LDA.G CSH.EXPBOP1 previous OP...
bne .2 go check precedence bne .5 go check precedence
txa txa
>STA.G CSH.EXPBOP1 >STA.G CSH.EXPBOP1
@ -454,7 +460,7 @@ CSH.ExpEval jsr CSH.ZeroACC
sec sec
.99 rts .99 rts
.2 txa .5 txa
>STA.G CSH.EXPBOP2 >STA.G CSH.EXPBOP2
>CMP.G CSH.EXPBOP1 >CMP.G CSH.EXPBOP1
bcs .3 bcs .3
@ -471,28 +477,18 @@ CSH.ExpEval jsr CSH.ZeroACC
bcs .9 bcs .9
jsr CSH.GetCharNB jsr CSH.GetCharNB
bcc .10 bcc .10
.4
bra .9 bra .9
.5 jsr CSH.IsDigit10 number ?
bcs .9
jsr CSH.GetNumInACC
bcs .9
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
CSA.Compute tax CSA.Compute tax
jmp (J.CSH.BOBS,x) >DEBUG
jmp (J.CSH.BOPS,x)
*-------------------------------------- *--------------------------------------
CSH.GetNumInACC >LDA.G CSH.ACCT CSH.GetNumInACC >LDA.G CSH.ACCT
cmp #CSH.TYPE.FLOAT cmp #CSH.TYPE.FLOAT
bcc .1 bcc .1
>PUSHWI ZPCSHBufPtr >PUSHWI ZPCSHBufPtr
>PUSHW ZPCSHBufPtr >PUSHW ZPCSHBufPtr
>PUSHEA.G CSH.ACC >PUSHEA.G CSH.ACC
@ -592,13 +588,12 @@ CSH.GetVar >LDYA ZPCSHSymbols
>STYA ZPPtr1 >STYA ZPPtr1
jsr CSH.GetIDLen jsr CSH.GetIDLen
pha tax Save len
.1 lda (ZPPtr1) .1 lda (ZPPtr1)
beq .9 beq .9
pla txa Get back len
pha
cmp (ZPPtr1) cmp (ZPPtr1)
bne .3 bne .3
@ -623,7 +618,7 @@ CSH.GetVar >LDYA ZPCSHSymbols
adc ZPCSHData+1 adc ZPCSHData+1
sta ZPCSHValue+1 sta ZPCSHValue+1
pla txa Get back len
clc clc
adc ZPCSHBufPtr adc ZPCSHBufPtr
@ -646,8 +641,7 @@ CSH.GetVar >LDYA ZPCSHSymbols
inc ZPPtr1+1 inc ZPPtr1+1
bra .1 bra .1
.9 pla .9 sec
sec
rts rts
*-------------------------------------- *--------------------------------------
CSH.LoadACCFromVar CSH.LoadACCFromVar
@ -662,7 +656,7 @@ CSH.LoadACCFromVar
>LEA.G CSH.ACC >LEA.G CSH.ACC
>STYA ZPPtr1 >STYA ZPPtr1
ldy #0 ldy #1
.1 lda (ZPCSHValue),y .1 lda (ZPCSHValue),y
sta (ZPPtr1) sta (ZPPtr1)
@ -693,7 +687,7 @@ CSH.StoreACCToVar
>LEA.G CSH.ACC >LEA.G CSH.ACC
>STYA ZPPtr1 >STYA ZPPtr1
ldy #0 ldy #1 do not trash TYPE byte
.1 lda (ZPPtr1) .1 lda (ZPPtr1)
inc ZPPtr1 inc ZPPtr1
@ -738,7 +732,25 @@ CSH.IsACC0 >LDA.G CSH.ACCT
.9 sec .9 sec
rts rts
*-------------------------------------- *--------------------------------------
CSH.BOPS.PLUS CSH.BOPS.ADD
CSH.BOPS.SUB
CSH.BOPS.MUL
CSH.BOPS.DIV
CSH.BOPS.MOD
CSH.BOPS.SHL
CSH.BOPS.SHR
CSH.BOPS.L
CSH.BOPS.G
CSH.BOPS.LE
CSH.BOPS.GE
CSH.BOPS.EQ
CSH.BOPS.NE
CSH.BOPS.AND
CSH.BOPS.OR
CSH.BOPS.EOR
CSH.BOPS.LAND
CSH.BOPS.LOR
clc clc
rts rts

View File

@ -1,6 +1,6 @@
PR#3 PR#3
PREFIX /A2OSX.BUILD PREFIX /A2OSX.BUILD
NEW LOMEM $A00
INC 1 INC 1
AUTO 6 AUTO 6
.LIST OFF .LIST OFF

View File

@ -25,9 +25,6 @@ CmdLine.MAX .EQ 255
VarLen.MAX .EQ 15 VarLen.MAX .EQ 15
History.MAX .EQ 256 History.MAX .EQ 256
CSH.Stack.MAX .EQ 15
CSH.Name.MAX .EQ 15
CSH.E.SYNTAX .EQ $7F CSH.E.SYNTAX .EQ $7F
CSH.E.SOVERFLW .EQ $7E CSH.E.SOVERFLW .EQ $7E
CSH.E.NOVERFLW .EQ $7D CSH.E.NOVERFLW .EQ $7D
@ -85,7 +82,24 @@ J.INTCMDS .DA Cmd.Exec.CD
.DA Cmd.Exec.STARTPROC .DA Cmd.Exec.STARTPROC
.DA Cmd.Exec.TIME .DA Cmd.Exec.TIME
L.CSH.BOPS .DA CSH.BOPS L.CSH.BOPS .DA CSH.BOPS
J.CSH.BOBS .DA CSH.BOPS.PLUS J.CSH.BOPS .DA CSH.BOPS.ADD
.DA CSH.BOPS.SUB
.DA CSH.BOPS.MUL
.DA CSH.BOPS.DIV
.DA CSH.BOPS.MOD
.DA CSH.BOPS.SHL
.DA CSH.BOPS.SHR
.DA CSH.BOPS.L
.DA CSH.BOPS.G
.DA CSH.BOPS.LE
.DA CSH.BOPS.GE
.DA CSH.BOPS.EQ
.DA CSH.BOPS.NE
.DA CSH.BOPS.AND
.DA CSH.BOPS.OR
.DA CSH.BOPS.EOR
.DA CSH.BOPS.LAND
.DA CSH.BOPS.LOR
L.CSH.KEYWORDS .DA CSH.KEYWORDS L.CSH.KEYWORDS .DA CSH.KEYWORDS
J.CSH.KEYWORDS .DA CSH.IF J.CSH.KEYWORDS .DA CSH.IF
.DA CSH.WHILE .DA CSH.WHILE
@ -440,22 +454,6 @@ SetPWD ldy #S.PS.hPREFIX
>PUSHW L.ENV.PWD >PUSHW L.ENV.PWD
>SYSCALL SetEnv >SYSCALL SetEnv
rts rts
*--------------------------------------
PrintPrompt >LDYA L.ENV.PS1
>SYSCALL GetEnv.YA
>SYSCALL ExpandStr.YA
phx
>SYSCALL PrintF.YA
>LDYA L.MSG.PROMPT
>SYSCALL PrintF.YA
plx
php
pha
txa
>SYSCALL FreeMem.A
pla
plp
rts
*-------------------------------------- *--------------------------------------
.INB /A2OSX.SRC/SBIN/SHELL.S.CL .INB /A2OSX.SRC/SBIN/SHELL.S.CL
.INB /A2OSX.SRC/SBIN/SHELL.S.CMD .INB /A2OSX.SRC/SBIN/SHELL.S.CMD
@ -530,15 +528,13 @@ CSH.BOPS >PSTR "+"
>PSTR ">>" >PSTR ">>"
>PSTR "<" >PSTR "<"
>PSTR ">" >PSTR ">"
>PSTR ">=" >PSTR "<="
>PSTR "<"
>PSTR ">=" >PSTR ">="
>PSTR "==" >PSTR "=="
>PSTR "!=" >PSTR "!="
>PSTR "&" >PSTR "&"
>PSTR "|" >PSTR "|"
>PSTR "^" >PSTR "^"
>PSTR "~"
>PSTR "&&" >PSTR "&&"
>PSTR "||" >PSTR "||"
.HS 00 .HS 00

View File

@ -134,7 +134,12 @@ STDLIB.Dec2Hex jsr STDLIB.32.Clear
jsr STDIO.IsDigit jsr STDIO.IsDigit
bcs .8 bcs .8
phy Save Y, pointing to next char
jsr STDLIB.32.T10 jsr STDLIB.32.T10
ply
bcs .9 bcs .9
lda (ZPPtr2),y lda (ZPPtr2),y
@ -169,7 +174,6 @@ STDLIB.32.T10 ldx #3
bcs .9 overflow!!! bcs .9 overflow!!!
ldx #0 ldx #0
phy
ldy #4 ldy #4
* clc * clc
@ -180,7 +184,6 @@ STDLIB.32.T10 ldx #3
inx inx
dey dey
bne .2 bne .2
ply
bcs .99 overflow!!! bcs .99 overflow!!!
@ -191,6 +194,7 @@ STDLIB.32.T10 ldx #3
pla pla
pla pla
pla pla
.99 rts .99 rts
*-------------------------------------- *--------------------------------------
STDLIB.32.ROL asl STDLIB.32 STDLIB.32.ROL asl STDLIB.32