Kernel 0.9.1 : ASM rewrite....bugfix

This commit is contained in:
Rémy GIBERT 2018-03-19 16:48:41 +00:00
parent bb8b8f1bd8
commit 158fc06b83
7 changed files with 54 additions and 41 deletions

Binary file not shown.

View File

@ -146,7 +146,19 @@ DIR.DA jsr SRC.GetNextCharNB
.1 jsr EXP.Eval
bcs .9
lda SRC.ACC.SIZE
ldx #0
.2 phx
lda SRC.ACC,x
jsr OUT.EmitByte
plx
bcs .9
inx
cpx SRC.ACC.SIZE
bne .2
jsr SRC.GetNextChar
bcs .8

View File

@ -18,6 +18,11 @@ AUTO 4,1
EXP.Eval lda #2
sta SRC.ACC.SIZE Default To WORD (2 bytes)
stz SRC.ACC
stz SRC.ACC+1
stz SRC.ACC+2
stz SRC.ACC+3
>STZ.G EXP.Modifier
>STZ.G EXP.Prefix
>STZ.G EXP.Operator
@ -136,7 +141,7 @@ EXP.EvalExitOK >LDA.G EXP.Modifier
beq .8
asl
tax
jmp (J.EXP.MOD,x)
jmp (J.EXP.MOD-2,x)
.8 clc
EXP.EvalExitRTS rts
@ -201,6 +206,8 @@ EXP.SetAccA sta SRC.ACC
stz SRC.ACC+1
stz SRC.ACC+2
stz SRC.ACC+3
lda #1
sta SRC.ACC.SIZE
rts
*---------------------------------------
EXP.GetSymbol jsr SYM.LookupGlobal
@ -218,12 +225,11 @@ EXP.GetSymbol jsr SYM.LookupGlobal
sec
.9 rts
*---------------------------------------
EXP.Compute dec
asl
EXP.Compute asl
tax
>LDA.G ASM.PASS pass#2?
beq .8
jmp (J.EXP.OP,x)
jmp (J.EXP.OP-2,x)
.8 clc
rts
*---------------------------------------

View File

@ -156,7 +156,7 @@ OUT.PrintLineAcc ldx SRC.ACC.SIZE
rts
*---------------------------------------
OUT.EmitByte pha
>LDA.G OUT.Buf
cmp #3
bne .2
@ -166,6 +166,7 @@ OUT.EmitByte pha
>LDA.G ASM.LI.XON
bpl .1
jsr OUT.PrintLineOutBuf
lda #13
>SYSCALL PutChar.A

View File

@ -161,7 +161,7 @@ SRC.ParseLine.LABEL lda #0
.1 lda #$ff
>STA.G SYM.bGlobal
inc
sta (ZPLocalBuf)
sta (ZPLocalBuf) Reset Local Labels
>LDA.G ASM.PASS
bne .3
@ -316,12 +316,7 @@ SRC.ParseLine.OpCode
sec
.99 rts
*---------------------------------------
SRC.ParseLine.AM >LDA.G EXP.Prefix
beq .1
inc SRC.AM.StrBuf
ldx SRC.AM.StrBuf
sta SRC.AM.StrBuf,x
SRC.ParseLine.AM
.1 jsr SRC.GetChar
bcs SRC.ParseLine.AMCheck
@ -365,7 +360,14 @@ SRC.ParseLine.AM >LDA.G EXP.Prefix
.6 jsr EXP.Eval
bcs .99
ldx #3
>LDA.G EXP.Prefix
beq .74
inc SRC.AM.StrBuf
ldx SRC.AM.StrBuf
sta SRC.AM.StrBuf,x
.74 ldx #3
.73 lda SRC.ACC,x
bne .72
dex
@ -619,16 +621,16 @@ SRC.GetBinary jsr SRC.GetNextChar skip '%'
*---------------------------------------
SRC.GetKeyword >STYA ZPPtr1 KeyWord table
lda #0 Keyword.ID
ldx #0 Keyword.ID
.1 pha
.1 phx
lda (ZPPtr1)
beq .9 End Of table
tax KW len
.2 ldy #0
ldy #0
.3 lda (ZPLinePtr),y
beq .6
@ -656,7 +658,7 @@ SRC.GetKeyword >STYA ZPPtr1 KeyWord table
bcc .5
inc ZPLinePtr+1
.5 pla Keyword.ID
.5 plx Keyword.ID
clc
rts
@ -668,9 +670,9 @@ SRC.GetKeyword >STYA ZPPtr1 KeyWord table
inc ZPPtr1+1
.7 pla Keyword.ID
inc
inc
.7 plx Keyword.ID
inx
inx
bra .1
.9 plx

View File

@ -83,7 +83,7 @@ SYM.Dump stz ZPLinePtr
ldy #SYM.F Get Symbol Size
lda (ZPPtr1),y
and #3
and #7
beq .3
pha
@ -115,7 +115,7 @@ SYM.Dump stz ZPLinePtr
.8 clc
rts
*---------------------------------------
SYM.AddGlobalPC jsr SYM.PC2Global A=SYM.Len
SYM.AddGlobalPC jsr SYM.PC2Global A=PC Size
ora #SYM.F.RESOLVED PC is always known
*---------------------------------------
SYM.AddGlobal >STA.G SYM.Global+SYM.F
@ -180,16 +180,7 @@ SYM.UpdateGlobalAcc ldx #3
dex
bpl .1
ldx #4
ldy #3
.3 lda SRC.ACC,y
bne .4
dex
dey
bne .3
.4 txa
lda SRC.ACC.SIZE
*---------------------------------------
SYM.UpdateGlobal ora #SYM.F.RESOLVED
>STA.G SYM.Global+SYM.F
@ -233,7 +224,7 @@ SYM.PC2Global ldx #4
dey
bne .3
.4 txa
.4 txa A=PC Size
rts
*---------------------------------------

View File

@ -150,7 +150,7 @@ J.LI .DA DIR.LI.ON
.DA DIR.LI.MOFF
.DA DIR.LI.XON
.DA DIR.LI.XOFF
J.EXP.MOD .DA EXP.MOD.8.1
J.EXP.MOD .DA EXP.MOD.8.1 #/^<>
.DA EXP.MOD.8.2
.DA EXP.MOD.8.3
.DA EXP.MOD.24
@ -268,7 +268,8 @@ CS.RUN >SYSCALL GetChar
bne .1
inc
sta (pData),y
jsr DIR.Init Reset
jsr DIR.Init Reset
>DEBUG
clc
rts
@ -398,11 +399,11 @@ MSG.OUT0 .AZ "%H- "
MSG.OUT1 .AZ "%H-%h "
MSG.OUT2 .AZ "%H-%h %h "
MSG.OUT3 .AZ "%H-%h %h %h"
MSG.EQU0 .AZ "[ ?]"
MSG.EQU1 .AZ "[ %h]"
MSG.EQU2 .AZ "[ %h%h]"
MSG.EQU3 .AZ "[ %h%h%h]"
MSG.EQU4 .AZ "[ %h%h%h%h]"
MSG.EQU0 .AZ " [ ?]"
MSG.EQU1 .AZ " [ %h]"
MSG.EQU2 .AZ " [ %h%h]"
MSG.EQU3 .AZ " [ %h%h%h]"
MSG.EQU4 .AZ " [%h%h%h%h]"
MSG.SRCLINE .AZ " %05D %s\r\n"
MSG.ERROR .AZ "*** Fatal Error $%h "
MSG.SYMBOLS .AZ "Symbol Table:\r\n"