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:
parent
8ba337088d
commit
5b71c50a90
@ -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");
|
||||
|
13
src/test/kc/kickasm-uses-0.kc
Normal file
13
src/test/kc/kickasm-uses-0.kc
Normal 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
|
||||
}}
|
||||
|
||||
}
|
14
src/test/kc/kickasm-uses-1.kc
Normal file
14
src/test/kc/kickasm-uses-1.kc
Normal 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
|
||||
}}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user