1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00

Working on catching all declared constants in parse 0.

This commit is contained in:
jespergravgaard 2019-11-17 01:28:20 +01:00
parent 9403fe34c8
commit 0e1acd35d2
5 changed files with 13 additions and 11 deletions

View File

@ -85,8 +85,7 @@ public class SymbolTypeStruct implements SymbolType {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
SymbolTypeStruct that = (SymbolTypeStruct) o;
return sizeBytes == that.sizeBytes &&
Objects.equals(name, that.name);
return Objects.equals(name, that.name);
}
@Override

View File

@ -2020,6 +2020,9 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
return new ConstantInteger(-((ConstantInteger) child).getInteger(), ((ConstantInteger) child).getType());
} else if(operator.equals(Operators.ADDRESS_OF) && child instanceof SymbolRef) {
return new ConstantSymbolPointer((SymbolRef) child);
} else if(operator.equals(Operators.ADDRESS_OF) && child instanceof PointerDereferenceIndexed && ((PointerDereferenceIndexed) child).getPointer() instanceof ConstantValue && ((PointerDereferenceIndexed) child).getIndex() instanceof ConstantValue) {
PointerDereferenceIndexed pointerDeref = (PointerDereferenceIndexed) child;
return new ConstantBinary((ConstantValue) pointerDeref.getPointer(), Operators.PLUS, (ConstantValue)pointerDeref.getIndex());
} else if(child instanceof ConstantValue) {
return new ConstantUnary((OperatorUnary) operator, (ConstantValue) child);
} else {

View File

@ -15,9 +15,9 @@ const char[0x200] align(0x100) SINTABLE = kickasm {{
}};
// Screen containing distance to center
const byte* SCREEN_DIST = malloc(1000);
byte* SCREEN_DIST = malloc(1000);
// Screen containing angle to center
const byte* SCREEN_ANGLE = malloc(1000);
byte* SCREEN_ANGLE = malloc(1000);
// Plasma charset
const char* CHARSET = 0x2000;
// Plasma screen 1

View File

@ -7,9 +7,9 @@ import "sqr"
import "atan2"
// Screen containing distance to center
const byte* SCREEN_DIST = malloc(1000);
byte* SCREEN_DIST = malloc(1000);
// Screen containing angle to center
const byte* SCREEN_ANGLE= malloc(1000);
byte* SCREEN_ANGLE= malloc(1000);
// Screen containing angle to center
const byte* SCREEN_FILL = 0x0400;
@ -70,15 +70,15 @@ void main() {
const byte NUM_BUCKETS = 0x30;
// Array containing the bucket size for each of the distance buckets
const byte* BUCKET_SIZES = malloc(NUM_BUCKETS*sizeof(byte));
byte* BUCKET_SIZES = malloc(NUM_BUCKETS*sizeof(byte));
// Buckets containing screen indices for each distance from the center.
// BUCKETS[dist] is an array of words containing screen indices.
// The size of the array BUCKETS[dist] is BUCKET_SIZES[dist]
const word** BUCKETS = malloc(NUM_BUCKETS*sizeof(word*));
word** BUCKETS = malloc(NUM_BUCKETS*sizeof(word*));
// Current index into each bucket. Used while populating the buckets. (After population the end the values will be equal to the bucket sizes)
const byte* BUCKET_IDX = malloc(NUM_BUCKETS*sizeof(byte));
byte* BUCKET_IDX = malloc(NUM_BUCKETS*sizeof(byte));
// Initialize buckets containing indices of chars on the screen with specific distances to the center.
void init_buckets(byte* screen) {

View File

@ -6,9 +6,9 @@ import "atan2"
// Screen containing distance to center
const byte* SCREEN_DIST = malloc(1000);
byte* SCREEN_DIST = malloc(1000);
// Screen containing angle to center
const byte* SCREEN_ANGLE = malloc(1000);
byte* SCREEN_ANGLE = malloc(1000);
// Screen containing angle to center
const byte* SCREEN_FILL = 0x0400;