1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-26 18:29:54 +00:00

Added missing fragments. Handling inlined procedures.

This commit is contained in:
jespergravgaard 2020-02-28 00:11:33 +01:00
parent 378798d6ba
commit ce7e6d29cb
28 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,9 @@
tsx
lda {m1}
sta STACK_BASE+{c1},x
lda {m1}+1
sta STACK_BASE+{c1}+1,x
lda {m1}+2
sta STACK_BASE+{c1}+2,x
lda {m1}+3
sta STACK_BASE+{c1}+3,x

View File

@ -0,0 +1,5 @@
tsx
lda {m1}
sta STACK_BASE+{c1},x
lda {m1}+1
sta STACK_BASE+{c1}+1,x

View File

@ -0,0 +1,2 @@
tsx
sta STACK_BASE+{c1},x

View File

@ -0,0 +1,9 @@
tsx
lda {m1}
sta STACK_BASE+{c1},x
lda {m1}+1
sta STACK_BASE+{c1}+1,x
lda {m1}+2
sta STACK_BASE+{c1}+2,x
lda {m1}+3
sta STACK_BASE+{c1}+3,x

View File

@ -0,0 +1,3 @@
pha
pha
pha

View File

@ -0,0 +1,4 @@
pha
pha
pha
pha

View File

@ -0,0 +1,8 @@
lda #>{c1}>>$10
pha
lda #<{c1}>>$10
pha
lda #>{c1}
pha
lda #<{c1}
pha

View File

@ -0,0 +1,8 @@
lda {m1}+3
pha
lda {m1}+2
pha
lda {m1}+1
pha
lda {m1}
pha

View File

@ -0,0 +1 @@
pha

View File

@ -0,0 +1,8 @@
lda #>{c1}>>$10
pha
lda #<{c1}>>$10
pha
lda #>{c1}
pha
lda #<{c1}
pha

View File

@ -0,0 +1,5 @@
tax
lda #0
pha
txa
pha

View File

@ -0,0 +1,4 @@
pla
sta {m1}
pla
sta {m1}+1

View File

@ -0,0 +1,5 @@
tsx
lda STACK_BASE+{c1},x
sta {m1}
lda STACK_BASE+{c1}+1,x
sta {m1}+1

View File

@ -0,0 +1,5 @@
tsx
lda STACK_BASE+{c1},x
sta {m1}
lda STACK_BASE+{c1}+1,x
sta {m1}+1

View File

@ -0,0 +1,5 @@
tsx
lda STACK_BASE+{c1},x
sta {m1}
lda STACK_BASE+{c1}+1,x
sta {m1}+1

View File

@ -0,0 +1,4 @@
pla
sta {m1}
pla
sta {m1}+1

View File

@ -0,0 +1,5 @@
tsx
lda STACK_BASE+{c1},x
sta {m1}
lda STACK_BASE+{c1}+1,x
sta {m1}+1

View File

@ -0,0 +1,5 @@
tsx
lda STACK_BASE+{c1},x
sta {m1}
lda STACK_BASE+{c1}+1,x
sta {m1}+1

View File

@ -0,0 +1,4 @@
pla
sta {m1}
pla
sta {m1}+1

View File

@ -0,0 +1,2 @@
tsx
lda STACK_BASE+{c1},x

View File

@ -0,0 +1 @@
pla

View File

@ -0,0 +1,2 @@
tsx
ldy STACK_BASE+{c1},x

View File

@ -0,0 +1,8 @@
pla
sta {m1}
pla
sta {m1}+1
pla
sta {m1}+2
pla
sta {m1}+3

View File

@ -0,0 +1,9 @@
tsx
lda STACK_BASE+{c1},x
sta {m1}
lda STACK_BASE+{c1}+1,x
sta {m1}+1
lda STACK_BASE+{c1}+2,x
sta {m1}+2
lda STACK_BASE+{c1}+3,x
sta {m1}+3

View File

@ -0,0 +1,8 @@
pla
sta {m1}
pla
sta {m1}+1
pla
sta {m1}+2
pla
sta {m1}+3

View File

@ -0,0 +1,4 @@
pla
sta {m1}
lda #0
sta {m1}+1

View File

@ -678,6 +678,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
for(Directive directive : directives) {
if(directive instanceof Directive.Inline) {
procedure.setDeclaredInline(true);
procedure.setCallingConvention(Procedure.CallingConvention.PHI_CALL);
} else if(directive instanceof Directive.CallingConvention) {
procedure.setCallingConvention(((Directive.CallingConvention) directive).callingConvention);
} else if(directive instanceof Directive.Interrupt) {

View File

@ -39,6 +39,7 @@ public class Pass1ProcedureInline extends Pass1Base {
ProcedureRef procedureRef = call.getProcedure();
Procedure procedure = getScope().getProcedure(procedureRef);
if(procedure.isDeclaredInline()) {
procedure.setCallingConvention(Procedure.CallingConvention.PHI_CALL);
if(procedure.getInterruptType()!=null) {
throw new CompileError("Error! Interrupts cannot be inlined. "+procedure.getRef().toString());
}