diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 71a545bf1..c8b212212 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -42,6 +42,11 @@ public class TestPrograms { public TestPrograms() { } + //@Test + //public void testStaticInitCode() throws IOException, URISyntaxException { + // compileAndCompare("static-init-code.c", log()); + //} + @Test public void testConstParenthesis() throws IOException, URISyntaxException { compileAndCompare("const-parenthesis.c"); diff --git a/src/test/kc/static-init-code.c b/src/test/kc/static-init-code.c new file mode 100644 index 000000000..7a194abb2 --- /dev/null +++ b/src/test/kc/static-init-code.c @@ -0,0 +1,16 @@ +// Tests static initialization code +// Currently placed outside any function scope and pushed into @begin block. +// To be put into an initializer function. + +// Initialize a volatile ZP-variable (will be done in the initializer) +volatile char c1 = 'x'; + +char * const SCREEN = 0x0400; + +void main() { + SCREEN[0] = c1; + SCREEN[0] = c2; +} + +// Initialize another volatile ZP-variable (will be done in the initializer) +volatile char c2 = 'y';