A2osX/BIN/ASM.S.SYM.txt
2015-11-13 17:25:31 +01:00

162 lines
3.0 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.

PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
*---------------------------------------
* Global Symbol Record: (8+ bytes)
* 0-3 : 32 bits Value
* 4 : Flags:
* b7=R/W (.SE)
* b6=pending
* 5 : Len
* 6-... Name
* ......
* Local Symbol Record: (2 bytes)
* 2 : Local ID (0->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 jsr SYM.NewGBlock
bcs .9
clc
.9 rts
*---------------------------------------
SYM.Quit ldy #SYM.LastGBlock
lda (pData),y
bmi .8
.1 clc
adc #SYM.hGBlocks
tay
lda (pData),y
>SYSCALL SYS.FreeMemA
ldy #SYM.LastGBlock
lda (pData),y
dec
sta (pData),y
bpl .1
.8 clc
rts
*---------------------------------------
SYM.AddGlobal
clc
rts
*---------------------------------------
SYM.LookupGlobal
clc
rts
*---------------------------------------
SYM.AddLocal
clc
rts
*---------------------------------------
SYM.LookupLocal
clc
rts
*---------------------------------------
SYM.AddPrivate
clc
rts
*---------------------------------------
SYM.LookupPrivate
clc
rts
*---------------------------------------
SYM.AddMacro
clc
rts
*---------------------------------------
SYM.LookupMacro
clc
rts
*---------------------------------------
SYM.AddToGBlock ldy #SYM.GBlockPtr
lda (pData),y
clc
adc #6 Value+Flags+Len
bcs .1
adc SRC.GLabel.Len
bcs .1
ldy #SYM.LastGBlock
lda (pData),y
>SYSCALL SYS.GetMemPtrA
>STYA ZPPtr1
bra .2
.1 jsr SYM.NewGBlock
bcs .9
>STYA ZPPtr1
.2 ldx #0
ldy #SYM.GBlockPtr
.3 lda SRC.GLabel.Value,x
sta (ZPPtr1),y
inx
iny
cpx #6
bne .3
ldx #0
.4 lda SRC.GLabel.Name,x
sta (ZPPtr1),y
inx
iny
cpx SRC.GLabel.Len
bne .4
tya
ldy #SYM.GBlockPtr
sta (pData),y set new SYM.GBlockPtr
clc
.9
rts
*---------------------------------------
SYM.NewGBlock >PUSHWI 256
>PUSHBI S.MEM.F.INIT0
>SYSCALL SYS.GetMem
bcs .9
>STYA ZPPtr1
ldy #SYM.LastGBlock
lda (pData),y
inc
sta (pData),y
ldy #SYM.hGBlocks
clc
adc (pData),y
tay
txa
sta (pData),y
lda #0
ldy #SYM.GBlockPtr
sta (pData),y
clc
.9 rts
*---------------------------------------
MAN
SAVE BIN/ASM.S.SYM
LOAD BIN/ASM.S
ASM