Kernel 0.93

This commit is contained in:
Rémy GIBERT 2019-03-22 16:47:33 +00:00
parent bec9c084a4
commit 09ecc37759
7 changed files with 86 additions and 50 deletions

Binary file not shown.

View File

@ -289,20 +289,42 @@ DIR.SE sec
*---------------------------------------
DIR.EQ clc
>LDA.G SYM.bNewGlobal
>LDA.G SYM.bInGlobal
bpl .99
jsr SRC.GetNextCharNB
bcs .99
jsr EXP.Eval
bcs .9
lda #$ff
>STA.G OUT.bEquate
>LDA.G ASM.PASS
bne .2
jsr EXP.Eval PASS#1
bcs .9
jsr SYM.Acc2Global
jmp SYM.StoreGlobal
.2 lda (ZPGlobalBuf) PASS#2
and #SYMG.F.FWREF
beq .3
jsr EXP.Eval
bcs .9
jmp SYM.UpdateGlobal
.3 ldy #SYMG-1 copy back value for OUT.Print
.4 lda (ZPGlobalBuf),y
sta SRC.ACC.F,y
dey
bpl .4
clc
rts
.99 lda #ERR.SYNTAX.ERROR
sec

View File

@ -52,7 +52,7 @@ EXP.Eval.Next stz SRC.ACC.F
cmp #'.' Local Label?
bne .12
jsr EXP.GetSymL
jsr EXP.GetLocal
bcs .14
jmp EXP.EvalOperator
@ -135,7 +135,7 @@ EXP.Eval.Next stz SRC.ACC.F
.42 jsr SRC.IsLetter Symbol ?
bcs EXP.EvalExitSYN
jsr EXP.GetSymG
jsr EXP.GetGlobal
bcs EXP.EvalExitUND
bra EXP.EvalOperator
@ -186,7 +186,7 @@ EXP.EvalOperator
jmp EXP.Eval.Next0
*---------------------------------------
EXP.GetSymL jsr SRC.GetNextChar
EXP.GetLocal jsr SRC.GetNextChar
bcs .9
jsr SRC.GetDecimal
@ -215,9 +215,9 @@ EXP.GetSymL jsr SRC.GetNextChar
sec
.8 rts
*---------------------------------------
EXP.GetSymG >DEBUG
jsr SYM.LookupGlobal
bcc .8
EXP.GetGlobal jsr SYM.LookupGlobal
bcc .2
>LDA.G ASM.PASS pass#2?
bne EXP.EvalExitUND yes, undefined symbol
@ -235,6 +235,11 @@ EXP.GetSymG >DEBUG
cmp #'_'
beq .1
clc
rts
.2
.8 clc
rts
*---------------------------------------

View File

@ -58,7 +58,8 @@ MAC.Quit >LDA.G MAC.hCtxBuf
*---------------------------------------
MAC.AddChar tax
phy
>LDA.G ASM.PASS If Pass#2, ignore
bne .8
>LDA.G MAC.BufPtr
tay
@ -66,7 +67,6 @@ MAC.AddChar tax
txa
sta (ZPMacroBuf),y
>INC.G MAC.BufPtr
ply
txa
bne .8

View File

@ -24,21 +24,12 @@ SRC.ParseLine jsr OUT.Reset
.1 >LDA.G ASM.MA.ON
bmi SRC.ParseLine.MACRO
jsr SRC.ParseLine.LABEL
bcs .9
* >LDA.G SYM.bNewGlobal
* bpl .8
* jmp SYM.StoreGlobal
jmp SRC.ParseLine.LABEL
.8 clc
.9 rts
*---------------------------------------
SRC.ParseLine.Macro
>LDA.G ASM.PASS If Pass#2, ignore
bne .8
>STZ.G MAC.BufPtr
sta (ZPMacroBuf)
@ -142,7 +133,7 @@ SRC.ParseLine.LABEL
cmp #'.' local symbol?
bne .1
>LDA.G SYM.bNewGlobal Not relative to Global label...
>LDA.G SYM.bInGlobal Not relative to Global label...
bpl SRC.ParseLine.InvLbl
jsr SRC.GetNextChar
@ -246,7 +237,7 @@ SRC.ParseLine.OpCode
>LDYA ZPOpsPtr
>STYA ZPOpDefPtr
.1 lda (ZPOpDefPtr) End Of OpCode List
ldy #1
ora (ZPOpDefPtr),y
@ -391,10 +382,6 @@ SRC.ParseLine.AM
.99 rts
*---------------------------------------
SRC.ParseLine.AMCheck
* jsr OUT.PrintLine.1
>LDYA L.SRC.AM.StrBuf
>SYSCALL puts
>DEBUG
lda SRC.AM.StrBuf
beq SRC.ParseLine.OPAMCheckFF

View File

@ -38,7 +38,7 @@ SYM.Init >SYSCALL SListNew
.9 rts
*---------------------------------------
SYM.Reset >STZ.G SYM.bNewGlobal
SYM.Reset >STZ.G SYM.bInGlobal
rts
*---------------------------------------
SYM.Quit >LDA.G SYM.hNameBuf
@ -182,7 +182,7 @@ SYM.NewGlobal jsr SYM.StoreGlobal
sta (ZPGlobalBuf),y
lda #$ff
>STA.G SYM.bNewGlobal
>STA.G SYM.bInGlobal
clc
rts
@ -206,15 +206,20 @@ SYM.GetGlobal >PUSHW ZPLinePtr Pass #2: should be already defined...
.1 >PUSHWI 0 Start
>PUSHWI $ffff End
>PUSHWI ZPGlobalBuf
>PUSHW SYM.GlobalID
>PUSHW ZPGlobalBuf
>PUSHW.G SYM.GlobalID
>LDA.G SYM.hGlobalList
>SYSCALL SListGetData
bcs .99
lda #$ff
>STA.G SYM.bInGlobal
* clc
rts
.9 lda #ERR.UNDEF.SYMBOL
sec
rts
.99 rts
*---------------------------------------
SYM.LookupGlobal
>PUSHW ZPLinePtr
@ -234,7 +239,7 @@ SYM.LookupGlobal
.1 >LDA.G SYM.GlobalID
cmp ZPPtr1
bne .3
iny
iny SYM.GlobalID+1
lda (pData),y
cmp ZPPtr1+1
bne .3
@ -245,6 +250,7 @@ SYM.LookupGlobal
sta SRC.ACC.F,y
dey
bpl .2
clc
rts
@ -263,7 +269,7 @@ SYM.LookupGlobal
SYM.StoreGlobal >LDA.G ASM.PASS
bne .8
>LDA.G SYM.bNewGlobal
>LDA.G SYM.bInGlobal
bpl .8
>LDA.G SYM.GlobalPtr
@ -291,18 +297,28 @@ SYM.StoreGlobal >LDA.G ASM.PASS
bcs .9
lda #0
>STA.G SYM.bNewGlobal
>STA.G SYM.bInGlobal
rts
.8 clc
.9 rts
*---------------------------------------
SYM.UpdateGlobal
>PUSHWI SYMG
>PUSHW L.SRC.ACC.F
>PUSHW.G SYM.GlobalID
>LDA.G SYM.hGlobalList
>SYSCALL SListSetData
rts
*---------------------------------------
SYM.PC2Acc ldy #ASM.PC+3
ldx #3
.1 lda (pData),y
sta SRC.ACC,x
dey
dex
bpl .1
lda #2
@ -325,9 +341,9 @@ SYM.Acc2Global ldy #SYMG-1
* 1-4 : 32 bits Value (PC)
*---------------------------------------
SYM.NewOrGetLocalA
tax Save ID
tax Save Local ID
>LDA.G SYM.bNewGlobal not in a global label
>LDA.G SYM.bInGlobal not in a global label
bpl .91
>LDA.G ASM.PASS Pass #2: should be already defined...
@ -361,9 +377,13 @@ SYM.NewOrGetLocalA
sta (ZPGlobalBuf),y
dex
bne .2
tya
>STA.G SYM.GlobalPtr
iny
lda #0
sta (ZPGlobalBuf),y
clc
rts
@ -380,9 +400,11 @@ SYM.NewOrGetLocalA
sec
rts
*---------------------------------------
SYM.GetLocalX >LDA.G SYM.GlobalPtr
tay
SYM.GetLocalX lda (ZPGlobalBuf)
and #SYMG.F.LOCALS
beq .9
ldy #SYML
.1 lda (ZPGlobalBuf),y
beq .9

View File

@ -443,7 +443,7 @@ T.LI >PSTR "ON"
ASM..T. .AZ ".T."
ASM.6502 .AZ "6502"
MSG.HELP .AZ "A2osX-Macro Assembler (S-C MASM 3.0 Based)\r\nUsage : ASM <src file> [type TXT ($04) or S-C/BAS ($FA)]\r\n"
MSG.PASS .AZ "**** Pass:#%d\r\n"
MSG.PASS .AZ "\r\n**** Pass:#%d ****\r\n\r\n"
MSG.SRC.FILE .AZ "**** Reading SRC File:%s\r\n"
MSG.OBJ.FILE .AZ "**** Writing OBJ File:%s, Type=%02x\r\n"
MSG.T.FILE .AZ "**** Loading CPU File:%s\r\n"
@ -451,14 +451,14 @@ 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.LSYMBOL .AZ " .%d=%h%h%h%h"
MSG.SRCLINE .AZ " %05D %s\r\n"
MSG.ERROR .AZ "*** Fatal Error $%h"
MSG.ERROR .AZ "**** Fatal Error $%h"
MSG.SYMBOLS .AZ "Symbol Table:"
MSG.CRLF .AZ " \r\n"
MSG.SUMMARY .AZ "\r\nSymbol Table Size : %5D Bytes.\r\nEnd Of Assembly.\r\n"
@ -533,7 +533,7 @@ ASM.PC.PH .BS 4
ASM.PC.DU .BS 4
SYM.hGlobalList .BS 1
SYM.bNewGlobal .BS 1
SYM.bInGlobal .BS 1
SYM.GlobalID .BS 2
SYM.hGlobalBuf .BS 1
SYM.GlobalPtr .BS 1