1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-02-16 18:30:37 +00:00

Added compiler option -Warraytype to allow non-standard array syntax. By default it is not allowed. #162

This commit is contained in:
jespergravgaard 2020-03-26 16:20:30 +01:00
parent d3012e92d1
commit ffa9d8a6ca
217 changed files with 472 additions and 460 deletions

View File

@ -61,6 +61,10 @@ public class Compiler {
program.setWarnFragmentMissing(warnFragmentMissing);
}
public void setWarnArrayType(boolean warnArrayType) {
program.setWarnArrayType(warnArrayType);
}
public void setLinkScriptFileName(String linkScript) {
this.linkScriptFileName = linkScript;
}

View File

@ -127,6 +127,9 @@ public class KickC implements Callable<Void> {
@CommandLine.Option(names = {"-Wfragment"}, description = "Warning Option. Missing fragments produces a warning instead of an error.")
private boolean warnFragmentMissing = false;
@CommandLine.Option(names = {"-Warraytype"}, description = "Warning Option. Non-standard array syntax produces a warning instead of an error.")
private boolean warnArrayType = false;
@CommandLine.Option(names = {"-fragment"}, description = "Print the ASM code for a named fragment. The fragment is loaded/synthesized and the ASM variations are written to the output.")
private String fragment = null;
@ -279,6 +282,10 @@ public class KickC implements Callable<Void> {
compiler.setWarnFragmentMissing(true);
}
if(warnArrayType) {
compiler.setWarnArrayType(true);
}
if(linkScript != null) {
compiler.setLinkScriptFileName(linkScript);
}

View File

@ -40,6 +40,8 @@ public class Program {
/** Missing fragments produce a warning instead of an error (STATIC) */
private boolean warnFragmentMissing = false;
/** Array syntax used on types (eg. char[8] x; ) produce a warning instead of an error (STATIC) */
private boolean warnArrayType = false;
/** Path to any custom link script file used for linking (STATIC) */
private Path linkScriptFilePath;
@ -179,6 +181,14 @@ public class Program {
this.warnFragmentMissing = warnFragmentMissing;
}
public boolean isWarnArrayType() {
return warnArrayType;
}
public void setWarnArrayType(boolean errorArrayKickC) {
this.warnArrayType = errorArrayKickC;
}
public Path getAsmFragmentCacheFolder() {
return asmFragmentCacheFolder;
}

View File

@ -1566,15 +1566,19 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override
public SymbolType visitTypeArray(KickCParser.TypeArrayContext ctx) {
// throw new CompileError("Non-standard array declaration ", new StatementSource(ctx));
SymbolType elementType = (SymbolType) visit(ctx.typeDecl());
if(ctx.expr() != null) {
RValue sizeVal = (RValue) visit(ctx.expr());
declArraySpec = new ArraySpec((ConstantValue) sizeVal);
return new SymbolTypePointer(elementType);
if(program.isWarnArrayType()) {
program.getLog().append("Non-standard array declaration.\n" + new StatementSource(ctx).toString());
SymbolType elementType = (SymbolType) visit(ctx.typeDecl());
if(ctx.expr() != null) {
RValue sizeVal = (RValue) visit(ctx.expr());
declArraySpec = new ArraySpec((ConstantValue) sizeVal);
return new SymbolTypePointer(elementType);
} else {
declArraySpec = new ArraySpec();
return new SymbolTypePointer(elementType);
}
} else {
declArraySpec = new ArraySpec();
return new SymbolTypePointer(elementType);
throw new CompileError("ERROR! Non-standard array declaration. Allow using commandline option -Warraytype", new StatementSource(ctx));
}
}

View File

@ -3166,6 +3166,11 @@ public class TestPrograms {
compileAndCompare("arrays-init-short");
}
@Test
public void testArraysNonstandardSyntax() throws IOException, URISyntaxException {
assertError("arrays-nonstandard-syntax", "ERROR! Non-standard array declaration.");
}
@Test
public void testArraysInit() throws IOException, URISyntaxException {
compileAndCompare("arrays-init");

View File

@ -1,6 +1,6 @@
// Test address-of an array element
int[] VALS = { 1, 2, 3, 4 };
int VALS[] = { 1, 2, 3, 4 };
void main() {
print(VALS);

View File

@ -7,7 +7,7 @@ void main() {
SCREEN[idx] = getValue(idx);
}
unsigned int[128] arr16;
unsigned int arr16[128];
unsigned int getValue(unsigned int index) {
return (unsigned int)((arr16[index & 0x7f] & 0xff) >> 1);

View File

@ -1,4 +1,4 @@
byte[3] b = { 1, 2, 3, 4, 5 };
byte b[3] = { 1, 2, 3, 4, 5 };
void main() {
byte* SCREEN = $400;

View File

@ -1,7 +1,7 @@
// Illustrates symbolic array lengths
const byte SZ = 15;
byte[SZ] items;
byte items[SZ];
// Fills the array item by item with $is, where i is the item# and s is the sub#
void main() {

View File

@ -3,7 +3,7 @@
const byte ITEM_COUNT = 3;
const byte ITEM_SIZE = 5;
byte[ITEM_COUNT*ITEM_SIZE] items = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte items[ITEM_COUNT*ITEM_SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// Fills the array item by item with $is, where i is the item# and s is the sub#
void main() {

View File

@ -1,4 +1,4 @@
byte[] b;
byte b[];
void main() {
byte* SCREEN = $400;

View File

@ -1,7 +1,7 @@
// Test initializing array using KickAssembler
// Sinus table
byte[256] SINTAB = kickasm {{
byte SINTAB[256] = kickasm {{
.fill 256, 128 + 128*sin(i*2*PI/256)
}};

View File

@ -1,7 +1,7 @@
// Test a short array initializer - the rest should be zero-filled
char[16] msg1 ="camelot";
char[16] msg2 = { 'c', 'm', 'l' };
char msg1[16] ="camelot";
char msg2[16] = { 'c', 'm', 'l' };
const char* SCREEN = 0x400;

View File

@ -0,0 +1,10 @@
// Test non-standard array syntax char[8]
char[16] msg ="camelot";
const char* SCREEN = 0x400;
void main() {
for(char i=0;msg[i];i++)
SCREEN[i] = msg1[i];
}

View File

@ -1,5 +1,5 @@
// Test compound assignment operators
byte[] ref = { 3, 4, 3, 18, 9, 1, 4, 2, 4, 5, 1 , 0};
byte ref[] = { 3, 4, 3, 18, 9, 1, 4, 2, 4, 5, 1 , 0};
byte* screen1 = $400;
byte* screen2 = screen1+40;
byte* cols = $d800;

View File

@ -4,7 +4,7 @@ const byte* SCREEN = $400;
const byte* BITMAP = $2000;
const byte* COLORS = $d800;
byte[] bitmask = { 128, 64, 32, 16, 8, 4, 2, 1 };
byte bitmask[] = { 128, 64, 32, 16, 8, 4, 2, 1 };
void main() {
fill(BITMAP,40*25*8,0);

View File

@ -8,7 +8,7 @@ const byte* SCREEN = $400;
const byte* BITMAP = $2000;
const byte* COLORS = $d800;
byte[] bitmask = { 128, 64, 32, 16, 8, 4, 2, 1 };
byte bitmask[] = { 128, 64, 32, 16, 8, 4, 2, 1 };
void main() {
fill(BITMAP,40*25*8,0);

View File

@ -6,7 +6,7 @@ import "bitmap2"
byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;
byte[0x100] plots_per_frame;
byte plots_per_frame[0x100];
void main() {
bitmap_init(BITMAP, SCREEN);

View File

@ -8,9 +8,9 @@ import "bitmap2"
byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;
byte[0x100] plots_per_frame;
byte plots_per_frame[0x100];
align(0x100) signed word[512] SINUS;
align(0x100) signed word SINUS[512];
void main() {
sin16s_gen2(SINUS, 512, -0x1001, 0x1001);

View File

@ -8,9 +8,9 @@ import "bitmap2"
byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;
byte[0x100] plots_per_frame;
byte plots_per_frame[0x100];
align(0x100) signed word[512] SINUS;
align(0x100) signed word SINUS[512];
void main() {
sin16s_gen2(SINUS, 512, -0x1001, 0x1001);

View File

@ -7,7 +7,7 @@ import "print"
byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;
byte[0x180] align(0x100) SINTAB = kickasm {{ .fill $180, 99.5+99.5*sin(i*2*PI/256) }};
byte align(0x100) SINTAB[0x180] = kickasm {{ .fill $180, 99.5+99.5*sin(i*2*PI/256) }};
byte* COSTAB = SINTAB+0x40;
void main() {

View File

@ -33,8 +33,8 @@ void main() {
} while (true);
}
byte[] plots_x = { 60, 80, 110, 80, 60, 40, 10, 40 };
byte[] plots_y = { 10, 40, 60, 80, 110, 80, 60, 40 };
byte plots_x[] = { 60, 80, 110, 80, 60, 40, 10, 40 };
byte plots_y[] = { 10, 40, 60, 80, 110, 80, 60, 40 };
byte plots_cnt = 8;
void plots() {
@ -43,11 +43,11 @@ void plots() {
}
}
const byte[256] plot_xlo;
const byte[256] plot_xhi;
const byte[256] plot_ylo;
const byte[256] plot_yhi;
const byte[256] plot_bit;
const byte plot_xlo[256];
const byte plot_xhi[256];
const byte plot_ylo[256];
const byte plot_yhi[256];
const byte plot_bit[256];
void plot(byte x, byte y) {
byte* plotter_x = 0;

View File

@ -1,5 +1,5 @@
byte STAR = 81;
byte[40*25] SCREEN = $0400;
byte SCREEN[40*25] = $0400;
void main() {
byte x0 = 4;

View File

@ -1,7 +1,7 @@
void main() {
byte STAR = 81;
byte[40*25] screen = $0400;
byte screen[40*25] = $0400;
byte x0 = 0;
byte y0 = 0;
byte x1 = 39;

View File

@ -3,8 +3,8 @@
import "c64dtv.kc"
const byte* SCREEN = $400;
const byte[] SRCA = "camelot rules!";
const byte[] SRCB = { $80 };
const byte SRCA[] = "camelot rules!";
const byte SRCB[] = { $80 };
void main() {

View File

@ -1,9 +1,9 @@
import "c64dtv.kc"
const byte* SCREEN = $400;
const byte[] SRCA = { 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '};
const byte SRCA[] = { 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '};
const byte SRCA_LEN = 9;
const byte[] SRCB = { $80 };
const byte SRCB[] = { $80 };
void main() {

View File

@ -7,7 +7,7 @@ void main() {
*DTV_FEATURE = DTV_FEATURE_ENABLE;
*DTV_CONTROL = DTV_HIGHCOLOR | DTV_BORDER_OFF | DTV_BADLINE_OFF;
byte[16] palette = { $0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $a, $b, $c, $d, $e, $f };
byte palette[16] = { $0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $a, $b, $c, $d, $e, $f };
while(true) {
while(*RASTER!=$40) { }

View File

@ -114,7 +114,7 @@ const byte* FORM_SCREEN = $0400;
// Charset used for the FORM
const byte* FORM_CHARSET = $1800; // Charset ROM
byte[] FORM_TEXT =
byte FORM_TEXT[] =
" C64 DTV Graphics Mode Explorer @"
" @"
" PRESET 0 Standard Charset @"
@ -131,7 +131,7 @@ byte[] FORM_TEXT =
" overscan 0 step 00 bgcol2 00 @"
" modulo 00 bgcol3 00 @"
;
byte[] FORM_COLS =
byte FORM_COLS[] =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@"
" @"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@"
@ -153,35 +153,35 @@ byte[] FORM_COLS =
// Number of form fields
byte form_fields_cnt = 36;
// Form fields x/y-positions
byte[] form_fields_x = { 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 25, 24, 25, 24, 25, 24, 25, 25, 24, 25, 24, 25, 24, 25, 37, 37, 37, 37, 36, 37, 36, 37, 36, 37, 36, 37 };
byte[] form_fields_y = { 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 5, 6, 6, 7, 7, 8, 8, 11, 12, 12, 13, 13, 14, 14, 5, 6, 7, 10, 11, 11, 12, 12, 13, 13, 14, 14 };
byte form_fields_x[] = { 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 25, 24, 25, 24, 25, 24, 25, 25, 24, 25, 24, 25, 24, 25, 37, 37, 37, 37, 36, 37, 36, 37, 36, 37, 36, 37 };
byte form_fields_y[] = { 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 5, 6, 6, 7, 7, 8, 8, 11, 12, 12, 13, 13, 14, 14, 5, 6, 7, 10, 11, 11, 12, 12, 13, 13, 14, 14 };
// Form field max values (all values are in the interval 0..max)
byte[] form_fields_max = { 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, $d, $f, $f, $f, $f, $f, $f, $d, $f, $f, $f, $f, $f, $f, $3, $1, $4, $1, $f, $f, $f, $f, $f, $f, $f, $f };
byte form_fields_max[] = { 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, $d, $f, $f, $f, $f, $f, $f, $d, $f, $f, $f, $f, $f, $f, $3, $1, $4, $1, $f, $f, $f, $f, $f, $f, $f, $f };
// Form fields values
byte[] form_fields_val = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte form_fields_val[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// Preset: Standard Char Mode
byte[] preset_stdchar = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte preset_stdchar[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// Preset: Extended Color Char Mode
byte[] preset_ecmchar = { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 5, 0, 6 };
byte preset_ecmchar[] = { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 5, 0, 6 };
// Preset: Standard Bitmap
byte[] preset_stdbm = { 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte preset_stdbm[] = { 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// Preset: MC Bitmap
byte[] preset_mcbm = { 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0 };
byte preset_mcbm[] = { 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0 };
// Preset: Hicolor Standard Char Mode
byte[] preset_hi_stdchar = { 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
byte preset_hi_stdchar[] = { 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
// Preset: Hicolor Extended Color Char Mode
byte[] preset_hi_ecmchar = { 5, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 6, 8, 9, $c, $c };
byte preset_hi_ecmchar[] = { 5, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 6, 8, 9, $c, $c };
// Preset: Two plane mode
byte[] preset_twoplane = { 6, 1, 0, 1, 1, 1, 0, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 7, 0, $d, 4, 0, 0, 0, 0 };
byte preset_twoplane[] = { 6, 1, 0, 1, 1, 1, 0, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 7, 0, $d, 4, 0, 0, 0, 0 };
// Preset: Chunky 8bpp
byte[] preset_chunky = { 7, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
byte preset_chunky[] = { 7, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
// Preset: Sixs FREDs mode
byte[] preset_sixsfred = { 8, 1, 1, 1, 1, 1, 0, 0, 0, 0, $9, 0, 0, 0, 1, 0, 0, $a, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
byte preset_sixsfred[] = { 8, 1, 1, 1, 1, 1, 0, 0, 0, 0, $9, 0, 0, 0, 1, 0, 0, $a, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
// Preset: Sixs FREDs 2 mode
byte[] preset_sixsfred2 = { 9, 1, 1, 1, 0, 1, 0, 0, 0, 0, $9, 0, 0, 0, 1, 0, 0, $a, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
byte preset_sixsfred2[] = { 9, 1, 1, 1, 0, 1, 0, 0, 0, 0, $9, 0, 0, 0, 1, 0, 0, $a, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
// Preset: 8bpp Pixel Cell
byte[] preset_8bpppixelcell = { 10, 0, 1, 1, 1, 1, 0, 1, 0, 0, $0, 0, 0, 0, 1, 0, 0, $b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
byte preset_8bpppixelcell[] = { 10, 0, 1, 1, 1, 1, 0, 1, 0, 0, $0, 0, 0, 0, 1, 0, 0, $b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
// Apply a form value preset to the form values
// idx is the ID of the preset
@ -487,8 +487,8 @@ void gfx_init_vic_bitmap() {
// Draw some lines on the bitmap
bitmap_init(VIC_BITMAP);
bitmap_clear();
byte[] lines_x = { $00, $ff, $ff, $00, $00, $80, $ff, $80, $00, $80 };
byte[] lines_y = { $00, $00, $c7, $c7, $00, $00, $64, $c7, $64, $00 };
byte lines_x[] = { $00, $ff, $ff, $00, $00, $80, $ff, $80, $00, $80 };
byte lines_y[] = { $00, $00, $c7, $c7, $00, $00, $64, $c7, $64, $00 };
byte lines_cnt = 9;
for(byte l=0; l<lines_cnt;l++) {
bitmap_line(lines_x[l], lines_x[l+1], lines_y[l], lines_y[l+1]);
@ -539,7 +539,7 @@ void gfx_init_plane_horisontal2() {
byte gfxbCpuBank = (byte)(PLANE_HORISONTAL2/$4000);
dtvSetCpuBankSegment1(gfxbCpuBank++);
byte* gfxa = $4000 + (PLANE_HORISONTAL2 & $3fff);
byte[] row_bitmask = { %00000000, %01010101, %10101010, %11111111 };
byte row_bitmask[] = { %00000000, %01010101, %10101010, %11111111 };
for(byte ay : 0..199) {
for (byte ax : 0..39) {
byte row = (ay/2) & 3;
@ -686,8 +686,8 @@ void form_mode() {
}
// Table with addresses of the y-lines of the form. The first line contains the address of the form screen.
byte[25] form_line_lo;
byte[25] form_line_hi;
byte form_line_lo[25];
byte form_line_hi[25];
// Current selected field in the form
byte form_field_idx = 0;

View File

@ -17,7 +17,7 @@ void main() {
}
}
byte[] MENU_TEXT =
byte MENU_TEXT[] =
"C64DTV Graphics Modes CCLHBME@"
" OHIIMCC@"
" LUNCMMM@"
@ -378,8 +378,8 @@ void mode_stdbitmap() {
// Draw some lines on the bitmap
bitmap_init(BITMAP);
bitmap_clear();
byte[] lines_x = { $00, $ff, $ff, $00, $00, $80, $ff, $80, $00, $80 };
byte[] lines_y = { $00, $00, $c7, $c7, $00, $00, $64, $c7, $64, $00 };
byte lines_x[] = { $00, $ff, $ff, $00, $00, $80, $ff, $80, $00, $80 };
byte lines_y[] = { $00, $00, $c7, $c7, $00, $00, $64, $c7, $64, $00 };
byte lines_cnt = 9;
for(byte l=0; l<lines_cnt;l++) {
bitmap_line(lines_x[l], lines_x[l+1], lines_y[l], lines_y[l+1]);
@ -668,7 +668,7 @@ void mode_sixsfred() {
}
// Graphics for Plane A () - horizontal stripes every 2 pixels
byte* gfxa = PLANEA;
byte[] row_bitmask = { %00000000, %01010101, %10101010, %11111111 };
byte row_bitmask[] = { %00000000, %01010101, %10101010, %11111111 };
for(byte ay : 0..199) {
for (byte ax : 0..39) {
byte row = (ay/2) & 3;
@ -734,7 +734,7 @@ void mode_sixsfred2() {
}
// Graphics for Plane A () - horizontal stripes every 2 pixels
byte* gfxa = PLANEA;
byte[] row_bitmask = { %00000000, %01010101, %10101010, %11111111 };
byte row_bitmask[] = { %00000000, %01010101, %10101010, %11111111 };
for(byte ay : 0..199) {
for (byte ax : 0..39) {
byte row = (ay/2) & 3;

View File

@ -1,7 +1,7 @@
// Example of NOP-casting a dereferenced signed byte to a byte
void main() {
signed byte[] sbs = { -1, -2, -3, -4};
signed byte sbs[] = { -1, -2, -3, -4};
byte* SCREEN = $0400;
for(byte i : 0..3) {
SCREEN[i] = (byte) sbs[i];

View File

@ -1,6 +1,6 @@
// Tests a cast that is not needed
byte*[] screens = { (byte*)$0400, (byte*)$1400 };
byte* screens[] = { (byte*)$0400, (byte*)$1400 };
void main() {
byte* screen;

View File

@ -1,6 +1,6 @@
// Tests a cast that is not needed
byte*[] screens = { (byte*)$0400, (byte*)$1400 };
byte* screens[] = { (byte*)$0400, (byte*)$1400 };
void main() {
byte* DSP = $400;

View File

@ -5,7 +5,7 @@ void main() {
for(byte* sc : SCREEN..SCREEN+1000) *sc=' ';
byte[] header = " < <= == >= >";
byte header[] = " < <= == >= >";
for( byte i=0; header[i]!=0; i++)
SCREEN[i] = header[i];

View File

@ -71,7 +71,7 @@ struct ProcessingSprite {
};
// Sprites currently being processed in the interrupt
struct ProcessingSprite[NUM_PROCESSING] PROCESSING;
struct ProcessingSprite PROCESSING[NUM_PROCESSING];
void main() {
// Initialize the screen containing distance to the center

View File

@ -108,8 +108,8 @@ char* RENDERBOB_CLEANUP[NUM_BOBS];
// Pointer to the next clean-up to add
char** renderBobCleanupNext;
// *40 Table unsigned int[0x20] MUL40 = { ((unsigned int)i)*40 };
unsigned int[0x20] MUL40;
// *40 Table unsigned int MUL40[0x20] = { ((unsigned int)i)*40 };
unsigned int MUL40[0x20];
// Initialize the tables used by renderBob()
void renderBobInit() {

View File

@ -45,7 +45,7 @@ struct SplineVector32 {
};
// Array filled with spline segment points by splinePlot_16()
struct SplineVector16[17] SPLINE_16SEG;
struct SplineVector16 SPLINE_16SEG[17];
// Generate a 16-segment quadratic spline using 32-bit fixed point 1/$10000-format math 16 decimal bits).
// This function can handle all signed int values in the points.
@ -76,7 +76,7 @@ void spline_16seg(struct SplineVector16 p0, struct SplineVector16 p1, struct Spl
}
// Array filled with spline segment points by splinePlot_8()
struct SplineVector16[9] SPLINE_8SEG;
struct SplineVector16 SPLINE_8SEG[9];
// Generate a 8-segment quadratic spline using 32-bit fixed point 1/$10000-format math 16 decimal bits).
// The resulting spline segment points are returned in SPLINE_8SEG[]

View File

@ -19,7 +19,7 @@ struct Segment {
};
// True type letter c
struct Segment[22] letter_c = {
struct Segment letter_c[22] = {
{ MOVE_TO, {108,146}, {0,0} },
{ SPLINE_TO, {89,182}, {103,169} },
{ SPLINE_TO, {59,195}, {75,195} },

View File

@ -1,6 +1,6 @@
// Test fragment promotion of a constant (400) to signed word even if it also matches an unsigned word
signed word[3] world ;
signed word world[3];
void main() {
for(byte i:0..2) {

View File

@ -1,6 +1,6 @@
// Concatenates string constants in different ways
void main() {
byte[] msg = "camel" "ot";
byte msg[] = "camel" "ot";
byte* SCREEN = 0x0400;
for( byte i=0;msg[i]!=0;i++) {
SCREEN[i] = msg[i];

View File

@ -1,6 +1,6 @@
// Concatenates string constants in different ways
void main() {
byte[] s = "c"
byte s[] = "c"
"ame"
"lot";
byte* SCREEN = $400;

View File

@ -9,7 +9,7 @@ import "print"
const byte* CHARSET = 0x2000;
const byte* SCREEN = 0x2800;
const byte[1000] SCREEN_REF = kickasm {{
const byte SCREEN_REF[1000] = kickasm {{
.for(var y=-12;y<=12;y++)
.for(var x=-19;x<=20;x++)
.byte round(256*atan2(y, x)/PI/2)

View File

@ -4,7 +4,7 @@
struct foo {
char thing1;
char thing2;
char[12] thing3;
char thing3[12];
};
__mem __ma struct foo bar = { 'a', 'b', "qwe" };

View File

@ -1,7 +1,7 @@
// Tests optimizing derefs of *(ptr+b) to ptr[b - even when a noop-cast is needed
byte[] msg1 = { 'a', 'b', 'c', 'd' };
byte[] msg2 = { '1', '2', '3', '4' };
byte msg1[] = { 'a', 'b', 'c', 'd' };
byte msg2[] = { '1', '2', '3', '4' };
void main() {
print(msg1);

View File

@ -1,7 +1,7 @@
// Tests optimizing derefs of *(ptr+b) to ptr[b]
byte[] msg1 = { 'a', 'b', 'c', 'd' };
byte[] msg2 = { '1', '2', '3', '4' };
byte msg1[] = { 'a', 'b', 'c', 'd' };
byte msg2[] = { '1', '2', '3', '4' };
void main() {
print(msg1);

View File

@ -1,8 +1,8 @@
// Tests that constant offset indexing into arrays is handled correctly
byte[1000] MAPDATA;
byte[256] COLORMAP1;
byte[256] COLORMAP2;
byte MAPDATA[1000];
byte COLORMAP1[256];
byte COLORMAP2[256];
byte* SCREEN = $0400;
byte* COLS = $d800;

View File

@ -2,16 +2,16 @@
#pragma encoding(petscii_mixed)
const char cpm = 'A';
const char[] spm = "A";
const char spm[] = "A";
#pragma encoding(petscii_upper)
const char ccpu = 'A';
const char[] spu = "A";
const char spu[] = "A";
#pragma encoding(screencode_mixed)
const char csm = 'A';
const char[] ssm = "A";
const char ssm[] = "A";
#pragma encoding(screencode_upper)
const char csu = 'A';
const char[] ssu = "A";
const char ssu[] = "A";
const char* screen = 0x0400;
void main() {

View File

@ -413,9 +413,9 @@ char align(0x100) mulf_sqr2[0x200] = kickasm {{
// - http://codebase64.org/doku.php?id=magazines:chacking16
// mulf_sqr tables will contain f(x)=int(x*x) and g(x) = f(1-x).
// f(x) = >(( x * x ))
byte[512] align($100) mulf_sqr1;
byte align($100) mulf_sqr1[512];
// g(x) = >((( 1 - x ) * ( 1 - x )))
byte[512] align($100) mulf_sqr2;
byte align($100) mulf_sqr2[512];
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x) and g(x) = f(1-x)
void mulf_init() {

View File

@ -14,7 +14,7 @@ kickasm(resource "logo.png", pc LOGO, bytes 6*40*8) {{
const unsigned int XSIN_SIZE = 512;
signed int[XSIN_SIZE] align($100) xsin;
signed int align($100) xsin[XSIN_SIZE];
void main() {
asm { sei }

View File

@ -10,9 +10,9 @@ char* BITMAP = $2000;
const unsigned int SIN_SIZE = 512;
signed int[512] align($100) sin;
signed int align($100) sin[512];
signed int[512] sin2 = kickasm {{
signed int sin2[512] = kickasm {{
.for(var i=0; i<512; i++) {
.word sin(toRadians([i*360]/512))*320
}

View File

@ -55,11 +55,11 @@ void print_mulf8s127(signed char a, signed char b) {
// mulf_sqr tables will contain f(x)=int(x*x/4) and g(x) = f(x-255).
// f(x) = ( x * x )/4
unsigned char[512] align($100) mulf127_sqr1_lo = kickasm{{ .fill 512, <round((i/127*i/127)*127/4) }};
unsigned char[512] align($100) mulf127_sqr1_hi = kickasm{{ .fill 512, >round((i/127*i/127)*127/4) }};
unsigned char align($100) mulf127_sqr1_lo[512] = kickasm{{ .fill 512, <round((i/127*i/127)*127/4) }};
unsigned char align($100) mulf127_sqr1_hi[512] = kickasm{{ .fill 512, >round((i/127*i/127)*127/4) }};
// g(x) = <((( x - 255) * ( x - 255 ))/4)
unsigned char[512] align($100) mulf127_sqr2_lo = kickasm{{ .fill 512, <round(((i-255)/127*(i-255)/127)*127/4) }};
unsigned char[512] align($100) mulf127_sqr2_hi = kickasm{{ .fill 512, >round(((i-255)/127*(i-255)/127)*127/4) }};
unsigned char align($100) mulf127_sqr2_lo[512] = kickasm{{ .fill 512, <round(((i-255)/127*(i-255)/127)*127/4) }};
unsigned char align($100) mulf127_sqr2_hi[512] = kickasm{{ .fill 512, >round(((i-255)/127*(i-255)/127)*127/4) }};
unsigned word mulf8u127(unsigned char a, unsigned char b) {
const byte* memA = $fc;

View File

@ -1,4 +1,4 @@
byte[15] fibs;
byte fibs[15];
void main() {
fibs[0] = 0;

View File

@ -1,5 +1,5 @@
byte[16*16] buffer1;
byte[16*16] buffer2;
byte buffer1[16*16];
byte buffer2[16*16];
byte *RASTER = $d012;
byte* SCREEN = $0400;

View File

@ -21,7 +21,7 @@ void init_font_hex(byte* charset) {
}
// Bit patterns for symbols 0-f (3x5 pixels) used in font hex
byte[] FONT_HEX_PROTO = {
byte FONT_HEX_PROTO[] = {
// 0
0b010,
0b101,

View File

@ -8,7 +8,7 @@ void main() {
new_ball[4];
}
const char[$10] BALLS;
const char BALLS[0x10];
void new_ball(char i) {
BALLS[i]++;

View File

@ -10,7 +10,7 @@ void fn2() {
(*BGCOL)++;
}
void()*[2] fns = { &fn1, &fn2 };
void()* fns[2] = { &fn1, &fn2 };
void main() {
byte i = 0;

View File

@ -6,7 +6,7 @@ void do10(void()* fn) {
}
const byte* SCREEN = $0400;
const byte[] msg = "hello ";
const byte msg[] = "hello ";
volatile byte idx = 0;

View File

@ -8,8 +8,8 @@ void do10(void()* fn) {
const byte* SCREEN = $0400;
const byte[] msg1 = "hello ";
const byte[] msg2 = "world ";
const byte msg1[] = "hello ";
const byte msg2[] = "world ";
volatile byte* msg;
volatile byte idx = 0;

View File

@ -5,7 +5,7 @@ byte* PROCPORT = $01;
byte* D018 = $d018;
byte* CHARSET4 = $2800;
byte[] bits_count = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
byte bits_count[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
void main() {
asm { sei }

View File

@ -1,6 +1,6 @@
// Tests minimal hello world
byte[] msg = "hello world!";
byte msg[] = "hello world!";
byte* SCREEN = 0x0400;
void main() {

View File

@ -16,7 +16,7 @@ void cls() {
}
// Digits used for utoa()
unsigned char[] DIGITS = "0123456789abcdef";
unsigned char DIGITS[] = "0123456789abcdef";
// Hexadecimal utoa() for an unsigned int (16bits)
void utoa16w(unsigned int value, unsigned char* dst) {

View File

@ -23,7 +23,7 @@ void main() {
*bordercol = 0;
unsigned char time = time_end - time_start;
utoa10w((unsigned int)time, screen+80);
byte[] msg = "raster lines";
byte msg[] = "raster lines";
for( byte i=0; msg[i]!=0; i++ ) (screen+80+3)[i] = msg[i];
//for( byte* m="lines", s=screen+80+6 ;*m!=0;m++,s++) *s = *m;
}
@ -41,12 +41,12 @@ const unsigned char RADIX_DECIMAL = 10;
const unsigned char RADIX_HEX = 16;
// Digits used for utoa()
unsigned char[] DIGITS = "0123456789abcdef";
unsigned char DIGITS[] = "0123456789abcdef";
// Subtraction values used for decimal utoa()
unsigned int[] UTOA10_SUB = { 30000, 10000, 3000, 1000, 300, 100, 30, 10 };
unsigned int UTOA10_SUB[] = { 30000, 10000, 3000, 1000, 300, 100, 30, 10 };
// Digit addition values used for decimal utoa()
unsigned char[] UTOA10_VAL = { 3, 1, 3, 1, 3, 1, 3, 1 };
unsigned char UTOA10_VAL[] = { 3, 1, 3, 1, 3, 1, 3, 1 };
// Decimal utoa() without using multiply or divide
void utoa10w(unsigned int value, unsigned char* dst) {

View File

@ -1,6 +1,6 @@
import "print.kc"
byte[] txt = "camelot";
byte txt[] = "camelot";
void main() {
print_cls();

View File

@ -1,7 +1,7 @@
// Demonstrates initializing an object using = { ... } syntax
// Array of chars
unsigned char[] chars = { 1, 2, 3 };
unsigned char chars[] = { 1, 2, 3 };
void main() {
const char* SCREEN = 0x0400;

View File

@ -1,7 +1,7 @@
// Demonstrates initializing an object using = { ... } syntax
// Array of words
unsigned int[] words = { 1, 2, 3 };
unsigned int words[] = { 1, 2, 3 };
void main() {
const char* SCREEN = 0x0400;

View File

@ -6,7 +6,7 @@ struct Point {
char y;
};
struct Point[] points = {
struct Point points[] = {
{ 1, 2 },
{ 3, 4 },
{ 5, 6 }

View File

@ -6,7 +6,7 @@ struct Point {
int y;
};
struct Point[] points = {
struct Point points[] = {
{ 1, 2 },
{ 3, 4 },
{ 5, 6 }

View File

@ -1,7 +1,7 @@
// Illustrates how inline assembler use internal labels and external references
const byte* SCREEN = $400;
byte[] table = "cml!"z;
byte table[] = "cml!"z;
void main() {
asm {
ldx #0

View File

@ -1,7 +1,7 @@
// Illustrates how inline assembler can reference data from the outside program without the data being optimized away as unused
const byte* SCREEN = $400;
byte[] table = "cml!"z;
byte table[] = "cml!"z;
void main() {
asm {
ldx #0

View File

@ -1,6 +1,6 @@
// Illustrates how inline assembler can reference data from the outside program
byte[] table = "cml!"z;
byte table[] = "cml!"z;
void main() {
const byte* SCREEN = $400;

View File

@ -1,6 +1,6 @@
// Illustrates how inline kickassembler can reference data from the outside program
byte[] table = "cml!"z;
byte table[] = "cml!"z;
void main() {
const byte* SCREEN = $400;

View File

@ -2,7 +2,7 @@
// The result should be an labelled .text in the ASM
// Erroneously tries to inline the string completely leading to a CompileError
void main() {
const byte[] STRING = "camelot"z;
const byte STRING[] = "camelot"z;
const byte* PTR = $9ffe;
*PTR = <STRING;
*(PTR+1)= >STRING;

View File

@ -1,7 +1,7 @@
// Test casting the address of an inline string to a dword.
void main() {
const char[] msg = "camelot";
const char msg[] = "camelot";
unsigned long dw = (unsigned long)msg;
output(dw);
}

View File

@ -1,8 +1,8 @@
// Inline Strings in method calls are automatically converted to local constant variables byte[] st = "..."; - generating an ASM .text).
// Inline Strings in method calls are automatically converted to local constant variables byte st[] = "..."; - generating an ASM .text).
byte[] msg1 = "message 1 ";
byte msg1[] = "message 1 ";
void main() {
byte[] msg2 = "message 2 ";
byte msg2[] = "message 2 ";
print(msg1);
print(msg2);
print("message 3 ");

View File

@ -1,7 +1,7 @@
const byte* SCREEN = $400;
void main() {
byte[] his = { >SCREEN, >SCREEN+$100, >SCREEN+$200 }; // constant array
byte his[] = { >SCREEN, >SCREEN+$100, >SCREEN+$200 }; // constant array
for( byte h: 0..2) {
for (byte l: 4..7) {
word w = { his[h], l }; // inline word

View File

@ -4,8 +4,8 @@
byte* SCREEN = $0400;
byte* SCREEN2 = $0400+$28;
void main() {
byte[] txt = "qwe"z;
byte[] data = { 1, 2, 3 };
byte txt[] = "qwe"z;
byte data[] = { 1, 2, 3 };
for( byte i : 0..3) {
SCREEN[i] = txt[i];
SCREEN2[i] = data[i];

View File

@ -3,7 +3,7 @@ const byte RED = 2;
const byte GREEN = 5;
void main() {
byte[] colseq = { WHITE, RED, GREEN };
byte colseq[] = { WHITE, RED, GREEN };
byte* screen = $0400;
byte* cols = $d800;
byte j = 0;

View File

@ -1,6 +1,6 @@
byte* SCREEN = $0400;
byte[] TXT = { 3, 1, 13, 5, 12, 15, 20, 32};
byte TXT[] = { 3, 1, 13, 5, 12, 15, 20, 32};
void main() {
byte j = 0;

View File

@ -1,6 +1,6 @@
byte* SCREEN = $0400;
byte[] TEXT = "camelot "z;
byte TEXT[] = "camelot "z;
void main() {
byte* cursor = SCREEN;

View File

@ -1,6 +1,6 @@
// Inner increment is not being done properly (screen++)
const word[0x100] CHAR_COUNTS;
const word CHAR_COUNTS[0x100];
void main() {
// Count the number of the different chars on the screen

View File

@ -23,8 +23,8 @@ const byte *VIC_BASE = $D000;
const byte VIC_SIZE = 48;
const byte IRQ_CHANGE_NEXT = $7f;
byte[] IRQ_CHANGE_IDX = { $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT };
byte[] IRQ_CHANGE_VAL = { $0b, $0b, $63, $00, $00, $80, $07, $07, $83, $00, $00, $60 };
byte IRQ_CHANGE_IDX[] = { $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT };
byte IRQ_CHANGE_VAL[] = { $0b, $0b, $63, $00, $00, $80, $07, $07, $83, $00, $00, $60 };
volatile byte irq_idx = 0;

View File

@ -1,5 +1,5 @@
void main() {
byte[16] buf = $1100;
byte buf[16] = $1100;
byte i = 5;
do {
buf[i] = 2+i+2;

View File

@ -1,6 +1,6 @@
#pragma reserve(0x16)
#pragma encoding(petscii_mixed)
char[] strTemp = "v=X";
char strTemp[] = "v=X";
int main(void){
strTemp[2] = 'e';
strTemp[3] = 0;

View File

@ -11,23 +11,23 @@ const byte SIZE = 4;
const byte DELAY = 8;
// The coordinates of the lines to animate
word[SIZE] x_start = { 10, 20, 30, 30 };
byte[SIZE] y_start = { 10, 10, 10, 20 };
word[SIZE] x_end = { 20, 10, 20, 20 };
byte[SIZE] y_end = { 20, 20, 10, 20 };
word x_start[SIZE] = { 10, 20, 30, 30 };
byte y_start[SIZE] = { 10, 10, 10, 20 };
word x_end[SIZE] = { 20, 10, 20, 20 };
byte y_end[SIZE] = { 20, 20, 10, 20 };
// Current x position fixed point [12.4]
word[SIZE] x_cur;
word x_cur[SIZE];
// Current y position fixed point [12.4]
word[SIZE] y_cur;
word y_cur[SIZE];
// X position addition per frame s[3.4]
signed byte[SIZE] x_add;
signed byte x_add[SIZE];
// Y position addition per frame s[3.4]
signed byte[SIZE] y_add;
signed byte y_add[SIZE];
// Frame delay (counted down to 0)
byte[SIZE] delay;
byte delay[SIZE];
// Frame number (counted down to 0)
byte[SIZE] frame;
byte frame[SIZE];
void main() {
// Disable normal interrupt
@ -94,9 +94,9 @@ void screen_fill(byte* screen, byte ch) {
}
// Tables for the plotter - initialized by calling bitmap_init();
const byte[256] bitmap_plot_ylo;
const byte[256] bitmap_plot_yhi;
const byte[256] bitmap_plot_bit;
const byte bitmap_plot_ylo[256];
const byte bitmap_plot_yhi[256];
const byte bitmap_plot_bit[256];
void bitmap_init(byte* bitmap) {
byte bits = $80;

View File

@ -4,11 +4,11 @@ import "division.kc"
import "print.kc"
void main() {
word[20] lintab1;
word lintab1[20];
lin16u_gen(557, 29793, lintab1, 20);
word[20] lintab2;
word lintab2[20];
lin16u_gen(31179, 63361, lintab2, 20);
word[20] lintab3;
word lintab3[20];
lin16u_gen(0, $6488, lintab3, 20);
print_cls();
print_str(" ");

View File

@ -2,8 +2,8 @@
const byte* SCREEN = $400;
byte[] msgz = "cml"z;
byte[] msg = "cml";
byte msgz[] = "cml"z;
byte msg[] = "cml";
void main() {
for( byte i:0..3) {

View File

@ -2,8 +2,8 @@ byte* SCREEN = $0400;
byte ch = 'a';
byte num = 1;
byte[] str = "bc" "d" "e";
byte[] nums = { 2, 3, 4, 5};
byte str[] = "bc" "d" "e";
byte nums[] = { 2, 3, 4, 5};
void main() {
SCREEN[0] = ch;

View File

@ -19,7 +19,7 @@ void outsw(signed int sw) {
outw((unsigned int)sw);
}
char[] HEXTAB = "0123456789abcdef";
char HEXTAB[] = "0123456789abcdef";
void outw(unsigned int w) {
out(HEXTAB[(>w)<<4]);

View File

@ -2,7 +2,7 @@
// out::c should be a hardware register, main::i should be a hardware register, global idx should be a hardware register
byte[] msg = "hello world!";
byte msg[] = "hello world!";
const char* SCREEN = 0x0400;
char idx = 0;

View File

@ -1,7 +1,7 @@
// Local constant strings are placed at the start of the method. This means the generated ASM jumps / calls straignt into the constant string
void main() {
byte* screen = $0400;
byte[] msg = "message 2 ";
byte msg[] = "message 2 ";
byte i=0;
while(msg[i]) {
screen[i++] = msg[i];

View File

@ -2,7 +2,7 @@
// Prints a message ending at NUL skipping all spaces
void main() {
byte* screen = $400;
byte[] str = "hello brave new world";
byte str[] = "hello brave new world";
for( byte i: 0..255) {
if(str[i]==0) break;
if(str[i]==' ') continue;

View File

@ -2,7 +2,7 @@
const char* SCREEN = $400;
const char[] MESSAGE = "hello brave new world!";
const char MESSAGE[] = "hello brave new world!";
void main() {
char idx = 0;

View File

@ -1,6 +1,6 @@
// Test a for-loop with an empty body
const char[] str = "Hello!";
const char str[] = "Hello!";
const char* SCREEN = 0x0400;
void main() {

View File

@ -3,7 +3,7 @@
// Caused by constant loop head unroll
int[8] ball_y = { 50, 100, -200, 12, -100, 75, 0, -121 } ;
int ball_y[8] = { 50, 100, -200, 12, -100, 75, 0, -121 } ;
void main() {
const char* screen = 0x0400;

View File

@ -19,7 +19,7 @@ void main() {
}
}
const char[0x100] align(0x100) SINTABLE = kickasm {{
const char align(0x100) SINTABLE[0x100] = kickasm {{
.for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(2*PI*i/256))
}};

View File

@ -1,9 +1,9 @@
// Test that memory alignment of arrays work
byte[$100] align($100) bs;
byte align($100) bs[$100];
void main() {
byte[$100] align($100) cs;
byte align($100) cs[$100];
for( byte i: 0..255) {
bs[i] = i;
}

View File

@ -1,6 +1,6 @@
// Array declaration & allocation (allocated in same memory space as the program)
byte[8*8] idtab = $1100;
byte idtab[8*8] = $1100;
// Array assignment
idtab[0] = 12;

View File

@ -3,7 +3,7 @@
import "string"
const char* SCREEN = 0x0400;
const char[] CAMELOT = "camelot";
const char CAMELOT[] = "camelot";
void main() {
// Working memory copy of string

View File

@ -1,4 +1,4 @@
byte[256] tab = $1100;
byte tab[256] = $1100;
byte* ptr = tab;
byte i=0;
do {

View File

@ -5,7 +5,7 @@ struct node {
unsigned int value;
};
struct node [4000] heap;
struct node heap[4000];
unsigned int free_;
struct node* root;

View File

@ -7,7 +7,7 @@ const char* CHARSET = 0xE800;
const char PAGE1 = ((((unsigned int)SCREEN1) >> 6) & 0xF0) | (((unsigned int)CHARSET >> 10) & 0x0E);
const char PAGE2 = ((((unsigned int)SCREEN2) >> 6) & 0xF0) | (((unsigned int)CHARSET >> 10) & 0x0E);
const char [0x100] align($100) sinustable = {
const char align($100) sinustable[0x100] = {
0x80, 0x7d, 0x7a, 0x77, 0x74, 0x70, 0x6d, 0x6a,
0x67, 0x64, 0x61, 0x5e, 0x5b, 0x58, 0x55, 0x52,
0x4f, 0x4d, 0x4a, 0x47, 0x44, 0x41, 0x3f, 0x3c,
@ -43,8 +43,8 @@ const char [0x100] align($100) sinustable = {
};
char[40] xbuf;
char[25] ybuf;
char xbuf[40];
char ybuf[25];
void doplasma (char* scrn)
{
@ -83,7 +83,7 @@ void doplasma (char* scrn)
}
const char[] bittab = {
const char bittab[] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
};

Some files were not shown because too many files have changed in this diff Show More