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)
|
|
|
|
|
* 0-3 : 32 bits Value
|
|
|
|
|
* 4 : Flags:
|
2015-10-30 16:34:59 +00:00
|
|
|
|
* b7=R/W (.SE)
|
2015-11-13 16:25:31 +00:00
|
|
|
|
* b6=pending
|
|
|
|
|
* 5 : Len
|
|
|
|
|
* 6-... Name
|
|
|
|
|
* ......
|
|
|
|
|
* Local Symbol Record: (2 bytes)
|
|
|
|
|
* 2 : Local ID (0->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 jsr SYM.NewGBlock
|
2015-10-30 16:34:59 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
2015-11-13 16:25:31 +00:00
|
|
|
|
SYM.Quit ldy #SYM.LastGBlock
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bmi .8
|
|
|
|
|
|
|
|
|
|
.1 clc
|
|
|
|
|
adc #SYM.hGBlocks
|
|
|
|
|
tay
|
2015-10-30 16:34:59 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
2015-11-13 16:25:31 +00:00
|
|
|
|
ldy #SYM.LastGBlock
|
|
|
|
|
lda (pData),y
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2015-10-30 16:34:59 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-10-28 16:55:12 +00:00
|
|
|
|
SYM.AddGlobal
|
2015-10-04 20:55:51 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-10-28 16:55:12 +00:00
|
|
|
|
SYM.LookupGlobal
|
2015-10-04 20:55:51 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-11-13 16:25:31 +00:00
|
|
|
|
SYM.AddLocal
|
2015-10-04 20:55:51 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-11-13 16:25:31 +00:00
|
|
|
|
SYM.LookupLocal
|
2015-10-04 20:55:51 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
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-13 16:25:31 +00:00
|
|
|
|
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
|
2015-10-04 20:55:51 +00:00
|
|
|
|
inx
|
2015-11-13 16:25:31 +00:00
|
|
|
|
iny
|
|
|
|
|
cpx #6
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
ldx #0
|
2015-10-04 20:55:51 +00:00
|
|
|
|
|
2015-11-13 16:25:31 +00:00
|
|
|
|
.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
|
2015-10-04 20:55:51 +00:00
|
|
|
|
>SYSCALL SYS.GetMem
|
|
|
|
|
bcs .9
|
2015-11-13 16:25:31 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
ldy #SYM.LastGBlock
|
|
|
|
|
lda (pData),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
ldy #SYM.hGBlocks
|
|
|
|
|
clc
|
|
|
|
|
adc (pData),y
|
|
|
|
|
tay
|
2015-10-04 20:55:51 +00:00
|
|
|
|
txa
|
2015-11-13 16:25:31 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
ldy #SYM.GBlockPtr
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2015-10-04 20:55:51 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE BIN/ASM.S.SYM
|
|
|
|
|
LOAD BIN/ASM.S
|
|
|
|
|
ASM
|