1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-07-03 20:29:34 +00:00

Implemented file-level comments. Added a few comment tests.

This commit is contained in:
jespergravgaard 2019-02-17 11:03:55 +01:00
parent 69562b7fa9
commit 27cfaf0ecf
326 changed files with 64790 additions and 63001 deletions

View File

@ -9,6 +9,11 @@ public class Comment {
private String comment;
/** The index of the hidden parser token containing the comment.
* Used to prevent comments from being included multiple times.
*/
private int tokenIndex;
public Comment(String comment) {
this.comment = comment;
}
@ -17,4 +22,11 @@ public class Comment {
return comment;
}
public int getTokenIndex() {
return tokenIndex;
}
public void setTokenIndex(int tokenIndex) {
this.tokenIndex = tokenIndex;
}
}

View File

@ -28,6 +28,8 @@ public class Program {
private AsmProgram asm;
/** Resource files that should be copied to the output folder to be compiled with the generated ASM. */
private List<Path> asmResourceFiles;
/** Comments for the (main) file. */
private List<Comment> fileComments;
/** The log containing information about the compilation process. */
private CompileLog log;
@ -68,6 +70,14 @@ public class Program {
this.asmResourceFiles = new ArrayList<>();
}
public List<Comment> getFileComments() {
return fileComments;
}
public void setFileComments(List<Comment> fileComments) {
this.fileComments = fileComments;
}
public List<String> getImportPaths() {
return importPaths;
}

View File

@ -212,6 +212,8 @@ fragment NAME_START : [a-zA-Z_];
fragment NAME_CHAR : [a-zA-Z0-9_];
ASMREL: '!' NAME_CHAR* [+-]+ ;
WS : [ \t\r\n\u00a0]+ -> skip ;
COMMENT_LINE : '//' ~[\r\n]* -> channel(HIDDEN);
COMMENT_BLOCK : '/*' .*? '*/' -> channel(HIDDEN);
// Add white space to the hidden channel 1
WS : [ \t\r\n\u00a0]+ -> channel(1);
// Add comments to the hidden channel 2
COMMENT_LINE : '//' ~[\r\n]* -> channel(2);
COMMENT_BLOCK : '/*' .*? '*/' -> channel(2);

View File

@ -459,7 +459,7 @@ public class KickCLexer extends Lexer {
"\u0385\3\2\2\2\u0385\u0386\b_\3\2\u0386\u00be\3\2\2\2!\2\u02a7\u02af\u02ca"+
"\u02d0\u02d2\u02db\u02e8\u02ec\u02f1\u02f8\u02fd\u0304\u0309\u0310\u0317"+
"\u031c\u0323\u0328\u032f\u0335\u0337\u033c\u0343\u0348\u0354\u035f\u0365"+
"\u036a\u0374\u037f\4\b\2\2\2\3\2";
"\u036a\u0374\u037f\4\2\3\2\2\4\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {

View File

@ -22,6 +22,7 @@ import org.antlr.v4.runtime.tree.TerminalNode;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Stack;
import java.util.regex.Matcher;
@ -75,6 +76,10 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
@Override
public Void visitFile(KickCParser.FileContext ctx) {
if(program.getFileComments()==null) {
// Only set program file level comments for the first file.
program.setFileComments(getCommentsFile(ctx));
}
this.visit(ctx.importSeq());
this.visit(ctx.declSeq());
return null;
@ -114,7 +119,7 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
String name = ctx.NAME().getText();
Procedure procedure = getCurrentSymbols().addProcedure(name, type);
addDirectives(procedure, ctx.directive());
procedure.setComments(getComments(ctx));
procedure.setComments(getCommentsSymbol(ctx));
scopeStack.push(procedure);
Label procExit = procedure.addLabel(SymbolRef.PROCEXIT_BLOCK_NAME);
VariableUnversioned returnVar = null;
@ -144,26 +149,6 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
return null;
}
/**
* Find comments preceding the passed context
* @param ctx The parse context to examine
* @return The comments preceding the context
*/
private List<Comment> getComments(ParserRuleContext ctx) {
List<Comment> comments = new ArrayList<>();
List<Token> hiddenTokensToLeft = tokenStream.getHiddenTokensToLeft(ctx.start.getTokenIndex());
if(hiddenTokensToLeft!=null) {
for(Token hiddenToken : hiddenTokensToLeft) {
String text = hiddenToken.getText();
if(text.startsWith("//")) {
text = text.substring(2);
}
Comment comment = new Comment(text);
comments.add(comment);
}
}
return comments;
}
@Override
public List<Variable> visitParameterListDecl(KickCParser.ParameterListDeclContext ctx) {
@ -326,7 +311,7 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
}
if(lValue.isDeclaredConstant()) {
// Add comments to constant
lValue.setComments(getComments(ctx));
lValue.setComments(getCommentsSymbol(ctx));
}
KickCParser.ExprContext initializer = ctx.expr();
if(initializer != null) {
@ -929,6 +914,100 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
throw new CompileError("Error! Unhandled symbol " + symbol.toString(program));
}
/** The hidden lexer channel containing whitespace. */
private static final int CHANNEL_WHITESPACE = 1;
/** The hidden lexer channel containing comments. */
private static final int CHANNEL_COMMENTS = 2;
/**
* Find all comments preceding the passed context.
* Group the comments into blocks each time an empty line (double newline) is encountered
*
* @param ctx The parse context to examine
* @return The comment blocks preceding the context
*/
private List<List<Comment>> getCommentBlocks(ParserRuleContext ctx) {
List<List<Comment>> commentBlocks = new ArrayList<>();
List<Comment> comments = new ArrayList<>();
List<Token> hiddenTokens = tokenStream.getHiddenTokensToLeft(ctx.start.getTokenIndex());
if(hiddenTokens != null) {
for(Token hiddenToken : hiddenTokens) {
if(hiddenToken.getChannel() == CHANNEL_WHITESPACE) {
String text = hiddenToken.getText();
long newlineCount = text.chars().filter(ch -> ch == '\n').count();
if(newlineCount > 1 && comments.size()>0) {
// Create new comment block
commentBlocks.add(comments);
comments = new ArrayList<>();
}
} else if(hiddenToken.getChannel() == CHANNEL_COMMENTS) {
String text = hiddenToken.getText();
if(text.startsWith("//")) {
text = text.substring(2);
}
Comment comment = new Comment(text);
comment.setTokenIndex(hiddenToken.getTokenIndex());
comments.add( comment);
}
}
}
if(comments.size()>0) {
commentBlocks.add(comments);
}
return commentBlocks;
}
/** Set containing the token index of all comment blocks that have already been used. */
HashSet<Integer> usedCommentTokenIndices = new HashSet<>();
/**
* Ensures that the comments have not already been "used" in another context.
*
* @param candidate The comments to examine
* @return The comments if they are unused. An empty comment if they had already been used.
*/
private List<Comment> ensureUnusedComments(List<Comment> candidate) {
int tokenIndex = candidate.get(0).getTokenIndex();
if(usedCommentTokenIndices.contains(tokenIndex)) {
// Comment was already used - Return an empty list
return new ArrayList<>();
} else {
// Comment unused - Mark as used and return it
usedCommentTokenIndices.add(tokenIndex);
return candidate;
}
}
/**
* Find the first comments preceding the passed context (search from start until meeting a double newline).
* Only returns comments if they have not already been "used" by another call.
*
* @param ctx The parse context to examine
* @return The first comments preceding the context
*/
private List<Comment> getCommentsFile(ParserRuleContext ctx) {
List<List<Comment>> commentBlocks = getCommentBlocks(ctx);
if(commentBlocks.size()==0) {
return new ArrayList<>();
}
return ensureUnusedComments(commentBlocks.get(0));
}
/**
* Find comments immediately preceding the passed context (search from end until meeting a double newline)
* Only returns comments if they have not already been "used" by another call.
*
* @param ctx The parse context to examine
* @return The comments immediately preceding the context
*/
private List<Comment> getCommentsSymbol(ParserRuleContext ctx) {
List<List<Comment>> commentBlocks = getCommentBlocks(ctx);
if(commentBlocks.size()==0) {
return new ArrayList<>();
}
return ensureUnusedComments(commentBlocks.get(commentBlocks.size() - 1));
}
/** A declaration directive. */
private interface Directive {
}

View File

@ -45,6 +45,10 @@ public class Pass4CodeGeneration {
AsmProgram asm = new AsmProgram();
ScopeRef currentScope = ScopeRef.ROOT;
// Add file level comments
asm.startSegment(currentScope, null, "File Comments");
addComments(asm, program.getFileComments());
asm.startSegment(currentScope, null, "Basic Upstart");
asm.addLine(new AsmSetPc("Basic", AsmFormat.getAsmNumber(0x0801)));
asm.addLine(new AsmBasicUpstart("bbegin"));

View File

@ -44,6 +44,16 @@ public class TestPrograms {
AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false);
}
@Test
public void testCommentsSingle() throws IOException, URISyntaxException {
compileAndCompare("test-comments-single");
}
@Test
public void testCommentsUsage() throws IOException, URISyntaxException {
compileAndCompare("test-comments-usage");
}
@Test
public void testBgBlack() throws IOException, URISyntaxException {
compileAndCompare("bgblack");
@ -163,7 +173,7 @@ public class TestPrograms {
@Test
public void testFastMultiply8() throws IOException, URISyntaxException {
compileAndCompare("examples/fastmultiply/fastmultiply8.kc");
compileAndCompare("examples/fastmultiply/fastmultiply8");
}
@Test

View File

@ -0,0 +1,30 @@
// Tests that single-line comments are compiled correctly
// Has a bunch of comments that will be moved into the generated ASM
// The C64 screen
const byte* SCREEN = $400;
// One of the bytes used for addition
byte a = 'a';
// The program entry point
void main() {
byte i = 0;
// Do some sums
for(byte b: 0..10 ) {
// Output the result on the screen
SCREEN[i++] = sum(a, b);
}
}
// Adds up two bytes and returns the result
// a - the first byte
// b - the second byte
// Returns the sum pf the two bytes
byte sum( byte a, byte b) {
// calculate the sum
byte r = a+b;
// return the sum
return r;
}

View File

@ -0,0 +1,8 @@
// Tests that single-line comments are only included once in the output
const byte* SCREEN = $400;
// The program entry point
void main() {
*SCREEN = 'a';
}

View File

@ -1,3 +1,4 @@
// Illustrates symbolic array lengths
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"

View File

@ -136,58 +136,60 @@ Complete equivalence classes
Allocated zp ZP_BYTE:2 [ main::sub#2 main::sub#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Illustrates symbolic array lengths
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const SZ = $f
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
.label sub = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta sub
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte[SZ#0]) items#0 + (byte) main::sub#2) ← (byte) main::sub#2 -- pbuc1_derefidx_vbuz1=vbuz1
//SEG16 [6] *((const byte[SZ#0]) items#0 + (byte) main::sub#2) ← (byte) main::sub#2 -- pbuc1_derefidx_vbuz1=vbuz1
ldy sub
tya
sta items,y
//SEG16 [7] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuz1=_inc_vbuz1
//SEG17 [7] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuz1=_inc_vbuz1
inc sub
//SEG17 [8] if((byte) main::sub#1!=(const byte) SZ#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::sub#1!=(const byte) SZ#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda sub
cmp #SZ+1
bne b1_from_b1
jmp breturn
//SEG18 main::@return
//SEG19 main::@return
breturn:
//SEG19 [9] return
//SEG20 [9] return
rts
}
items: .fill SZ, 0
@ -203,54 +205,56 @@ Uplifting [main] best 263 combination reg byte x [ main::sub#2 main::sub#1 ]
Uplifting [] best 263 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Illustrates symbolic array lengths
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const SZ = $f
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte[SZ#0]) items#0 + (byte) main::sub#2) ← (byte) main::sub#2 -- pbuc1_derefidx_vbuxx=vbuxx
//SEG16 [6] *((const byte[SZ#0]) items#0 + (byte) main::sub#2) ← (byte) main::sub#2 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta items,x
//SEG16 [7] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuxx=_inc_vbuxx
inx
//SEG17 [8] if((byte) main::sub#1!=(const byte) SZ#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::sub#1!=(const byte) SZ#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #SZ+1
bne b1_from_b1
jmp breturn
//SEG18 main::@return
//SEG19 main::@return
breturn:
//SEG19 [9] return
//SEG20 [9] return
rts
}
items: .fill SZ, 0
@ -302,39 +306,41 @@ reg byte x [ main::sub#2 main::sub#1 ]
FINAL ASSEMBLER
Score: 161
//SEG0 Basic Upstart
//SEG0 File Comments
// Illustrates symbolic array lengths
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const SZ = $f
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte[SZ#0]) items#0 + (byte) main::sub#2) ← (byte) main::sub#2 -- pbuc1_derefidx_vbuxx=vbuxx
//SEG16 [6] *((const byte[SZ#0]) items#0 + (byte) main::sub#2) ← (byte) main::sub#2 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta items,x
//SEG16 [7] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuxx=_inc_vbuxx
inx
//SEG17 [8] if((byte) main::sub#1!=(const byte) SZ#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::sub#1!=(const byte) SZ#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #SZ+1
bne b1
//SEG18 main::@return
//SEG19 [9] return
//SEG19 main::@return
//SEG20 [9] return
rts
}
items: .fill SZ, 0

View File

@ -1,3 +1,4 @@
// Illustrates symbolic array lengths
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"

View File

@ -243,30 +243,32 @@ Allocated zp ZP_BYTE:6 [ main::$2 ]
Allocated zp ZP_BYTE:7 [ main::$3 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Illustrates symbolic array lengths
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const ITEM_COUNT = 3
.const ITEM_SIZE = 5
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
.label _2 = 6
@ -274,61 +276,61 @@ main: {
.label sub = 5
.label cur_item = 3
.label item = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte*) main::cur_item#4 = (const byte[ITEM_COUNT#0*ITEM_SIZE#0]) items#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
//SEG12 [5] phi (byte*) main::cur_item#4 = (const byte[ITEM_COUNT#0*ITEM_SIZE#0]) items#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
lda #<items
sta cur_item
lda #>items
sta cur_item+1
//SEG12 [5] phi (byte) main::item#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
//SEG13 [5] phi (byte) main::item#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
lda #0
sta item
jmp b1
//SEG13 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG14 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG14 [5] phi (byte*) main::cur_item#4 = (byte*) main::cur_item#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG15 [5] phi (byte) main::item#4 = (byte) main::item#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG15 [5] phi (byte*) main::cur_item#4 = (byte*) main::cur_item#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG16 [5] phi (byte) main::item#4 = (byte) main::item#1 [phi:main::@3->main::@1#1] -- register_copy
jmp b1
//SEG16 main::@1
//SEG17 main::@1
b1:
//SEG17 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG18 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
//SEG18 [6] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
//SEG19 [6] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
lda #0
sta sub
jmp b2
//SEG19 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG20 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
//SEG20 [6] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG21 [6] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@2->main::@2#0] -- register_copy
jmp b2
//SEG21 main::@2
//SEG22 main::@2
b2:
//SEG22 [7] (byte~) main::$2 ← (byte) main::item#4 << (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuz1=vbuz2_rol_4
//SEG23 [7] (byte~) main::$2 ← (byte) main::item#4 << (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuz1=vbuz2_rol_4
lda item
asl
asl
asl
asl
sta _2
//SEG23 [8] (byte~) main::$3 ← (byte~) main::$2 | (byte) main::sub#2 -- vbuz1=vbuz2_bor_vbuz3
//SEG24 [8] (byte~) main::$3 ← (byte~) main::$2 | (byte) main::sub#2 -- vbuz1=vbuz2_bor_vbuz3
lda _2
ora sub
sta _3
//SEG24 [9] *((byte*) main::cur_item#4 + (byte) main::sub#2) ← (byte~) main::$3 -- pbuz1_derefidx_vbuz2=vbuz3
//SEG25 [9] *((byte*) main::cur_item#4 + (byte) main::sub#2) ← (byte~) main::$3 -- pbuz1_derefidx_vbuz2=vbuz3
lda _3
ldy sub
sta (cur_item),y
//SEG25 [10] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuz1=_inc_vbuz1
//SEG26 [10] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuz1=_inc_vbuz1
inc sub
//SEG26 [11] if((byte) main::sub#1!=(const byte) ITEM_SIZE#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
//SEG27 [11] if((byte) main::sub#1!=(const byte) ITEM_SIZE#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda sub
cmp #ITEM_SIZE-1+1
bne b2_from_b2
jmp b3
//SEG27 main::@3
//SEG28 main::@3
b3:
//SEG28 [12] (byte*) main::cur_item#1 ← (byte*) main::cur_item#4 + (const byte) ITEM_SIZE#0 -- pbuz1=pbuz1_plus_vbuc1
//SEG29 [12] (byte*) main::cur_item#1 ← (byte*) main::cur_item#4 + (const byte) ITEM_SIZE#0 -- pbuz1=pbuz1_plus_vbuc1
lda cur_item
clc
adc #ITEM_SIZE
@ -336,16 +338,16 @@ main: {
bcc !+
inc cur_item+1
!:
//SEG29 [13] (byte) main::item#1 ← ++ (byte) main::item#4 -- vbuz1=_inc_vbuz1
//SEG30 [13] (byte) main::item#1 ← ++ (byte) main::item#4 -- vbuz1=_inc_vbuz1
inc item
//SEG30 [14] if((byte) main::item#1!=(const byte) ITEM_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG31 [14] if((byte) main::item#1!=(const byte) ITEM_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda item
cmp #ITEM_COUNT-1+1
bne b1_from_b3
jmp breturn
//SEG31 main::@return
//SEG32 main::@return
breturn:
//SEG32 [15] return
//SEG33 [15] return
rts
}
items: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@ -373,81 +375,83 @@ Uplifting [] best 4418 combination
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ main::cur_item#4 main::cur_item#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Illustrates symbolic array lengths
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const ITEM_COUNT = 3
.const ITEM_SIZE = 5
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
.label cur_item = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte*) main::cur_item#4 = (const byte[ITEM_COUNT#0*ITEM_SIZE#0]) items#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
//SEG12 [5] phi (byte*) main::cur_item#4 = (const byte[ITEM_COUNT#0*ITEM_SIZE#0]) items#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
lda #<items
sta cur_item
lda #>items
sta cur_item+1
//SEG12 [5] phi (byte) main::item#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
//SEG13 [5] phi (byte) main::item#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG13 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG14 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG14 [5] phi (byte*) main::cur_item#4 = (byte*) main::cur_item#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG15 [5] phi (byte) main::item#4 = (byte) main::item#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG15 [5] phi (byte*) main::cur_item#4 = (byte*) main::cur_item#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG16 [5] phi (byte) main::item#4 = (byte) main::item#1 [phi:main::@3->main::@1#1] -- register_copy
jmp b1
//SEG16 main::@1
//SEG17 main::@1
b1:
//SEG17 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG18 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
//SEG18 [6] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuyy=vbuc1
//SEG19 [6] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuyy=vbuc1
ldy #0
jmp b2
//SEG19 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG20 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
//SEG20 [6] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG21 [6] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@2->main::@2#0] -- register_copy
jmp b2
//SEG21 main::@2
//SEG22 main::@2
b2:
//SEG22 [7] (byte~) main::$2 ← (byte) main::item#4 << (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_rol_4
//SEG23 [7] (byte~) main::$2 ← (byte) main::item#4 << (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_rol_4
txa
asl
asl
asl
asl
//SEG23 [8] (byte~) main::$3 ← (byte~) main::$2 | (byte) main::sub#2 -- vbuaa=vbuaa_bor_vbuyy
//SEG24 [8] (byte~) main::$3 ← (byte~) main::$2 | (byte) main::sub#2 -- vbuaa=vbuaa_bor_vbuyy
sty $ff
ora $ff
//SEG24 [9] *((byte*) main::cur_item#4 + (byte) main::sub#2) ← (byte~) main::$3 -- pbuz1_derefidx_vbuyy=vbuaa
//SEG25 [9] *((byte*) main::cur_item#4 + (byte) main::sub#2) ← (byte~) main::$3 -- pbuz1_derefidx_vbuyy=vbuaa
sta (cur_item),y
//SEG25 [10] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuyy=_inc_vbuyy
//SEG26 [10] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuyy=_inc_vbuyy
iny
//SEG26 [11] if((byte) main::sub#1!=(const byte) ITEM_SIZE#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@2 -- vbuyy_neq_vbuc1_then_la1
//SEG27 [11] if((byte) main::sub#1!=(const byte) ITEM_SIZE#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@2 -- vbuyy_neq_vbuc1_then_la1
cpy #ITEM_SIZE-1+1
bne b2_from_b2
jmp b3
//SEG27 main::@3
//SEG28 main::@3
b3:
//SEG28 [12] (byte*) main::cur_item#1 ← (byte*) main::cur_item#4 + (const byte) ITEM_SIZE#0 -- pbuz1=pbuz1_plus_vbuc1
//SEG29 [12] (byte*) main::cur_item#1 ← (byte*) main::cur_item#4 + (const byte) ITEM_SIZE#0 -- pbuz1=pbuz1_plus_vbuc1
lda cur_item
clc
adc #ITEM_SIZE
@ -455,15 +459,15 @@ main: {
bcc !+
inc cur_item+1
!:
//SEG29 [13] (byte) main::item#1 ← ++ (byte) main::item#4 -- vbuxx=_inc_vbuxx
//SEG30 [13] (byte) main::item#1 ← ++ (byte) main::item#4 -- vbuxx=_inc_vbuxx
inx
//SEG30 [14] if((byte) main::item#1!=(const byte) ITEM_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG31 [14] if((byte) main::item#1!=(const byte) ITEM_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #ITEM_COUNT-1+1
bne b1_from_b3
jmp breturn
//SEG31 main::@return
//SEG32 main::@return
breturn:
//SEG32 [15] return
//SEG33 [15] return
rts
}
items: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@ -537,62 +541,64 @@ reg byte a [ main::$3 ]
FINAL ASSEMBLER
Score: 3416
//SEG0 Basic Upstart
//SEG0 File Comments
// Illustrates symbolic array lengths
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const ITEM_COUNT = 3
.const ITEM_SIZE = 5
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
// Fills the array item by item with $is, where i is the item# and s is the sub#
main: {
.label cur_item = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte*) main::cur_item#4 = (const byte[ITEM_COUNT#0*ITEM_SIZE#0]) items#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte*) main::cur_item#4 = (const byte[ITEM_COUNT#0*ITEM_SIZE#0]) items#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
lda #<items
sta cur_item
lda #>items
sta cur_item+1
//SEG12 [5] phi (byte) main::item#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
//SEG13 [5] phi (byte) main::item#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
ldx #0
//SEG13 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG14 [5] phi (byte*) main::cur_item#4 = (byte*) main::cur_item#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG15 [5] phi (byte) main::item#4 = (byte) main::item#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG16 main::@1
//SEG14 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG15 [5] phi (byte*) main::cur_item#4 = (byte*) main::cur_item#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG16 [5] phi (byte) main::item#4 = (byte) main::item#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG17 main::@1
b1:
//SEG17 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG18 [6] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuyy=vbuc1
//SEG18 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG19 [6] phi (byte) main::sub#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuyy=vbuc1
ldy #0
//SEG19 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG20 [6] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG21 main::@2
//SEG20 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG21 [6] phi (byte) main::sub#2 = (byte) main::sub#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG22 main::@2
b2:
//SEG22 [7] (byte~) main::$2 ← (byte) main::item#4 << (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_rol_4
//SEG23 [7] (byte~) main::$2 ← (byte) main::item#4 << (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_rol_4
txa
asl
asl
asl
asl
//SEG23 [8] (byte~) main::$3 ← (byte~) main::$2 | (byte) main::sub#2 -- vbuaa=vbuaa_bor_vbuyy
//SEG24 [8] (byte~) main::$3 ← (byte~) main::$2 | (byte) main::sub#2 -- vbuaa=vbuaa_bor_vbuyy
sty $ff
ora $ff
//SEG24 [9] *((byte*) main::cur_item#4 + (byte) main::sub#2) ← (byte~) main::$3 -- pbuz1_derefidx_vbuyy=vbuaa
//SEG25 [9] *((byte*) main::cur_item#4 + (byte) main::sub#2) ← (byte~) main::$3 -- pbuz1_derefidx_vbuyy=vbuaa
sta (cur_item),y
//SEG25 [10] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuyy=_inc_vbuyy
//SEG26 [10] (byte) main::sub#1 ← ++ (byte) main::sub#2 -- vbuyy=_inc_vbuyy
iny
//SEG26 [11] if((byte) main::sub#1!=(const byte) ITEM_SIZE#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@2 -- vbuyy_neq_vbuc1_then_la1
//SEG27 [11] if((byte) main::sub#1!=(const byte) ITEM_SIZE#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@2 -- vbuyy_neq_vbuc1_then_la1
cpy #ITEM_SIZE-1+1
bne b2
//SEG27 main::@3
//SEG28 [12] (byte*) main::cur_item#1 ← (byte*) main::cur_item#4 + (const byte) ITEM_SIZE#0 -- pbuz1=pbuz1_plus_vbuc1
//SEG28 main::@3
//SEG29 [12] (byte*) main::cur_item#1 ← (byte*) main::cur_item#4 + (const byte) ITEM_SIZE#0 -- pbuz1=pbuz1_plus_vbuc1
lda cur_item
clc
adc #ITEM_SIZE
@ -600,13 +606,13 @@ main: {
bcc !+
inc cur_item+1
!:
//SEG29 [13] (byte) main::item#1 ← ++ (byte) main::item#4 -- vbuxx=_inc_vbuxx
//SEG30 [13] (byte) main::item#1 ← ++ (byte) main::item#4 -- vbuxx=_inc_vbuxx
inx
//SEG30 [14] if((byte) main::item#1!=(const byte) ITEM_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG31 [14] if((byte) main::item#1!=(const byte) ITEM_COUNT#0-(byte/signed byte/word/signed word/dword/signed dword) 1+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #ITEM_COUNT-1+1
bne b1
//SEG31 main::@return
//SEG32 [15] return
//SEG32 main::@return
//SEG33 [15] return
rts
}
items: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

View File

@ -116,44 +116,45 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte[3]) b#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte[3]) b#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
lda #'c'
sta b
//SEG10 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0) -- _deref_pbuc1=_deref_pbuc2
//SEG11 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0) -- _deref_pbuc1=_deref_pbuc2
lda b
sta SCREEN
//SEG11 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_deref_pbuc2
//SEG12 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_deref_pbuc2
lda c+1
sta SCREEN+1
//SEG12 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← *((const byte[]) d#0+(byte/signed byte/word/signed word/dword/signed dword) 2) -- _deref_pbuc1=_deref_pbuc2
//SEG13 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← *((const byte[]) d#0+(byte/signed byte/word/signed word/dword/signed dword) 2) -- _deref_pbuc1=_deref_pbuc2
lda d+2
sta SCREEN+2
jmp breturn
//SEG13 main::@return
//SEG14 main::@return
breturn:
//SEG14 [8] return
//SEG15 [8] return
rts
}
b: .fill 3, 0
@ -174,44 +175,45 @@ Uplifting [main] best 51 combination
Uplifting [] best 51 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte[3]) b#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte[3]) b#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
lda #'c'
sta b
//SEG10 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0) -- _deref_pbuc1=_deref_pbuc2
//SEG11 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0) -- _deref_pbuc1=_deref_pbuc2
lda b
sta SCREEN
//SEG11 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_deref_pbuc2
//SEG12 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_deref_pbuc2
lda c+1
sta SCREEN+1
//SEG12 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← *((const byte[]) d#0+(byte/signed byte/word/signed word/dword/signed dword) 2) -- _deref_pbuc1=_deref_pbuc2
//SEG13 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← *((const byte[]) d#0+(byte/signed byte/word/signed word/dword/signed dword) 2) -- _deref_pbuc1=_deref_pbuc2
lda d+2
sta SCREEN+2
jmp breturn
//SEG13 main::@return
//SEG14 main::@return
breturn:
//SEG14 [8] return
//SEG15 [8] return
rts
}
b: .fill 3, 0
@ -258,33 +260,34 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 32
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG9 [4] *((const byte[3]) b#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte[3]) b#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
lda #'c'
sta b
//SEG10 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0) -- _deref_pbuc1=_deref_pbuc2
//SEG11 [5] *((const byte*) SCREEN#0) ← *((const byte[3]) b#0) -- _deref_pbuc1=_deref_pbuc2
sta SCREEN
//SEG11 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_deref_pbuc2
//SEG12 [6] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← *((const byte[]) c#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- _deref_pbuc1=_deref_pbuc2
lda c+1
sta SCREEN+1
//SEG12 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← *((const byte[]) d#0+(byte/signed byte/word/signed word/dword/signed dword) 2) -- _deref_pbuc1=_deref_pbuc2
//SEG13 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← *((const byte[]) d#0+(byte/signed byte/word/signed word/dword/signed dword) 2) -- _deref_pbuc1=_deref_pbuc2
lda d+2
sta SCREEN+2
//SEG13 main::@return
//SEG14 [8] return
//SEG14 main::@return
//SEG15 [8] return
rts
}
b: .fill 3, 0

View File

@ -1,3 +1,4 @@
// Tests that inline ASM clobbering is taken into account when assigning registers
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"

View File

@ -273,127 +273,129 @@ Allocated zp ZP_BYTE:4 [ main::k#4 main::k#1 ]
Allocated zp ZP_BYTE:5 [ main::l#2 main::l#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that inline ASM clobbering is taken into account when assigning registers
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.label j = 3
.label i = 2
.label l = 5
.label k = 4
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG13 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
b1_from_b5:
//SEG13 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG16 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
//SEG16 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
//SEG17 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
lda #0
sta j
jmp b2
//SEG17 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG18 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG19 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
jmp b2
//SEG19 main::@2
//SEG20 main::@2
b2:
//SEG20 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG21 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuz1=vbuz2
lda j
ldy i
sta SCREEN,y
//SEG21 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuz1=_inc_vbuz1
//SEG22 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuz1=_inc_vbuz1
inc j
//SEG22 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
//SEG23 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda j
cmp #$65
bne b2_from_b2
jmp b5
//SEG23 main::@5
//SEG24 main::@5
b5:
//SEG24 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuz1=_inc_vbuz1
//SEG25 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuz1=_inc_vbuz1
inc i
//SEG25 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG26 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$65
bne b1_from_b5
//SEG26 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
//SEG27 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
b3_from_b5:
//SEG27 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuz1=vbuc1
//SEG28 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuz1=vbuc1
lda #0
sta k
jmp b3
//SEG28 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
//SEG29 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
b3_from_b7:
//SEG29 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
//SEG30 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
jmp b3
//SEG30 main::@3
//SEG31 main::@3
b3:
//SEG31 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG32 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
b4_from_b3:
//SEG32 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
//SEG33 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
lda #0
sta l
jmp b4
//SEG33 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
//SEG34 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
b4_from_b4:
//SEG34 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
//SEG35 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
jmp b4
//SEG35 main::@4
//SEG36 main::@4
b4:
//SEG36 asm { eor#$55 tax }
//SEG37 asm { eor#$55 tax }
eor #$55
tax
//SEG37 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG38 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuz1=vbuz2
lda l
ldy k
sta SCREEN,y
//SEG38 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
//SEG39 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
inc l
//SEG39 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
//SEG40 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
lda l
cmp #$65
bne b4_from_b4
jmp b7
//SEG40 main::@7
//SEG41 main::@7
b7:
//SEG41 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuz1=_inc_vbuz1
//SEG42 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuz1=_inc_vbuz1
inc k
//SEG42 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuz1_neq_vbuc1_then_la1
//SEG43 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuz1_neq_vbuc1_then_la1
lda k
cmp #$65
bne b3_from_b7
jmp breturn
//SEG43 main::@return
//SEG44 main::@return
breturn:
//SEG44 [20] return
//SEG45 [20] return
rts
}
@ -422,116 +424,118 @@ Uplifting [main] best 6638 combination zp ZP_BYTE:5 [ main::l#2 main::l#1 ]
Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:2 [ main::l#2 main::l#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that inline ASM clobbering is taken into account when assigning registers
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.label l = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG13 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
b1_from_b5:
//SEG13 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG16 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
//SEG16 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuaa=vbuc1
//SEG17 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuaa=vbuc1
lda #0
jmp b2
//SEG17 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG18 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG19 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
jmp b2
//SEG19 main::@2
//SEG20 main::@2
b2:
//SEG20 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG21 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG21 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuaa=_inc_vbuaa
//SEG22 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuaa=_inc_vbuaa
clc
adc #1
//SEG22 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuaa_neq_vbuc1_then_la1
//SEG23 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuaa_neq_vbuc1_then_la1
cmp #$65
bne b2_from_b2
jmp b5
//SEG23 main::@5
//SEG24 main::@5
b5:
//SEG24 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
//SEG25 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
inx
//SEG25 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG26 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1_from_b5
//SEG26 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
//SEG27 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
b3_from_b5:
//SEG27 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuyy=vbuc1
//SEG28 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuyy=vbuc1
ldy #0
jmp b3
//SEG28 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
//SEG29 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
b3_from_b7:
//SEG29 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
//SEG30 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
jmp b3
//SEG30 main::@3
//SEG31 main::@3
b3:
//SEG31 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG32 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
b4_from_b3:
//SEG32 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
//SEG33 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
lda #0
sta l
jmp b4
//SEG33 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
//SEG34 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
b4_from_b4:
//SEG34 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
//SEG35 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
jmp b4
//SEG35 main::@4
//SEG36 main::@4
b4:
//SEG36 asm { eor#$55 tax }
//SEG37 asm { eor#$55 tax }
eor #$55
tax
//SEG37 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuyy=vbuz1
//SEG38 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuyy=vbuz1
lda l
sta SCREEN,y
//SEG38 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
//SEG39 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
inc l
//SEG39 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
//SEG40 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
lda l
cmp #$65
bne b4_from_b4
jmp b7
//SEG40 main::@7
//SEG41 main::@7
b7:
//SEG41 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuyy=_inc_vbuyy
//SEG42 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuyy=_inc_vbuyy
iny
//SEG42 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuyy_neq_vbuc1_then_la1
//SEG43 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuyy_neq_vbuc1_then_la1
cpy #$65
bne b3_from_b7
jmp breturn
//SEG43 main::@return
//SEG44 main::@return
breturn:
//SEG44 [20] return
//SEG45 [20] return
rts
}
@ -615,85 +619,87 @@ zp ZP_BYTE:2 [ main::l#2 main::l#1 ]
FINAL ASSEMBLER
Score: 4676
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that inline ASM clobbering is taken into account when assigning registers
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.label l = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG13 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG14 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG16 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuaa=vbuc1
//SEG16 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG17 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuaa=vbuc1
lda #0
//SEG17 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG19 main::@2
//SEG18 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG19 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG20 main::@2
b2:
//SEG20 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG21 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG21 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuaa=_inc_vbuaa
//SEG22 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuaa=_inc_vbuaa
clc
adc #1
//SEG22 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuaa_neq_vbuc1_then_la1
//SEG23 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuaa_neq_vbuc1_then_la1
cmp #$65
bne b2
//SEG23 main::@5
//SEG24 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
//SEG24 main::@5
//SEG25 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
inx
//SEG25 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG26 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1
//SEG26 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
//SEG27 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuyy=vbuc1
//SEG27 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
//SEG28 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuyy=vbuc1
ldy #0
//SEG28 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
//SEG29 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
//SEG30 main::@3
//SEG29 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
//SEG30 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
//SEG31 main::@3
b3:
//SEG31 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG32 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
//SEG32 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG33 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
lda #0
sta l
//SEG33 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
//SEG34 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
//SEG35 main::@4
//SEG34 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
//SEG35 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
//SEG36 main::@4
b4:
//SEG36 asm { eor#$55 tax }
//SEG37 asm { eor#$55 tax }
eor #$55
tax
//SEG37 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuyy=vbuz1
//SEG38 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuyy=vbuz1
lda l
sta SCREEN,y
//SEG38 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
//SEG39 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
inc l
//SEG39 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
//SEG40 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
lda l
cmp #$65
bne b4
//SEG40 main::@7
//SEG41 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuyy=_inc_vbuyy
//SEG41 main::@7
//SEG42 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuyy=_inc_vbuyy
iny
//SEG42 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuyy_neq_vbuc1_then_la1
//SEG43 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuyy_neq_vbuc1_then_la1
cpy #$65
bne b3
//SEG43 main::@return
//SEG44 [20] return
//SEG44 main::@return
//SEG45 [20] return
rts
}

View File

@ -1,7 +1,7 @@
// Tests that chained assignments work as intended
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Tests that chained assignments work as intended
main: {
.label screen = $400
lda #'c'

View File

@ -112,55 +112,56 @@ Complete equivalence classes
Allocated zp ZP_BYTE:2 [ main::a#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that chained assignments work as intended
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Tests that chained assignments work as intended
//SEG9 main
main: {
.label screen = $400
.label a = 2
//SEG9 [4] *((const byte*) main::screen#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
lda #'c'
sta screen
//SEG10 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40) ← (byte) 'c' -- _deref_pbuc1=vbuc2
lda #'c'
sta screen+$28
//SEG11 [6] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'm' -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'm' -- _deref_pbuc1=vbuc2
lda #'m'
sta screen+1
//SEG12 [7] (byte) main::a#1 ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuz1=_deref_pbuc1
//SEG13 [7] (byte) main::a#1 ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuz1=_deref_pbuc1
lda screen+1
sta a
//SEG13 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41) ← (byte) main::a#1 -- _deref_pbuc1=vbuz1
//SEG14 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41) ← (byte) main::a#1 -- _deref_pbuc1=vbuz1
lda a
sta screen+$29
//SEG14 [9] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte/signed byte/word/signed word/dword/signed dword) 1+(byte) 'l' -- _deref_pbuc1=vbuc2
//SEG15 [9] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte/signed byte/word/signed word/dword/signed dword) 1+(byte) 'l' -- _deref_pbuc1=vbuc2
lda #1+'l'
sta screen+2
//SEG15 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 42) ← (byte) 'l' -- _deref_pbuc1=vbuc2
//SEG16 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 42) ← (byte) 'l' -- _deref_pbuc1=vbuc2
lda #'l'
sta screen+$2a
jmp breturn
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [11] return
//SEG18 [11] return
rts
}
@ -180,52 +181,53 @@ Uplifting [main] best 59 combination reg byte a [ main::a#1 ]
Uplifting [] best 59 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that chained assignments work as intended
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Tests that chained assignments work as intended
//SEG9 main
main: {
.label screen = $400
//SEG9 [4] *((const byte*) main::screen#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
lda #'c'
sta screen
//SEG10 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40) ← (byte) 'c' -- _deref_pbuc1=vbuc2
lda #'c'
sta screen+$28
//SEG11 [6] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'm' -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'm' -- _deref_pbuc1=vbuc2
lda #'m'
sta screen+1
//SEG12 [7] (byte) main::a#1 ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuaa=_deref_pbuc1
//SEG13 [7] (byte) main::a#1 ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuaa=_deref_pbuc1
lda screen+1
//SEG13 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41) ← (byte) main::a#1 -- _deref_pbuc1=vbuaa
//SEG14 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41) ← (byte) main::a#1 -- _deref_pbuc1=vbuaa
sta screen+$29
//SEG14 [9] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte/signed byte/word/signed word/dword/signed dword) 1+(byte) 'l' -- _deref_pbuc1=vbuc2
//SEG15 [9] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte/signed byte/word/signed word/dword/signed dword) 1+(byte) 'l' -- _deref_pbuc1=vbuc2
lda #1+'l'
sta screen+2
//SEG15 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 42) ← (byte) 'l' -- _deref_pbuc1=vbuc2
//SEG16 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 42) ← (byte) 'l' -- _deref_pbuc1=vbuc2
lda #'l'
sta screen+$2a
jmp breturn
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [11] return
//SEG18 [11] return
rts
}
@ -267,40 +269,41 @@ reg byte a [ main::a#1 ]
FINAL ASSEMBLER
Score: 38
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that chained assignments work as intended
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
// Tests that chained assignments work as intended
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
.label screen = $400
//SEG9 [4] *((const byte*) main::screen#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
lda #'c'
sta screen
//SEG10 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40) ← (byte) 'c' -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40) ← (byte) 'c' -- _deref_pbuc1=vbuc2
sta screen+$28
//SEG11 [6] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'm' -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'm' -- _deref_pbuc1=vbuc2
lda #'m'
sta screen+1
//SEG12 [7] (byte) main::a#1 ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuaa=_deref_pbuc1
//SEG13 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41) ← (byte) main::a#1 -- _deref_pbuc1=vbuaa
//SEG13 [7] (byte) main::a#1 ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) -- vbuaa=_deref_pbuc1
//SEG14 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41) ← (byte) main::a#1 -- _deref_pbuc1=vbuaa
sta screen+$29
//SEG14 [9] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte/signed byte/word/signed word/dword/signed dword) 1+(byte) 'l' -- _deref_pbuc1=vbuc2
//SEG15 [9] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte/signed byte/word/signed word/dword/signed dword) 1+(byte) 'l' -- _deref_pbuc1=vbuc2
lda #1+'l'
sta screen+2
//SEG15 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 42) ← (byte) 'l' -- _deref_pbuc1=vbuc2
//SEG16 [10] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 42) ← (byte) 'l' -- _deref_pbuc1=vbuc2
lda #'l'
sta screen+$2a
//SEG16 main::@return
//SEG17 [11] return
//SEG17 main::@return
//SEG18 [11] return
rts
}

View File

@ -1,3 +1,4 @@
// Test compound assignment operators
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
@ -71,5 +72,4 @@ test: {
sta cols,x
jmp breturn
}
// Test compound assignment operators
ref: .byte 3, 4, 3, $12, 9, 1, 4, 2, 4, 5, 1, 0

View File

@ -752,238 +752,239 @@ Allocated zp ZP_BYTE:2 [ test::a#11 ]
Allocated zp ZP_BYTE:3 [ test::i#11 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Test compound assignment operators
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen1 = $400
.label cols = $d800
.const GREEN = 5
.const RED = 2
.label screen2 = screen1+$28
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] call test
//SEG11 [27] phi from main to test [phi:main->test]
//SEG11 [5] call test
//SEG12 [27] phi from main to test [phi:main->test]
test_from_main:
//SEG12 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->test#0] -- vbuz1=vbuc1
//SEG13 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->test#0] -- vbuz1=vbuc1
lda #0
sta test.i
//SEG13 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main->test#1] -- vbuz1=vbuc1
//SEG14 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main->test#1] -- vbuz1=vbuc1
lda #3
sta test.a
jsr test
//SEG14 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG15 main::@1
//SEG16 main::@1
b1:
//SEG16 [7] call test
//SEG17 [27] phi from main::@1 to test [phi:main::@1->test]
//SEG17 [7] call test
//SEG18 [27] phi from main::@1 to test [phi:main::@1->test]
test_from_b1:
//SEG18 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#0] -- vbuz1=vbuc1
//SEG19 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#0] -- vbuz1=vbuc1
lda #1
sta test.i
//SEG19 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#1] -- vbuz1=vbuc1
//SEG20 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#1] -- vbuz1=vbuc1
lda #3+1
sta test.a
jsr test
//SEG20 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG21 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG21 main::@2
//SEG22 main::@2
b2:
//SEG22 [9] call test
//SEG23 [27] phi from main::@2 to test [phi:main::@2->test]
//SEG23 [9] call test
//SEG24 [27] phi from main::@2 to test [phi:main::@2->test]
test_from_b2:
//SEG24 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@2->test#0] -- vbuz1=vbuc1
//SEG25 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@2->test#0] -- vbuz1=vbuc1
lda #2
sta test.i
//SEG25 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@2->test#1] -- vbuz1=vbuc1
//SEG26 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@2->test#1] -- vbuz1=vbuc1
lda #3+1-1
sta test.a
jsr test
//SEG26 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG27 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
jmp b3
//SEG27 main::@3
//SEG28 main::@3
b3:
//SEG28 [11] call test
//SEG29 [27] phi from main::@3 to test [phi:main::@3->test]
//SEG29 [11] call test
//SEG30 [27] phi from main::@3 to test [phi:main::@3->test]
test_from_b3:
//SEG30 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@3->test#0] -- vbuz1=vbuc1
//SEG31 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@3->test#0] -- vbuz1=vbuc1
lda #3
sta test.i
//SEG31 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@3->test#1] -- vbuz1=vbuc1
//SEG32 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@3->test#1] -- vbuz1=vbuc1
lda #(3+1-1)*6
sta test.a
jsr test
//SEG32 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG33 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
b4_from_b3:
jmp b4
//SEG33 main::@4
//SEG34 main::@4
b4:
//SEG34 [13] call test
//SEG35 [27] phi from main::@4 to test [phi:main::@4->test]
//SEG35 [13] call test
//SEG36 [27] phi from main::@4 to test [phi:main::@4->test]
test_from_b4:
//SEG36 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main::@4->test#0] -- vbuz1=vbuc1
//SEG37 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main::@4->test#0] -- vbuz1=vbuc1
lda #4
sta test.i
//SEG37 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@4->test#1] -- vbuz1=vbuc1
//SEG38 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@4->test#1] -- vbuz1=vbuc1
lda #(3+1-1)*6/2
sta test.a
jsr test
//SEG38 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
//SEG39 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
b5_from_b4:
jmp b5
//SEG39 main::@5
//SEG40 main::@5
b5:
//SEG40 [15] call test
//SEG41 [27] phi from main::@5 to test [phi:main::@5->test]
//SEG41 [15] call test
//SEG42 [27] phi from main::@5 to test [phi:main::@5->test]
test_from_b5:
//SEG42 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@5->test#0] -- vbuz1=vbuc1
//SEG43 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@5->test#0] -- vbuz1=vbuc1
lda #5
sta test.i
//SEG43 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@5->test#1] -- vbuz1=vbuc1
//SEG44 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@5->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)
sta test.a
jsr test
//SEG44 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
//SEG45 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
b6_from_b5:
jmp b6
//SEG45 main::@6
//SEG46 main::@6
b6:
//SEG46 [17] call test
//SEG47 [27] phi from main::@6 to test [phi:main::@6->test]
//SEG47 [17] call test
//SEG48 [27] phi from main::@6 to test [phi:main::@6->test]
test_from_b6:
//SEG48 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@6->test#0] -- vbuz1=vbuc1
//SEG49 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@6->test#0] -- vbuz1=vbuc1
lda #6
sta test.i
//SEG49 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@6->test#1] -- vbuz1=vbuc1
//SEG50 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@6->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2
sta test.a
jsr test
//SEG50 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
//SEG51 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
b7_from_b6:
jmp b7
//SEG51 main::@7
//SEG52 main::@7
b7:
//SEG52 [19] call test
//SEG53 [27] phi from main::@7 to test [phi:main::@7->test]
//SEG53 [19] call test
//SEG54 [27] phi from main::@7 to test [phi:main::@7->test]
test_from_b7:
//SEG54 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@7->test#0] -- vbuz1=vbuc1
//SEG55 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@7->test#0] -- vbuz1=vbuc1
lda #7
sta test.i
//SEG55 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@7->test#1] -- vbuz1=vbuc1
//SEG56 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@7->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1
sta test.a
jsr test
//SEG56 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
//SEG57 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
b8_from_b7:
jmp b8
//SEG57 main::@8
//SEG58 main::@8
b8:
//SEG58 [21] call test
//SEG59 [27] phi from main::@8 to test [phi:main::@8->test]
//SEG59 [21] call test
//SEG60 [27] phi from main::@8 to test [phi:main::@8->test]
test_from_b8:
//SEG60 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@8->test#0] -- vbuz1=vbuc1
//SEG61 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@8->test#0] -- vbuz1=vbuc1
lda #8
sta test.i
//SEG61 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@8->test#1] -- vbuz1=vbuc1
//SEG62 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@8->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1^6
sta test.a
jsr test
//SEG62 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
//SEG63 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
b9_from_b8:
jmp b9
//SEG63 main::@9
//SEG64 main::@9
b9:
//SEG64 [23] call test
//SEG65 [27] phi from main::@9 to test [phi:main::@9->test]
//SEG65 [23] call test
//SEG66 [27] phi from main::@9 to test [phi:main::@9->test]
test_from_b9:
//SEG66 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 9 [phi:main::@9->test#0] -- vbuz1=vbuc1
//SEG67 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 9 [phi:main::@9->test#0] -- vbuz1=vbuc1
lda #9
sta test.i
//SEG67 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@9->test#1] -- vbuz1=vbuc1
//SEG68 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@9->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1^6|1
sta test.a
jsr test
//SEG68 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
//SEG69 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
b10_from_b9:
jmp b10
//SEG69 main::@10
//SEG70 main::@10
b10:
//SEG70 [25] call test
//SEG71 [27] phi from main::@10 to test [phi:main::@10->test]
//SEG71 [25] call test
//SEG72 [27] phi from main::@10 to test [phi:main::@10->test]
test_from_b10:
//SEG72 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 10 [phi:main::@10->test#0] -- vbuz1=vbuc1
//SEG73 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 10 [phi:main::@10->test#0] -- vbuz1=vbuc1
lda #$a
sta test.i
//SEG73 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1&(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@10->test#1] -- vbuz1=vbuc1
//SEG74 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1&(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@10->test#1] -- vbuz1=vbuc1
lda #(mod((3+1-1)*6/2,2)<<2>>1^6|1)&1
sta test.a
jsr test
jmp breturn
//SEG74 main::@return
//SEG75 main::@return
breturn:
//SEG75 [26] return
//SEG76 [26] return
rts
}
//SEG76 test
//SEG77 test
test: {
.label a = 2
.label i = 3
//SEG77 [28] *((const byte*) screen1#0 + (byte) test::i#11) ← (byte) test::a#11 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG78 [28] *((const byte*) screen1#0 + (byte) test::i#11) ← (byte) test::a#11 -- pbuc1_derefidx_vbuz1=vbuz2
lda a
ldy i
sta screen1,y
//SEG78 [29] *((const byte*) screen2#0 + (byte) test::i#11) ← *((const byte[]) ref#0 + (byte) test::i#11) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
//SEG79 [29] *((const byte*) screen2#0 + (byte) test::i#11) ← *((const byte[]) ref#0 + (byte) test::i#11) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy i
lda ref,y
sta screen2,y
//SEG79 [30] if(*((const byte[]) ref#0 + (byte) test::i#11)==(byte) test::a#11) goto test::@1 -- pbuc1_derefidx_vbuz1_eq_vbuz2_then_la1
//SEG80 [30] if(*((const byte[]) ref#0 + (byte) test::i#11)==(byte) test::a#11) goto test::@1 -- pbuc1_derefidx_vbuz1_eq_vbuz2_then_la1
ldy i
lda ref,y
cmp a
beq b1
jmp b3
//SEG80 test::@3
//SEG81 test::@3
b3:
//SEG81 [31] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) RED#0 -- pbuc1_derefidx_vbuz1=vbuc2
//SEG82 [31] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) RED#0 -- pbuc1_derefidx_vbuz1=vbuc2
ldy i
lda #RED
sta cols,y
jmp breturn
//SEG82 test::@return
//SEG83 test::@return
breturn:
//SEG83 [32] return
//SEG84 [32] return
rts
//SEG84 test::@1
//SEG85 test::@1
b1:
//SEG85 [33] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuz1=vbuc2
//SEG86 [33] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuz1=vbuc2
ldy i
lda #GREEN
sta cols,y
jmp breturn
}
// Test compound assignment operators
ref: .byte 3, 4, 3, $12, 9, 1, 4, 2, 4, 5, 1, 0
REGISTER UPLIFT POTENTIAL REGISTERS
@ -1013,221 +1014,222 @@ Attempting to uplift remaining variables inzp ZP_BYTE:2 [ test::a#11 ]
Uplifting [test] best 250 combination zp ZP_BYTE:2 [ test::a#11 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Test compound assignment operators
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen1 = $400
.label cols = $d800
.const GREEN = 5
.const RED = 2
.label screen2 = screen1+$28
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] call test
//SEG11 [27] phi from main to test [phi:main->test]
//SEG11 [5] call test
//SEG12 [27] phi from main to test [phi:main->test]
test_from_main:
//SEG12 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->test#0] -- vbuxx=vbuc1
//SEG13 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->test#0] -- vbuxx=vbuc1
ldx #0
//SEG13 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main->test#1] -- vbuz1=vbuc1
//SEG14 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main->test#1] -- vbuz1=vbuc1
lda #3
sta test.a
jsr test
//SEG14 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG15 main::@1
//SEG16 main::@1
b1:
//SEG16 [7] call test
//SEG17 [27] phi from main::@1 to test [phi:main::@1->test]
//SEG17 [7] call test
//SEG18 [27] phi from main::@1 to test [phi:main::@1->test]
test_from_b1:
//SEG18 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#0] -- vbuxx=vbuc1
//SEG19 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#0] -- vbuxx=vbuc1
ldx #1
//SEG19 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#1] -- vbuz1=vbuc1
//SEG20 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#1] -- vbuz1=vbuc1
lda #3+1
sta test.a
jsr test
//SEG20 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG21 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG21 main::@2
//SEG22 main::@2
b2:
//SEG22 [9] call test
//SEG23 [27] phi from main::@2 to test [phi:main::@2->test]
//SEG23 [9] call test
//SEG24 [27] phi from main::@2 to test [phi:main::@2->test]
test_from_b2:
//SEG24 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@2->test#0] -- vbuxx=vbuc1
//SEG25 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@2->test#0] -- vbuxx=vbuc1
ldx #2
//SEG25 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@2->test#1] -- vbuz1=vbuc1
//SEG26 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@2->test#1] -- vbuz1=vbuc1
lda #3+1-1
sta test.a
jsr test
//SEG26 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG27 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
jmp b3
//SEG27 main::@3
//SEG28 main::@3
b3:
//SEG28 [11] call test
//SEG29 [27] phi from main::@3 to test [phi:main::@3->test]
//SEG29 [11] call test
//SEG30 [27] phi from main::@3 to test [phi:main::@3->test]
test_from_b3:
//SEG30 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@3->test#0] -- vbuxx=vbuc1
//SEG31 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@3->test#0] -- vbuxx=vbuc1
ldx #3
//SEG31 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@3->test#1] -- vbuz1=vbuc1
//SEG32 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@3->test#1] -- vbuz1=vbuc1
lda #(3+1-1)*6
sta test.a
jsr test
//SEG32 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG33 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
b4_from_b3:
jmp b4
//SEG33 main::@4
//SEG34 main::@4
b4:
//SEG34 [13] call test
//SEG35 [27] phi from main::@4 to test [phi:main::@4->test]
//SEG35 [13] call test
//SEG36 [27] phi from main::@4 to test [phi:main::@4->test]
test_from_b4:
//SEG36 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main::@4->test#0] -- vbuxx=vbuc1
//SEG37 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main::@4->test#0] -- vbuxx=vbuc1
ldx #4
//SEG37 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@4->test#1] -- vbuz1=vbuc1
//SEG38 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@4->test#1] -- vbuz1=vbuc1
lda #(3+1-1)*6/2
sta test.a
jsr test
//SEG38 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
//SEG39 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
b5_from_b4:
jmp b5
//SEG39 main::@5
//SEG40 main::@5
b5:
//SEG40 [15] call test
//SEG41 [27] phi from main::@5 to test [phi:main::@5->test]
//SEG41 [15] call test
//SEG42 [27] phi from main::@5 to test [phi:main::@5->test]
test_from_b5:
//SEG42 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@5->test#0] -- vbuxx=vbuc1
//SEG43 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@5->test#0] -- vbuxx=vbuc1
ldx #5
//SEG43 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@5->test#1] -- vbuz1=vbuc1
//SEG44 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@5->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)
sta test.a
jsr test
//SEG44 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
//SEG45 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
b6_from_b5:
jmp b6
//SEG45 main::@6
//SEG46 main::@6
b6:
//SEG46 [17] call test
//SEG47 [27] phi from main::@6 to test [phi:main::@6->test]
//SEG47 [17] call test
//SEG48 [27] phi from main::@6 to test [phi:main::@6->test]
test_from_b6:
//SEG48 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@6->test#0] -- vbuxx=vbuc1
//SEG49 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@6->test#0] -- vbuxx=vbuc1
ldx #6
//SEG49 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@6->test#1] -- vbuz1=vbuc1
//SEG50 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@6->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2
sta test.a
jsr test
//SEG50 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
//SEG51 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
b7_from_b6:
jmp b7
//SEG51 main::@7
//SEG52 main::@7
b7:
//SEG52 [19] call test
//SEG53 [27] phi from main::@7 to test [phi:main::@7->test]
//SEG53 [19] call test
//SEG54 [27] phi from main::@7 to test [phi:main::@7->test]
test_from_b7:
//SEG54 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@7->test#0] -- vbuxx=vbuc1
//SEG55 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@7->test#0] -- vbuxx=vbuc1
ldx #7
//SEG55 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@7->test#1] -- vbuz1=vbuc1
//SEG56 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@7->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1
sta test.a
jsr test
//SEG56 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
//SEG57 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
b8_from_b7:
jmp b8
//SEG57 main::@8
//SEG58 main::@8
b8:
//SEG58 [21] call test
//SEG59 [27] phi from main::@8 to test [phi:main::@8->test]
//SEG59 [21] call test
//SEG60 [27] phi from main::@8 to test [phi:main::@8->test]
test_from_b8:
//SEG60 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@8->test#0] -- vbuxx=vbuc1
//SEG61 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@8->test#0] -- vbuxx=vbuc1
ldx #8
//SEG61 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@8->test#1] -- vbuz1=vbuc1
//SEG62 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@8->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1^6
sta test.a
jsr test
//SEG62 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
//SEG63 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
b9_from_b8:
jmp b9
//SEG63 main::@9
//SEG64 main::@9
b9:
//SEG64 [23] call test
//SEG65 [27] phi from main::@9 to test [phi:main::@9->test]
//SEG65 [23] call test
//SEG66 [27] phi from main::@9 to test [phi:main::@9->test]
test_from_b9:
//SEG66 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 9 [phi:main::@9->test#0] -- vbuxx=vbuc1
//SEG67 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 9 [phi:main::@9->test#0] -- vbuxx=vbuc1
ldx #9
//SEG67 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@9->test#1] -- vbuz1=vbuc1
//SEG68 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@9->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1^6|1
sta test.a
jsr test
//SEG68 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
//SEG69 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
b10_from_b9:
jmp b10
//SEG69 main::@10
//SEG70 main::@10
b10:
//SEG70 [25] call test
//SEG71 [27] phi from main::@10 to test [phi:main::@10->test]
//SEG71 [25] call test
//SEG72 [27] phi from main::@10 to test [phi:main::@10->test]
test_from_b10:
//SEG72 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 10 [phi:main::@10->test#0] -- vbuxx=vbuc1
//SEG73 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 10 [phi:main::@10->test#0] -- vbuxx=vbuc1
ldx #$a
//SEG73 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1&(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@10->test#1] -- vbuz1=vbuc1
//SEG74 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1&(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@10->test#1] -- vbuz1=vbuc1
lda #(mod((3+1-1)*6/2,2)<<2>>1^6|1)&1
sta test.a
jsr test
jmp breturn
//SEG74 main::@return
//SEG75 main::@return
breturn:
//SEG75 [26] return
//SEG76 [26] return
rts
}
//SEG76 test
//SEG77 test
test: {
.label a = 2
//SEG77 [28] *((const byte*) screen1#0 + (byte) test::i#11) ← (byte) test::a#11 -- pbuc1_derefidx_vbuxx=vbuz1
//SEG78 [28] *((const byte*) screen1#0 + (byte) test::i#11) ← (byte) test::a#11 -- pbuc1_derefidx_vbuxx=vbuz1
lda a
sta screen1,x
//SEG78 [29] *((const byte*) screen2#0 + (byte) test::i#11) ← *((const byte[]) ref#0 + (byte) test::i#11) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG79 [29] *((const byte*) screen2#0 + (byte) test::i#11) ← *((const byte[]) ref#0 + (byte) test::i#11) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda ref,x
sta screen2,x
//SEG79 [30] if(*((const byte[]) ref#0 + (byte) test::i#11)==(byte) test::a#11) goto test::@1 -- pbuc1_derefidx_vbuxx_eq_vbuz1_then_la1
//SEG80 [30] if(*((const byte[]) ref#0 + (byte) test::i#11)==(byte) test::a#11) goto test::@1 -- pbuc1_derefidx_vbuxx_eq_vbuz1_then_la1
lda ref,x
cmp a
beq b1
jmp b3
//SEG80 test::@3
//SEG81 test::@3
b3:
//SEG81 [31] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG82 [31] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #RED
sta cols,x
jmp breturn
//SEG82 test::@return
//SEG83 test::@return
breturn:
//SEG83 [32] return
//SEG84 [32] return
rts
//SEG84 test::@1
//SEG85 test::@1
b1:
//SEG85 [33] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG86 [33] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #GREEN
sta cols,x
jmp breturn
}
// Test compound assignment operators
ref: .byte 3, 4, 3, $12, 9, 1, 4, 2, 4, 5, 1, 0
ASSEMBLER OPTIMIZATIONS
@ -1339,165 +1341,166 @@ reg byte x [ test::i#11 ]
FINAL ASSEMBLER
Score: 199
//SEG0 Basic Upstart
//SEG0 File Comments
// Test compound assignment operators
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen1 = $400
.label cols = $d800
.const GREEN = 5
.const RED = 2
.label screen2 = screen1+$28
//SEG2 @begin
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 @2
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG5 @2
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG10 [5] call test
//SEG11 [27] phi from main to test [phi:main->test]
//SEG12 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->test#0] -- vbuxx=vbuc1
//SEG11 [5] call test
//SEG12 [27] phi from main to test [phi:main->test]
//SEG13 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->test#0] -- vbuxx=vbuc1
ldx #0
//SEG13 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main->test#1] -- vbuz1=vbuc1
//SEG14 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main->test#1] -- vbuz1=vbuc1
lda #3
sta test.a
jsr test
//SEG14 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG15 main::@1
//SEG16 [7] call test
//SEG17 [27] phi from main::@1 to test [phi:main::@1->test]
//SEG18 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#0] -- vbuxx=vbuc1
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG16 main::@1
//SEG17 [7] call test
//SEG18 [27] phi from main::@1 to test [phi:main::@1->test]
//SEG19 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#0] -- vbuxx=vbuc1
ldx #1
//SEG19 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#1] -- vbuz1=vbuc1
//SEG20 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@1->test#1] -- vbuz1=vbuc1
lda #3+1
sta test.a
jsr test
//SEG20 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG21 main::@2
//SEG22 [9] call test
//SEG23 [27] phi from main::@2 to test [phi:main::@2->test]
//SEG24 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@2->test#0] -- vbuxx=vbuc1
//SEG21 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG22 main::@2
//SEG23 [9] call test
//SEG24 [27] phi from main::@2 to test [phi:main::@2->test]
//SEG25 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@2->test#0] -- vbuxx=vbuc1
ldx #2
//SEG25 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@2->test#1] -- vbuz1=vbuc1
//SEG26 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@2->test#1] -- vbuz1=vbuc1
lda #3+1-1
sta test.a
jsr test
//SEG26 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG27 main::@3
//SEG28 [11] call test
//SEG29 [27] phi from main::@3 to test [phi:main::@3->test]
//SEG30 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@3->test#0] -- vbuxx=vbuc1
//SEG27 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG28 main::@3
//SEG29 [11] call test
//SEG30 [27] phi from main::@3 to test [phi:main::@3->test]
//SEG31 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@3->test#0] -- vbuxx=vbuc1
ldx #3
//SEG31 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@3->test#1] -- vbuz1=vbuc1
//SEG32 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@3->test#1] -- vbuz1=vbuc1
lda #(3+1-1)*6
sta test.a
jsr test
//SEG32 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG33 main::@4
//SEG34 [13] call test
//SEG35 [27] phi from main::@4 to test [phi:main::@4->test]
//SEG36 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main::@4->test#0] -- vbuxx=vbuc1
//SEG33 [12] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG34 main::@4
//SEG35 [13] call test
//SEG36 [27] phi from main::@4 to test [phi:main::@4->test]
//SEG37 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main::@4->test#0] -- vbuxx=vbuc1
ldx #4
//SEG37 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@4->test#1] -- vbuz1=vbuc1
//SEG38 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@4->test#1] -- vbuz1=vbuc1
lda #(3+1-1)*6/2
sta test.a
jsr test
//SEG38 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
//SEG39 main::@5
//SEG40 [15] call test
//SEG41 [27] phi from main::@5 to test [phi:main::@5->test]
//SEG42 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@5->test#0] -- vbuxx=vbuc1
//SEG39 [14] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
//SEG40 main::@5
//SEG41 [15] call test
//SEG42 [27] phi from main::@5 to test [phi:main::@5->test]
//SEG43 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@5->test#0] -- vbuxx=vbuc1
ldx #5
//SEG43 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@5->test#1] -- vbuz1=vbuc1
//SEG44 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@5->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)
sta test.a
jsr test
//SEG44 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
//SEG45 main::@6
//SEG46 [17] call test
//SEG47 [27] phi from main::@6 to test [phi:main::@6->test]
//SEG48 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@6->test#0] -- vbuxx=vbuc1
//SEG45 [16] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
//SEG46 main::@6
//SEG47 [17] call test
//SEG48 [27] phi from main::@6 to test [phi:main::@6->test]
//SEG49 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@6->test#0] -- vbuxx=vbuc1
ldx #6
//SEG49 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@6->test#1] -- vbuz1=vbuc1
//SEG50 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main::@6->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2
sta test.a
jsr test
//SEG50 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
//SEG51 main::@7
//SEG52 [19] call test
//SEG53 [27] phi from main::@7 to test [phi:main::@7->test]
//SEG54 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@7->test#0] -- vbuxx=vbuc1
//SEG51 [18] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
//SEG52 main::@7
//SEG53 [19] call test
//SEG54 [27] phi from main::@7 to test [phi:main::@7->test]
//SEG55 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 7 [phi:main::@7->test#0] -- vbuxx=vbuc1
ldx #7
//SEG55 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@7->test#1] -- vbuz1=vbuc1
//SEG56 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@7->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1
sta test.a
jsr test
//SEG56 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
//SEG57 main::@8
//SEG58 [21] call test
//SEG59 [27] phi from main::@8 to test [phi:main::@8->test]
//SEG60 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@8->test#0] -- vbuxx=vbuc1
//SEG57 [20] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
//SEG58 main::@8
//SEG59 [21] call test
//SEG60 [27] phi from main::@8 to test [phi:main::@8->test]
//SEG61 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 8 [phi:main::@8->test#0] -- vbuxx=vbuc1
ldx #8
//SEG61 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@8->test#1] -- vbuz1=vbuc1
//SEG62 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6 [phi:main::@8->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1^6
sta test.a
jsr test
//SEG62 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
//SEG63 main::@9
//SEG64 [23] call test
//SEG65 [27] phi from main::@9 to test [phi:main::@9->test]
//SEG66 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 9 [phi:main::@9->test#0] -- vbuxx=vbuc1
//SEG63 [22] phi from main::@8 to main::@9 [phi:main::@8->main::@9]
//SEG64 main::@9
//SEG65 [23] call test
//SEG66 [27] phi from main::@9 to test [phi:main::@9->test]
//SEG67 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 9 [phi:main::@9->test#0] -- vbuxx=vbuc1
ldx #9
//SEG67 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@9->test#1] -- vbuz1=vbuc1
//SEG68 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@9->test#1] -- vbuz1=vbuc1
lda #mod((3+1-1)*6/2,2)<<2>>1^6|1
sta test.a
jsr test
//SEG68 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
//SEG69 main::@10
//SEG70 [25] call test
//SEG71 [27] phi from main::@10 to test [phi:main::@10->test]
//SEG72 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 10 [phi:main::@10->test#0] -- vbuxx=vbuc1
//SEG69 [24] phi from main::@9 to main::@10 [phi:main::@9->main::@10]
//SEG70 main::@10
//SEG71 [25] call test
//SEG72 [27] phi from main::@10 to test [phi:main::@10->test]
//SEG73 [27] phi (byte) test::i#11 = (byte/signed byte/word/signed word/dword/signed dword) 10 [phi:main::@10->test#0] -- vbuxx=vbuc1
ldx #$a
//SEG73 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1&(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@10->test#1] -- vbuz1=vbuc1
//SEG74 [27] phi (byte) test::a#11 = (byte/signed byte/word/signed word/dword/signed dword) 3+(byte/signed byte/word/signed word/dword/signed dword) 1-(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 6/(byte/signed byte/word/signed word/dword/signed dword) 2%(byte/signed byte/word/signed word/dword/signed dword) 2<<(byte/signed byte/word/signed word/dword/signed dword) 2>>(byte/signed byte/word/signed word/dword/signed dword) 1^(byte/signed byte/word/signed word/dword/signed dword) 6|(byte/signed byte/word/signed word/dword/signed dword) 1&(byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main::@10->test#1] -- vbuz1=vbuc1
lda #(mod((3+1-1)*6/2,2)<<2>>1^6|1)&1
sta test.a
jsr test
//SEG74 main::@return
//SEG75 [26] return
//SEG75 main::@return
//SEG76 [26] return
rts
}
//SEG76 test
//SEG77 test
test: {
.label a = 2
//SEG77 [28] *((const byte*) screen1#0 + (byte) test::i#11) ← (byte) test::a#11 -- pbuc1_derefidx_vbuxx=vbuz1
//SEG78 [28] *((const byte*) screen1#0 + (byte) test::i#11) ← (byte) test::a#11 -- pbuc1_derefidx_vbuxx=vbuz1
lda a
sta screen1,x
//SEG78 [29] *((const byte*) screen2#0 + (byte) test::i#11) ← *((const byte[]) ref#0 + (byte) test::i#11) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG79 [29] *((const byte*) screen2#0 + (byte) test::i#11) ← *((const byte[]) ref#0 + (byte) test::i#11) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda ref,x
sta screen2,x
//SEG79 [30] if(*((const byte[]) ref#0 + (byte) test::i#11)==(byte) test::a#11) goto test::@1 -- pbuc1_derefidx_vbuxx_eq_vbuz1_then_la1
//SEG80 [30] if(*((const byte[]) ref#0 + (byte) test::i#11)==(byte) test::a#11) goto test::@1 -- pbuc1_derefidx_vbuxx_eq_vbuz1_then_la1
lda ref,x
cmp a
beq b1
//SEG80 test::@3
//SEG81 [31] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG81 test::@3
//SEG82 [31] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) RED#0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #RED
sta cols,x
//SEG82 test::@return
//SEG83 test::@return
breturn:
//SEG83 [32] return
//SEG84 [32] return
rts
//SEG84 test::@1
//SEG85 test::@1
b1:
//SEG85 [33] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG86 [33] *((const byte*) cols#0 + (byte) test::i#11) ← (const byte) GREEN#0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #GREEN
sta cols,x
jmp breturn
}
// Test compound assignment operators
ref: .byte 3, 4, 3, $12, 9, 1, 4, 2, 4, 5, 1, 0

View File

@ -460,37 +460,38 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BGCOL = $d021
// The colors of the C64
.const BLACK = 0
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @5 [phi:@begin->@5]
//SEG4 [1] phi from @begin to @5 [phi:@begin->@5]
b5_from_bbegin:
jmp b5
//SEG4 @5
//SEG5 @5
b5:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @5 to @end [phi:@5->@end]
//SEG7 [3] phi from @5 to @end [phi:@5->@end]
bend_from_b5:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BGCOL
jmp breturn
//SEG10 main::@return
//SEG11 main::@return
breturn:
//SEG11 [5] return
//SEG12 [5] return
rts
}
@ -505,37 +506,38 @@ Uplifting [main] best 27 combination
Uplifting [] best 27 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BGCOL = $d021
// The colors of the C64
.const BLACK = 0
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @5 [phi:@begin->@5]
//SEG4 [1] phi from @begin to @5 [phi:@begin->@5]
b5_from_bbegin:
jmp b5
//SEG4 @5
//SEG5 @5
b5:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @5 to @end [phi:@5->@end]
//SEG7 [3] phi from @5 to @end [phi:@5->@end]
bend_from_b5:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BGCOL
jmp breturn
//SEG10 main::@return
//SEG11 main::@return
breturn:
//SEG11 [5] return
//SEG12 [5] return
rts
}
@ -650,27 +652,28 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 12
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BGCOL = $d021
// The colors of the C64
.const BLACK = 0
//SEG2 @begin
//SEG3 [1] phi from @begin to @5 [phi:@begin->@5]
//SEG4 @5
//SEG5 [2] call main
//SEG6 [3] phi from @5 to @end [phi:@5->@end]
//SEG7 @end
//SEG8 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @5 [phi:@begin->@5]
//SEG5 @5
//SEG6 [2] call main
//SEG7 [3] phi from @5 to @end [phi:@5->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BGCOL
//SEG10 main::@return
//SEG11 [5] return
//SEG11 main::@return
//SEG12 [5] return
rts
}

File diff suppressed because it is too large Load Diff

View File

@ -122,63 +122,64 @@ Allocated zp ZP_BYTE:2 [ main::c#2 main::c#1 ]
Allocated zp ZP_BYTE:3 [ main::$1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
.label SCREEN = $400
.label _1 = 3
.label c = 2
//SEG9 [4] *((const byte*) main::SCREEN#0) ← ~(byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::SCREEN#0) ← ~(byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
lda #1^$ff
sta SCREEN
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #1
sta c
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (byte~) main::$1 ← ~ (byte) main::c#2 -- vbuz1=_bnot_vbuz2
//SEG16 [6] (byte~) main::$1 ← ~ (byte) main::c#2 -- vbuz1=_bnot_vbuz2
lda c
eor #$ff
sta _1
//SEG16 [7] *((const byte*) main::SCREEN#0 + (byte) main::c#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG17 [7] *((const byte*) main::SCREEN#0 + (byte) main::c#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuz2
lda _1
ldy c
sta SCREEN,y
//SEG17 [8] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuz1=_inc_vbuz1
//SEG18 [8] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuz1=_inc_vbuz1
inc c
//SEG18 [9] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 27) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 27) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda c
cmp #$1b
bne b1_from_b1
jmp breturn
//SEG19 main::@return
//SEG20 main::@return
breturn:
//SEG20 [10] return
//SEG21 [10] return
rts
}
@ -199,56 +200,57 @@ Uplifting [main] best 289 combination reg byte x [ main::c#2 main::c#1 ] reg byt
Uplifting [] best 289 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
.label SCREEN = $400
//SEG9 [4] *((const byte*) main::SCREEN#0) ← ~(byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::SCREEN#0) ← ~(byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
lda #1^$ff
sta SCREEN
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #1
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (byte~) main::$1 ← ~ (byte) main::c#2 -- vbuaa=_bnot_vbuxx
//SEG16 [6] (byte~) main::$1 ← ~ (byte) main::c#2 -- vbuaa=_bnot_vbuxx
txa
eor #$ff
//SEG16 [7] *((const byte*) main::SCREEN#0 + (byte) main::c#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG17 [7] *((const byte*) main::SCREEN#0 + (byte) main::c#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG17 [8] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
//SEG18 [8] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
inx
//SEG18 [9] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 27) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 27) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$1b
bne b1_from_b1
jmp breturn
//SEG19 main::@return
//SEG20 main::@return
breturn:
//SEG20 [10] return
//SEG21 [10] return
rts
}
@ -297,42 +299,43 @@ reg byte a [ main::$1 ]
FINAL ASSEMBLER
Score: 187
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
.label SCREEN = $400
//SEG9 [4] *((const byte*) main::SCREEN#0) ← ~(byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::SCREEN#0) ← ~(byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
lda #1^$ff
sta SCREEN
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] (byte~) main::$1 ← ~ (byte) main::c#2 -- vbuaa=_bnot_vbuxx
//SEG16 [6] (byte~) main::$1 ← ~ (byte) main::c#2 -- vbuaa=_bnot_vbuxx
txa
eor #$ff
//SEG16 [7] *((const byte*) main::SCREEN#0 + (byte) main::c#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG17 [7] *((const byte*) main::SCREEN#0 + (byte) main::c#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG17 [8] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
//SEG18 [8] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
inx
//SEG18 [9] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 27) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 27) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$1b
bne b1
//SEG19 main::@return
//SEG20 [10] return
//SEG20 main::@return
//SEG21 [10] return
rts
}

View File

@ -1,7 +1,7 @@
// A Minimal test of boolean constants.
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// A Minimal test of boolean constants.
.label SCREEN = $400
main: {
jsr bool_const_if

View File

@ -314,102 +314,103 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// A Minimal test of boolean constants.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
// A Minimal test of boolean constants.
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @4 [phi:@begin->@4]
//SEG4 [1] phi from @begin to @4 [phi:@begin->@4]
b4_from_bbegin:
jmp b4
//SEG4 @4
//SEG5 @4
b4:
//SEG5 [2] call main
//SEG6 [4] phi from @4 to main [phi:@4->main]
//SEG6 [2] call main
//SEG7 [4] phi from @4 to main [phi:@4->main]
main_from_b4:
jsr main
//SEG7 [3] phi from @4 to @end [phi:@4->@end]
//SEG8 [3] phi from @4 to @end [phi:@4->@end]
bend_from_b4:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] call bool_const_if
//SEG11 [17] phi from main to bool_const_if [phi:main->bool_const_if]
//SEG11 [5] call bool_const_if
//SEG12 [17] phi from main to bool_const_if [phi:main->bool_const_if]
bool_const_if_from_main:
jsr bool_const_if
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG13 main::@1
//SEG14 main::@1
b1:
//SEG14 [7] call bool_const_vars
//SEG15 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
//SEG15 [7] call bool_const_vars
//SEG16 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
bool_const_vars_from_b1:
jsr bool_const_vars
//SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG17 main::@2
//SEG18 main::@2
b2:
//SEG18 [9] call bool_const_inline
//SEG19 [11] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
//SEG19 [9] call bool_const_inline
//SEG20 [11] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
bool_const_inline_from_b2:
jsr bool_const_inline
jmp breturn
//SEG20 main::@return
//SEG21 main::@return
breturn:
//SEG21 [10] return
//SEG22 [10] return
rts
}
//SEG22 bool_const_inline
//SEG23 bool_const_inline
// A constant boolean inside an if()
bool_const_inline: {
jmp b1
//SEG23 bool_const_inline::@1
//SEG24 bool_const_inline::@1
b1:
//SEG24 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
//SEG25 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
lda #'t'
sta SCREEN+2
jmp breturn
//SEG25 bool_const_inline::@return
//SEG26 bool_const_inline::@return
breturn:
//SEG26 [13] return
//SEG27 [13] return
rts
}
//SEG27 bool_const_vars
//SEG28 bool_const_vars
// A bunch of constant boolean vars (used in an if)
bool_const_vars: {
jmp b3
//SEG28 bool_const_vars::@3
//SEG29 bool_const_vars::@3
b3:
//SEG29 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
//SEG30 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
lda #'f'
sta SCREEN+1
jmp breturn
//SEG30 bool_const_vars::@return
//SEG31 bool_const_vars::@return
breturn:
//SEG31 [16] return
//SEG32 [16] return
rts
}
//SEG32 bool_const_if
//SEG33 bool_const_if
// A constant boolean inside an if()
bool_const_if: {
jmp b1
//SEG33 bool_const_if::@1
//SEG34 bool_const_if::@1
b1:
//SEG34 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
//SEG35 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
lda #'t'
sta SCREEN
jmp breturn
//SEG35 bool_const_if::@return
//SEG36 bool_const_if::@return
breturn:
//SEG36 [19] return
//SEG37 [19] return
rts
}
@ -432,102 +433,103 @@ Uplifting [bool_const_inline] best 180 combination
Uplifting [] best 180 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// A Minimal test of boolean constants.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
// A Minimal test of boolean constants.
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @4 [phi:@begin->@4]
//SEG4 [1] phi from @begin to @4 [phi:@begin->@4]
b4_from_bbegin:
jmp b4
//SEG4 @4
//SEG5 @4
b4:
//SEG5 [2] call main
//SEG6 [4] phi from @4 to main [phi:@4->main]
//SEG6 [2] call main
//SEG7 [4] phi from @4 to main [phi:@4->main]
main_from_b4:
jsr main
//SEG7 [3] phi from @4 to @end [phi:@4->@end]
//SEG8 [3] phi from @4 to @end [phi:@4->@end]
bend_from_b4:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] call bool_const_if
//SEG11 [17] phi from main to bool_const_if [phi:main->bool_const_if]
//SEG11 [5] call bool_const_if
//SEG12 [17] phi from main to bool_const_if [phi:main->bool_const_if]
bool_const_if_from_main:
jsr bool_const_if
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG13 main::@1
//SEG14 main::@1
b1:
//SEG14 [7] call bool_const_vars
//SEG15 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
//SEG15 [7] call bool_const_vars
//SEG16 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
bool_const_vars_from_b1:
jsr bool_const_vars
//SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG17 main::@2
//SEG18 main::@2
b2:
//SEG18 [9] call bool_const_inline
//SEG19 [11] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
//SEG19 [9] call bool_const_inline
//SEG20 [11] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
bool_const_inline_from_b2:
jsr bool_const_inline
jmp breturn
//SEG20 main::@return
//SEG21 main::@return
breturn:
//SEG21 [10] return
//SEG22 [10] return
rts
}
//SEG22 bool_const_inline
//SEG23 bool_const_inline
// A constant boolean inside an if()
bool_const_inline: {
jmp b1
//SEG23 bool_const_inline::@1
//SEG24 bool_const_inline::@1
b1:
//SEG24 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
//SEG25 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
lda #'t'
sta SCREEN+2
jmp breturn
//SEG25 bool_const_inline::@return
//SEG26 bool_const_inline::@return
breturn:
//SEG26 [13] return
//SEG27 [13] return
rts
}
//SEG27 bool_const_vars
//SEG28 bool_const_vars
// A bunch of constant boolean vars (used in an if)
bool_const_vars: {
jmp b3
//SEG28 bool_const_vars::@3
//SEG29 bool_const_vars::@3
b3:
//SEG29 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
//SEG30 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
lda #'f'
sta SCREEN+1
jmp breturn
//SEG30 bool_const_vars::@return
//SEG31 bool_const_vars::@return
breturn:
//SEG31 [16] return
//SEG32 [16] return
rts
}
//SEG32 bool_const_if
//SEG33 bool_const_if
// A constant boolean inside an if()
bool_const_if: {
jmp b1
//SEG33 bool_const_if::@1
//SEG34 bool_const_if::@1
b1:
//SEG34 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
//SEG35 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
lda #'t'
sta SCREEN
jmp breturn
//SEG35 bool_const_if::@return
//SEG36 bool_const_if::@return
breturn:
//SEG36 [19] return
//SEG37 [19] return
rts
}
@ -602,70 +604,71 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 60
//SEG0 Basic Upstart
//SEG0 File Comments
// A Minimal test of boolean constants.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
// A Minimal test of boolean constants.
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @4 [phi:@begin->@4]
//SEG4 @4
//SEG5 [2] call main
//SEG6 [4] phi from @4 to main [phi:@4->main]
//SEG7 [3] phi from @4 to @end [phi:@4->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @4 [phi:@begin->@4]
//SEG5 @4
//SEG6 [2] call main
//SEG7 [4] phi from @4 to main [phi:@4->main]
//SEG8 [3] phi from @4 to @end [phi:@4->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG10 [5] call bool_const_if
//SEG11 [17] phi from main to bool_const_if [phi:main->bool_const_if]
//SEG11 [5] call bool_const_if
//SEG12 [17] phi from main to bool_const_if [phi:main->bool_const_if]
jsr bool_const_if
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG13 main::@1
//SEG14 [7] call bool_const_vars
//SEG15 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG14 main::@1
//SEG15 [7] call bool_const_vars
//SEG16 [14] phi from main::@1 to bool_const_vars [phi:main::@1->bool_const_vars]
jsr bool_const_vars
//SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG17 main::@2
//SEG18 [9] call bool_const_inline
//SEG19 [11] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
//SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG18 main::@2
//SEG19 [9] call bool_const_inline
//SEG20 [11] phi from main::@2 to bool_const_inline [phi:main::@2->bool_const_inline]
jsr bool_const_inline
//SEG20 main::@return
//SEG21 [10] return
//SEG21 main::@return
//SEG22 [10] return
rts
}
//SEG22 bool_const_inline
//SEG23 bool_const_inline
// A constant boolean inside an if()
bool_const_inline: {
//SEG23 bool_const_inline::@1
//SEG24 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
//SEG24 bool_const_inline::@1
//SEG25 [12] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) 't' -- _deref_pbuc1=vbuc2
lda #'t'
sta SCREEN+2
//SEG25 bool_const_inline::@return
//SEG26 [13] return
//SEG26 bool_const_inline::@return
//SEG27 [13] return
rts
}
//SEG27 bool_const_vars
//SEG28 bool_const_vars
// A bunch of constant boolean vars (used in an if)
bool_const_vars: {
//SEG28 bool_const_vars::@3
//SEG29 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
//SEG29 bool_const_vars::@3
//SEG30 [15] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) 'f' -- _deref_pbuc1=vbuc2
lda #'f'
sta SCREEN+1
//SEG30 bool_const_vars::@return
//SEG31 [16] return
//SEG31 bool_const_vars::@return
//SEG32 [16] return
rts
}
//SEG32 bool_const_if
//SEG33 bool_const_if
// A constant boolean inside an if()
bool_const_if: {
//SEG33 bool_const_if::@1
//SEG34 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
//SEG34 bool_const_if::@1
//SEG35 [18] *((const byte*) SCREEN#0) ← (byte) 't' -- _deref_pbuc1=vbuc2
lda #'t'
sta SCREEN
//SEG35 bool_const_if::@return
//SEG36 [19] return
//SEG36 bool_const_if::@return
//SEG37 [19] return
rts
}

View File

@ -1,7 +1,7 @@
// Test a function taking boolean parameter and returning boolean result
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Test a function taking boolean parameter and returning boolean result
main: {
.label screen = $400
ldx #0

View File

@ -255,51 +255,52 @@ Allocated zp ZP_BOOL:9 [ isSet::$1 ]
Allocated zp ZP_BOOL:10 [ isSet::return#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a function taking boolean parameter and returning boolean result
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Test a function taking boolean parameter and returning boolean result
//SEG10 main
main: {
.label screen = $400
.label _0 = 3
.label _2 = 7
.label i = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG13 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_band_vbuc1
//SEG16 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_band_vbuc1
lda #1
and i
sta _0
//SEG16 [7] (bool) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboz1=vbuz2_eq_vbuc1
//SEG17 [7] (bool) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboz1=vbuz2_eq_vbuc1
lda _0
cmp #0
beq !+
@ -307,54 +308,54 @@ main: {
!:
eor #1
sta isSet.b
//SEG17 [8] (byte) isSet::i#0 ← (byte) main::i#2 -- vbuz1=vbuz2
//SEG18 [8] (byte) isSet::i#0 ← (byte) main::i#2 -- vbuz1=vbuz2
lda i
sta isSet.i
//SEG18 [9] call isSet
//SEG19 [9] call isSet
jsr isSet
//SEG19 [10] (bool) isSet::return#0 ← (bool) isSet::return#1 -- vboz1=vboz2
//SEG20 [10] (bool) isSet::return#0 ← (bool) isSet::return#1 -- vboz1=vboz2
lda isSet.return_1
sta isSet.return
jmp b7
//SEG20 main::@7
//SEG21 main::@7
b7:
//SEG21 [11] (bool~) main::$2 ← (bool) isSet::return#0 -- vboz1=vboz2
//SEG22 [11] (bool~) main::$2 ← (bool) isSet::return#0 -- vboz1=vboz2
lda isSet.return
sta _2
//SEG22 [12] if((bool~) main::$2) goto main::@2 -- vboz1_then_la1
//SEG23 [12] if((bool~) main::$2) goto main::@2 -- vboz1_then_la1
lda _2
cmp #0
bne b2
jmp b4
//SEG23 main::@4
//SEG24 main::@4
b4:
//SEG24 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' -- pbuc1_derefidx_vbuz1=vbuc2
//SEG25 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' -- pbuc1_derefidx_vbuz1=vbuc2
ldy i
lda #' '
sta screen,y
jmp b3
//SEG25 main::@3
//SEG26 main::@3
b3:
//SEG26 [14] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
//SEG27 [14] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG27 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG28 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$65
bne b1_from_b3
jmp breturn
//SEG28 main::@return
//SEG29 main::@return
breturn:
//SEG29 [16] return
//SEG30 [16] return
rts
//SEG30 main::@2
//SEG31 main::@2
b2:
//SEG31 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuz1=vbuc2
//SEG32 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuz1=vbuc2
ldy i
lda #'*'
sta screen,y
jmp b3
}
//SEG32 isSet
//SEG33 isSet
// Determine whether to set a char to '*.
// Returns true if i&8!=0 or b=true
isSet: {
@ -364,25 +365,25 @@ isSet: {
.label b = 4
.label return = 6
.label return_1 = $a
//SEG33 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuz1=vbuz2_band_vbuc1
//SEG34 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuz1=vbuz2_band_vbuc1
lda #8
and i
sta _0
//SEG34 [19] (bool~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboz1=vbuz2_neq_vbuc1
//SEG35 [19] (bool~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboz1=vbuz2_neq_vbuc1
lda _0
cmp #0
beq !+
lda #1
!:
sta _1
//SEG35 [20] (bool) isSet::return#1 ← (bool) isSet::b#0 || (bool~) isSet::$1 -- vboz1=vboz2_or_vboz3
//SEG36 [20] (bool) isSet::return#1 ← (bool) isSet::b#0 || (bool~) isSet::$1 -- vboz1=vboz2_or_vboz3
lda b
ora _1
sta return_1
jmp breturn
//SEG36 isSet::@return
//SEG37 isSet::@return
breturn:
//SEG37 [21] return
//SEG38 [21] return
rts
}
@ -425,108 +426,109 @@ Uplifting [] best 735 combination
Allocated (was zp ZP_BOOL:4) zp ZP_BOOL:2 [ isSet::b#0 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a function taking boolean parameter and returning boolean result
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Test a function taking boolean parameter and returning boolean result
//SEG10 main
main: {
.label screen = $400
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG13 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1
//SEG16 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1
txa
and #1
//SEG16 [7] (bool) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboz1=vbuaa_eq_vbuc1
//SEG17 [7] (bool) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboz1=vbuaa_eq_vbuc1
cmp #0
beq !+
lda #1
!:
eor #1
sta isSet.b
//SEG17 [8] (byte) isSet::i#0 ← (byte) main::i#2
//SEG18 [9] call isSet
//SEG18 [8] (byte) isSet::i#0 ← (byte) main::i#2
//SEG19 [9] call isSet
jsr isSet
//SEG19 [10] (bool) isSet::return#0 ← (bool) isSet::return#1
//SEG20 [10] (bool) isSet::return#0 ← (bool) isSet::return#1
jmp b7
//SEG20 main::@7
//SEG21 main::@7
b7:
//SEG21 [11] (bool~) main::$2 ← (bool) isSet::return#0
//SEG22 [12] if((bool~) main::$2) goto main::@2 -- vboaa_then_la1
//SEG22 [11] (bool~) main::$2 ← (bool) isSet::return#0
//SEG23 [12] if((bool~) main::$2) goto main::@2 -- vboaa_then_la1
cmp #0
bne b2
jmp b4
//SEG23 main::@4
//SEG24 main::@4
b4:
//SEG24 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2
//SEG25 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
sta screen,x
jmp b3
//SEG25 main::@3
//SEG26 main::@3
b3:
//SEG26 [14] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG27 [14] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG27 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG28 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1_from_b3
jmp breturn
//SEG28 main::@return
//SEG29 main::@return
breturn:
//SEG29 [16] return
//SEG30 [16] return
rts
//SEG30 main::@2
//SEG31 main::@2
b2:
//SEG31 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2
//SEG32 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2
lda #'*'
sta screen,x
jmp b3
}
//SEG32 isSet
//SEG33 isSet
// Determine whether to set a char to '*.
// Returns true if i&8!=0 or b=true
isSet: {
.label b = 2
//SEG33 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuaa=vbuxx_band_vbuc1
//SEG34 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuaa=vbuxx_band_vbuc1
txa
and #8
//SEG34 [19] (bool~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboaa=vbuaa_neq_vbuc1
//SEG35 [19] (bool~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboaa=vbuaa_neq_vbuc1
cmp #0
beq !+
lda #1
!:
//SEG35 [20] (bool) isSet::return#1 ← (bool) isSet::b#0 || (bool~) isSet::$1 -- vboaa=vboz1_or_vboaa
//SEG36 [20] (bool) isSet::return#1 ← (bool) isSet::b#0 || (bool~) isSet::$1 -- vboaa=vboz1_or_vboaa
ora b
jmp breturn
//SEG36 isSet::@return
//SEG37 isSet::@return
breturn:
//SEG37 [21] return
//SEG38 [21] return
rts
}
@ -606,86 +608,87 @@ reg byte a [ isSet::return#1 ]
FINAL ASSEMBLER
Score: 540
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a function taking boolean parameter and returning boolean result
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 @2
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 @end
//SEG9 main
// Test a function taking boolean parameter and returning boolean result
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG5 @2
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
//SEG9 @end
//SEG10 main
main: {
.label screen = $400
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1
//SEG16 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1
txa
and #1
//SEG16 [7] (bool) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboz1=vbuaa_eq_vbuc1
//SEG17 [7] (bool) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboz1=vbuaa_eq_vbuc1
cmp #0
beq !+
lda #1
!:
eor #1
sta isSet.b
//SEG17 [8] (byte) isSet::i#0 ← (byte) main::i#2
//SEG18 [9] call isSet
//SEG18 [8] (byte) isSet::i#0 ← (byte) main::i#2
//SEG19 [9] call isSet
jsr isSet
//SEG19 [10] (bool) isSet::return#0 ← (bool) isSet::return#1
//SEG20 main::@7
//SEG21 [11] (bool~) main::$2 ← (bool) isSet::return#0
//SEG22 [12] if((bool~) main::$2) goto main::@2 -- vboaa_then_la1
//SEG20 [10] (bool) isSet::return#0 ← (bool) isSet::return#1
//SEG21 main::@7
//SEG22 [11] (bool~) main::$2 ← (bool) isSet::return#0
//SEG23 [12] if((bool~) main::$2) goto main::@2 -- vboaa_then_la1
cmp #0
bne b2
//SEG23 main::@4
//SEG24 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2
//SEG24 main::@4
//SEG25 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
sta screen,x
//SEG25 main::@3
//SEG26 main::@3
b3:
//SEG26 [14] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG27 [14] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG27 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG28 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1
//SEG28 main::@return
//SEG29 [16] return
//SEG29 main::@return
//SEG30 [16] return
rts
//SEG30 main::@2
//SEG31 main::@2
b2:
//SEG31 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2
//SEG32 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2
lda #'*'
sta screen,x
jmp b3
}
//SEG32 isSet
//SEG33 isSet
// Determine whether to set a char to '*.
// Returns true if i&8!=0 or b=true
isSet: {
.label b = 2
//SEG33 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuaa=vbuxx_band_vbuc1
//SEG34 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuaa=vbuxx_band_vbuc1
txa
and #8
//SEG34 [19] (bool~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboaa=vbuaa_neq_vbuc1
//SEG35 [19] (bool~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 -- vboaa=vbuaa_neq_vbuc1
cmp #0
beq !+
lda #1
!:
//SEG35 [20] (bool) isSet::return#1 ← (bool) isSet::b#0 || (bool~) isSet::$1 -- vboaa=vboz1_or_vboaa
//SEG36 [20] (bool) isSet::return#1 ← (bool) isSet::b#0 || (bool~) isSet::$1 -- vboaa=vboz1_or_vboaa
ora b
//SEG36 isSet::@return
//SEG37 [21] return
//SEG37 isSet::@return
//SEG38 [21] return
rts
}

View File

@ -1,7 +1,7 @@
// A test of boolean conditions using && || and !
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// A test of boolean conditions using && || and !
main: {
jsr bool_and
jsr bool_or

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Tests a pointer to a boolean
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Tests a pointer to a boolean
main: {
lda #1
sta $400

View File

@ -114,49 +114,50 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests a pointer to a boolean
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Tests a pointer to a boolean
//SEG9 main
main: {
//SEG9 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
//SEG10 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
lda #1
sta $400
//SEG10 [5] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 1) ← false -- _deref_pboc1=vboc2
//SEG11 [5] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 1) ← false -- _deref_pboc1=vboc2
lda #0
sta $400+1
//SEG11 [6] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
//SEG12 [6] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
lda #1
sta $400+2
//SEG12 [7] if(*(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2)) goto main::@2 -- _deref_pboc1_then_la1
//SEG13 [7] if(*(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2)) goto main::@2 -- _deref_pboc1_then_la1
lda $400+2
cmp #0
bne b2
jmp breturn
//SEG13 main::@return
//SEG14 main::@return
breturn:
//SEG14 [8] return
//SEG15 [8] return
rts
//SEG15 main::@2
//SEG16 main::@2
b2:
//SEG16 [9] *(++((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
//SEG17 [9] *(++((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
lda #1
sta $400+2+1
jmp breturn
@ -177,49 +178,50 @@ Uplifting [main] best 56 combination
Uplifting [] best 56 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests a pointer to a boolean
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Tests a pointer to a boolean
//SEG9 main
main: {
//SEG9 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
//SEG10 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
lda #1
sta $400
//SEG10 [5] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 1) ← false -- _deref_pboc1=vboc2
//SEG11 [5] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 1) ← false -- _deref_pboc1=vboc2
lda #0
sta $400+1
//SEG11 [6] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
//SEG12 [6] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
lda #1
sta $400+2
//SEG12 [7] if(*(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2)) goto main::@2 -- _deref_pboc1_then_la1
//SEG13 [7] if(*(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2)) goto main::@2 -- _deref_pboc1_then_la1
lda $400+2
cmp #0
bne b2
jmp breturn
//SEG13 main::@return
//SEG14 main::@return
breturn:
//SEG14 [8] return
//SEG15 [8] return
rts
//SEG15 main::@2
//SEG16 main::@2
b2:
//SEG16 [9] *(++((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
//SEG17 [9] *(++((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
lda #1
sta $400+2+1
jmp breturn
@ -258,39 +260,40 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 37
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests a pointer to a boolean
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
// Tests a pointer to a boolean
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG9 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
//SEG10 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
lda #1
sta $400
//SEG10 [5] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 1) ← false -- _deref_pboc1=vboc2
//SEG11 [5] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 1) ← false -- _deref_pboc1=vboc2
lda #0
sta $400+1
//SEG11 [6] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
//SEG12 [6] *(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
lda #1
sta $400+2
//SEG12 [7] if(*(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2)) goto main::@2 -- _deref_pboc1_then_la1
//SEG13 [7] if(*(((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2)) goto main::@2 -- _deref_pboc1_then_la1
cmp #0
bne b2
//SEG13 main::@return
//SEG14 main::@return
breturn:
//SEG14 [8] return
//SEG15 [8] return
rts
//SEG15 main::@2
//SEG16 main::@2
b2:
//SEG16 [9] *(++((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
//SEG17 [9] *(++((bool*))(word/signed word/dword/signed dword) 1024+(byte/signed byte/word/signed word/dword/signed dword) 2) ← true -- _deref_pboc1=vboc2
lda #1
sta $400+2+1
jmp breturn

View File

@ -1,7 +1,7 @@
// A test of boolean conditions using && || and !
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// A test of boolean conditions using && || and !
main: {
jsr bool_and
jsr bool_or

File diff suppressed because it is too large Load Diff

View File

@ -354,30 +354,31 @@ Allocated zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ]
Allocated zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const STAR = $51
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.const x1 = $27
.const y1 = $18
@ -387,58 +388,58 @@ main: {
.label cursor = 2
.label e = 5
.label y = 6
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #4
sta y
//SEG12 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuz1=vbuc1
//SEG13 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuz1=vbuc1
lda #yd/2
sta e
//SEG13 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#2] -- vbuz1=vbuc1
//SEG14 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#2] -- vbuz1=vbuc1
lda #4
sta x
//SEG14 [5] phi (byte*) main::cursor#3 = (const byte[40*25]) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4*(byte/signed byte/word/signed word/dword/signed dword) 40+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#3] -- pbuz1=pbuc1
//SEG15 [5] phi (byte*) main::cursor#3 = (const byte[40*25]) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4*(byte/signed byte/word/signed word/dword/signed dword) 40+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#3] -- pbuz1=pbuc1
lda #<SCREEN+4*$28+4
sta cursor
lda #>SCREEN+4*$28+4
sta cursor+1
jmp b1
//SEG15 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG16 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
//SEG16 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG17 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG19 [5] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 [phi:main::@2->main::@1#3] -- register_copy
//SEG17 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG18 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG20 [5] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 [phi:main::@2->main::@1#3] -- register_copy
jmp b1
//SEG20 main::@1
//SEG21 main::@1
b1:
//SEG21 [6] *((byte*) main::cursor#3) ← (const byte) STAR#0 -- _deref_pbuz1=vbuc1
//SEG22 [6] *((byte*) main::cursor#3) ← (const byte) STAR#0 -- _deref_pbuz1=vbuc1
lda #STAR
ldy #0
sta (cursor),y
//SEG22 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc x
//SEG23 [8] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuz1=pbuz1_plus_1
//SEG24 [8] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuz1=pbuz1_plus_1
inc cursor
bne !+
inc cursor+1
!:
//SEG24 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuz1=vbuz1_plus_vbuc1
//SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuz1=vbuz1_plus_vbuc1
lda #yd
clc
adc e
sta e
//SEG25 [10] if((const byte) main::xd#0>(byte) main::e#1) goto main::@2 -- vbuc1_gt_vbuz1_then_la1
//SEG26 [10] if((const byte) main::xd#0>(byte) main::e#1) goto main::@2 -- vbuc1_gt_vbuz1_then_la1
lda e
cmp #xd
bcc b2_from_b1
jmp b3
//SEG26 main::@3
//SEG27 main::@3
b3:
//SEG27 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc y
//SEG28 [12] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG29 [12] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda cursor
clc
adc #$28
@ -446,28 +447,28 @@ main: {
bcc !+
inc cursor+1
!:
//SEG29 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuz1=vbuz1_minus_vbuc1
//SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuz1=vbuz1_minus_vbuc1
lda e
sec
sbc #xd
sta e
//SEG30 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
//SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
b2_from_b1:
b2_from_b3:
//SEG31 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG32 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG33 [14] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
//SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG34 [14] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
jmp b2
//SEG34 main::@2
//SEG35 main::@2
b2:
//SEG35 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
//SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda x
cmp #x1+1
bcc b1_from_b2
jmp breturn
//SEG36 main::@return
//SEG37 main::@return
breturn:
//SEG37 [16] return
//SEG38 [16] return
rts
}
@ -504,30 +505,31 @@ Uplifting [main] best 1168 combination zp ZP_BYTE:4 [ main::x#2 main::x#1 ]
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const STAR = $51
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.const x1 = $27
.const y1 = $18
@ -536,56 +538,56 @@ main: {
.label x = 4
.label cursor = 2
.label y = 5
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #4
sta y
//SEG12 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1
//SEG13 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1
ldx #yd/2
//SEG13 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#2] -- vbuz1=vbuc1
//SEG14 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#2] -- vbuz1=vbuc1
lda #4
sta x
//SEG14 [5] phi (byte*) main::cursor#3 = (const byte[40*25]) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4*(byte/signed byte/word/signed word/dword/signed dword) 40+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#3] -- pbuz1=pbuc1
//SEG15 [5] phi (byte*) main::cursor#3 = (const byte[40*25]) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4*(byte/signed byte/word/signed word/dword/signed dword) 40+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#3] -- pbuz1=pbuc1
lda #<SCREEN+4*$28+4
sta cursor
lda #>SCREEN+4*$28+4
sta cursor+1
jmp b1
//SEG15 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG16 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
//SEG16 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG17 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG19 [5] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 [phi:main::@2->main::@1#3] -- register_copy
//SEG17 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG18 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG20 [5] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 [phi:main::@2->main::@1#3] -- register_copy
jmp b1
//SEG20 main::@1
//SEG21 main::@1
b1:
//SEG21 [6] *((byte*) main::cursor#3) ← (const byte) STAR#0 -- _deref_pbuz1=vbuc1
//SEG22 [6] *((byte*) main::cursor#3) ← (const byte) STAR#0 -- _deref_pbuz1=vbuc1
lda #STAR
ldy #0
sta (cursor),y
//SEG22 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc x
//SEG23 [8] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuz1=pbuz1_plus_1
//SEG24 [8] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuz1=pbuz1_plus_1
inc cursor
bne !+
inc cursor+1
!:
//SEG24 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuxx=vbuxx_plus_vbuc1
//SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuxx=vbuxx_plus_vbuc1
txa
clc
adc #yd
tax
//SEG25 [10] if((const byte) main::xd#0>(byte) main::e#1) goto main::@2 -- vbuc1_gt_vbuxx_then_la1
//SEG26 [10] if((const byte) main::xd#0>(byte) main::e#1) goto main::@2 -- vbuc1_gt_vbuxx_then_la1
cpx #xd
bcc b2_from_b1
jmp b3
//SEG26 main::@3
//SEG27 main::@3
b3:
//SEG27 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc y
//SEG28 [12] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG29 [12] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda cursor
clc
adc #$28
@ -593,28 +595,28 @@ main: {
bcc !+
inc cursor+1
!:
//SEG29 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuxx=vbuxx_minus_vbuc1
//SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuxx=vbuxx_minus_vbuc1
txa
sec
sbc #xd
tax
//SEG30 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
//SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
b2_from_b1:
b2_from_b3:
//SEG31 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG32 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG33 [14] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
//SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG34 [14] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
jmp b2
//SEG34 main::@2
//SEG35 main::@2
b2:
//SEG35 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
//SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda x
cmp #x1+1
bcc b1_from_b2
jmp breturn
//SEG36 main::@return
//SEG37 main::@return
breturn:
//SEG37 [16] return
//SEG38 [16] return
rts
}
@ -701,21 +703,22 @@ zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ]
FINAL ASSEMBLER
Score: 986
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.const STAR = $51
.label SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.const x1 = $27
.const y1 = $18
@ -724,49 +727,49 @@ main: {
.label x = 4
.label cursor = 2
.label y = 5
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #4
sta y
//SEG12 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1
//SEG13 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1
ldx #yd/2
//SEG13 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#2] -- vbuz1=vbuc1
//SEG14 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#2] -- vbuz1=vbuc1
sta x
//SEG14 [5] phi (byte*) main::cursor#3 = (const byte[40*25]) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4*(byte/signed byte/word/signed word/dword/signed dword) 40+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#3] -- pbuz1=pbuc1
//SEG15 [5] phi (byte*) main::cursor#3 = (const byte[40*25]) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 4*(byte/signed byte/word/signed word/dword/signed dword) 40+(byte/signed byte/word/signed word/dword/signed dword) 4 [phi:main->main::@1#3] -- pbuz1=pbuc1
lda #<SCREEN+4*$28+4
sta cursor
lda #>SCREEN+4*$28+4
sta cursor+1
//SEG15 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG16 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG17 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG19 [5] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 [phi:main::@2->main::@1#3] -- register_copy
//SEG20 main::@1
//SEG16 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG17 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG18 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG20 [5] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 [phi:main::@2->main::@1#3] -- register_copy
//SEG21 main::@1
b1:
//SEG21 [6] *((byte*) main::cursor#3) ← (const byte) STAR#0 -- _deref_pbuz1=vbuc1
//SEG22 [6] *((byte*) main::cursor#3) ← (const byte) STAR#0 -- _deref_pbuz1=vbuc1
lda #STAR
ldy #0
sta (cursor),y
//SEG22 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc x
//SEG23 [8] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuz1=pbuz1_plus_1
//SEG24 [8] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuz1=pbuz1_plus_1
inc cursor
bne !+
inc cursor+1
!:
//SEG24 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuxx=vbuxx_plus_vbuc1
//SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuxx=vbuxx_plus_vbuc1
txa
clc
adc #yd
tax
//SEG25 [10] if((const byte) main::xd#0>(byte) main::e#1) goto main::@2 -- vbuc1_gt_vbuxx_then_la1
//SEG26 [10] if((const byte) main::xd#0>(byte) main::e#1) goto main::@2 -- vbuc1_gt_vbuxx_then_la1
cpx #xd
bcc b2
//SEG26 main::@3
//SEG27 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG27 main::@3
//SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc y
//SEG28 [12] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG29 [12] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda cursor
clc
adc #$28
@ -774,23 +777,23 @@ main: {
bcc !+
inc cursor+1
!:
//SEG29 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuxx=vbuxx_minus_vbuc1
//SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuxx=vbuxx_minus_vbuc1
txa
sec
sbc #xd
tax
//SEG30 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
//SEG31 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG32 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG33 [14] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
//SEG34 main::@2
//SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
//SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG34 [14] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
//SEG35 main::@2
b2:
//SEG35 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
//SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda x
cmp #x1+1
bcc b1
//SEG36 main::@return
//SEG37 [16] return
//SEG37 main::@return
//SEG38 [16] return
rts
}

View File

@ -345,28 +345,29 @@ Allocated zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ]
Allocated zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.const STAR = $51
.label screen = $400
@ -378,33 +379,33 @@ main: {
.label idx = 2
.label e = 5
.label y = 6
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta y
//SEG12 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuz1=vbuc1
//SEG13 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuz1=vbuc1
lda #yd/2
sta e
//SEG13 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuz1=vbuc1
//SEG14 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuz1=vbuc1
lda #0
sta x
//SEG14 [5] phi (word) main::idx#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#3] -- vwuz1=vbuc1
//SEG15 [5] phi (word) main::idx#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#3] -- vwuz1=vbuc1
lda #<0
sta idx
lda #>0
sta idx+1
jmp b1
//SEG15 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG16 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
//SEG16 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG17 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG19 [5] phi (word) main::idx#3 = (word) main::idx#5 [phi:main::@2->main::@1#3] -- register_copy
//SEG17 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG18 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG20 [5] phi (word) main::idx#3 = (word) main::idx#5 [phi:main::@2->main::@1#3] -- register_copy
jmp b1
//SEG20 main::@1
//SEG21 main::@1
b1:
//SEG21 [6] *((const byte[40*25]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2
//SEG22 [6] *((const byte[40*25]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2
lda #<screen
clc
adc idx
@ -415,28 +416,28 @@ main: {
lda #STAR
!:
sta screen
//SEG22 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc x
//SEG23 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1
//SEG24 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1
inc idx
bne !+
inc idx+1
!:
//SEG24 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuz1=vbuz1_plus_vbuc1
//SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuz1=vbuz1_plus_vbuc1
lda #yd
clc
adc e
sta e
//SEG25 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuz1_then_la1
//SEG26 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuz1_then_la1
lda #xd
cmp e
bcs b2_from_b1
jmp b3
//SEG26 main::@3
//SEG27 main::@3
b3:
//SEG27 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc y
//SEG28 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- vwuz1=vwuz1_plus_vbuc1
//SEG29 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- vwuz1=vwuz1_plus_vbuc1
clc
lda idx
adc #<$28
@ -444,28 +445,28 @@ main: {
lda idx+1
adc #>$28
sta idx+1
//SEG29 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuz1=vbuz1_minus_vbuc1
//SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuz1=vbuz1_minus_vbuc1
lda e
sec
sbc #xd
sta e
//SEG30 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
//SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
b2_from_b1:
b2_from_b3:
//SEG31 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG32 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG33 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
//SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG34 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
jmp b2
//SEG34 main::@2
//SEG35 main::@2
b2:
//SEG35 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
//SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda x
cmp #x1+1
bcc b1_from_b2
jmp breturn
//SEG36 main::@return
//SEG37 main::@return
breturn:
//SEG37 [16] return
//SEG38 [16] return
rts
}
@ -497,28 +498,29 @@ Uplifting [main] best 1268 combination zp ZP_BYTE:6 [ main::y#2 main::y#4 main::
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ main::y#2 main::y#4 main::y#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.const STAR = $51
.label screen = $400
@ -528,31 +530,31 @@ main: {
.const yd = y1-0
.label idx = 2
.label y = 4
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta y
//SEG12 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuyy=vbuc1
//SEG13 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuyy=vbuc1
ldy #yd/2
//SEG13 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuxx=vbuc1
//SEG14 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuxx=vbuc1
ldx #0
//SEG14 [5] phi (word) main::idx#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#3] -- vwuz1=vbuc1
//SEG15 [5] phi (word) main::idx#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#3] -- vwuz1=vbuc1
lda #<0
sta idx
lda #>0
sta idx+1
jmp b1
//SEG15 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG16 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
//SEG16 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG17 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG19 [5] phi (word) main::idx#3 = (word) main::idx#5 [phi:main::@2->main::@1#3] -- register_copy
//SEG17 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG18 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG20 [5] phi (word) main::idx#3 = (word) main::idx#5 [phi:main::@2->main::@1#3] -- register_copy
jmp b1
//SEG20 main::@1
//SEG21 main::@1
b1:
//SEG21 [6] *((const byte[40*25]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2
//SEG22 [6] *((const byte[40*25]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2
lda #<screen
clc
adc idx
@ -563,28 +565,28 @@ main: {
lda #STAR
!:
sta screen
//SEG22 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_plus_1
//SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_plus_1
inx
//SEG23 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1
//SEG24 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1
inc idx
bne !+
inc idx+1
!:
//SEG24 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuyy=vbuyy_plus_vbuc1
//SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuyy=vbuyy_plus_vbuc1
tya
clc
adc #yd
tay
//SEG25 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuyy_then_la1
//SEG26 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuyy_then_la1
cpy #xd
bcc b2_from_b1
beq b2_from_b1
jmp b3
//SEG26 main::@3
//SEG27 main::@3
b3:
//SEG27 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc y
//SEG28 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- vwuz1=vwuz1_plus_vbuc1
//SEG29 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- vwuz1=vwuz1_plus_vbuc1
clc
lda idx
adc #<$28
@ -592,27 +594,27 @@ main: {
lda idx+1
adc #>$28
sta idx+1
//SEG29 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuyy=vbuyy_minus_vbuc1
//SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuyy=vbuyy_minus_vbuc1
tya
sec
sbc #xd
tay
//SEG30 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
//SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
b2_from_b1:
b2_from_b3:
//SEG31 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG32 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG33 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
//SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG34 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
jmp b2
//SEG34 main::@2
//SEG35 main::@2
b2:
//SEG35 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_lt_vbuc1_then_la1
//SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_lt_vbuc1_then_la1
cpx #x1+1
bcc b1_from_b2
jmp breturn
//SEG36 main::@return
//SEG37 main::@return
breturn:
//SEG37 [16] return
//SEG38 [16] return
rts
}
@ -702,19 +704,20 @@ zp ZP_BYTE:4 [ main::y#2 main::y#4 main::y#1 ]
FINAL ASSEMBLER
Score: 1066
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.const STAR = $51
.label screen = $400
@ -724,25 +727,25 @@ main: {
.const yd = y1-0
.label idx = 2
.label y = 4
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta y
//SEG12 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuyy=vbuc1
//SEG13 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuyy=vbuc1
ldy #yd/2
//SEG13 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuxx=vbuc1
//SEG14 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuxx=vbuc1
tax
//SEG14 [5] phi (word) main::idx#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#3] -- vwuz1=vbuc1
//SEG15 [5] phi (word) main::idx#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#3] -- vwuz1=vbuc1
sta idx
sta idx+1
//SEG15 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG16 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG17 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG19 [5] phi (word) main::idx#3 = (word) main::idx#5 [phi:main::@2->main::@1#3] -- register_copy
//SEG20 main::@1
//SEG16 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG17 [5] phi (byte) main::y#2 = (byte) main::y#4 [phi:main::@2->main::@1#0] -- register_copy
//SEG18 [5] phi (byte) main::e#3 = (byte) main::e#5 [phi:main::@2->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@2->main::@1#2] -- register_copy
//SEG20 [5] phi (word) main::idx#3 = (word) main::idx#5 [phi:main::@2->main::@1#3] -- register_copy
//SEG21 main::@1
b1:
//SEG21 [6] *((const byte[40*25]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2
//SEG22 [6] *((const byte[40*25]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2
lda #<screen
clc
adc idx
@ -753,26 +756,26 @@ main: {
lda #STAR
!:
sta screen
//SEG22 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_plus_1
//SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_plus_1
inx
//SEG23 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1
//SEG24 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1
inc idx
bne !+
inc idx+1
!:
//SEG24 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuyy=vbuyy_plus_vbuc1
//SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuyy=vbuyy_plus_vbuc1
tya
clc
adc #yd
tay
//SEG25 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuyy_then_la1
//SEG26 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuyy_then_la1
cpy #xd
bcc b2
beq b2
//SEG26 main::@3
//SEG27 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
//SEG27 main::@3
//SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1
inc y
//SEG28 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- vwuz1=vwuz1_plus_vbuc1
//SEG29 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- vwuz1=vwuz1_plus_vbuc1
clc
lda idx
adc #<$28
@ -780,22 +783,22 @@ main: {
lda idx+1
adc #>$28
sta idx+1
//SEG29 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuyy=vbuyy_minus_vbuc1
//SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuyy=vbuyy_minus_vbuc1
tya
sec
sbc #xd
tay
//SEG30 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
//SEG31 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG32 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG33 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
//SEG34 main::@2
//SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
//SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
//SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy
//SEG34 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy
//SEG35 main::@2
b2:
//SEG35 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_lt_vbuc1_then_la1
//SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuxx_lt_vbuc1_then_la1
cpx #x1+1
bcc b1
//SEG36 main::@return
//SEG37 [16] return
//SEG37 main::@return
//SEG38 [16] return
rts
}

View File

@ -1,7 +1,7 @@
// C64DTV 8bpp charmode stretcher
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Commodore 64 Registers and Constants
// Processor port data direction register
.label PROCPORT_DDR = 0
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// C64DTV 8bpp charmode stretcher
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Commodore 64 Registers and Constants
// Processor port data direction register
.label PROCPORT_DDR = 0
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written

File diff suppressed because it is too large Load Diff

View File

@ -1175,11 +1175,12 @@ Allocated zp ZP_BYTE:2 [ main::r#2 main::r#1 ]
Allocated zp ZP_BYTE:3 [ main::$15 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
// Feature enables or disables the extra C64 DTV features
.label DTV_FEATURE = $d03f
.const DTV_FEATURE_ENABLE = 1
@ -1249,159 +1250,159 @@ INITIAL ASM
.const DTV_BLIT_STATUS_BUSY = 1
.label SCREEN = $400
.const SRCA_LEN = 9
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @6 [phi:@begin->@6]
//SEG4 [1] phi from @begin to @6 [phi:@begin->@6]
b6_from_bbegin:
jmp b6
//SEG4 @6
//SEG5 @6
b6:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @6 to @end [phi:@6->@end]
//SEG7 [3] phi from @6 to @end [phi:@6->@end]
bend_from_b6:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
.label _15 = 3
.label r = 2
//SEG9 [4] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
lda #DTV_FEATURE_ENABLE
sta DTV_FEATURE
//SEG10 [5] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_CLEAR_IRQ#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_CLEAR_IRQ#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_CLEAR_IRQ
sta DTV_BLITTER_CONTROL2
//SEG11 [6] *((const byte*) DTV_BLITTER_SRCA_LO#0) ← <(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) DTV_BLITTER_SRCA_LO#0) ← <(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
lda #<SRCA
sta DTV_BLITTER_SRCA_LO
//SEG12 [7] *((const byte*) DTV_BLITTER_SRCA_MI#0) ← >(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
//SEG13 [7] *((const byte*) DTV_BLITTER_SRCA_MI#0) ← >(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
lda #>SRCA
sta DTV_BLITTER_SRCA_MI
//SEG13 [8] *((const byte*) DTV_BLITTER_SRCA_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG14 [8] *((const byte*) DTV_BLITTER_SRCA_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCA_HI
//SEG14 [9] *((const byte*) DTV_BLITTER_SRCA_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG15 [9] *((const byte*) DTV_BLITTER_SRCA_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCA_MOD_LO
//SEG15 [10] *((const byte*) DTV_BLITTER_SRCA_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG16 [10] *((const byte*) DTV_BLITTER_SRCA_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCA_MOD_HI
//SEG16 [11] *((const byte*) DTV_BLITTER_SRCA_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG17 [11] *((const byte*) DTV_BLITTER_SRCA_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_SRCA_LIN_LO
//SEG17 [12] *((const byte*) DTV_BLITTER_SRCA_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG18 [12] *((const byte*) DTV_BLITTER_SRCA_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_SRCA_LIN_HI
//SEG18 [13] *((const byte*) DTV_BLITTER_SRCA_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
//SEG19 [13] *((const byte*) DTV_BLITTER_SRCA_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
lda #$10
sta DTV_BLITTER_SRCA_STEP
//SEG19 [14] *((const byte*) DTV_BLITTER_SRCB_LO#0) ← <(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
//SEG20 [14] *((const byte*) DTV_BLITTER_SRCB_LO#0) ← <(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
lda #<SRCB
sta DTV_BLITTER_SRCB_LO
//SEG20 [15] *((const byte*) DTV_BLITTER_SRCB_MI#0) ← >(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
//SEG21 [15] *((const byte*) DTV_BLITTER_SRCB_MI#0) ← >(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
lda #>SRCB
sta DTV_BLITTER_SRCB_MI
//SEG21 [16] *((const byte*) DTV_BLITTER_SRCB_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG22 [16] *((const byte*) DTV_BLITTER_SRCB_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_HI
//SEG22 [17] *((const byte*) DTV_BLITTER_SRCB_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG23 [17] *((const byte*) DTV_BLITTER_SRCB_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_MOD_LO
//SEG23 [18] *((const byte*) DTV_BLITTER_SRCB_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG24 [18] *((const byte*) DTV_BLITTER_SRCB_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_MOD_HI
//SEG24 [19] *((const byte*) DTV_BLITTER_SRCB_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG25 [19] *((const byte*) DTV_BLITTER_SRCB_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_SRCB_LIN_LO
//SEG25 [20] *((const byte*) DTV_BLITTER_SRCB_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG26 [20] *((const byte*) DTV_BLITTER_SRCB_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_SRCB_LIN_HI
//SEG26 [21] *((const byte*) DTV_BLITTER_SRCB_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG27 [21] *((const byte*) DTV_BLITTER_SRCB_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_STEP
//SEG27 [22] *((const byte*) DTV_BLITTER_DEST_LO#0) ← <(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
//SEG28 [22] *((const byte*) DTV_BLITTER_DEST_LO#0) ← <(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
lda #<SCREEN
sta DTV_BLITTER_DEST_LO
//SEG28 [23] *((const byte*) DTV_BLITTER_DEST_MI#0) ← >(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
//SEG29 [23] *((const byte*) DTV_BLITTER_DEST_MI#0) ← >(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
lda #>SCREEN
sta DTV_BLITTER_DEST_MI
//SEG29 [24] *((const byte*) DTV_BLITTER_DEST_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG30 [24] *((const byte*) DTV_BLITTER_DEST_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_DEST_HI
//SEG30 [25] *((const byte*) DTV_BLITTER_DEST_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG31 [25] *((const byte*) DTV_BLITTER_DEST_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_DEST_MOD_LO
//SEG31 [26] *((const byte*) DTV_BLITTER_DEST_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG32 [26] *((const byte*) DTV_BLITTER_DEST_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_DEST_MOD_HI
//SEG32 [27] *((const byte*) DTV_BLITTER_DEST_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG33 [27] *((const byte*) DTV_BLITTER_DEST_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_DEST_LIN_LO
//SEG33 [28] *((const byte*) DTV_BLITTER_DEST_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG34 [28] *((const byte*) DTV_BLITTER_DEST_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_DEST_LIN_HI
//SEG34 [29] *((const byte*) DTV_BLITTER_DEST_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
//SEG35 [29] *((const byte*) DTV_BLITTER_DEST_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
lda #$10
sta DTV_BLITTER_DEST_STEP
//SEG35 [30] *((const byte*) DTV_BLITTER_LEN_LO#0) ← (const byte) SRCA_LEN#0 -- _deref_pbuc1=vbuc2
//SEG36 [30] *((const byte*) DTV_BLITTER_LEN_LO#0) ← (const byte) SRCA_LEN#0 -- _deref_pbuc1=vbuc2
lda #SRCA_LEN
sta DTV_BLITTER_LEN_LO
//SEG36 [31] *((const byte*) DTV_BLITTER_LEN_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG37 [31] *((const byte*) DTV_BLITTER_LEN_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_LEN_HI
//SEG37 [32] *((const byte*) DTV_BLITTER_ALU#0) ← (const byte) DTV_BLIT_ADD#0 -- _deref_pbuc1=vbuc2
//SEG38 [32] *((const byte*) DTV_BLITTER_ALU#0) ← (const byte) DTV_BLIT_ADD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_ADD
sta DTV_BLITTER_ALU
//SEG38 [33] *((const byte*) DTV_BLITTER_TRANSPARANCY#0) ← (const byte) DTV_BLIT_TRANSPARANCY_NONE#0 -- _deref_pbuc1=vbuc2
//SEG39 [33] *((const byte*) DTV_BLITTER_TRANSPARANCY#0) ← (const byte) DTV_BLIT_TRANSPARANCY_NONE#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_TRANSPARANCY_NONE
sta DTV_BLITTER_TRANSPARANCY
//SEG39 [34] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
//SEG40 [34] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
sta DTV_BLITTER_CONTROL
//SEG40 [35] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_DEST_CONT#0 -- _deref_pbuc1=vbuc2
//SEG41 [35] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_DEST_CONT#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_DEST_CONT
sta DTV_BLITTER_CONTROL2
//SEG41 [36] phi from main to main::@2 [phi:main->main::@2]
//SEG42 [36] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
//SEG42 [36] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@2#0] -- vbuz1=vbuc1
//SEG43 [36] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@2#0] -- vbuz1=vbuc1
lda #0
sta r
jmp b2
//SEG43 [36] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG44 [36] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
jmp b2
//SEG44 [36] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
//SEG45 [36] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
b2_from_b3:
//SEG45 [36] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG46 [36] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@3->main::@2#0] -- register_copy
jmp b2
//SEG46 main::@2
//SEG47 main::@2
b2:
//SEG47 [37] (byte~) main::$15 ← *((const byte*) DTV_BLITTER_CONTROL2#0) & (const byte) DTV_BLIT_STATUS_BUSY#0 -- vbuz1=_deref_pbuc1_band_vbuc2
//SEG48 [37] (byte~) main::$15 ← *((const byte*) DTV_BLITTER_CONTROL2#0) & (const byte) DTV_BLIT_STATUS_BUSY#0 -- vbuz1=_deref_pbuc1_band_vbuc2
lda DTV_BLITTER_CONTROL2
and #DTV_BLIT_STATUS_BUSY
sta _15
//SEG48 [38] if((byte~) main::$15!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@2 -- vbuz1_neq_0_then_la1
//SEG49 [38] if((byte~) main::$15!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@2 -- vbuz1_neq_0_then_la1
lda _15
cmp #0
bne b2_from_b2
jmp b3
//SEG49 main::@3
//SEG50 main::@3
b3:
//SEG50 [39] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
//SEG51 [39] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
sta DTV_BLITTER_CONTROL
//SEG51 [40] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuz1=_inc_vbuz1
//SEG52 [40] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuz1=_inc_vbuz1
inc r
//SEG52 [41] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
//SEG53 [41] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda r
cmp #8
bne b2_from_b3
jmp breturn
//SEG53 main::@return
//SEG54 main::@return
breturn:
//SEG54 [42] return
//SEG55 [42] return
rts
}
SRCA: .byte 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '
@ -1488,11 +1489,12 @@ Uplifting [main] best 2815 combination reg byte a [ main::$15 ] reg byte x [ mai
Uplifting [] best 2815 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
// Feature enables or disables the extra C64 DTV features
.label DTV_FEATURE = $d03f
.const DTV_FEATURE_ENABLE = 1
@ -1562,153 +1564,153 @@ ASSEMBLER BEFORE OPTIMIZATION
.const DTV_BLIT_STATUS_BUSY = 1
.label SCREEN = $400
.const SRCA_LEN = 9
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @6 [phi:@begin->@6]
//SEG4 [1] phi from @begin to @6 [phi:@begin->@6]
b6_from_bbegin:
jmp b6
//SEG4 @6
//SEG5 @6
b6:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @6 to @end [phi:@6->@end]
//SEG7 [3] phi from @6 to @end [phi:@6->@end]
bend_from_b6:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
lda #DTV_FEATURE_ENABLE
sta DTV_FEATURE
//SEG10 [5] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_CLEAR_IRQ#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_CLEAR_IRQ#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_CLEAR_IRQ
sta DTV_BLITTER_CONTROL2
//SEG11 [6] *((const byte*) DTV_BLITTER_SRCA_LO#0) ← <(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) DTV_BLITTER_SRCA_LO#0) ← <(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
lda #<SRCA
sta DTV_BLITTER_SRCA_LO
//SEG12 [7] *((const byte*) DTV_BLITTER_SRCA_MI#0) ← >(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
//SEG13 [7] *((const byte*) DTV_BLITTER_SRCA_MI#0) ← >(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
lda #>SRCA
sta DTV_BLITTER_SRCA_MI
//SEG13 [8] *((const byte*) DTV_BLITTER_SRCA_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG14 [8] *((const byte*) DTV_BLITTER_SRCA_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCA_HI
//SEG14 [9] *((const byte*) DTV_BLITTER_SRCA_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG15 [9] *((const byte*) DTV_BLITTER_SRCA_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCA_MOD_LO
//SEG15 [10] *((const byte*) DTV_BLITTER_SRCA_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG16 [10] *((const byte*) DTV_BLITTER_SRCA_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCA_MOD_HI
//SEG16 [11] *((const byte*) DTV_BLITTER_SRCA_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG17 [11] *((const byte*) DTV_BLITTER_SRCA_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_SRCA_LIN_LO
//SEG17 [12] *((const byte*) DTV_BLITTER_SRCA_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG18 [12] *((const byte*) DTV_BLITTER_SRCA_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_SRCA_LIN_HI
//SEG18 [13] *((const byte*) DTV_BLITTER_SRCA_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
//SEG19 [13] *((const byte*) DTV_BLITTER_SRCA_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
lda #$10
sta DTV_BLITTER_SRCA_STEP
//SEG19 [14] *((const byte*) DTV_BLITTER_SRCB_LO#0) ← <(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
//SEG20 [14] *((const byte*) DTV_BLITTER_SRCB_LO#0) ← <(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
lda #<SRCB
sta DTV_BLITTER_SRCB_LO
//SEG20 [15] *((const byte*) DTV_BLITTER_SRCB_MI#0) ← >(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
//SEG21 [15] *((const byte*) DTV_BLITTER_SRCB_MI#0) ← >(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
lda #>SRCB
sta DTV_BLITTER_SRCB_MI
//SEG21 [16] *((const byte*) DTV_BLITTER_SRCB_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG22 [16] *((const byte*) DTV_BLITTER_SRCB_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_HI
//SEG22 [17] *((const byte*) DTV_BLITTER_SRCB_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG23 [17] *((const byte*) DTV_BLITTER_SRCB_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_MOD_LO
//SEG23 [18] *((const byte*) DTV_BLITTER_SRCB_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG24 [18] *((const byte*) DTV_BLITTER_SRCB_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_MOD_HI
//SEG24 [19] *((const byte*) DTV_BLITTER_SRCB_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG25 [19] *((const byte*) DTV_BLITTER_SRCB_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_SRCB_LIN_LO
//SEG25 [20] *((const byte*) DTV_BLITTER_SRCB_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG26 [20] *((const byte*) DTV_BLITTER_SRCB_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_SRCB_LIN_HI
//SEG26 [21] *((const byte*) DTV_BLITTER_SRCB_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG27 [21] *((const byte*) DTV_BLITTER_SRCB_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_STEP
//SEG27 [22] *((const byte*) DTV_BLITTER_DEST_LO#0) ← <(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
//SEG28 [22] *((const byte*) DTV_BLITTER_DEST_LO#0) ← <(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
lda #<SCREEN
sta DTV_BLITTER_DEST_LO
//SEG28 [23] *((const byte*) DTV_BLITTER_DEST_MI#0) ← >(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
//SEG29 [23] *((const byte*) DTV_BLITTER_DEST_MI#0) ← >(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
lda #>SCREEN
sta DTV_BLITTER_DEST_MI
//SEG29 [24] *((const byte*) DTV_BLITTER_DEST_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG30 [24] *((const byte*) DTV_BLITTER_DEST_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_DEST_HI
//SEG30 [25] *((const byte*) DTV_BLITTER_DEST_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG31 [25] *((const byte*) DTV_BLITTER_DEST_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_DEST_MOD_LO
//SEG31 [26] *((const byte*) DTV_BLITTER_DEST_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG32 [26] *((const byte*) DTV_BLITTER_DEST_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_DEST_MOD_HI
//SEG32 [27] *((const byte*) DTV_BLITTER_DEST_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG33 [27] *((const byte*) DTV_BLITTER_DEST_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_DEST_LIN_LO
//SEG33 [28] *((const byte*) DTV_BLITTER_DEST_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG34 [28] *((const byte*) DTV_BLITTER_DEST_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_DEST_LIN_HI
//SEG34 [29] *((const byte*) DTV_BLITTER_DEST_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
//SEG35 [29] *((const byte*) DTV_BLITTER_DEST_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
lda #$10
sta DTV_BLITTER_DEST_STEP
//SEG35 [30] *((const byte*) DTV_BLITTER_LEN_LO#0) ← (const byte) SRCA_LEN#0 -- _deref_pbuc1=vbuc2
//SEG36 [30] *((const byte*) DTV_BLITTER_LEN_LO#0) ← (const byte) SRCA_LEN#0 -- _deref_pbuc1=vbuc2
lda #SRCA_LEN
sta DTV_BLITTER_LEN_LO
//SEG36 [31] *((const byte*) DTV_BLITTER_LEN_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG37 [31] *((const byte*) DTV_BLITTER_LEN_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_LEN_HI
//SEG37 [32] *((const byte*) DTV_BLITTER_ALU#0) ← (const byte) DTV_BLIT_ADD#0 -- _deref_pbuc1=vbuc2
//SEG38 [32] *((const byte*) DTV_BLITTER_ALU#0) ← (const byte) DTV_BLIT_ADD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_ADD
sta DTV_BLITTER_ALU
//SEG38 [33] *((const byte*) DTV_BLITTER_TRANSPARANCY#0) ← (const byte) DTV_BLIT_TRANSPARANCY_NONE#0 -- _deref_pbuc1=vbuc2
//SEG39 [33] *((const byte*) DTV_BLITTER_TRANSPARANCY#0) ← (const byte) DTV_BLIT_TRANSPARANCY_NONE#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_TRANSPARANCY_NONE
sta DTV_BLITTER_TRANSPARANCY
//SEG39 [34] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
//SEG40 [34] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
sta DTV_BLITTER_CONTROL
//SEG40 [35] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_DEST_CONT#0 -- _deref_pbuc1=vbuc2
//SEG41 [35] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_DEST_CONT#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_DEST_CONT
sta DTV_BLITTER_CONTROL2
//SEG41 [36] phi from main to main::@2 [phi:main->main::@2]
//SEG42 [36] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
//SEG42 [36] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
//SEG43 [36] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #0
jmp b2
//SEG43 [36] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG44 [36] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
jmp b2
//SEG44 [36] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
//SEG45 [36] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
b2_from_b3:
//SEG45 [36] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG46 [36] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@3->main::@2#0] -- register_copy
jmp b2
//SEG46 main::@2
//SEG47 main::@2
b2:
//SEG47 [37] (byte~) main::$15 ← *((const byte*) DTV_BLITTER_CONTROL2#0) & (const byte) DTV_BLIT_STATUS_BUSY#0 -- vbuaa=_deref_pbuc1_band_vbuc2
//SEG48 [37] (byte~) main::$15 ← *((const byte*) DTV_BLITTER_CONTROL2#0) & (const byte) DTV_BLIT_STATUS_BUSY#0 -- vbuaa=_deref_pbuc1_band_vbuc2
lda DTV_BLITTER_CONTROL2
and #DTV_BLIT_STATUS_BUSY
//SEG48 [38] if((byte~) main::$15!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@2 -- vbuaa_neq_0_then_la1
//SEG49 [38] if((byte~) main::$15!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@2 -- vbuaa_neq_0_then_la1
cmp #0
bne b2_from_b2
jmp b3
//SEG49 main::@3
//SEG50 main::@3
b3:
//SEG50 [39] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
//SEG51 [39] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
sta DTV_BLITTER_CONTROL
//SEG51 [40] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuxx=_inc_vbuxx
//SEG52 [40] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuxx=_inc_vbuxx
inx
//SEG52 [41] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
//SEG53 [41] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne b2_from_b3
jmp breturn
//SEG53 main::@return
//SEG54 main::@return
breturn:
//SEG54 [42] return
//SEG55 [42] return
rts
}
SRCA: .byte 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '
@ -1998,11 +2000,12 @@ reg byte a [ main::$15 ]
FINAL ASSEMBLER
Score: 1561
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
// Feature enables or disables the extra C64 DTV features
.label DTV_FEATURE = $d03f
.const DTV_FEATURE_ENABLE = 1
@ -2072,129 +2075,129 @@ Score: 1561
.const DTV_BLIT_STATUS_BUSY = 1
.label SCREEN = $400
.const SRCA_LEN = 9
//SEG2 @begin
//SEG3 [1] phi from @begin to @6 [phi:@begin->@6]
//SEG4 @6
//SEG5 [2] call main
//SEG6 [3] phi from @6 to @end [phi:@6->@end]
//SEG7 @end
//SEG8 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @6 [phi:@begin->@6]
//SEG5 @6
//SEG6 [2] call main
//SEG7 [3] phi from @6 to @end [phi:@6->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG9 [4] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
lda #DTV_FEATURE_ENABLE
sta DTV_FEATURE
//SEG10 [5] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_CLEAR_IRQ#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_CLEAR_IRQ#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_CLEAR_IRQ
sta DTV_BLITTER_CONTROL2
//SEG11 [6] *((const byte*) DTV_BLITTER_SRCA_LO#0) ← <(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) DTV_BLITTER_SRCA_LO#0) ← <(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
lda #<SRCA
sta DTV_BLITTER_SRCA_LO
//SEG12 [7] *((const byte*) DTV_BLITTER_SRCA_MI#0) ← >(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
//SEG13 [7] *((const byte*) DTV_BLITTER_SRCA_MI#0) ← >(const byte[]) SRCA#0 -- _deref_pbuc1=vbuc2
lda #>SRCA
sta DTV_BLITTER_SRCA_MI
//SEG13 [8] *((const byte*) DTV_BLITTER_SRCA_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG14 [8] *((const byte*) DTV_BLITTER_SRCA_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCA_HI
//SEG14 [9] *((const byte*) DTV_BLITTER_SRCA_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG15 [9] *((const byte*) DTV_BLITTER_SRCA_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta DTV_BLITTER_SRCA_MOD_LO
//SEG15 [10] *((const byte*) DTV_BLITTER_SRCA_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG16 [10] *((const byte*) DTV_BLITTER_SRCA_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta DTV_BLITTER_SRCA_MOD_HI
//SEG16 [11] *((const byte*) DTV_BLITTER_SRCA_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG17 [11] *((const byte*) DTV_BLITTER_SRCA_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_SRCA_LIN_LO
//SEG17 [12] *((const byte*) DTV_BLITTER_SRCA_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG18 [12] *((const byte*) DTV_BLITTER_SRCA_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_SRCA_LIN_HI
//SEG18 [13] *((const byte*) DTV_BLITTER_SRCA_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
//SEG19 [13] *((const byte*) DTV_BLITTER_SRCA_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
lda #$10
sta DTV_BLITTER_SRCA_STEP
//SEG19 [14] *((const byte*) DTV_BLITTER_SRCB_LO#0) ← <(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
//SEG20 [14] *((const byte*) DTV_BLITTER_SRCB_LO#0) ← <(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
lda #<SRCB
sta DTV_BLITTER_SRCB_LO
//SEG20 [15] *((const byte*) DTV_BLITTER_SRCB_MI#0) ← >(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
//SEG21 [15] *((const byte*) DTV_BLITTER_SRCB_MI#0) ← >(const byte[]) SRCB#0 -- _deref_pbuc1=vbuc2
lda #>SRCB
sta DTV_BLITTER_SRCB_MI
//SEG21 [16] *((const byte*) DTV_BLITTER_SRCB_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG22 [16] *((const byte*) DTV_BLITTER_SRCB_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_HI
//SEG22 [17] *((const byte*) DTV_BLITTER_SRCB_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG23 [17] *((const byte*) DTV_BLITTER_SRCB_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta DTV_BLITTER_SRCB_MOD_LO
//SEG23 [18] *((const byte*) DTV_BLITTER_SRCB_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG24 [18] *((const byte*) DTV_BLITTER_SRCB_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta DTV_BLITTER_SRCB_MOD_HI
//SEG24 [19] *((const byte*) DTV_BLITTER_SRCB_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG25 [19] *((const byte*) DTV_BLITTER_SRCB_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_SRCB_LIN_LO
//SEG25 [20] *((const byte*) DTV_BLITTER_SRCB_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG26 [20] *((const byte*) DTV_BLITTER_SRCB_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_SRCB_LIN_HI
//SEG26 [21] *((const byte*) DTV_BLITTER_SRCB_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG27 [21] *((const byte*) DTV_BLITTER_SRCB_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_SRCB_STEP
//SEG27 [22] *((const byte*) DTV_BLITTER_DEST_LO#0) ← <(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
//SEG28 [22] *((const byte*) DTV_BLITTER_DEST_LO#0) ← <(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
lda #<SCREEN
sta DTV_BLITTER_DEST_LO
//SEG28 [23] *((const byte*) DTV_BLITTER_DEST_MI#0) ← >(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
//SEG29 [23] *((const byte*) DTV_BLITTER_DEST_MI#0) ← >(const byte*) SCREEN#0 -- _deref_pbuc1=vbuc2
lda #>SCREEN
sta DTV_BLITTER_DEST_MI
//SEG29 [24] *((const byte*) DTV_BLITTER_DEST_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG30 [24] *((const byte*) DTV_BLITTER_DEST_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_DEST_HI
//SEG30 [25] *((const byte*) DTV_BLITTER_DEST_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG31 [25] *((const byte*) DTV_BLITTER_DEST_MOD_LO#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta DTV_BLITTER_DEST_MOD_LO
//SEG31 [26] *((const byte*) DTV_BLITTER_DEST_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG32 [26] *((const byte*) DTV_BLITTER_DEST_MOD_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta DTV_BLITTER_DEST_MOD_HI
//SEG32 [27] *((const byte*) DTV_BLITTER_DEST_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG33 [27] *((const byte*) DTV_BLITTER_DEST_LIN_LO#0) ← <(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #<$100
sta DTV_BLITTER_DEST_LIN_LO
//SEG33 [28] *((const byte*) DTV_BLITTER_DEST_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
//SEG34 [28] *((const byte*) DTV_BLITTER_DEST_LIN_HI#0) ← >(word/signed word/dword/signed dword) 256 -- _deref_pbuc1=vbuc2
lda #>$100
sta DTV_BLITTER_DEST_LIN_HI
//SEG34 [29] *((const byte*) DTV_BLITTER_DEST_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
//SEG35 [29] *((const byte*) DTV_BLITTER_DEST_STEP#0) ← (byte/signed byte/word/signed word/dword/signed dword) 16 -- _deref_pbuc1=vbuc2
lda #$10
sta DTV_BLITTER_DEST_STEP
//SEG35 [30] *((const byte*) DTV_BLITTER_LEN_LO#0) ← (const byte) SRCA_LEN#0 -- _deref_pbuc1=vbuc2
//SEG36 [30] *((const byte*) DTV_BLITTER_LEN_LO#0) ← (const byte) SRCA_LEN#0 -- _deref_pbuc1=vbuc2
lda #SRCA_LEN
sta DTV_BLITTER_LEN_LO
//SEG36 [31] *((const byte*) DTV_BLITTER_LEN_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG37 [31] *((const byte*) DTV_BLITTER_LEN_HI#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta DTV_BLITTER_LEN_HI
//SEG37 [32] *((const byte*) DTV_BLITTER_ALU#0) ← (const byte) DTV_BLIT_ADD#0 -- _deref_pbuc1=vbuc2
//SEG38 [32] *((const byte*) DTV_BLITTER_ALU#0) ← (const byte) DTV_BLIT_ADD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_ADD
sta DTV_BLITTER_ALU
//SEG38 [33] *((const byte*) DTV_BLITTER_TRANSPARANCY#0) ← (const byte) DTV_BLIT_TRANSPARANCY_NONE#0 -- _deref_pbuc1=vbuc2
//SEG39 [33] *((const byte*) DTV_BLITTER_TRANSPARANCY#0) ← (const byte) DTV_BLIT_TRANSPARANCY_NONE#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_TRANSPARANCY_NONE
sta DTV_BLITTER_TRANSPARANCY
//SEG39 [34] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
//SEG40 [34] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
sta DTV_BLITTER_CONTROL
//SEG40 [35] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_DEST_CONT#0 -- _deref_pbuc1=vbuc2
//SEG41 [35] *((const byte*) DTV_BLITTER_CONTROL2#0) ← (const byte) DTV_BLIT_DEST_CONT#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_DEST_CONT
sta DTV_BLITTER_CONTROL2
//SEG41 [36] phi from main to main::@2 [phi:main->main::@2]
//SEG42 [36] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
//SEG42 [36] phi from main to main::@2 [phi:main->main::@2]
//SEG43 [36] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #0
//SEG43 [36] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG44 [36] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
//SEG45 [36] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG46 main::@2
//SEG44 [36] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG45 [36] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
//SEG46 [36] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG47 main::@2
b2:
//SEG47 [37] (byte~) main::$15 ← *((const byte*) DTV_BLITTER_CONTROL2#0) & (const byte) DTV_BLIT_STATUS_BUSY#0 -- vbuaa=_deref_pbuc1_band_vbuc2
//SEG48 [37] (byte~) main::$15 ← *((const byte*) DTV_BLITTER_CONTROL2#0) & (const byte) DTV_BLIT_STATUS_BUSY#0 -- vbuaa=_deref_pbuc1_band_vbuc2
lda DTV_BLITTER_CONTROL2
and #DTV_BLIT_STATUS_BUSY
//SEG48 [38] if((byte~) main::$15!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@2 -- vbuaa_neq_0_then_la1
//SEG49 [38] if((byte~) main::$15!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@2 -- vbuaa_neq_0_then_la1
cmp #0
bne b2
//SEG49 main::@3
//SEG50 [39] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
//SEG50 main::@3
//SEG51 [39] *((const byte*) DTV_BLITTER_CONTROL#0) ← (const byte) DTV_BLIT_FORCE_START#0|(const byte) DTV_BLIT_SRCA_FWD#0|(const byte) DTV_BLIT_SRCB_FWD#0|(const byte) DTV_BLIT_DEST_FWD#0 -- _deref_pbuc1=vbuc2
lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
sta DTV_BLITTER_CONTROL
//SEG51 [40] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuxx=_inc_vbuxx
//SEG52 [40] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuxx=_inc_vbuxx
inx
//SEG52 [41] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
//SEG53 [41] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne b2
//SEG53 main::@return
//SEG54 [42] return
//SEG54 main::@return
//SEG55 [42] return
rts
}
SRCA: .byte 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '

View File

@ -1,3 +1,4 @@
// Test C64DTV v2 256-colors and the 16-color redefinable palette
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"

View File

@ -1074,11 +1074,13 @@ Allocated zp ZP_BYTE:2 [ main::r#2 main::r#1 ]
Allocated zp ZP_BYTE:3 [ main::c#2 main::c#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Test C64DTV v2 256-colors and the 16-color redefinable palette
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label RASTER = $d012
.label BGCOL = $d021
// Feature enables or disables the extra C64 DTV features
@ -1091,58 +1093,58 @@ INITIAL ASM
.const DTV_BADLINE_OFF = $20
// Defines colors for the 16 first colors ($00-$0f)
.label DTV_PALETTE = $d200
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @6 [phi:@begin->@6]
//SEG4 [1] phi from @begin to @6 [phi:@begin->@6]
b6_from_bbegin:
jmp b6
//SEG4 @6
//SEG5 @6
b6:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @6 to @end [phi:@6->@end]
//SEG7 [3] phi from @6 to @end [phi:@6->@end]
bend_from_b6:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
.label r = 2
.label c = 3
//SEG9 asm { sei }
//SEG10 asm { sei }
sei
//SEG10 [5] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
lda #DTV_FEATURE_ENABLE
sta DTV_FEATURE
//SEG11 [6] *((const byte*) DTV_CONTROL#0) ← (const byte) DTV_HIGHCOLOR#0|(const byte) DTV_BORDER_OFF#0|(const byte) DTV_BADLINE_OFF#0 -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) DTV_CONTROL#0) ← (const byte) DTV_HIGHCOLOR#0|(const byte) DTV_BORDER_OFF#0|(const byte) DTV_BADLINE_OFF#0 -- _deref_pbuc1=vbuc2
lda #DTV_HIGHCOLOR|DTV_BORDER_OFF|DTV_BADLINE_OFF
sta DTV_CONTROL
jmp b4
//SEG12 main::@4
//SEG13 main::@4
b4:
//SEG13 [7] if(*((const byte*) RASTER#0)!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@4 -- _deref_pbuc1_neq_vbuc2_then_la1
//SEG14 [7] if(*((const byte*) RASTER#0)!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@4 -- _deref_pbuc1_neq_vbuc2_then_la1
lda RASTER
cmp #$40
bne b4
jmp b6
//SEG14 main::@6
//SEG15 main::@6
b6:
//SEG15 [8] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG16 [8] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta BGCOL
//SEG16 [9] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
//SEG17 [9] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
b7_from_b6:
//SEG17 [9] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 49 [phi:main::@6->main::@7#0] -- vbuz1=vbuc1
//SEG18 [9] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 49 [phi:main::@6->main::@7#0] -- vbuz1=vbuc1
lda #$31
sta r
jmp b7
//SEG18 [9] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
//SEG19 [9] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
b7_from_b7:
//SEG19 [9] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@7->main::@7#0] -- register_copy
//SEG20 [9] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@7->main::@7#0] -- register_copy
jmp b7
//SEG20 main::@7
//SEG21 main::@7
b7:
//SEG21 asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
//SEG22 asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
nop
nop
nop
@ -1168,36 +1170,36 @@ main: {
nop
nop
nop
//SEG22 [11] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG23 [11] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
//SEG23 [12] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuz1=_inc_vbuz1
//SEG24 [12] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuz1=_inc_vbuz1
inc r
//SEG24 [13] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@7 -- vbuz1_neq_0_then_la1
//SEG25 [13] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@7 -- vbuz1_neq_0_then_la1
lda r
cmp #0
bne b7_from_b7
//SEG25 [14] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
//SEG26 [14] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
b8_from_b7:
//SEG26 [14] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@8#0] -- vbuz1=vbuc1
//SEG27 [14] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@8#0] -- vbuz1=vbuc1
lda #0
sta c
jmp b8
//SEG27 [14] phi from main::@8 to main::@8 [phi:main::@8->main::@8]
//SEG28 [14] phi from main::@8 to main::@8 [phi:main::@8->main::@8]
b8_from_b8:
//SEG28 [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@8#0] -- register_copy
//SEG29 [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@8#0] -- register_copy
jmp b8
//SEG29 main::@8
//SEG30 main::@8
b8:
//SEG30 [15] *((const byte*) DTV_PALETTE#0 + (byte) main::c#2) ← *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
//SEG31 [15] *((const byte*) DTV_PALETTE#0 + (byte) main::c#2) ← *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy c
lda palette,y
sta DTV_PALETTE,y
//SEG31 [16] *((const byte[16]) main::palette#0 + (byte) main::c#2) ← ++ *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
//SEG32 [16] *((const byte[16]) main::palette#0 + (byte) main::c#2) ← ++ *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
ldx c
inc palette,x
//SEG32 [17] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuz1=_inc_vbuz1
//SEG33 [17] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuz1=_inc_vbuz1
inc c
//SEG33 [18] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@8 -- vbuz1_neq_vbuc1_then_la1
//SEG34 [18] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@8 -- vbuz1_neq_vbuc1_then_la1
lda c
cmp #$10
bne b8_from_b8
@ -1228,11 +1230,13 @@ Uplifting [main] best 11689 combination reg byte x [ main::c#2 main::c#1 ] reg b
Uplifting [] best 11689 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Test C64DTV v2 256-colors and the 16-color redefinable palette
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label RASTER = $d012
.label BGCOL = $d021
// Feature enables or disables the extra C64 DTV features
@ -1245,55 +1249,55 @@ ASSEMBLER BEFORE OPTIMIZATION
.const DTV_BADLINE_OFF = $20
// Defines colors for the 16 first colors ($00-$0f)
.label DTV_PALETTE = $d200
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @6 [phi:@begin->@6]
//SEG4 [1] phi from @begin to @6 [phi:@begin->@6]
b6_from_bbegin:
jmp b6
//SEG4 @6
//SEG5 @6
b6:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @6 to @end [phi:@6->@end]
//SEG7 [3] phi from @6 to @end [phi:@6->@end]
bend_from_b6:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 asm { sei }
//SEG10 asm { sei }
sei
//SEG10 [5] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
lda #DTV_FEATURE_ENABLE
sta DTV_FEATURE
//SEG11 [6] *((const byte*) DTV_CONTROL#0) ← (const byte) DTV_HIGHCOLOR#0|(const byte) DTV_BORDER_OFF#0|(const byte) DTV_BADLINE_OFF#0 -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) DTV_CONTROL#0) ← (const byte) DTV_HIGHCOLOR#0|(const byte) DTV_BORDER_OFF#0|(const byte) DTV_BADLINE_OFF#0 -- _deref_pbuc1=vbuc2
lda #DTV_HIGHCOLOR|DTV_BORDER_OFF|DTV_BADLINE_OFF
sta DTV_CONTROL
jmp b4
//SEG12 main::@4
//SEG13 main::@4
b4:
//SEG13 [7] if(*((const byte*) RASTER#0)!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@4 -- _deref_pbuc1_neq_vbuc2_then_la1
//SEG14 [7] if(*((const byte*) RASTER#0)!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@4 -- _deref_pbuc1_neq_vbuc2_then_la1
lda RASTER
cmp #$40
bne b4
jmp b6
//SEG14 main::@6
//SEG15 main::@6
b6:
//SEG15 [8] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG16 [8] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta BGCOL
//SEG16 [9] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
//SEG17 [9] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
b7_from_b6:
//SEG17 [9] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 49 [phi:main::@6->main::@7#0] -- vbuxx=vbuc1
//SEG18 [9] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 49 [phi:main::@6->main::@7#0] -- vbuxx=vbuc1
ldx #$31
jmp b7
//SEG18 [9] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
//SEG19 [9] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
b7_from_b7:
//SEG19 [9] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@7->main::@7#0] -- register_copy
//SEG20 [9] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@7->main::@7#0] -- register_copy
jmp b7
//SEG20 main::@7
//SEG21 main::@7
b7:
//SEG21 asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
//SEG22 asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
nop
nop
nop
@ -1319,32 +1323,32 @@ main: {
nop
nop
nop
//SEG22 [11] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG23 [11] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
//SEG23 [12] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuxx=_inc_vbuxx
//SEG24 [12] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuxx=_inc_vbuxx
inx
//SEG24 [13] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@7 -- vbuxx_neq_0_then_la1
//SEG25 [13] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@7 -- vbuxx_neq_0_then_la1
cpx #0
bne b7_from_b7
//SEG25 [14] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
//SEG26 [14] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
b8_from_b7:
//SEG26 [14] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@8#0] -- vbuxx=vbuc1
//SEG27 [14] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@8#0] -- vbuxx=vbuc1
ldx #0
jmp b8
//SEG27 [14] phi from main::@8 to main::@8 [phi:main::@8->main::@8]
//SEG28 [14] phi from main::@8 to main::@8 [phi:main::@8->main::@8]
b8_from_b8:
//SEG28 [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@8#0] -- register_copy
//SEG29 [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@8#0] -- register_copy
jmp b8
//SEG29 main::@8
//SEG30 main::@8
b8:
//SEG30 [15] *((const byte*) DTV_PALETTE#0 + (byte) main::c#2) ← *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG31 [15] *((const byte*) DTV_PALETTE#0 + (byte) main::c#2) ← *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda palette,x
sta DTV_PALETTE,x
//SEG31 [16] *((const byte[16]) main::palette#0 + (byte) main::c#2) ← ++ *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuxx=_inc_pbuc1_derefidx_vbuxx
//SEG32 [16] *((const byte[16]) main::palette#0 + (byte) main::c#2) ← ++ *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuxx=_inc_pbuc1_derefidx_vbuxx
inc palette,x
//SEG32 [17] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
//SEG33 [17] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
inx
//SEG33 [18] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@8 -- vbuxx_neq_vbuc1_then_la1
//SEG34 [18] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@8 -- vbuxx_neq_vbuc1_then_la1
cpx #$10
bne b8_from_b8
jmp b4
@ -1589,11 +1593,13 @@ reg byte x [ main::c#2 main::c#1 ]
FINAL ASSEMBLER
Score: 10174
//SEG0 Basic Upstart
//SEG0 File Comments
// Test C64DTV v2 256-colors and the 16-color redefinable palette
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label RASTER = $d012
.label BGCOL = $d021
// Feature enables or disables the extra C64 DTV features
@ -1606,40 +1612,40 @@ Score: 10174
.const DTV_BADLINE_OFF = $20
// Defines colors for the 16 first colors ($00-$0f)
.label DTV_PALETTE = $d200
//SEG2 @begin
//SEG3 [1] phi from @begin to @6 [phi:@begin->@6]
//SEG4 @6
//SEG5 [2] call main
//SEG6 [3] phi from @6 to @end [phi:@6->@end]
//SEG7 @end
//SEG8 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @6 [phi:@begin->@6]
//SEG5 @6
//SEG6 [2] call main
//SEG7 [3] phi from @6 to @end [phi:@6->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG9 asm { sei }
//SEG10 asm { sei }
sei
//SEG10 [5] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) DTV_FEATURE#0) ← (const byte) DTV_FEATURE_ENABLE#0 -- _deref_pbuc1=vbuc2
lda #DTV_FEATURE_ENABLE
sta DTV_FEATURE
//SEG11 [6] *((const byte*) DTV_CONTROL#0) ← (const byte) DTV_HIGHCOLOR#0|(const byte) DTV_BORDER_OFF#0|(const byte) DTV_BADLINE_OFF#0 -- _deref_pbuc1=vbuc2
//SEG12 [6] *((const byte*) DTV_CONTROL#0) ← (const byte) DTV_HIGHCOLOR#0|(const byte) DTV_BORDER_OFF#0|(const byte) DTV_BADLINE_OFF#0 -- _deref_pbuc1=vbuc2
lda #DTV_HIGHCOLOR|DTV_BORDER_OFF|DTV_BADLINE_OFF
sta DTV_CONTROL
//SEG12 main::@4
//SEG13 main::@4
b4:
//SEG13 [7] if(*((const byte*) RASTER#0)!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@4 -- _deref_pbuc1_neq_vbuc2_then_la1
//SEG14 [7] if(*((const byte*) RASTER#0)!=(byte/signed byte/word/signed word/dword/signed dword) 64) goto main::@4 -- _deref_pbuc1_neq_vbuc2_then_la1
lda RASTER
cmp #$40
bne b4
//SEG14 main::@6
//SEG15 [8] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG15 main::@6
//SEG16 [8] *((const byte*) BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta BGCOL
//SEG16 [9] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
//SEG17 [9] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 49 [phi:main::@6->main::@7#0] -- vbuxx=vbuc1
//SEG17 [9] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
//SEG18 [9] phi (byte) main::r#2 = (byte/signed byte/word/signed word/dword/signed dword) 49 [phi:main::@6->main::@7#0] -- vbuxx=vbuc1
ldx #$31
//SEG18 [9] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
//SEG19 [9] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@7->main::@7#0] -- register_copy
//SEG20 main::@7
//SEG19 [9] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
//SEG20 [9] phi (byte) main::r#2 = (byte) main::r#1 [phi:main::@7->main::@7#0] -- register_copy
//SEG21 main::@7
b7:
//SEG21 asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
//SEG22 asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
nop
nop
nop
@ -1665,28 +1671,28 @@ main: {
nop
nop
nop
//SEG22 [11] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG23 [11] *((const byte*) BGCOL#0) ← ++ *((const byte*) BGCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
//SEG23 [12] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuxx=_inc_vbuxx
//SEG24 [12] (byte) main::r#1 ← ++ (byte) main::r#2 -- vbuxx=_inc_vbuxx
inx
//SEG24 [13] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@7 -- vbuxx_neq_0_then_la1
//SEG25 [13] if((byte) main::r#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@7 -- vbuxx_neq_0_then_la1
cpx #0
bne b7
//SEG25 [14] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
//SEG26 [14] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@8#0] -- vbuxx=vbuc1
//SEG26 [14] phi from main::@7 to main::@8 [phi:main::@7->main::@8]
//SEG27 [14] phi (byte) main::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@7->main::@8#0] -- vbuxx=vbuc1
ldx #0
//SEG27 [14] phi from main::@8 to main::@8 [phi:main::@8->main::@8]
//SEG28 [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@8#0] -- register_copy
//SEG29 main::@8
//SEG28 [14] phi from main::@8 to main::@8 [phi:main::@8->main::@8]
//SEG29 [14] phi (byte) main::c#2 = (byte) main::c#1 [phi:main::@8->main::@8#0] -- register_copy
//SEG30 main::@8
b8:
//SEG30 [15] *((const byte*) DTV_PALETTE#0 + (byte) main::c#2) ← *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG31 [15] *((const byte*) DTV_PALETTE#0 + (byte) main::c#2) ← *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda palette,x
sta DTV_PALETTE,x
//SEG31 [16] *((const byte[16]) main::palette#0 + (byte) main::c#2) ← ++ *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuxx=_inc_pbuc1_derefidx_vbuxx
//SEG32 [16] *((const byte[16]) main::palette#0 + (byte) main::c#2) ← ++ *((const byte[16]) main::palette#0 + (byte) main::c#2) -- pbuc1_derefidx_vbuxx=_inc_pbuc1_derefidx_vbuxx
inc palette,x
//SEG32 [17] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
//SEG33 [17] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx
inx
//SEG33 [18] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@8 -- vbuxx_neq_vbuc1_then_la1
//SEG34 [18] if((byte) main::c#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@8 -- vbuxx_neq_vbuc1_then_la1
cpx #$10
bne b8
jmp b4

View File

@ -1,7 +1,7 @@
// Interactive Explorer for C64DTV Screen Modes
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Commodore 64 Registers and Constants
// Processor port data direction register
.label PROCPORT_DDR = 0
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
@ -2544,8 +2544,6 @@ keyboard_init: {
keyboard_events: .fill 8, 0
// The values scanned values for each row. Set by keyboard_scan() and used by keyboard_get_event()
keyboard_scan_values: .fill 8, 0
// Plot and line drawing routines for HIRES bitmaps
// Currently it can only plot on the first 256 x-positions.
// Tables for the plotter - initialized by calling bitmap_draw_init();
bitmap_plot_xlo: .fill $100, 0
bitmap_plot_xhi: .fill $100, 0

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Exploring C64DTV Screen Modes
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Commodore 64 Registers and Constants
// Processor port data direction register
.label PROCPORT_DDR = 0
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
@ -2211,8 +2211,6 @@ print_set_screen: {
keyboard_matrix_row_bitmask: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f
// Keyboard matrix column bitmasks for a specific keybooard matrix column when reading the keyboard. (columns are numbered 0-7)
keyboard_matrix_col_bitmask: .byte 1, 2, 4, 8, $10, $20, $40, $80
// Plot and line drawing routines for HIRES bitmaps
// Currently it can only plot on the first 256 x-positions.
// Tables for the plotter - initialized by calling bitmap_draw_init();
bitmap_plot_xlo: .fill $100, 0
bitmap_plot_xhi: .fill $100, 0

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
// Multiple calls with different (constant?) parameters should yield different values at runtime
// Currently the same constant parameter is passed on every call.
// Reason: Multiple versioned parameter constants x0#0, x0#1 are only output as a single constant in the ASM .const x0 = 0
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"

View File

@ -227,98 +227,102 @@ Allocated zp ZP_BYTE:3 [ line::x#2 line::x#0 line::x#1 ]
Allocated zp ZP_WORD:4 [ screen#10 screen#14 screen#11 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Multiple calls with different (constant?) parameters should yield different values at runtime
// Currently the same constant parameter is passed on every call.
// Reason: Multiple versioned parameter constants x0#0, x0#1 are only output as a single constant in the ASM .const x0 = 0
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen = 4
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] call line
//SEG11 [9] phi from main to line [phi:main->line]
//SEG11 [5] call line
//SEG12 [9] phi from main to line [phi:main->line]
line_from_main:
//SEG12 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->line#0] -- vbuz1=vbuc1
//SEG13 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->line#0] -- vbuz1=vbuc1
lda #2
sta line.x1
//SEG13 [9] phi (byte*) screen#14 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->line#1] -- pbuz1=pbuc1
//SEG14 [9] phi (byte*) screen#14 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->line#1] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
//SEG14 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->line#2] -- vbuz1=vbuc1
//SEG15 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->line#2] -- vbuz1=vbuc1
lda #1
sta line.x
jsr line
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG16 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG16 main::@1
//SEG17 main::@1
b1:
//SEG17 [7] call line
//SEG18 [9] phi from main::@1 to line [phi:main::@1->line]
//SEG18 [7] call line
//SEG19 [9] phi from main::@1 to line [phi:main::@1->line]
line_from_b1:
//SEG19 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@1->line#0] -- vbuz1=vbuc1
//SEG20 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@1->line#0] -- vbuz1=vbuc1
lda #5
sta line.x1
//SEG20 [9] phi (byte*) screen#14 = (byte*) screen#11 [phi:main::@1->line#1] -- register_copy
//SEG21 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@1->line#2] -- vbuz1=vbuc1
//SEG21 [9] phi (byte*) screen#14 = (byte*) screen#11 [phi:main::@1->line#1] -- register_copy
//SEG22 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@1->line#2] -- vbuz1=vbuc1
lda #3
sta line.x
jsr line
jmp breturn
//SEG22 main::@return
//SEG23 main::@return
breturn:
//SEG23 [8] return
//SEG24 [8] return
rts
}
//SEG24 line
//SEG25 line
line: {
.label x = 3
.label x1 = 2
//SEG25 [10] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
//SEG26 [10] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
b1_from_line:
b1_from_b1:
//SEG26 [10] phi (byte*) screen#10 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy
//SEG27 [10] phi (byte) line::x#2 = (byte) line::x#0 [phi:line/line::@1->line::@1#1] -- register_copy
//SEG27 [10] phi (byte*) screen#10 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy
//SEG28 [10] phi (byte) line::x#2 = (byte) line::x#0 [phi:line/line::@1->line::@1#1] -- register_copy
jmp b1
//SEG28 line::@1
//SEG29 line::@1
b1:
//SEG29 [11] *((byte*) screen#10) ← (byte) line::x#2 -- _deref_pbuz1=vbuz2
//SEG30 [11] *((byte*) screen#10) ← (byte) line::x#2 -- _deref_pbuz1=vbuz2
lda x
ldy #0
sta (screen),y
//SEG30 [12] (byte*) screen#11 ← ++ (byte*) screen#10 -- pbuz1=_inc_pbuz1
//SEG31 [12] (byte*) screen#11 ← ++ (byte*) screen#10 -- pbuz1=_inc_pbuz1
inc screen
bne !+
inc screen+1
!:
//SEG31 [13] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuz1=_inc_vbuz1
//SEG32 [13] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuz1=_inc_vbuz1
inc x
//SEG32 [14] if((byte) line::x#1<(byte) line::x1#3) goto line::@1 -- vbuz1_lt_vbuz2_then_la1
//SEG33 [14] if((byte) line::x#1<(byte) line::x1#3) goto line::@1 -- vbuz1_lt_vbuz2_then_la1
lda x
cmp x1
bcc b1_from_b1
jmp breturn
//SEG33 line::@return
//SEG34 line::@return
breturn:
//SEG34 [15] return
//SEG35 [15] return
rts
}
@ -344,94 +348,98 @@ Uplifting [line] best 426 combination zp ZP_BYTE:2 [ line::x1#3 ]
Allocated (was zp ZP_WORD:4) zp ZP_WORD:3 [ screen#10 screen#14 screen#11 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Multiple calls with different (constant?) parameters should yield different values at runtime
// Currently the same constant parameter is passed on every call.
// Reason: Multiple versioned parameter constants x0#0, x0#1 are only output as a single constant in the ASM .const x0 = 0
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen = 3
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] call line
//SEG11 [9] phi from main to line [phi:main->line]
//SEG11 [5] call line
//SEG12 [9] phi from main to line [phi:main->line]
line_from_main:
//SEG12 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->line#0] -- vbuz1=vbuc1
//SEG13 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->line#0] -- vbuz1=vbuc1
lda #2
sta line.x1
//SEG13 [9] phi (byte*) screen#14 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->line#1] -- pbuz1=pbuc1
//SEG14 [9] phi (byte*) screen#14 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->line#1] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
//SEG14 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->line#2] -- vbuxx=vbuc1
//SEG15 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->line#2] -- vbuxx=vbuc1
ldx #1
jsr line
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG16 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG16 main::@1
//SEG17 main::@1
b1:
//SEG17 [7] call line
//SEG18 [9] phi from main::@1 to line [phi:main::@1->line]
//SEG18 [7] call line
//SEG19 [9] phi from main::@1 to line [phi:main::@1->line]
line_from_b1:
//SEG19 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@1->line#0] -- vbuz1=vbuc1
//SEG20 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@1->line#0] -- vbuz1=vbuc1
lda #5
sta line.x1
//SEG20 [9] phi (byte*) screen#14 = (byte*) screen#11 [phi:main::@1->line#1] -- register_copy
//SEG21 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@1->line#2] -- vbuxx=vbuc1
//SEG21 [9] phi (byte*) screen#14 = (byte*) screen#11 [phi:main::@1->line#1] -- register_copy
//SEG22 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@1->line#2] -- vbuxx=vbuc1
ldx #3
jsr line
jmp breturn
//SEG22 main::@return
//SEG23 main::@return
breturn:
//SEG23 [8] return
//SEG24 [8] return
rts
}
//SEG24 line
//SEG25 line
line: {
.label x1 = 2
//SEG25 [10] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
//SEG26 [10] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
b1_from_line:
b1_from_b1:
//SEG26 [10] phi (byte*) screen#10 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy
//SEG27 [10] phi (byte) line::x#2 = (byte) line::x#0 [phi:line/line::@1->line::@1#1] -- register_copy
//SEG27 [10] phi (byte*) screen#10 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy
//SEG28 [10] phi (byte) line::x#2 = (byte) line::x#0 [phi:line/line::@1->line::@1#1] -- register_copy
jmp b1
//SEG28 line::@1
//SEG29 line::@1
b1:
//SEG29 [11] *((byte*) screen#10) ← (byte) line::x#2 -- _deref_pbuz1=vbuxx
//SEG30 [11] *((byte*) screen#10) ← (byte) line::x#2 -- _deref_pbuz1=vbuxx
txa
ldy #0
sta (screen),y
//SEG30 [12] (byte*) screen#11 ← ++ (byte*) screen#10 -- pbuz1=_inc_pbuz1
//SEG31 [12] (byte*) screen#11 ← ++ (byte*) screen#10 -- pbuz1=_inc_pbuz1
inc screen
bne !+
inc screen+1
!:
//SEG31 [13] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuxx=_inc_vbuxx
//SEG32 [13] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuxx=_inc_vbuxx
inx
//SEG32 [14] if((byte) line::x#1<(byte) line::x1#3) goto line::@1 -- vbuxx_lt_vbuz1_then_la1
//SEG33 [14] if((byte) line::x#1<(byte) line::x1#3) goto line::@1 -- vbuxx_lt_vbuz1_then_la1
cpx x1
bcc b1_from_b1
jmp breturn
//SEG33 line::@return
//SEG34 line::@return
breturn:
//SEG34 [15] return
//SEG35 [15] return
rts
}
@ -495,73 +503,77 @@ zp ZP_WORD:3 [ screen#10 screen#14 screen#11 ]
FINAL ASSEMBLER
Score: 348
//SEG0 Basic Upstart
//SEG0 File Comments
// Multiple calls with different (constant?) parameters should yield different values at runtime
// Currently the same constant parameter is passed on every call.
// Reason: Multiple versioned parameter constants x0#0, x0#1 are only output as a single constant in the ASM .const x0 = 0
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen = 3
//SEG2 @begin
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 @2
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG5 @2
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG10 [5] call line
//SEG11 [9] phi from main to line [phi:main->line]
//SEG12 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->line#0] -- vbuz1=vbuc1
//SEG11 [5] call line
//SEG12 [9] phi from main to line [phi:main->line]
//SEG13 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->line#0] -- vbuz1=vbuc1
lda #2
sta line.x1
//SEG13 [9] phi (byte*) screen#14 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->line#1] -- pbuz1=pbuc1
//SEG14 [9] phi (byte*) screen#14 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->line#1] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
//SEG14 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->line#2] -- vbuxx=vbuc1
//SEG15 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->line#2] -- vbuxx=vbuc1
ldx #1
jsr line
//SEG15 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG16 main::@1
//SEG17 [7] call line
//SEG18 [9] phi from main::@1 to line [phi:main::@1->line]
//SEG19 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@1->line#0] -- vbuz1=vbuc1
//SEG16 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG17 main::@1
//SEG18 [7] call line
//SEG19 [9] phi from main::@1 to line [phi:main::@1->line]
//SEG20 [9] phi (byte) line::x1#3 = (byte/signed byte/word/signed word/dword/signed dword) 5 [phi:main::@1->line#0] -- vbuz1=vbuc1
lda #5
sta line.x1
//SEG20 [9] phi (byte*) screen#14 = (byte*) screen#11 [phi:main::@1->line#1] -- register_copy
//SEG21 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@1->line#2] -- vbuxx=vbuc1
//SEG21 [9] phi (byte*) screen#14 = (byte*) screen#11 [phi:main::@1->line#1] -- register_copy
//SEG22 [9] phi (byte) line::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 3 [phi:main::@1->line#2] -- vbuxx=vbuc1
ldx #3
jsr line
//SEG22 main::@return
//SEG23 [8] return
//SEG23 main::@return
//SEG24 [8] return
rts
}
//SEG24 line
//SEG25 line
line: {
.label x1 = 2
//SEG25 [10] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
//SEG26 [10] phi (byte*) screen#10 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy
//SEG27 [10] phi (byte) line::x#2 = (byte) line::x#0 [phi:line/line::@1->line::@1#1] -- register_copy
//SEG28 line::@1
//SEG26 [10] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
//SEG27 [10] phi (byte*) screen#10 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy
//SEG28 [10] phi (byte) line::x#2 = (byte) line::x#0 [phi:line/line::@1->line::@1#1] -- register_copy
//SEG29 line::@1
b1:
//SEG29 [11] *((byte*) screen#10) ← (byte) line::x#2 -- _deref_pbuz1=vbuxx
//SEG30 [11] *((byte*) screen#10) ← (byte) line::x#2 -- _deref_pbuz1=vbuxx
txa
ldy #0
sta (screen),y
//SEG30 [12] (byte*) screen#11 ← ++ (byte*) screen#10 -- pbuz1=_inc_pbuz1
//SEG31 [12] (byte*) screen#11 ← ++ (byte*) screen#10 -- pbuz1=_inc_pbuz1
inc screen
bne !+
inc screen+1
!:
//SEG31 [13] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuxx=_inc_vbuxx
//SEG32 [13] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuxx=_inc_vbuxx
inx
//SEG32 [14] if((byte) line::x#1<(byte) line::x1#3) goto line::@1 -- vbuxx_lt_vbuz1_then_la1
//SEG33 [14] if((byte) line::x#1<(byte) line::x1#3) goto line::@1 -- vbuxx_lt_vbuz1_then_la1
cpx x1
bcc b1
//SEG33 line::@return
//SEG34 [15] return
//SEG34 line::@return
//SEG35 [15] return
rts
}

View File

@ -1,7 +1,7 @@
// Example of NOP-casting a dereferenced signed byte to a byte
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Example of NOP-casting a dereferenced signed byte to a byte
main: {
.label SCREEN = $400
ldx #0

View File

@ -138,58 +138,59 @@ Complete equivalence classes
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Example of NOP-casting a dereferenced signed byte to a byte
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Example of NOP-casting a dereferenced signed byte to a byte
//SEG10 main
main: {
.label SCREEN = $400
.label i = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte)*((const signed byte[]) main::sbs#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
//SEG16 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte)*((const signed byte[]) main::sbs#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy i
lda sbs,y
sta SCREEN,y
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #4
bne b1_from_b1
jmp breturn
//SEG18 main::@return
//SEG19 main::@return
breturn:
//SEG19 [9] return
//SEG20 [9] return
rts
sbs: .byte -1, -2, -3, -4
}
@ -208,54 +209,55 @@ Uplifting [main] best 288 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 288 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Example of NOP-casting a dereferenced signed byte to a byte
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Example of NOP-casting a dereferenced signed byte to a byte
//SEG10 main
main: {
.label SCREEN = $400
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte)*((const signed byte[]) main::sbs#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG16 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte)*((const signed byte[]) main::sbs#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda sbs,x
sta SCREEN,x
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #4
bne b1_from_b1
jmp breturn
//SEG18 main::@return
//SEG19 main::@return
breturn:
//SEG19 [9] return
//SEG20 [9] return
rts
sbs: .byte -1, -2, -3, -4
}
@ -306,39 +308,40 @@ reg byte x [ main::i#2 main::i#1 ]
FINAL ASSEMBLER
Score: 186
//SEG0 Basic Upstart
//SEG0 File Comments
// Example of NOP-casting a dereferenced signed byte to a byte
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
// Example of NOP-casting a dereferenced signed byte to a byte
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.label SCREEN = $400
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte)*((const signed byte[]) main::sbs#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG16 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte)*((const signed byte[]) main::sbs#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda sbs,x
sta SCREEN,x
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #4
bne b1
//SEG18 main::@return
//SEG19 [9] return
//SEG19 main::@return
//SEG20 [9] return
rts
sbs: .byte -1, -2, -3, -4
}

View File

@ -1,7 +1,7 @@
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
main: {
.label SCREEN = $400
.const min = $a

View File

@ -169,27 +169,28 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
//SEG9 main
main: {
.label SCREEN = $400
.const min = $a
@ -199,30 +200,30 @@ main: {
.const sumw = min+max
.const midb = (sumb>>1)+1
.const midw = (sumw>>1)+1
//SEG9 [4] *((const byte*) main::SCREEN#0) ← (const byte) main::midw#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::SCREEN#0) ← (const byte) main::midw#0 -- _deref_pbuc1=vbuc2
lda #midw
sta SCREEN
//SEG10 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::midb#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::midb#0 -- _deref_pbuc1=vbuc2
lda #midb
sta SCREEN+1
//SEG11 [6] if(*((const byte*) main::SCREEN#0)==*((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1)) goto main::@1 -- _deref_pbuc1_eq__deref_pbuc2_then_la1
//SEG12 [6] if(*((const byte*) main::SCREEN#0)==*((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1)) goto main::@1 -- _deref_pbuc1_eq__deref_pbuc2_then_la1
lda SCREEN
cmp SCREEN+1
beq b1
jmp b3
//SEG12 main::@3
//SEG13 main::@3
b3:
//SEG13 [7] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2
//SEG14 [7] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2
lda #2
sta BGCOL
jmp breturn
//SEG14 main::@return
//SEG15 main::@return
breturn:
//SEG15 [8] return
//SEG16 [8] return
rts
//SEG16 main::@1
//SEG17 main::@1
b1:
//SEG17 [9] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2
//SEG18 [9] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2
lda #5
sta BGCOL
jmp breturn
@ -243,27 +244,28 @@ Uplifting [main] best 61 combination
Uplifting [] best 61 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
//SEG9 main
main: {
.label SCREEN = $400
.const min = $a
@ -273,30 +275,30 @@ main: {
.const sumw = min+max
.const midb = (sumb>>1)+1
.const midw = (sumw>>1)+1
//SEG9 [4] *((const byte*) main::SCREEN#0) ← (const byte) main::midw#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::SCREEN#0) ← (const byte) main::midw#0 -- _deref_pbuc1=vbuc2
lda #midw
sta SCREEN
//SEG10 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::midb#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::midb#0 -- _deref_pbuc1=vbuc2
lda #midb
sta SCREEN+1
//SEG11 [6] if(*((const byte*) main::SCREEN#0)==*((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1)) goto main::@1 -- _deref_pbuc1_eq__deref_pbuc2_then_la1
//SEG12 [6] if(*((const byte*) main::SCREEN#0)==*((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1)) goto main::@1 -- _deref_pbuc1_eq__deref_pbuc2_then_la1
lda SCREEN
cmp SCREEN+1
beq b1
jmp b3
//SEG12 main::@3
//SEG13 main::@3
b3:
//SEG13 [7] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2
//SEG14 [7] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2
lda #2
sta BGCOL
jmp breturn
//SEG14 main::@return
//SEG15 main::@return
breturn:
//SEG15 [8] return
//SEG16 [8] return
rts
//SEG16 main::@1
//SEG17 main::@1
b1:
//SEG17 [9] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2
//SEG18 [9] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2
lda #5
sta BGCOL
jmp breturn
@ -351,19 +353,20 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 43
//SEG0 Basic Upstart
//SEG0 File Comments
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
.label SCREEN = $400
.const min = $a
@ -373,27 +376,27 @@ main: {
.const sumw = min+max
.const midb = (sumb>>1)+1
.const midw = (sumw>>1)+1
//SEG9 [4] *((const byte*) main::SCREEN#0) ← (const byte) main::midw#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::SCREEN#0) ← (const byte) main::midw#0 -- _deref_pbuc1=vbuc2
lda #midw
sta SCREEN
//SEG10 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::midb#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::midb#0 -- _deref_pbuc1=vbuc2
lda #midb
sta SCREEN+1
//SEG11 [6] if(*((const byte*) main::SCREEN#0)==*((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1)) goto main::@1 -- _deref_pbuc1_eq__deref_pbuc2_then_la1
//SEG12 [6] if(*((const byte*) main::SCREEN#0)==*((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1)) goto main::@1 -- _deref_pbuc1_eq__deref_pbuc2_then_la1
lda SCREEN
cmp SCREEN+1
beq b1
//SEG12 main::@3
//SEG13 [7] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2
//SEG13 main::@3
//SEG14 [7] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuc1=vbuc2
lda #2
sta BGCOL
//SEG14 main::@return
//SEG15 main::@return
breturn:
//SEG15 [8] return
//SEG16 [8] return
rts
//SEG16 main::@1
//SEG17 main::@1
b1:
//SEG17 [9] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2
//SEG18 [9] *((const byte*) main::BGCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 5 -- _deref_pbuc1=vbuc2
lda #5
sta BGCOL
jmp breturn

View File

@ -343,130 +343,131 @@ Allocated zp ZP_BYTE:5 [ main::sb#0 ]
Allocated zp ZP_BYTE:6 [ w::b2#0 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
.label SCREEN2 = SCREEN+$28*3
.label SCREEN3 = SCREEN+$28*6
.label SCREEN4 = SCREEN+$28*9
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.label b2 = 4
.label sb = 5
.label b = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::b#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::b#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta b
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (byte) main::b2#0 ← (byte/word/signed word/dword/signed dword) 200 - (byte) main::b#2 -- vbuz1=vbuc1_minus_vbuz2
//SEG16 [6] (byte) main::b2#0 ← (byte/word/signed word/dword/signed dword) 200 - (byte) main::b#2 -- vbuz1=vbuc1_minus_vbuz2
lda #$c8
sec
sbc b
sta b2
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda b2
ldy b
sta SCREEN,y
//SEG17 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 -- vbsz1=_neg_vbsz2
//SEG18 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 -- vbsz1=_neg_vbsz2
lda b
eor #$ff
clc
adc #1
sta sb
//SEG18 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG19 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda sb
ldy b
sta SCREEN2,y
//SEG19 [10] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuz1=_inc_vbuz1
//SEG20 [10] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuz1=_inc_vbuz1
inc b
//SEG20 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG21 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda b
cmp #$65
bne b1_from_b1
//SEG21 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG22 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG22 main::@2
//SEG23 main::@2
b2:
//SEG23 [13] call w
//SEG24 [15] phi from main::@2 to w [phi:main::@2->w]
//SEG24 [13] call w
//SEG25 [15] phi from main::@2 to w [phi:main::@2->w]
w_from_b2:
jsr w
jmp breturn
//SEG25 main::@return
//SEG26 main::@return
breturn:
//SEG26 [14] return
//SEG27 [14] return
rts
}
//SEG27 w
//SEG28 w
w: {
.const w1 = $514
.const w2 = $4e2
.const b = w1-w2
.label b2 = 6
.label i = 3
//SEG28 [16] phi from w to w::@1 [phi:w->w::@1]
//SEG29 [16] phi from w to w::@1 [phi:w->w::@1]
b1_from_w:
//SEG29 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:w->w::@1#0] -- vbuz1=vbuc1
//SEG30 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:w->w::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG30 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
//SEG31 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
b1_from_b1:
//SEG31 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
//SEG32 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
jmp b1
//SEG32 w::@1
//SEG33 w::@1
b1:
//SEG33 [17] (byte) w::b2#0 ← (word/signed word/dword/signed dword) 1400-(word/signed word/dword/signed dword) 1350 + (byte) w::i#2 -- vbuz1=vbuc1_plus_vbuz2
//SEG34 [17] (byte) w::b2#0 ← (word/signed word/dword/signed dword) 1400-(word/signed word/dword/signed dword) 1350 + (byte) w::i#2 -- vbuz1=vbuc1_plus_vbuz2
lda #$578-$546
clc
adc i
sta b2
//SEG34 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 -- pbuc1_derefidx_vbuz1=vbuc2
//SEG35 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 -- pbuc1_derefidx_vbuz1=vbuc2
ldy i
lda #b
sta SCREEN3,y
//SEG35 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG36 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda b2
ldy i
sta SCREEN4,y
//SEG36 [20] (byte) w::i#1 ← ++ (byte) w::i#2 -- vbuz1=_inc_vbuz1
//SEG37 [20] (byte) w::i#1 ← ++ (byte) w::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG37 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto w::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG38 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto w::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$b
bne b1_from_b1
jmp breturn
//SEG38 w::@return
//SEG39 w::@return
breturn:
//SEG39 [22] return
//SEG40 [22] return
rts
}
@ -500,114 +501,115 @@ Uplifting [w] best 836 combination reg byte y [ w::i#2 w::i#1 ] reg byte x [ w::
Uplifting [] best 836 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
.label SCREEN2 = SCREEN+$28*3
.label SCREEN3 = SCREEN+$28*6
.label SCREEN4 = SCREEN+$28*9
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::b#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::b#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (byte) main::b2#0 ← (byte/word/signed word/dword/signed dword) 200 - (byte) main::b#2 -- vbuaa=vbuc1_minus_vbuxx
//SEG16 [6] (byte) main::b2#0 ← (byte/word/signed word/dword/signed dword) 200 - (byte) main::b#2 -- vbuaa=vbuc1_minus_vbuxx
txa
eor #$ff
clc
adc #$c8+1
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG17 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 -- vbsaa=_neg_vbsxx
//SEG18 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 -- vbsaa=_neg_vbsxx
txa
eor #$ff
clc
adc #1
//SEG18 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG19 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN2,x
//SEG19 [10] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuxx=_inc_vbuxx
//SEG20 [10] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuxx=_inc_vbuxx
inx
//SEG20 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG21 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1_from_b1
//SEG21 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG22 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG22 main::@2
//SEG23 main::@2
b2:
//SEG23 [13] call w
//SEG24 [15] phi from main::@2 to w [phi:main::@2->w]
//SEG24 [13] call w
//SEG25 [15] phi from main::@2 to w [phi:main::@2->w]
w_from_b2:
jsr w
jmp breturn
//SEG25 main::@return
//SEG26 main::@return
breturn:
//SEG26 [14] return
//SEG27 [14] return
rts
}
//SEG27 w
//SEG28 w
w: {
.const w1 = $514
.const w2 = $4e2
.const b = w1-w2
//SEG28 [16] phi from w to w::@1 [phi:w->w::@1]
//SEG29 [16] phi from w to w::@1 [phi:w->w::@1]
b1_from_w:
//SEG29 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:w->w::@1#0] -- vbuyy=vbuc1
//SEG30 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:w->w::@1#0] -- vbuyy=vbuc1
ldy #0
jmp b1
//SEG30 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
//SEG31 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
b1_from_b1:
//SEG31 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
//SEG32 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
jmp b1
//SEG32 w::@1
//SEG33 w::@1
b1:
//SEG33 [17] (byte) w::b2#0 ← (word/signed word/dword/signed dword) 1400-(word/signed word/dword/signed dword) 1350 + (byte) w::i#2 -- vbuxx=vbuc1_plus_vbuyy
//SEG34 [17] (byte) w::b2#0 ← (word/signed word/dword/signed dword) 1400-(word/signed word/dword/signed dword) 1350 + (byte) w::i#2 -- vbuxx=vbuc1_plus_vbuyy
tya
clc
adc #$578-$546
tax
//SEG34 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 -- pbuc1_derefidx_vbuyy=vbuc2
//SEG35 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 -- pbuc1_derefidx_vbuyy=vbuc2
lda #b
sta SCREEN3,y
//SEG35 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 -- pbuc1_derefidx_vbuyy=vbuxx
//SEG36 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta SCREEN4,y
//SEG36 [20] (byte) w::i#1 ← ++ (byte) w::i#2 -- vbuyy=_inc_vbuyy
//SEG37 [20] (byte) w::i#1 ← ++ (byte) w::i#2 -- vbuyy=_inc_vbuyy
iny
//SEG37 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto w::@1 -- vbuyy_neq_vbuc1_then_la1
//SEG38 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto w::@1 -- vbuyy_neq_vbuc1_then_la1
cpy #$b
bne b1_from_b1
jmp breturn
//SEG38 w::@return
//SEG39 w::@return
breturn:
//SEG39 [22] return
//SEG40 [22] return
rts
}
@ -695,89 +697,90 @@ reg byte x [ w::b2#0 ]
FINAL ASSEMBLER
Score: 668
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
.label SCREEN2 = SCREEN+$28*3
.label SCREEN3 = SCREEN+$28*6
.label SCREEN4 = SCREEN+$28*9
//SEG2 @begin
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 @2
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG5 @2
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::b#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::b#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] (byte) main::b2#0 ← (byte/word/signed word/dword/signed dword) 200 - (byte) main::b#2 -- vbuaa=vbuc1_minus_vbuxx
//SEG16 [6] (byte) main::b2#0 ← (byte/word/signed word/dword/signed dword) 200 - (byte) main::b#2 -- vbuaa=vbuc1_minus_vbuxx
txa
eor #$ff
clc
adc #$c8+1
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG17 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 -- vbsaa=_neg_vbsxx
//SEG18 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 -- vbsaa=_neg_vbsxx
txa
eor #$ff
clc
adc #1
//SEG18 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG19 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN2,x
//SEG19 [10] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuxx=_inc_vbuxx
//SEG20 [10] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuxx=_inc_vbuxx
inx
//SEG20 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG21 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1
//SEG21 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG22 main::@2
//SEG23 [13] call w
//SEG24 [15] phi from main::@2 to w [phi:main::@2->w]
//SEG22 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG23 main::@2
//SEG24 [13] call w
//SEG25 [15] phi from main::@2 to w [phi:main::@2->w]
jsr w
//SEG25 main::@return
//SEG26 [14] return
//SEG26 main::@return
//SEG27 [14] return
rts
}
//SEG27 w
//SEG28 w
w: {
.const w1 = $514
.const w2 = $4e2
.const b = w1-w2
//SEG28 [16] phi from w to w::@1 [phi:w->w::@1]
//SEG29 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:w->w::@1#0] -- vbuyy=vbuc1
//SEG29 [16] phi from w to w::@1 [phi:w->w::@1]
//SEG30 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:w->w::@1#0] -- vbuyy=vbuc1
ldy #0
//SEG30 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
//SEG31 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
//SEG32 w::@1
//SEG31 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
//SEG32 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
//SEG33 w::@1
b1:
//SEG33 [17] (byte) w::b2#0 ← (word/signed word/dword/signed dword) 1400-(word/signed word/dword/signed dword) 1350 + (byte) w::i#2 -- vbuxx=vbuc1_plus_vbuyy
//SEG34 [17] (byte) w::b2#0 ← (word/signed word/dword/signed dword) 1400-(word/signed word/dword/signed dword) 1350 + (byte) w::i#2 -- vbuxx=vbuc1_plus_vbuyy
tya
clc
adc #$578-$546
tax
//SEG34 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 -- pbuc1_derefidx_vbuyy=vbuc2
//SEG35 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 -- pbuc1_derefidx_vbuyy=vbuc2
lda #b
sta SCREEN3,y
//SEG35 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 -- pbuc1_derefidx_vbuyy=vbuxx
//SEG36 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta SCREEN4,y
//SEG36 [20] (byte) w::i#1 ← ++ (byte) w::i#2 -- vbuyy=_inc_vbuyy
//SEG37 [20] (byte) w::i#1 ← ++ (byte) w::i#2 -- vbuyy=_inc_vbuyy
iny
//SEG37 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto w::@1 -- vbuyy_neq_vbuc1_then_la1
//SEG38 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto w::@1 -- vbuyy_neq_vbuc1_then_la1
cpy #$b
bne b1
//SEG38 w::@return
//SEG39 [22] return
//SEG39 w::@return
//SEG40 [22] return
rts
}

View File

@ -369,29 +369,30 @@ Allocated zp ZP_BYTE:7 [ main::c#2 ]
Allocated zp ZP_BYTE:8 [ main::$1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label PROCPORT = 1
.label CHARGEN = $d000
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
.label CHAR_A = CHARGEN+8
.label _1 = 8
@ -400,97 +401,97 @@ main: {
.label x = 6
.label y = 2
.label c = 7
//SEG9 asm { sei }
//SEG10 asm { sei }
sei
//SEG10 [5] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- _deref_pbuc1=vbuc2
lda #$32
sta PROCPORT
//SEG11 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG12 [6] phi (byte*) main::sc#7 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
//SEG13 [6] phi (byte*) main::sc#7 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
lda #<SCREEN
sta sc
lda #>SCREEN
sta sc+1
//SEG13 [6] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
//SEG14 [6] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
lda #0
sta y
jmp b1
//SEG14 [6] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG15 [6] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
b1_from_b5:
//SEG15 [6] phi (byte*) main::sc#7 = (byte*) main::sc#2 [phi:main::@5->main::@1#0] -- register_copy
//SEG16 [6] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#1] -- register_copy
//SEG16 [6] phi (byte*) main::sc#7 = (byte*) main::sc#2 [phi:main::@5->main::@1#0] -- register_copy
//SEG17 [6] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#1] -- register_copy
jmp b1
//SEG17 main::@1
//SEG18 main::@1
b1:
//SEG18 [7] (byte) main::bits#0 ← *((const byte*) main::CHAR_A#0 + (byte) main::y#2) -- vbuz1=pbuc1_derefidx_vbuz2
//SEG19 [7] (byte) main::bits#0 ← *((const byte*) main::CHAR_A#0 + (byte) main::y#2) -- vbuz1=pbuc1_derefidx_vbuz2
ldy y
lda CHAR_A,y
sta bits
//SEG19 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG20 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
//SEG20 [8] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
//SEG21 [8] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
lda #0
sta x
//SEG21 [8] phi (byte*) main::sc#3 = (byte*) main::sc#7 [phi:main::@1->main::@2#1] -- register_copy
//SEG22 [8] phi (byte) main::bits#2 = (byte) main::bits#0 [phi:main::@1->main::@2#2] -- register_copy
//SEG22 [8] phi (byte*) main::sc#3 = (byte*) main::sc#7 [phi:main::@1->main::@2#1] -- register_copy
//SEG23 [8] phi (byte) main::bits#2 = (byte) main::bits#0 [phi:main::@1->main::@2#2] -- register_copy
jmp b2
//SEG23 [8] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
//SEG24 [8] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
b2_from_b3:
//SEG24 [8] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG25 [8] phi (byte*) main::sc#3 = (byte*) main::sc#1 [phi:main::@3->main::@2#1] -- register_copy
//SEG26 [8] phi (byte) main::bits#2 = (byte) main::bits#1 [phi:main::@3->main::@2#2] -- register_copy
//SEG25 [8] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG26 [8] phi (byte*) main::sc#3 = (byte*) main::sc#1 [phi:main::@3->main::@2#1] -- register_copy
//SEG27 [8] phi (byte) main::bits#2 = (byte) main::bits#1 [phi:main::@3->main::@2#2] -- register_copy
jmp b2
//SEG27 main::@2
//SEG28 main::@2
b2:
//SEG28 [9] (byte~) main::$1 ← (byte) main::bits#2 & (byte/word/signed word/dword/signed dword) 128 -- vbuz1=vbuz2_band_vbuc1
//SEG29 [9] (byte~) main::$1 ← (byte) main::bits#2 & (byte/word/signed word/dword/signed dword) 128 -- vbuz1=vbuz2_band_vbuc1
lda #$80
and bits
sta _1
//SEG29 [10] if((byte~) main::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@3 -- vbuz1_eq_0_then_la1
//SEG30 [10] if((byte~) main::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@3 -- vbuz1_eq_0_then_la1
lda _1
cmp #0
beq b3_from_b2
//SEG30 [11] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
//SEG31 [11] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
b4_from_b2:
jmp b4
//SEG31 main::@4
//SEG32 main::@4
b4:
//SEG32 [12] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
//SEG33 [12] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
b3_from_b4:
//SEG33 [12] phi (byte) main::c#2 = (byte) '*' [phi:main::@4->main::@3#0] -- vbuz1=vbuc1
//SEG34 [12] phi (byte) main::c#2 = (byte) '*' [phi:main::@4->main::@3#0] -- vbuz1=vbuc1
lda #'*'
sta c
jmp b3
//SEG34 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG35 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
//SEG35 [12] phi (byte) main::c#2 = (byte) '.' [phi:main::@2->main::@3#0] -- vbuz1=vbuc1
//SEG36 [12] phi (byte) main::c#2 = (byte) '.' [phi:main::@2->main::@3#0] -- vbuz1=vbuc1
lda #'.'
sta c
jmp b3
//SEG36 main::@3
//SEG37 main::@3
b3:
//SEG37 [13] *((byte*) main::sc#3) ← (byte) main::c#2 -- _deref_pbuz1=vbuz2
//SEG38 [13] *((byte*) main::sc#3) ← (byte) main::c#2 -- _deref_pbuz1=vbuz2
lda c
ldy #0
sta (sc),y
//SEG38 [14] (byte*) main::sc#1 ← ++ (byte*) main::sc#3 -- pbuz1=_inc_pbuz1
//SEG39 [14] (byte*) main::sc#1 ← ++ (byte*) main::sc#3 -- pbuz1=_inc_pbuz1
inc sc
bne !+
inc sc+1
!:
//SEG39 [15] (byte) main::bits#1 ← (byte) main::bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
//SEG40 [15] (byte) main::bits#1 ← (byte) main::bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
asl bits
//SEG40 [16] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuz1=_inc_vbuz1
//SEG41 [16] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuz1=_inc_vbuz1
inc x
//SEG41 [17] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
//SEG42 [17] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda x
cmp #8
bne b2_from_b3
jmp b5
//SEG42 main::@5
//SEG43 main::@5
b5:
//SEG43 [18] (byte*) main::sc#2 ← (byte*) main::sc#1 + (byte/signed byte/word/signed word/dword/signed dword) 32 -- pbuz1=pbuz1_plus_vbuc1
//SEG44 [18] (byte*) main::sc#2 ← (byte*) main::sc#1 + (byte/signed byte/word/signed word/dword/signed dword) 32 -- pbuz1=pbuz1_plus_vbuc1
lda sc
clc
adc #$20
@ -498,24 +499,24 @@ main: {
bcc !+
inc sc+1
!:
//SEG44 [19] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
//SEG45 [19] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
inc y
//SEG45 [20] if((byte) main::y#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG46 [20] if((byte) main::y#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda y
cmp #8
bne b1_from_b5
jmp b6
//SEG46 main::@6
//SEG47 main::@6
b6:
//SEG47 [21] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 55 -- _deref_pbuc1=vbuc2
//SEG48 [21] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 55 -- _deref_pbuc1=vbuc2
lda #$37
sta PROCPORT
//SEG48 asm { cli }
//SEG49 asm { cli }
cli
jmp breturn
//SEG49 main::@return
//SEG50 main::@return
breturn:
//SEG50 [23] return
//SEG51 [23] return
rts
}
@ -557,118 +558,119 @@ Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::y#2 main::y#1 ]
Uplifting [main] best 7232 combination zp ZP_BYTE:2 [ main::y#2 main::y#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label PROCPORT = 1
.label CHARGEN = $d000
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
.label CHAR_A = CHARGEN+8
.label bits = 3
.label sc = 4
.label y = 2
//SEG9 asm { sei }
//SEG10 asm { sei }
sei
//SEG10 [5] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- _deref_pbuc1=vbuc2
lda #$32
sta PROCPORT
//SEG11 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG12 [6] phi (byte*) main::sc#7 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
//SEG13 [6] phi (byte*) main::sc#7 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
lda #<SCREEN
sta sc
lda #>SCREEN
sta sc+1
//SEG13 [6] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
//SEG14 [6] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
lda #0
sta y
jmp b1
//SEG14 [6] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG15 [6] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
b1_from_b5:
//SEG15 [6] phi (byte*) main::sc#7 = (byte*) main::sc#2 [phi:main::@5->main::@1#0] -- register_copy
//SEG16 [6] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#1] -- register_copy
//SEG16 [6] phi (byte*) main::sc#7 = (byte*) main::sc#2 [phi:main::@5->main::@1#0] -- register_copy
//SEG17 [6] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#1] -- register_copy
jmp b1
//SEG17 main::@1
//SEG18 main::@1
b1:
//SEG18 [7] (byte) main::bits#0 ← *((const byte*) main::CHAR_A#0 + (byte) main::y#2) -- vbuz1=pbuc1_derefidx_vbuz2
//SEG19 [7] (byte) main::bits#0 ← *((const byte*) main::CHAR_A#0 + (byte) main::y#2) -- vbuz1=pbuc1_derefidx_vbuz2
ldy y
lda CHAR_A,y
sta bits
//SEG19 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG20 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
//SEG20 [8] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
//SEG21 [8] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
ldx #0
//SEG21 [8] phi (byte*) main::sc#3 = (byte*) main::sc#7 [phi:main::@1->main::@2#1] -- register_copy
//SEG22 [8] phi (byte) main::bits#2 = (byte) main::bits#0 [phi:main::@1->main::@2#2] -- register_copy
//SEG22 [8] phi (byte*) main::sc#3 = (byte*) main::sc#7 [phi:main::@1->main::@2#1] -- register_copy
//SEG23 [8] phi (byte) main::bits#2 = (byte) main::bits#0 [phi:main::@1->main::@2#2] -- register_copy
jmp b2
//SEG23 [8] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
//SEG24 [8] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
b2_from_b3:
//SEG24 [8] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG25 [8] phi (byte*) main::sc#3 = (byte*) main::sc#1 [phi:main::@3->main::@2#1] -- register_copy
//SEG26 [8] phi (byte) main::bits#2 = (byte) main::bits#1 [phi:main::@3->main::@2#2] -- register_copy
//SEG25 [8] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG26 [8] phi (byte*) main::sc#3 = (byte*) main::sc#1 [phi:main::@3->main::@2#1] -- register_copy
//SEG27 [8] phi (byte) main::bits#2 = (byte) main::bits#1 [phi:main::@3->main::@2#2] -- register_copy
jmp b2
//SEG27 main::@2
//SEG28 main::@2
b2:
//SEG28 [9] (byte~) main::$1 ← (byte) main::bits#2 & (byte/word/signed word/dword/signed dword) 128 -- vbuaa=vbuz1_band_vbuc1
//SEG29 [9] (byte~) main::$1 ← (byte) main::bits#2 & (byte/word/signed word/dword/signed dword) 128 -- vbuaa=vbuz1_band_vbuc1
lda #$80
and bits
//SEG29 [10] if((byte~) main::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@3 -- vbuaa_eq_0_then_la1
//SEG30 [10] if((byte~) main::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@3 -- vbuaa_eq_0_then_la1
cmp #0
beq b3_from_b2
//SEG30 [11] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
//SEG31 [11] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
b4_from_b2:
jmp b4
//SEG31 main::@4
//SEG32 main::@4
b4:
//SEG32 [12] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
//SEG33 [12] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
b3_from_b4:
//SEG33 [12] phi (byte) main::c#2 = (byte) '*' [phi:main::@4->main::@3#0] -- vbuaa=vbuc1
//SEG34 [12] phi (byte) main::c#2 = (byte) '*' [phi:main::@4->main::@3#0] -- vbuaa=vbuc1
lda #'*'
jmp b3
//SEG34 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG35 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
//SEG35 [12] phi (byte) main::c#2 = (byte) '.' [phi:main::@2->main::@3#0] -- vbuaa=vbuc1
//SEG36 [12] phi (byte) main::c#2 = (byte) '.' [phi:main::@2->main::@3#0] -- vbuaa=vbuc1
lda #'.'
jmp b3
//SEG36 main::@3
//SEG37 main::@3
b3:
//SEG37 [13] *((byte*) main::sc#3) ← (byte) main::c#2 -- _deref_pbuz1=vbuaa
//SEG38 [13] *((byte*) main::sc#3) ← (byte) main::c#2 -- _deref_pbuz1=vbuaa
ldy #0
sta (sc),y
//SEG38 [14] (byte*) main::sc#1 ← ++ (byte*) main::sc#3 -- pbuz1=_inc_pbuz1
//SEG39 [14] (byte*) main::sc#1 ← ++ (byte*) main::sc#3 -- pbuz1=_inc_pbuz1
inc sc
bne !+
inc sc+1
!:
//SEG39 [15] (byte) main::bits#1 ← (byte) main::bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
//SEG40 [15] (byte) main::bits#1 ← (byte) main::bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
asl bits
//SEG40 [16] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuxx=_inc_vbuxx
//SEG41 [16] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuxx=_inc_vbuxx
inx
//SEG41 [17] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
//SEG42 [17] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne b2_from_b3
jmp b5
//SEG42 main::@5
//SEG43 main::@5
b5:
//SEG43 [18] (byte*) main::sc#2 ← (byte*) main::sc#1 + (byte/signed byte/word/signed word/dword/signed dword) 32 -- pbuz1=pbuz1_plus_vbuc1
//SEG44 [18] (byte*) main::sc#2 ← (byte*) main::sc#1 + (byte/signed byte/word/signed word/dword/signed dword) 32 -- pbuz1=pbuz1_plus_vbuc1
lda sc
clc
adc #$20
@ -676,24 +678,24 @@ main: {
bcc !+
inc sc+1
!:
//SEG44 [19] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
//SEG45 [19] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
inc y
//SEG45 [20] if((byte) main::y#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG46 [20] if((byte) main::y#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda y
cmp #8
bne b1_from_b5
jmp b6
//SEG46 main::@6
//SEG47 main::@6
b6:
//SEG47 [21] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 55 -- _deref_pbuc1=vbuc2
//SEG48 [21] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 55 -- _deref_pbuc1=vbuc2
lda #$37
sta PROCPORT
//SEG48 asm { cli }
//SEG49 asm { cli }
cli
jmp breturn
//SEG49 main::@return
//SEG50 main::@return
breturn:
//SEG50 [23] return
//SEG51 [23] return
rts
}
@ -787,95 +789,96 @@ reg byte a [ main::$1 ]
FINAL ASSEMBLER
Score: 5627
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label PROCPORT = 1
.label CHARGEN = $d000
.label SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
.label CHAR_A = CHARGEN+8
.label bits = 3
.label sc = 4
.label y = 2
//SEG9 asm { sei }
//SEG10 asm { sei }
sei
//SEG10 [5] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- _deref_pbuc1=vbuc2
lda #$32
sta PROCPORT
//SEG11 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [6] phi (byte*) main::sc#7 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG13 [6] phi (byte*) main::sc#7 = (const byte*) SCREEN#0 [phi:main->main::@1#0] -- pbuz1=pbuc1
lda #<SCREEN
sta sc
lda #>SCREEN
sta sc+1
//SEG13 [6] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
//SEG14 [6] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
lda #0
sta y
//SEG14 [6] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG15 [6] phi (byte*) main::sc#7 = (byte*) main::sc#2 [phi:main::@5->main::@1#0] -- register_copy
//SEG16 [6] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#1] -- register_copy
//SEG17 main::@1
//SEG15 [6] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG16 [6] phi (byte*) main::sc#7 = (byte*) main::sc#2 [phi:main::@5->main::@1#0] -- register_copy
//SEG17 [6] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#1] -- register_copy
//SEG18 main::@1
b1:
//SEG18 [7] (byte) main::bits#0 ← *((const byte*) main::CHAR_A#0 + (byte) main::y#2) -- vbuz1=pbuc1_derefidx_vbuz2
//SEG19 [7] (byte) main::bits#0 ← *((const byte*) main::CHAR_A#0 + (byte) main::y#2) -- vbuz1=pbuc1_derefidx_vbuz2
ldy y
lda CHAR_A,y
sta bits
//SEG19 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG20 [8] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
//SEG20 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG21 [8] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuxx=vbuc1
ldx #0
//SEG21 [8] phi (byte*) main::sc#3 = (byte*) main::sc#7 [phi:main::@1->main::@2#1] -- register_copy
//SEG22 [8] phi (byte) main::bits#2 = (byte) main::bits#0 [phi:main::@1->main::@2#2] -- register_copy
//SEG23 [8] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
//SEG24 [8] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG25 [8] phi (byte*) main::sc#3 = (byte*) main::sc#1 [phi:main::@3->main::@2#1] -- register_copy
//SEG26 [8] phi (byte) main::bits#2 = (byte) main::bits#1 [phi:main::@3->main::@2#2] -- register_copy
//SEG27 main::@2
//SEG22 [8] phi (byte*) main::sc#3 = (byte*) main::sc#7 [phi:main::@1->main::@2#1] -- register_copy
//SEG23 [8] phi (byte) main::bits#2 = (byte) main::bits#0 [phi:main::@1->main::@2#2] -- register_copy
//SEG24 [8] phi from main::@3 to main::@2 [phi:main::@3->main::@2]
//SEG25 [8] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@3->main::@2#0] -- register_copy
//SEG26 [8] phi (byte*) main::sc#3 = (byte*) main::sc#1 [phi:main::@3->main::@2#1] -- register_copy
//SEG27 [8] phi (byte) main::bits#2 = (byte) main::bits#1 [phi:main::@3->main::@2#2] -- register_copy
//SEG28 main::@2
b2:
//SEG28 [9] (byte~) main::$1 ← (byte) main::bits#2 & (byte/word/signed word/dword/signed dword) 128 -- vbuaa=vbuz1_band_vbuc1
//SEG29 [9] (byte~) main::$1 ← (byte) main::bits#2 & (byte/word/signed word/dword/signed dword) 128 -- vbuaa=vbuz1_band_vbuc1
lda #$80
and bits
//SEG29 [10] if((byte~) main::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@3 -- vbuaa_eq_0_then_la1
//SEG30 [10] if((byte~) main::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@3 -- vbuaa_eq_0_then_la1
cmp #0
beq b4
//SEG30 [11] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
//SEG31 main::@4
//SEG32 [12] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
//SEG33 [12] phi (byte) main::c#2 = (byte) '*' [phi:main::@4->main::@3#0] -- vbuaa=vbuc1
//SEG31 [11] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
//SEG32 main::@4
//SEG33 [12] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
//SEG34 [12] phi (byte) main::c#2 = (byte) '*' [phi:main::@4->main::@3#0] -- vbuaa=vbuc1
lda #'*'
jmp b3
//SEG34 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG35 [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b4:
//SEG35 [12] phi (byte) main::c#2 = (byte) '.' [phi:main::@2->main::@3#0] -- vbuaa=vbuc1
//SEG36 [12] phi (byte) main::c#2 = (byte) '.' [phi:main::@2->main::@3#0] -- vbuaa=vbuc1
lda #'.'
//SEG36 main::@3
//SEG37 main::@3
b3:
//SEG37 [13] *((byte*) main::sc#3) ← (byte) main::c#2 -- _deref_pbuz1=vbuaa
//SEG38 [13] *((byte*) main::sc#3) ← (byte) main::c#2 -- _deref_pbuz1=vbuaa
ldy #0
sta (sc),y
//SEG38 [14] (byte*) main::sc#1 ← ++ (byte*) main::sc#3 -- pbuz1=_inc_pbuz1
//SEG39 [14] (byte*) main::sc#1 ← ++ (byte*) main::sc#3 -- pbuz1=_inc_pbuz1
inc sc
bne !+
inc sc+1
!:
//SEG39 [15] (byte) main::bits#1 ← (byte) main::bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
//SEG40 [15] (byte) main::bits#1 ← (byte) main::bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_rol_1
asl bits
//SEG40 [16] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuxx=_inc_vbuxx
//SEG41 [16] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuxx=_inc_vbuxx
inx
//SEG41 [17] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
//SEG42 [17] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne b2
//SEG42 main::@5
//SEG43 [18] (byte*) main::sc#2 ← (byte*) main::sc#1 + (byte/signed byte/word/signed word/dword/signed dword) 32 -- pbuz1=pbuz1_plus_vbuc1
//SEG43 main::@5
//SEG44 [18] (byte*) main::sc#2 ← (byte*) main::sc#1 + (byte/signed byte/word/signed word/dword/signed dword) 32 -- pbuz1=pbuz1_plus_vbuc1
lda sc
clc
adc #$20
@ -883,20 +886,20 @@ main: {
bcc !+
inc sc+1
!:
//SEG44 [19] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
//SEG45 [19] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
inc y
//SEG45 [20] if((byte) main::y#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG46 [20] if((byte) main::y#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda y
cmp #8
bne b1
//SEG46 main::@6
//SEG47 [21] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 55 -- _deref_pbuc1=vbuc2
//SEG47 main::@6
//SEG48 [21] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 55 -- _deref_pbuc1=vbuc2
lda #$37
sta PROCPORT
//SEG48 asm { cli }
//SEG49 asm { cli }
cli
//SEG49 main::@return
//SEG50 [23] return
//SEG50 main::@return
//SEG51 [23] return
rts
}

View File

@ -1,7 +1,7 @@
// Draws a chess board in the upper left corner of the screen
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Draws a chess board in the upper left corner of the screen
main: {
.label screen = 2
.label colors = 4

View File

@ -246,103 +246,104 @@ Allocated zp ZP_BYTE:7 [ main::column#2 main::column#1 ]
Allocated zp ZP_BYTE:8 [ main::color#3 main::color#5 main::color#2 main::color#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Draws a chess board in the upper left corner of the screen
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Draws a chess board in the upper left corner of the screen
//SEG10 main
main: {
.label color = 8
.label column = 7
.label screen = 2
.label colors = 4
.label row = 6
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::row#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::row#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta row
//SEG12 [5] phi (byte*) main::colors#4 = ((byte*))(word/dword/signed dword) 55296 [phi:main->main::@1#1] -- pbuz1=pbuc1
//SEG13 [5] phi (byte*) main::colors#4 = ((byte*))(word/dword/signed dword) 55296 [phi:main->main::@1#1] -- pbuz1=pbuc1
lda #<$d800
sta colors
lda #>$d800
sta colors+1
//SEG13 [5] phi (byte) main::color#5 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#2] -- vbuz1=vbuc1
//SEG14 [5] phi (byte) main::color#5 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#2] -- vbuz1=vbuc1
lda #1
sta color
//SEG14 [5] phi (byte*) main::screen#4 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#3] -- pbuz1=pbuc1
//SEG15 [5] phi (byte*) main::screen#4 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#3] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
jmp b1
//SEG15 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG16 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG16 [5] phi (byte) main::row#4 = (byte) main::row#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG17 [5] phi (byte*) main::colors#4 = (byte*) main::colors#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::color#5 = (byte) main::color#2 [phi:main::@3->main::@1#2] -- register_copy
//SEG19 [5] phi (byte*) main::screen#4 = (byte*) main::screen#1 [phi:main::@3->main::@1#3] -- register_copy
//SEG17 [5] phi (byte) main::row#4 = (byte) main::row#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG18 [5] phi (byte*) main::colors#4 = (byte*) main::colors#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::color#5 = (byte) main::color#2 [phi:main::@3->main::@1#2] -- register_copy
//SEG20 [5] phi (byte*) main::screen#4 = (byte*) main::screen#1 [phi:main::@3->main::@1#3] -- register_copy
jmp b1
//SEG20 main::@1
//SEG21 main::@1
b1:
//SEG21 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG22 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
//SEG22 [6] phi (byte) main::color#3 = (byte) main::color#5 [phi:main::@1->main::@2#0] -- register_copy
//SEG23 [6] phi (byte) main::column#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#1] -- vbuz1=vbuc1
//SEG23 [6] phi (byte) main::color#3 = (byte) main::color#5 [phi:main::@1->main::@2#0] -- register_copy
//SEG24 [6] phi (byte) main::column#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#1] -- vbuz1=vbuc1
lda #0
sta column
jmp b2
//SEG24 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG25 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
//SEG25 [6] phi (byte) main::color#3 = (byte) main::color#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG26 [6] phi (byte) main::column#2 = (byte) main::column#1 [phi:main::@2->main::@2#1] -- register_copy
//SEG26 [6] phi (byte) main::color#3 = (byte) main::color#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG27 [6] phi (byte) main::column#2 = (byte) main::column#1 [phi:main::@2->main::@2#1] -- register_copy
jmp b2
//SEG27 main::@2
//SEG28 main::@2
b2:
//SEG28 [7] *((byte*) main::screen#4 + (byte) main::column#2) ← (byte/word/signed word/dword/signed dword) 160 -- pbuz1_derefidx_vbuz2=vbuc1
//SEG29 [7] *((byte*) main::screen#4 + (byte) main::column#2) ← (byte/word/signed word/dword/signed dword) 160 -- pbuz1_derefidx_vbuz2=vbuc1
lda #$a0
ldy column
sta (screen),y
//SEG29 [8] *((byte*) main::colors#4 + (byte) main::column#2) ← (byte) main::color#3 -- pbuz1_derefidx_vbuz2=vbuz3
//SEG30 [8] *((byte*) main::colors#4 + (byte) main::column#2) ← (byte) main::color#3 -- pbuz1_derefidx_vbuz2=vbuz3
lda color
ldy column
sta (colors),y
//SEG30 [9] (byte) main::color#1 ← (byte) main::color#3 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_bxor_vbuc1
//SEG31 [9] (byte) main::color#1 ← (byte) main::color#3 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_bxor_vbuc1
lda color
eor #1
sta color
//SEG31 [10] (byte) main::column#1 ← ++ (byte) main::column#2 -- vbuz1=_inc_vbuz1
//SEG32 [10] (byte) main::column#1 ← ++ (byte) main::column#2 -- vbuz1=_inc_vbuz1
inc column
//SEG32 [11] if((byte) main::column#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
//SEG33 [11] if((byte) main::column#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda column
cmp #8
bne b2_from_b2
jmp b3
//SEG33 main::@3
//SEG34 main::@3
b3:
//SEG34 [12] (byte) main::color#2 ← (byte) main::color#1 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_bxor_vbuc1
//SEG35 [12] (byte) main::color#2 ← (byte) main::color#1 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_bxor_vbuc1
lda color
eor #1
sta color
//SEG35 [13] (byte*) main::screen#1 ← (byte*) main::screen#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG36 [13] (byte*) main::screen#1 ← (byte*) main::screen#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda screen
clc
adc #$28
@ -350,7 +351,7 @@ main: {
bcc !+
inc screen+1
!:
//SEG36 [14] (byte*) main::colors#1 ← (byte*) main::colors#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG37 [14] (byte*) main::colors#1 ← (byte*) main::colors#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda colors
clc
adc #$28
@ -358,16 +359,16 @@ main: {
bcc !+
inc colors+1
!:
//SEG37 [15] (byte) main::row#1 ← ++ (byte) main::row#4 -- vbuz1=_inc_vbuz1
//SEG38 [15] (byte) main::row#1 ← ++ (byte) main::row#4 -- vbuz1=_inc_vbuz1
inc row
//SEG38 [16] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG39 [16] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda row
cmp #8
bne b1_from_b3
jmp breturn
//SEG39 main::@return
//SEG40 main::@return
breturn:
//SEG40 [17] return
//SEG41 [17] return
rts
}
@ -403,96 +404,97 @@ Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::row#4 main::row#
Uplifting [main] best 4863 combination zp ZP_BYTE:6 [ main::row#4 main::row#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Draws a chess board in the upper left corner of the screen
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Draws a chess board in the upper left corner of the screen
//SEG10 main
main: {
.label screen = 2
.label colors = 4
.label row = 6
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::row#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::row#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta row
//SEG12 [5] phi (byte*) main::colors#4 = ((byte*))(word/dword/signed dword) 55296 [phi:main->main::@1#1] -- pbuz1=pbuc1
//SEG13 [5] phi (byte*) main::colors#4 = ((byte*))(word/dword/signed dword) 55296 [phi:main->main::@1#1] -- pbuz1=pbuc1
lda #<$d800
sta colors
lda #>$d800
sta colors+1
//SEG13 [5] phi (byte) main::color#5 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#2] -- vbuxx=vbuc1
//SEG14 [5] phi (byte) main::color#5 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#2] -- vbuxx=vbuc1
ldx #1
//SEG14 [5] phi (byte*) main::screen#4 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#3] -- pbuz1=pbuc1
//SEG15 [5] phi (byte*) main::screen#4 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#3] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
jmp b1
//SEG15 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG16 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG16 [5] phi (byte) main::row#4 = (byte) main::row#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG17 [5] phi (byte*) main::colors#4 = (byte*) main::colors#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::color#5 = (byte) main::color#2 [phi:main::@3->main::@1#2] -- register_copy
//SEG19 [5] phi (byte*) main::screen#4 = (byte*) main::screen#1 [phi:main::@3->main::@1#3] -- register_copy
//SEG17 [5] phi (byte) main::row#4 = (byte) main::row#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG18 [5] phi (byte*) main::colors#4 = (byte*) main::colors#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::color#5 = (byte) main::color#2 [phi:main::@3->main::@1#2] -- register_copy
//SEG20 [5] phi (byte*) main::screen#4 = (byte*) main::screen#1 [phi:main::@3->main::@1#3] -- register_copy
jmp b1
//SEG20 main::@1
//SEG21 main::@1
b1:
//SEG21 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG22 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
//SEG22 [6] phi (byte) main::color#3 = (byte) main::color#5 [phi:main::@1->main::@2#0] -- register_copy
//SEG23 [6] phi (byte) main::column#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#1] -- vbuyy=vbuc1
//SEG23 [6] phi (byte) main::color#3 = (byte) main::color#5 [phi:main::@1->main::@2#0] -- register_copy
//SEG24 [6] phi (byte) main::column#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#1] -- vbuyy=vbuc1
ldy #0
jmp b2
//SEG24 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG25 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
b2_from_b2:
//SEG25 [6] phi (byte) main::color#3 = (byte) main::color#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG26 [6] phi (byte) main::column#2 = (byte) main::column#1 [phi:main::@2->main::@2#1] -- register_copy
//SEG26 [6] phi (byte) main::color#3 = (byte) main::color#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG27 [6] phi (byte) main::column#2 = (byte) main::column#1 [phi:main::@2->main::@2#1] -- register_copy
jmp b2
//SEG27 main::@2
//SEG28 main::@2
b2:
//SEG28 [7] *((byte*) main::screen#4 + (byte) main::column#2) ← (byte/word/signed word/dword/signed dword) 160 -- pbuz1_derefidx_vbuyy=vbuc1
//SEG29 [7] *((byte*) main::screen#4 + (byte) main::column#2) ← (byte/word/signed word/dword/signed dword) 160 -- pbuz1_derefidx_vbuyy=vbuc1
lda #$a0
sta (screen),y
//SEG29 [8] *((byte*) main::colors#4 + (byte) main::column#2) ← (byte) main::color#3 -- pbuz1_derefidx_vbuyy=vbuxx
//SEG30 [8] *((byte*) main::colors#4 + (byte) main::column#2) ← (byte) main::color#3 -- pbuz1_derefidx_vbuyy=vbuxx
txa
sta (colors),y
//SEG30 [9] (byte) main::color#1 ← (byte) main::color#3 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_bxor_vbuc1
//SEG31 [9] (byte) main::color#1 ← (byte) main::color#3 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_bxor_vbuc1
txa
eor #1
tax
//SEG31 [10] (byte) main::column#1 ← ++ (byte) main::column#2 -- vbuyy=_inc_vbuyy
//SEG32 [10] (byte) main::column#1 ← ++ (byte) main::column#2 -- vbuyy=_inc_vbuyy
iny
//SEG32 [11] if((byte) main::column#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuyy_neq_vbuc1_then_la1
//SEG33 [11] if((byte) main::column#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuyy_neq_vbuc1_then_la1
cpy #8
bne b2_from_b2
jmp b3
//SEG33 main::@3
//SEG34 main::@3
b3:
//SEG34 [12] (byte) main::color#2 ← (byte) main::color#1 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_bxor_vbuc1
//SEG35 [12] (byte) main::color#2 ← (byte) main::color#1 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_bxor_vbuc1
txa
eor #1
tax
//SEG35 [13] (byte*) main::screen#1 ← (byte*) main::screen#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG36 [13] (byte*) main::screen#1 ← (byte*) main::screen#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda screen
clc
adc #$28
@ -500,7 +502,7 @@ main: {
bcc !+
inc screen+1
!:
//SEG36 [14] (byte*) main::colors#1 ← (byte*) main::colors#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG37 [14] (byte*) main::colors#1 ← (byte*) main::colors#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda colors
clc
adc #$28
@ -508,16 +510,16 @@ main: {
bcc !+
inc colors+1
!:
//SEG37 [15] (byte) main::row#1 ← ++ (byte) main::row#4 -- vbuz1=_inc_vbuz1
//SEG38 [15] (byte) main::row#1 ← ++ (byte) main::row#4 -- vbuz1=_inc_vbuz1
inc row
//SEG38 [16] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG39 [16] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda row
cmp #8
bne b1_from_b3
jmp breturn
//SEG39 main::@return
//SEG40 main::@return
breturn:
//SEG40 [17] return
//SEG41 [17] return
rts
}
@ -590,77 +592,78 @@ reg byte x [ main::color#3 main::color#5 main::color#2 main::color#1 ]
FINAL ASSEMBLER
Score: 3861
//SEG0 Basic Upstart
//SEG0 File Comments
// Draws a chess board in the upper left corner of the screen
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
// Draws a chess board in the upper left corner of the screen
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.label screen = 2
.label colors = 4
.label row = 6
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::row#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::row#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta row
//SEG12 [5] phi (byte*) main::colors#4 = ((byte*))(word/dword/signed dword) 55296 [phi:main->main::@1#1] -- pbuz1=pbuc1
//SEG13 [5] phi (byte*) main::colors#4 = ((byte*))(word/dword/signed dword) 55296 [phi:main->main::@1#1] -- pbuz1=pbuc1
lda #<$d800
sta colors
lda #>$d800
sta colors+1
//SEG13 [5] phi (byte) main::color#5 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#2] -- vbuxx=vbuc1
//SEG14 [5] phi (byte) main::color#5 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:main->main::@1#2] -- vbuxx=vbuc1
ldx #1
//SEG14 [5] phi (byte*) main::screen#4 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#3] -- pbuz1=pbuc1
//SEG15 [5] phi (byte*) main::screen#4 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#3] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
//SEG15 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG16 [5] phi (byte) main::row#4 = (byte) main::row#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG17 [5] phi (byte*) main::colors#4 = (byte*) main::colors#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG18 [5] phi (byte) main::color#5 = (byte) main::color#2 [phi:main::@3->main::@1#2] -- register_copy
//SEG19 [5] phi (byte*) main::screen#4 = (byte*) main::screen#1 [phi:main::@3->main::@1#3] -- register_copy
//SEG20 main::@1
//SEG16 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG17 [5] phi (byte) main::row#4 = (byte) main::row#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG18 [5] phi (byte*) main::colors#4 = (byte*) main::colors#1 [phi:main::@3->main::@1#1] -- register_copy
//SEG19 [5] phi (byte) main::color#5 = (byte) main::color#2 [phi:main::@3->main::@1#2] -- register_copy
//SEG20 [5] phi (byte*) main::screen#4 = (byte*) main::screen#1 [phi:main::@3->main::@1#3] -- register_copy
//SEG21 main::@1
b1:
//SEG21 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG22 [6] phi (byte) main::color#3 = (byte) main::color#5 [phi:main::@1->main::@2#0] -- register_copy
//SEG23 [6] phi (byte) main::column#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#1] -- vbuyy=vbuc1
//SEG22 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG23 [6] phi (byte) main::color#3 = (byte) main::color#5 [phi:main::@1->main::@2#0] -- register_copy
//SEG24 [6] phi (byte) main::column#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#1] -- vbuyy=vbuc1
ldy #0
//SEG24 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG25 [6] phi (byte) main::color#3 = (byte) main::color#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG26 [6] phi (byte) main::column#2 = (byte) main::column#1 [phi:main::@2->main::@2#1] -- register_copy
//SEG27 main::@2
//SEG25 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG26 [6] phi (byte) main::color#3 = (byte) main::color#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG27 [6] phi (byte) main::column#2 = (byte) main::column#1 [phi:main::@2->main::@2#1] -- register_copy
//SEG28 main::@2
b2:
//SEG28 [7] *((byte*) main::screen#4 + (byte) main::column#2) ← (byte/word/signed word/dword/signed dword) 160 -- pbuz1_derefidx_vbuyy=vbuc1
//SEG29 [7] *((byte*) main::screen#4 + (byte) main::column#2) ← (byte/word/signed word/dword/signed dword) 160 -- pbuz1_derefidx_vbuyy=vbuc1
lda #$a0
sta (screen),y
//SEG29 [8] *((byte*) main::colors#4 + (byte) main::column#2) ← (byte) main::color#3 -- pbuz1_derefidx_vbuyy=vbuxx
//SEG30 [8] *((byte*) main::colors#4 + (byte) main::column#2) ← (byte) main::color#3 -- pbuz1_derefidx_vbuyy=vbuxx
txa
sta (colors),y
//SEG30 [9] (byte) main::color#1 ← (byte) main::color#3 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_bxor_vbuc1
//SEG31 [9] (byte) main::color#1 ← (byte) main::color#3 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_bxor_vbuc1
txa
eor #1
tax
//SEG31 [10] (byte) main::column#1 ← ++ (byte) main::column#2 -- vbuyy=_inc_vbuyy
//SEG32 [10] (byte) main::column#1 ← ++ (byte) main::column#2 -- vbuyy=_inc_vbuyy
iny
//SEG32 [11] if((byte) main::column#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuyy_neq_vbuc1_then_la1
//SEG33 [11] if((byte) main::column#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@2 -- vbuyy_neq_vbuc1_then_la1
cpy #8
bne b2
//SEG33 main::@3
//SEG34 [12] (byte) main::color#2 ← (byte) main::color#1 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_bxor_vbuc1
//SEG34 main::@3
//SEG35 [12] (byte) main::color#2 ← (byte) main::color#1 ^ (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_bxor_vbuc1
txa
eor #1
tax
//SEG35 [13] (byte*) main::screen#1 ← (byte*) main::screen#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG36 [13] (byte*) main::screen#1 ← (byte*) main::screen#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda screen
clc
adc #$28
@ -668,7 +671,7 @@ main: {
bcc !+
inc screen+1
!:
//SEG36 [14] (byte*) main::colors#1 ← (byte*) main::colors#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG37 [14] (byte*) main::colors#1 ← (byte*) main::colors#4 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda colors
clc
adc #$28
@ -676,14 +679,14 @@ main: {
bcc !+
inc colors+1
!:
//SEG37 [15] (byte) main::row#1 ← ++ (byte) main::row#4 -- vbuz1=_inc_vbuz1
//SEG38 [15] (byte) main::row#1 ← ++ (byte) main::row#4 -- vbuz1=_inc_vbuz1
inc row
//SEG38 [16] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG39 [16] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda row
cmp #8
bne b1
//SEG39 main::@return
//SEG40 [17] return
//SEG40 main::@return
//SEG41 [17] return
rts
}

View File

@ -255,11 +255,12 @@ Allocated zp ZP_BYTE:4 [ irq_raster_next#1 ]
Allocated zp ZP_BYTE:5 [ irq::$0 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BORDERCOL = $d020
.label RASTER = $d012
.const DARK_GREY = $b
@ -267,88 +268,88 @@ INITIAL ASM
.label KERNEL_IRQ = $314
.label irq_raster_next = 3
.label irq_raster_next_1 = 4
//SEG2 @begin
//SEG3 @begin
bbegin:
jmp b1
//SEG3 @1
//SEG4 @1
b1:
//SEG4 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
//SEG5 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta irq_raster_next
//SEG5 [2] phi from @1 to @2 [phi:@1->@2]
//SEG6 [2] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
jmp b2
//SEG6 @2
//SEG7 @2
b2:
//SEG7 [3] call main
//SEG8 [3] call main
jsr main
//SEG8 [4] phi from @2 to @end [phi:@2->@end]
//SEG9 [4] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG9 @end
//SEG10 @end
bend:
//SEG10 main
//SEG11 main
main: {
//SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
//SEG12 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
lda #<irq
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
jmp breturn
//SEG12 main::@return
//SEG13 main::@return
breturn:
//SEG13 [6] return
//SEG14 [6] return
rts
}
//SEG14 irq
//SEG15 irq
irq: {
.label _0 = 5
.label raster_next = 2
//SEG15 entry interrupt(HARDWARE_CLOBBER)
//SEG16 entry interrupt(HARDWARE_CLOBBER)
sta rega+1
stx regx+1
sty regy+1
//SEG16 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2
//SEG17 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2
lda #DARK_GREY
sta BORDERCOL
//SEG17 [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1
//SEG18 [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1
lda #$15
clc
adc irq_raster_next
sta irq_raster_next_1
//SEG18 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuz1=vbuz2
//SEG19 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuz1=vbuz2
lda irq_raster_next_1
sta raster_next
//SEG19 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1
//SEG20 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1
lda #7
and raster_next
sta _0
//SEG20 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
//SEG21 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
lda _0
cmp #0
bne b1_from_irq
jmp b2
//SEG21 irq::@2
//SEG22 irq::@2
b2:
//SEG22 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_minus_1
//SEG23 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_minus_1
dec raster_next
//SEG23 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
//SEG24 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
b1_from_irq:
b1_from_b2:
//SEG24 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
//SEG25 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
jmp b1
//SEG25 irq::@1
//SEG26 irq::@1
b1:
//SEG26 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuz1
//SEG27 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuz1
lda raster_next
sta RASTER
//SEG27 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
//SEG28 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
jmp breturn
//SEG28 irq::@return
//SEG29 irq::@return
breturn:
//SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER)
//SEG30 [16] return - exit interrupt(HARDWARE_CLOBBER)
rega:
lda #00
regx:
@ -394,97 +395,98 @@ Uplifting [] best 248 combination zp ZP_BYTE:4 [ irq_raster_next#1 ]
Coalescing zero page register with common assignment [ zp ZP_BYTE:3 [ irq_raster_next#0 ] ] with [ zp ZP_BYTE:4 [ irq_raster_next#1 ] ] - score: 1
Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ irq_raster_next#0 irq_raster_next#1 ]
Interrupt procedure irq clobbers AXCNZV
Removing interrupt register storage sty regy+1 in SEG15 entry interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage regy: in SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage ldy #00 in SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage sty regy+1 in SEG16 entry interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage regy: in SEG30 [16] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage ldy #00 in SEG30 [16] return - exit interrupt(HARDWARE_CLOBBER)
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BORDERCOL = $d020
.label RASTER = $d012
.const DARK_GREY = $b
.const BLACK = 0
.label KERNEL_IRQ = $314
.label irq_raster_next = 2
//SEG2 @begin
//SEG3 @begin
bbegin:
jmp b1
//SEG3 @1
//SEG4 @1
b1:
//SEG4 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
//SEG5 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta irq_raster_next
//SEG5 [2] phi from @1 to @2 [phi:@1->@2]
//SEG6 [2] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
jmp b2
//SEG6 @2
//SEG7 @2
b2:
//SEG7 [3] call main
//SEG8 [3] call main
jsr main
//SEG8 [4] phi from @2 to @end [phi:@2->@end]
//SEG9 [4] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG9 @end
//SEG10 @end
bend:
//SEG10 main
//SEG11 main
main: {
//SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
//SEG12 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
lda #<irq
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
jmp breturn
//SEG12 main::@return
//SEG13 main::@return
breturn:
//SEG13 [6] return
//SEG14 [6] return
rts
}
//SEG14 irq
//SEG15 irq
irq: {
//SEG15 entry interrupt(HARDWARE_CLOBBER)
//SEG16 entry interrupt(HARDWARE_CLOBBER)
sta rega+1
stx regx+1
//SEG16 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2
//SEG17 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2
lda #DARK_GREY
sta BORDERCOL
//SEG17 [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1
//SEG18 [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1
lda #$15
clc
adc irq_raster_next
sta irq_raster_next
//SEG18 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuxx=vbuz1
//SEG19 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuxx=vbuz1
ldx irq_raster_next
//SEG19 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vbuxx_band_vbuc1
//SEG20 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vbuxx_band_vbuc1
txa
and #7
//SEG20 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuaa_neq_0_then_la1
//SEG21 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuaa_neq_0_then_la1
cmp #0
bne b1_from_irq
jmp b2
//SEG21 irq::@2
//SEG22 irq::@2
b2:
//SEG22 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_minus_1
//SEG23 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_minus_1
dex
//SEG23 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
//SEG24 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
b1_from_irq:
b1_from_b2:
//SEG24 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
//SEG25 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
jmp b1
//SEG25 irq::@1
//SEG26 irq::@1
b1:
//SEG26 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx
//SEG27 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx
stx RASTER
//SEG27 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
//SEG28 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
jmp breturn
//SEG28 irq::@return
//SEG29 irq::@return
breturn:
//SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER)
//SEG30 [16] return - exit interrupt(HARDWARE_CLOBBER)
rega:
lda #00
regx:
@ -554,75 +556,76 @@ reg byte a [ irq::$0 ]
FINAL ASSEMBLER
Score: 157
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BORDERCOL = $d020
.label RASTER = $d012
.const DARK_GREY = $b
.const BLACK = 0
.label KERNEL_IRQ = $314
.label irq_raster_next = 2
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 @1
//SEG4 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
//SEG4 @1
//SEG5 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta irq_raster_next
//SEG5 [2] phi from @1 to @2 [phi:@1->@2]
//SEG6 @2
//SEG7 [3] call main
//SEG6 [2] phi from @1 to @2 [phi:@1->@2]
//SEG7 @2
//SEG8 [3] call main
jsr main
//SEG8 [4] phi from @2 to @end [phi:@2->@end]
//SEG9 @end
//SEG10 main
//SEG9 [4] phi from @2 to @end [phi:@2->@end]
//SEG10 @end
//SEG11 main
main: {
//SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
//SEG12 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
lda #<irq
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
//SEG12 main::@return
//SEG13 [6] return
//SEG13 main::@return
//SEG14 [6] return
rts
}
//SEG14 irq
//SEG15 irq
irq: {
//SEG15 entry interrupt(HARDWARE_CLOBBER)
//SEG16 entry interrupt(HARDWARE_CLOBBER)
sta rega+1
stx regx+1
//SEG16 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2
//SEG17 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2
lda #DARK_GREY
sta BORDERCOL
//SEG17 [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1
//SEG18 [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1
lda #$15
clc
adc irq_raster_next
sta irq_raster_next
//SEG18 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuxx=vbuz1
//SEG19 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuxx=vbuz1
tax
//SEG19 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vbuxx_band_vbuc1
//SEG20 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vbuxx_band_vbuc1
txa
and #7
//SEG20 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuaa_neq_0_then_la1
//SEG21 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuaa_neq_0_then_la1
cmp #0
bne b1
//SEG21 irq::@2
//SEG22 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_minus_1
//SEG22 irq::@2
//SEG23 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_minus_1
dex
//SEG23 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
//SEG24 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
//SEG25 irq::@1
//SEG24 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
//SEG25 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
//SEG26 irq::@1
b1:
//SEG26 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx
//SEG27 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx
stx RASTER
//SEG27 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
//SEG28 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
lda #BLACK
sta BORDERCOL
//SEG28 irq::@return
//SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER)
//SEG29 irq::@return
//SEG30 [16] return - exit interrupt(HARDWARE_CLOBBER)
rega:
lda #00
regx:

View File

@ -1,7 +1,6 @@
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
// Commodore 64 Registers and Constants
// Processor port data direction register
.label PROCPORT_DDR = 0
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
@ -40,8 +39,6 @@
.label HARDWARE_IRQ = $fffe
// The colors of the C64
.const BLACK = 0
// Tetris Game for the Commodore 64
// Memory Layout and Shared Data
// Address of the first screen
.label PLAYFIELD_SCREEN_1 = $400
// Address of the second screen

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,9 @@
// Tetris Game for the Commodore 64
// The tetris game tries to match NES tetris gameplay pretty closely
// Source: https://meatfighter.com/nintendotetrisai/
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
// Commodore 64 Registers and Constants
// Processor port data direction register
.label PROCPORT_DDR = 0
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
@ -88,8 +90,6 @@
.label SID_VOICE3_CONTROL = $d412
.const SID_CONTROL_NOISE = $80
.label SID_VOICE3_OSC = $d41b
// Tetris Game for the Commodore 64
// Memory Layout and Shared Data
// Address of the first screen
.label PLAYFIELD_SCREEN_1 = $400
// Address of the second screen
@ -1689,8 +1689,6 @@ sprites_irq: {
keyboard_events: .fill 8, 0
// The values scanned values for each row. Set by keyboard_scan() and used by keyboard_get_event()
keyboard_scan_values: .fill 8, 0
// Tetris Game for the Commodore 64
// The tetris pieces
// The T-piece
.align $40
PIECE_T: .byte 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Concatenate a char to a string
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Concatenate a char to a string
main: {
.label screen = $400
ldx #0

View File

@ -129,58 +129,59 @@ Complete equivalence classes
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Concatenate a char to a string
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Concatenate a char to a string
//SEG10 main
main: {
.label screen = $400
.label i = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte[]) main::msg#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
//SEG16 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte[]) main::msg#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy i
lda msg,y
sta screen,y
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #3
bne b1_from_b1
jmp breturn
//SEG18 main::@return
//SEG19 main::@return
breturn:
//SEG19 [9] return
//SEG20 [9] return
rts
msg: .text "cm"+'l'
}
@ -199,54 +200,55 @@ Uplifting [main] best 288 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 288 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Concatenate a char to a string
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Concatenate a char to a string
//SEG10 main
main: {
.label screen = $400
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte[]) main::msg#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG16 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte[]) main::msg#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda msg,x
sta screen,x
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #3
bne b1_from_b1
jmp breturn
//SEG18 main::@return
//SEG19 main::@return
breturn:
//SEG19 [9] return
//SEG20 [9] return
rts
msg: .text "cm"+'l'
}
@ -298,39 +300,40 @@ reg byte x [ main::i#2 main::i#1 ]
FINAL ASSEMBLER
Score: 186
//SEG0 Basic Upstart
//SEG0 File Comments
// Concatenate a char to a string
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
// Concatenate a char to a string
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.label screen = $400
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte[]) main::msg#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG16 [6] *((const byte*) main::screen#0 + (byte) main::i#2) ← *((const byte[]) main::msg#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda msg,x
sta screen,x
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #3
bne b1
//SEG18 main::@return
//SEG19 [9] return
//SEG19 main::@return
//SEG20 [9] return
rts
msg: .text "cm"+'l'
}

View File

@ -145,69 +145,70 @@ Allocated zp ZP_BYTE:2 [ main::x#2 main::x#1 ]
Allocated zp ZP_BYTE:3 [ main::y#0 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.const BLACK = 0
.label screen = $400
.label cols = $d800
.label y = 3
.label x = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta x
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (byte) main::y#0 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuz1=vbuz2_plus_vbuc1
//SEG16 [6] (byte) main::y#0 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuz1=vbuz2_plus_vbuc1
lda #$c
clc
adc x
sta y
//SEG16 [7] *((const byte*) main::screen#0 + (byte) main::y#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
//SEG17 [7] *((const byte*) main::screen#0 + (byte) main::y#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
ldy y
lda #'a'
sta screen,y
//SEG17 [8] *((const byte*) main::cols#0 + (byte) main::y#0) ← (const byte) main::BLACK#0 -- pbuc1_derefidx_vbuz1=vbuc2
//SEG18 [8] *((const byte*) main::cols#0 + (byte) main::y#0) ← (const byte) main::BLACK#0 -- pbuc1_derefidx_vbuz1=vbuc2
ldy y
lda #BLACK
sta cols,y
//SEG18 [9] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuz1=_inc_vbuz1
//SEG19 [9] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuz1=_inc_vbuz1
inc x
//SEG19 [10] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG20 [10] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda x
cmp #$b
bne b1_from_b1
jmp breturn
//SEG20 main::@return
//SEG21 main::@return
breturn:
//SEG21 [11] return
//SEG22 [11] return
rts
}
@ -231,63 +232,64 @@ Uplifting [main] best 413 combination reg byte y [ main::x#2 main::x#1 ] reg byt
Uplifting [] best 413 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.const BLACK = 0
.label screen = $400
.label cols = $d800
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
//SEG12 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (byte) main::y#0 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuxx=vbuyy_plus_vbuc1
//SEG16 [6] (byte) main::y#0 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuxx=vbuyy_plus_vbuc1
tya
clc
adc #$c
tax
//SEG16 [7] *((const byte*) main::screen#0 + (byte) main::y#0) ← (byte) 'a' -- pbuc1_derefidx_vbuxx=vbuc2
//SEG17 [7] *((const byte*) main::screen#0 + (byte) main::y#0) ← (byte) 'a' -- pbuc1_derefidx_vbuxx=vbuc2
lda #'a'
sta screen,x
//SEG17 [8] *((const byte*) main::cols#0 + (byte) main::y#0) ← (const byte) main::BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG18 [8] *((const byte*) main::cols#0 + (byte) main::y#0) ← (const byte) main::BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #BLACK
sta cols,x
//SEG18 [9] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuyy=_inc_vbuyy
//SEG19 [9] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuyy=_inc_vbuyy
iny
//SEG19 [10] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuyy_neq_vbuc1_then_la1
//SEG20 [10] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuyy_neq_vbuc1_then_la1
cpy #$b
bne b1_from_b1
jmp breturn
//SEG20 main::@return
//SEG21 main::@return
breturn:
//SEG21 [11] return
//SEG22 [11] return
rts
}
@ -342,48 +344,49 @@ reg byte x [ main::y#0 ]
FINAL ASSEMBLER
Score: 311
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.const BLACK = 0
.label screen = $400
.label cols = $d800
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] (byte) main::y#0 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuxx=vbuyy_plus_vbuc1
//SEG16 [6] (byte) main::y#0 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuxx=vbuyy_plus_vbuc1
tya
clc
adc #$c
tax
//SEG16 [7] *((const byte*) main::screen#0 + (byte) main::y#0) ← (byte) 'a' -- pbuc1_derefidx_vbuxx=vbuc2
//SEG17 [7] *((const byte*) main::screen#0 + (byte) main::y#0) ← (byte) 'a' -- pbuc1_derefidx_vbuxx=vbuc2
lda #'a'
sta screen,x
//SEG17 [8] *((const byte*) main::cols#0 + (byte) main::y#0) ← (const byte) main::BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG18 [8] *((const byte*) main::cols#0 + (byte) main::y#0) ← (const byte) main::BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #BLACK
sta cols,x
//SEG18 [9] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuyy=_inc_vbuyy
//SEG19 [9] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuyy=_inc_vbuyy
iny
//SEG19 [10] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuyy_neq_vbuc1_then_la1
//SEG20 [10] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuyy_neq_vbuc1_then_la1
cpy #$b
bne b1
//SEG20 main::@return
//SEG21 [11] return
//SEG21 main::@return
//SEG22 [11] return
rts
}

View File

@ -170,52 +170,53 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
jmp b1
//SEG10 main::@1
//SEG11 main::@1
b1:
//SEG11 [5] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG12 [5] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta screen+$27
//SEG12 [6] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG13 [6] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta screen+$26
jmp b1_1
//SEG13 main::@1_1
//SEG14 main::@1_1
b1_1:
//SEG14 [7] *((byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1+(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG15 [7] *((byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1+(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta $28*1+screen+$27
//SEG15 [8] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38+(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG16 [8] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38+(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta screen+$26+$28*1
jmp breturn
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [9] return
//SEG18 [9] return
rts
}
@ -233,52 +234,53 @@ Uplifting [main] best 78 combination
Uplifting [] best 78 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
jmp b1
//SEG10 main::@1
//SEG11 main::@1
b1:
//SEG11 [5] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG12 [5] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta screen+$27
//SEG12 [6] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG13 [6] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta screen+$26
jmp b1_1
//SEG13 main::@1_1
//SEG14 main::@1_1
b1_1:
//SEG14 [7] *((byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1+(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG15 [7] *((byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1+(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta $28*1+screen+$27
//SEG15 [8] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38+(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG16 [8] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38+(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta screen+$26+$28*1
jmp breturn
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [9] return
//SEG18 [9] return
rts
}
@ -327,34 +329,35 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 24
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label screen = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG10 main::@1
//SEG11 [5] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG11 main::@1
//SEG12 [5] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
lda #0
sta screen+$27
//SEG12 [6] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG13 [6] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta screen+$26
//SEG13 main::@1_1
//SEG14 [7] *((byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1+(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG14 main::@1_1
//SEG15 [7] *((byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1+(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 39) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta $28*1+screen+$27
//SEG15 [8] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38+(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
//SEG16 [8] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 38+(byte/signed byte/word/signed word/dword/signed dword) 40*(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2
sta screen+$26+$28*1
//SEG16 main::@return
//SEG17 [9] return
//SEG17 main::@return
//SEG18 [9] return
rts
}

View File

@ -1,7 +1,7 @@
// Ensure that if()'s with constant comparisons are identified and eliminated
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Ensure that if()'s with constant comparisons are identified and eliminated
main: {
.label SCREEN = $400
lda #'!'

View File

@ -93,41 +93,42 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Ensure that if()'s with constant comparisons are identified and eliminated
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Ensure that if()'s with constant comparisons are identified and eliminated
//SEG10 main
main: {
.label SCREEN = $400
jmp b3
//SEG10 main::@3
//SEG11 main::@3
b3:
//SEG11 [5] *((const byte*) main::SCREEN#0) ← (byte) '!' -- _deref_pbuc1=vbuc2
//SEG12 [5] *((const byte*) main::SCREEN#0) ← (byte) '!' -- _deref_pbuc1=vbuc2
lda #'!'
sta SCREEN
jmp breturn
//SEG12 main::@return
//SEG13 main::@return
breturn:
//SEG13 [6] return
//SEG14 [6] return
rts
}
@ -142,41 +143,42 @@ Uplifting [main] best 57 combination
Uplifting [] best 57 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Ensure that if()'s with constant comparisons are identified and eliminated
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Ensure that if()'s with constant comparisons are identified and eliminated
//SEG10 main
main: {
.label SCREEN = $400
jmp b3
//SEG10 main::@3
//SEG11 main::@3
b3:
//SEG11 [5] *((const byte*) main::SCREEN#0) ← (byte) '!' -- _deref_pbuc1=vbuc2
//SEG12 [5] *((const byte*) main::SCREEN#0) ← (byte) '!' -- _deref_pbuc1=vbuc2
lda #'!'
sta SCREEN
jmp breturn
//SEG12 main::@return
//SEG13 main::@return
breturn:
//SEG13 [6] return
//SEG14 [6] return
rts
}
@ -216,28 +218,29 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 12
//SEG0 Basic Upstart
//SEG0 File Comments
// Ensure that if()'s with constant comparisons are identified and eliminated
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
// Ensure that if()'s with constant comparisons are identified and eliminated
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.label SCREEN = $400
//SEG10 main::@3
//SEG11 [5] *((const byte*) main::SCREEN#0) ← (byte) '!' -- _deref_pbuc1=vbuc2
//SEG11 main::@3
//SEG12 [5] *((const byte*) main::SCREEN#0) ← (byte) '!' -- _deref_pbuc1=vbuc2
lda #'!'
sta SCREEN
//SEG12 main::@return
//SEG13 [6] return
//SEG13 main::@return
//SEG14 [6] return
rts
}

View File

@ -288,130 +288,131 @@ Allocated zp ZP_BYTE:5 [ plot::idx#0 ]
Allocated zp ZP_BYTE:6 [ plot::$0 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label plots = $1000
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG4 [1] phi from @begin to @3 [phi:@begin->@3]
b3_from_bbegin:
jmp b3
//SEG4 @3
//SEG5 @3
b3:
//SEG5 [2] call main
//SEG6 [4] phi from @3 to main [phi:@3->main]
//SEG6 [2] call main
//SEG7 [4] phi from @3 to main [phi:@3->main]
main_from_b3:
jsr main
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
//SEG8 [3] phi from @3 to @end [phi:@3->@end]
bend_from_b3:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.label i = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuz1
//SEG16 [6] *((const byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuz1
ldy i
tya
sta plots,y
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuz1=vbuc2
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuz1=vbuc2
ldy i
lda #0
sta SCREEN,y
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG18 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$28
bne b1_from_b1
//SEG19 [10] phi from main::@1 main::@2 to main::@2 [phi:main::@1/main::@2->main::@2]
//SEG20 [10] phi from main::@1 main::@2 to main::@2 [phi:main::@1/main::@2->main::@2]
b2_from_b1:
b2_from_b2:
jmp b2
//SEG20 main::@2
//SEG21 main::@2
b2:
//SEG21 [11] call line
//SEG22 [12] phi from main::@2 to line [phi:main::@2->line]
//SEG22 [11] call line
//SEG23 [12] phi from main::@2 to line [phi:main::@2->line]
line_from_b2:
jsr line
jmp b2_from_b2
}
//SEG23 line
//SEG24 line
line: {
.const x0 = 0
.const x1 = $a
.label x = 3
//SEG24 [13] phi from line to line::@3 [phi:line->line::@3]
//SEG25 [13] phi from line to line::@3 [phi:line->line::@3]
b3_from_line:
//SEG25 [13] phi (byte) line::x#2 = (const byte) line::x0#0 [phi:line->line::@3#0] -- vbuz1=vbuc1
//SEG26 [13] phi (byte) line::x#2 = (const byte) line::x0#0 [phi:line->line::@3#0] -- vbuz1=vbuc1
lda #x0
sta x
jmp b3
//SEG26 [13] phi from line::@8 to line::@3 [phi:line::@8->line::@3]
//SEG27 [13] phi from line::@8 to line::@3 [phi:line::@8->line::@3]
b3_from_b8:
//SEG27 [13] phi (byte) line::x#2 = (byte) line::x#1 [phi:line::@8->line::@3#0] -- register_copy
//SEG28 [13] phi (byte) line::x#2 = (byte) line::x#1 [phi:line::@8->line::@3#0] -- register_copy
jmp b3
//SEG28 line::@3
//SEG29 line::@3
b3:
//SEG29 [14] (byte) plot::x#1 ← (byte) line::x#2 -- vbuz1=vbuz2
//SEG30 [14] (byte) plot::x#1 ← (byte) line::x#2 -- vbuz1=vbuz2
lda x
sta plot.x
//SEG30 [15] call plot
//SEG31 [15] call plot
jsr plot
jmp b8
//SEG31 line::@8
//SEG32 line::@8
b8:
//SEG32 [16] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuz1=_inc_vbuz1
//SEG33 [16] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuz1=_inc_vbuz1
inc x
//SEG33 [17] if((byte) line::x#1<=(const byte) line::x1#0) goto line::@3 -- vbuz1_le_vbuc1_then_la1
//SEG34 [17] if((byte) line::x#1<=(const byte) line::x1#0) goto line::@3 -- vbuz1_le_vbuc1_then_la1
lda #x1
cmp x
bcs b3_from_b8
jmp breturn
//SEG34 line::@return
//SEG35 line::@return
breturn:
//SEG35 [18] return
//SEG36 [18] return
rts
}
//SEG36 plot
//SEG37 plot
plot: {
.label _0 = 6
.label x = 4
.label idx = 5
//SEG37 [19] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#1) -- vbuz1=pbuc1_derefidx_vbuz2
//SEG38 [19] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#1) -- vbuz1=pbuc1_derefidx_vbuz2
ldy x
lda plots,y
sta idx
//SEG38 [20] (byte/signed word/word/dword/signed dword~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=pbuc1_derefidx_vbuz2_plus_1
//SEG39 [20] (byte/signed word/word/dword/signed dword~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=pbuc1_derefidx_vbuz2_plus_1
ldy idx
lda SCREEN,y
clc
adc #1
sta _0
//SEG39 [21] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/signed word/word/dword/signed dword~) plot::$0 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG40 [21] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/signed word/word/dword/signed dword~) plot::$0 -- pbuc1_derefidx_vbuz1=vbuz2
lda _0
ldy idx
sta SCREEN,y
jmp breturn
//SEG40 plot::@return
//SEG41 plot::@return
breturn:
//SEG41 [22] return
//SEG42 [22] return
rts
}
@ -442,112 +443,113 @@ Uplifting [main] best 3268 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 3268 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label plots = $1000
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG4 [1] phi from @begin to @3 [phi:@begin->@3]
b3_from_bbegin:
jmp b3
//SEG4 @3
//SEG5 @3
b3:
//SEG5 [2] call main
//SEG6 [4] phi from @3 to main [phi:@3->main]
//SEG6 [2] call main
//SEG7 [4] phi from @3 to main [phi:@3->main]
main_from_b3:
jsr main
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
//SEG8 [3] phi from @3 to @end [phi:@3->@end]
bend_from_b3:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
//SEG16 [6] *((const byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta plots,x
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #0
sta SCREEN,x
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG18 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$28
bne b1_from_b1
//SEG19 [10] phi from main::@1 main::@2 to main::@2 [phi:main::@1/main::@2->main::@2]
//SEG20 [10] phi from main::@1 main::@2 to main::@2 [phi:main::@1/main::@2->main::@2]
b2_from_b1:
b2_from_b2:
jmp b2
//SEG20 main::@2
//SEG21 main::@2
b2:
//SEG21 [11] call line
//SEG22 [12] phi from main::@2 to line [phi:main::@2->line]
//SEG22 [11] call line
//SEG23 [12] phi from main::@2 to line [phi:main::@2->line]
line_from_b2:
jsr line
jmp b2_from_b2
}
//SEG23 line
//SEG24 line
line: {
.const x0 = 0
.const x1 = $a
//SEG24 [13] phi from line to line::@3 [phi:line->line::@3]
//SEG25 [13] phi from line to line::@3 [phi:line->line::@3]
b3_from_line:
//SEG25 [13] phi (byte) line::x#2 = (const byte) line::x0#0 [phi:line->line::@3#0] -- vbuxx=vbuc1
//SEG26 [13] phi (byte) line::x#2 = (const byte) line::x0#0 [phi:line->line::@3#0] -- vbuxx=vbuc1
ldx #x0
jmp b3
//SEG26 [13] phi from line::@8 to line::@3 [phi:line::@8->line::@3]
//SEG27 [13] phi from line::@8 to line::@3 [phi:line::@8->line::@3]
b3_from_b8:
//SEG27 [13] phi (byte) line::x#2 = (byte) line::x#1 [phi:line::@8->line::@3#0] -- register_copy
//SEG28 [13] phi (byte) line::x#2 = (byte) line::x#1 [phi:line::@8->line::@3#0] -- register_copy
jmp b3
//SEG28 line::@3
//SEG29 line::@3
b3:
//SEG29 [14] (byte) plot::x#1 ← (byte) line::x#2
//SEG30 [15] call plot
//SEG30 [14] (byte) plot::x#1 ← (byte) line::x#2
//SEG31 [15] call plot
jsr plot
jmp b8
//SEG31 line::@8
//SEG32 line::@8
b8:
//SEG32 [16] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuxx=_inc_vbuxx
//SEG33 [16] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuxx=_inc_vbuxx
inx
//SEG33 [17] if((byte) line::x#1<=(const byte) line::x1#0) goto line::@3 -- vbuxx_le_vbuc1_then_la1
//SEG34 [17] if((byte) line::x#1<=(const byte) line::x1#0) goto line::@3 -- vbuxx_le_vbuc1_then_la1
cpx #x1
bcc b3_from_b8
beq b3_from_b8
jmp breturn
//SEG34 line::@return
//SEG35 line::@return
breturn:
//SEG35 [18] return
//SEG36 [18] return
rts
}
//SEG36 plot
//SEG37 plot
plot: {
//SEG37 [19] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#1) -- vbuyy=pbuc1_derefidx_vbuxx
//SEG38 [19] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#1) -- vbuyy=pbuc1_derefidx_vbuxx
ldy plots,x
//SEG38 [20] (byte/signed word/word/dword/signed dword~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=pbuc1_derefidx_vbuyy_plus_1
//SEG39 [20] (byte/signed word/word/dword/signed dword~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=pbuc1_derefidx_vbuyy_plus_1
lda SCREEN,y
clc
adc #1
//SEG39 [21] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/signed word/word/dword/signed dword~) plot::$0 -- pbuc1_derefidx_vbuyy=vbuaa
//SEG40 [21] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/signed word/word/dword/signed dword~) plot::$0 -- pbuc1_derefidx_vbuyy=vbuaa
sta SCREEN,y
jmp breturn
//SEG40 plot::@return
//SEG41 plot::@return
breturn:
//SEG41 [22] return
//SEG42 [22] return
rts
}
@ -634,85 +636,86 @@ reg byte a [ plot::$0 ]
FINAL ASSEMBLER
Score: 1963
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label plots = $1000
.label SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG4 @3
//SEG5 [2] call main
//SEG6 [4] phi from @3 to main [phi:@3->main]
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG5 @3
//SEG6 [2] call main
//SEG7 [4] phi from @3 to main [phi:@3->main]
//SEG8 [3] phi from @3 to @end [phi:@3->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
//SEG16 [6] *((const byte*) plots#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta plots,x
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- pbuc1_derefidx_vbuxx=vbuc2
lda #0
sta SCREEN,x
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG18 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 40) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$28
bne b1
//SEG19 [10] phi from main::@1 main::@2 to main::@2 [phi:main::@1/main::@2->main::@2]
//SEG20 main::@2
//SEG20 [10] phi from main::@1 main::@2 to main::@2 [phi:main::@1/main::@2->main::@2]
//SEG21 main::@2
b2:
//SEG21 [11] call line
//SEG22 [12] phi from main::@2 to line [phi:main::@2->line]
//SEG22 [11] call line
//SEG23 [12] phi from main::@2 to line [phi:main::@2->line]
jsr line
jmp b2
}
//SEG23 line
//SEG24 line
line: {
.const x0 = 0
.const x1 = $a
//SEG24 [13] phi from line to line::@3 [phi:line->line::@3]
//SEG25 [13] phi (byte) line::x#2 = (const byte) line::x0#0 [phi:line->line::@3#0] -- vbuxx=vbuc1
//SEG25 [13] phi from line to line::@3 [phi:line->line::@3]
//SEG26 [13] phi (byte) line::x#2 = (const byte) line::x0#0 [phi:line->line::@3#0] -- vbuxx=vbuc1
ldx #x0
//SEG26 [13] phi from line::@8 to line::@3 [phi:line::@8->line::@3]
//SEG27 [13] phi (byte) line::x#2 = (byte) line::x#1 [phi:line::@8->line::@3#0] -- register_copy
//SEG28 line::@3
//SEG27 [13] phi from line::@8 to line::@3 [phi:line::@8->line::@3]
//SEG28 [13] phi (byte) line::x#2 = (byte) line::x#1 [phi:line::@8->line::@3#0] -- register_copy
//SEG29 line::@3
b3:
//SEG29 [14] (byte) plot::x#1 ← (byte) line::x#2
//SEG30 [15] call plot
//SEG30 [14] (byte) plot::x#1 ← (byte) line::x#2
//SEG31 [15] call plot
jsr plot
//SEG31 line::@8
//SEG32 [16] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuxx=_inc_vbuxx
//SEG32 line::@8
//SEG33 [16] (byte) line::x#1 ← ++ (byte) line::x#2 -- vbuxx=_inc_vbuxx
inx
//SEG33 [17] if((byte) line::x#1<=(const byte) line::x1#0) goto line::@3 -- vbuxx_le_vbuc1_then_la1
//SEG34 [17] if((byte) line::x#1<=(const byte) line::x1#0) goto line::@3 -- vbuxx_le_vbuc1_then_la1
cpx #x1
bcc b3
beq b3
//SEG34 line::@return
//SEG35 [18] return
//SEG35 line::@return
//SEG36 [18] return
rts
}
//SEG36 plot
//SEG37 plot
plot: {
//SEG37 [19] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#1) -- vbuyy=pbuc1_derefidx_vbuxx
//SEG38 [19] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#1) -- vbuyy=pbuc1_derefidx_vbuxx
ldy plots,x
//SEG38 [20] (byte/signed word/word/dword/signed dword~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=pbuc1_derefidx_vbuyy_plus_1
//SEG39 [20] (byte/signed word/word/dword/signed dword~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=pbuc1_derefidx_vbuyy_plus_1
lda SCREEN,y
clc
adc #1
//SEG39 [21] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/signed word/word/dword/signed dword~) plot::$0 -- pbuc1_derefidx_vbuyy=vbuaa
//SEG40 [21] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/signed word/word/dword/signed dword~) plot::$0 -- pbuc1_derefidx_vbuyy=vbuaa
sta SCREEN,y
//SEG40 plot::@return
//SEG41 [22] return
//SEG41 plot::@return
//SEG42 [22] return
rts
}

View File

@ -1,7 +1,7 @@
// Test a constant with multiplication and division
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Test a constant with multiplication and division
main: {
.label screen = $400
.const b = 6*$e/3+mod($16,3)

View File

@ -95,37 +95,38 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a constant with multiplication and division
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Test a constant with multiplication and division
//SEG9 main
main: {
.label screen = $400
.const b = 6*$e/3+mod($16,3)
//SEG9 [4] *((const byte*) main::screen#0) ← (const byte) main::b#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (const byte) main::b#0 -- _deref_pbuc1=vbuc2
lda #b
sta screen
jmp breturn
//SEG10 main::@return
//SEG11 main::@return
breturn:
//SEG11 [5] return
//SEG12 [5] return
rts
}
@ -140,37 +141,38 @@ Uplifting [main] best 27 combination
Uplifting [] best 27 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a constant with multiplication and division
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Test a constant with multiplication and division
//SEG9 main
main: {
.label screen = $400
.const b = 6*$e/3+mod($16,3)
//SEG9 [4] *((const byte*) main::screen#0) ← (const byte) main::b#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (const byte) main::b#0 -- _deref_pbuc1=vbuc2
lda #b
sta screen
jmp breturn
//SEG10 main::@return
//SEG11 main::@return
breturn:
//SEG11 [5] return
//SEG12 [5] return
rts
}
@ -208,27 +210,28 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 12
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a constant with multiplication and division
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
// Test a constant with multiplication and division
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
.label screen = $400
.const b = 6*$e/3+mod($16,3)
//SEG9 [4] *((const byte*) main::screen#0) ← (const byte) main::b#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (const byte) main::b#0 -- _deref_pbuc1=vbuc2
lda #b
sta screen
//SEG10 main::@return
//SEG11 [5] return
//SEG11 main::@return
//SEG12 [5] return
rts
}

View File

@ -1,7 +1,7 @@
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
main: {
.label screen = $400
.label reverse = $80

View File

@ -242,114 +242,115 @@ Allocated zp ZP_BYTE:8 [ main::$2 ]
Allocated zp ZP_BYTE:9 [ sum::return#3 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
//SEG10 main
main: {
.label screen = $400
.label reverse = $80
.label _0 = 4
.label _1 = 6
.label _2 = 8
//SEG10 [5] call sum
//SEG11 [18] phi from main to sum [phi:main->sum]
//SEG11 [5] call sum
//SEG12 [18] phi from main to sum [phi:main->sum]
sum_from_main:
//SEG12 [18] phi (byte) sum::b#3 = (byte) 'c' [phi:main->sum#0] -- vbuz1=vbuc1
//SEG13 [18] phi (byte) sum::b#3 = (byte) 'c' [phi:main->sum#0] -- vbuz1=vbuc1
lda #'c'
sta sum.b
jsr sum
//SEG13 [6] (byte) sum::return#0 ← (byte) sum::return#3 -- vbuz1=vbuz2
//SEG14 [6] (byte) sum::return#0 ← (byte) sum::return#3 -- vbuz1=vbuz2
lda sum.return_3
sta sum.return
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [7] (byte~) main::$0 ← (byte) sum::return#0 -- vbuz1=vbuz2
//SEG16 [7] (byte~) main::$0 ← (byte) sum::return#0 -- vbuz1=vbuz2
lda sum.return
sta _0
//SEG16 [8] *((const byte*) main::screen#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuz1
//SEG17 [8] *((const byte*) main::screen#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuz1
lda _0
sta screen
//SEG17 [9] call sum
//SEG18 [18] phi from main::@1 to sum [phi:main::@1->sum]
//SEG18 [9] call sum
//SEG19 [18] phi from main::@1 to sum [phi:main::@1->sum]
sum_from_b1:
//SEG19 [18] phi (byte) sum::b#3 = (byte) 'm' [phi:main::@1->sum#0] -- vbuz1=vbuc1
//SEG20 [18] phi (byte) sum::b#3 = (byte) 'm' [phi:main::@1->sum#0] -- vbuz1=vbuc1
lda #'m'
sta sum.b
jsr sum
//SEG20 [10] (byte) sum::return#1 ← (byte) sum::return#3 -- vbuz1=vbuz2
//SEG21 [10] (byte) sum::return#1 ← (byte) sum::return#3 -- vbuz1=vbuz2
lda sum.return_3
sta sum.return_1
jmp b2
//SEG21 main::@2
//SEG22 main::@2
b2:
//SEG22 [11] (byte~) main::$1 ← (byte) sum::return#1 -- vbuz1=vbuz2
//SEG23 [11] (byte~) main::$1 ← (byte) sum::return#1 -- vbuz1=vbuz2
lda sum.return_1
sta _1
//SEG23 [12] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuz1
//SEG24 [12] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuz1
lda _1
sta screen+1
//SEG24 [13] call sum
//SEG25 [18] phi from main::@2 to sum [phi:main::@2->sum]
//SEG25 [13] call sum
//SEG26 [18] phi from main::@2 to sum [phi:main::@2->sum]
sum_from_b2:
//SEG26 [18] phi (byte) sum::b#3 = (byte) 'l' [phi:main::@2->sum#0] -- vbuz1=vbuc1
//SEG27 [18] phi (byte) sum::b#3 = (byte) 'l' [phi:main::@2->sum#0] -- vbuz1=vbuc1
lda #'l'
sta sum.b
jsr sum
//SEG27 [14] (byte) sum::return#2 ← (byte) sum::return#3 -- vbuz1=vbuz2
//SEG28 [14] (byte) sum::return#2 ← (byte) sum::return#3 -- vbuz1=vbuz2
lda sum.return_3
sta sum.return_2
jmp b3
//SEG28 main::@3
//SEG29 main::@3
b3:
//SEG29 [15] (byte~) main::$2 ← (byte) sum::return#2 -- vbuz1=vbuz2
//SEG30 [15] (byte~) main::$2 ← (byte) sum::return#2 -- vbuz1=vbuz2
lda sum.return_2
sta _2
//SEG30 [16] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuz1
//SEG31 [16] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuz1
lda _2
sta screen+2
jmp breturn
//SEG31 main::@return
//SEG32 main::@return
breturn:
//SEG32 [17] return
//SEG33 [17] return
rts
}
//SEG33 sum
//SEG34 sum
sum: {
.label return = 3
.label return_1 = 5
.label return_2 = 7
.label return_3 = 9
.label b = 2
//SEG34 [19] (byte) sum::return#3 ← (const byte) main::reverse#0 + (byte) sum::b#3 -- vbuz1=vbuc1_plus_vbuz2
//SEG35 [19] (byte) sum::return#3 ← (const byte) main::reverse#0 + (byte) sum::b#3 -- vbuz1=vbuc1_plus_vbuz2
lda #main.reverse
clc
adc b
sta return_3
jmp breturn
//SEG35 sum::@return
//SEG36 sum::@return
breturn:
//SEG36 [20] return
//SEG37 [20] return
rts
}
@ -377,86 +378,87 @@ Attempting to uplift remaining variables inzp ZP_BYTE:9 [ sum::return#3 ]
Uplifting [sum] best 79 combination reg byte a [ sum::return#3 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
b2_from_bbegin:
jmp b2
//SEG4 @2
//SEG5 @2
b2:
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
//SEG10 main
main: {
.label screen = $400
.label reverse = $80
//SEG10 [5] call sum
//SEG11 [18] phi from main to sum [phi:main->sum]
//SEG11 [5] call sum
//SEG12 [18] phi from main to sum [phi:main->sum]
sum_from_main:
//SEG12 [18] phi (byte) sum::b#3 = (byte) 'c' [phi:main->sum#0] -- vbuaa=vbuc1
//SEG13 [18] phi (byte) sum::b#3 = (byte) 'c' [phi:main->sum#0] -- vbuaa=vbuc1
lda #'c'
jsr sum
//SEG13 [6] (byte) sum::return#0 ← (byte) sum::return#3
//SEG14 [6] (byte) sum::return#0 ← (byte) sum::return#3
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [7] (byte~) main::$0 ← (byte) sum::return#0
//SEG16 [8] *((const byte*) main::screen#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa
//SEG16 [7] (byte~) main::$0 ← (byte) sum::return#0
//SEG17 [8] *((const byte*) main::screen#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa
sta screen
//SEG17 [9] call sum
//SEG18 [18] phi from main::@1 to sum [phi:main::@1->sum]
//SEG18 [9] call sum
//SEG19 [18] phi from main::@1 to sum [phi:main::@1->sum]
sum_from_b1:
//SEG19 [18] phi (byte) sum::b#3 = (byte) 'm' [phi:main::@1->sum#0] -- vbuaa=vbuc1
//SEG20 [18] phi (byte) sum::b#3 = (byte) 'm' [phi:main::@1->sum#0] -- vbuaa=vbuc1
lda #'m'
jsr sum
//SEG20 [10] (byte) sum::return#1 ← (byte) sum::return#3
//SEG21 [10] (byte) sum::return#1 ← (byte) sum::return#3
jmp b2
//SEG21 main::@2
//SEG22 main::@2
b2:
//SEG22 [11] (byte~) main::$1 ← (byte) sum::return#1
//SEG23 [12] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa
//SEG23 [11] (byte~) main::$1 ← (byte) sum::return#1
//SEG24 [12] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa
sta screen+1
//SEG24 [13] call sum
//SEG25 [18] phi from main::@2 to sum [phi:main::@2->sum]
//SEG25 [13] call sum
//SEG26 [18] phi from main::@2 to sum [phi:main::@2->sum]
sum_from_b2:
//SEG26 [18] phi (byte) sum::b#3 = (byte) 'l' [phi:main::@2->sum#0] -- vbuaa=vbuc1
//SEG27 [18] phi (byte) sum::b#3 = (byte) 'l' [phi:main::@2->sum#0] -- vbuaa=vbuc1
lda #'l'
jsr sum
//SEG27 [14] (byte) sum::return#2 ← (byte) sum::return#3
//SEG28 [14] (byte) sum::return#2 ← (byte) sum::return#3
jmp b3
//SEG28 main::@3
//SEG29 main::@3
b3:
//SEG29 [15] (byte~) main::$2 ← (byte) sum::return#2
//SEG30 [16] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa
//SEG30 [15] (byte~) main::$2 ← (byte) sum::return#2
//SEG31 [16] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa
sta screen+2
jmp breturn
//SEG31 main::@return
//SEG32 main::@return
breturn:
//SEG32 [17] return
//SEG33 [17] return
rts
}
//SEG33 sum
//SEG34 sum
sum: {
//SEG34 [19] (byte) sum::return#3 ← (const byte) main::reverse#0 + (byte) sum::b#3 -- vbuaa=vbuc1_plus_vbuaa
//SEG35 [19] (byte) sum::return#3 ← (const byte) main::reverse#0 + (byte) sum::b#3 -- vbuaa=vbuc1_plus_vbuaa
clc
adc #main.reverse
jmp breturn
//SEG35 sum::@return
//SEG36 sum::@return
breturn:
//SEG36 [20] return
//SEG37 [20] return
rts
}
@ -530,64 +532,65 @@ reg byte a [ sum::return#3 ]
FINAL ASSEMBLER
Score: 52
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG4 @2
//SEG5 [2] call main
//SEG6 [4] phi from @2 to main [phi:@2->main]
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
//SEG8 @end
//SEG9 main
// Test that the compiler optimizes when the same parameter value is passed into a function in all calls
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @2 [phi:@begin->@2]
//SEG5 @2
//SEG6 [2] call main
//SEG7 [4] phi from @2 to main [phi:@2->main]
//SEG8 [3] phi from @2 to @end [phi:@2->@end]
//SEG9 @end
//SEG10 main
main: {
.label screen = $400
.label reverse = $80
//SEG10 [5] call sum
//SEG11 [18] phi from main to sum [phi:main->sum]
//SEG12 [18] phi (byte) sum::b#3 = (byte) 'c' [phi:main->sum#0] -- vbuaa=vbuc1
//SEG11 [5] call sum
//SEG12 [18] phi from main to sum [phi:main->sum]
//SEG13 [18] phi (byte) sum::b#3 = (byte) 'c' [phi:main->sum#0] -- vbuaa=vbuc1
lda #'c'
jsr sum
//SEG13 [6] (byte) sum::return#0 ← (byte) sum::return#3
//SEG14 main::@1
//SEG15 [7] (byte~) main::$0 ← (byte) sum::return#0
//SEG16 [8] *((const byte*) main::screen#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa
//SEG14 [6] (byte) sum::return#0 ← (byte) sum::return#3
//SEG15 main::@1
//SEG16 [7] (byte~) main::$0 ← (byte) sum::return#0
//SEG17 [8] *((const byte*) main::screen#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa
sta screen
//SEG17 [9] call sum
//SEG18 [18] phi from main::@1 to sum [phi:main::@1->sum]
//SEG19 [18] phi (byte) sum::b#3 = (byte) 'm' [phi:main::@1->sum#0] -- vbuaa=vbuc1
//SEG18 [9] call sum
//SEG19 [18] phi from main::@1 to sum [phi:main::@1->sum]
//SEG20 [18] phi (byte) sum::b#3 = (byte) 'm' [phi:main::@1->sum#0] -- vbuaa=vbuc1
lda #'m'
jsr sum
//SEG20 [10] (byte) sum::return#1 ← (byte) sum::return#3
//SEG21 main::@2
//SEG22 [11] (byte~) main::$1 ← (byte) sum::return#1
//SEG23 [12] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa
//SEG21 [10] (byte) sum::return#1 ← (byte) sum::return#3
//SEG22 main::@2
//SEG23 [11] (byte~) main::$1 ← (byte) sum::return#1
//SEG24 [12] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa
sta screen+1
//SEG24 [13] call sum
//SEG25 [18] phi from main::@2 to sum [phi:main::@2->sum]
//SEG26 [18] phi (byte) sum::b#3 = (byte) 'l' [phi:main::@2->sum#0] -- vbuaa=vbuc1
//SEG25 [13] call sum
//SEG26 [18] phi from main::@2 to sum [phi:main::@2->sum]
//SEG27 [18] phi (byte) sum::b#3 = (byte) 'l' [phi:main::@2->sum#0] -- vbuaa=vbuc1
lda #'l'
jsr sum
//SEG27 [14] (byte) sum::return#2 ← (byte) sum::return#3
//SEG28 main::@3
//SEG29 [15] (byte~) main::$2 ← (byte) sum::return#2
//SEG30 [16] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa
//SEG28 [14] (byte) sum::return#2 ← (byte) sum::return#3
//SEG29 main::@3
//SEG30 [15] (byte~) main::$2 ← (byte) sum::return#2
//SEG31 [16] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa
sta screen+2
//SEG31 main::@return
//SEG32 [17] return
//SEG32 main::@return
//SEG33 [17] return
rts
}
//SEG33 sum
//SEG34 sum
sum: {
//SEG34 [19] (byte) sum::return#3 ← (const byte) main::reverse#0 + (byte) sum::b#3 -- vbuaa=vbuc1_plus_vbuaa
//SEG35 [19] (byte) sum::return#3 ← (const byte) main::reverse#0 + (byte) sum::b#3 -- vbuaa=vbuc1_plus_vbuaa
clc
adc #main.reverse
//SEG35 sum::@return
//SEG36 [20] return
//SEG36 sum::@return
//SEG37 [20] return
rts
}

View File

@ -1,7 +1,7 @@
// Test that constant pointers are detected correctly
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Test that constant pointers are detected correctly
main: {
.label screen = $400
lda #'*'

View File

@ -110,41 +110,42 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that constant pointers are detected correctly
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Test that constant pointers are detected correctly
//SEG10 main
main: {
.label screen = $400
jmp b1
//SEG10 main::@1
//SEG11 main::@1
b1:
//SEG11 [5] *((const byte*) main::screen#0) ← (byte) '*' -- _deref_pbuc1=vbuc2
//SEG12 [5] *((const byte*) main::screen#0) ← (byte) '*' -- _deref_pbuc1=vbuc2
lda #'*'
sta screen
jmp breturn
//SEG12 main::@return
//SEG13 main::@return
breturn:
//SEG13 [6] return
//SEG14 [6] return
rts
}
@ -159,41 +160,42 @@ Uplifting [main] best 57 combination
Uplifting [] best 57 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that constant pointers are detected correctly
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Test that constant pointers are detected correctly
//SEG10 main
main: {
.label screen = $400
jmp b1
//SEG10 main::@1
//SEG11 main::@1
b1:
//SEG11 [5] *((const byte*) main::screen#0) ← (byte) '*' -- _deref_pbuc1=vbuc2
//SEG12 [5] *((const byte*) main::screen#0) ← (byte) '*' -- _deref_pbuc1=vbuc2
lda #'*'
sta screen
jmp breturn
//SEG12 main::@return
//SEG13 main::@return
breturn:
//SEG13 [6] return
//SEG14 [6] return
rts
}
@ -235,28 +237,29 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 12
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that constant pointers are detected correctly
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
// Test that constant pointers are detected correctly
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.label screen = $400
//SEG10 main::@1
//SEG11 [5] *((const byte*) main::screen#0) ← (byte) '*' -- _deref_pbuc1=vbuc2
//SEG11 main::@1
//SEG12 [5] *((const byte*) main::screen#0) ← (byte) '*' -- _deref_pbuc1=vbuc2
lda #'*'
sta screen
//SEG12 main::@return
//SEG13 [6] return
//SEG13 main::@return
//SEG14 [6] return
rts
}

View File

@ -1,8 +1,8 @@
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
main: {
.label screen = $400
.label wp = w

View File

@ -128,28 +128,29 @@ Allocated zp ZP_BYTE:6 [ main::$3 ]
Allocated zp ZP_BYTE:7 [ main::$4 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
//SEG9 main
main: {
.label screen = $400
.label wp = w
@ -158,44 +159,44 @@ main: {
.label _3 = 6
.label _4 = 7
.label w = 2
//SEG9 [4] (word) main::w#0 ← (word/signed word/dword/signed dword) 3331 -- vwuz1=vwuc1
//SEG10 [4] (word) main::w#0 ← (word/signed word/dword/signed dword) 3331 -- vwuz1=vwuc1
lda #<$d03
sta w
lda #>$d03
sta w+1
//SEG10 [5] (byte~) main::$1 ← < *((const word*) main::wp#0) -- vbuz1=_lo__deref_pwuc1
//SEG11 [5] (byte~) main::$1 ← < *((const word*) main::wp#0) -- vbuz1=_lo__deref_pwuc1
lda wp
sta _1
//SEG11 [6] *((const byte*) main::screen#0) ← (byte~) main::$1 -- _deref_pbuc1=vbuz1
//SEG12 [6] *((const byte*) main::screen#0) ← (byte~) main::$1 -- _deref_pbuc1=vbuz1
lda _1
sta screen
//SEG12 [7] (byte~) main::$2 ← > *((const word*) main::wp#0) -- vbuz1=_hi__deref_pwuc1
//SEG13 [7] (byte~) main::$2 ← > *((const word*) main::wp#0) -- vbuz1=_hi__deref_pwuc1
lda wp+1
sta _2
//SEG13 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$2 -- _deref_pbuc1=vbuz1
//SEG14 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$2 -- _deref_pbuc1=vbuz1
lda _2
sta screen+1
//SEG14 [9] *((const word*) main::wp#0) ← (word/signed word/dword/signed dword) 8460 -- _deref_pwuc1=vwuc2
//SEG15 [9] *((const word*) main::wp#0) ← (word/signed word/dword/signed dword) 8460 -- _deref_pwuc1=vwuc2
lda #<$210c
sta wp
lda #>$210c
sta wp+1
//SEG15 [10] (byte~) main::$3 ← < *((const word*) main::wp#0) -- vbuz1=_lo__deref_pwuc1
//SEG16 [10] (byte~) main::$3 ← < *((const word*) main::wp#0) -- vbuz1=_lo__deref_pwuc1
lda wp
sta _3
//SEG16 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$3 -- _deref_pbuc1=vbuz1
//SEG17 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$3 -- _deref_pbuc1=vbuz1
lda _3
sta screen+2
//SEG17 [12] (byte~) main::$4 ← > *((const word*) main::wp#0) -- vbuz1=_hi__deref_pwuc1
//SEG18 [12] (byte~) main::$4 ← > *((const word*) main::wp#0) -- vbuz1=_hi__deref_pwuc1
lda wp+1
sta _4
//SEG18 [13] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte~) main::$4 -- _deref_pbuc1=vbuz1
//SEG19 [13] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte~) main::$4 -- _deref_pbuc1=vbuz1
lda _4
sta screen+3
jmp breturn
//SEG19 main::@return
//SEG20 main::@return
breturn:
//SEG20 [14] return
//SEG21 [14] return
rts
}
@ -217,62 +218,63 @@ Limited combination testing to 100 combinations of 256 possible.
Uplifting [] best 75 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
//SEG9 main
main: {
.label screen = $400
.label wp = w
.label w = 2
//SEG9 [4] (word) main::w#0 ← (word/signed word/dword/signed dword) 3331 -- vwuz1=vwuc1
//SEG10 [4] (word) main::w#0 ← (word/signed word/dword/signed dword) 3331 -- vwuz1=vwuc1
lda #<$d03
sta w
lda #>$d03
sta w+1
//SEG10 [5] (byte~) main::$1 ← < *((const word*) main::wp#0) -- vbuaa=_lo__deref_pwuc1
//SEG11 [5] (byte~) main::$1 ← < *((const word*) main::wp#0) -- vbuaa=_lo__deref_pwuc1
lda wp
//SEG11 [6] *((const byte*) main::screen#0) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa
//SEG12 [6] *((const byte*) main::screen#0) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa
sta screen
//SEG12 [7] (byte~) main::$2 ← > *((const word*) main::wp#0) -- vbuaa=_hi__deref_pwuc1
//SEG13 [7] (byte~) main::$2 ← > *((const word*) main::wp#0) -- vbuaa=_hi__deref_pwuc1
lda wp+1
//SEG13 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa
//SEG14 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa
sta screen+1
//SEG14 [9] *((const word*) main::wp#0) ← (word/signed word/dword/signed dword) 8460 -- _deref_pwuc1=vwuc2
//SEG15 [9] *((const word*) main::wp#0) ← (word/signed word/dword/signed dword) 8460 -- _deref_pwuc1=vwuc2
lda #<$210c
sta wp
lda #>$210c
sta wp+1
//SEG15 [10] (byte~) main::$3 ← < *((const word*) main::wp#0) -- vbuaa=_lo__deref_pwuc1
//SEG16 [10] (byte~) main::$3 ← < *((const word*) main::wp#0) -- vbuaa=_lo__deref_pwuc1
lda wp
//SEG16 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$3 -- _deref_pbuc1=vbuaa
//SEG17 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$3 -- _deref_pbuc1=vbuaa
sta screen+2
//SEG17 [12] (byte~) main::$4 ← > *((const word*) main::wp#0) -- vbuaa=_hi__deref_pwuc1
//SEG18 [12] (byte~) main::$4 ← > *((const word*) main::wp#0) -- vbuaa=_hi__deref_pwuc1
lda wp+1
//SEG18 [13] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte~) main::$4 -- _deref_pbuc1=vbuaa
//SEG19 [13] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte~) main::$4 -- _deref_pbuc1=vbuaa
sta screen+3
jmp breturn
//SEG19 main::@return
//SEG20 main::@return
breturn:
//SEG20 [14] return
//SEG21 [14] return
rts
}
@ -321,52 +323,53 @@ reg byte a [ main::$4 ]
FINAL ASSEMBLER
Score: 60
//SEG0 Basic Upstart
//SEG0 File Comments
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
// Test a constant word pointers (pointing to a word placed on zeropage).
// The result when running is "CML!" on the screen.
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
.label screen = $400
.label wp = w
.label w = 2
//SEG9 [4] (word) main::w#0 ← (word/signed word/dword/signed dword) 3331 -- vwuz1=vwuc1
//SEG10 [4] (word) main::w#0 ← (word/signed word/dword/signed dword) 3331 -- vwuz1=vwuc1
lda #<$d03
sta w
lda #>$d03
sta w+1
//SEG10 [5] (byte~) main::$1 ← < *((const word*) main::wp#0) -- vbuaa=_lo__deref_pwuc1
//SEG11 [5] (byte~) main::$1 ← < *((const word*) main::wp#0) -- vbuaa=_lo__deref_pwuc1
lda wp
//SEG11 [6] *((const byte*) main::screen#0) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa
//SEG12 [6] *((const byte*) main::screen#0) ← (byte~) main::$1 -- _deref_pbuc1=vbuaa
sta screen
//SEG12 [7] (byte~) main::$2 ← > *((const word*) main::wp#0) -- vbuaa=_hi__deref_pwuc1
//SEG13 [7] (byte~) main::$2 ← > *((const word*) main::wp#0) -- vbuaa=_hi__deref_pwuc1
lda wp+1
//SEG13 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa
//SEG14 [8] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte~) main::$2 -- _deref_pbuc1=vbuaa
sta screen+1
//SEG14 [9] *((const word*) main::wp#0) ← (word/signed word/dword/signed dword) 8460 -- _deref_pwuc1=vwuc2
//SEG15 [9] *((const word*) main::wp#0) ← (word/signed word/dword/signed dword) 8460 -- _deref_pwuc1=vwuc2
lda #<$210c
sta wp
lda #>$210c
sta wp+1
//SEG15 [10] (byte~) main::$3 ← < *((const word*) main::wp#0) -- vbuaa=_lo__deref_pwuc1
//SEG16 [10] (byte~) main::$3 ← < *((const word*) main::wp#0) -- vbuaa=_lo__deref_pwuc1
lda wp
//SEG16 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$3 -- _deref_pbuc1=vbuaa
//SEG17 [11] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte~) main::$3 -- _deref_pbuc1=vbuaa
sta screen+2
//SEG17 [12] (byte~) main::$4 ← > *((const word*) main::wp#0) -- vbuaa=_hi__deref_pwuc1
//SEG18 [12] (byte~) main::$4 ← > *((const word*) main::wp#0) -- vbuaa=_hi__deref_pwuc1
lda wp+1
//SEG18 [13] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte~) main::$4 -- _deref_pbuc1=vbuaa
//SEG19 [13] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte~) main::$4 -- _deref_pbuc1=vbuaa
sta screen+3
//SEG19 main::@return
//SEG20 [14] return
//SEG20 main::@return
//SEG21 [14] return
rts
}

View File

@ -68,35 +68,36 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
lda #1
sta SCREEN
jmp breturn
//SEG10 main::@return
//SEG11 main::@return
breturn:
//SEG11 [5] return
//SEG12 [5] return
rts
}
@ -111,35 +112,36 @@ Uplifting [main] best 27 combination
Uplifting [] best 27 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
lda #1
sta SCREEN
jmp breturn
//SEG10 main::@return
//SEG11 main::@return
breturn:
//SEG11 [5] return
//SEG12 [5] return
rts
}
@ -175,25 +177,26 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 12
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2
lda #1
sta SCREEN
//SEG10 main::@return
//SEG11 [5] return
//SEG11 main::@return
//SEG12 [5] return
rts
}

View File

@ -1,7 +1,7 @@
// Concatenates string constants in different ways
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Concatenates string constants in different ways
main: {
.label SCREEN = $400
ldx #0

View File

@ -169,58 +169,59 @@ Complete equivalence classes
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Concatenates string constants in different ways
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Concatenates string constants in different ways
//SEG10 main
main: {
.label SCREEN = $400
.label i = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← *((const byte[]) main::s5#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
//SEG16 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← *((const byte[]) main::s5#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy i
lda s5,y
sta SCREEN,y
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #8
bne b1_from_b1
jmp breturn
//SEG18 main::@return
//SEG19 main::@return
breturn:
//SEG19 [9] return
//SEG20 [9] return
rts
s: .text "e"+"l"
s4: .text ""+'t'+'!'
@ -242,54 +243,55 @@ Uplifting [main] best 288 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 288 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Concatenates string constants in different ways
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Concatenates string constants in different ways
//SEG10 main
main: {
.label SCREEN = $400
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← *((const byte[]) main::s5#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG16 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← *((const byte[]) main::s5#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda s5,x
sta SCREEN,x
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne b1_from_b1
jmp breturn
//SEG18 main::@return
//SEG19 main::@return
breturn:
//SEG19 [9] return
//SEG20 [9] return
rts
s: .text "e"+"l"
s4: .text ""+'t'+'!'
@ -351,39 +353,40 @@ reg byte x [ main::i#2 main::i#1 ]
FINAL ASSEMBLER
Score: 186
//SEG0 Basic Upstart
//SEG0 File Comments
// Concatenates string constants in different ways
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
// Concatenates string constants in different ways
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.label SCREEN = $400
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← *((const byte[]) main::s5#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
//SEG16 [6] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← *((const byte[]) main::s5#0 + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda s5,x
sta SCREEN,x
//SEG16 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG17 [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG17 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG18 [8] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #8
bne b1
//SEG18 main::@return
//SEG19 [9] return
//SEG19 main::@return
//SEG20 [9] return
rts
s: .text "e"+"l"
s4: .text ""+'t'+'!'

View File

@ -157,65 +157,66 @@ Complete equivalence classes
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
.const STAR = $51
.label VIC = $d000
.const RED = 2
.label BGCOL = VIC+$10*2+1
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
.label i = 2
//SEG9 [4] *((const byte*) SCREEN#0) ← (const byte) STAR#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) SCREEN#0) ← (const byte) STAR#0 -- _deref_pbuc1=vbuc2
lda #STAR
sta SCREEN
//SEG10 [5] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
lda #RED
sta BGCOL
//SEG11 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG12 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 40 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG13 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 40 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #$28
sta i
jmp b1
//SEG13 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG14 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG15 main::@1
//SEG16 main::@1
b1:
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (const byte) STAR#0+(byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vbuz1=vbuc2
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (const byte) STAR#0+(byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vbuz1=vbuc2
ldy i
lda #STAR+1
sta SCREEN,y
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG18 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 80) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 80) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$50
bne b1_from_b1
jmp breturn
//SEG19 main::@return
//SEG20 main::@return
breturn:
//SEG20 [10] return
//SEG21 [10] return
rts
}
@ -237,61 +238,62 @@ Uplifting [main] best 275 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 275 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
.const STAR = $51
.label VIC = $d000
.const RED = 2
.label BGCOL = VIC+$10*2+1
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (const byte) STAR#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) SCREEN#0) ← (const byte) STAR#0 -- _deref_pbuc1=vbuc2
lda #STAR
sta SCREEN
//SEG10 [5] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
lda #RED
sta BGCOL
//SEG11 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG12 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 40 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG13 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 40 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #$28
jmp b1
//SEG13 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG14 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG15 main::@1
//SEG16 main::@1
b1:
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (const byte) STAR#0+(byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (const byte) STAR#0+(byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vbuxx=vbuc2
lda #STAR+1
sta SCREEN,x
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG18 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 80) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 80) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$50
bne b1_from_b1
jmp breturn
//SEG19 main::@return
//SEG20 main::@return
breturn:
//SEG20 [10] return
//SEG21 [10] return
rts
}
@ -346,47 +348,48 @@ reg byte x [ main::i#2 main::i#1 ]
FINAL ASSEMBLER
Score: 173
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label SCREEN = $400
.const STAR = $51
.label VIC = $d000
.const RED = 2
.label BGCOL = VIC+$10*2+1
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (const byte) STAR#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) SCREEN#0) ← (const byte) STAR#0 -- _deref_pbuc1=vbuc2
lda #STAR
sta SCREEN
//SEG10 [5] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
lda #RED
sta BGCOL
//SEG11 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 40 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG13 [6] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 40 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #$28
//SEG13 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
//SEG14 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG15 [6] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG16 main::@1
b1:
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (const byte) STAR#0+(byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vbuxx=vbuc2
//SEG17 [7] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (const byte) STAR#0+(byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vbuxx=vbuc2
lda #STAR+1
sta SCREEN,x
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG18 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 80) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 80) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$50
bne b1
//SEG19 main::@return
//SEG20 [10] return
//SEG20 main::@return
//SEG21 [10] return
rts
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Test that a double-assignment works.
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Test that a double-assignment works.
main: {
.label screen = $400
.const a = $c

View File

@ -85,40 +85,41 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that a double-assignment works.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Test that a double-assignment works.
//SEG9 main
main: {
.label screen = $400
.const a = $c
//SEG9 [4] *((const byte*) main::screen#0) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
lda #a
sta screen
//SEG10 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
lda #a
sta screen+1
jmp breturn
//SEG11 main::@return
//SEG12 main::@return
breturn:
//SEG12 [6] return
//SEG13 [6] return
rts
}
@ -134,40 +135,41 @@ Uplifting [main] best 33 combination
Uplifting [] best 33 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that a double-assignment works.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
// Test that a double-assignment works.
//SEG9 main
main: {
.label screen = $400
.const a = $c
//SEG9 [4] *((const byte*) main::screen#0) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
lda #a
sta screen
//SEG10 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
lda #a
sta screen+1
jmp breturn
//SEG11 main::@return
//SEG12 main::@return
breturn:
//SEG12 [6] return
//SEG13 [6] return
rts
}
@ -208,29 +210,30 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 16
//SEG0 Basic Upstart
//SEG0 File Comments
// Test that a double-assignment works.
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
// Test that a double-assignment works.
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
.label screen = $400
.const a = $c
//SEG9 [4] *((const byte*) main::screen#0) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) main::screen#0) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
lda #a
sta screen
//SEG10 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
//SEG11 [5] *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (const byte) main::a#0 -- _deref_pbuc1=vbuc2
sta screen+1
//SEG11 main::@return
//SEG12 [6] return
//SEG12 main::@return
//SEG13 [6] return
rts
}

View File

@ -73,36 +73,37 @@ Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BGCOL = $d021
.const RED = 2
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
lda #RED
sta BGCOL
jmp breturn
//SEG10 main::@return
//SEG11 main::@return
breturn:
//SEG11 [5] return
//SEG12 [5] return
rts
}
@ -117,36 +118,37 @@ Uplifting [main] best 27 combination
Uplifting [] best 27 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BGCOL = $d021
.const RED = 2
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [2] call main
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
//SEG8 @end
bend:
//SEG8 main
//SEG9 main
main: {
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
lda #RED
sta BGCOL
jmp breturn
//SEG10 main::@return
//SEG11 main::@return
breturn:
//SEG11 [5] return
//SEG12 [5] return
rts
}
@ -184,26 +186,27 @@ FINAL SYMBOL TABLE
FINAL ASSEMBLER
Score: 12
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label BGCOL = $d021
.const RED = 2
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
//SEG10 [4] *((const byte*) BGCOL#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2
lda #RED
sta BGCOL
//SEG10 main::@return
//SEG11 [5] return
//SEG11 main::@return
//SEG12 [5] return
rts
}

View File

@ -142,47 +142,48 @@ Allocated zp ZP_DWORD:3 [ main::b#0 ]
Allocated zp ZP_BYTE:7 [ main::c#0 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.const a = $ee6b2800
.label SCREEN = $400
.label b = 3
.label c = 7
.label i = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (dword) main::b#0 ← (const dword) main::a#0 + (byte) main::i#2 -- vduz1=vduc1_plus_vbuz2
//SEG16 [6] (dword) main::b#0 ← (const dword) main::a#0 + (byte) main::i#2 -- vduz1=vduc1_plus_vbuz2
lda i
clc
adc #<a
@ -196,23 +197,23 @@ main: {
lda #>a>>$10
adc #0
sta b+3
//SEG16 [7] (byte) main::c#0 ← ((byte)) (dword) main::b#0 -- vbuz1=_byte_vduz2
//SEG17 [7] (byte) main::c#0 ← ((byte)) (dword) main::b#0 -- vbuz1=_byte_vduz2
lda b
sta c
//SEG17 [8] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte) main::c#0 -- pbuc1_derefidx_vbuz1=vbuz2
//SEG18 [8] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte) main::c#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda c
ldy i
sta SCREEN,y
//SEG18 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
//SEG19 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG19 [10] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
//SEG20 [10] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$65
bne b1_from_b1
jmp breturn
//SEG20 main::@return
//SEG21 main::@return
breturn:
//SEG21 [11] return
//SEG22 [11] return
rts
}
@ -235,44 +236,45 @@ Uplifting [] best 573 combination
Allocated (was zp ZP_DWORD:3) zp ZP_DWORD:2 [ main::b#0 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG2 Global Constants & labels
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
//SEG5 @1
b1:
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.const a = $ee6b2800
.label SCREEN = $400
.label b = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
//SEG15 main::@1
b1:
//SEG15 [6] (dword) main::b#0 ← (const dword) main::a#0 + (byte) main::i#2 -- vduz1=vduc1_plus_vbuxx
//SEG16 [6] (dword) main::b#0 ← (const dword) main::a#0 + (byte) main::i#2 -- vduz1=vduc1_plus_vbuxx
txa
clc
adc #<a
@ -286,19 +288,19 @@ main: {
lda #>a>>$10
adc #0
sta b+3
//SEG16 [7] (byte) main::c#0 ← ((byte)) (dword) main::b#0 -- vbuaa=_byte_vduz1
//SEG17 [7] (byte) main::c#0 ← ((byte)) (dword) main::b#0 -- vbuaa=_byte_vduz1
lda b
//SEG17 [8] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte) main::c#0 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG18 [8] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte) main::c#0 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG18 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG19 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG19 [10] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG20 [10] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1_from_b1
jmp breturn
//SEG20 main::@return
//SEG21 main::@return
breturn:
//SEG21 [11] return
//SEG22 [11] return
rts
}
@ -354,31 +356,32 @@ reg byte a [ main::c#0 ]
FINAL ASSEMBLER
Score: 471
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG2 Global Constants & labels
//SEG3 @begin
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.const a = $ee6b2800
.label SCREEN = $400
.label b = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
//SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG15 [6] (dword) main::b#0 ← (const dword) main::a#0 + (byte) main::i#2 -- vduz1=vduc1_plus_vbuxx
//SEG16 [6] (dword) main::b#0 ← (const dword) main::a#0 + (byte) main::i#2 -- vduz1=vduc1_plus_vbuxx
txa
clc
adc #<a
@ -392,17 +395,17 @@ main: {
lda #>a>>$10
adc #0
sta b+3
//SEG16 [7] (byte) main::c#0 ← ((byte)) (dword) main::b#0 -- vbuaa=_byte_vduz1
//SEG17 [7] (byte) main::c#0 ← ((byte)) (dword) main::b#0 -- vbuaa=_byte_vduz1
lda b
//SEG17 [8] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte) main::c#0 -- pbuc1_derefidx_vbuxx=vbuaa
//SEG18 [8] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte) main::c#0 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG18 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
//SEG19 [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG19 [10] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
//SEG20 [10] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1
//SEG20 main::@return
//SEG21 [11] return
//SEG21 main::@return
//SEG22 [11] return
rts
}

View File

@ -1,8 +1,8 @@
// Error cleaning up unused blocks
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label B = $1000
// Error cleaning up unused blocks
main: {
lda #0
b2:

View File

@ -303,94 +303,95 @@ Complete equivalence classes
Allocated zp ZP_BYTE:2 [ a#1 a#12 a#5 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
// Error cleaning up unused blocks
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label B = $1000
.label a = 2
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG4 [1] phi from @begin to @3 [phi:@begin->@3]
b3_from_bbegin:
jmp b3
//SEG4 @3
//SEG5 @3
b3:
//SEG5 [2] call main
//SEG6 [4] phi from @3 to main [phi:@3->main]
//SEG6 [2] call main
//SEG7 [4] phi from @3 to main [phi:@3->main]
main_from_b3:
jsr main
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
//SEG8 [3] phi from @3 to @end [phi:@3->@end]
bend_from_b3:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Error cleaning up unused blocks
//SEG10 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) a#1 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) a#1 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta a
jmp b1
//SEG12 main::@1
//SEG13 main::@1
b1:
//SEG13 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG14 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG14 main::@2
//SEG15 main::@2
b2:
//SEG15 [7] call menu
//SEG16 [8] phi from main::@2 to menu [phi:main::@2->menu]
//SEG16 [7] call menu
//SEG17 [8] phi from main::@2 to menu [phi:main::@2->menu]
menu_from_b2:
jsr menu
//SEG17 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG18 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
//SEG18 [5] phi (byte) a#1 = (byte) a#12 [phi:main::@2->main::@1#0] -- register_copy
//SEG19 [5] phi (byte) a#1 = (byte) a#12 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
}
//SEG19 menu
//SEG20 menu
menu: {
//SEG20 [9] phi from menu to menu::@2 [phi:menu->menu::@2]
//SEG21 [9] phi from menu to menu::@2 [phi:menu->menu::@2]
b2_from_menu:
jmp b2
//SEG21 menu::@2
//SEG22 menu::@2
b2:
//SEG22 [10] call mode
//SEG23 [12] phi from menu::@2 to mode [phi:menu::@2->mode]
//SEG23 [10] call mode
//SEG24 [12] phi from menu::@2 to mode [phi:menu::@2->mode]
mode_from_b2:
jsr mode
jmp breturn
//SEG24 menu::@return
//SEG25 menu::@return
breturn:
//SEG25 [11] return
//SEG26 [11] return
rts
}
//SEG26 mode
//SEG27 mode
mode: {
//SEG27 [13] phi from mode mode::@7 to mode::@1 [phi:mode/mode::@7->mode::@1]
//SEG28 [13] phi from mode mode::@7 to mode::@1 [phi:mode/mode::@7->mode::@1]
b1_from_mode:
b1_from_b7:
//SEG28 [13] phi (byte) a#12 = (byte) a#1 [phi:mode/mode::@7->mode::@1#0] -- register_copy
//SEG29 [13] phi (byte) a#12 = (byte) a#1 [phi:mode/mode::@7->mode::@1#0] -- register_copy
jmp b1
//SEG29 [13] phi from mode::@2 to mode::@1 [phi:mode::@2->mode::@1]
//SEG30 [13] phi from mode::@2 to mode::@1 [phi:mode::@2->mode::@1]
b1_from_b2:
jmp b1
//SEG30 mode::@1
//SEG31 mode::@1
b1:
jmp b2
//SEG31 mode::@2
//SEG32 mode::@2
b2:
//SEG32 [14] if(*((const byte*) B#0)!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1
//SEG33 [14] if(*((const byte*) B#0)!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1
lda B
cmp #0
bne b1_from_b2
jmp b7
//SEG33 mode::@7
//SEG34 mode::@7
b7:
//SEG34 [15] (byte) a#5 ← *((const byte*) B#0) -- vbuz1=_deref_pbuc1
//SEG35 [15] (byte) a#5 ← *((const byte*) B#0) -- vbuz1=_deref_pbuc1
lda B
sta a
jmp b1_from_b7
@ -412,92 +413,93 @@ Uplifting [menu] best 18376 combination
Uplifting [mode] best 18376 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
// Error cleaning up unused blocks
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label B = $1000
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG4 [1] phi from @begin to @3 [phi:@begin->@3]
b3_from_bbegin:
jmp b3
//SEG4 @3
//SEG5 @3
b3:
//SEG5 [2] call main
//SEG6 [4] phi from @3 to main [phi:@3->main]
//SEG6 [2] call main
//SEG7 [4] phi from @3 to main [phi:@3->main]
main_from_b3:
jsr main
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
//SEG8 [3] phi from @3 to @end [phi:@3->@end]
bend_from_b3:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
// Error cleaning up unused blocks
//SEG10 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) a#1 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
//SEG12 [5] phi (byte) a#1 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #0
jmp b1
//SEG12 main::@1
//SEG13 main::@1
b1:
//SEG13 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG14 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG14 main::@2
//SEG15 main::@2
b2:
//SEG15 [7] call menu
//SEG16 [8] phi from main::@2 to menu [phi:main::@2->menu]
//SEG16 [7] call menu
//SEG17 [8] phi from main::@2 to menu [phi:main::@2->menu]
menu_from_b2:
jsr menu
//SEG17 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG18 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
//SEG18 [5] phi (byte) a#1 = (byte) a#12 [phi:main::@2->main::@1#0] -- register_copy
//SEG19 [5] phi (byte) a#1 = (byte) a#12 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
}
//SEG19 menu
//SEG20 menu
menu: {
//SEG20 [9] phi from menu to menu::@2 [phi:menu->menu::@2]
//SEG21 [9] phi from menu to menu::@2 [phi:menu->menu::@2]
b2_from_menu:
jmp b2
//SEG21 menu::@2
//SEG22 menu::@2
b2:
//SEG22 [10] call mode
//SEG23 [12] phi from menu::@2 to mode [phi:menu::@2->mode]
//SEG23 [10] call mode
//SEG24 [12] phi from menu::@2 to mode [phi:menu::@2->mode]
mode_from_b2:
jsr mode
jmp breturn
//SEG24 menu::@return
//SEG25 menu::@return
breturn:
//SEG25 [11] return
//SEG26 [11] return
rts
}
//SEG26 mode
//SEG27 mode
mode: {
//SEG27 [13] phi from mode mode::@7 to mode::@1 [phi:mode/mode::@7->mode::@1]
//SEG28 [13] phi from mode mode::@7 to mode::@1 [phi:mode/mode::@7->mode::@1]
b1_from_mode:
b1_from_b7:
//SEG28 [13] phi (byte) a#12 = (byte) a#1 [phi:mode/mode::@7->mode::@1#0] -- register_copy
//SEG29 [13] phi (byte) a#12 = (byte) a#1 [phi:mode/mode::@7->mode::@1#0] -- register_copy
jmp b1
//SEG29 [13] phi from mode::@2 to mode::@1 [phi:mode::@2->mode::@1]
//SEG30 [13] phi from mode::@2 to mode::@1 [phi:mode::@2->mode::@1]
b1_from_b2:
jmp b1
//SEG30 mode::@1
//SEG31 mode::@1
b1:
jmp b2
//SEG31 mode::@2
//SEG32 mode::@2
b2:
//SEG32 [14] if(*((const byte*) B#0)!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1
//SEG33 [14] if(*((const byte*) B#0)!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1
lda B
cmp #0
bne b1_from_b2
jmp b7
//SEG33 mode::@7
//SEG34 mode::@7
b7:
//SEG34 [15] (byte) a#5 ← *((const byte*) B#0) -- vbuaa=_deref_pbuc1
//SEG35 [15] (byte) a#5 ← *((const byte*) B#0) -- vbuaa=_deref_pbuc1
lda B
jmp b1_from_b7
}
@ -579,61 +581,62 @@ reg byte a [ a#1 a#12 a#5 ]
FINAL ASSEMBLER
Score: 8868
//SEG0 Basic Upstart
//SEG0 File Comments
// Error cleaning up unused blocks
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label B = $1000
//SEG2 @begin
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG4 @3
//SEG5 [2] call main
//SEG6 [4] phi from @3 to main [phi:@3->main]
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
//SEG8 @end
//SEG9 main
// Error cleaning up unused blocks
//SEG3 @begin
//SEG4 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG5 @3
//SEG6 [2] call main
//SEG7 [4] phi from @3 to main [phi:@3->main]
//SEG8 [3] phi from @3 to @end [phi:@3->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) a#1 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) a#1 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #0
//SEG12 main::@1
//SEG13 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG14 main::@2
//SEG13 main::@1
//SEG14 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG15 main::@2
b2:
//SEG15 [7] call menu
//SEG16 [8] phi from main::@2 to menu [phi:main::@2->menu]
//SEG16 [7] call menu
//SEG17 [8] phi from main::@2 to menu [phi:main::@2->menu]
jsr menu
//SEG17 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG18 [5] phi (byte) a#1 = (byte) a#12 [phi:main::@2->main::@1#0] -- register_copy
//SEG18 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG19 [5] phi (byte) a#1 = (byte) a#12 [phi:main::@2->main::@1#0] -- register_copy
jmp b2
}
//SEG19 menu
//SEG20 menu
menu: {
//SEG20 [9] phi from menu to menu::@2 [phi:menu->menu::@2]
//SEG21 menu::@2
//SEG22 [10] call mode
//SEG23 [12] phi from menu::@2 to mode [phi:menu::@2->mode]
//SEG21 [9] phi from menu to menu::@2 [phi:menu->menu::@2]
//SEG22 menu::@2
//SEG23 [10] call mode
//SEG24 [12] phi from menu::@2 to mode [phi:menu::@2->mode]
jsr mode
//SEG24 menu::@return
//SEG25 [11] return
//SEG25 menu::@return
//SEG26 [11] return
rts
}
//SEG26 mode
//SEG27 mode
mode: {
//SEG27 [13] phi from mode mode::@7 to mode::@1 [phi:mode/mode::@7->mode::@1]
//SEG28 [13] phi (byte) a#12 = (byte) a#1 [phi:mode/mode::@7->mode::@1#0] -- register_copy
//SEG29 [13] phi from mode::@2 to mode::@1 [phi:mode::@2->mode::@1]
//SEG30 mode::@1
//SEG31 mode::@2
//SEG28 [13] phi from mode mode::@7 to mode::@1 [phi:mode/mode::@7->mode::@1]
//SEG29 [13] phi (byte) a#12 = (byte) a#1 [phi:mode/mode::@7->mode::@1#0] -- register_copy
//SEG30 [13] phi from mode::@2 to mode::@1 [phi:mode::@2->mode::@1]
//SEG31 mode::@1
//SEG32 mode::@2
b2:
//SEG32 [14] if(*((const byte*) B#0)!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1
//SEG33 [14] if(*((const byte*) B#0)!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mode::@1 -- _deref_pbuc1_neq_0_then_la1
lda B
cmp #0
bne b2
//SEG33 mode::@7
//SEG34 [15] (byte) a#5 ← *((const byte*) B#0) -- vbuaa=_deref_pbuc1
//SEG34 mode::@7
//SEG35 [15] (byte) a#5 ← *((const byte*) B#0) -- vbuaa=_deref_pbuc1
jmp b2
}

View File

@ -1,3 +1,7 @@
// 3D Rotation using a Rotation Matrix
// Based on:
// - C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
// - Codebase64 Article http://codebase64.org/doku.php?id=base:3d_rotation
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
// 3D Rotation using a Rotation Matrix
// Based on:
// - C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
// - Codebase64 Article http://codebase64.org/doku.php?id=base:3d_rotation
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"

File diff suppressed because it is too large Load Diff

View File

@ -410,8 +410,6 @@ bitmap_init: {
bne b3
rts
}
// Plot and line drawing routines for HIRES bitmaps
// Currently it can only plot on the first 256 x-positions.
// Tables for the plotter - initialized by calling bitmap_draw_init();
bitmap_plot_xlo: .fill $100, 0
bitmap_plot_xhi: .fill $100, 0

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
// Allows analysis of the CHARGEN ROM font
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
@ -301,7 +302,6 @@ plot_chargen: {
cli
rts
}
// Simple binary multiplication implementation
// Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word
mul8u: {
.const b = $a

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,10 @@
// Seriously fast multiply 8-bit version (8bit*8bit=8bit)
// Multiplies two signed 8-bit numbers and results in an 8-bit number
// C=A*B, A in [-64;64], B in [-96;95], C in [-96;95] - 64 acts a 1 (X*64=X)
// Uses the formula a*b = (a+b)^2/4 - (a-b)^2/4
// See the following for information about the method
// - http://codebase64.org/doku.php?id=base:seriously_fast_multiplication
// - http://codebase64.org/doku.php?id=magazines:chacking16
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"

View File

@ -319,69 +319,70 @@ Allocated zp ZP_WORD:4 [ print_str::str#2 print_str::str#0 ]
Allocated zp ZP_WORD:6 [ print_char_cursor#10 print_char_cursor#1 ]
INITIAL ASM
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label print_char_cursor = 6
.label print_line_cursor = 2
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @20 [phi:@begin->@20]
//SEG4 [1] phi from @begin to @20 [phi:@begin->@20]
b20_from_bbegin:
jmp b20
//SEG4 @20
//SEG5 @20
b20:
//SEG5 [2] call main
//SEG6 [4] phi from @20 to main [phi:@20->main]
//SEG6 [2] call main
//SEG7 [4] phi from @20 to main [phi:@20->main]
main_from_b20:
jsr main
//SEG7 [3] phi from @20 to @end [phi:@20->@end]
//SEG8 [3] phi from @20 to @end [phi:@20->@end]
bend_from_b20:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] call print_str
//SEG11 [14] phi from main to print_str [phi:main->print_str]
//SEG11 [5] call print_str
//SEG12 [14] phi from main to print_str [phi:main->print_str]
print_str_from_main:
jsr print_str
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG13 main::@1
//SEG14 main::@1
b1:
//SEG14 [7] call print_ln
//SEG15 [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
//SEG15 [7] call print_ln
//SEG16 [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
print_ln_from_b1:
jsr print_ln
jmp breturn
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [8] return
//SEG18 [8] return
rts
str: .text "hello world!@"
}
//SEG18 print_ln
//SEG19 print_ln
// Print a newline
print_ln: {
//SEG19 [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
//SEG20 [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
b1_from_print_ln:
//SEG20 [10] phi (byte*) print_line_cursor#6 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1
//SEG21 [10] phi (byte*) print_line_cursor#6 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1
lda #<$400
sta print_line_cursor
lda #>$400
sta print_line_cursor+1
jmp b1
//SEG21 [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
//SEG22 [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
b1_from_b1:
//SEG22 [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy
//SEG23 [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy
jmp b1
//SEG23 print_ln::@1
//SEG24 print_ln::@1
b1:
//SEG24 [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG25 [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda print_line_cursor
clc
adc #$28
@ -389,7 +390,7 @@ print_ln: {
bcc !+
inc print_line_cursor+1
!:
//SEG25 [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1
//SEG26 [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1
lda print_line_cursor+1
cmp print_char_cursor+1
bcc b1_from_b1
@ -399,61 +400,61 @@ print_ln: {
bcc b1_from_b1
!:
jmp breturn
//SEG26 print_ln::@return
//SEG27 print_ln::@return
breturn:
//SEG27 [13] return
//SEG28 [13] return
rts
}
//SEG28 print_str
//SEG29 print_str
// Print a zero-terminated string
print_str: {
.label str = 4
//SEG29 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
//SEG30 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
b1_from_print_str:
//SEG30 [15] phi (byte*) print_char_cursor#10 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1
//SEG31 [15] phi (byte*) print_char_cursor#10 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1
lda #<$400
sta print_char_cursor
lda #>$400
sta print_char_cursor+1
//SEG31 [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1
//SEG32 [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1
lda #<main.str
sta str
lda #>main.str
sta str+1
jmp b1
//SEG32 print_str::@1
//SEG33 print_str::@1
b1:
//SEG33 [16] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1
//SEG34 [16] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1
ldy #0
lda (str),y
cmp #'@'
bne b2
jmp breturn
//SEG34 print_str::@return
//SEG35 print_str::@return
breturn:
//SEG35 [17] return
//SEG36 [17] return
rts
//SEG36 print_str::@2
//SEG37 print_str::@2
b2:
//SEG37 [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2
//SEG38 [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2
ldy #0
lda (str),y
ldy #0
sta (print_char_cursor),y
//SEG38 [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1
//SEG39 [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1
inc print_char_cursor
bne !+
inc print_char_cursor+1
!:
//SEG39 [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1
//SEG40 [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1
inc str
bne !+
inc str+1
!:
//SEG40 [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
//SEG41 [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
b1_from_b2:
//SEG41 [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy
//SEG42 [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy
//SEG42 [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy
//SEG43 [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy
jmp b1
}
@ -480,69 +481,70 @@ Coalescing zero page register [ zp ZP_WORD:2 [ print_line_cursor#6 print_line_cu
Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ print_char_cursor#10 print_char_cursor#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label print_char_cursor = 4
.label print_line_cursor = 2
//SEG2 @begin
//SEG3 @begin
bbegin:
//SEG3 [1] phi from @begin to @20 [phi:@begin->@20]
//SEG4 [1] phi from @begin to @20 [phi:@begin->@20]
b20_from_bbegin:
jmp b20
//SEG4 @20
//SEG5 @20
b20:
//SEG5 [2] call main
//SEG6 [4] phi from @20 to main [phi:@20->main]
//SEG6 [2] call main
//SEG7 [4] phi from @20 to main [phi:@20->main]
main_from_b20:
jsr main
//SEG7 [3] phi from @20 to @end [phi:@20->@end]
//SEG8 [3] phi from @20 to @end [phi:@20->@end]
bend_from_b20:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
//SEG10 [5] call print_str
//SEG11 [14] phi from main to print_str [phi:main->print_str]
//SEG11 [5] call print_str
//SEG12 [14] phi from main to print_str [phi:main->print_str]
print_str_from_main:
jsr print_str
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG13 main::@1
//SEG14 main::@1
b1:
//SEG14 [7] call print_ln
//SEG15 [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
//SEG15 [7] call print_ln
//SEG16 [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
print_ln_from_b1:
jsr print_ln
jmp breturn
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [8] return
//SEG18 [8] return
rts
str: .text "hello world!@"
}
//SEG18 print_ln
//SEG19 print_ln
// Print a newline
print_ln: {
//SEG19 [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
//SEG20 [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
b1_from_print_ln:
//SEG20 [10] phi (byte*) print_line_cursor#6 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1
//SEG21 [10] phi (byte*) print_line_cursor#6 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1
lda #<$400
sta print_line_cursor
lda #>$400
sta print_line_cursor+1
jmp b1
//SEG21 [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
//SEG22 [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
b1_from_b1:
//SEG22 [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy
//SEG23 [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy
jmp b1
//SEG23 print_ln::@1
//SEG24 print_ln::@1
b1:
//SEG24 [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG25 [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda print_line_cursor
clc
adc #$28
@ -550,7 +552,7 @@ print_ln: {
bcc !+
inc print_line_cursor+1
!:
//SEG25 [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1
//SEG26 [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1
lda print_line_cursor+1
cmp print_char_cursor+1
bcc b1_from_b1
@ -560,61 +562,61 @@ print_ln: {
bcc b1_from_b1
!:
jmp breturn
//SEG26 print_ln::@return
//SEG27 print_ln::@return
breturn:
//SEG27 [13] return
//SEG28 [13] return
rts
}
//SEG28 print_str
//SEG29 print_str
// Print a zero-terminated string
print_str: {
.label str = 2
//SEG29 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
//SEG30 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
b1_from_print_str:
//SEG30 [15] phi (byte*) print_char_cursor#10 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1
//SEG31 [15] phi (byte*) print_char_cursor#10 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1
lda #<$400
sta print_char_cursor
lda #>$400
sta print_char_cursor+1
//SEG31 [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1
//SEG32 [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1
lda #<main.str
sta str
lda #>main.str
sta str+1
jmp b1
//SEG32 print_str::@1
//SEG33 print_str::@1
b1:
//SEG33 [16] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1
//SEG34 [16] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1
ldy #0
lda (str),y
cmp #'@'
bne b2
jmp breturn
//SEG34 print_str::@return
//SEG35 print_str::@return
breturn:
//SEG35 [17] return
//SEG36 [17] return
rts
//SEG36 print_str::@2
//SEG37 print_str::@2
b2:
//SEG37 [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2
//SEG38 [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2
ldy #0
lda (str),y
ldy #0
sta (print_char_cursor),y
//SEG38 [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1
//SEG39 [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1
inc print_char_cursor
bne !+
inc print_char_cursor+1
!:
//SEG39 [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1
//SEG40 [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1
inc str
bne !+
inc str+1
!:
//SEG40 [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
//SEG41 [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
b1_from_b2:
//SEG41 [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy
//SEG42 [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy
//SEG42 [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy
//SEG43 [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy
jmp b1
}
@ -692,49 +694,50 @@ zp ZP_WORD:4 [ print_char_cursor#10 print_char_cursor#1 ]
FINAL ASSEMBLER
Score: 1235
//SEG0 Basic Upstart
//SEG0 File Comments
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 Global Constants & labels
.label print_char_cursor = 4
.label print_line_cursor = 2
//SEG2 @begin
//SEG3 [1] phi from @begin to @20 [phi:@begin->@20]
//SEG4 @20
//SEG5 [2] call main
//SEG6 [4] phi from @20 to main [phi:@20->main]
//SEG7 [3] phi from @20 to @end [phi:@20->@end]
//SEG8 @end
//SEG9 main
//SEG3 @begin
//SEG4 [1] phi from @begin to @20 [phi:@begin->@20]
//SEG5 @20
//SEG6 [2] call main
//SEG7 [4] phi from @20 to main [phi:@20->main]
//SEG8 [3] phi from @20 to @end [phi:@20->@end]
//SEG9 @end
//SEG10 main
main: {
//SEG10 [5] call print_str
//SEG11 [14] phi from main to print_str [phi:main->print_str]
//SEG11 [5] call print_str
//SEG12 [14] phi from main to print_str [phi:main->print_str]
jsr print_str
//SEG12 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG13 main::@1
//SEG14 [7] call print_ln
//SEG15 [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
//SEG13 [6] phi from main to main::@1 [phi:main->main::@1]
//SEG14 main::@1
//SEG15 [7] call print_ln
//SEG16 [9] phi from main::@1 to print_ln [phi:main::@1->print_ln]
jsr print_ln
//SEG16 main::@return
//SEG17 [8] return
//SEG17 main::@return
//SEG18 [8] return
rts
str: .text "hello world!@"
}
//SEG18 print_ln
//SEG19 print_ln
// Print a newline
print_ln: {
//SEG19 [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
//SEG20 [10] phi (byte*) print_line_cursor#6 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1
//SEG20 [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
//SEG21 [10] phi (byte*) print_line_cursor#6 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1
lda #<$400
sta print_line_cursor
lda #>$400
sta print_line_cursor+1
//SEG21 [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
//SEG22 [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy
//SEG23 print_ln::@1
//SEG22 [10] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1]
//SEG23 [10] phi (byte*) print_line_cursor#6 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy
//SEG24 print_ln::@1
b1:
//SEG24 [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
//SEG25 [11] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#6 + (byte/signed byte/word/signed word/dword/signed dword) 40 -- pbuz1=pbuz1_plus_vbuc1
lda print_line_cursor
clc
adc #$28
@ -742,7 +745,7 @@ print_ln: {
bcc !+
inc print_line_cursor+1
!:
//SEG25 [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1
//SEG26 [12] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1
lda print_line_cursor+1
cmp print_char_cursor+1
bcc b1
@ -751,54 +754,54 @@ print_ln: {
cmp print_char_cursor
bcc b1
!:
//SEG26 print_ln::@return
//SEG27 [13] return
//SEG27 print_ln::@return
//SEG28 [13] return
rts
}
//SEG28 print_str
//SEG29 print_str
// Print a zero-terminated string
print_str: {
.label str = 2
//SEG29 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
//SEG30 [15] phi (byte*) print_char_cursor#10 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1
//SEG30 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1]
//SEG31 [15] phi (byte*) print_char_cursor#10 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_str->print_str::@1#0] -- pbuz1=pbuc1
lda #<$400
sta print_char_cursor
lda #>$400
sta print_char_cursor+1
//SEG31 [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1
//SEG32 [15] phi (byte*) print_str::str#2 = (const string) main::str [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1
lda #<main.str
sta str
lda #>main.str
sta str+1
//SEG32 print_str::@1
//SEG33 print_str::@1
b1:
//SEG33 [16] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1
//SEG34 [16] if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 -- _deref_pbuz1_neq_vbuc1_then_la1
ldy #0
lda (str),y
cmp #'@'
bne b2
//SEG34 print_str::@return
//SEG35 [17] return
//SEG35 print_str::@return
//SEG36 [17] return
rts
//SEG36 print_str::@2
//SEG37 print_str::@2
b2:
//SEG37 [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2
//SEG38 [18] *((byte*) print_char_cursor#10) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2
ldy #0
lda (str),y
sta (print_char_cursor),y
//SEG38 [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1
//SEG39 [19] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#10 -- pbuz1=_inc_pbuz1
inc print_char_cursor
bne !+
inc print_char_cursor+1
!:
//SEG39 [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1
//SEG40 [20] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1
inc str
bne !+
inc str+1
!:
//SEG40 [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
//SEG41 [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy
//SEG42 [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy
//SEG41 [15] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1]
//SEG42 [15] phi (byte*) print_char_cursor#10 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy
//SEG43 [15] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy
jmp b1
}

Some files were not shown because too many files have changed in this diff Show More