Kernel 0.9.1 : ASM rewrite....

This commit is contained in:
Rémy GIBERT 2018-01-22 16:52:04 +00:00
parent 47bd2c8ed7
commit c5959af52d
7 changed files with 87 additions and 55 deletions

Binary file not shown.

Binary file not shown.

View File

@ -178,13 +178,13 @@ DIR.EP ldy #ASM.PH.ON
DIR.EQ jsr SRC.GetNextCharNB
beq .99
>DEBUG
jsr EXP.Eval
bcs .9
ldx #3
jsr SYM.UpdateGlobal
bcs .9
* jsr SYM.UpdateGlobal
* bcs .9
clc
rts

View File

@ -77,6 +77,19 @@ SRC.ParseLine lda (ZPLineBuf)
cpx #'.' local symbol?
bne .2
jsr SRC.GetNextChar skip '.'
beq SRC.ParseLine.Inv
jsr SRC.GetDecimal
bcs SRC.ParseLine.Inv
lda SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
bne SRC.ParseLine.Inv Max .255
lda SRC.ACC
beq SRC.ParseLine.Inv .0 is not allowed
jsr SYM.AddLocal
bra .3
@ -113,16 +126,15 @@ SRC.ParseLine lda (ZPLineBuf)
SRC.ParseLine.Ok >LDA.G SYM.bGlobalUpdate
bpl .8
bra .8
ldy #ASM.PASS
lda (pData),y pass#2?
bne .8 yes, nothing to do
* --- Pass #1
jsr SYM.UpdateGlobal
bcs SRC.ParseLine.Inv if CS, not found ???
>LDA.G SYM.Global+SYM.F
bit #SYM.F.RESOLVED found symbol pending ?
bne .2 yes, update
@ -144,35 +156,17 @@ SRC.ParseLine.Err sec
SRC.ParseLine.Redef lda #ERR.SYMBOL.REDEFINE
sec
rts
*---------------------------------------
SRC.ParseLine.SymP jsr SRC.GetNextChar
beq SRC.ParseLine.SymE
jsr SRC.GetDecimal
bcs SRC.ParseLine.SymE
jmp SYM.AddPrivate
*---------------------------------------
SRC.ParseLine.SymL jsr SRC.GetNextChar
beq SRC.ParseLine.SymE
jsr SRC.GetDecimal
bcs SRC.ParseLine.SymE
lda SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
bne SRC.ParseLine.SymE Max .255
lda SRC.ACC
beq SRC.ParseLine.SymE .0 is not allowed
clc
rts
*---------------------------------------
SRC.ParseLine.SymE lda #ERR.INV.LABEL
sec
rts
SRC.ParseLine.SymR lda #ERR.RANGE
sec
rts
*---------------------------------------
SRC.ParseLine.SymP jsr SRC.GetNextChar
beq SRC.ParseLine.Inv
jsr SRC.GetDecimal
bcs SRC.ParseLine.Inv
jmp SYM.AddPrivate
*---------------------------------------
SRC.ParseLine.Dir >LDYA L.T.DIRECTIVES
jsr SRC.GetKeyword

View File

@ -28,7 +28,7 @@ AUTO 4,1
*---------------------------------------
SYM.Init >SYSCALL SListNew
bcs .9
>STA.G SYM.hGlobals
.9 rts
*---------------------------------------
@ -39,7 +39,42 @@ SYM.Quit >LDA.G SYM.hGlobals
SYM.Dump >LDYA L.MSG.SYMBOLS
>SYSCALL PrintF.YA
clc
stz ZPLinePtr
stz ZPLinePtr+1
.1 >PUSHB.G SYM.hGlobals
>PUSHW ZPLinePtr
>PUSHW ZPTmpBuf
>SYSCALL SListGetByID
bcs .8
>STYA ZPLinePtr
>PUSHW ZPTmpBuf Label (PString)
lda (ZPTmpBuf)
sec
adc ZPTmpBuf
sta ZPPtr1
lda ZPTmpBuf+1
adc #0
sta ZPPtr1+1
ldx #4
ldy #2
.2 lda (ZPPtr1),y
>PUSHA
iny
dex
bne .2
>LDYA L.MSG.GSYMBOL
>SYSCALL PrintF.YA
bcc .1
rts
.8 clc
rts
*---------------------------------------
SYM.AddGlobalPC ldx #4
@ -61,22 +96,21 @@ SYM.AddGlobalPC ldx #4
dey
dex
bne .2
>DEBUG
*---------------------------------------
SYM.AddGlobal lda #SYM.F.RESOLVED
>STA.G SYM.Global+SYM.F
lda #6 LEN+F+DWORD
>STA.G SYM.Global+SYM.LEN
>PUSHB.G SYM.hGlobals
>PUSHW ZPLinePtr
>PUSHEA.G SYM.Global
>SYSCALL SListAdd
bcs .9
adc ZPLinePtr
sta ZPLinePtr
bcc .1
@ -92,6 +126,8 @@ SYM.AddGlobal lda #SYM.F.RESOLVED
.9 rts
*---------------------------------------
SYM.UpdateGlobal >PUSHB.G SYM.hGlobals
>DEBUG
>PUSHW.G ASM.SYM.ID
>PUSHEA.G SYM.Global

View File

@ -81,7 +81,6 @@ L.MSG.LINECR .DA MSG.LINECR
L.MSG.ERROR .DA MSG.ERROR
L.MSG.SYMBOLS .DA MSG.SYMBOLS
L.MSG.GSYMBOL .DA MSG.GSYMBOL
L.MSG.LSYMBOL .DA MSG.LSYMBOL
L.MSG.SUMMARY .DA MSG.SUMMARY
L.MSG.PASS .DA MSG.PASS
L.MSG.SRC.FILE .DA MSG.SRC.FILE
@ -378,8 +377,7 @@ 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"
MSG.GSYMBOL >CSTR "$%H%H:%S"
MSG.LSYMBOL >CSTR " .%d:+$%h"
MSG.GSYMBOL >CSTR "$%H%H:%S\r\n"
MSG.SUMMARY >CSTR "\r\nEnd Of Assembly.\r\n"
SRC.AM.RESERVED >PSTR "[](),"
SRC.MOD.RESERVED >PSTR "#/<>"

View File

@ -13,14 +13,15 @@ X.SLIST jmp (.1-SYS.SListAdd,x)
SLIST.Add jsr SLIST.Search
bcc .9 Lookup succeeded...DUP
ldy #0
ldy #$ff
.1 jsr MEM.GetKeyCharY
iny
.1 iny
jsr MEM.GetKeyCharY
bcc .1
sty .8+1
tya
beq .9 CS
jsr SLIST.AddBlockByte
bcs .9
@ -35,20 +36,20 @@ SLIST.Add jsr SLIST.Search
iny
bra .2
.3 jsr MEM.GetDataByteY
.3 ldy #0
jsr MEM.GetDataByteY
tax
jsr SLIST.AddBlockByte
bcs .9
ldy #1
.4 jsr MEM.GetDataByteY
.4 iny
jsr MEM.GetDataByteY
jsr SLIST.AddBlockByte
bcs .9
iny
dex
bne .4
@ -83,13 +84,13 @@ SLIST.Lookup jsr SLIST.Search
*--------------------------------------
SLIST.GetByID jsr SLIST.Select
ldy #0
jsr SLIST.GetBlockByte
beq .9
bcs .9
tax
ldy #0
jsr MEM.SetDataByteY
.1 iny
@ -98,8 +99,10 @@ SLIST.GetByID jsr SLIST.Select
dex
bne .1
jsr MEM.SetDataByteY
jsr SLIST.GetBlockByte
tax
jsr MEM.SetDataByteY
.2 iny
@ -108,7 +111,8 @@ SLIST.GetByID jsr SLIST.Select
dex
bne .2
>LDYA ZPSListKey
ldy SLIST.IndexOfs
lda SLIST.BlockOfs
clc
rts