2021-12-02 21:28:26 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Built in Keywords
|
|
|
|
|
*--------------------------------------
|
2023-01-22 14:38:20 +00:00
|
|
|
|
KW.IF jsr SCOPE.New IF (
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-12-23 16:50:50 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
jsr CC.GetCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #'('
|
|
|
|
|
bne .9
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr EXP.Eval00 Any var type
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr KW.TestZero Y,A=T/Q
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'E'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #$4C emit JMP else
|
|
|
|
|
jsr CODE.TOABSYX
|
|
|
|
|
bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .9
|
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr STMT.New00
|
|
|
|
|
bcs .99
|
2023-01-11 18:34:34 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jmp STMT.SetType
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.99 rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-12-30 16:29:57 +00:00
|
|
|
|
KW.IF.END jsr STMT.Close
|
|
|
|
|
bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>LDYA L.CC.KW2.IF Check allowed KW for IF....
|
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcc .2
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
lda #'E' define ELSE Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2023-01-22 14:38:20 +00:00
|
|
|
|
jmp SCOPE.Close IF )
|
2022-08-20 14:37:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.2 lda #'X'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #$4C emit JMP exit
|
|
|
|
|
jsr CODE.TOABSYX
|
|
|
|
|
bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'E' define ELSE Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
lda #KW.ELSE.ID
|
|
|
|
|
>STA.G CC.CmdSave
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr STMT.New00
|
|
|
|
|
bcs .99
|
2023-01-11 18:34:34 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jmp STMT.SetType
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
KW.ELSE lda #E.CSYN illegal
|
2022-08-20 14:37:37 +00:00
|
|
|
|
sec
|
2021-12-02 21:28:26 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-12-30 16:29:57 +00:00
|
|
|
|
KW.ELSE.END jsr STMT.Close
|
2023-01-11 18:34:34 +00:00
|
|
|
|
bcs .99
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
|
|
|
|
lda #'X' define EXIT Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2023-01-22 14:38:20 +00:00
|
|
|
|
jmp SCOPE.Close IF }
|
2022-12-13 06:55:13 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2023-01-22 14:38:20 +00:00
|
|
|
|
KW.WHILE jsr SCOPE.New WHILE (
|
2022-12-30 16:29:57 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #'C' define CONT Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
cmp #'('
|
|
|
|
|
bne .9
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr EXP.Eval00 Any var type
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr KW.TestZero
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
lda #'B'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #$4C emit JMP break:
|
2022-01-30 21:47:08 +00:00
|
|
|
|
jsr CODE.TOABSYX
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
cmp #')'
|
|
|
|
|
bne .9
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
|
|
|
|
jsr STMT.New00
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .99
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
|
|
|
|
jmp STMT.SetType
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.9 lda #E.CSYN
|
2022-01-30 21:47:08 +00:00
|
|
|
|
sec
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.99 rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-12-30 16:29:57 +00:00
|
|
|
|
KW.WHILE.END jsr STMT.Close
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>LDYA L.PCC.SLEEP
|
2022-10-09 21:22:46 +00:00
|
|
|
|
jsr CODE.EmitPCC
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #'C'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #$4C
|
|
|
|
|
jsr CODE.TOABSYX emit JMP cont:
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #'B' define BREAK Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
2023-01-22 14:38:20 +00:00
|
|
|
|
jmp SCOPE.Close WHILE )
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2023-01-22 14:38:20 +00:00
|
|
|
|
KW.DO jsr SCOPE.New DO {
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #'C' define CONT Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
>LDYA L.PCC.SLEEP
|
|
|
|
|
jsr CODE.EmitPCC
|
|
|
|
|
bcs .99
|
2023-01-22 14:38:20 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr STMT.New00
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jmp STMT.SetType
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2022-12-30 16:29:57 +00:00
|
|
|
|
KW.DO.END jsr STMT.Close
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>LDYA L.CC.KW2.DO Check allowed KW for DO....
|
2022-08-20 14:37:37 +00:00
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #'('
|
|
|
|
|
bne .9
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr EXP.Eval00 Any var type
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr KW.TestnZero
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
|
|
|
|
lda #'C'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #$4C emit JMP cont
|
|
|
|
|
jsr CODE.TOABSYX
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .9
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr CORE.GetNCharNB skip ')'
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .9
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
|
|
|
|
lda #'B' define BREAK Label
|
|
|
|
|
jsr SYM.NewLabelA
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .99
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
2023-01-22 14:38:20 +00:00
|
|
|
|
jmp SCOPE.Close D0 )
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-08-20 14:37:37 +00:00
|
|
|
|
* for (s1;e2;s3) s;
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*
|
2022-06-12 20:42:22 +00:00
|
|
|
|
* { <- new scope : allows for(int i=1; ....)
|
2022-08-20 14:37:37 +00:00
|
|
|
|
* s1;
|
2022-06-12 20:42:22 +00:00
|
|
|
|
* loop:
|
2022-08-20 14:37:37 +00:00
|
|
|
|
* while (e2) jmp break:
|
2022-06-12 20:42:22 +00:00
|
|
|
|
* {
|
2022-08-20 14:37:37 +00:00
|
|
|
|
* s; jsr s:
|
2022-06-12 20:42:22 +00:00
|
|
|
|
* cont:
|
2022-08-20 14:37:37 +00:00
|
|
|
|
* s3; jmp loop:
|
2022-06-12 20:42:22 +00:00
|
|
|
|
* }
|
2022-08-20 14:37:37 +00:00
|
|
|
|
* s:
|
|
|
|
|
* <s>;
|
|
|
|
|
* break:
|
2022-01-30 21:47:08 +00:00
|
|
|
|
* }
|
|
|
|
|
*--------------------------------------
|
2023-01-22 14:38:20 +00:00
|
|
|
|
KW.FOR jsr SCOPE.New FOR (
|
|
|
|
|
bcs .19
|
|
|
|
|
|
|
|
|
|
jsr SCOPE.AddLocal FOR (int...
|
|
|
|
|
bcs .19
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .19
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
|
|
|
|
cmp #'('
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bne .29
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB skip '('
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .29
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>LDYA L.CC.TYPEQUAL
|
|
|
|
|
jsr CC.LookupID
|
|
|
|
|
bcs .1
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr DECL.X
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcc .2
|
|
|
|
|
|
|
|
|
|
.19 rts
|
|
|
|
|
|
2022-12-13 06:55:13 +00:00
|
|
|
|
.29 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.1 jsr STMT.Get get s1
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .19
|
|
|
|
|
|
|
|
|
|
.2 jsr CC.GetCharNB
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .29
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
|
|
|
|
cmp #';'
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bne .29
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB skip ';'
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .29
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'L' LOOP Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr EXP.Eval00 get e2
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr KW.TestZero
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'B'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #$4C emit JMP break:
|
|
|
|
|
jsr CODE.TOABSYX
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'S'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #$20 emit JSR s:
|
|
|
|
|
jsr CODE.TOABSYX
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
2021-12-02 21:28:26 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-01-30 21:47:08 +00:00
|
|
|
|
cmp #';'
|
|
|
|
|
bne .9
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB skip ';'
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
*--------------------------------------
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'C' CONT Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr STMT.Get get s3
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .9
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'L'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #$4C
|
|
|
|
|
jsr CODE.TOABSYX emit JMP loop
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'S' S Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr STMT.New00
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jmp STMT.SetType
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2023-01-21 21:53:55 +00:00
|
|
|
|
KW.FOR.END >LDYA L.PCC.SLEEP
|
|
|
|
|
jsr CODE.EmitPCC
|
|
|
|
|
bcs .99
|
2023-01-22 14:38:20 +00:00
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
lda #$60
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
jsr CODE.EmitByte set RTS for JSR code;
|
|
|
|
|
bcs .99
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr STMT.Close
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #'B' define BREAK Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bcs .99
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-22 14:38:20 +00:00
|
|
|
|
jsr SCOPE.RemLocal FOR (int...) {};
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2023-01-21 21:53:55 +00:00
|
|
|
|
jmp SCOPE.Close FOR )
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.99 rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
KW.SWITCH jsr CC.GetCharNB
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .98
|
|
|
|
|
|
|
|
|
|
cmp #'('
|
|
|
|
|
bne .98
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .98
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr EXP.Eval00 Any var type
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .99 Y,A=T/Q
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
bne .97
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
cpy #SYM.T.UCHAR
|
|
|
|
|
bcc .97
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
cpy #SYM.T.ULONG
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .97
|
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
cpy #SYM.T.SINT+1
|
|
|
|
|
bcs .1
|
|
|
|
|
|
|
|
|
|
>LDYA L.PCC.8to16 make char an int
|
|
|
|
|
jsr CODE.EmitPCC
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
.1 >LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .99
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
txa
|
2023-01-06 14:02:35 +00:00
|
|
|
|
jsr CC.Push push STMT.hMEM
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
lda #0
|
2023-01-06 14:02:35 +00:00
|
|
|
|
jsr CC.Push push STMT.MemPtr
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .99
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr STMT.New
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .99
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #')'
|
|
|
|
|
bne .98
|
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jsr STMT.SetType {
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
lda #'J'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-10-18 05:56:59 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #$4C emit JMP JmpTable
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jmp CODE.TOABSYX
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.97 lda #E.TMISMATCH
|
|
|
|
|
sec
|
2022-09-11 19:11:32 +00:00
|
|
|
|
rts
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
|
|
|
|
.98 lda #E.CSYN
|
|
|
|
|
sec
|
2022-10-18 05:56:59 +00:00
|
|
|
|
.99
|
|
|
|
|
KW.SWITCH.RTS rts
|
2022-09-04 20:12:49 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-18 05:56:59 +00:00
|
|
|
|
KW.SWITCH.END lda #'J' define JMP Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-10-18 05:56:59 +00:00
|
|
|
|
bcs KW.SWITCH.RTS
|
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda StmtPtr
|
2022-10-18 05:56:59 +00:00
|
|
|
|
clc
|
2023-01-06 14:02:35 +00:00
|
|
|
|
adc #STMT.hMEM
|
2022-10-18 05:56:59 +00:00
|
|
|
|
tay
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda (StmtStk),y
|
2022-10-18 05:56:59 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda StmtPtr
|
2022-10-18 05:56:59 +00:00
|
|
|
|
clc
|
2023-01-06 14:02:35 +00:00
|
|
|
|
adc #STMT.MemPtr
|
2022-10-18 05:56:59 +00:00
|
|
|
|
tay
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda (StmtStk),y
|
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
sta ZPPtr2+1
|
|
|
|
|
|
|
|
|
|
stz ZPPtr2
|
|
|
|
|
|
|
|
|
|
.1 ldy ZPPtr2
|
|
|
|
|
cpy ZPPtr2+1
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
tax
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
jsr CODE.LDAXI
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>LDYA L.PCC.JmpOnYA
|
|
|
|
|
jsr CODE.EmitPCC
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
ldy ZPPtr2
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
tax
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
sty ZPPtr2
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
lda #$4C emit JMP Case ...
|
|
|
|
|
jsr CODE.TOABSYX
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 >LDYA L.PCC.Pop16
|
|
|
|
|
jsr CODE.EmitPCC
|
|
|
|
|
bcs .99
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
lda #'D'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-10-18 05:56:59 +00:00
|
|
|
|
bcs .3
|
|
|
|
|
|
|
|
|
|
lda #$4C emit JMP Default
|
|
|
|
|
jsr CODE.TOABSYX
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .99
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
.3 lda #'B' define BREAK Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.NewLabelA
|
2022-10-18 05:56:59 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-12-30 16:29:57 +00:00
|
|
|
|
jmp STMT.Close SWITCH ()
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2023-01-06 14:02:35 +00:00
|
|
|
|
KW.CASE ldy StmtPtr
|
2022-10-18 05:56:59 +00:00
|
|
|
|
beq .98
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda (StmtStk),y
|
2022-10-18 05:56:59 +00:00
|
|
|
|
cmp #KW.SWITCH.ID SWITCH ??
|
|
|
|
|
bne .98
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda StmtPtr
|
2022-09-04 20:12:49 +00:00
|
|
|
|
clc
|
2023-01-06 14:02:35 +00:00
|
|
|
|
adc #STMT.hMEM
|
2022-09-04 20:12:49 +00:00
|
|
|
|
tay
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda (StmtStk),y
|
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
jsr EXP.GetIntegral
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr2
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda StmtPtr
|
2022-10-18 05:56:59 +00:00
|
|
|
|
clc
|
2023-01-06 14:02:35 +00:00
|
|
|
|
adc #STMT.MemPtr
|
2022-10-18 05:56:59 +00:00
|
|
|
|
tay
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda (StmtStk),y
|
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
tay
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
lda ZPPtr2
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
lda ZPPtr2+1
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda ZPCCCode
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
lda ZPCCCode+1
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
iny
|
|
|
|
|
beq .97
|
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda StmtPtr
|
2022-10-18 05:56:59 +00:00
|
|
|
|
clc
|
2023-01-06 14:02:35 +00:00
|
|
|
|
adc #STMT.MemPtr
|
2022-10-18 05:56:59 +00:00
|
|
|
|
tay
|
|
|
|
|
pla
|
2023-01-06 14:02:35 +00:00
|
|
|
|
sta (StmtStk),y
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
|
|
|
|
jsr CC.GetCharNB
|
2022-10-18 05:56:59 +00:00
|
|
|
|
bcs .98
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
cmp #':'
|
2022-10-18 05:56:59 +00:00
|
|
|
|
bne .98
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB skip ':'
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
.97 lda #E.BUF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.98 lda #E.CSYN
|
2022-06-12 20:42:22 +00:00
|
|
|
|
sec
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2023-01-06 14:02:35 +00:00
|
|
|
|
KW.DEFAULT ldy StmtPtr
|
2022-09-04 20:12:49 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda (StmtStk),y
|
2022-10-18 05:56:59 +00:00
|
|
|
|
cmp #KW.SWITCH.ID
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bne .9
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
jsr CC.GetCharNB
|
|
|
|
|
bcs .9
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
cmp #':'
|
|
|
|
|
bne .9
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNCharNB skip ':'
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-10-18 05:56:59 +00:00
|
|
|
|
lda #'D' define DEFAULT Label
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jmp SYM.NewLabelA
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2022-06-12 20:42:22 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
KW.BREAK lda #'B'
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .99
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #$4C emit JMP break
|
|
|
|
|
jmp CODE.TOABSYX
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.9 lda #E.CSYN
|
2022-06-12 20:42:22 +00:00
|
|
|
|
sec
|
2022-12-13 06:55:13 +00:00
|
|
|
|
.99 rts
|
2022-06-12 20:42:22 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
KW.CONTINUE lda #'C'
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bcs .99
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #$4C emit JMP cont
|
|
|
|
|
jmp CODE.TOABSYX
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.9 lda #E.CSYN
|
2022-01-30 21:47:08 +00:00
|
|
|
|
sec
|
2022-12-13 06:55:13 +00:00
|
|
|
|
.99 rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2023-01-26 07:07:08 +00:00
|
|
|
|
KW.RETURN jsr CC.GetCharNB
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
cmp #';'
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
lda #'R'
|
2023-01-22 14:38:20 +00:00
|
|
|
|
jsr SYM.LookupLabelA Y,A=T/Q
|
2022-12-07 07:02:29 +00:00
|
|
|
|
bcs .99
|
2022-12-30 16:29:57 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr EXP.Eval
|
2022-01-30 21:47:08 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2022-12-23 16:50:50 +00:00
|
|
|
|
jsr SYM.GetYASizeOfInAX Y,A=T/Q
|
2022-01-30 21:47:08 +00:00
|
|
|
|
tax X = sizeof
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2023-01-11 18:34:34 +00:00
|
|
|
|
jsr CODE.SetRetValue
|
2022-12-23 16:50:50 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2023-01-26 07:07:08 +00:00
|
|
|
|
.1 lda #'X'
|
2022-12-13 06:55:13 +00:00
|
|
|
|
jsr SYM.LookupLabelA
|
2022-12-23 16:50:50 +00:00
|
|
|
|
bcs .99
|
2022-12-13 06:55:13 +00:00
|
|
|
|
|
|
|
|
|
lda #$4C emit JMP exit
|
|
|
|
|
jmp CODE.TOABSYX
|
|
|
|
|
|
2023-01-26 07:07:08 +00:00
|
|
|
|
.9 lda #E.CSYN
|
|
|
|
|
sec
|
2022-12-30 16:29:57 +00:00
|
|
|
|
.99 rts
|
2022-01-30 21:47:08 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
KW.SIZEOF
|
2022-02-04 14:57:17 +00:00
|
|
|
|
lda #E.CSYN
|
2021-12-02 21:28:26 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
* Input : Value on Stack, Y,A = Type/Qual
|
|
|
|
|
*--------------------------------------
|
2022-12-23 16:50:50 +00:00
|
|
|
|
KW.TestZero jsr EXP.GetYASizeOfInAX
|
2022-01-30 21:47:08 +00:00
|
|
|
|
tax
|
2022-08-20 14:37:37 +00:00
|
|
|
|
cpx #1
|
|
|
|
|
bne .1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>LDYA L.PCC.TestZero1
|
|
|
|
|
jmp CODE.EmitPCC
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.1 cpx #2
|
|
|
|
|
bne .2
|
2022-01-30 21:47:08 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>LDYA L.PCC.TestZero2
|
|
|
|
|
jmp CODE.EmitPCC
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.2 jsr CODE.LDXI
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYA L.PCC.TestZeroX
|
|
|
|
|
jmp CODE.EmitPCC
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-08-20 14:37:37 +00:00
|
|
|
|
* Input : Value on Stack, Y,A = Type/Qual
|
|
|
|
|
*--------------------------------------
|
2022-12-23 16:50:50 +00:00
|
|
|
|
KW.TestnZero jsr EXP.GetYASizeOfInAX
|
2022-08-20 14:37:37 +00:00
|
|
|
|
tax
|
|
|
|
|
cpx #1
|
|
|
|
|
bne .1
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>LDYA L.PCC.TestnZero1
|
|
|
|
|
jmp CODE.EmitPCC
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.1 cpx #2
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
>LDYA L.PCC.TestnZero2
|
|
|
|
|
jmp CODE.EmitPCC
|
|
|
|
|
|
|
|
|
|
.2 jsr CODE.LDXI
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYA L.PCC.TestnZeroX
|
|
|
|
|
jmp CODE.EmitPCC
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-01-30 21:47:08 +00:00
|
|
|
|
* Input : Value on Stack, Y,A = Type/Qual
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
KW.StackDiscard jsr TYPE.SizeOf
|
2022-01-30 21:47:08 +00:00
|
|
|
|
txa
|
|
|
|
|
beq .8 void
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
jsr CODE.RemLocal
|
2021-12-02 21:28:26 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2022-01-30 21:47:08 +00:00
|
|
|
|
.9 rts
|
2021-12-02 21:28:26 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/cc.s.kw
|
|
|
|
|
LOAD usr/src/bin/cc.s
|
|
|
|
|
ASM
|