Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-02-24 17:37:55 +01:00
parent d1188bc992
commit 20a9b57a98
8 changed files with 119 additions and 62 deletions

Binary file not shown.

View File

@ -261,6 +261,7 @@ DIR.EQ clc
jsr EXP.Eval PASS#1
bcs .9
jsr SYM.Acc2Global
jmp SYM.StoreGlobal

View File

@ -337,12 +337,14 @@ EXP.OP.MUL >PUSHL L.SRC.ARG
>PUSHL L.SRC.ACC
>FPU MUL32
>PULLL L.SRC.ACC
clc
rts
*---------------------------------------
EXP.OP.DIV >PUSHL L.SRC.ARG
>PUSHL L.SRC.ACC
>FPU DIV32
>PULLL L.SRC.ACC
>PULLL L.SRC.ACC
clc
rts
*---------------------------------------
EXP.SetAccA sta SRC.ACC

View File

@ -32,6 +32,7 @@ MAC.Init >SYSCALL SListNew
*---------------------------------------
MAC.Reset >STZ.G MAC.StkPtr
>STA.G MAC.CtxID
>STA.G MAC.NextCtxID
rts
*---------------------------------------
MAC.Quit >LDA.G MAC.hStk
@ -273,7 +274,7 @@ MAC.ReadLine >LDA.G MAC.hBuf
.21 cmp #'#'
bne .20
jsr MAC.GetArgCnt
lda ZPMacroArgCnt
ora #$30
sta (ZPLineBuf),y
iny
@ -324,9 +325,12 @@ MAC.Put >LDA.G MAC.StkPtr
dey skip mac ID
dey
dey
lda ZPPtr2
sta (ZPMacroStk),y
dey
lda ZPPtr2+1
sta (ZPMacroStk),y get offset
clc
@ -336,26 +340,69 @@ MAC.Push >LDA.G MAC.StkPtr
cmp #MA.MAXDEPTH*8
beq .9
stz ZPPtr2
stz ZPPtr2+1 offset = 0
>INC.G MAC.CtxID
>INC.G MAC.Depth
>LDA.G MAC.CtxID
pha
>INC.G MAC.Depth
clc
adc #MAC.CtxIDS
tay
pla
sta (pData),y
>INC.G MAC.NextCtxID
>STA.G MAC.CtxID
>LDYA ZPLinePtr
>SYSCALL strdup Args
bcs .99
>STYA ZPPtr2
>LDA.G MAC.StkPtr
phx
ldx #0
.1 ldy #$ff
.2 iny
lda (ZPPtr2),y
beq .3
cmp #','
bne .2
lda #0
sta (ZPPtr2),y
.3 tya
beq .4
inx
sec
adc ZPPtr2
sta ZPPtr2
bcc .1
inc ZPPtr2+1
bra .1
.4 >LDA.G MAC.StkPtr
tay
txa push args
pla push hArgs
sta (ZPMacroStk),y
iny
lda ZPPtr2+1 push offset
txa push arg count
sta (ZPMacroStk),y
iny
lda #0 push offset
sta (ZPMacroStk),y
iny
lda ZPPtr2
sta (ZPMacroStk),y
iny
@ -383,16 +430,23 @@ MAC.Pop >LDA.G MAC.StkPtr
dec
dec
dec
dec
sta (pData),y 5 bytes off stack
sta (pData),y 6 bytes off stack
tay
lda (ZPMacroStk),y
>SYSCALL freemem
>DEC.G MAC.CtxID
>LDA.G MAC.Depth
clc
adc #MAC.CtxIDS
tay
lda (pData),y
>STA.G MAC.CtxID
>DEC.G MAC.Depth
clc
rts
*---------------------------------------
@ -414,6 +468,10 @@ MAC.Get >LDA.G MAC.StkPtr
lda (ZPMacroStk),y
sta ZPPtr2+1 get offset
dey
lda (ZPMacroStk),y get arg count
sta ZPMacroArgCnt
dey
lda (ZPMacroStk),y
>SYSCALL GetMemPtr
@ -421,60 +479,31 @@ MAC.Get >LDA.G MAC.StkPtr
>STYA ZPMacroArgBuf get args
rts
*---------------------------------------
MAC.GetArgCnt phy
ldx #0
ldy #$ff
.1 iny
lda (ZPMacroArgBuf),y
beq .7
cmp #','
bne .1
iny
inx
bra .1
.7 tya
beq .8
inx
.8 txa
ply
clc
rts
*---------------------------------------
MAC.GetArgX phy
>LDYA ZPMacroArgBuf
>STYA ZPPtr1
ldy #$ff
.1 ldy #$ff
.1 iny
.2 iny
lda (ZPPtr1),y
beq .7
bne .2
cmp #','
bne .1
.2 dex
beq .7
.3 dex
beq .4
tya
beq .9
clc
adc ZPPtr1
bcc .7
sta ZPPtr1
bcc .1
inc ZPPtr1+1
bra .1
.7 tya
.4 tya
tax
beq .9

View File

@ -65,8 +65,9 @@ OUT.PrintLineErr
sec
sbc ZPLineBuf
jsr OUT.PrintLineErrDashA
>LDA.G SRC.Depth
dec
jsr OUT.PrintLineErrDashA
>LDA.G MAC.Depth

View File

@ -638,42 +638,57 @@ SRC.GetOctal jsr SRC.GetNextChar skip '&'
*---------------------------------------
SRC.GetBinary jsr SRC.GetNextChar skip '%'
bcs .99
stz SRC.ACC+1
stz SRC.ACC+2
stz SRC.ACC+3
cmp #'1'
beq .10
cmp #'0'
bne .99
.10 and #$01
sta SRC.ACC
.1 jsr SRC.GetNextChar
bcs .8
cmp #' '
cmp #'.' allow %111.00.1
beq .1
cmp #C.SPACE
beq .8
jsr SRC.IsEXPReserved
bcc .8
jsr SRC.IsAMReserved
bcc .8
cmp #'1'
beq .11
cmp #'0'
bne .8
.11 lsr
rol SRC.ACC
rol SRC.ACC+1
rol SRC.ACC+2
rol SRC.ACC+3
bcs .9
bra .1
.8 clc
rts
bcc .1
.9 lda #E.VAL.TOO.BIG
sec
rts
.99 lda #E.SYNTAX.ERROR
sec
rts
.8 clc
rts
*---------------------------------------
SRC.GetKeyword >STYA ZPPtr1 KeyWord table

View File

@ -234,8 +234,16 @@ SYM.GetGlobal >PUSHB.G SYM.hList
sta ZPLinePtr
bcc .1
inc ZPLinePtr+1
.1 >PUSHB.G SYM.hList
.1
* txa
* ora #$30
* >SYSCALL putchar
* >LDYA ZPLinePtr
* >SYSCALL puts
* >DEBUG
>PUSHB.G SYM.hList
>PUSHW.G SYM.GlobalID
>PUSHW ZPSymbolBuf
>PUSHWI $ffff all
@ -326,8 +334,7 @@ SYM.StoreGlobal >LDA.G ASM.PASS
>SYSCALL SListAddData
bcs .9
lda #0
>STA.G SYM.bInGlobal
>STZ.G SYM.bInGlobal
>STA.G MAC.CtxID
.8 clc

View File

@ -31,6 +31,7 @@ ZPOpDefPtr .BS 2
ZPMacroStk .BS 2
ZPMacroBuf .BS 2
ZPMacroArgBuf .BS 2
ZPMacroArgCnt .BS 1
ZPPtr1 .BS 2
ZPPtr2 .BS 2
@ -566,8 +567,9 @@ MAC.BufPtr .BS 1
MAC.hStk .BS 1
MAC.StkPtr .BS 1
MAC.hArgBuf .BS 1
MAC.CtxID .BS 1
MAC.ID .BS 2
MAC.CtxID .BS 1
MAC.NextCtxID .BS 1
MAC.Depth .BS 1
MAC.CtxIDS .BS MA.MAXDEPTH