1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-23 23:32:55 +00:00

Added tests for kickasm uses variable version problem. #296

This commit is contained in:
Jesper Gravgaard 2019-08-27 12:49:17 +02:00
parent 8ba337088d
commit 5b71c50a90
3 changed files with 41 additions and 0 deletions

View File

@ -41,6 +41,20 @@ public class TestPrograms {
compileAndCompare("kickasm-uses-prevent-deletion");
}
// TODO: Fix inline kickasm uses handling of used variables. https://gitlab.com/camelot/kickc/issues/296
/*
@Test
public void testKickasmUses1() throws IOException, URISyntaxException {
compileAndCompare("kickasm-uses-1");
}
@Test
public void testKickasmUses0() throws IOException, URISyntaxException {
compileAndCompare("kickasm-uses-0");
}
*/
@Test
public void testBitmapCircle() throws IOException, URISyntaxException {
compileAndCompare("bitmap-circle");

View File

@ -0,0 +1,13 @@
// Tests that inline kickasm uses clause makes the compiler treat the variable in a special way
// Always allocate memory for the variable (do not allow it to be turned into a constant)
char color = 7;
void main() {
kickasm(uses color) {{
lda color
sta $d020
}}
}

View File

@ -0,0 +1,14 @@
// Tests that inline kickasm uses clause makes the compiler treat the variable in a special way
// Make sure the version of the variable transfered into the inline asm is not turned into a constant
void main() {
char color;
for( char i:0..2)
color = i;
color = 7;
kickasm(uses color) {{ // Here 7 is turned into a constant!
lda color
sta $d020
}}
}