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

Added failing test for inline asm with variable reference parameters.

This commit is contained in:
jespergravgaard 2017-11-05 03:10:10 +01:00
parent 8d68d449c4
commit f1512af630
4 changed files with 21 additions and 6 deletions

View File

@ -5,6 +5,7 @@ Known Problems
- (forrangesymbolic.kc) Range-based for does not recognize symbolic constants. The following gives a ParseTreeConstantEvaluator$NotConstantException - const byte* BITMAP = $2000; for(byte* b : BITMAP..BITMAP+$2000) { *b = 0; }
- (wordexpr.kc) Expressions based on bytes but resulting in words are erronously infered as bytes - eg. yoffs = yoffs + 40*8;
- (useuninitialized.kc) Using an uninitialized variable fails in the optimizer phase. It should fail much earlier.
- (inline-asm-param.kc) Inline ASM does not attempt to handle parameters (variables).
Features
- Move the main code into a main() function, and disallow code outside functions. The main function per default has no parameters and exits with RTS.
@ -59,12 +60,7 @@ Arrays / Strings / Inline data
- Syntax for accessing the low/high byte-array that underlies the word-array. word[$100] plot_x; byte* plot_x_lo = plot_x.lo; plot_x_lo[0] = 0;
- Inline ASM
- Add support for inline asm
- Syntax asm( "asm...", "asm...", "asm..." ); - aligned with gcc
- Better syntax: asm { asm... } - using real ASM syntax inline!
- Allow inline ASM parameter expansion - eg lda line (where line is a variable)
- Support ASM syntax check etc.
- Also perform ASM clobber analysis when assigning registers.
- Allow lda <var> or sta <var> to just perform a register copy if possible.
Assembler Improvements
@ -182,3 +178,7 @@ Done
+ Inline constants that are only call parameters used once (eg. x0#0 and x0#1 in callconstparam.kc)
+ Ensured that assignment to variables with ALU potential does not affect potential registers through clobbering.
+ (const-identification.kc) Constants are not identified correctly. Some times constant pointers are treated as variables Eg. byte* SCREEN = $0400 is adressed through zero-page even though it can be adressed directly.
+ Add support for inline asm
+ Syntax: asm { asm... } - using real ASM syntax inline!
+ Support ASM syntax check etc.
+ Also perform ASM clobber analysis when assigning registers.

View File

@ -24,6 +24,10 @@ public class TestErrors extends TestCase {
helper = new ReferenceHelper("dk/camelot64/kickc/test/ref/");
}
public void testInlineAsmParam() throws IOException, URISyntaxException {
compileAndCompare("inline-asm-param");
}
public void testOverlapAllocation() throws IOException, URISyntaxException {
compileAndCompare("overlap-allocation");
}

View File

@ -0,0 +1,11 @@
byte* SCREEN = $0400;
void main() {
byte a = 'a';
asm {
lda {a}
sta {SCREEN}
};
a++;
}

View File

@ -13,7 +13,7 @@ void main() {
if((bits & $80) != 0) {
*sc = '*';
} else {
*sc = '.';
*sc = '.';
}
sc++;
bits = bits<<1;