1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-28 16:31:36 +00:00

Merge remote-tracking branch 'origin/master' into 328-memvars

This commit is contained in:
Jesper Gravgaard 2019-10-10 08:44:41 +02:00
commit 95f3b38e7c
4 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,13 @@
sec
lda {c1}
sbc {z2}
sta {z1}
lda {c1}+1
sbc {z2}+1
sta {z1}+1
lda {c1}+2
sbc {z2}+2
sta {z1}+2
lda {c1}+3
sbc {z2}+3
sta {z1}+3

View File

@ -0,0 +1,13 @@
clc
lda {c1}
adc #2
sta {z1}
lda {c1}+1
adc #0
sta {z1}+1
lda {c1}+2
adc #0
sta {z1}+2
lda {c1}+3
adc #0
sta {z1}+3

View File

@ -724,6 +724,9 @@ public class TestPrograms {
/**
* TODO: Fix error with number resolving
*
* @Test public void testNumberTernaryFail2() throws IOException, URISyntaxException {
* compileAndCompare("number-ternary-fail-2");
* }
* @Test public void testNumberTernaryFail() throws IOException, URISyntaxException {
* compileAndCompare("number-ternary-fail");
* }

View File

@ -0,0 +1,36 @@
// Failing number type resolving in ternary operator
// Currently fails in the ternary operator with number-issues if integer literal is not specified!
import "stdlib"
void SolveMaze(char *maze, word width, word height) {
word count=0;
word x=3, y=2;
word forward=0;
while(x != (width - 2) || y != (height - 2)) {
maze[y * width + x] = forward ? 2 : 3;
if ( 1 == 1 ) {
forward = 1; // <- HERE
} else {
forward = 0;
count = 0;
}
}
}
void main() {
word width=18 * 2 + 3;
word height=6 * 2 + 3;
char *maze;
maze = malloc(width * height);
SolveMaze(maze, width, height);
free(maze);
asm {loop: jmp loop }
}