1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-10-21 02:24:34 +00:00

Fixed a few errors introduced by condition simplification rewrite. Added a fragment.

This commit is contained in:
jespergravgaard 2020-02-25 09:26:05 +01:00
parent 5fd74a8d39
commit e9eeafd170
7 changed files with 19 additions and 9 deletions

View File

@ -0,0 +1,4 @@
lda #<{c1}
sta {m1}
lda #>{c1}
sta {m1}+1

View File

@ -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<LabelRef> 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);
}

View File

@ -212,6 +212,9 @@ public class VariableReferenceInfos {
*/
public Collection<VariableRef> getDefinedVars(Statement stmt) {
Collection<ReferenceToSymbolVar> 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)

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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