A2osX/BIN/ASM.S.SYM.txt

355 lines
6.6 KiB
Plaintext
Raw Normal View History

2015-10-04 20:55:51 +00:00
PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
2015-10-04 20:55:51 +00:00
INC 1
AUTO 6
2015-10-06 16:14:48 +00:00
.LIST OFF
2015-10-04 20:55:51 +00:00
*---------------------------------------
2015-11-13 16:25:31 +00:00
* Global Symbol Record: (8+ bytes)
2015-11-20 16:31:14 +00:00
* 0 : Flags:
* b7=Valid Entry
2015-11-13 16:25:31 +00:00
* b6=pending
2015-11-20 16:31:14 +00:00
* b0=R/W (.SE)
* 1-4 : 32 bits Value
2015-11-13 16:25:31 +00:00
* 5 : Len
* 6-... Name
* ......
* Local Symbol Record: (2 bytes)
2015-11-20 16:31:14 +00:00
* 2 : Local ID (1->255)
2015-10-30 16:34:59 +00:00
* 3 : offset from Global Symbol
2015-11-13 16:25:31 +00:00
* ......
* Ending 0
*---------------------------------------
* Global Symbol Index (Sorted)
* 0 : hGblock
* 1 : Offset in block
2015-10-30 16:34:59 +00:00
*---------------------------------------
* Private Symbol Record: (7 bytes)
* 0,1 : MacroID
2015-11-13 16:25:31 +00:00
* 2 : Private ID (0->255)
2015-10-30 16:34:59 +00:00
* 3-6 : Value
*---------------------------------------
2015-11-13 16:25:31 +00:00
* Macro Record: ( bytes)
*---------------------------------------
SYM.Init jmp SYM.NewGBlock
2015-10-30 16:34:59 +00:00
*---------------------------------------
2015-12-04 16:33:33 +00:00
SYM.Quit ldy #SYM.pLastGBlock
2015-11-13 16:25:31 +00:00
lda (pData),y
beq .8
2015-11-13 16:25:31 +00:00
.1 clc
adc #SYM.hGBlocks-1
2015-11-13 16:25:31 +00:00
tay
2015-10-30 16:34:59 +00:00
lda (pData),y
>SYSCALL FreeMem.A
2015-12-04 16:33:33 +00:00
ldy #SYM.pLastGBlock
2015-11-13 16:25:31 +00:00
lda (pData),y
dec
sta (pData),y
bne .1
2015-11-13 16:25:31 +00:00
2015-10-30 16:34:59 +00:00
.8 clc
rts
*---------------------------------------
SYM.Dump >LDYA L.MSG.SYMBOLS
>SYSCALL PrintF.YA
2015-11-20 16:31:14 +00:00
ldy #SYM.DumpCount
lda #20
sta (pData),y
2015-12-04 16:33:33 +00:00
jsr SYM.ResetGBlockPtr
2015-11-20 16:31:14 +00:00
.1 jsr SYM.GetByteGBlock Get Flags
sta SRC.GLabel.Flags
bne .10
2015-10-04 20:55:51 +00:00
clc
rts
2015-11-20 16:31:14 +00:00
.10 ldx #0
.2 jsr SYM.GetByteGBlock
sta SRC.GLabel.Value,x
inx
2015-12-04 16:33:33 +00:00
cpx #5
bne .2 Get Value+Len
2015-11-20 16:31:14 +00:00
ldx #0
.3 jsr SYM.GetByteGBlock
sta SRC.GLabel.Name,x
inx
cpx SRC.GLabel.Len
bne .3
>PUSHW L.SRC.GLabel.Len
lda SRC.GLabel.Value+1
>PUSHA
lda SRC.GLabel.Value
>PUSHA
lda SRC.GLabel.Value+3
>PUSHA
lda SRC.GLabel.Value+2
>PUSHA
>LDYA L.MSG.GSYMBOL
>SYSCALL PrintF.YA
2015-12-04 16:33:33 +00:00
bcs .9
2015-11-20 16:31:14 +00:00
.4 jsr SYM.GetByteGBlock
beq .5 End Locals...proceed next Global
pha
jsr SYM.GetByteGBlock
>PUSHA
pla
>PUSHA
>LDYA L.MSG.LSYMBOL
>SYSCALL PrintF.YA
bcc .4
2015-12-04 16:33:33 +00:00
rts
2015-11-20 16:31:14 +00:00
.5 lda #13
>SYSCALL PutChar.A
2015-11-20 16:31:14 +00:00
ldy #SYM.DumpCount
lda (pData),y
dec
bne .6
2015-12-04 16:33:33 +00:00
2015-11-20 16:31:14 +00:00
lda #20
.6 sta (pData),y
jmp .1
.9 rts
2015-10-04 20:55:51 +00:00
*---------------------------------------
2015-11-13 16:25:31 +00:00
SYM.AddPrivate
2015-10-04 20:55:51 +00:00
clc
rts
*---------------------------------------
2015-11-13 16:25:31 +00:00
SYM.LookupPrivate
2015-10-04 20:55:51 +00:00
clc
rts
*---------------------------------------
2015-11-13 16:25:31 +00:00
SYM.AddMacro
2015-10-04 20:55:51 +00:00
clc
rts
*---------------------------------------
2015-11-13 16:25:31 +00:00
SYM.LookupMacro
2015-10-04 20:55:51 +00:00
clc
rts
*---------------------------------------
2015-11-20 16:31:14 +00:00
SYM.UpdateGlobal
2015-11-27 16:26:11 +00:00
clc
rts
*---------------------------------------
2015-12-04 16:33:33 +00:00
SYM.SearchLocal
2015-11-27 16:26:11 +00:00
clc
rts
2015-11-20 16:31:14 +00:00
*---------------------------------------
2015-12-04 16:33:33 +00:00
SYM.SearchGlobal >STYA ZPSymbolPtr
jsr SYM.ResetGBlockPtr
2015-11-13 16:25:31 +00:00
2015-12-17 16:57:35 +00:00
.1 ldy #SYM.iCurGBlock
lda (pData),y
sta SYM.iCurGBlock.Save
ldy #SYM.pCurGBlock
lda (pData),y
sta SYM.pCurGBlock.Save
jsr SYM.GetByteGBlock Get Flags
2015-11-20 16:31:14 +00:00
beq .9
sta SRC.FLabel.Flags
ldx #0
.2 jsr SYM.GetByteGBlock
sta SRC.FLabel.Value,x
inx
2015-12-04 16:33:33 +00:00
cpx #5
bne .2 Get Value+Len
2015-11-20 16:31:14 +00:00
ldx #0
.3 jsr SYM.GetByteGBlock
sta SRC.FLabel.Name,x
inx
cpx SRC.FLabel.Len
bne .3
2015-12-04 16:33:33 +00:00
txa
ldy #5
cmp (ZPSymbolPtr),y
2015-11-20 16:31:14 +00:00
bne .5
2015-12-04 16:33:33 +00:00
ldx #0
.4 inx
iny
lda SRC.FLabel.Name-1,x
cmp (ZPSymbolPtr),y
2015-11-20 16:31:14 +00:00
bne .5
2015-12-04 16:33:33 +00:00
cpx SRC.FLabel.Len
2015-11-20 16:31:14 +00:00
bne .4
2015-12-04 16:33:33 +00:00
2015-12-17 16:57:35 +00:00
lda SYM.pCurGBlock.Save
ldy #SYM.pCurGBlock
sta (pData),y
lda SYM.iCurGBlock.Save
ldy #SYM.iCurGBlock
sta (pData),y
jmp SYM.GetGBlockA
2015-11-13 16:25:31 +00:00
2015-12-04 16:33:33 +00:00
.5 jsr SYM.GetByteGBlock skip Locals
2015-11-20 16:31:14 +00:00
beq .1
jsr SYM.GetByteGBlock
bra .5
.9 sec
rts
*---------------------------------------
2015-11-27 16:26:11 +00:00
SYM.AddGToGBlockYA >STYA ZPSymbolPtr
2015-12-04 16:33:33 +00:00
jsr SYM.SetGBlockPtr
2015-11-20 16:31:14 +00:00
2015-12-04 16:33:33 +00:00
ldy #SYM.pLastGBlock 1st Gblock to add?
2015-11-20 16:31:14 +00:00
lda (pData),y
2015-12-04 16:33:33 +00:00
ldy #SYM.iLastGBlock
2015-11-20 16:31:14 +00:00
ora (pData),y
beq .10 yes, skip closing previous one
2015-11-27 16:26:11 +00:00
lda #0 Close Pending Global/Local
2015-11-20 16:31:14 +00:00
jsr SYM.AddByteGBlock
bcs .9
2015-11-13 16:25:31 +00:00
2015-11-27 16:26:11 +00:00
.10 ldy #0
.1 lda (ZPSymbolPtr),y
2015-11-20 16:31:14 +00:00
jsr SYM.AddByteGBlock
bcs .9
2015-11-27 16:26:11 +00:00
iny
cpy #5
bne .1 moved Flags & Value to GBlock....
2015-11-13 16:25:31 +00:00
2015-11-27 16:26:11 +00:00
lda (ZPSymbolPtr),y Get Len
tax
jsr SYM.AddByteGBlock
bcs .9
2015-10-04 20:55:51 +00:00
2015-12-04 16:33:33 +00:00
.2 iny
lda (ZPSymbolPtr),y
2015-11-20 16:31:14 +00:00
jsr SYM.AddByteGBlock
bcs .9
2015-11-27 16:26:11 +00:00
dex
2015-11-20 16:31:14 +00:00
bne .2
2015-11-13 16:25:31 +00:00
2015-11-20 16:31:14 +00:00
clc
.9 rts
*---------------------------------------
2015-12-04 16:33:33 +00:00
SYM.AddLToGBlock jsr SYM.SetGBlockPtr
lda SRC.LLabel.ID
jsr SYM.AddByteGBlock
bcs .9
lda SRC.LLabel.Offset
jmp SYM.AddByteGBlock
.9 rts
*---------------------------------------
2015-11-20 16:31:14 +00:00
SYM.GetByteGBlock ldy #SYM.iCurGBlock
lda (pData),y
tay
lda (ZPBlockPtr),y
pha
ldy #SYM.iCurGBlock
lda (pData),y
inc
sta (pData),y
bne .1
2015-12-04 16:33:33 +00:00
ldy #SYM.pCurGBlock
2015-11-20 16:31:14 +00:00
lda (pData),y
inc
sta (pData),y
jsr SYM.GetGBlockA
.1 pla
clc
rts
*---------------------------------------
2015-12-17 16:57:35 +00:00
SYM.ResetGBlockPtr lda #0
ldy #SYM.pCurGBlock
sta (pData),y
ldy #SYM.iCurGBlock
sta (pData),y
bra SYM.GetGBlockA
*---------------------------------------
2015-12-04 16:33:33 +00:00
SYM.SetGBlockPtr ldy #SYM.pLastGBlock
2015-11-20 16:31:14 +00:00
lda (pData),y
2015-12-04 16:33:33 +00:00
2015-11-20 16:31:14 +00:00
SYM.GetGBlockA clc
adc #SYM.hGBlocks
tay
lda (pData),y
phx
>SYSCALL GetMemPtr.A
2015-11-20 16:31:14 +00:00
>STYA ZPBlockPtr
plx
rts
*---------------------------------------
2015-11-27 16:26:11 +00:00
SYM.AddByteGBlock phx
phy
pha
2015-12-04 16:33:33 +00:00
ldy #SYM.iLastGBlock
2015-11-20 16:31:14 +00:00
lda (pData),y
tay
pla
sta (ZPBlockPtr),y
2015-11-13 16:25:31 +00:00
tya
2015-11-20 16:31:14 +00:00
inc
2015-11-27 16:26:11 +00:00
beq SYM.NewGBlock2
2015-11-20 16:31:14 +00:00
2015-12-04 16:33:33 +00:00
ldy #SYM.iLastGBlock
2015-11-20 16:31:14 +00:00
sta (pData),y
2015-11-27 16:26:11 +00:00
ply
plx
2015-11-13 16:25:31 +00:00
clc
rts
*---------------------------------------
2015-11-20 16:31:14 +00:00
SYM.NewGBlock phx
2015-11-27 16:26:11 +00:00
phy
SYM.NewGBlock2 >LDYAI 256
>SYSCALL GetMem0.YA
2015-11-20 16:31:14 +00:00
2015-10-04 20:55:51 +00:00
bcs .9
2015-11-20 16:31:14 +00:00
>STYA ZPBlockPtr
2015-11-13 16:25:31 +00:00
2015-12-04 16:33:33 +00:00
ldy #SYM.pLastGBlock
2015-11-13 16:25:31 +00:00
lda (pData),y
inc
sta (pData),y
clc
2017-07-07 15:13:55 +00:00
adc #SYM.hGBlocks-1
2015-11-13 16:25:31 +00:00
tay
2015-11-20 16:31:14 +00:00
2015-10-04 20:55:51 +00:00
txa
2015-11-13 16:25:31 +00:00
sta (pData),y
lda #0
2015-12-04 16:33:33 +00:00
ldy #SYM.iLastGBlock
2015-11-13 16:25:31 +00:00
sta (pData),y
2015-10-04 20:55:51 +00:00
clc
2015-11-27 16:26:11 +00:00
.9 ply
plx
2015-11-20 16:31:14 +00:00
rts
*---------------------------------------
2015-10-04 20:55:51 +00:00
MAN
SAVE /A2OSX.SRC/BIN/ASM.S.SYM
LOAD /A2OSX.SRC/BIN/ASM.S
2015-10-04 20:55:51 +00:00
ASM