mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-27 16:30:14 +00:00
Fixed scope comparison.
This commit is contained in:
parent
3d4d114522
commit
e09a0718d0
@ -448,7 +448,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
|
||||
return statementKickAsm;
|
||||
}
|
||||
|
||||
/** Inline KickAssembler code. */
|
||||
/** Inline KickAssembler (can be either inline code or inline data initialization). */
|
||||
static class KickAsm {
|
||||
/** KickAssembler code. */
|
||||
private final String kickAsmCode;
|
||||
|
@ -1,14 +1,9 @@
|
||||
package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.model.CompileError;
|
||||
import dk.camelot64.kickc.model.ControlFlowBlock;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.statements.StatementLValue;
|
||||
import dk.camelot64.kickc.model.symbols.Variable;
|
||||
import dk.camelot64.kickc.model.values.ScopeRef;
|
||||
import dk.camelot64.kickc.model.values.SymbolRef;
|
||||
import dk.camelot64.kickc.model.values.VariableRef;
|
||||
|
||||
/**
|
||||
* Checks that no local variables with arrays and hard-coded addresses exist
|
||||
@ -22,7 +17,7 @@ public class Pass1AssertNoLocalAddressArray extends Pass1Base {
|
||||
@Override
|
||||
public boolean step() {
|
||||
for(Variable variable : getScope().getAllVars(true)) {
|
||||
if(!ScopeRef.ROOT.equals(variable.getScope()) && variable.isArray() && variable.getMemoryAddress()!=null)
|
||||
if(!ScopeRef.ROOT.equals(variable.getScope().getRef()) && variable.isArray() && variable.getMemoryAddress()!=null)
|
||||
throw new CompileError("Error! Local array variables with __address() not allowed. "+variable.toString(getProgram()));
|
||||
}
|
||||
return false;
|
||||
|
@ -7,13 +7,13 @@ __address(0x0c00) byte SPRITE[] = kickasm(resource "balloon.png") {{
|
||||
.byte pic.getSinglecolorByte(x,y)
|
||||
}};
|
||||
|
||||
byte* const SCREEN= $400;
|
||||
byte* const SPRITES_ENABLE = $d015;
|
||||
byte* const SPRITES_XPOS = $d000;
|
||||
byte* const SPRITES_YPOS = $d001;
|
||||
char* const SCREEN= 0x400;
|
||||
char* const SPRITES_ENABLE = 0xd015;
|
||||
char* const SPRITES_XPOS = 0xd000;
|
||||
char* const SPRITES_YPOS = 0xd001;
|
||||
|
||||
void main() {
|
||||
*(SCREEN+$3f8) = (byte)((word)SPRITE/$40);
|
||||
*(SCREEN+0x3f8) = (char)((unsigned int)SPRITE/$40);
|
||||
*SPRITES_ENABLE = 1;
|
||||
*SPRITES_XPOS = 100;
|
||||
*SPRITES_YPOS = 100;
|
||||
|
@ -2,15 +2,13 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.label SPRITE = $c00
|
||||
.label SCREEN = $400
|
||||
.label SPRITES_ENABLE = $d015
|
||||
.label SPRITES_XPOS = $d000
|
||||
.label SPRITES_YPOS = $d001
|
||||
// kickasm
|
||||
main: {
|
||||
// *(SCREEN+$3f8) = (byte)((word)SPRITE/$40)
|
||||
lda #SPRITE/$40
|
||||
// *(SCREEN+0x3f8) = (char)((unsigned int)SPRITE/$40)
|
||||
lda #$ff&SPRITE/$40
|
||||
sta SCREEN+$3f8
|
||||
// *SPRITES_ENABLE = 1
|
||||
lda #1
|
||||
@ -23,8 +21,9 @@ main: {
|
||||
// }
|
||||
rts
|
||||
}
|
||||
.pc = SPRITE "SPRITE"
|
||||
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
|
||||
.pc = $c00 "SPRITE"
|
||||
SPRITE:
|
||||
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
|
||||
.for (var y=0; y<21; y++)
|
||||
.for (var x=0;x<3; x++)
|
||||
.byte pic.getSinglecolorByte(x,y)
|
||||
|
Loading…
x
Reference in New Issue
Block a user