2022-01-30 21:47:08 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.GetTQInYA >ENTER 2
|
2022-01-30 21:47:08 +00:00
|
|
|
|
lda #0
|
|
|
|
|
sta (pStack) Type
|
|
|
|
|
ldy #1
|
|
|
|
|
sta (pStack),y Qual
|
|
|
|
|
|
2022-09-11 19:11:32 +00:00
|
|
|
|
jsr .8
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
pha
|
|
|
|
|
lda (pStack)
|
|
|
|
|
tay Y = Type
|
|
|
|
|
pla A = Qual
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.99 >LEAVE
|
|
|
|
|
rts
|
|
|
|
|
|
2022-09-11 19:11:32 +00:00
|
|
|
|
.8 jmp (J.CC.TYPEQUAL,x)
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.GetTQInYA2 >ENTER 2
|
|
|
|
|
lda (ZPLookupSymPtr)
|
|
|
|
|
sta (pStack) Type
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
ldy #SYM.Q
|
|
|
|
|
lda (ZPLookupSymPtr),y
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
* ldy #1
|
|
|
|
|
sta (pStack),y Qual
|
|
|
|
|
|
|
|
|
|
jsr TYPE.GetQ2
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr SYM.LookupFree
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
pha
|
|
|
|
|
lda (pStack)
|
|
|
|
|
tay Y = Type
|
|
|
|
|
pla A = Qual
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.99 >LEAVE
|
2023-01-21 21:53:55 +00:00
|
|
|
|
rts
|
2022-10-07 19:21:37 +00:00
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
* Type Declaration keywords
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.CONST lda #SYM.Q.CONST
|
|
|
|
|
bra TYPE.VOLATILE.1
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.VOLATILE lda #SYM.Q.VOLATILE
|
|
|
|
|
TYPE.VOLATILE.1 ldy #1
|
2022-01-30 21:47:08 +00:00
|
|
|
|
ora (pStack),y
|
|
|
|
|
sta (pStack),y
|
|
|
|
|
|
|
|
|
|
jsr CC.CheckSpace
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYA L.CC.TYPESPEC
|
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .9
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jmp (J.CC.TYPESPEC,x)
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.STRUCT clc
|
|
|
|
|
.HS B0 BCS
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.UNION sec
|
|
|
|
|
ror ZPPtr2+1 bStrucUnion
|
|
|
|
|
|
|
|
|
|
stz ZPPtr2 bNewTagDef
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bit bPass2
|
|
|
|
|
bpl TYPE.SU.1 Pass 1: create def
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.SU.2 jsr CORE.GetCharNBNL
|
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
cmp #'{'
|
|
|
|
|
beq .1 no TAG
|
|
|
|
|
|
|
|
|
|
jsr TYPE.GetTag
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CORE.GetNCharNBNL
|
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
cmp #'{'
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
.1 jsr CORE.GetNCharNBNL skip '{'
|
|
|
|
|
|
|
|
|
|
cmp #'}'
|
|
|
|
|
bne .1 skip definition
|
|
|
|
|
|
|
|
|
|
jsr CORE.GetNCharNB skip '}'
|
|
|
|
|
|
|
|
|
|
.8 lda #SYM.T.SU
|
|
|
|
|
jmp TYPE.GetQ
|
|
|
|
|
|
|
|
|
|
.98 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.SU.1 ldy #SYM.T.SU
|
|
|
|
|
lda #0
|
|
|
|
|
ldx #SYM.SC.TAG
|
|
|
|
|
sec reset buffer
|
|
|
|
|
jsr SYM.BufInitYAXC
|
|
|
|
|
|
|
|
|
|
jsr CORE.GetCharNBNL
|
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
cmp #'{'
|
|
|
|
|
beq .30 no TAG
|
|
|
|
|
|
|
|
|
|
jsr TYPE.GetTag
|
|
|
|
|
bcc .20
|
|
|
|
|
|
|
|
|
|
jsr TYPE.NewTag
|
|
|
|
|
bcs .99
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
sec
|
|
|
|
|
ror ZPPtr2 bNewTagDef
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.20 jsr CORE.GetCharNBNL
|
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
cmp #'{'
|
|
|
|
|
beq .30
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bit ZPPtr2 bNewTagDef
|
|
|
|
|
bmi .98
|
|
|
|
|
|
|
|
|
|
bra .38
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.30 jsr CORE.GetNCharNBNL skip '{' of ';'
|
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
cmp #'}'
|
|
|
|
|
beq .37
|
|
|
|
|
|
|
|
|
|
>LDYA L.CC.TYPEQUAL
|
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
cpx #4 no const nor volatile
|
|
|
|
|
bcc .98
|
|
|
|
|
|
|
|
|
|
jsr TYPE.GetTQInYA
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr TYPE.SizeOf get sizeof in X
|
|
|
|
|
|
|
|
|
|
jsr TYPE.SU.AddYAX
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr SYM.Add0000 TODO: bitO & bitW
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr SYM.AddName
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
cmp #';'
|
|
|
|
|
bne .98
|
|
|
|
|
|
|
|
|
|
bra .30
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.37 jsr CORE.GetNCharNB skip '}'
|
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
jsr SYM.Add0000 Close F definition
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
bit ZPPtr2 bNewTagDef
|
|
|
|
|
bpl .38
|
|
|
|
|
|
|
|
|
|
jsr TYPE.StoreTag
|
|
|
|
|
bcs .99
|
2023-01-21 21:53:55 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.38 lda #SYM.T.SU
|
|
|
|
|
jmp TYPE.GetQ
|
|
|
|
|
|
|
|
|
|
.98 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.SU.AddYAX jsr SYM.AddWord add T/Q
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
bit ZPPtr2+1 bStrucUnion
|
|
|
|
|
bmi .1
|
|
|
|
|
|
|
|
|
|
ldy #SYM.SizeOf
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
ply
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr SYM.AddWord Add Y/A Offset
|
|
|
|
|
bcs .99
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
txa
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
ldy #SYM.SizeOf
|
|
|
|
|
* clc
|
|
|
|
|
adc (ZPSymBufPtr),y
|
|
|
|
|
sta (ZPSymBufPtr),y
|
|
|
|
|
bcc .99
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
iny
|
|
|
|
|
lda #0
|
|
|
|
|
adc (ZPSymBufPtr),y
|
|
|
|
|
sta (ZPSymBufPtr),y
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
|
|
|
|
* clc
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
.1 txa
|
|
|
|
|
ldy #SYM.SizeOf
|
|
|
|
|
cmp (ZPSymBufPtr),y
|
|
|
|
|
bcs .2
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
sta (ZPSymBufPtr),y
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.2 jmp SYM.Add0000 Add Y/A Offset (always 0 for union)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.ENUM
|
|
|
|
|
lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.NewTag >LDA.G CC.hTags
|
|
|
|
|
jsr SYM.NewKey
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1 TagID
|
|
|
|
|
dec ZPPtr2 bNewTagDef = true
|
|
|
|
|
|
|
|
|
|
jsr CC.SkipX
|
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
.9 rts
|
2022-10-07 19:21:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.GetTag >PUSHB.G CC.hTags
|
|
|
|
|
>PUSHW ZPLineBufPtr
|
2022-11-02 06:54:30 +00:00
|
|
|
|
>PUSHWI 0 ScopeID
|
2022-10-07 19:21:37 +00:00
|
|
|
|
>SYSCALL SListLookup
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
phy Y,A = KeyID
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
jsr CC.SkipX X = KeyLen
|
|
|
|
|
|
|
|
|
|
>PUSHB.G CC.hTags
|
|
|
|
|
pla
|
|
|
|
|
>PUSHA
|
|
|
|
|
pla
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHW ZPSymBufPtr
|
|
|
|
|
>PUSHWI 65535 all
|
|
|
|
|
>PUSHWZ From Start
|
|
|
|
|
>SYSCALL SListGetData
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.StoreTag >PUSHB.G CC.hTags
|
|
|
|
|
>PUSHW ZPPtr1
|
|
|
|
|
>PUSHW ZPSymBufPtr
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
ldy #SYM.DefSize
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListAddData
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
TYPE.SIGNED sec
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.HS 90 BCC
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.UNSIGNED clc
|
2022-01-30 21:47:08 +00:00
|
|
|
|
php
|
|
|
|
|
|
|
|
|
|
jsr CC.CheckSpace
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYA L.CC.TYPES
|
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cpx #SYM.T.UCHAR
|
|
|
|
|
bcc .9 void
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
cpx #SYM.T.SLONG+1 only char int long allowed
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
jmp (J.CC.UTYPES-2,x)
|
|
|
|
|
|
|
|
|
|
.8 jmp (J.CC.STYPES-2,x)
|
|
|
|
|
|
|
|
|
|
.9 plp
|
|
|
|
|
|
|
|
|
|
lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.SHORT jsr CC.CheckSpace
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .9
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
>LDYA L.CC.TYPES
|
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs TYPE.UCHAR
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
cpx #4 only int allowed
|
2022-10-07 19:21:37 +00:00
|
|
|
|
beq TYPE.SCHAR
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
2023-01-21 21:53:55 +00:00
|
|
|
|
rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.VOID lda #SYM.T.VOID
|
|
|
|
|
bra TYPE.GetQ
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.CHAR
|
|
|
|
|
TYPE.UCHAR lda #SYM.T.UCHAR
|
|
|
|
|
bra TYPE.GetQ
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.SCHAR lda #SYM.T.SCHAR
|
|
|
|
|
bra TYPE.GetQ
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.UINT lda #SYM.T.UINT
|
|
|
|
|
bra TYPE.GetQ
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.INT
|
|
|
|
|
TYPE.SINT lda #SYM.T.SINT
|
|
|
|
|
bra TYPE.GetQ
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.ULONG lda #SYM.T.ULONG
|
|
|
|
|
bra TYPE.GetQ
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.LONG
|
|
|
|
|
TYPE.SLONG lda #SYM.T.SLONG
|
|
|
|
|
bra TYPE.GetQ
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.FLOAT lda #SYM.T.FLOAT
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.GetQ sta (pStack) T
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.GetQ2 jsr CC.GetCharNB
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
.1 cmp #'*'
|
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
ldy #1 Q
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
clc
|
|
|
|
|
adc #SYM.Q.POINTER
|
|
|
|
|
bcs .9 more than ***
|
|
|
|
|
|
|
|
|
|
sta (pStack),y
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcc .1
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2022-10-07 19:21:37 +00:00
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.10 jsr CC.IsLetter
|
|
|
|
|
bcs .8
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>LDYA L.CC.FTYPES int fastcall f() ?
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .8 next char is an identifier
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
ora #SYM.Q.FUNC+SYM.Q.FASTCALL
|
|
|
|
|
sta (pStack),y
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .9 next char is an identifier, ",", "(",")"
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.8 clc
|
2023-01-21 21:53:55 +00:00
|
|
|
|
rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* in : Y,A = type/qual
|
|
|
|
|
* out : X = size
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
TYPE.SizeOf bit #SYM.Q.PPPOINTER
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
ldx CC.TYPESIZE-1,y
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.2 ldx #2 pointer
|
|
|
|
|
sec +1 for hMem Storage
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/cc.s.type
|
|
|
|
|
LOAD usr/src/bin/cc.s
|
|
|
|
|
ASM
|