Kernel 0.9.1 : ASM rewrite....Symbols DB

This commit is contained in:
Rémy GIBERT 2018-01-23 16:52:22 +00:00
parent c9a37c4fad
commit f2cbecc25f
9 changed files with 90 additions and 107 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,15 +2,15 @@ NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*---------------------------------------
DIR.Init lda #$00
DIR.Init lda #$80
ldy #ASM.LI.ON
sta (pData),y
lda #0
ldy #ASM.LI.CON
sta (pData),y
ldy #ASM.LI.XON
sta (pData),y
lda #$80
ldy #ASM.LI.ON
sta (pData),y
rts
*---------------------------------------
DIR.AC clc
@ -172,14 +172,13 @@ DIR.EP ldy #ASM.PH.ON
clc
rts
.9 lda #ERR.INV.DIRECTIVE
.9 lda #ERR.INV.DIR
sec
rts
*---------------------------------------
DIR.EQ jsr SRC.GetNextCharNB
bcs .99
>DEBUG
jsr EXP.Eval
bcs .9
@ -207,7 +206,7 @@ DIR.FI ldy #ASM.DO.Count
.1 clc
rts
.99 lda #ERR.INV.DIRECTIVE
.99 lda #ERR.INV.DIR
sec
rts
*---------------------------------------
@ -268,6 +267,7 @@ DIR.LI.OFF ldy #ASM.LI.ON
DIR.LI.APPLY lsr
sta (pData),y
clc
rts
DIR.LI.9 lda #ERR.SYNTAX.ERROR
@ -282,7 +282,7 @@ DIR.MA jsr SRC.GetNextCharNB
jsr SRC.PrintLine
lda (ZPLineBuf)
lda SRC.GetChar
beq .1
cmp #'*' Comment?
@ -392,7 +392,7 @@ DIR.PH ldy #ASM.PH.ON
jmp DIR.OR
.9 lda #ERR.INV.DIRECTIVE
.9 lda #ERR.INV.DIR
sec
rts
*---------------------------------------

View File

@ -13,9 +13,9 @@ AUTO 4,1
EXP.Eval stz EXP.Operator
stz EXP.Modifier
lda (ZPLinePtr)
beq EXP.Eval.Missing
jsr SRC.GetChar
bcs EXP.Eval.Missing
jsr SRC.IsMODReserved
bcs EXP.Eval.Next1
@ -133,7 +133,7 @@ EXP.EvalOperator lda EXP.Operator
jsr EXP.Compute
bcs EXP.EvalExitRTS
.7 jsr SRC.GetNextChar
.7 jsr SRC.GetChar
bcs EXP.EvalExitOK
cmp #' '

View File

@ -2,9 +2,7 @@ NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*---------------------------------------
SRC.PrintLine bra .8
>LDA.G ASM.MACRO.ON
SRC.PrintLine >LDA.G ASM.MACRO.ON
bpl .1
>LDA.G ASM.LI.CON
@ -29,10 +27,8 @@ SRC.PrintLineErr >PUSHW ZPLineBuf
>SYSCALL PrintF.YA
bcs .9
lda ZPLinePtr
sec
sbc ZPLineBuf
tax
ldx ZPLinePtr
cpx ZPLineBuf
beq .4
.3 phx
@ -41,6 +37,7 @@ SRC.PrintLineErr >PUSHW ZPLineBuf
plx
bcs .9
dex
cpx ZPLineBuf
bne .3
.4 lda #'^'
@ -56,60 +53,54 @@ SRC.PrintLineErr >PUSHW ZPLineBuf
.9 rts
*---------------------------------------
SRC.ParseLine lda (ZPLineBuf)
tax
beq .1
SRC.ParseLine lda #0
>STA.G SYM.bGlobalUpdate
jsr SRC.GetChar
bcs .8
cmp #'*' Comment?
beq .1
beq .8
cmp #';' Comment?
beq .1
beq .8
ldy #ASM.DO.ON
lda (pData),y
bne .1
cmp #' ' no label...go scan dir/opcode
beq SRC.ParseLine.DirOp
lda #0
>STA.G SYM.bGlobalUpdate
cpx #' ' no label...go scan dir/opcode
beq .4
cpx #'.' local symbol?
cmp #'.' local symbol?
bne .2
>DEBUG
jsr SRC.GetNextChar skip '.'
bcs SRC.ParseLine.Inv
jsr SRC.GetNextChar
bcs SRC.ParseLine.InvLbl
jsr SRC.GetDecimal
bcs SRC.ParseLine.Inv
bcs SRC.ParseLine.InvLbl
lda SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
bne SRC.ParseLine.Inv Max .255
bne SRC.ParseLine.InvLbl Max .255
lda SRC.ACC
beq SRC.ParseLine.Inv .0 is not allowed
beq SRC.ParseLine.InvLbl .0 is not allowed
jsr SYM.AddLocal
bra .3
.1 clc
.8 clc
rts
.2 jsr SYM.AddGlobalPC
.3 bcs SRC.ParseLine.Err
.4 jsr SRC.GetNextCharNB Scan for an Opcode...
SRC.ParseLine.DirOp jsr SRC.GetNextCharNB Scan for an Opcode...
bcs SRC.ParseLine.Ok
cmp #'.'
bne .5
jsr SRC.GetNextChar Skip .
jsr SRC.GetNextChar
bcs SRC.ParseLine.InvDir
jsr SRC.ParseLine.Dir
bcs SRC.ParseLine.Err
@ -150,7 +141,8 @@ SRC.ParseLine.Ok >LDA.G SYM.bGlobalUpdate
.8 clc
rts
SRC.ParseLine.Inv lda #ERR.INV.LABEL
SRC.ParseLine.InvLbl
lda #ERR.INV.LABEL
SRC.ParseLine.Err sec
rts
@ -158,27 +150,18 @@ SRC.ParseLine.Redef lda #ERR.SYMBOL.REDEFINE
sec
rts
SRC.ParseLine.SymR lda #ERR.RANGE
SRC.ParseLine.InvDir
lda #ERR.INV.DIR
sec
rts
*---------------------------------------
SRC.ParseLine.SymP jsr SRC.GetNextChar
bcs SRC.ParseLine.Inv
jsr SRC.GetDecimal
bcs SRC.ParseLine.Inv
jmp SYM.AddPrivate
*---------------------------------------
SRC.ParseLine.Dir >LDYA L.T.DIRECTIVES
jsr SRC.GetKeyword
bcs .9
bcs SRC.ParseLine.InvDir
jmp (J.DIRECTIVES,x)
.9 lda #ERR.INV.DIRECTIVE
sec
rts
*---------------------------------------
SRC.ParseLine.Exec.Macro
clc
@ -397,13 +380,13 @@ SRC.ParseLine.AM stz SRC.AM.ID
sec
.99 rts
*---------------------------------------
SRC.GetDecimal stz SRC.ACC+1
SRC.GetDecimal jsr SRC.GetChar
beq .99
stz SRC.ACC+1
stz SRC.ACC+2
stz SRC.ACC+3
lda (ZPLinePtr)
beq .99
jsr SRC.IsDigit10
bcs .99
@ -454,13 +437,13 @@ SRC.GetDecimal stz SRC.ACC+1
sec
rts
*---------------------------------------
SRC.GetHex stz SRC.ACC+1
SRC.GetHex jsr SRC.GetNextChar skip '$'
bcs .99
stz SRC.ACC+1
stz SRC.ACC+2
stz SRC.ACC+3
jsr SRC.GetNextChar
bcs .99
jsr SRC.IsDigit16
bcs .99
@ -501,15 +484,13 @@ SRC.GetHex stz SRC.ACC+1
sec
rts
*---------------------------------------
SRC.GetOctal stz SRC.ACC+1
SRC.GetOctal jsr SRC.GetNextChar skip '&'
bcs .99
stz SRC.ACC+1
stz SRC.ACC+2
stz SRC.ACC+3
jsr SRC.GetNextChar
bcs .99
lda (ZPLinePtr)
beq .99
jsr SRC.IsDigit8
bcs .99
@ -559,13 +540,13 @@ SRC.GetOctal stz SRC.ACC+1
sec
rts
*---------------------------------------
SRC.GetBinary stz SRC.ACC+1
SRC.GetBinary jsr SRC.GetNextChar skip '%'
bcs .99
stz SRC.ACC+1
stz SRC.ACC+2
stz SRC.ACC+3
jsr SRC.GetNextChar
bcs .99
cmp #'1'
beq .10
@ -748,7 +729,7 @@ SRC.IsDigit8 cmp #'0'
.9 sec
rts
*---------------------------------------
SRC.GetNextCharNB jsr SRC.GetNextCharUC
SRC.GetNextCharNB jsr SRC.GetNextChar
bcs .9
cmp #' '
beq SRC.GetNextCharNB
@ -769,24 +750,24 @@ SRC.GetNextCharUC jsr SRC.GetNextChar
.9 rts
*---------------------------------------
SRC.GetNextChar lda (ZPLinePtr)
beq .9
beq SRC.GetChar.ERR
cmp #$0D
beq .9
beq SRC.GetChar.ERR
inc ZPLinePtr
bne .8
bne SRC.GetChar
inc ZPLinePtr+1
.8 lda (ZPLinePtr)
beq .9
SRC.GetChar lda (ZPLinePtr)
beq SRC.GetChar.ERR
cmp #$0D
beq .9
beq SRC.GetChar.ERR
clc
rts
.9 sec
SRC.GetChar.ERR sec
rts
*---------------------------------------
SRC.ACC10 lda SRC.ACC ACC*2-> ACC & ACCTMP

View File

@ -45,7 +45,6 @@ SYM.Dump >LDYA L.MSG.SYMBOLS
.1 >PUSHB.G SYM.hGlobals
>PUSHW ZPLinePtr
>PUSHW ZPTmpBuf
>SYSCALL SListGetByID
bcs .8
>STYA ZPLinePtr

View File

@ -38,13 +38,12 @@ ERR.INV.ARGS .EQ $80
ERR.SRC.INV.TYPE .EQ $90
ERR.SRC.TOO.MANY.IN .EQ $91
ERR.SRC.UNEXP.EOF .EQ $92
ERR.OOM .EQ $93
ERR.SYNTAX.ERROR .EQ $A0
ERR.SYM.TOO.LONG .EQ $A1
ERR.VAL.TOO.BIG .EQ $A2
ERR.LINE.TOO.LONG .EQ $A3
ERR.INV.LABEL .EQ $A4
ERR.INV.DIRECTIVE .EQ $A5
ERR.INV.DIR .EQ $A5
ERR.INV.OPCODE .EQ $A6
ERR.INV.AM.SYN .EQ $A7
ERR.INV.AM.4.OC .EQ $A8
@ -247,6 +246,7 @@ CS.RUN >SYSCALL GetChar
bne .1
inc
sta (pData),y
jsr DIR.Init Reset
clc
rts
@ -276,6 +276,9 @@ CS.RUN >SYSCALL GetChar
>PUSHW SRC.LINENUM
>LDYA L.MSG.ERROR
>SYSCALL PrintF.YA
jsr SYM.Dump
pla
sec
rts
@ -373,7 +376,7 @@ MSG.PASS >CSTR "Pass:#%d\r\n"
MSG.SRC.FILE >CSTR "Reading SRC File:%s\r\n"
MSG.OBJ.FILE >CSTR "Writing OBJ File:%s, Type=%02x\r\n"
MSG.T.FILE >CSTR "Loading CPU File:%s\r\n"
MSG.SRCLINE >CSTR "%H: %05D-%s\r\n"
MSG.SRCLINE >CSTR "%H- %05D %s\r\n"
MSG.LINECR >CSTR "%s\r\n"
MSG.ERROR >CSTR "%05D-Error:$%h\r\n"
MSG.SYMBOLS >CSTR "Symbol Table:\r\n"
@ -393,7 +396,6 @@ EXP.Modifier .BS 1
SRC.LINENUM .BS 2
SRC.LinePtrSave .BS 2
SRC.Directive.ID .BS 1
SRC.Keyword.ID .BS 1
SRC.ACC .BS 4
SRC.ACCTMP .BS 4

View File

@ -8,8 +8,9 @@ AUTO 4,1
*--------------------------------------
.INB /A2OSX.BUILD/INC/MACROS.I
.INB /A2OSX.BUILD/INC/A2OSX.I
.INB /A2OSX.BUILD/INC/GUI.I
.INB /A2OSX.BUILD/INC/LIBGUI.I
.INB /A2OSX.BUILD/X.FNT.I
.INB /A2OSX.BUILD/ROOT/X.FNT.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPInputBufPtr .EQ ZPBIN+2
@ -807,7 +808,7 @@ CS.QUIT >LDA.G hOutPutBuf
*--------------------------------------
CS.END
*--------------------------------------
.INB /A2OSX.BUILD/X.TWIST.G
.INB /A2OSX.BUILD/ROOT/X.TWIST.G
*--------------------------------------
OptionList >PSTR "NnVv"
OptionVars .DA #bNoShrink,#bNoShrink,#bVerbose,#bVerbose
@ -846,5 +847,5 @@ DS.END
.ED
*--------------------------------------
MAN
SAVE /A2OSX.BUILD/FNT2FON.S
SAVE /A2OSX.BUILD/ROOT/FNT2FON.S
ASM

View File

@ -40,7 +40,7 @@ SLIST.Add jsr SLIST.Search
jsr MEM.GetDataByteY
tax
>DEBUG
jsr SLIST.AddBlockByte
bcs .9
@ -83,7 +83,6 @@ SLIST.Lookup jsr SLIST.Search
.9 rts
*--------------------------------------
SLIST.GetByID jsr SLIST.Select
jsr SLIST.GetBlockByte
bcs .9
@ -93,8 +92,8 @@ SLIST.GetByID jsr SLIST.Select
jsr MEM.SetDataByteY
.1 iny
jsr SLIST.GetBlockByte
.1 jsr SLIST.GetBlockByte
iny
jsr MEM.SetDataByteY
dex
bne .1
@ -103,16 +102,17 @@ SLIST.GetByID jsr SLIST.Select
tax
iny
jsr MEM.SetDataByteY
.2 iny
jsr SLIST.GetBlockByte
.2 jsr SLIST.GetBlockByte
iny
jsr MEM.SetDataByteY
dex
bne .2
ldy SLIST.IndexOfs
lda SLIST.BlockOfs
lda SLIST.IndexOfs
ldy SLIST.BlockOfs
clc
rts
@ -180,15 +180,15 @@ SLIST.Free.A sta .8+1
SLIST.Select jsr K.GetMemPtr.A
>STYA ZPSListIndex
ldy ZPSListKey
lda (ZPSListIndex),y
ldy ZPSListKey+1
sty SLIST.IndexOfs
sta SLIST.IndexOfs
lda (ZPSListIndex),y
jsr K.GetMemPtr.A
>STYA ZPSListBlock
lda ZPSListKey+1
lda ZPSListKey
sta SLIST.BlockOfs
rts
*--------------------------------------