mirror of
https://github.com/A2osX/A2osX.git
synced 2024-07-13 13:29:04 +00:00
Kernel 0.9.1 : ASM rewrite....bugfix
This commit is contained in:
parent
bb8b8f1bd8
commit
158fc06b83
Binary file not shown.
@ -146,7 +146,19 @@ DIR.DA jsr SRC.GetNextCharNB
|
|||||||
.1 jsr EXP.Eval
|
.1 jsr EXP.Eval
|
||||||
bcs .9
|
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
|
jsr SRC.GetNextChar
|
||||||
bcs .8
|
bcs .8
|
||||||
|
@ -18,6 +18,11 @@ AUTO 4,1
|
|||||||
EXP.Eval lda #2
|
EXP.Eval lda #2
|
||||||
sta SRC.ACC.SIZE Default To WORD (2 bytes)
|
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.Modifier
|
||||||
>STZ.G EXP.Prefix
|
>STZ.G EXP.Prefix
|
||||||
>STZ.G EXP.Operator
|
>STZ.G EXP.Operator
|
||||||
@ -136,7 +141,7 @@ EXP.EvalExitOK >LDA.G EXP.Modifier
|
|||||||
beq .8
|
beq .8
|
||||||
asl
|
asl
|
||||||
tax
|
tax
|
||||||
jmp (J.EXP.MOD,x)
|
jmp (J.EXP.MOD-2,x)
|
||||||
.8 clc
|
.8 clc
|
||||||
EXP.EvalExitRTS rts
|
EXP.EvalExitRTS rts
|
||||||
|
|
||||||
@ -201,6 +206,8 @@ EXP.SetAccA sta SRC.ACC
|
|||||||
stz SRC.ACC+1
|
stz SRC.ACC+1
|
||||||
stz SRC.ACC+2
|
stz SRC.ACC+2
|
||||||
stz SRC.ACC+3
|
stz SRC.ACC+3
|
||||||
|
lda #1
|
||||||
|
sta SRC.ACC.SIZE
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
EXP.GetSymbol jsr SYM.LookupGlobal
|
EXP.GetSymbol jsr SYM.LookupGlobal
|
||||||
@ -218,12 +225,11 @@ EXP.GetSymbol jsr SYM.LookupGlobal
|
|||||||
sec
|
sec
|
||||||
.9 rts
|
.9 rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
EXP.Compute dec
|
EXP.Compute asl
|
||||||
asl
|
|
||||||
tax
|
tax
|
||||||
>LDA.G ASM.PASS pass#2?
|
>LDA.G ASM.PASS pass#2?
|
||||||
beq .8
|
beq .8
|
||||||
jmp (J.EXP.OP,x)
|
jmp (J.EXP.OP-2,x)
|
||||||
.8 clc
|
.8 clc
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
|
@ -156,7 +156,7 @@ OUT.PrintLineAcc ldx SRC.ACC.SIZE
|
|||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
OUT.EmitByte pha
|
OUT.EmitByte pha
|
||||||
|
|
||||||
>LDA.G OUT.Buf
|
>LDA.G OUT.Buf
|
||||||
cmp #3
|
cmp #3
|
||||||
bne .2
|
bne .2
|
||||||
@ -166,6 +166,7 @@ OUT.EmitByte pha
|
|||||||
|
|
||||||
>LDA.G ASM.LI.XON
|
>LDA.G ASM.LI.XON
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
jsr OUT.PrintLineOutBuf
|
jsr OUT.PrintLineOutBuf
|
||||||
lda #13
|
lda #13
|
||||||
>SYSCALL PutChar.A
|
>SYSCALL PutChar.A
|
||||||
|
@ -161,7 +161,7 @@ SRC.ParseLine.LABEL lda #0
|
|||||||
.1 lda #$ff
|
.1 lda #$ff
|
||||||
>STA.G SYM.bGlobal
|
>STA.G SYM.bGlobal
|
||||||
inc
|
inc
|
||||||
sta (ZPLocalBuf)
|
sta (ZPLocalBuf) Reset Local Labels
|
||||||
|
|
||||||
>LDA.G ASM.PASS
|
>LDA.G ASM.PASS
|
||||||
bne .3
|
bne .3
|
||||||
@ -316,12 +316,7 @@ SRC.ParseLine.OpCode
|
|||||||
sec
|
sec
|
||||||
.99 rts
|
.99 rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SRC.ParseLine.AM >LDA.G EXP.Prefix
|
SRC.ParseLine.AM
|
||||||
beq .1
|
|
||||||
inc SRC.AM.StrBuf
|
|
||||||
ldx SRC.AM.StrBuf
|
|
||||||
sta SRC.AM.StrBuf,x
|
|
||||||
|
|
||||||
.1 jsr SRC.GetChar
|
.1 jsr SRC.GetChar
|
||||||
bcs SRC.ParseLine.AMCheck
|
bcs SRC.ParseLine.AMCheck
|
||||||
|
|
||||||
@ -365,7 +360,14 @@ SRC.ParseLine.AM >LDA.G EXP.Prefix
|
|||||||
.6 jsr EXP.Eval
|
.6 jsr EXP.Eval
|
||||||
bcs .99
|
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
|
.73 lda SRC.ACC,x
|
||||||
bne .72
|
bne .72
|
||||||
dex
|
dex
|
||||||
@ -619,16 +621,16 @@ SRC.GetBinary jsr SRC.GetNextChar skip '%'
|
|||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SRC.GetKeyword >STYA ZPPtr1 KeyWord table
|
SRC.GetKeyword >STYA ZPPtr1 KeyWord table
|
||||||
|
|
||||||
lda #0 Keyword.ID
|
ldx #0 Keyword.ID
|
||||||
|
|
||||||
.1 pha
|
.1 phx
|
||||||
|
|
||||||
lda (ZPPtr1)
|
lda (ZPPtr1)
|
||||||
beq .9 End Of table
|
beq .9 End Of table
|
||||||
|
|
||||||
tax KW len
|
tax KW len
|
||||||
|
|
||||||
.2 ldy #0
|
ldy #0
|
||||||
|
|
||||||
.3 lda (ZPLinePtr),y
|
.3 lda (ZPLinePtr),y
|
||||||
beq .6
|
beq .6
|
||||||
@ -656,7 +658,7 @@ SRC.GetKeyword >STYA ZPPtr1 KeyWord table
|
|||||||
bcc .5
|
bcc .5
|
||||||
inc ZPLinePtr+1
|
inc ZPLinePtr+1
|
||||||
|
|
||||||
.5 pla Keyword.ID
|
.5 plx Keyword.ID
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -668,9 +670,9 @@ SRC.GetKeyword >STYA ZPPtr1 KeyWord table
|
|||||||
|
|
||||||
inc ZPPtr1+1
|
inc ZPPtr1+1
|
||||||
|
|
||||||
.7 pla Keyword.ID
|
.7 plx Keyword.ID
|
||||||
inc
|
inx
|
||||||
inc
|
inx
|
||||||
bra .1
|
bra .1
|
||||||
|
|
||||||
.9 plx
|
.9 plx
|
||||||
|
@ -83,7 +83,7 @@ SYM.Dump stz ZPLinePtr
|
|||||||
|
|
||||||
ldy #SYM.F Get Symbol Size
|
ldy #SYM.F Get Symbol Size
|
||||||
lda (ZPPtr1),y
|
lda (ZPPtr1),y
|
||||||
and #3
|
and #7
|
||||||
beq .3
|
beq .3
|
||||||
|
|
||||||
pha
|
pha
|
||||||
@ -115,7 +115,7 @@ SYM.Dump stz ZPLinePtr
|
|||||||
.8 clc
|
.8 clc
|
||||||
rts
|
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
|
ora #SYM.F.RESOLVED PC is always known
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SYM.AddGlobal >STA.G SYM.Global+SYM.F
|
SYM.AddGlobal >STA.G SYM.Global+SYM.F
|
||||||
@ -180,16 +180,7 @@ SYM.UpdateGlobalAcc ldx #3
|
|||||||
dex
|
dex
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
ldx #4
|
lda SRC.ACC.SIZE
|
||||||
ldy #3
|
|
||||||
|
|
||||||
.3 lda SRC.ACC,y
|
|
||||||
bne .4
|
|
||||||
dex
|
|
||||||
dey
|
|
||||||
bne .3
|
|
||||||
|
|
||||||
.4 txa
|
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
SYM.UpdateGlobal ora #SYM.F.RESOLVED
|
SYM.UpdateGlobal ora #SYM.F.RESOLVED
|
||||||
>STA.G SYM.Global+SYM.F
|
>STA.G SYM.Global+SYM.F
|
||||||
@ -233,7 +224,7 @@ SYM.PC2Global ldx #4
|
|||||||
dey
|
dey
|
||||||
bne .3
|
bne .3
|
||||||
|
|
||||||
.4 txa
|
.4 txa A=PC Size
|
||||||
|
|
||||||
rts
|
rts
|
||||||
*---------------------------------------
|
*---------------------------------------
|
||||||
|
@ -150,7 +150,7 @@ J.LI .DA DIR.LI.ON
|
|||||||
.DA DIR.LI.MOFF
|
.DA DIR.LI.MOFF
|
||||||
.DA DIR.LI.XON
|
.DA DIR.LI.XON
|
||||||
.DA DIR.LI.XOFF
|
.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.2
|
||||||
.DA EXP.MOD.8.3
|
.DA EXP.MOD.8.3
|
||||||
.DA EXP.MOD.24
|
.DA EXP.MOD.24
|
||||||
@ -268,7 +268,8 @@ CS.RUN >SYSCALL GetChar
|
|||||||
bne .1
|
bne .1
|
||||||
inc
|
inc
|
||||||
sta (pData),y
|
sta (pData),y
|
||||||
jsr DIR.Init Reset
|
jsr DIR.Init Reset
|
||||||
|
>DEBUG
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -398,11 +399,11 @@ MSG.OUT0 .AZ "%H- "
|
|||||||
MSG.OUT1 .AZ "%H-%h "
|
MSG.OUT1 .AZ "%H-%h "
|
||||||
MSG.OUT2 .AZ "%H-%h %h "
|
MSG.OUT2 .AZ "%H-%h %h "
|
||||||
MSG.OUT3 .AZ "%H-%h %h %h"
|
MSG.OUT3 .AZ "%H-%h %h %h"
|
||||||
MSG.EQU0 .AZ "[ ?]"
|
MSG.EQU0 .AZ " [ ?]"
|
||||||
MSG.EQU1 .AZ "[ %h]"
|
MSG.EQU1 .AZ " [ %h]"
|
||||||
MSG.EQU2 .AZ "[ %h%h]"
|
MSG.EQU2 .AZ " [ %h%h]"
|
||||||
MSG.EQU3 .AZ "[ %h%h%h]"
|
MSG.EQU3 .AZ " [ %h%h%h]"
|
||||||
MSG.EQU4 .AZ "[ %h%h%h%h]"
|
MSG.EQU4 .AZ " [%h%h%h%h]"
|
||||||
MSG.SRCLINE .AZ " %05D %s\r\n"
|
MSG.SRCLINE .AZ " %05D %s\r\n"
|
||||||
MSG.ERROR .AZ "*** Fatal Error $%h "
|
MSG.ERROR .AZ "*** Fatal Error $%h "
|
||||||
MSG.SYMBOLS .AZ "Symbol Table:\r\n"
|
MSG.SYMBOLS .AZ "Symbol Table:\r\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user