A2osX/BIN/ASM.S.SYM.txt
2018-01-26 07:04:29 +00:00

202 lines
3.7 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*---------------------------------------
* Global Symbol Record: (8+ bytes)
* 0 : Len (6)
* 1 : Flags:
* b7=0=pending,1=resolved
* b6=R/W (.SE)
* 2-5 : 32 bits Value
*
* Local Symbol Record: (2 bytes)
* 2 : Local ID (1->255)
* 3 : offset from Global Symbol
* ......
* Ending 0
*---------------------------------------
* Global Symbol Index (Sorted)
* 0 : hGblock
* 1 : Offset in block
*---------------------------------------
* Private Symbol Record: (7 bytes)
* 0,1 : MacroID
* 2 : Private ID (0->255)
* 3-6 : Value
*---------------------------------------
* Macro Record: ( bytes)
*---------------------------------------
SYM.Init >SYSCALL SListNew
bcs .9
>STA.G SYM.hGlobals
.9 rts
*---------------------------------------
SYM.Quit >LDA.G SYM.hGlobals
>SYSCALL SListFree.A
rts
*---------------------------------------
SYM.Dump >LDYA L.MSG.SYMBOLS
>SYSCALL PrintF.YA
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
ldy #ASM.PC
.1 lda (pData),y
pha
iny
dex
bne .1
ldx #4
ldy #SYM.Global+SYM.V+3
.2 pla
sta (pData),y
dey
dex
bne .2
*---------------------------------------
SYM.AddGlobal lda #SYM.F.RESOLVED
>STA.G SYM.Global+SYM.F
lda #5 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
inc ZPLinePtr+1
clc
.1 tya
>STA.G SYM.ID+1
dey
txa
sta (pData),y
.9 rts
*---------------------------------------
SYM.LookupGlobal >PUSHB.G SYM.hGlobals
>PUSHW ZPLinePtr
>PUSHEA.G SYM.Lookup
>SYSCALL SListLookup
bcs .9
adc ZPLinePtr
sta ZPLinePtr
bcc .1
inc ZPLinePtr+1
clc
.1 tya
>STA.G SYM.ID+1
txa
>STA.G SYM.ID
.9 rts
*---------------------------------------
SYM.UpdateGlobalAcc ldx #3
ldy #SYM.Global+SYM.V+3
.1 lda SRC.ACC,x
sta (pData),y
dey
dex
bpl .1
*---------------------------------------
SYM.UpdateGlobal lda #SYM.F.RESOLVED
>STA.G SYM.Global+SYM.F
lda #5 F+DWORD
>STA.G SYM.Global+SYM.LEN
>PUSHB.G SYM.hGlobals
>PUSHW.G SYM.ID
>PUSHEA.G SYM.Global
>SYSCALL SListUpdateByID
rts
*---------------------------------------
SYM.AddLocal
clc
rts
*---------------------------------------
SYM.GetLocal
clc
rts
*---------------------------------------
SYM.AddPrivate
clc
rts
*---------------------------------------
SYM.LookupPrivate
clc
rts
*---------------------------------------
SYM.AddMacro
clc
rts
*---------------------------------------
SYM.LookupMacro
clc
rts
*---------------------------------------
MAN
SAVE /A2OSX.BUILD/BIN/DEV/ASM.S.SYM
LOAD /A2OSX.BUILD/BIN/DEV/ASM.S
ASM