A2osX/BIN/CC.S.STMT.txt

243 lines
3.9 KiB
Plaintext
Raw Permalink Normal View History

2022-01-30 21:47:08 +00:00
NEW
AUTO 3,1
*--------------------------------------
STMT.Get jsr CC.GetCharNB
2022-08-20 14:37:37 +00:00
jsr CC.IsLetter
ldx #$ff
bcc .20
>LDYA L.CC.PREOPS ++var ?
jsr CC.LookupOP
bcs .9
.20 stx StmtPreOp
jsr SYM.Lookup var or func() ?
2022-08-20 14:37:37 +00:00
bcs .99
ldy #SYM.SC
lda (ZPLookupSymPtr),y
cmp #SYM.SC.TYPEDEF
bne .60
*--------------------------------------
jsr CORE.GetNCharNB
bcs .9
ldy #SYM.Q
lda (ZPLookupSymPtr),y
pha
lda (ZPLookupSymPtr)
pha
jsr SYM.LookupFree
ply
pla
sec Reset Buffer
jmp DECL.YAC
*--------------------------------------
.60 ldy #SYM.Q
lda (ZPLookupSymPtr),y
bit #SYM.Q.FUNC
beq .61
bit StmtPreOp
bpl .9 ++func ????????
jsr F.CallNoRetV func( ... );
bcs .99
jmp SYM.LookupFree
*--------------------------------------
.61 jsr STMT.SetVar
2022-08-20 14:37:37 +00:00
bcs .99
jmp SYM.LookupFree
2022-08-20 14:37:37 +00:00
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
STMT.SetVar stz ExpState
jsr EXP.POSTOPS var++, var[0]... ?
bcs .99
ldx StmtPreOp
jsr EXP.PREOPS apply ++var, ....
bcs .99
jsr CC.GetCharNB
bcs .90
jsr CC.IsEndArg var++; or ++var; ?
bcc .8
jsr CC.LookupAOP var=, var+= ... ?
bcs .90
cpx #0 TOTO : all AOPS
bne *
lda ExpState
bmi .90 VonStack
asl
bmi .7 AinPTR
asl
bmi .6 AonStack
jsr EXP.GetAddr1
bcc .7
rts
.6 >LDYA L.PCC.PopAddr1
jsr CODE.EmitPCC
bcs .99
.7 ldy #SYM.Q
lda (ZPLookupSymPtr),y
pha
lda (ZPLookupSymPtr)
tay
pla get expected T/Q
jsr EXP.Eval
bcs .99
jmp SYM.PopValue
.8 clc
rts
.90 lda #E.CSYN
sec
.99 rts
*--------------------------------------
*--------------------------------------
STMT.Stmt.END ldy StmtPtr
beq STMT.End.8 Global context
lda (StmtStk),y
bmi STMT.End.8 local F context
* in an instruction ...
iny STMT.TERM
lda (StmtStk),y
cmp #'}'
beq STMT.End.8 in a STMT...
cmp #';' must be ';' on stack....
bne STMT.End.9
jsr STMT.End
bcc STMT.Stmt.END
rts
STMT.End.9 lda #E.STACKERROR
2022-12-07 16:09:29 +00:00
sec
rts
2022-01-30 21:47:08 +00:00
STMT.End.8 clc
rts
2022-01-30 21:47:08 +00:00
*--------------------------------------
STMT.CPStmt.END ldy StmtPtr
beq STMT.End.9
lda (StmtStk),y
2022-12-13 06:55:13 +00:00
bpl .1
2022-12-13 06:55:13 +00:00
jmp F.Def.END local F context
.1 iny
lda (StmtStk),y STMT.TERM
2022-01-30 21:47:08 +00:00
cmp #'}' must be '}' on stack....
bne STMT.End.9
2022-12-13 06:55:13 +00:00
*--------------------------------------
STMT.End ldy StmtPtr STMT.KW
lda (StmtStk),y
2022-12-13 06:55:13 +00:00
tax
jmp (J.CC.KW.END,x)
*--------------------------------------
STMT.New00 lda #0
jsr CC.Push STMT.hMEM
bcs STMT.New.RTS
jsr CC.Push STMT.MemPtr
bcs STMT.New.RTS
STMT.New lda #';' STMT.TERM
jsr CC.Push
bcs .99
>LDA.G CC.CmdSave STMT.KW
jmp CC.Push
.99
STMT.New.RTS rts
*--------------------------------------
STMT.SetType jsr CORE.GetNCharNBNL
bcs STMT.SetType.9
ldx #';'
cmp #'{'
bne STMT.SetType.1
STMT.SetTypeCP jsr SCOPE.New
bcs STMT.New.RTS
2022-12-07 16:09:29 +00:00
ldx #'}'
STMT.SetType.1 txa
ldy StmtPtr
iny STMT.TERM
sta (StmtStk),y
clc
rts
STMT.SetType.9 lda #E.CSYN
sec
rts
*--------------------------------------
STMT.Close lda StmtPtr
clc
adc #STMT.hMEM
tay
lda (StmtStk),y
beq .1
>SYSCALL FreeMem
.1 ldy StmtPtr STMT.KW
iny STMT.TERM
lda (StmtStk),y
cmp #'}'
bne .2
jsr SCOPE.Close {};
bcs .99
.2 lda StmtPtr
clc
adc #STMT
sta StmtPtr
clc
.99 rts
*--------------------------------------
2022-01-30 21:47:08 +00:00
MAN
SAVE usr/src/bin/cc.s.stmt
LOAD usr/src/bin/cc.s
ASM