A2osX/BIN/CC.S.EXP.txt

1170 lines
18 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
*--------------------------------------
* Input:
* ZPLineBufPtr, Y,A = Expected type/qual
* Output:
* CS, A = EC
2022-01-30 21:47:08 +00:00
* CC, Y,A = type/qual
*--------------------------------------
EXP.Eval00 lda #0
2022-01-30 21:47:08 +00:00
tay
EXP.Eval ldx ZPPtr1 local : returned T/Q
2022-08-20 14:37:37 +00:00
phx
ldx ZPPtr1+1
phx
ldx ZPPtr2 local : expected T/Q
phx
ldx ZPPtr2+1
phx
ldx ZPPtr3 local : BOP
phx
2022-01-30 21:47:08 +00:00
ldx ZPPtr3+1 local : PREOP
phx
2022-01-30 21:47:08 +00:00
>STYA ZPPtr2
2022-08-20 14:37:37 +00:00
stz ZPPtr1
stz ZPPtr1+1
lda #$ff no previous OP
2022-08-20 14:37:37 +00:00
sta ZPPtr3+1 no PREOPS
pha
*--------------------------------------
.10 jsr CC.GetCharNB
bcs .19
2022-01-30 21:47:08 +00:00
cmp #'('
bne .20
jsr CORE.GetNCharNB skip (
bcs .19
2022-01-30 21:47:08 +00:00
>LDYA L.CC.TYPEQUAL
jsr CC.LookupID
bcs .12
jsr EXP.Cast
2022-01-30 21:47:08 +00:00
bcs .19
bra .20
*--------------------------------------
.12 >LDYA ZPPtr2 expected T/Q
jsr EXP.Eval
bcs .19
>STYA ZPPtr2 update T/Q
jsr CC.GetCharNB
bcs .19
cmp #')'
bne .19
jsr CORE.GetNCharNB skip )
bcc .31
.19 jmp EXP.Eval.ESYN
*--------------------------------------
2022-08-20 14:37:37 +00:00
.20 >LDYA L.CC.PREOPS
jsr CC.LookupOP
stx ZPPtr3+1
jsr CC.GetCharNB
2022-01-30 21:47:08 +00:00
bcs .29
jsr CC.IsLetter define, f() or Var ?
bcs .22
jsr CC.GetDefine
bcc .10
jsr SYM.Lookup
bcs .22
2022-01-30 21:47:08 +00:00
ldy #SYM.Q
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-01-30 21:47:08 +00:00
and #SYM.Q.FUNC
bne .21
jsr EXP.GetVar Check T/Q & Get value on stack
bcs .29
jsr SYM.LookupFree
2022-01-30 21:47:08 +00:00
bra .30
*--------------------------------------
.21 >LDYA ZPPtr2 get expected T/Q
jsr F.CallRetV
bcs .29
>STYA ZPPtr2 store real T/Q
2022-01-30 21:47:08 +00:00
jsr SYM.LookupFree
2022-01-30 21:47:08 +00:00
bra .30
*--------------------------------------
.22 jsr CC.IsDigit10 number ?
bcs .24
ldy ZPPtr2 T
bne .23
2022-01-30 21:47:08 +00:00
ldy #SYM.T.SINT
sty ZPPtr2
stz ZPPtr2+1 Q
.23 jsr EXP.GetNum
bcs .29
bra .30
2022-01-30 21:47:08 +00:00
*--------------------------------------
.24 cmp #'''
bne .25
jsr EXP.GetChar
bcs .29
bra .30
.25 cmp #'"' String literal
bne EXP.Eval.ESYN
jsr EXP.AddConstCharP
.29 bcs EXP.Eval.Err
*--------------------------------------
.30 jsr CC.GetCharNB
bcs EXP.Eval.ESYN
.31 jsr CC.IsEndArg , ; ) ? :
bcc EXP.Eval.End
jsr CC.IsOPChar
bcs EXP.Eval.ESYN
2022-01-30 21:47:08 +00:00
>LDYA L.CC.BOPS we are at V1 op1 V2 op2...
jsr CC.LookupOP
bcs EXP.Eval.ESYN
stx ZPPtr3 save OP(n)
2022-01-30 21:47:08 +00:00
.33 plx get OP(n-1)
bmi .38 $ff....
cpx ZPPtr3
2022-01-30 21:47:08 +00:00
bcc .38 OP(n) has precedence, on stack : V1,V2
>LDYA ZPPtr2 OP(n-1) has precedence...
jsr EXP.BOPS compute V(n-1) <OP(n-1)> V(n)
2022-01-30 21:47:08 +00:00
bcc .33
bcs EXP.Eval.Err
2022-01-30 21:47:08 +00:00
.38 phx push back OP(n-1)
lda ZPPtr3 get OP(n)
pha push OP(n) on stack
jmp .10 go check for next token
*--------------------------------------
EXP.Eval.End plx any OP on stack ?
bmi EXP.Eval.Exit
>LDYA ZPPtr2 Var Type
2022-08-20 14:37:37 +00:00
jsr EXP.BOPS
bcc EXP.Eval.End
bra EXP.Eval.Err
2022-01-30 21:47:08 +00:00
*--------------------------------------
EXP.Eval.ESYN lda #E.ESYN
EXP.Eval.Err plx
bpl EXP.Eval.Err
sec
bra EXP.Eval.ExitErr
2022-01-30 21:47:08 +00:00
*--------------------------------------
EXP.Eval.Exit lda ZPPtr1+1
2022-08-20 14:37:37 +00:00
ldy ZPPtr1
bne .1
2022-01-30 21:47:08 +00:00
>LDYA ZPPtr2 Type/Qual
2022-08-20 14:37:37 +00:00
.1 and #$FC ignore SYM.Q.FUNC+SYM.Q.FASTCALL
2022-01-30 21:47:08 +00:00
clc
EXP.Eval.ExitErr
2022-01-30 21:47:08 +00:00
plx
stx ZPPtr3+1
plx
stx ZPPtr3
2022-01-30 21:47:08 +00:00
plx
stx ZPPtr2+1
plx
stx ZPPtr2
2022-08-20 14:37:37 +00:00
plx
stx ZPPtr1+1
plx
stx ZPPtr1
2022-06-22 06:26:44 +00:00
rts
2022-01-30 21:47:08 +00:00
*--------------------------------------
EXP.Cast jsr TYPE.GetTQInYA
2022-01-30 21:47:08 +00:00
bcs .99
2022-08-20 14:37:37 +00:00
>STYA ZPPtr1
2022-01-30 21:47:08 +00:00
jsr CC.GetCharNB
bcs .9
cmp #')'
bne .9
jsr CORE.GetNCharNB skip )
2022-01-30 21:47:08 +00:00
clc
rts
.9 lda #E.ESYN
sec
.99 rts
*--------------------------------------
* Y,A = Type/Qual, X = OP
*--------------------------------------
EXP.BOPS bit #SYM.Q.PPPOINTER
2022-08-20 14:37:37 +00:00
beq .10
ldy #SYM.T.UINT
bra .3
2022-08-20 14:37:37 +00:00
.10 cpy #SYM.T.UINT
bcs .3
2022-01-30 21:47:08 +00:00
cpy #SYM.T.UCHAR
beq .1
2022-01-30 21:47:08 +00:00
cpy #SYM.T.SCHAR
beq .2
lda #E.TMISMATCH
sec
rts
2022-08-20 14:37:37 +00:00
.1 >LDYA L.PCC.bBOPS,x
jmp CODE.EmitPCC
2022-08-20 14:37:37 +00:00
.2 >LDYA L.PCC.bBOPS,x
jmp CODE.EmitPCC
.3 txa
clc
2022-01-30 21:47:08 +00:00
adc CC.Type2FPU-SYM.T.UINT,y
tax
jsr CODE.FPUCALL
clc
rts
*--------------------------------------
EXP.GetIntegral jsr CC.GetCharNB
cmp #'''
bne .1
jsr CC.GetNextCharEsc
bcs .9
tay
jsr CC.GetNextChar
bcs .9
cmp #'''
bne .9
jsr CORE.GetNCharNB skip '
lda #0 Y,A = integral
clc
rts
.1 jsr CC.IsDigit10
bcc EXP.IntConst
.9 lda #E.CSYN
* sec
rts
*--------------------------------------
EXP.IntConst >PUSHW ZPLineBufPtr
2022-08-20 14:37:37 +00:00
>PUSHWI ZPLineBufPtr
>PUSHBI 10
>SYSCALL StrToUL
>PULLA
tay
>PULLA
inc pStack
inc pStack Y,A = integral
2022-08-20 14:37:37 +00:00
rts
*--------------------------------------
EXP.GetNum cpy #SYM.T.FLOAT
bcc .1
beq .11
.90 lda #E.TMISMATCH
* sec
rts
.11 >PUSHW ZPLineBufPtr
>PUSHWI ZPLineBufPtr
>SYSCALL StrToF
* bcs .99
ldy #4
.10 lda (pStack),y
jsr CODE.PUSHI
dey
bpl .10
>POP 5
clc
rts
*--------------------------------------
.1 >PUSHW ZPLineBufPtr
>PUSHWI ZPLineBufPtr
>PUSHBI 10
lda CC.TYPESIGN-1,y
bmi .2
>SYSCALL StrToUL
bra .3
.2 >SYSCALL StrToL
.3 bcs .99
2022-01-30 21:47:08 +00:00
ldy #1 anticipate 2 bytes if *
lda ZPPtr2+1
and #SYM.Q.PPPOINTER
bne .5
ldx ZPPtr2
lda CC.TYPESIZE-1,x
dec
tay
.5 lda (pStack),y
jsr CODE.PUSHI
dey
bpl .5
>POP 4
* clc
.99 rts
*--------------------------------------
EXP.GetChar ldy ZPPtr2+1
bne .9
lda ZPPtr2
cmp #SYM.T.UCHAR
beq .1
cmp #SYM.T.SCHAR
bne .9
.1 jsr CC.GetNextCharEsc
bcs .9
jsr CODE.PUSHI
bcs .99
jsr CC.GetNextChar
bcs .9
cmp #'''
bne .9
jsr CORE.GetNCharNB skip '
clc
rts
.9 lda #E.ESYN
sec
.99 rts
*--------------------------------------
EXP.AddConstCharP
lda ZPCCConst
ldx ZPCCConst+1
jsr CODE.LDAXI
bcs .99
>LDYA L.PCC.PushIAddr
jsr CODE.EmitPCC
bcs .99
jsr CODE.DSSelect
bcs .99
.1 jsr CC.GetNextCharEsc
bcs .9
bvs .2 ESCaped
cmp #C.CR
beq .9
cmp #'"'
beq .3
.2 jsr CODE.EmitData
bcs .99
bra .1
.3 jsr CORE.GetNCharNBNL Skip "
bcs .8
cmp #'\'
beq .3
cmp #'"'
beq .1
.8 lda #0
jsr CODE.EmitData
bcs .99
jmp CODE.CSSelect
.9 lda #E.ESYN
sec
.99 rts
*--------------------------------------
2022-01-30 21:47:08 +00:00
* ZPPtr2 = expected T/Q
* ZPPtr3+1 = PREOPS
*--------------------------------------
EXP.GetVar stz ExpState
jsr EXP.POSTOPS var++, var[0]... ?
2022-01-30 21:47:08 +00:00
bcs .99
2022-08-20 14:37:37 +00:00
ldx ZPPtr3+1 preop &, * ...
jsr EXP.PREOPS
2022-01-30 21:47:08 +00:00
bcs .99
2022-08-20 14:37:37 +00:00
lda ExpState
bmi .8 VonStack
2022-08-20 14:37:37 +00:00
asl
2022-08-20 14:37:37 +00:00
bmi .7 AinPTR
asl
bmi .6 AonStack
jsr EXP.GetAddr2
2022-08-20 14:37:37 +00:00
bcs .99
bra .7
.6 >LDYA L.PCC.PopAddr2
jsr CODE.EmitPCC
bcs .99
.7 jsr EXP.PushValue
2022-08-20 14:37:37 +00:00
bcs .99
.8 jmp SYM.LookupCheckTQ
2022-08-20 14:37:37 +00:00
.99 rts
*--------------------------------------
* POSTOPS
*--------------------------------------
EXP.POSTOPS >LDYA L.CC.POSTOPS
2022-08-20 14:37:37 +00:00
jsr CC.LookupOP
bcs .8
jmp (J.CC.POSTOPS,x)
.8 clc
rts
2022-08-20 14:37:37 +00:00
*--------------------------------------
EXP.postinc lda ExpState
2022-08-20 14:37:37 +00:00
bit #ExpState.AinPTR
bne .1
jsr EXP.GetAddr2
2022-08-20 14:37:37 +00:00
bcs .99
lda #ExpState.AinPTR
tsb ExpState
2022-08-20 14:37:37 +00:00
.1 ldy #SYM.Q
lda (ZPLookupSymPtr),y
and #SYM.Q.AAARRAY+SYM.Q.PPPOINTER
bne .8
lda (ZPLookupSymPtr) #SYM.T
cmp #SYM.T.FLOAT
bcs .98
2022-08-20 14:37:37 +00:00
tay
lda CC.TYPESIZE-1,y
lsr
bcc .2
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.Inc1
jmp CODE.EmitPCC
.2 lsr
bcc .4
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.Inc2
jmp CODE.EmitPCC
.4 >LDYA L.PCC.Inc4
2022-08-20 14:37:37 +00:00
jmp CODE.EmitPCC
.8
2022-08-20 14:37:37 +00:00
.98 lda #E.ESYN
sec
.99 rts
2022-01-30 21:47:08 +00:00
*--------------------------------------
EXP.postdec lda ExpState
2022-08-20 14:37:37 +00:00
bit #ExpState.AinPTR
bne .1
jsr EXP.GetAddr2
2022-08-20 14:37:37 +00:00
bcs .99
lda #ExpState.AinPTR
tsb ExpState
.1 ldy #SYM.Q
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-08-20 14:37:37 +00:00
and #SYM.Q.AAARRAY+SYM.Q.PPPOINTER
bne .8
2022-08-20 14:37:37 +00:00
lda (ZPLookupSymPtr) #SYM.T
cmp #SYM.T.FLOAT
bcs .98
2022-08-20 14:37:37 +00:00
tay
2022-08-20 14:37:37 +00:00
lda CC.TYPESIZE-1,y
lsr
bcc .2
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.Dec1
jmp CODE.EmitPCC
2022-08-20 14:37:37 +00:00
.2 lsr
bcc .4
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.Dec2
jmp CODE.EmitPCC
.4 >LDYA L.PCC.Dec4
2022-08-20 14:37:37 +00:00
jmp CODE.EmitPCC
2022-01-30 21:47:08 +00:00
.8
2022-08-20 14:37:37 +00:00
.98 lda #E.ESYN
sec
.99 rts
*--------------------------------------
EXP.Idx ldy #SYM.Q
2022-08-20 14:37:37 +00:00
lda (ZPLookupSymPtr),y
bit #SYM.Q.AAARRAY
bne EXP.array
and #SYM.Q.PPPOINTER
cmp #SYM.Q.POINTER
bne .98
lda (ZPLookupSymPtr),y
eor #SYM.Q.POINTER+SYM.Q.ARRAY
sta (ZPLookupSymPtr),y convert from *type to type[]
jsr EXP.GetAddr2
bcs .99
>LDYA L.PCC.PushDeref2
jsr CODE.EmitPCC
bcs .99
jsr EXP.array.getIdx ...int16 on stack...
bcs .99
jsr EXP.GetSymSizeOfInAX
cmp #1
bne .1
cpx #0
beq .2 sizeof=1, no MUL required
.1 jsr CODE.PUSHAXI ...sizeof on stack...
bcs .99
ldx #FPU.wMUL
jsr CODE.FPUCALL ...sizeof*int16...
bcs .99
.2 ldx #FPU.wAdd
jsr CODE.FPUCALL ...add to base address
bcs .99
jsr CC.GetCharNB
bcs .97
cmp #']'
bne .97
jsr CORE.GetNCharNB skip ']'
lda #ExpState.AonStack
sta ExpState
clc
rts
.97 lda #E.ESYN
sec
rts
.98 lda #E.TMISMATCH
sec
.99 rts
*--------------------------------------
EXP.array ldy #SYM.Def
2022-08-20 14:37:37 +00:00
lda (ZPLookupSymPtr),y
iny
ora (ZPLookupSymPtr),y
beq .1
* jsr CODE.DEBUG
jsr EXP.PushAddr array[int]...
2022-08-20 14:37:37 +00:00
bcc .2
2022-08-20 14:37:37 +00:00
rts
.1 jsr EXP.GetAddr2 array[]...it is a *
2022-08-20 14:37:37 +00:00
bcs .9
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.PushDeref2
jsr CODE.EmitPCC
bcs .9
.2 jsr EXP.array.getIdx ...int16 on stack...
2022-01-30 21:47:08 +00:00
bcs .9
jsr EXP.GetSymSizeOfInAX
2022-08-20 14:37:37 +00:00
jsr CODE.PUSHAXI ...sizeof on stack...
bcs .9
2022-01-30 21:47:08 +00:00
ldx #FPU.wMUL
2022-08-20 14:37:37 +00:00
jsr CODE.FPUCALL ...sizeof*int16...
bcs .9
ldx #FPU.wAdd
2022-08-20 14:37:37 +00:00
jsr CODE.FPUCALL ...add to base address
bcs .9
.3 jsr CORE.GetNCharNB skip ']'
2022-08-20 14:37:37 +00:00
bcs .98
2022-08-20 14:37:37 +00:00
cmp #'['
bne .8
jsr CORE.GetNCharNB skip '['
2022-08-20 14:37:37 +00:00
bcs .98
2022-08-20 14:37:37 +00:00
ldy #SYM.Q
lda (ZPLookupSymPtr),y
and #SYM.Q.AAARRAY
.39 beq .99
jsr EXP.array.getIdx ...int16 on stack...
2022-08-20 14:37:37 +00:00
bcs .9
2022-08-20 14:37:37 +00:00
ldy #SYM.Def+3
lda (ZPLookupSymPtr),y
tax
dey
lda (ZPLookupSymPtr),y
jsr CODE.PUSHAXI [][SIZE] on stack
ldx #FPU.wMUL
2022-08-20 14:37:37 +00:00
jsr CODE.FPUCALL [][SIZE] * int16 on stack
jsr EXP.GetSymSizeOfInAX
2022-08-20 14:37:37 +00:00
jsr CODE.PUSHAXI ...sizeof on stack...
bcs .9
ldx #FPU.wMUL
2022-08-20 14:37:37 +00:00
jsr CODE.FPUCALL ...sizeof*int16...
ldx #FPU.wAdd
2022-08-20 14:37:37 +00:00
jsr CODE.FPUCALL ...add to base address
bcs .9
jsr CORE.GetNCharNB skip ']'
2022-08-20 14:37:37 +00:00
bcs .98
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
* TODO : [][][]
2022-08-20 14:37:37 +00:00
.8 lda #ExpState.AonStack
sta ExpState
clc
rts
.98 lda #E.ESYN
sec
rts
.99 lda #E.TMISMATCH
sec
.9 rts
*--------------------------------------
EXP.array.getIdx
2022-08-20 14:37:37 +00:00
ldy #SYM.T.SINT
lda #0
jsr EXP.Eval
2022-08-20 14:37:37 +00:00
bcs .9
jsr CC.GetCharNB
bcs .98
cmp #']'
bne .98
2022-01-30 21:47:08 +00:00
ldy #SYM.Q
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-01-30 21:47:08 +00:00
sec
sbc #SYM.Q.ARRAY
2022-08-20 14:37:37 +00:00
sta (ZPLookupSymPtr),y
2022-08-20 14:37:37 +00:00
clc
rts
.98 lda #E.ESYN
sec
.9 rts
*--------------------------------------
EXP.SU lda (ZPLookupSymPtr)
cmp #SYM.T.SU
bne .97
ldy #SYM.Q
lda (ZPLookupSymPtr),y
and #SYM.Q.PPPOINTER
bne .97
jsr CC.GetCharNB
bcs .98
jsr CC.IsLetter
bcs .98
jsr EXP.SU.GetF
bcs .98
jsr CC.SkipX
lda (ZPLookupSymPtr),y SU.F.T
sta (ZPLookupSymPtr) SYM.T
iny
lda (ZPLookupSymPtr),y SU.F.Q
phy
ldy #SYM.Q
sta (ZPLookupSymPtr),y
ply
iny
lda (ZPLookupSymPtr),y SU.F.O
phy
ldy #SYM.Addr
clc
adc (ZPLookupSymPtr),y
sta (ZPLookupSymPtr),y
ply
iny
lda (ZPLookupSymPtr),y SU.F.O+1
ldy #SYM.Addr+1
adc (ZPLookupSymPtr),y
sta (ZPLookupSymPtr),y
clc
rts
.97 lda #E.TMISMATCH
sec
rts
.98 lda #E.ESYN
sec
.99 rts
2022-08-20 14:37:37 +00:00
*--------------------------------------
EXP.pSU lda #E.ESYN
2022-08-20 14:37:37 +00:00
sec
rts
*--------------------------------------
EXP.SU.GetF jsr CC.GetIDLen
tya
tax
ldy #SYM.Def
.1 lda (ZPLookupSymPtr),y
beq .98
phy SU.F.T
tya
clc
adc #SU.F.Name
tay
txa
cmp (ZPLookupSymPtr),y
bne .7
phy SU.F.Name
phx SU.F.NameLen
tya
clc
adc ZPLookupSymPtr
sta ZPLookupPtr
lda #0
adc ZPLookupSymPtr+1
sta ZPLookupPtr+1
ldy #0
.2 lda (ZPLineBufPtr),y
iny
cmp (ZPLookupPtr),y
bne .6
dex
bne .2
plx NameLen
pla SU.F.Name
ply SU.F.T
clc
rts
.6 plx
ply
.7 pla
sec
adc (ZPLookupSymPtr),y
adc #SU.F.Name
tay
bra .1
.98 lda #E.NOKEY
sec
.99 rts
*--------------------------------------
2022-08-20 14:37:37 +00:00
* PREOPS
*--------------------------------------
EXP.PREOPS bmi .8
2022-08-20 14:37:37 +00:00
jmp (J.CC.PREOPS,x)
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
.8 clc
rts
*--------------------------------------
EXP.Ref ldy #SYM.Q
2022-08-20 14:37:37 +00:00
lda (ZPLookupSymPtr),y
clc
2022-08-20 14:37:37 +00:00
adc #SYM.Q.POINTER
bcs .9 more than ***
* and #%11001111
2022-08-20 14:37:37 +00:00
sta (ZPLookupSymPtr),y
bit ExpState
bvs .8
jsr EXP.PushAddr
2022-08-20 14:37:37 +00:00
bcs .99
.8 lda #ExpState.VonStack
sta ExpState
* clc Addr on stack
rts
2022-08-20 14:37:37 +00:00
.9 lda #E.TMISMATCH
* sec
.99 rts
*--------------------------------------
EXP.Deref ldy #SYM.Q
2022-08-20 14:37:37 +00:00
lda (ZPLookupSymPtr),y
bit #SYM.Q.PPPOINTER
beq .9
2022-01-30 21:47:08 +00:00
sec
2022-08-20 14:37:37 +00:00
sbc #SYM.Q.POINTER
sta (ZPLookupSymPtr),y
jsr EXP.GetAddr2
2022-08-20 14:37:37 +00:00
bcs .99
>LDYA L.PCC.Deref2
jsr CODE.EmitPCC
bcs .99
2022-08-20 14:37:37 +00:00
lda #ExpState.AinPTR
sta ExpState
* clc
rts
.9 lda #E.TMISMATCH
sec
.99 rts
*--------------------------------------
EXP.Abs
2022-08-20 14:37:37 +00:00
clc
2022-01-30 21:47:08 +00:00
.99 rts
*--------------------------------------
EXP.negate
2022-08-20 14:37:37 +00:00
clc
.99 rts
*--------------------------------------
EXP.lnot
2022-08-20 14:37:37 +00:00
clc
.99 rts
*--------------------------------------
EXP.bnot
2022-08-20 14:37:37 +00:00
clc
.99 rts
*--------------------------------------
EXP.preinc
2022-08-20 14:37:37 +00:00
clc
.99 rts
*--------------------------------------
EXP.predec
2022-08-20 14:37:37 +00:00
clc
.99 rts
*--------------------------------------
EXP.PushAddr ldy #SYM.SC
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-08-20 14:37:37 +00:00
beq .1 SYM.SC.STATIC
2022-01-30 21:47:08 +00:00
* LOCAL
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.PushLAddrH
jsr CODE.EmitPCC
bcs .9
2022-01-30 21:47:08 +00:00
ldy #SYM.Addr
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-01-30 21:47:08 +00:00
eor #$FF
inc
jsr CODE.LDAI
2022-08-20 14:37:37 +00:00
bcs .9
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.PushLAddrL
jmp CODE.EmitPCC
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
* GLOBAL
.1 ldy #SYM.Addr+1
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-08-20 14:37:37 +00:00
tax
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
dey
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
jsr CODE.LDAXI
bcs .9
ldy #SYM.Q
lda (ZPLookupSymPtr),y
and #SYM.Q.CONST
beq .2
>LDYA L.PCC.PushIAddr
jmp CODE.EmitPCC
.2 >LDYA L.PCC.PushUAddr
jmp CODE.EmitPCC
2022-08-20 14:37:37 +00:00
.9 rts
*--------------------------------------
EXP.GetAddr1 ldy #SYM.SC
2022-08-20 14:37:37 +00:00
lda (ZPLookupSymPtr),y
beq .1 SYM.SC.STATIC
* LOCAL
2022-01-30 21:47:08 +00:00
ldy #SYM.Addr
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-01-30 21:47:08 +00:00
eor #$FF
inc
jsr CODE.LDAI
2022-08-20 14:37:37 +00:00
bcs .9
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.GetLAddr1
jmp CODE.EmitPCC
* GLOBAL
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
.1 ldy #SYM.Addr+1
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-08-20 14:37:37 +00:00
tax
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
dey
lda (ZPLookupSymPtr),y
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
jsr CODE.LDAXI
bcs .9
ldy #SYM.Q
lda (ZPLookupSymPtr),y
and #SYM.Q.CONST
beq .2
>LDYA L.PCC.GetIAddr1
jmp CODE.EmitPCC
.2 >LDYA L.PCC.GetUAddr1
jmp CODE.EmitPCC
2022-01-30 21:47:08 +00:00
2022-06-12 20:42:22 +00:00
.9 rts
2022-01-30 21:47:08 +00:00
*--------------------------------------
EXP.GetAddr2 ldy #SYM.SC
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-08-20 14:37:37 +00:00
beq .1 SYM.SC.STATIC
* LOCAL
2022-01-30 21:47:08 +00:00
ldy #SYM.Addr
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-08-20 14:37:37 +00:00
eor #$FF
inc
jsr CODE.LDAI
bcs .9
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.GetLAddr2
jmp CODE.EmitPCC
* GLOBAL
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
.1 ldy #SYM.Addr+1
lda (ZPLookupSymPtr),y
tax
dey
lda (ZPLookupSymPtr),y
jsr CODE.LDAXI
bcs .9
2022-01-30 21:47:08 +00:00
ldy #SYM.Q
2022-06-12 20:42:22 +00:00
lda (ZPLookupSymPtr),y
2022-08-20 14:37:37 +00:00
and #SYM.Q.CONST
beq .2
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.GetIAddr2
jmp CODE.EmitPCC
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
.2 >LDYA L.PCC.GetUAddr2
jmp CODE.EmitPCC
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
.9 rts
2022-01-30 21:47:08 +00:00
*--------------------------------------
EXP.PushValue jsr EXP.GetSymSizeOfInAX
2022-08-20 14:37:37 +00:00
tay
dey
bne .1
>LDYA L.PCC.PushValue1
jmp CODE.EmitPCC
.1 cpy #1
bne .2
>LDYA L.PCC.PushValue2
jmp CODE.EmitPCC
.2 jsr CODE.LDYI
2022-08-20 14:37:37 +00:00
bcs .99
2022-01-30 21:47:08 +00:00
>LDYA L.PCC.PushValueY
2022-08-20 14:37:37 +00:00
jmp CODE.EmitPCC
2022-08-20 14:37:37 +00:00
.99 rts
*--------------------------------------
* out : A,X = size
2022-08-20 14:37:37 +00:00
*--------------------------------------
EXP.GetSymSizeOfInAX
2022-08-20 14:37:37 +00:00
ldy #SYM.Q
lda (ZPLookupSymPtr),y
pha
lda (ZPLookupSymPtr) SYM.T
2022-01-30 21:47:08 +00:00
tay
2022-08-20 14:37:37 +00:00
pla
2022-01-30 21:47:08 +00:00
EXP.GetYASizeOfInAX
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
bit #SYM.Q.PPPOINTER+SYM.Q.AAARRAY
bne .1
lda CC.TYPESIZE-1,y
ldx #0
clc
rts
.1 lda #2 pointer
ldx #0
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
sec +1 for hMem Storage
2022-01-30 21:47:08 +00:00
rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.exp
LOAD usr/src/bin/cc.s
ASM