2015-10-04 20:55:51 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
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)
|
|
|
|
|
*---------------------------------------
|
2015-11-20 16:31:14 +00:00
|
|
|
|
SYM.Init lda #0
|
2015-12-04 16:33:33 +00:00
|
|
|
|
ldy #SYM.iLastGBlock
|
2015-11-20 16:31:14 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
dec
|
2015-12-04 16:33:33 +00:00
|
|
|
|
ldy #SYM.pLastGBlock
|
2015-11-20 16:31:14 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
jsr SYM.NewGBlock
|
2015-10-30 16:34:59 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
2015-12-04 16:33:33 +00:00
|
|
|
|
SYM.Quit ldy #SYM.pLastGBlock
|
2015-11-13 16:25:31 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
bmi .8
|
2015-11-20 16:31:14 +00:00
|
|
|
|
|
2015-11-13 16:25:31 +00:00
|
|
|
|
.1 clc
|
|
|
|
|
adc #SYM.hGBlocks
|
|
|
|
|
tay
|
2015-10-30 16:34:59 +00:00
|
|
|
|
lda (pData),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
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
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2015-10-30 16:34:59 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2016-10-29 19:58:21 +00:00
|
|
|
|
SYM.Dump >LDYA L.MSG.SYMBOLS
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
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
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>LDYA L.MSG.GSYMBOL
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-12-04 16:33:33 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +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
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>LDYA L.MSG.LSYMBOL
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcc .4
|
2015-12-04 16:33:33 +00:00
|
|
|
|
rts
|
2015-11-20 16:31:14 +00:00
|
|
|
|
|
|
|
|
|
.5 lda #13
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL COutA
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
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 >PUSHWI 256
|
2015-11-13 16:25:31 +00:00
|
|
|
|
>PUSHBI S.MEM.F.INIT0
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMem
|
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
|
2015-11-20 16:31:14 +00:00
|
|
|
|
adc #SYM.hGBlocks
|
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 BIN/ASM.S.SYM
|
|
|
|
|
LOAD BIN/ASM.S
|
|
|
|
|
ASM
|