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
*--------------------------------------
*--------------------------------------
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
.1 lda (ZPCMDBuf),y

View File

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

View File

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

View File

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

View File

@ -25,9 +25,6 @@ CmdLine.MAX .EQ 255
VarLen.MAX .EQ 15
History.MAX .EQ 256
CSH.Stack.MAX .EQ 15
CSH.Name.MAX .EQ 15
CSH.E.SYNTAX .EQ $7F
CSH.E.SOVERFLW .EQ $7E
CSH.E.NOVERFLW .EQ $7D
@ -85,7 +82,24 @@ J.INTCMDS .DA Cmd.Exec.CD
.DA Cmd.Exec.STARTPROC
.DA Cmd.Exec.TIME
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
J.CSH.KEYWORDS .DA CSH.IF
.DA CSH.WHILE
@ -440,22 +454,6 @@ SetPWD ldy #S.PS.hPREFIX
>PUSHW L.ENV.PWD
>SYSCALL SetEnv
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.CMD
@ -530,15 +528,13 @@ CSH.BOPS >PSTR "+"
>PSTR ">>"
>PSTR "<"
>PSTR ">"
>PSTR ">="
>PSTR "<"
>PSTR "<="
>PSTR ">="
>PSTR "=="
>PSTR "!="
>PSTR "&"
>PSTR "|"
>PSTR "^"
>PSTR "~"
>PSTR "&&"
>PSTR "||"
.HS 00

View File

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