mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-27 04:49:27 +00:00
Minor stuff.
This commit is contained in:
parent
c4d24caa72
commit
440da0eaee
@ -58,7 +58,7 @@ public class TestPrograms {
|
|||||||
compileAndCompare("textbox");
|
compileAndCompare("textbox");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Implemente & / address-of for struct values
|
/* TODO: Implement address-of (&) for struct values
|
||||||
@Test
|
@Test
|
||||||
public void testStructPtr12Ref() throws IOException, URISyntaxException {
|
public void testStructPtr12Ref() throws IOException, URISyntaxException {
|
||||||
compileAndCompare("struct-ptr-12-ref", log());
|
compileAndCompare("struct-ptr-12-ref", log());
|
||||||
@ -117,12 +117,12 @@ public class TestPrograms {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStructPtr2() throws IOException, URISyntaxException {
|
public void testStructPtr2() throws IOException, URISyntaxException {
|
||||||
compileAndCompare("struct-ptr-2", log());
|
compileAndCompare("struct-ptr-2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStructPtr1() throws IOException, URISyntaxException {
|
public void testStructPtr1() throws IOException, URISyntaxException {
|
||||||
compileAndCompare("struct-ptr-1", log());
|
compileAndCompare("struct-ptr-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -24,16 +24,16 @@ const word NOT_FOUND = 0xffff;
|
|||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
// Init processing array
|
// Init processing array
|
||||||
for( byte i: 0..7 ) PROCESSING[i] = { 0, 0, NOT_FOUND };
|
for( byte i: 0..NUM_PROCESSING-1 ) PROCESSING[i] = { 0, 0, NOT_FOUND };
|
||||||
|
|
||||||
// Set-up raster interrupts
|
// Set-up raster interrupts
|
||||||
setupRasterIrq(RASTER_IRQ_TOP, &irqTop);
|
setupRasterIrq(RASTER_IRQ_TOP, &irqTop);
|
||||||
|
|
||||||
// Fill screen with some chars
|
// Fill screen with some chars
|
||||||
for( byte* sc: SCREEN..SCREEN+999) *sc = 'a'+(<sc&0x1f);
|
//for( byte* sc: SCREEN..SCREEN+999) *sc = 'a'+(<sc&0x1f);
|
||||||
|
|
||||||
// Copy screen to screen copy
|
// Copy screen to screen copy
|
||||||
for( byte* src=SCREEN, dst=SCREEN_COPY; src!=SCREEN+999; src++, dst++) *dst = *src;
|
for( byte* src=SCREEN, dst=SCREEN_COPY; src!=SCREEN+1000; src++, dst++) *dst = *src;
|
||||||
|
|
||||||
// Init squares table
|
// Init squares table
|
||||||
initSquareTables();
|
initSquareTables();
|
||||||
@ -41,7 +41,7 @@ void main() {
|
|||||||
// Main loop
|
// Main loop
|
||||||
do {
|
do {
|
||||||
// Look for the non-space closest to the screen center
|
// Look for the non-space closest to the screen center
|
||||||
struct ProcessingChar center = getCenterChar();
|
struct ProcessingChar center = getCharToProcess();
|
||||||
if(center.dist==NOT_FOUND)
|
if(center.dist==NOT_FOUND)
|
||||||
break;
|
break;
|
||||||
startProcessing(center);
|
startProcessing(center);
|
||||||
@ -52,15 +52,16 @@ void main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const byte NUM_PROCESSING = 16;
|
||||||
// Chars currently being processed in the interrupt
|
// Chars currently being processed in the interrupt
|
||||||
struct ProcessingChar[8] PROCESSING;
|
struct ProcessingChar[NUM_PROCESSING] PROCESSING;
|
||||||
|
|
||||||
// Start processing a char - by inserting it into the PROCESSING array
|
// Start processing a char - by inserting it into the PROCESSING array
|
||||||
void startProcessing(struct ProcessingChar center) {
|
void startProcessing(struct ProcessingChar center) {
|
||||||
// Busy-wait while finding an empty slot in the PROCESSING array
|
// Busy-wait while finding an empty slot in the PROCESSING array
|
||||||
byte freeIdx = 0xff;
|
byte freeIdx = 0xff;
|
||||||
do {
|
do {
|
||||||
for( byte i: 0..7 ) {
|
for( byte i: 0..NUM_PROCESSING-1 ) {
|
||||||
if(PROCESSING[i].dist==NOT_FOUND) {
|
if(PROCESSING[i].dist==NOT_FOUND) {
|
||||||
freeIdx = i;
|
freeIdx = i;
|
||||||
break;
|
break;
|
||||||
@ -74,7 +75,7 @@ void startProcessing(struct ProcessingChar center) {
|
|||||||
|
|
||||||
// Process any chars in the PROCESSING array
|
// Process any chars in the PROCESSING array
|
||||||
void processChars() {
|
void processChars() {
|
||||||
for( byte i: 0..7 ) {
|
for( byte i: 0..NUM_PROCESSING-1 ) {
|
||||||
if(PROCESSING[i].dist!=NOT_FOUND) {
|
if(PROCESSING[i].dist!=NOT_FOUND) {
|
||||||
struct ProcessingChar processing = PROCESSING[i];
|
struct ProcessingChar processing = PROCESSING[i];
|
||||||
*(COLS+(word)processing.y*40+processing.x) = WHITE;
|
*(COLS+(word)processing.y*40+processing.x) = WHITE;
|
||||||
@ -108,7 +109,7 @@ void initSquareTables() {
|
|||||||
|
|
||||||
// Find the non-space char closest to the center of the screen
|
// Find the non-space char closest to the center of the screen
|
||||||
// If no non-space char is found the distance will be 0xffff
|
// If no non-space char is found the distance will be 0xffff
|
||||||
struct ProcessingChar getCenterChar() {
|
struct ProcessingChar getCharToProcess() {
|
||||||
struct ProcessingChar closest = { 0, 0, NOT_FOUND };
|
struct ProcessingChar closest = { 0, 0, NOT_FOUND };
|
||||||
byte* screen_line = SCREEN_COPY;
|
byte* screen_line = SCREEN_COPY;
|
||||||
for( byte y: 0..24) {
|
for( byte y: 0..24) {
|
||||||
|
Loading…
Reference in New Issue
Block a user