diff --git a/src/main/fragment/mos6502-common/pdum1=vwuc1.asm b/src/main/fragment/mos6502-common/pdum1=vwuc1.asm new file mode 100644 index 000000000..7fa49e4f7 --- /dev/null +++ b/src/main/fragment/mos6502-common/pdum1=vwuc1.asm @@ -0,0 +1,4 @@ +lda #<{c1} +sta {m1} +lda #>{c1} +sta {m1}+1 diff --git a/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java b/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java index 5e60388ae..f9d642720 100644 --- a/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java +++ b/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java @@ -6,6 +6,7 @@ import dk.camelot64.kickc.model.statements.StatementPhiBlock; import dk.camelot64.kickc.model.symbols.Label; import dk.camelot64.kickc.model.symbols.Procedure; import dk.camelot64.kickc.model.values.LabelRef; +import dk.camelot64.kickc.model.values.ProcedureRef; import dk.camelot64.kickc.model.values.ScopeRef; import dk.camelot64.kickc.model.values.SymbolRef; import dk.camelot64.kickc.passes.Pass2ConstantIdentification; @@ -279,6 +280,8 @@ public class ControlFlowGraph implements Serializable { // Recurse to successor blocks final Collection successors = block.getSuccessors(); for(LabelRef successor : successors) { + if(successor.getFullName().equals(ProcedureRef.PROCEXIT_BLOCK_NAME)) + continue; final ControlFlowBlock successorBlock = getBlock(successor); populateStatementsBetween(from, to, true, between, successorBlock); } diff --git a/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java b/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java index 8774450b0..505a3b9bf 100644 --- a/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java +++ b/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java @@ -212,6 +212,9 @@ public class VariableReferenceInfos { */ public Collection getDefinedVars(Statement stmt) { Collection referenceToSymbolVars = statementVarReferences.get(stmt.getIndex()); + // TODO: This may cause problems since it is a sign that the maps are out of date! + if(referenceToSymbolVars==null) + return new ArrayList<>(); return referenceToSymbolVars .stream() .filter(referenceToSymbolVar -> referenceToSymbolVar.getReferenced() instanceof VariableRef) diff --git a/src/test/kc/complex/tetris/tetris-data.kc b/src/test/kc/complex/tetris/tetris-data.kc index 02df67f2e..0d2d64e9c 100644 --- a/src/test/kc/complex/tetris/tetris-data.kc +++ b/src/test/kc/complex/tetris/tetris-data.kc @@ -10,7 +10,7 @@ const char* PLAYFIELD_SPRITE_PTRS_1 = (PLAYFIELD_SCREEN_1+SPRITE_PTRS); // Screen Sprite pointers on screen 2 const char* PLAYFIELD_SPRITE_PTRS_2 = (PLAYFIELD_SCREEN_2+SPRITE_PTRS); // Address of the sprites covering the playfield -const char* PLAYFIELD_SPRITES = 0x2000; +const char* PLAYFIELD_SPRITES = 0x3000; // Address of the charset const char* PLAYFIELD_CHARSET = 0x2800; diff --git a/src/test/ref/complex/tetris/tetris.asm b/src/test/ref/complex/tetris/tetris.asm index aca025881..3ea47ec7c 100644 --- a/src/test/ref/complex/tetris/tetris.asm +++ b/src/test/ref/complex/tetris/tetris.asm @@ -91,7 +91,7 @@ // Screen Sprite pointers on screen 2 .label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS // Address of the sprites covering the playfield - .label PLAYFIELD_SPRITES = $2000 + .label PLAYFIELD_SPRITES = $3000 // Address of the charset .label PLAYFIELD_CHARSET = $2800 // The size of the playfield diff --git a/src/test/ref/complex/tetris/tetris.log b/src/test/ref/complex/tetris/tetris.log index 626f811dd..fc2b4b517 100644 --- a/src/test/ref/complex/tetris/tetris.log +++ b/src/test/ref/complex/tetris/tetris.log @@ -3458,7 +3458,7 @@ SYMBOL TABLE SSA // <<6 to move extended colors to the upper 2 bits .fill screen.getSize(), ( (screen.get(i)+1) | (extended.get(i)-1)<<6 ) }} -(const byte*) PLAYFIELD_SPRITES = (byte*)(number) $2000 +(const byte*) PLAYFIELD_SPRITES = (byte*)(number) $3000 (const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS (const byte*) PROCPORT = (byte*)(number) 1 @@ -6512,7 +6512,7 @@ Simplifying constant pointer cast (byte*) 54290 Simplifying constant pointer cast (byte*) 54299 Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 11264 -Simplifying constant pointer cast (byte*) 8192 +Simplifying constant pointer cast (byte*) 12288 Simplifying constant pointer cast (byte*) 10240 Simplifying constant integer cast $13 Simplifying constant integer cast 1 @@ -11710,7 +11710,7 @@ Target platform is c64basic / MOS6502X // Screen Sprite pointers on screen 2 .label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS // Address of the sprites covering the playfield - .label PLAYFIELD_SPRITES = $2000 + .label PLAYFIELD_SPRITES = $3000 // Address of the charset .label PLAYFIELD_CHARSET = $2800 // The size of the playfield @@ -16861,7 +16861,7 @@ ASSEMBLER BEFORE OPTIMIZATION // Screen Sprite pointers on screen 2 .label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS // Address of the sprites covering the playfield - .label PLAYFIELD_SPRITES = $2000 + .label PLAYFIELD_SPRITES = $3000 // Address of the charset .label PLAYFIELD_CHARSET = $2800 // The size of the playfield @@ -21039,7 +21039,7 @@ FINAL SYMBOL TABLE // <<6 to move extended colors to the upper 2 bits .fill screen.getSize(), ( (screen.get(i)+1) | (extended.get(i)-1)<<6 ) }} -(const byte*) PLAYFIELD_SPRITES = (byte*) 8192 +(const byte*) PLAYFIELD_SPRITES = (byte*) 12288 (const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS (const byte*) PROCPORT = (byte*) 1 @@ -22117,7 +22117,7 @@ Score: 3348735 // Screen Sprite pointers on screen 2 .label PLAYFIELD_SPRITE_PTRS_2 = PLAYFIELD_SCREEN_2+SPRITE_PTRS // Address of the sprites covering the playfield - .label PLAYFIELD_SPRITES = $2000 + .label PLAYFIELD_SPRITES = $3000 // Address of the charset .label PLAYFIELD_CHARSET = $2800 // The size of the playfield diff --git a/src/test/ref/complex/tetris/tetris.sym b/src/test/ref/complex/tetris/tetris.sym index b5deeb9c5..46820bc2a 100644 --- a/src/test/ref/complex/tetris/tetris.sym +++ b/src/test/ref/complex/tetris/tetris.sym @@ -79,7 +79,7 @@ // <<6 to move extended colors to the upper 2 bits .fill screen.getSize(), ( (screen.get(i)+1) | (extended.get(i)-1)<<6 ) }} -(const byte*) PLAYFIELD_SPRITES = (byte*) 8192 +(const byte*) PLAYFIELD_SPRITES = (byte*) 12288 (const byte*) PLAYFIELD_SPRITE_PTRS_1 = (const byte*) PLAYFIELD_SCREEN_1+(const word) SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS_2 = (const byte*) PLAYFIELD_SCREEN_2+(const word) SPRITE_PTRS (const byte*) PROCPORT = (byte*) 1