1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00

Added some missing fragments.

This commit is contained in:
jespergravgaard 2020-02-26 11:00:08 +01:00
parent 5e6ac1a0cd
commit ee18c2c414
7 changed files with 60 additions and 7 deletions

View File

@ -0,0 +1,8 @@
clc
ldy #0
adc ({z2}),y
sta {m1}
tya
iny
adc ({z2}),y
sta {m1}+1

View File

@ -0,0 +1,10 @@
clc
ldy #0
adc ({z1}),y
pha
tya
iny
adc ({z1}),y
sta {z1}+1
pla
sta {z1}

View File

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

View File

@ -0,0 +1,19 @@
lda {m3}+1
ora #$7f
bmi !+
lda #0
!:
sta $ff
sec
lda {m2}
sbc {m3}
sta {m1}
lda {m2}+1
sbc {m3}+1
sta {m1}+1
lda {m2}+2
sbc $ff
sta {m1}+2
lda {m2}+3
sbc $ff
sta {m1}+3

View File

@ -0,0 +1,19 @@
lda {m3}+1
ora #$7f
bmi !+
lda #0
!:
sta $ff
clc
lda {m2}
adc {m3}
sta {m1}
lda {m2}+1
adc {m3}+1
sta {m1}+1
lda {m2}+2
adc $ff
sta {m1}+2
lda {m2}+3
adc $ff
sta {m1}+3

View File

@ -87,16 +87,12 @@ public class VariableBuilderConfig {
*/
public static void defaultPostConfig(VariableBuilderConfig config, CompileLog log) {
// Arrays are always load/store variables in main memory
// TODO: Theoretically some program may want an array on ZP. How to support that?
config.addSetting("array_ma_mem", log, StatementSource.NONE);
// Global struct values are always load/store variables in main memory
// TODO: Global structs can be SSA (and then unwound) which can optimize some programs. How to support that?
config.addSetting("global_struct_ma_mem", log, StatementSource.NONE);
// Parameters are always passed using single-static-assignment
// TODO: Compilation Unit support will require parameters that are not SSA. How to specify that?
config.addSetting("parameter_ssa", log, StatementSource.NONE);
// Pointers are always on zeropage
// TODO: Pointers can technically exist in main-memory and be moved to ZP on every use. How to specify that?
config.addSetting("pointer_zp", log, StatementSource.NONE);
}

View File

@ -97,9 +97,6 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
if(program.getLog().isVerboseParse()) {
program.getLog().append("Importing " + importFileName);
}
// The Parser / Lexer will automatically add the import file content here in the token stream
//Path currentPath = file.toPath().getParent();
//SourceLoader.loadAndParseFile(importFileName, currentPath, program);
return null;
}