2022-01-30 21:47:08 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Input : ZPLineBufPtr, Y,A = T/Q, X = SC
|
|
|
|
|
* Output : Y,A = VarID
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.New >STYA ZPPtr2 T/Q
|
|
|
|
|
stx ZPPtr3 SC
|
|
|
|
|
|
|
|
|
|
ldy ScopePtr
|
|
|
|
|
lda (pData),y
|
|
|
|
|
sta hSymScope
|
|
|
|
|
jsr CC.SYM.NewKey
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-02-04 14:57:17 +00:00
|
|
|
|
>STYA ZPSymID Y,A = KeyID
|
|
|
|
|
stx ZPPtr3+1 X = KeyLen
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPSymBufPtr
|
|
|
|
|
stx hSymBuf
|
|
|
|
|
|
|
|
|
|
>LDYA ZPPtr2
|
|
|
|
|
jsr CC.SYM.SetTypeYA
|
|
|
|
|
|
|
|
|
|
lda ZPPtr3
|
|
|
|
|
ldy #SYM.SC
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
lda #SYM.Def
|
|
|
|
|
sta ZPSymSize
|
|
|
|
|
stz ZPSymSize+1
|
|
|
|
|
|
2022-02-04 14:57:17 +00:00
|
|
|
|
ldx ZPPtr3+1 Key Len
|
|
|
|
|
jsr CC.SYM.Link
|
|
|
|
|
|
|
|
|
|
jsr CC.SkipX
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs CC.SYM.SetAddr
|
|
|
|
|
|
|
|
|
|
cmp #'('
|
|
|
|
|
bne CC.SYM.NewV
|
|
|
|
|
|
|
|
|
|
jmp CC.F.Decl
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.NewV cmp #'['
|
|
|
|
|
bne CC.SYM.SetAddr
|
|
|
|
|
|
|
|
|
|
jsr CC.GetNextCharNB Skip [
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #']'
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
.2 ldy #SYM.Q
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
bit #SYM.Q.PPPOINTER
|
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
and #SYM.Q.AAARRAY
|
|
|
|
|
cmp #SYM.Q.AAARRAY
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
* ldy #SYM.Q
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
* clc
|
|
|
|
|
adc #SYM.Q.ARRAY
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
jsr CC.GetNextCharNB Skip ]
|
|
|
|
|
bcs CC.SYM.SetAddr
|
|
|
|
|
|
|
|
|
|
cmp #'['
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
bra CC.SYM.SetAddr
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.3 jsr CC.EXP.IntConst
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.SetSizeOf
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #']'
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetNextCharNB Skip ]
|
|
|
|
|
bcs CC.SYM.SetAddr
|
|
|
|
|
|
|
|
|
|
* cmp #'['
|
|
|
|
|
* bne CC.SYM.SetAddr
|
|
|
|
|
|
|
|
|
|
bra CC.SYM.SetAddr
|
|
|
|
|
|
|
|
|
|
.99 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.SetAddr ldy #SYM.Q
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
and #SYM.Q.FUNC
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
ldy #SYM.SC
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
beq CC.SYM.SetAddrG SYM.SC.STATIC
|
|
|
|
|
|
|
|
|
|
cmp #SYM.SC.AUTO
|
|
|
|
|
beq CC.SYM.SetAddrL
|
|
|
|
|
|
|
|
|
|
.9 lda #E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.SetAddrG jsr CC.SYM.GetSymSizeOfInAXC
|
|
|
|
|
jsr CC.SYM.SetSizeOf
|
|
|
|
|
|
|
|
|
|
* clc / sec A,X=Size, CS if pointer
|
|
|
|
|
|
|
|
|
|
ldy #SYM.Addr
|
|
|
|
|
|
|
|
|
|
lda ZPCCData
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
adc ZPCCData
|
|
|
|
|
sta ZPCCData
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda ZPCCData+1
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
adc ZPCCData+1
|
|
|
|
|
sta ZPCCData+1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.SetAddrL jsr CC.SYM.GetSymSizeOfInAXC
|
|
|
|
|
jsr CC.SYM.SetSizeOf
|
|
|
|
|
|
|
|
|
|
ldy #SYM.SizeOf+1
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
dey SYM.SizeOf
|
|
|
|
|
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
* clc / sec A,X=Size, CS if pointer
|
|
|
|
|
clc
|
|
|
|
|
adc LocalPtr
|
|
|
|
|
sta LocalPtr
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
ldy #SYM.Addr
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.GetSymSizeOfInAXC
|
|
|
|
|
jsr CODE.nAddLocal
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #E.BUF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.NewKey >PUSHA
|
|
|
|
|
>PUSHW ZPLineBufPtr
|
|
|
|
|
>SYSCALL SListNewKey
|
2022-02-04 14:57:17 +00:00
|
|
|
|
* bcs .9
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-02-04 14:57:17 +00:00
|
|
|
|
* clc Y,A = KeyID, X = KeyLen
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Input : ZPLineBufPtr, X = KeyLen
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.Link >LDYA L.CC.LIBC
|
|
|
|
|
>STYA ZPLookupPtr
|
|
|
|
|
|
|
|
|
|
phx
|
|
|
|
|
|
2022-02-04 14:57:17 +00:00
|
|
|
|
lda #0
|
|
|
|
|
ldy #SYM.Addr
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPLookupPtr)
|
|
|
|
|
beq .9 Ending 0, not found....
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
pha Get Back Len
|
|
|
|
|
cmp (ZPLookupPtr) Same Len ?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPLookupPtr),y
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
cmp (ZPLineBufPtr),y
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
lda (ZPLookupPtr)
|
|
|
|
|
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol
|
|
|
|
|
|
|
|
|
|
ldy #2 Skip LEN
|
|
|
|
|
lda (ZPLookupPtr),y
|
|
|
|
|
pha
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPLookupPtr),y
|
|
|
|
|
ply
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.SetAddrYA
|
|
|
|
|
|
|
|
|
|
plx
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.4 inx
|
|
|
|
|
inx
|
|
|
|
|
|
|
|
|
|
lda (ZPLookupPtr)
|
|
|
|
|
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol
|
|
|
|
|
|
|
|
|
|
lda (ZPLookupPtr)
|
|
|
|
|
jsr CC.ZPLookupPtrAddAp1 Skip LEN\definition
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.9 plx
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.Store >PUSHB hSymScope
|
|
|
|
|
>PUSHW ZPSymID
|
|
|
|
|
>PUSHW ZPSymBufPtr
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>PUSHB ZPSymSize
|
|
|
|
|
>SYSCALL SListAddData
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.NewScope ldy ScopePtr
|
|
|
|
|
cpy #CC.hSymbols+SCOPE.MAX-1
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListNew
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
inc ScopePtr
|
|
|
|
|
ldy ScopePtr
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
dec ScopenCnt
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #E.OOH
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.FreeScope
|
|
|
|
|
ldy ScopePtr
|
|
|
|
|
cpy #CC.hSymbols
|
|
|
|
|
beq *
|
|
|
|
|
|
|
|
|
|
lda (pData),y
|
|
|
|
|
>SYSCALL SListFree
|
|
|
|
|
|
|
|
|
|
dec ScopePtr
|
|
|
|
|
inc ScopenCnt
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.Lookup jsr CC.SYM.Push
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>PUSHB ScopePtr
|
|
|
|
|
|
|
|
|
|
.1 tay
|
|
|
|
|
lda (pData),y
|
|
|
|
|
jsr CC.SListLookup
|
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
lda (pstack)
|
|
|
|
|
cmp #CC.hSymbols
|
|
|
|
|
beq .9 CS
|
|
|
|
|
|
|
|
|
|
dec
|
|
|
|
|
sta (pstack)
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.9 jsr CC.SYM.Pop
|
|
|
|
|
|
|
|
|
|
inc pStack
|
|
|
|
|
|
|
|
|
|
lda #E.NOKEY
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 stx hSymBuf
|
|
|
|
|
|
|
|
|
|
>PULLA
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
|
|
|
|
sta hSymScope
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPSymBufPtr
|
|
|
|
|
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.Push ldx #7
|
|
|
|
|
|
|
|
|
|
.1 lda ZPSymID,x
|
|
|
|
|
jsr CC.Push
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.FreeBuf lda hSymBuf
|
|
|
|
|
|
|
|
|
|
stz hSymBuf
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.FreeBufPop
|
|
|
|
|
jsr CC.SYM.FreeBuf
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.Pop ldx #0
|
|
|
|
|
|
|
|
|
|
.1 jsr CC.Pop
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
sta ZPSymID,x
|
|
|
|
|
inx
|
|
|
|
|
cpx #8
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Y,A = value T/Q
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.PushValue
|
|
|
|
|
jsr CC.SYM.CheckTypeYA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.GetSymSizeOfInAXC
|
|
|
|
|
tax
|
|
|
|
|
jsr CODE.LDXI
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.GetAddrInYA
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
jsr CODE.LDYAI
|
|
|
|
|
jsr CODE.PushXFromYA
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 jsr CODE.GetLocal Y = local address
|
|
|
|
|
jsr CODE.PushXFromYA
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.PopValue jsr CC.SYM.CheckTypeYA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.GetSymSizeOfInAXC
|
|
|
|
|
tax
|
|
|
|
|
jsr CODE.LDXI
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.GetAddrInYA
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
jsr CODE.LDYAI
|
|
|
|
|
jsr CODE.PopXToYA
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 jsr CODE.GetLocal Y = local address
|
|
|
|
|
jsr CODE.PopXToYA
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.SetValue jsr CC.SYM.CheckTypeYA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.GetSymSizeOfInAXC
|
|
|
|
|
tax
|
|
|
|
|
jsr CODE.LDXI
|
|
|
|
|
|
|
|
|
|
jsr CC.SYM.GetAddrInYA
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
jsr CODE.LDYAI
|
|
|
|
|
jsr CODE.SetXToYA
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 jsr CODE.GetLocal Y = local address
|
|
|
|
|
jsr CODE.SetXToYA
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* in : Y,A = T/Q
|
|
|
|
|
* out : CC
|
|
|
|
|
* CS, A = E.TMISMATCH
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.CheckTypeYA
|
|
|
|
|
pha
|
|
|
|
|
tya
|
|
|
|
|
cmp (ZPSymBufPtr)
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
phy
|
|
|
|
|
ldy #SYM.Q
|
|
|
|
|
cmp (ZPSymBufPtr),y
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 pla
|
|
|
|
|
|
|
|
|
|
lda #E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* out : Y,A = T/Q
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.GetTypeInYA
|
|
|
|
|
ldy #SYM.Q
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
pha
|
|
|
|
|
lda (ZPSymBufPtr)
|
|
|
|
|
tay
|
|
|
|
|
pla
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* in : Y,A = T/Q
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.SetTypeYA
|
|
|
|
|
phy
|
|
|
|
|
ldy #SYM.Q
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
pla
|
|
|
|
|
sta (ZPSymBufPtr)
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* out : A,X,C = size
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.GetSymSizeOfInAXC
|
|
|
|
|
ldy #SYM.Q
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
pha
|
|
|
|
|
lda (ZPSymBufPtr) SYM.T
|
|
|
|
|
tay
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
CC.SYM.GetYASizeOfInAXC
|
|
|
|
|
|
|
|
|
|
bit #SYM.Q.PPPOINTER
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda CC.TYPESIZE-1,y
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 lda #2 pointer
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
sec +1 for hMem Storage
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* in/out : A,X,C = size
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.SetSizeOf
|
|
|
|
|
ldy #SYM.SizeOf
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.GetAddrInYA
|
|
|
|
|
ldy #SYM.Addr+1
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
dey #SYM.Addr
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
pla Z if Local
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.SYM.SetAddrYA
|
|
|
|
|
phy
|
|
|
|
|
|
|
|
|
|
ldy #SYM.Addr+1
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/cc.s.sym
|
|
|
|
|
LOAD usr/src/bin/cc.s
|
|
|
|
|
ASM
|