mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-08 14:37:40 +00:00
Added procedure comments to the compiled assembler.
This commit is contained in:
parent
b5c61aad5d
commit
67e223d629
@ -64,7 +64,8 @@ public class Compiler {
|
||||
throw new CompileError("Error parsing file " + fileStream.getSourceName() + "\n - Line: " + line + "\n - Message: " + msg);
|
||||
}
|
||||
});
|
||||
KickCParser parser = new KickCParser(new CommonTokenStream(lexer));
|
||||
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
|
||||
KickCParser parser = new KickCParser(tokenStream);
|
||||
parser.setBuildParseTree(true);
|
||||
parser.addErrorListener(new BaseErrorListener() {
|
||||
@Override
|
||||
@ -78,7 +79,7 @@ public class Compiler {
|
||||
throw new CompileError("Error parsing file " + fileStream.getSourceName() + "\n - Line: " + line + "\n - Message: " + msg);
|
||||
}
|
||||
});
|
||||
Pass0GenerateStatementSequence pass0GenerateStatementSequence = new Pass0GenerateStatementSequence(file, parser.file(), program);
|
||||
Pass0GenerateStatementSequence pass0GenerateStatementSequence = new Pass0GenerateStatementSequence(file, tokenStream, parser.file(), program);
|
||||
pass0GenerateStatementSequence.generate();
|
||||
} catch(IOException e) {
|
||||
throw new CompileError("Error loading file " + fileName, e);
|
||||
|
@ -45,5 +45,14 @@ public class AsmComment implements AsmLine {
|
||||
return getAsm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of lines the comment has
|
||||
* @return The number of lines
|
||||
*/
|
||||
public long getLineCount() {
|
||||
return comment.chars().filter(x -> x == '\n').count() + 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -200,11 +200,6 @@ public class AsmSegment {
|
||||
out.append("\n");
|
||||
}
|
||||
for(AsmLine line : lines) {
|
||||
if(line instanceof AsmComment && !printState.isComments()) {
|
||||
if(!((AsmComment) line).getComment().contains("Fragment")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(line instanceof AsmScopeEnd) {
|
||||
printState.decIndent();
|
||||
}
|
||||
@ -212,7 +207,7 @@ public class AsmSegment {
|
||||
out.append("["+line.getIndex()+"]");
|
||||
}
|
||||
out.append(printState.getIndent());
|
||||
if(line instanceof AsmComment || line instanceof AsmInstruction || line instanceof AsmLabelDecl || line instanceof AsmConstant || line instanceof AsmDataNumeric || line instanceof AsmDataFill || line instanceof AsmDataString || line instanceof AsmDataAlignment || line instanceof AsmInlineKickAsm) {
|
||||
if(line instanceof AsmInstruction || line instanceof AsmLabelDecl || line instanceof AsmConstant || line instanceof AsmDataNumeric || line instanceof AsmDataFill || line instanceof AsmDataString || line instanceof AsmDataAlignment || line instanceof AsmInlineKickAsm) {
|
||||
out.append(" ");
|
||||
}
|
||||
out.append(line.getAsm() + "\n");
|
||||
|
20
src/main/java/dk/camelot64/kickc/model/Comment.java
Normal file
20
src/main/java/dk/camelot64/kickc/model/Comment.java
Normal file
@ -0,0 +1,20 @@
|
||||
package dk.camelot64.kickc.model;
|
||||
|
||||
/**
|
||||
* A comment in the source code.
|
||||
* Comments are attached to symbols and statements and
|
||||
* can be output in the generated assembler code.
|
||||
**/
|
||||
public class Comment {
|
||||
|
||||
private String comment;
|
||||
|
||||
public Comment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
}
|
@ -76,6 +76,9 @@ public class LiveRangeVariablesEffective {
|
||||
/** Cached alive combinations. */
|
||||
Map<Integer, AliveCombinations> statementAliveCombinations = new LinkedHashMap<>();
|
||||
|
||||
/** Special procedure reference used to represent the ROOT scope during live range analysis.*/
|
||||
static final ProcedureRef ROOT_PROCEDURE = new ProcedureRef("");
|
||||
|
||||
/**
|
||||
* Get all combinations of variables alive at a statement.
|
||||
* If the statement is inside a method the different combinations in the result arises from different calls of the method
|
||||
@ -101,7 +104,7 @@ public class LiveRangeVariablesEffective {
|
||||
callPaths = procedureCallPaths.get(procedure.getRef());
|
||||
referencedInProcedure = referenceInfo.getReferencedVars(procedure.getRef().getLabelRef());
|
||||
} else {
|
||||
callPaths = new CallPaths(Procedure.ROOT);
|
||||
callPaths = new CallPaths(ROOT_PROCEDURE);
|
||||
referencedInProcedure = new ArrayList<>();
|
||||
}
|
||||
Pass2AliasElimination.Aliases callAliases = null;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package dk.camelot64.kickc.model.symbols;
|
||||
|
||||
import dk.camelot64.kickc.model.Comment;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.types.SymbolType;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypeProcedure;
|
||||
@ -11,19 +12,23 @@ import java.util.List;
|
||||
/** Symbol describing a procedure/function */
|
||||
public class Procedure extends Scope {
|
||||
|
||||
public static final ProcedureRef ROOT = new ProcedureRef("");
|
||||
/** The return type. {@link SymbolType#VOID} if the procedure does not return a value. */
|
||||
private final SymbolType returnType;
|
||||
/** The names of the parameters of the procedure. */
|
||||
private List<String> parameterNames;
|
||||
/** true if the procedure is declared inline. */
|
||||
private boolean declaredInline;
|
||||
|
||||
/** The type of interrupt that the procedure serves. Null for all procedures not serving an interrupt. */
|
||||
private InterruptType interruptType;
|
||||
/** Comments preceeding the procedure in the source code. */
|
||||
private List<Comment> comments;
|
||||
|
||||
public Procedure(String name, SymbolType returnType, Scope parentScope) {
|
||||
super(name, parentScope);
|
||||
this.returnType = returnType;
|
||||
this.declaredInline = false;
|
||||
this.interruptType = null;
|
||||
this.comments = new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<String> getParameterNames() {
|
||||
@ -54,6 +59,15 @@ public class Procedure extends Scope {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<Comment> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(List<Comment> comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullName() {
|
||||
return super.getFullName();
|
||||
|
@ -213,5 +213,5 @@ fragment NAME_CHAR : [a-zA-Z0-9_];
|
||||
ASMREL: '!' NAME_CHAR* [+-]+ ;
|
||||
|
||||
WS : [ \t\r\n\u00a0]+ -> skip ;
|
||||
COMMENT_LINE : '//' ~[\r\n]* -> skip ;
|
||||
COMMENT_BLOCK : '/*' .*? '*/' -> skip;
|
||||
COMMENT_LINE : '//' ~[\r\n]* -> channel(HIDDEN);
|
||||
COMMENT_BLOCK : '/*' .*? '*/' -> channel(HIDDEN);
|
@ -452,14 +452,14 @@ public class KickCLexer extends Lexer {
|
||||
"\2\2\u036e\u036f\7\61\2\2\u036f\u0370\7\61\2\2\u0370\u0374\3\2\2\2\u0371"+
|
||||
"\u0373\n\f\2\2\u0372\u0371\3\2\2\2\u0373\u0376\3\2\2\2\u0374\u0372\3\2"+
|
||||
"\2\2\u0374\u0375\3\2\2\2\u0375\u0377\3\2\2\2\u0376\u0374\3\2\2\2\u0377"+
|
||||
"\u0378\b^\2\2\u0378\u00bc\3\2\2\2\u0379\u037a\7\61\2\2\u037a\u037b\7,"+
|
||||
"\u0378\b^\3\2\u0378\u00bc\3\2\2\2\u0379\u037a\7\61\2\2\u037a\u037b\7,"+
|
||||
"\2\2\u037b\u037f\3\2\2\2\u037c\u037e\13\2\2\2\u037d\u037c\3\2\2\2\u037e"+
|
||||
"\u0381\3\2\2\2\u037f\u0380\3\2\2\2\u037f\u037d\3\2\2\2\u0380\u0382\3\2"+
|
||||
"\2\2\u0381\u037f\3\2\2\2\u0382\u0383\7,\2\2\u0383\u0384\7\61\2\2\u0384"+
|
||||
"\u0385\3\2\2\2\u0385\u0386\b_\2\2\u0386\u00be\3\2\2\2!\2\u02a7\u02af\u02ca"+
|
||||
"\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\3\b\2\2";
|
||||
"\u036a\u0374\u037f\4\b\2\2\2\3\2";
|
||||
public static final ATN _ATN =
|
||||
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
|
||||
static {
|
||||
|
@ -2,10 +2,7 @@ package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.Compiler;
|
||||
import dk.camelot64.kickc.NumberParser;
|
||||
import dk.camelot64.kickc.model.CompileError;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.Registers;
|
||||
import dk.camelot64.kickc.model.StatementSequence;
|
||||
import dk.camelot64.kickc.model.*;
|
||||
import dk.camelot64.kickc.model.operators.Operator;
|
||||
import dk.camelot64.kickc.model.operators.Operators;
|
||||
import dk.camelot64.kickc.model.statements.*;
|
||||
@ -17,7 +14,9 @@ import dk.camelot64.kickc.model.types.SymbolTypeProcedure;
|
||||
import dk.camelot64.kickc.model.values.*;
|
||||
import dk.camelot64.kickc.parser.KickCBaseVisitor;
|
||||
import dk.camelot64.kickc.parser.KickCParser;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.ParserRuleContext;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
|
||||
import java.io.File;
|
||||
@ -37,6 +36,8 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
private File file;
|
||||
/** The source ANTLR parse tree of the source file. */
|
||||
private KickCParser.FileContext fileCtx;
|
||||
/** The source ANTLR Token Stream (used for finding comments in the lexer input.) */
|
||||
private CommonTokenStream tokenStream;
|
||||
|
||||
/** The program containing all compile structures. */
|
||||
private Program program;
|
||||
@ -45,8 +46,9 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
/** Used to build the scopes of the source file. */
|
||||
private Stack<Scope> scopeStack;
|
||||
|
||||
public Pass0GenerateStatementSequence(File file, KickCParser.FileContext fileCtx, Program program) {
|
||||
public Pass0GenerateStatementSequence(File file, CommonTokenStream tokenStream, KickCParser.FileContext fileCtx, Program program) {
|
||||
this.file = file;
|
||||
this.tokenStream = tokenStream;
|
||||
this.fileCtx = fileCtx;
|
||||
this.program = program;
|
||||
this.sequence = program.getStatementSequence();
|
||||
@ -112,6 +114,7 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
String name = ctx.NAME().getText();
|
||||
Procedure procedure = getCurrentSymbols().addProcedure(name, type);
|
||||
addDirectives(procedure, ctx.directive());
|
||||
addComments(procedure, ctx);
|
||||
scopeStack.push(procedure);
|
||||
Label procExit = procedure.addLabel(SymbolRef.PROCEXIT_BLOCK_NAME);
|
||||
VariableUnversioned returnVar = null;
|
||||
@ -141,6 +144,27 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find comments preceding the passed context
|
||||
* @param procedure
|
||||
* @param ctx
|
||||
*/
|
||||
private void addComments(Procedure procedure, 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);
|
||||
}
|
||||
}
|
||||
procedure.setComments(comments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Variable> visitParameterListDecl(KickCParser.ParameterListDeclContext ctx) {
|
||||
ArrayList<Variable> parameterDecls = new ArrayList<>();
|
||||
|
@ -56,12 +56,22 @@ public class Pass4CodeGeneration {
|
||||
addZpLabels(asm, currentScope);
|
||||
for(ControlFlowBlock block : getGraph().getAllBlocks()) {
|
||||
if(!block.getScope().equals(currentScope)) {
|
||||
// The current block is in a different scope. End the old scope.
|
||||
if(!ScopeRef.ROOT.equals(currentScope)) {
|
||||
addData(asm, currentScope);
|
||||
asm.addScopeEnd();
|
||||
}
|
||||
currentScope = block.getScope();
|
||||
asm.startSegment(currentScope, null, block.getLabel().getFullName());
|
||||
// Add any procedure comments
|
||||
if(block.isProcedureEntry(program)) {
|
||||
Procedure procedure = block.getProcedure(program);
|
||||
List<Comment> comments = procedure.getComments();
|
||||
for(Comment comment : comments) {
|
||||
asm.addComment(comment.getComment());
|
||||
}
|
||||
}
|
||||
// Start the new scope
|
||||
asm.addScopeBegin(block.getLabel().getFullName().replace('@', 'b').replace(':', '_'));
|
||||
// Add all ZP labels for the scope
|
||||
addConstants(asm, currentScope);
|
||||
@ -421,7 +431,7 @@ public class Pass4CodeGeneration {
|
||||
VariableRef lValueRef = (VariableRef) lValue;
|
||||
Registers.Register lValRegister = program.getSymbolInfos().getVariable(lValueRef).getAllocation();
|
||||
if(lValRegister.getType().equals(Registers.RegisterType.REG_ALU)) {
|
||||
asm.addComment(statement + " // ALU");
|
||||
//asm.addComment(statement + " // ALU");
|
||||
StatementAssignment assignmentAlu = assignment;
|
||||
aluState.setAluAssignment(assignmentAlu);
|
||||
isAlu = true;
|
||||
@ -429,7 +439,7 @@ public class Pass4CodeGeneration {
|
||||
}
|
||||
if(!isAlu) {
|
||||
if(assignment.getOperator() == null && assignment.getrValue1() == null && isRegisterCopy(lValue, assignment.getrValue2())) {
|
||||
asm.addComment(lValue.toString(program) + " = " + assignment.getrValue2().toString(program) + " // register copy " + getRegister(lValue));
|
||||
//asm.addComment(lValue.toString(program) + " = " + assignment.getrValue2().toString(program) + " // register copy " + getRegister(lValue));
|
||||
} else {
|
||||
AsmFragmentInstanceSpec asmFragmentInstanceSpec = new AsmFragmentInstanceSpec(assignment, program);
|
||||
AsmFragmentInstance asmFragmentInstance = AsmFragmentTemplateSynthesizer.getFragmentInstance(asmFragmentInstanceSpec, program.getLog());
|
||||
|
@ -104,7 +104,7 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
getLog().append("Warning! Failed to fix long branch at " + contextLine);
|
||||
throw new CompileError("Error! Failed to fix long branch at " + contextLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ public class Pass5ReindexAsmLines extends Pass5AsmOptimization {
|
||||
for(AsmSegment asmSegment : getAsmProgram().getSegments()) {
|
||||
for(AsmLine asmLine : asmSegment.getLines()) {
|
||||
if((asmLine instanceof AsmComment)) {
|
||||
asmLine.setIndex(-1);
|
||||
asmLine.setIndex(nextIndex);
|
||||
nextIndex += ((AsmComment) asmLine).getLineCount();
|
||||
} else if(asmLine instanceof AsmInlineKickAsm) {
|
||||
asmLine.setIndex(nextIndex);
|
||||
AsmInlineKickAsm inlineKickAsm = (AsmInlineKickAsm) asmLine;
|
||||
|
@ -44,6 +44,11 @@ public class TestPrograms {
|
||||
AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBgBlack() throws IOException, URISyntaxException {
|
||||
compileAndCompare("bgblack");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoRecursionHeavy() throws IOException, URISyntaxException {
|
||||
compileAndCompare("no-recursion-heavy");
|
||||
@ -76,7 +81,7 @@ public class TestPrograms {
|
||||
|
||||
//@Test
|
||||
//public void testRobozzle64() throws IOException, URISyntaxException {
|
||||
// compileAndCompare("complex/robozzle_c64/robozzle64");
|
||||
// compileAndCompare("complex/robozzle64/robozzle64");
|
||||
//}
|
||||
|
||||
@Test
|
||||
@ -251,6 +256,10 @@ public class TestPrograms {
|
||||
compileAndCompare("irq-kernel");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIrqKernelMinimal() throws IOException, URISyntaxException {
|
||||
compileAndCompare("irq-kernel-minimal");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIrqHyperscreen() throws IOException, URISyntaxException {
|
||||
|
4
src/test/kc/bgblack.kc
Normal file
4
src/test/kc/bgblack.kc
Normal file
@ -0,0 +1,4 @@
|
||||
import "c64"
|
||||
void main() {
|
||||
*BGCOL = BLACK;
|
||||
}
|
16
src/test/kc/irq-kernel-minimal.kc
Normal file
16
src/test/kc/irq-kernel-minimal.kc
Normal file
@ -0,0 +1,16 @@
|
||||
// A minimal working IRQ
|
||||
|
||||
import "c64"
|
||||
|
||||
// Setup the IRQ routine
|
||||
void main() {
|
||||
asm { sei }
|
||||
*KERNEL_IRQ = &irq;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
// The Interrupt Handler
|
||||
interrupt(kernel_keyboard) void irq() {
|
||||
*BGCOL = WHITE;
|
||||
*BGCOL = BLACK;
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.const SZ = $f
|
||||
// Fills the array item by item with $is, where i is the item# and s is the sub#
|
||||
main: {
|
||||
ldx #0
|
||||
b1:
|
||||
|
@ -159,6 +159,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 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]
|
||||
@ -225,6 +226,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 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]
|
||||
b1_from_main:
|
||||
@ -314,6 +316,7 @@ Score: 161
|
||||
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 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
|
||||
|
@ -3,6 +3,7 @@
|
||||
.pc = $80d "Program"
|
||||
.const ITEM_COUNT = 3
|
||||
.const ITEM_SIZE = 5
|
||||
// Fills the array item by item with $is, where i is the item# and s is the sub#
|
||||
main: {
|
||||
.label cur_item = 2
|
||||
lda #<items
|
||||
|
@ -267,6 +267,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Fills the array item by item with $is, where i is the item# and s is the sub#
|
||||
main: {
|
||||
.label _2 = 6
|
||||
.label _3 = 7
|
||||
@ -396,6 +397,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 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]
|
||||
@ -550,6 +552,7 @@ Score: 3416
|
||||
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 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]
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// Tests that chained assignments work as intended
|
||||
main: {
|
||||
.label screen = $400
|
||||
lda #'c'
|
||||
|
@ -132,6 +132,7 @@ bend_from_b1:
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
// Tests that chained assignments work as intended
|
||||
main: {
|
||||
.label screen = $400
|
||||
.label a = 2
|
||||
@ -199,6 +200,7 @@ bend_from_b1:
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
// Tests that chained assignments work as intended
|
||||
main: {
|
||||
.label screen = $400
|
||||
//SEG9 [4] *((const byte*) main::screen#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
|
||||
@ -277,6 +279,7 @@ Score: 38
|
||||
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG7 @end
|
||||
//SEG8 main
|
||||
// Tests that chained assignments work as intended
|
||||
main: {
|
||||
.label screen = $400
|
||||
//SEG9 [4] *((const byte*) main::screen#0) ← (byte) 'c' -- _deref_pbuc1=vbuc2
|
||||
|
10
src/test/ref/bgblack.asm
Normal file
10
src/test/ref/bgblack.asm
Normal file
@ -0,0 +1,10 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.label BGCOL = $d021
|
||||
.const BLACK = 0
|
||||
main: {
|
||||
lda #BLACK
|
||||
sta BGCOL
|
||||
rts
|
||||
}
|
15
src/test/ref/bgblack.cfg
Normal file
15
src/test/ref/bgblack.cfg
Normal file
@ -0,0 +1,15 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi()
|
||||
to:@5
|
||||
@5: scope:[] from @begin
|
||||
[1] phi()
|
||||
[2] call main
|
||||
to:@end
|
||||
@end: scope:[] from @5
|
||||
[3] phi()
|
||||
main: scope:[main] from @5
|
||||
[4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[5] return
|
||||
to:@return
|
673
src/test/ref/bgblack.log
Normal file
673
src/test/ref/bgblack.log
Normal file
@ -0,0 +1,673 @@
|
||||
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
|
||||
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) PROCPORT_DDR#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(byte*) PROCPORT#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) PROCPORT_RAM_ALL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48
|
||||
(byte) PROCPORT_RAM_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 53
|
||||
(byte) PROCPORT_RAM_CHARROM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 49
|
||||
(byte) PROCPORT_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 54
|
||||
(byte) PROCPORT_BASIC_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 55
|
||||
(byte*) CHARGEN#0 ← ((byte*)) (word/dword/signed dword) 53248
|
||||
(word) SPRITE_PTRS#0 ← (word/signed word/dword/signed dword) 1016
|
||||
(byte*) SPRITES_XPOS#0 ← ((byte*)) (word/dword/signed dword) 53248
|
||||
(byte*) SPRITES_YPOS#0 ← ((byte*)) (word/dword/signed dword) 53249
|
||||
(byte*) SPRITES_XMSB#0 ← ((byte*)) (word/dword/signed dword) 53264
|
||||
(byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266
|
||||
(byte*) SPRITES_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53269
|
||||
(byte*) SPRITES_EXPAND_Y#0 ← ((byte*)) (word/dword/signed dword) 53271
|
||||
(byte*) SPRITES_PRIORITY#0 ← ((byte*)) (word/dword/signed dword) 53275
|
||||
(byte*) SPRITES_MC#0 ← ((byte*)) (word/dword/signed dword) 53276
|
||||
(byte*) SPRITES_EXPAND_X#0 ← ((byte*)) (word/dword/signed dword) 53277
|
||||
(byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) 53280
|
||||
(byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte*) BGCOL1#0 ← ((byte*)) (word/dword/signed dword) 53281
|
||||
(byte*) BGCOL2#0 ← ((byte*)) (word/dword/signed dword) 53282
|
||||
(byte*) BGCOL3#0 ← ((byte*)) (word/dword/signed dword) 53283
|
||||
(byte*) BGCOL4#0 ← ((byte*)) (word/dword/signed dword) 53284
|
||||
(byte*) SPRITES_MC1#0 ← ((byte*)) (word/dword/signed dword) 53285
|
||||
(byte*) SPRITES_MC2#0 ← ((byte*)) (word/dword/signed dword) 53286
|
||||
(byte*) SPRITES_COLS#0 ← ((byte*)) (word/dword/signed dword) 53287
|
||||
(byte*) VIC_CONTROL#0 ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte*) D011#0 ← ((byte*)) (word/dword/signed dword) 53265
|
||||
(byte) VIC_RST8#0 ← (byte/word/signed word/dword/signed dword) 128
|
||||
(byte) VIC_ECM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 64
|
||||
(byte) VIC_BMM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32
|
||||
(byte) VIC_DEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte) VIC_RSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) VIC_CONTROL2#0 ← ((byte*)) (word/dword/signed dword) 53270
|
||||
(byte*) D016#0 ← ((byte*)) (word/dword/signed dword) 53270
|
||||
(byte) VIC_MCM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16
|
||||
(byte) VIC_CSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) D018#0 ← ((byte*)) (word/dword/signed dword) 53272
|
||||
(byte*) VIC_MEMORY#0 ← ((byte*)) (word/dword/signed dword) 53272
|
||||
(byte*) LIGHTPEN_X#0 ← ((byte*)) (word/dword/signed dword) 53267
|
||||
(byte*) LIGHTPEN_Y#0 ← ((byte*)) (word/dword/signed dword) 53268
|
||||
(byte*) IRQ_STATUS#0 ← ((byte*)) (word/dword/signed dword) 53273
|
||||
(byte*) IRQ_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53274
|
||||
(byte) IRQ_RASTER#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) IRQ_COLLISION_BG#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) IRQ_COLLISION_SPRITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) IRQ_LIGHTPEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte*) COLS#0 ← ((byte*)) (word/dword/signed dword) 55296
|
||||
(byte*) CIA1_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56320
|
||||
(byte*) CIA1_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56321
|
||||
(byte*) CIA1_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56322
|
||||
(byte*) CIA1_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56323
|
||||
(byte*) CIA1_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56333
|
||||
(byte) CIA_INTERRUPT_CLEAR#0 ← (byte/signed byte/word/signed word/dword/signed dword) 127
|
||||
(byte*) CIA2_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56576
|
||||
(byte*) CIA2_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56577
|
||||
(byte*) CIA2_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56578
|
||||
(byte*) CIA2_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56579
|
||||
(byte*) CIA2_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56589
|
||||
(void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788
|
||||
(void()**) HARDWARE_IRQ#0 ← ((void()**)) (word/dword/signed dword) 65534
|
||||
(byte) BLACK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) WHITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1
|
||||
(byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2
|
||||
(byte) CYAN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 3
|
||||
(byte) PURPLE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4
|
||||
(byte) GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5
|
||||
(byte) BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 6
|
||||
(byte) YELLOW#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7
|
||||
(byte) ORANGE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8
|
||||
(byte) BROWN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 9
|
||||
(byte) PINK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 10
|
||||
(byte) DARK_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 11
|
||||
(byte) GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12
|
||||
(byte) LIGHT_GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 13
|
||||
(byte) LIGHT_BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 14
|
||||
(byte) LIGHT_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 15
|
||||
to:@5
|
||||
main: scope:[main] from @5
|
||||
*((byte*) BGCOL#0) ← (byte) BLACK#0
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @begin
|
||||
call main
|
||||
to:@6
|
||||
@6: scope:[] from @5
|
||||
to:@end
|
||||
@end: scope:[] from @6
|
||||
|
||||
SYMBOL TABLE SSA
|
||||
(label) @5
|
||||
(label) @6
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(byte*) BGCOL#0
|
||||
(byte*) BGCOL1
|
||||
(byte*) BGCOL1#0
|
||||
(byte*) BGCOL2
|
||||
(byte*) BGCOL2#0
|
||||
(byte*) BGCOL3
|
||||
(byte*) BGCOL3#0
|
||||
(byte*) BGCOL4
|
||||
(byte*) BGCOL4#0
|
||||
(byte) BLACK
|
||||
(byte) BLACK#0
|
||||
(byte) BLUE
|
||||
(byte) BLUE#0
|
||||
(byte*) BORDERCOL
|
||||
(byte*) BORDERCOL#0
|
||||
(byte) BROWN
|
||||
(byte) BROWN#0
|
||||
(byte*) CHARGEN
|
||||
(byte*) CHARGEN#0
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte*) CIA1_INTERRUPT#0
|
||||
(byte*) CIA1_PORT_A
|
||||
(byte*) CIA1_PORT_A#0
|
||||
(byte*) CIA1_PORT_A_DDR
|
||||
(byte*) CIA1_PORT_A_DDR#0
|
||||
(byte*) CIA1_PORT_B
|
||||
(byte*) CIA1_PORT_B#0
|
||||
(byte*) CIA1_PORT_B_DDR
|
||||
(byte*) CIA1_PORT_B_DDR#0
|
||||
(byte*) CIA2_INTERRUPT
|
||||
(byte*) CIA2_INTERRUPT#0
|
||||
(byte*) CIA2_PORT_A
|
||||
(byte*) CIA2_PORT_A#0
|
||||
(byte*) CIA2_PORT_A_DDR
|
||||
(byte*) CIA2_PORT_A_DDR#0
|
||||
(byte*) CIA2_PORT_B
|
||||
(byte*) CIA2_PORT_B#0
|
||||
(byte*) CIA2_PORT_B_DDR
|
||||
(byte*) CIA2_PORT_B_DDR#0
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte) CIA_INTERRUPT_CLEAR#0
|
||||
(byte*) COLS
|
||||
(byte*) COLS#0
|
||||
(byte) CYAN
|
||||
(byte) CYAN#0
|
||||
(byte*) D011
|
||||
(byte*) D011#0
|
||||
(byte*) D016
|
||||
(byte*) D016#0
|
||||
(byte*) D018
|
||||
(byte*) D018#0
|
||||
(byte) DARK_GREY
|
||||
(byte) DARK_GREY#0
|
||||
(byte) GREEN
|
||||
(byte) GREEN#0
|
||||
(byte) GREY
|
||||
(byte) GREY#0
|
||||
(void()**) HARDWARE_IRQ
|
||||
(void()**) HARDWARE_IRQ#0
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_BG#0
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte) IRQ_COLLISION_SPRITE#0
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte*) IRQ_ENABLE#0
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_LIGHTPEN#0
|
||||
(byte) IRQ_RASTER
|
||||
(byte) IRQ_RASTER#0
|
||||
(byte*) IRQ_STATUS
|
||||
(byte*) IRQ_STATUS#0
|
||||
(void()**) KERNEL_IRQ
|
||||
(void()**) KERNEL_IRQ#0
|
||||
(byte*) LIGHTPEN_X
|
||||
(byte*) LIGHTPEN_X#0
|
||||
(byte*) LIGHTPEN_Y
|
||||
(byte*) LIGHTPEN_Y#0
|
||||
(byte) LIGHT_BLUE
|
||||
(byte) LIGHT_BLUE#0
|
||||
(byte) LIGHT_GREEN
|
||||
(byte) LIGHT_GREEN#0
|
||||
(byte) LIGHT_GREY
|
||||
(byte) LIGHT_GREY#0
|
||||
(byte) ORANGE
|
||||
(byte) ORANGE#0
|
||||
(byte) PINK
|
||||
(byte) PINK#0
|
||||
(byte*) PROCPORT
|
||||
(byte*) PROCPORT#0
|
||||
(byte) PROCPORT_BASIC_KERNEL_IO
|
||||
(byte) PROCPORT_BASIC_KERNEL_IO#0
|
||||
(byte*) PROCPORT_DDR
|
||||
(byte*) PROCPORT_DDR#0
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK#0
|
||||
(byte) PROCPORT_KERNEL_IO
|
||||
(byte) PROCPORT_KERNEL_IO#0
|
||||
(byte) PROCPORT_RAM_ALL
|
||||
(byte) PROCPORT_RAM_ALL#0
|
||||
(byte) PROCPORT_RAM_CHARROM
|
||||
(byte) PROCPORT_RAM_CHARROM#0
|
||||
(byte) PROCPORT_RAM_IO
|
||||
(byte) PROCPORT_RAM_IO#0
|
||||
(byte) PURPLE
|
||||
(byte) PURPLE#0
|
||||
(byte*) RASTER
|
||||
(byte*) RASTER#0
|
||||
(byte) RED
|
||||
(byte) RED#0
|
||||
(byte*) SPRITES_COLS
|
||||
(byte*) SPRITES_COLS#0
|
||||
(byte*) SPRITES_ENABLE
|
||||
(byte*) SPRITES_ENABLE#0
|
||||
(byte*) SPRITES_EXPAND_X
|
||||
(byte*) SPRITES_EXPAND_X#0
|
||||
(byte*) SPRITES_EXPAND_Y
|
||||
(byte*) SPRITES_EXPAND_Y#0
|
||||
(byte*) SPRITES_MC
|
||||
(byte*) SPRITES_MC#0
|
||||
(byte*) SPRITES_MC1
|
||||
(byte*) SPRITES_MC1#0
|
||||
(byte*) SPRITES_MC2
|
||||
(byte*) SPRITES_MC2#0
|
||||
(byte*) SPRITES_PRIORITY
|
||||
(byte*) SPRITES_PRIORITY#0
|
||||
(byte*) SPRITES_XMSB
|
||||
(byte*) SPRITES_XMSB#0
|
||||
(byte*) SPRITES_XPOS
|
||||
(byte*) SPRITES_XPOS#0
|
||||
(byte*) SPRITES_YPOS
|
||||
(byte*) SPRITES_YPOS#0
|
||||
(word) SPRITE_PTRS
|
||||
(word) SPRITE_PTRS#0
|
||||
(byte) VIC_BMM
|
||||
(byte) VIC_BMM#0
|
||||
(byte*) VIC_CONTROL
|
||||
(byte*) VIC_CONTROL#0
|
||||
(byte*) VIC_CONTROL2
|
||||
(byte*) VIC_CONTROL2#0
|
||||
(byte) VIC_CSEL
|
||||
(byte) VIC_CSEL#0
|
||||
(byte) VIC_DEN
|
||||
(byte) VIC_DEN#0
|
||||
(byte) VIC_ECM
|
||||
(byte) VIC_ECM#0
|
||||
(byte) VIC_MCM
|
||||
(byte) VIC_MCM#0
|
||||
(byte*) VIC_MEMORY
|
||||
(byte*) VIC_MEMORY#0
|
||||
(byte) VIC_RSEL
|
||||
(byte) VIC_RSEL#0
|
||||
(byte) VIC_RST8
|
||||
(byte) VIC_RST8#0
|
||||
(byte) WHITE
|
||||
(byte) WHITE#0
|
||||
(byte) YELLOW
|
||||
(byte) YELLOW#0
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
Culled Empty Block (label) @6
|
||||
Successful SSA optimization Pass2CullEmptyBlocks
|
||||
Constant (const byte*) PROCPORT_DDR#0 = ((byte*))0
|
||||
Constant (const byte) PROCPORT_DDR_MEMORY_MASK#0 = 7
|
||||
Constant (const byte*) PROCPORT#0 = ((byte*))1
|
||||
Constant (const byte) PROCPORT_RAM_ALL#0 = 48
|
||||
Constant (const byte) PROCPORT_RAM_IO#0 = 53
|
||||
Constant (const byte) PROCPORT_RAM_CHARROM#0 = 49
|
||||
Constant (const byte) PROCPORT_KERNEL_IO#0 = 54
|
||||
Constant (const byte) PROCPORT_BASIC_KERNEL_IO#0 = 55
|
||||
Constant (const byte*) CHARGEN#0 = ((byte*))53248
|
||||
Constant (const word) SPRITE_PTRS#0 = 1016
|
||||
Constant (const byte*) SPRITES_XPOS#0 = ((byte*))53248
|
||||
Constant (const byte*) SPRITES_YPOS#0 = ((byte*))53249
|
||||
Constant (const byte*) SPRITES_XMSB#0 = ((byte*))53264
|
||||
Constant (const byte*) RASTER#0 = ((byte*))53266
|
||||
Constant (const byte*) SPRITES_ENABLE#0 = ((byte*))53269
|
||||
Constant (const byte*) SPRITES_EXPAND_Y#0 = ((byte*))53271
|
||||
Constant (const byte*) SPRITES_PRIORITY#0 = ((byte*))53275
|
||||
Constant (const byte*) SPRITES_MC#0 = ((byte*))53276
|
||||
Constant (const byte*) SPRITES_EXPAND_X#0 = ((byte*))53277
|
||||
Constant (const byte*) BORDERCOL#0 = ((byte*))53280
|
||||
Constant (const byte*) BGCOL#0 = ((byte*))53281
|
||||
Constant (const byte*) BGCOL1#0 = ((byte*))53281
|
||||
Constant (const byte*) BGCOL2#0 = ((byte*))53282
|
||||
Constant (const byte*) BGCOL3#0 = ((byte*))53283
|
||||
Constant (const byte*) BGCOL4#0 = ((byte*))53284
|
||||
Constant (const byte*) SPRITES_MC1#0 = ((byte*))53285
|
||||
Constant (const byte*) SPRITES_MC2#0 = ((byte*))53286
|
||||
Constant (const byte*) SPRITES_COLS#0 = ((byte*))53287
|
||||
Constant (const byte*) VIC_CONTROL#0 = ((byte*))53265
|
||||
Constant (const byte*) D011#0 = ((byte*))53265
|
||||
Constant (const byte) VIC_RST8#0 = 128
|
||||
Constant (const byte) VIC_ECM#0 = 64
|
||||
Constant (const byte) VIC_BMM#0 = 32
|
||||
Constant (const byte) VIC_DEN#0 = 16
|
||||
Constant (const byte) VIC_RSEL#0 = 8
|
||||
Constant (const byte*) VIC_CONTROL2#0 = ((byte*))53270
|
||||
Constant (const byte*) D016#0 = ((byte*))53270
|
||||
Constant (const byte) VIC_MCM#0 = 16
|
||||
Constant (const byte) VIC_CSEL#0 = 8
|
||||
Constant (const byte*) D018#0 = ((byte*))53272
|
||||
Constant (const byte*) VIC_MEMORY#0 = ((byte*))53272
|
||||
Constant (const byte*) LIGHTPEN_X#0 = ((byte*))53267
|
||||
Constant (const byte*) LIGHTPEN_Y#0 = ((byte*))53268
|
||||
Constant (const byte*) IRQ_STATUS#0 = ((byte*))53273
|
||||
Constant (const byte*) IRQ_ENABLE#0 = ((byte*))53274
|
||||
Constant (const byte) IRQ_RASTER#0 = 1
|
||||
Constant (const byte) IRQ_COLLISION_BG#0 = 2
|
||||
Constant (const byte) IRQ_COLLISION_SPRITE#0 = 4
|
||||
Constant (const byte) IRQ_LIGHTPEN#0 = 8
|
||||
Constant (const byte*) COLS#0 = ((byte*))55296
|
||||
Constant (const byte*) CIA1_PORT_A#0 = ((byte*))56320
|
||||
Constant (const byte*) CIA1_PORT_B#0 = ((byte*))56321
|
||||
Constant (const byte*) CIA1_PORT_A_DDR#0 = ((byte*))56322
|
||||
Constant (const byte*) CIA1_PORT_B_DDR#0 = ((byte*))56323
|
||||
Constant (const byte*) CIA1_INTERRUPT#0 = ((byte*))56333
|
||||
Constant (const byte) CIA_INTERRUPT_CLEAR#0 = 127
|
||||
Constant (const byte*) CIA2_PORT_A#0 = ((byte*))56576
|
||||
Constant (const byte*) CIA2_PORT_B#0 = ((byte*))56577
|
||||
Constant (const byte*) CIA2_PORT_A_DDR#0 = ((byte*))56578
|
||||
Constant (const byte*) CIA2_PORT_B_DDR#0 = ((byte*))56579
|
||||
Constant (const byte*) CIA2_INTERRUPT#0 = ((byte*))56589
|
||||
Constant (const void()**) KERNEL_IRQ#0 = ((void()**))788
|
||||
Constant (const void()**) HARDWARE_IRQ#0 = ((void()**))65534
|
||||
Constant (const byte) BLACK#0 = 0
|
||||
Constant (const byte) WHITE#0 = 1
|
||||
Constant (const byte) RED#0 = 2
|
||||
Constant (const byte) CYAN#0 = 3
|
||||
Constant (const byte) PURPLE#0 = 4
|
||||
Constant (const byte) GREEN#0 = 5
|
||||
Constant (const byte) BLUE#0 = 6
|
||||
Constant (const byte) YELLOW#0 = 7
|
||||
Constant (const byte) ORANGE#0 = 8
|
||||
Constant (const byte) BROWN#0 = 9
|
||||
Constant (const byte) PINK#0 = 10
|
||||
Constant (const byte) DARK_GREY#0 = 11
|
||||
Constant (const byte) GREY#0 = 12
|
||||
Constant (const byte) LIGHT_GREEN#0 = 13
|
||||
Constant (const byte) LIGHT_BLUE#0 = 14
|
||||
Constant (const byte) LIGHT_GREY#0 = 15
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Successful SSA optimization PassNEliminateUnusedVars
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @5
|
||||
Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:2
|
||||
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @5
|
||||
Adding NOP phi() at start of @end
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
[0] phi()
|
||||
to:@5
|
||||
@5: scope:[] from @begin
|
||||
[1] phi()
|
||||
[2] call main
|
||||
to:@end
|
||||
@end: scope:[] from @5
|
||||
[3] phi()
|
||||
main: scope:[main] from @5
|
||||
[4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[5] return
|
||||
to:@return
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
(byte*) BGCOL
|
||||
(byte*) BGCOL1
|
||||
(byte*) BGCOL2
|
||||
(byte*) BGCOL3
|
||||
(byte*) BGCOL4
|
||||
(byte) BLACK
|
||||
(byte) BLUE
|
||||
(byte*) BORDERCOL
|
||||
(byte) BROWN
|
||||
(byte*) CHARGEN
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte*) CIA1_PORT_A
|
||||
(byte*) CIA1_PORT_A_DDR
|
||||
(byte*) CIA1_PORT_B
|
||||
(byte*) CIA1_PORT_B_DDR
|
||||
(byte*) CIA2_INTERRUPT
|
||||
(byte*) CIA2_PORT_A
|
||||
(byte*) CIA2_PORT_A_DDR
|
||||
(byte*) CIA2_PORT_B
|
||||
(byte*) CIA2_PORT_B_DDR
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte*) COLS
|
||||
(byte) CYAN
|
||||
(byte*) D011
|
||||
(byte*) D016
|
||||
(byte*) D018
|
||||
(byte) DARK_GREY
|
||||
(byte) GREEN
|
||||
(byte) GREY
|
||||
(void()**) HARDWARE_IRQ
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte*) LIGHTPEN_X
|
||||
(byte*) LIGHTPEN_Y
|
||||
(byte) LIGHT_BLUE
|
||||
(byte) LIGHT_GREEN
|
||||
(byte) LIGHT_GREY
|
||||
(byte) ORANGE
|
||||
(byte) PINK
|
||||
(byte*) PROCPORT
|
||||
(byte) PROCPORT_BASIC_KERNEL_IO
|
||||
(byte*) PROCPORT_DDR
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK
|
||||
(byte) PROCPORT_KERNEL_IO
|
||||
(byte) PROCPORT_RAM_ALL
|
||||
(byte) PROCPORT_RAM_CHARROM
|
||||
(byte) PROCPORT_RAM_IO
|
||||
(byte) PURPLE
|
||||
(byte*) RASTER
|
||||
(byte) RED
|
||||
(byte*) SPRITES_COLS
|
||||
(byte*) SPRITES_ENABLE
|
||||
(byte*) SPRITES_EXPAND_X
|
||||
(byte*) SPRITES_EXPAND_Y
|
||||
(byte*) SPRITES_MC
|
||||
(byte*) SPRITES_MC1
|
||||
(byte*) SPRITES_MC2
|
||||
(byte*) SPRITES_PRIORITY
|
||||
(byte*) SPRITES_XMSB
|
||||
(byte*) SPRITES_XPOS
|
||||
(byte*) SPRITES_YPOS
|
||||
(word) SPRITE_PTRS
|
||||
(byte) VIC_BMM
|
||||
(byte*) VIC_CONTROL
|
||||
(byte*) VIC_CONTROL2
|
||||
(byte) VIC_CSEL
|
||||
(byte) VIC_DEN
|
||||
(byte) VIC_ECM
|
||||
(byte) VIC_MCM
|
||||
(byte*) VIC_MEMORY
|
||||
(byte) VIC_RSEL
|
||||
(byte) VIC_RST8
|
||||
(byte) WHITE
|
||||
(byte) YELLOW
|
||||
(void()) main()
|
||||
|
||||
Initial phi equivalence classes
|
||||
Complete equivalence classes
|
||||
|
||||
INITIAL ASM
|
||||
//SEG0 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(bbegin)
|
||||
.pc = $80d "Program"
|
||||
//SEG1 Global Constants & labels
|
||||
.label BGCOL = $d021
|
||||
.const BLACK = 0
|
||||
//SEG2 @begin
|
||||
bbegin:
|
||||
//SEG3 [1] phi from @begin to @5 [phi:@begin->@5]
|
||||
b5_from_bbegin:
|
||||
jmp b5
|
||||
//SEG4 @5
|
||||
b5:
|
||||
//SEG5 [2] call main
|
||||
jsr main
|
||||
//SEG6 [3] phi from @5 to @end [phi:@5->@end]
|
||||
bend_from_b5:
|
||||
jmp bend
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
main: {
|
||||
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
|
||||
lda #BLACK
|
||||
sta BGCOL
|
||||
jmp breturn
|
||||
//SEG10 main::@return
|
||||
breturn:
|
||||
//SEG11 [5] return
|
||||
rts
|
||||
}
|
||||
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 27 combination
|
||||
Uplifting [] best 27 combination
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
//SEG0 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(bbegin)
|
||||
.pc = $80d "Program"
|
||||
//SEG1 Global Constants & labels
|
||||
.label BGCOL = $d021
|
||||
.const BLACK = 0
|
||||
//SEG2 @begin
|
||||
bbegin:
|
||||
//SEG3 [1] phi from @begin to @5 [phi:@begin->@5]
|
||||
b5_from_bbegin:
|
||||
jmp b5
|
||||
//SEG4 @5
|
||||
b5:
|
||||
//SEG5 [2] call main
|
||||
jsr main
|
||||
//SEG6 [3] phi from @5 to @end [phi:@5->@end]
|
||||
bend_from_b5:
|
||||
jmp bend
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
main: {
|
||||
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
|
||||
lda #BLACK
|
||||
sta BGCOL
|
||||
jmp breturn
|
||||
//SEG10 main::@return
|
||||
breturn:
|
||||
//SEG11 [5] return
|
||||
rts
|
||||
}
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp b5
|
||||
Removing instruction jmp bend
|
||||
Removing instruction jmp breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction b5_from_bbegin:
|
||||
Removing instruction b5:
|
||||
Removing instruction bend_from_b5:
|
||||
Succesful ASM optimization Pass5RedundantLabelElimination
|
||||
Removing instruction bend:
|
||||
Removing instruction breturn:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
Updating BasicUpstart to call main directly
|
||||
Removing instruction jsr main
|
||||
Succesful ASM optimization Pass5SkipBegin
|
||||
Removing instruction bbegin:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(label) @5
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53281
|
||||
(byte*) BGCOL1
|
||||
(byte*) BGCOL2
|
||||
(byte*) BGCOL3
|
||||
(byte*) BGCOL4
|
||||
(byte) BLACK
|
||||
(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) BLUE
|
||||
(byte*) BORDERCOL
|
||||
(byte) BROWN
|
||||
(byte*) CHARGEN
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte*) CIA1_PORT_A
|
||||
(byte*) CIA1_PORT_A_DDR
|
||||
(byte*) CIA1_PORT_B
|
||||
(byte*) CIA1_PORT_B_DDR
|
||||
(byte*) CIA2_INTERRUPT
|
||||
(byte*) CIA2_PORT_A
|
||||
(byte*) CIA2_PORT_A_DDR
|
||||
(byte*) CIA2_PORT_B
|
||||
(byte*) CIA2_PORT_B_DDR
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte*) COLS
|
||||
(byte) CYAN
|
||||
(byte*) D011
|
||||
(byte*) D016
|
||||
(byte*) D018
|
||||
(byte) DARK_GREY
|
||||
(byte) GREEN
|
||||
(byte) GREY
|
||||
(void()**) HARDWARE_IRQ
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte*) LIGHTPEN_X
|
||||
(byte*) LIGHTPEN_Y
|
||||
(byte) LIGHT_BLUE
|
||||
(byte) LIGHT_GREEN
|
||||
(byte) LIGHT_GREY
|
||||
(byte) ORANGE
|
||||
(byte) PINK
|
||||
(byte*) PROCPORT
|
||||
(byte) PROCPORT_BASIC_KERNEL_IO
|
||||
(byte*) PROCPORT_DDR
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK
|
||||
(byte) PROCPORT_KERNEL_IO
|
||||
(byte) PROCPORT_RAM_ALL
|
||||
(byte) PROCPORT_RAM_CHARROM
|
||||
(byte) PROCPORT_RAM_IO
|
||||
(byte) PURPLE
|
||||
(byte*) RASTER
|
||||
(byte) RED
|
||||
(byte*) SPRITES_COLS
|
||||
(byte*) SPRITES_ENABLE
|
||||
(byte*) SPRITES_EXPAND_X
|
||||
(byte*) SPRITES_EXPAND_Y
|
||||
(byte*) SPRITES_MC
|
||||
(byte*) SPRITES_MC1
|
||||
(byte*) SPRITES_MC2
|
||||
(byte*) SPRITES_PRIORITY
|
||||
(byte*) SPRITES_XMSB
|
||||
(byte*) SPRITES_XPOS
|
||||
(byte*) SPRITES_YPOS
|
||||
(word) SPRITE_PTRS
|
||||
(byte) VIC_BMM
|
||||
(byte*) VIC_CONTROL
|
||||
(byte*) VIC_CONTROL2
|
||||
(byte) VIC_CSEL
|
||||
(byte) VIC_DEN
|
||||
(byte) VIC_ECM
|
||||
(byte) VIC_MCM
|
||||
(byte*) VIC_MEMORY
|
||||
(byte) VIC_RSEL
|
||||
(byte) VIC_RST8
|
||||
(byte) WHITE
|
||||
(byte) YELLOW
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 12
|
||||
|
||||
//SEG0 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
//SEG1 Global Constants & labels
|
||||
.label BGCOL = $d021
|
||||
.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
|
||||
main: {
|
||||
//SEG9 [4] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2
|
||||
lda #BLACK
|
||||
sta BGCOL
|
||||
//SEG10 main::@return
|
||||
//SEG11 [5] return
|
||||
rts
|
||||
}
|
||||
|
87
src/test/ref/bgblack.sym
Normal file
87
src/test/ref/bgblack.sym
Normal file
@ -0,0 +1,87 @@
|
||||
(label) @5
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53281
|
||||
(byte*) BGCOL1
|
||||
(byte*) BGCOL2
|
||||
(byte*) BGCOL3
|
||||
(byte*) BGCOL4
|
||||
(byte) BLACK
|
||||
(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0
|
||||
(byte) BLUE
|
||||
(byte*) BORDERCOL
|
||||
(byte) BROWN
|
||||
(byte*) CHARGEN
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(byte*) CIA1_PORT_A
|
||||
(byte*) CIA1_PORT_A_DDR
|
||||
(byte*) CIA1_PORT_B
|
||||
(byte*) CIA1_PORT_B_DDR
|
||||
(byte*) CIA2_INTERRUPT
|
||||
(byte*) CIA2_PORT_A
|
||||
(byte*) CIA2_PORT_A_DDR
|
||||
(byte*) CIA2_PORT_B
|
||||
(byte*) CIA2_PORT_B_DDR
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(byte*) COLS
|
||||
(byte) CYAN
|
||||
(byte*) D011
|
||||
(byte*) D016
|
||||
(byte*) D018
|
||||
(byte) DARK_GREY
|
||||
(byte) GREEN
|
||||
(byte) GREY
|
||||
(void()**) HARDWARE_IRQ
|
||||
(byte) IRQ_COLLISION_BG
|
||||
(byte) IRQ_COLLISION_SPRITE
|
||||
(byte*) IRQ_ENABLE
|
||||
(byte) IRQ_LIGHTPEN
|
||||
(byte) IRQ_RASTER
|
||||
(byte*) IRQ_STATUS
|
||||
(void()**) KERNEL_IRQ
|
||||
(byte*) LIGHTPEN_X
|
||||
(byte*) LIGHTPEN_Y
|
||||
(byte) LIGHT_BLUE
|
||||
(byte) LIGHT_GREEN
|
||||
(byte) LIGHT_GREY
|
||||
(byte) ORANGE
|
||||
(byte) PINK
|
||||
(byte*) PROCPORT
|
||||
(byte) PROCPORT_BASIC_KERNEL_IO
|
||||
(byte*) PROCPORT_DDR
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK
|
||||
(byte) PROCPORT_KERNEL_IO
|
||||
(byte) PROCPORT_RAM_ALL
|
||||
(byte) PROCPORT_RAM_CHARROM
|
||||
(byte) PROCPORT_RAM_IO
|
||||
(byte) PURPLE
|
||||
(byte*) RASTER
|
||||
(byte) RED
|
||||
(byte*) SPRITES_COLS
|
||||
(byte*) SPRITES_ENABLE
|
||||
(byte*) SPRITES_EXPAND_X
|
||||
(byte*) SPRITES_EXPAND_Y
|
||||
(byte*) SPRITES_MC
|
||||
(byte*) SPRITES_MC1
|
||||
(byte*) SPRITES_MC2
|
||||
(byte*) SPRITES_PRIORITY
|
||||
(byte*) SPRITES_XMSB
|
||||
(byte*) SPRITES_XPOS
|
||||
(byte*) SPRITES_YPOS
|
||||
(word) SPRITE_PTRS
|
||||
(byte) VIC_BMM
|
||||
(byte*) VIC_CONTROL
|
||||
(byte*) VIC_CONTROL2
|
||||
(byte) VIC_CSEL
|
||||
(byte) VIC_DEN
|
||||
(byte) VIC_ECM
|
||||
(byte) VIC_MCM
|
||||
(byte*) VIC_MEMORY
|
||||
(byte) VIC_RSEL
|
||||
(byte) VIC_RST8
|
||||
(byte) WHITE
|
||||
(byte) YELLOW
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
@ -8,16 +8,19 @@ main: {
|
||||
jsr bool_const_inline
|
||||
rts
|
||||
}
|
||||
// A constant boolean inside an if()
|
||||
bool_const_inline: {
|
||||
lda #'t'
|
||||
sta SCREEN+2
|
||||
rts
|
||||
}
|
||||
// A bunch of constant boolean vars (used in an if)
|
||||
bool_const_vars: {
|
||||
lda #'f'
|
||||
sta SCREEN+1
|
||||
rts
|
||||
}
|
||||
// A constant boolean inside an if()
|
||||
bool_const_if: {
|
||||
lda #'t'
|
||||
sta SCREEN
|
||||
|
@ -367,6 +367,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG22 bool_const_inline
|
||||
// A constant boolean inside an if()
|
||||
bool_const_inline: {
|
||||
jmp b1
|
||||
//SEG23 bool_const_inline::@1
|
||||
@ -381,6 +382,7 @@ bool_const_inline: {
|
||||
rts
|
||||
}
|
||||
//SEG27 bool_const_vars
|
||||
// A bunch of constant boolean vars (used in an if)
|
||||
bool_const_vars: {
|
||||
jmp b3
|
||||
//SEG28 bool_const_vars::@3
|
||||
@ -395,6 +397,7 @@ bool_const_vars: {
|
||||
rts
|
||||
}
|
||||
//SEG32 bool_const_if
|
||||
// A constant boolean inside an if()
|
||||
bool_const_if: {
|
||||
jmp b1
|
||||
//SEG33 bool_const_if::@1
|
||||
@ -481,6 +484,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG22 bool_const_inline
|
||||
// A constant boolean inside an if()
|
||||
bool_const_inline: {
|
||||
jmp b1
|
||||
//SEG23 bool_const_inline::@1
|
||||
@ -495,6 +499,7 @@ bool_const_inline: {
|
||||
rts
|
||||
}
|
||||
//SEG27 bool_const_vars
|
||||
// A bunch of constant boolean vars (used in an if)
|
||||
bool_const_vars: {
|
||||
jmp b3
|
||||
//SEG28 bool_const_vars::@3
|
||||
@ -509,6 +514,7 @@ bool_const_vars: {
|
||||
rts
|
||||
}
|
||||
//SEG32 bool_const_if
|
||||
// A constant boolean inside an if()
|
||||
bool_const_if: {
|
||||
jmp b1
|
||||
//SEG33 bool_const_if::@1
|
||||
@ -627,6 +633,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG22 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
|
||||
@ -637,6 +644,7 @@ bool_const_inline: {
|
||||
rts
|
||||
}
|
||||
//SEG27 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
|
||||
@ -647,6 +655,7 @@ bool_const_vars: {
|
||||
rts
|
||||
}
|
||||
//SEG32 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
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// Test a function taking boolean parameter and returning boolean result
|
||||
main: {
|
||||
.label screen = $400
|
||||
ldx #0
|
||||
@ -28,6 +29,8 @@ main: {
|
||||
sta screen,x
|
||||
jmp b3
|
||||
}
|
||||
// Determine whether to set a char to '*.
|
||||
// Returns true if i&8!=0 or b=true
|
||||
isSet: {
|
||||
.label b = 2
|
||||
txa
|
||||
|
@ -277,6 +277,7 @@ bend_from_b2:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Test a function taking boolean parameter and returning boolean result
|
||||
main: {
|
||||
.label screen = $400
|
||||
.label _0 = 3
|
||||
@ -354,6 +355,8 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG32 isSet
|
||||
// Determine whether to set a char to '*.
|
||||
// Returns true if i&8!=0 or b=true
|
||||
isSet: {
|
||||
.label _0 = 8
|
||||
.label _1 = 9
|
||||
@ -444,6 +447,7 @@ bend_from_b2:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Test a function taking boolean parameter and returning boolean result
|
||||
main: {
|
||||
.label screen = $400
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
@ -468,16 +472,13 @@ main: {
|
||||
eor #1
|
||||
sta isSet.b
|
||||
//SEG17 [8] (byte) isSet::i#0 ← (byte) main::i#2
|
||||
// (byte) isSet::i#0 = (byte) main::i#2 // register copy reg byte x
|
||||
//SEG18 [9] call isSet
|
||||
jsr isSet
|
||||
//SEG19 [10] (bool) isSet::return#0 ← (bool) isSet::return#1
|
||||
// (bool) isSet::return#0 = (bool) isSet::return#1 // register copy reg byte a
|
||||
jmp b7
|
||||
//SEG20 main::@7
|
||||
b7:
|
||||
//SEG21 [11] (bool~) main::$2 ← (bool) isSet::return#0
|
||||
// (bool~) main::$2 = (bool) isSet::return#0 // register copy reg byte a
|
||||
//SEG22 [12] if((bool~) main::$2) goto main::@2 -- vboaa_then_la1
|
||||
cmp #0
|
||||
bne b2
|
||||
@ -508,6 +509,8 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG32 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
|
||||
@ -616,6 +619,7 @@ Score: 540
|
||||
//SEG7 [3] phi from @2 to @end [phi:@2->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
// Test a function taking boolean parameter and returning boolean result
|
||||
main: {
|
||||
.label screen = $400
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
@ -636,14 +640,11 @@ main: {
|
||||
eor #1
|
||||
sta isSet.b
|
||||
//SEG17 [8] (byte) isSet::i#0 ← (byte) main::i#2
|
||||
// (byte) isSet::i#0 = (byte) main::i#2 // register copy reg byte x
|
||||
//SEG18 [9] call isSet
|
||||
jsr isSet
|
||||
//SEG19 [10] (bool) isSet::return#0 ← (bool) isSet::return#1
|
||||
// (bool) isSet::return#0 = (bool) isSet::return#1 // register copy reg byte a
|
||||
//SEG20 main::@7
|
||||
//SEG21 [11] (bool~) main::$2 ← (bool) isSet::return#0
|
||||
// (bool~) main::$2 = (bool) isSet::return#0 // register copy reg byte a
|
||||
//SEG22 [12] if((bool~) main::$2) goto main::@2 -- vboaa_then_la1
|
||||
cmp #0
|
||||
bne b2
|
||||
@ -669,6 +670,8 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG32 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
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// A test of boolean conditions using && || and !
|
||||
main: {
|
||||
jsr bool_and
|
||||
jsr bool_or
|
||||
|
@ -575,6 +575,7 @@ bend_from_b5:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// A test of boolean conditions using && || and !
|
||||
main: {
|
||||
//SEG10 [5] call bool_and
|
||||
//SEG11 [46] phi from main to bool_and [phi:main->bool_and]
|
||||
@ -957,6 +958,7 @@ bend_from_b5:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// A test of boolean conditions using && || and !
|
||||
main: {
|
||||
//SEG10 [5] call bool_and
|
||||
//SEG11 [46] phi from main to bool_and [phi:main->bool_and]
|
||||
@ -1390,6 +1392,7 @@ Score: 1804
|
||||
//SEG7 [3] phi from @5 to @end [phi:@5->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
// A test of boolean conditions using && || and !
|
||||
main: {
|
||||
//SEG10 [5] call bool_and
|
||||
//SEG11 [46] phi from main to bool_and [phi:main->bool_and]
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// Tests a pointer to a boolean
|
||||
main: {
|
||||
lda #1
|
||||
sta $400
|
||||
|
@ -134,6 +134,7 @@ bend_from_b1:
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
// Tests a pointer to a boolean
|
||||
main: {
|
||||
//SEG9 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
|
||||
lda #1
|
||||
@ -196,6 +197,7 @@ bend_from_b1:
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
// Tests a pointer to a boolean
|
||||
main: {
|
||||
//SEG9 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
|
||||
lda #1
|
||||
@ -268,6 +270,7 @@ Score: 37
|
||||
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG7 @end
|
||||
//SEG8 main
|
||||
// Tests a pointer to a boolean
|
||||
main: {
|
||||
//SEG9 [4] *(((bool*))(word/signed word/dword/signed dword) 1024) ← true -- _deref_pboc1=vboc2
|
||||
lda #1
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// A test of boolean conditions using && || and !
|
||||
main: {
|
||||
jsr bool_and
|
||||
jsr bool_or
|
||||
|
@ -640,6 +640,7 @@ bend_from_b5:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// A test of boolean conditions using && || and !
|
||||
main: {
|
||||
//SEG10 [5] call bool_and
|
||||
//SEG11 [47] phi from main to bool_and [phi:main->bool_and]
|
||||
@ -1048,6 +1049,7 @@ bend_from_b5:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// A test of boolean conditions using && || and !
|
||||
main: {
|
||||
//SEG10 [5] call bool_and
|
||||
//SEG11 [47] phi from main to bool_and [phi:main->bool_and]
|
||||
@ -1512,6 +1514,7 @@ Score: 2089
|
||||
//SEG7 [3] phi from @5 to @end [phi:@5->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
// A test of boolean conditions using && || and !
|
||||
main: {
|
||||
//SEG10 [5] call bool_and
|
||||
//SEG11 [47] phi from main to bool_and [phi:main->bool_and]
|
||||
|
@ -183,11 +183,13 @@ main: {
|
||||
bne b8
|
||||
jmp b3
|
||||
}
|
||||
// Initialize the different graphics in the memory
|
||||
gfx_init: {
|
||||
jsr gfx_init_screen0
|
||||
jsr gfx_init_plane_charset8
|
||||
rts
|
||||
}
|
||||
// Initialize Plane with 8bpp charset
|
||||
gfx_init_plane_charset8: {
|
||||
.const gfxbCpuBank = $ff&CHARSET8/$4000
|
||||
.label bits = 6
|
||||
@ -258,6 +260,9 @@ gfx_init_plane_charset8: {
|
||||
jsr dtvSetCpuBankSegment1
|
||||
rts
|
||||
}
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
sta cpuBank
|
||||
@ -266,6 +271,7 @@ dtvSetCpuBankSegment1: {
|
||||
.byte $32, $00
|
||||
rts
|
||||
}
|
||||
// Initialize VIC screen 0 ( value is %yyyyxxxx where yyyy is ypos and xxxx is xpos)
|
||||
gfx_init_screen0: {
|
||||
.label _1 = 5
|
||||
.label ch = 3
|
||||
|
@ -2199,6 +2199,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG59 gfx_init
|
||||
// Initialize the different graphics in the memory
|
||||
gfx_init: {
|
||||
//SEG60 [45] call gfx_init_screen0
|
||||
//SEG61 [78] phi from gfx_init to gfx_init_screen0 [phi:gfx_init->gfx_init_screen0]
|
||||
@ -2220,6 +2221,7 @@ gfx_init: {
|
||||
rts
|
||||
}
|
||||
//SEG68 gfx_init_plane_charset8
|
||||
// Initialize Plane with 8bpp charset
|
||||
gfx_init_plane_charset8: {
|
||||
.const gfxbCpuBank = $ff&CHARSET8/$4000
|
||||
.label _7 = $16
|
||||
@ -2400,6 +2402,9 @@ gfx_init_plane_charset8: {
|
||||
rts
|
||||
}
|
||||
//SEG137 dtvSetCpuBankSegment1
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
.label cpuBankIdx = $d
|
||||
@ -2417,6 +2422,7 @@ dtvSetCpuBankSegment1: {
|
||||
rts
|
||||
}
|
||||
//SEG142 gfx_init_screen0
|
||||
// Initialize VIC screen 0 ( value is %yyyyxxxx where yyyy is ypos and xxxx is xpos)
|
||||
gfx_init_screen0: {
|
||||
.label _0 = $17
|
||||
.label _1 = $18
|
||||
@ -2934,6 +2940,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG59 gfx_init
|
||||
// Initialize the different graphics in the memory
|
||||
gfx_init: {
|
||||
//SEG60 [45] call gfx_init_screen0
|
||||
//SEG61 [78] phi from gfx_init to gfx_init_screen0 [phi:gfx_init->gfx_init_screen0]
|
||||
@ -2955,6 +2962,7 @@ gfx_init: {
|
||||
rts
|
||||
}
|
||||
//SEG68 gfx_init_plane_charset8
|
||||
// Initialize Plane with 8bpp charset
|
||||
gfx_init_plane_charset8: {
|
||||
.const gfxbCpuBank = $ff&CHARSET8/$4000
|
||||
.label bits = 6
|
||||
@ -3123,6 +3131,9 @@ gfx_init_plane_charset8: {
|
||||
rts
|
||||
}
|
||||
//SEG137 dtvSetCpuBankSegment1
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
//SEG138 [75] *((const byte*) dtvSetCpuBankSegment1::cpuBank#0) ← (byte) dtvSetCpuBankSegment1::cpuBankIdx#2 -- _deref_pbuc1=vbuaa
|
||||
@ -3138,6 +3149,7 @@ dtvSetCpuBankSegment1: {
|
||||
rts
|
||||
}
|
||||
//SEG142 gfx_init_screen0
|
||||
// Initialize VIC screen 0 ( value is %yyyyxxxx where yyyy is ypos and xxxx is xpos)
|
||||
gfx_init_screen0: {
|
||||
.label _1 = 5
|
||||
.label ch = 3
|
||||
@ -3885,6 +3897,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG59 gfx_init
|
||||
// Initialize the different graphics in the memory
|
||||
gfx_init: {
|
||||
//SEG60 [45] call gfx_init_screen0
|
||||
//SEG61 [78] phi from gfx_init to gfx_init_screen0 [phi:gfx_init->gfx_init_screen0]
|
||||
@ -3899,6 +3912,7 @@ gfx_init: {
|
||||
rts
|
||||
}
|
||||
//SEG68 gfx_init_plane_charset8
|
||||
// Initialize Plane with 8bpp charset
|
||||
gfx_init_plane_charset8: {
|
||||
.const gfxbCpuBank = $ff&CHARSET8/$4000
|
||||
.label bits = 6
|
||||
@ -4038,6 +4052,9 @@ gfx_init_plane_charset8: {
|
||||
rts
|
||||
}
|
||||
//SEG137 dtvSetCpuBankSegment1
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
//SEG138 [75] *((const byte*) dtvSetCpuBankSegment1::cpuBank#0) ← (byte) dtvSetCpuBankSegment1::cpuBankIdx#2 -- _deref_pbuc1=vbuaa
|
||||
@ -4051,6 +4068,7 @@ dtvSetCpuBankSegment1: {
|
||||
rts
|
||||
}
|
||||
//SEG142 gfx_init_screen0
|
||||
// Initialize VIC screen 0 ( value is %yyyyxxxx where yyyy is ypos and xxxx is xpos)
|
||||
gfx_init_screen0: {
|
||||
.label _1 = 5
|
||||
.label ch = 3
|
||||
|
@ -166,6 +166,7 @@ main: {
|
||||
bne b8
|
||||
jmp b3
|
||||
}
|
||||
// Initialize Plane with 8bpp chunky
|
||||
gfx_init_chunky: {
|
||||
.label _6 = 7
|
||||
.label gfxb = 5
|
||||
@ -231,6 +232,9 @@ gfx_init_chunky: {
|
||||
jsr dtvSetCpuBankSegment1
|
||||
rts
|
||||
}
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
sta cpuBank
|
||||
|
@ -1824,6 +1824,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG53 gfx_init_chunky
|
||||
// Initialize Plane with 8bpp chunky
|
||||
gfx_init_chunky: {
|
||||
.label _6 = $e
|
||||
.label c = $10
|
||||
@ -1977,6 +1978,9 @@ gfx_init_chunky: {
|
||||
rts
|
||||
}
|
||||
//SEG106 dtvSetCpuBankSegment1
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
.label cpuBankIdx = 9
|
||||
@ -2333,6 +2337,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG53 gfx_init_chunky
|
||||
// Initialize Plane with 8bpp chunky
|
||||
gfx_init_chunky: {
|
||||
.label _6 = 7
|
||||
.label gfxb = 5
|
||||
@ -2478,6 +2483,9 @@ gfx_init_chunky: {
|
||||
rts
|
||||
}
|
||||
//SEG106 dtvSetCpuBankSegment1
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
//SEG107 [59] *((const byte*) dtvSetCpuBankSegment1::cpuBank#0) ← (byte) dtvSetCpuBankSegment1::cpuBankIdx#3 -- _deref_pbuc1=vbuaa
|
||||
@ -3060,6 +3068,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG53 gfx_init_chunky
|
||||
// Initialize Plane with 8bpp chunky
|
||||
gfx_init_chunky: {
|
||||
.label _6 = 7
|
||||
.label gfxb = 5
|
||||
@ -3178,6 +3187,9 @@ gfx_init_chunky: {
|
||||
rts
|
||||
}
|
||||
//SEG106 dtvSetCpuBankSegment1
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
//SEG107 [59] *((const byte*) dtvSetCpuBankSegment1::cpuBank#0) ← (byte) dtvSetCpuBankSegment1::cpuBankIdx#3 -- _deref_pbuc1=vbuaa
|
||||
|
@ -147,6 +147,7 @@ main: {
|
||||
jsr gfx_mode
|
||||
jmp b2
|
||||
}
|
||||
// Change graphics mode to show the selected graphics mode
|
||||
gfx_mode: {
|
||||
.label _31 = $a
|
||||
.label _33 = 3
|
||||
@ -469,6 +470,9 @@ gfx_mode: {
|
||||
bne b15
|
||||
jmp b19
|
||||
}
|
||||
// Get the next event from the keyboard event buffer.
|
||||
// Returns $ff if there is no event waiting. As all events are <$7f it is enough to examine bit 7 when determining if there is any event to process.
|
||||
// The buffer is filled by keyboard_event_scan()
|
||||
keyboard_event_get: {
|
||||
lda keyboard_events_size
|
||||
cmp #0
|
||||
@ -482,6 +486,10 @@ keyboard_event_get: {
|
||||
breturn:
|
||||
rts
|
||||
}
|
||||
// Scans the entire matrix to determine which keys have been pressed/depressed.
|
||||
// Generates keyboard events into the event buffer. Events can be read using keyboard_event_get().
|
||||
// Handles debounce and only generates events when the status of a key changes.
|
||||
// Also stores current status of modifiers in keyboard_modifiers.
|
||||
keyboard_event_scan: {
|
||||
.label row_scan = $12
|
||||
.label keycode = 8
|
||||
@ -586,6 +594,8 @@ keyboard_event_scan: {
|
||||
inc keyboard_events_size
|
||||
jmp b5
|
||||
}
|
||||
// Determine if a specific key is currently pressed based on the last keyboard_event_scan()
|
||||
// Returns 0 is not pressed and non-0 if pressed
|
||||
keyboard_event_pressed: {
|
||||
.label row_bits = 8
|
||||
.label keycode = 7
|
||||
@ -603,6 +613,11 @@ keyboard_event_pressed: {
|
||||
and row_bits
|
||||
rts
|
||||
}
|
||||
// Read a single row of the keyboard matrix
|
||||
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
|
||||
// Returns the keys pressed on the row as bits according to the C64 key matrix.
|
||||
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
|
||||
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
|
||||
keyboard_matrix_read: {
|
||||
tay
|
||||
lda keyboard_matrix_row_bitmask,y
|
||||
@ -611,6 +626,7 @@ keyboard_matrix_read: {
|
||||
eor #$ff
|
||||
rts
|
||||
}
|
||||
// Get the VIC screen address from the screen index
|
||||
get_vic_screen: {
|
||||
.label return = 3
|
||||
cmp #0
|
||||
@ -654,6 +670,7 @@ get_vic_screen: {
|
||||
breturn:
|
||||
rts
|
||||
}
|
||||
// Get the VIC charset/bitmap address from the index
|
||||
get_vic_charset: {
|
||||
.label return = 3
|
||||
cmp #0
|
||||
@ -673,6 +690,7 @@ get_vic_charset: {
|
||||
breturn:
|
||||
rts
|
||||
}
|
||||
// Get plane address from a plane index (from the form)
|
||||
get_plane: {
|
||||
.label return = $a
|
||||
cmp #0
|
||||
@ -866,6 +884,7 @@ get_plane: {
|
||||
breturn:
|
||||
rts
|
||||
}
|
||||
// Show the form - and let the user change values
|
||||
form_mode: {
|
||||
.label preset_current = $f
|
||||
lda #<COLS
|
||||
@ -951,6 +970,8 @@ form_mode: {
|
||||
jsr render_preset_name
|
||||
jmp b5
|
||||
}
|
||||
// Render form preset name in the form
|
||||
// idx is the ID of the preset
|
||||
render_preset_name: {
|
||||
.label name = 3
|
||||
cmp #0
|
||||
@ -1061,6 +1082,7 @@ render_preset_name: {
|
||||
name_10: .text "8bpp Pixel Cell @"
|
||||
name_11: .text "Standard Charset @"
|
||||
}
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = 5
|
||||
.label str = 3
|
||||
@ -1088,6 +1110,7 @@ print_str_at: {
|
||||
!:
|
||||
jmp b1
|
||||
}
|
||||
// Render all form values from the form_fields_val array
|
||||
form_render_values: {
|
||||
.label field = 3
|
||||
.label idx = 2
|
||||
@ -1107,6 +1130,8 @@ form_render_values: {
|
||||
bcc b1
|
||||
rts
|
||||
}
|
||||
// Get the screen address of a form field
|
||||
// field_idx is the index of the field to get the screen address for
|
||||
form_field_ptr: {
|
||||
.label return = 3
|
||||
.label field_idx = 2
|
||||
@ -1128,6 +1153,8 @@ form_field_ptr: {
|
||||
sta return+1
|
||||
rts
|
||||
}
|
||||
// Apply a form value preset to the form values
|
||||
// idx is the ID of the preset
|
||||
apply_preset: {
|
||||
.label preset = 3
|
||||
cmp #0
|
||||
@ -1227,6 +1254,8 @@ apply_preset: {
|
||||
bne b23
|
||||
rts
|
||||
}
|
||||
// Reads keyboard and allows the user to navigate and change the fields of the form
|
||||
// Returns 0 if space is not pressed, non-0 if space is pressed
|
||||
form_control: {
|
||||
.label field = 3
|
||||
stx form_field_ptr.field_idx
|
||||
@ -1325,6 +1354,8 @@ form_control: {
|
||||
sta (field),y
|
||||
jmp b3
|
||||
}
|
||||
// Set the screen to use for the form.
|
||||
// screen is the start address of the screen to use
|
||||
form_set_screen: {
|
||||
.label line = 3
|
||||
ldy #0
|
||||
@ -1349,6 +1380,8 @@ form_set_screen: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Print a number of zero-terminated strings, each followed by a newline.
|
||||
// The sequence of lines is terminated by another zero.
|
||||
print_str_lines: {
|
||||
.label str = 3
|
||||
lda print_set_screen.screen
|
||||
@ -1386,6 +1419,7 @@ print_str_lines: {
|
||||
sta print_char_cursor+1
|
||||
jmp b1
|
||||
}
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
b1:
|
||||
lda print_line_cursor
|
||||
@ -1405,6 +1439,7 @@ print_ln: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label _0 = 5
|
||||
.label sc = 3
|
||||
@ -1435,10 +1470,12 @@ print_cls: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Set the screen to print on. Also resets current line/char cursor.
|
||||
print_set_screen: {
|
||||
.label screen = $10
|
||||
rts
|
||||
}
|
||||
// Initialize the different graphics in the memory
|
||||
gfx_init: {
|
||||
jsr gfx_init_screen0
|
||||
jsr gfx_init_screen1
|
||||
@ -1457,6 +1494,7 @@ gfx_init: {
|
||||
jsr gfx_init_plane_full
|
||||
rts
|
||||
}
|
||||
// Initialize Plane with all pixels
|
||||
gfx_init_plane_full: {
|
||||
lda #$ff
|
||||
sta gfx_init_plane_fill.fill
|
||||
@ -1471,6 +1509,7 @@ gfx_init_plane_full: {
|
||||
jsr gfx_init_plane_fill
|
||||
rts
|
||||
}
|
||||
// Initialize 320*200 1bpp pixel ($2000) plane with identical bytes
|
||||
gfx_init_plane_fill: {
|
||||
.label _0 = $13
|
||||
.label _1 = 3
|
||||
@ -1546,6 +1585,9 @@ gfx_init_plane_fill: {
|
||||
jsr dtvSetCpuBankSegment1
|
||||
rts
|
||||
}
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
sta cpuBank
|
||||
@ -1554,6 +1596,7 @@ dtvSetCpuBankSegment1: {
|
||||
.byte $32, $00
|
||||
rts
|
||||
}
|
||||
// Initialize Plane with blank pixels
|
||||
gfx_init_plane_blank: {
|
||||
lda #0
|
||||
sta gfx_init_plane_fill.fill
|
||||
@ -1568,6 +1611,7 @@ gfx_init_plane_blank: {
|
||||
jsr gfx_init_plane_fill
|
||||
rts
|
||||
}
|
||||
// Initialize Plane with Vertical Stripes every 2 pixels
|
||||
gfx_init_plane_vertical2: {
|
||||
lda #$1b
|
||||
sta gfx_init_plane_fill.fill
|
||||
@ -1582,6 +1626,7 @@ gfx_init_plane_vertical2: {
|
||||
jsr gfx_init_plane_fill
|
||||
rts
|
||||
}
|
||||
// Initialize Plane with Horizontal Stripes every 2 pixels
|
||||
gfx_init_plane_horisontal2: {
|
||||
.const gfxbCpuBank = PLANE_HORISONTAL2/$4000
|
||||
.label gfxa = 3
|
||||
@ -1620,6 +1665,7 @@ gfx_init_plane_horisontal2: {
|
||||
rts
|
||||
row_bitmask: .byte 0, $55, $aa, $ff
|
||||
}
|
||||
// Initialize Plane with Vertical Stripes
|
||||
gfx_init_plane_vertical: {
|
||||
.const gfxbCpuBank = PLANE_VERTICAL/$4000
|
||||
.label gfxb = 3
|
||||
@ -1653,6 +1699,7 @@ gfx_init_plane_vertical: {
|
||||
jsr dtvSetCpuBankSegment1
|
||||
rts
|
||||
}
|
||||
// Initialize Plane with Horizontal Stripes
|
||||
gfx_init_plane_horisontal: {
|
||||
.const gfxbCpuBank = PLANE_HORISONTAL/$4000
|
||||
.label gfxa = 3
|
||||
@ -1700,6 +1747,7 @@ gfx_init_plane_horisontal: {
|
||||
!:
|
||||
jmp b4
|
||||
}
|
||||
// Initialize Plane with 8bpp charset
|
||||
gfx_init_plane_charset8: {
|
||||
.const gfxbCpuBank = PLANE_CHARSET8/$4000
|
||||
.label bits = 8
|
||||
@ -1770,6 +1818,7 @@ gfx_init_plane_charset8: {
|
||||
jsr dtvSetCpuBankSegment1
|
||||
rts
|
||||
}
|
||||
// Initialize 8BPP Chunky Bitmap (contains 8bpp pixels)
|
||||
gfx_init_plane_8bppchunky: {
|
||||
.label _6 = $10
|
||||
.label gfxb = 5
|
||||
@ -1835,6 +1884,7 @@ gfx_init_plane_8bppchunky: {
|
||||
jsr dtvSetCpuBankSegment1
|
||||
rts
|
||||
}
|
||||
// Initialize VIC bitmap
|
||||
gfx_init_vic_bitmap: {
|
||||
.const lines_cnt = 9
|
||||
.label l = 2
|
||||
@ -1861,6 +1911,7 @@ gfx_init_vic_bitmap: {
|
||||
lines_x: .byte 0, $ff, $ff, 0, 0, $80, $ff, $80, 0, $80
|
||||
lines_y: .byte 0, 0, $c7, $c7, 0, 0, $64, $c7, $64, 0
|
||||
}
|
||||
// Draw a line on the bitmap
|
||||
bitmap_line: {
|
||||
.label xd = 8
|
||||
.label yd = 7
|
||||
@ -2123,6 +2174,7 @@ bitmap_line_ydxd: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = 3
|
||||
.label y = 2
|
||||
@ -2152,6 +2204,7 @@ bitmap_clear: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize the bitmap plotter tables for a specific bitmap
|
||||
bitmap_init: {
|
||||
.label _6 = 2
|
||||
.label yoffs = 3
|
||||
@ -2246,6 +2299,7 @@ gfx_init_charset: {
|
||||
sta PROCPORT
|
||||
rts
|
||||
}
|
||||
// Initialize VIC screen 4 - all chars are 00
|
||||
gfx_init_screen4: {
|
||||
.label ch = 3
|
||||
.label cy = 2
|
||||
@ -2274,6 +2328,7 @@ gfx_init_screen4: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize VIC screen 3 ( value is %00xx00yy where xx is xpos and yy is ypos
|
||||
gfx_init_screen3: {
|
||||
.label _1 = 7
|
||||
.label ch = 3
|
||||
@ -2312,6 +2367,7 @@ gfx_init_screen3: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize VIC screen 2 ( value is %ccccrrrr where cccc is (x+y mod $f) and rrrr is %1111-%cccc)
|
||||
gfx_init_screen2: {
|
||||
.label col2 = 7
|
||||
.label ch = 3
|
||||
@ -2356,6 +2412,7 @@ gfx_init_screen2: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize VIC screen 1 ( value is %0000cccc where cccc is (x+y mod $f))
|
||||
gfx_init_screen1: {
|
||||
.label ch = 3
|
||||
.label cy = 2
|
||||
@ -2387,6 +2444,7 @@ gfx_init_screen1: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize VIC screen 0 ( value is %yyyyxxxx where yyyy is ypos and xxxx is xpos)
|
||||
gfx_init_screen0: {
|
||||
.label _1 = 7
|
||||
.label ch = 3
|
||||
@ -2425,6 +2483,7 @@ gfx_init_screen0: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize keyboard reading by setting CIA#$ Data Direction Registers
|
||||
keyboard_init: {
|
||||
lda #$ff
|
||||
sta CIA1_PORT_A_DDR
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -230,6 +230,12 @@ menu: {
|
||||
jsr mode_8bppchunkybmm
|
||||
jmp breturn
|
||||
}
|
||||
// Chunky 8bpp Bitmap Mode (BMM = 0, ECM/MCM/HICOL/LINEAR/CHUNK/COLDIS = 1)
|
||||
// Resolution: 320x200
|
||||
// Linear Adressing
|
||||
// CharData/PlaneB Pixel Shifter (8):
|
||||
// - 8bpp color PlaneB[7:0]
|
||||
// To set up a linear video frame buffer the step size must be set to 8.
|
||||
mode_8bppchunkybmm: {
|
||||
.const PLANEB = $20000
|
||||
.label _23 = $d
|
||||
@ -324,6 +330,7 @@ mode_8bppchunkybmm: {
|
||||
jsr mode_ctrl
|
||||
rts
|
||||
}
|
||||
// Allow the user to control the DTV graphics using different keys
|
||||
mode_ctrl: {
|
||||
b4:
|
||||
lda RASTER
|
||||
@ -397,6 +404,10 @@ mode_ctrl: {
|
||||
stx BORDERCOL
|
||||
jmp b4
|
||||
}
|
||||
// Determines whether a specific key is currently pressed by accessing the matrix directly
|
||||
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
|
||||
// All keys exist as as KEY_XXX constants.
|
||||
// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed
|
||||
keyboard_key_pressed: {
|
||||
.label colidx = 7
|
||||
tya
|
||||
@ -412,6 +423,11 @@ keyboard_key_pressed: {
|
||||
and keyboard_matrix_col_bitmask,y
|
||||
rts
|
||||
}
|
||||
// Read a single row of the keyboard matrix
|
||||
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
|
||||
// Returns the keys pressed on the row as bits according to the C64 key matrix.
|
||||
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
|
||||
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
|
||||
keyboard_matrix_read: {
|
||||
lda keyboard_matrix_row_bitmask,y
|
||||
sta CIA1_PORT_A
|
||||
@ -419,6 +435,9 @@ keyboard_matrix_read: {
|
||||
eor #$ff
|
||||
rts
|
||||
}
|
||||
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
||||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
dtvSetCpuBankSegment1: {
|
||||
.label cpuBank = $ff
|
||||
sta cpuBank
|
||||
@ -427,6 +446,15 @@ dtvSetCpuBankSegment1: {
|
||||
.byte $32, $00
|
||||
rts
|
||||
}
|
||||
// 8bpp Pixel Cell Mode (BMM/COLDIS = 0, ECM/MCM/HICOL/LINEAR/CHUNK = 1)
|
||||
// Pixel Cell Adressing
|
||||
// CharData[8]: (PlaneA[21:0])
|
||||
// GfxData[8]: (PlaneB[21:14] & CharData[7:0] & RowCounter[3:0] & PixelCounter[7:0] )
|
||||
// GfxData Pixel Shifter (8):
|
||||
// - 8bpp color GfxData[7:0]
|
||||
// Pixel cell mode can be thought of as a text mode that uses a 8x8 pixel 8bpp font (64 bytes/char).
|
||||
// The characters come from counter A and the font (or "cells") from counter B.
|
||||
// Counter B step and modulo should be set to 0, counter A modulo to 0 and counter A step to 1 for normal operation.
|
||||
mode_8bpppixelcell: {
|
||||
.label PLANEA = $3c00
|
||||
.label PLANEB = $4000
|
||||
@ -566,6 +594,12 @@ mode_8bpppixelcell: {
|
||||
jsr mode_ctrl
|
||||
rts
|
||||
}
|
||||
// Sixs Fred Mode - 8bpp Packed Bitmap - Generated from the two DTV linear graphics plane counters
|
||||
// Two Plane MultiColor Bitmap - 8bpp Packed Bitmap (CHUNK/COLDIS = 0, ECM/BMM/MCM/HICOL/LINEAR = 1)
|
||||
// Resolution: 160x200
|
||||
// Linear Adressing
|
||||
// GfxData/PlaneA Pixel Shifter (2), CharData/PlaneB Pixel Shifter (2):
|
||||
// - 8bpp color (ColorData[3:0],CharData/PlaneB[1:0], GfxData/PlaneA[1:0])
|
||||
mode_sixsfred: {
|
||||
.label PLANEA = $4000
|
||||
.label PLANEB = $6000
|
||||
@ -699,6 +733,15 @@ mode_sixsfred: {
|
||||
rts
|
||||
row_bitmask: .byte 0, $55, $aa, $ff
|
||||
}
|
||||
// Two Plane Bitmap - generated from the two DTV linear graphics plane counters
|
||||
// Two Plane Bitmap Mode (CHUNK/COLDIS/MCM = 0, ECM/BMM/HICOL/LINEAR = 1)
|
||||
// Resolution: 320x200
|
||||
// Linear Adressing
|
||||
// GfxData/PlaneA Pixel Shifter (1), CharData/PlaneB Pixel Shifter (1):
|
||||
// - Plane A = 0 Plane B = 0: 8bpp BgColor0[7:0]
|
||||
// - Plane A = 0 Plane B = 1: 8bpp "0000" & ColorData[7:4]
|
||||
// - Plane A = 1 Plane B = 0: 8bpp "0000" & ColorData[3:0]
|
||||
// - Plane A = 1 Plane B = 1: 8bpp BgColor1[7:0]
|
||||
mode_twoplanebitmap: {
|
||||
.label PLANEA = $4000
|
||||
.label PLANEB = $6000
|
||||
@ -852,6 +895,12 @@ mode_twoplanebitmap: {
|
||||
!:
|
||||
jmp b7
|
||||
}
|
||||
// Sixs Fred Mode 2 - 8bpp Packed Bitmap - Generated from the two DTV linear graphics plane counters
|
||||
// Two Plane MultiColor Bitmap - 8bpp Packed Bitmap (CHUNK/COLDIS/HICOL = 0, ECM/BMM/MCM/LINEAR = 1)
|
||||
// Resolution: 160x200
|
||||
// Linear Adressing
|
||||
// PlaneA Pixel Shifter (2), PlaneB Pixel Shifter (2):
|
||||
// - 8bpp color (PlaneB[1:0],ColorData[5:4],PlaneA[1:0],ColorData[1:0])
|
||||
mode_sixsfred2: {
|
||||
.label PLANEA = $4000
|
||||
.label PLANEB = $6000
|
||||
@ -992,6 +1041,18 @@ mode_sixsfred2: {
|
||||
rts
|
||||
row_bitmask: .byte 0, $55, $aa, $ff
|
||||
}
|
||||
// High Color Multicolor Character Mode (LINEAR/CHUNK/COLDIS/BMM/ECM = 0, MCM/HICOL = 1)
|
||||
// Resolution: 160x200 (320x200)
|
||||
// Normal VIC Adressing:
|
||||
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
|
||||
// GfxData Pixel Shifter (1) if ColorData[3:3] = 0:
|
||||
// - 0: 8bpp BgColor0[7:0]
|
||||
// - 1: 8bpp ColorData[7:4] "0" & Color[2:0]
|
||||
// GfxData Pixel Shifter (2) if ColorData[3:3] = 1:
|
||||
// - 00: 8bpp BgColor0[7:0]
|
||||
// - 01: 8bpp BgColor1[7:0]
|
||||
// - 10: 8bpp BgColor2[7:0]
|
||||
// - 11: 8bpp ColorData[7:4] "0" & Color[2:0]
|
||||
mode_hicolmcchar: {
|
||||
.label SCREEN = $8000
|
||||
.label CHARSET = $9000
|
||||
@ -1080,6 +1141,17 @@ mode_hicolmcchar: {
|
||||
jsr mode_ctrl
|
||||
rts
|
||||
}
|
||||
// High Color Extended Background Color Character Mode (LINEAR/CHUNK/COLDIS/MCM/BMM = 0, ECM/HICOL = 1)
|
||||
// Resolution: 320x200
|
||||
// Normal VIC Adressing:
|
||||
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & "00" & CharData[5:0] & RowCounter[2:0] )
|
||||
// GfxData Pixel Shifter (1)
|
||||
// - 0: 8bpp Background Color
|
||||
// - CharData[7:6] 00: 8bpp BgColor0[7:0]
|
||||
// - CharData[7:6] 01: 8bpp BgColor1[7:0]
|
||||
// - CharData[7:6] 10: 8bpp BgColor2[7:0]
|
||||
// - CharData[7:6] 11: 8bpp BgColor3[7:0]
|
||||
// - 1: 8bpp ColorData[7:0]
|
||||
mode_hicolecmchar: {
|
||||
.label SCREEN = $8000
|
||||
.label CHARSET = $9000
|
||||
@ -1170,6 +1242,13 @@ mode_hicolecmchar: {
|
||||
jsr mode_ctrl
|
||||
rts
|
||||
}
|
||||
// High Color Standard Character Mode (LINEAR/CHUNK/COLDIS/ECM/MCM/BMM = 0, HICOL = 1)
|
||||
// Resolution: 320x200
|
||||
// Normal VIC Adressing:
|
||||
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
|
||||
// Pixel Shifter (1)
|
||||
// - 0: 8bpp BgColor0[7:0]
|
||||
// - 1: 8bpp ColorData[7:0]
|
||||
mode_hicolstdchar: {
|
||||
.label SCREEN = $8000
|
||||
.label CHARSET = $9000
|
||||
@ -1253,6 +1332,13 @@ mode_hicolstdchar: {
|
||||
jsr mode_ctrl
|
||||
rts
|
||||
}
|
||||
// Standard Bitmap Mode (LINEAR/HICOL/CHUNK/COLDIS/MCM/ECM = 0, BMM = 1)
|
||||
// Resolution: 320x200
|
||||
// Normal VIC Adressing:
|
||||
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:2] & Matrix[9:0] & RowCounter[2:0] )
|
||||
// Pixel Shifter (1)
|
||||
// - 0: 4bpp CharData[3:0]
|
||||
// - 1: 4bpp CharData[7:4]
|
||||
mode_stdbitmap: {
|
||||
.label SCREEN = $4000
|
||||
.label BITMAP = $6000
|
||||
@ -1349,6 +1435,7 @@ mode_stdbitmap: {
|
||||
lines_x: .byte 0, $ff, $ff, 0, 0, $80, $ff, $80, 0, $80
|
||||
lines_y: .byte 0, 0, $c7, $c7, 0, 0, $64, $c7, $64, 0
|
||||
}
|
||||
// Draw a line on the bitmap
|
||||
bitmap_line: {
|
||||
.label xd = 8
|
||||
.label yd = 7
|
||||
@ -1611,6 +1698,7 @@ bitmap_line_ydxd: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = 2
|
||||
.label y = 4
|
||||
@ -1640,6 +1728,7 @@ bitmap_clear: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize the bitmap plotter tables for a specific bitmap
|
||||
bitmap_init: {
|
||||
.label _6 = 4
|
||||
.label yoffs = 2
|
||||
@ -1693,6 +1782,18 @@ bitmap_init: {
|
||||
bne b3
|
||||
rts
|
||||
}
|
||||
// Multicolor Character Mode (LINEAR/HICOL/CHUNK/COLDIS/BMM/ECM = 0, MCM = 1)
|
||||
// Resolution: 160x200 (320x200)
|
||||
// Normal VIC Adressing:
|
||||
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
|
||||
// GfxData Pixel Shifter (1) if ColorData[3:3] = 0:
|
||||
// - 0: 4bpp BgColor0[3:0]
|
||||
// - 1: 4bpp ColorData[2:0]
|
||||
// GfxData Pixel Shifter (2) if ColorData[3:3] = 1:
|
||||
// - 00: 4bpp BgColor0[3:0]
|
||||
// - 01: 4bpp BgColor1[3:0]
|
||||
// - 10: 4bpp BgColor2[3:0]
|
||||
// - 11: 4bpp ColorData[2:0]// Standard Character Mode (LINEAR/HICOL/CHUNK/COLDIS/ECM/MCM/BMM = 0)
|
||||
mode_mcchar: {
|
||||
.label SCREEN = $8000
|
||||
.label CHARSET = $9000
|
||||
@ -1784,6 +1885,17 @@ mode_mcchar: {
|
||||
jsr mode_ctrl
|
||||
rts
|
||||
}
|
||||
// Extended Background Color Character Mode (LINEAR/HICOL/CHUNK/COLDIS/MCM/BMM = 0, ECM = 1)
|
||||
// Resolution: 320x200
|
||||
// Normal VIC Adressing:
|
||||
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & "00" & CharData[5:0] & RowCounter[2:0] )
|
||||
// GfxData Pixel Shifter (1)
|
||||
// - 0: 4bpp Background Color
|
||||
// - CharData[7:6] 00: 4bpp BgColor0[3:0]
|
||||
// - CharData[7:6] 01: 4bpp BgColor1[3:0]
|
||||
// - CharData[7:6] 10: 4bpp BgColor2[3:0]
|
||||
// - CharData[7:6] 11: 4bpp BgColor3[3:0]
|
||||
// - 1: 4bpp ColorData[3:0]
|
||||
mode_ecmchar: {
|
||||
.label SCREEN = $8000
|
||||
.label CHARSET = $9000
|
||||
@ -1876,6 +1988,13 @@ mode_ecmchar: {
|
||||
jsr mode_ctrl
|
||||
rts
|
||||
}
|
||||
// Standard Character Mode (LINEAR/HICOL/CHUNK/COLDIS/ECM/MCM/BMM = 0)
|
||||
// Resolution: 320x200
|
||||
// Normal VIC Adressing:
|
||||
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
|
||||
// Pixel Shifter (1)
|
||||
// - 0: 4bpp BgColor0[3:0]
|
||||
// - 1: 4bpp ColorData[3:0]
|
||||
mode_stdchar: {
|
||||
.label SCREEN = $8000
|
||||
.label CHARSET = $9000
|
||||
@ -1962,6 +2081,8 @@ mode_stdchar: {
|
||||
jsr mode_ctrl
|
||||
rts
|
||||
}
|
||||
// Print a number of zero-terminated strings, each followed by a newline.
|
||||
// The sequence of lines is terminated by another zero.
|
||||
print_str_lines: {
|
||||
.label str = 2
|
||||
lda #<menu.SCREEN
|
||||
@ -2007,6 +2128,7 @@ print_str_lines: {
|
||||
sta print_char_cursor+1
|
||||
jmp b1
|
||||
}
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
b1:
|
||||
lda print_line_cursor
|
||||
@ -2026,6 +2148,7 @@ print_ln: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
lda #<menu.SCREEN
|
||||
@ -2048,6 +2171,7 @@ print_cls: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Set the screen to print on. Also resets current line/char cursor.
|
||||
print_set_screen: {
|
||||
rts
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
.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
|
||||
|
@ -160,6 +160,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Example of NOP-casting a dereferenced signed byte to a byte
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label i = 2
|
||||
@ -229,6 +230,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Example of NOP-casting a dereferenced signed byte to a byte
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
@ -317,6 +319,7 @@ Score: 186
|
||||
//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
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
|
@ -1,6 +1,7 @@
|
||||
.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
|
||||
|
@ -189,6 +189,7 @@ bend_from_b1:
|
||||
//SEG7 @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
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.const min = $a
|
||||
@ -262,6 +263,7 @@ bend_from_b1:
|
||||
//SEG7 @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
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.const min = $a
|
||||
@ -361,6 +363,7 @@ Score: 43
|
||||
//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
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.const min = $a
|
||||
|
@ -1,6 +1,7 @@
|
||||
.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
|
||||
|
@ -268,6 +268,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Draws a chess board in the upper left corner of the screen
|
||||
main: {
|
||||
.label color = 8
|
||||
.label column = 7
|
||||
@ -424,6 +425,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Draws a chess board in the upper left corner of the screen
|
||||
main: {
|
||||
.label screen = 2
|
||||
.label colors = 4
|
||||
@ -601,6 +603,7 @@ Score: 3861
|
||||
//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
|
||||
main: {
|
||||
.label screen = 2
|
||||
.label colors = 4
|
||||
|
@ -135,6 +135,7 @@ loop: {
|
||||
inc sin_idx
|
||||
jmp b4
|
||||
}
|
||||
// Setup the IRQ
|
||||
sprites_irq_init: {
|
||||
sei
|
||||
lda #IRQ_RASTER
|
||||
@ -160,6 +161,7 @@ sprites_irq_init: {
|
||||
cli
|
||||
rts
|
||||
}
|
||||
// Setup the sprites
|
||||
sprites_init: {
|
||||
.label xpos = 2
|
||||
lda #$f
|
||||
@ -188,6 +190,9 @@ sprites_init: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Raster Interrupt Routine - sets up the sprites covering the playfield
|
||||
// Repeats 10 timers every 2 lines from line IRQ_RASTER_FIRST
|
||||
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
|
||||
sprites_irq: {
|
||||
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
|
||||
.label raster_sprite_gfx_modify = $a
|
||||
|
@ -2504,6 +2504,7 @@ loop: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG92 sprites_irq_init
|
||||
// Setup the IRQ
|
||||
sprites_irq_init: {
|
||||
//SEG93 asm { sei }
|
||||
sei
|
||||
@ -2545,6 +2546,7 @@ sprites_irq_init: {
|
||||
rts
|
||||
}
|
||||
//SEG106 sprites_init
|
||||
// Setup the sprites
|
||||
sprites_init: {
|
||||
.label s2 = $13
|
||||
.label xpos = 9
|
||||
@ -2607,6 +2609,9 @@ sprites_init: {
|
||||
rts
|
||||
}
|
||||
//SEG126 sprites_irq
|
||||
// Raster Interrupt Routine - sets up the sprites covering the playfield
|
||||
// Repeats 10 timers every 2 lines from line IRQ_RASTER_FIRST
|
||||
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
|
||||
sprites_irq: {
|
||||
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
|
||||
.label _0 = $15
|
||||
@ -3377,6 +3382,7 @@ loop: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG92 sprites_irq_init
|
||||
// Setup the IRQ
|
||||
sprites_irq_init: {
|
||||
//SEG93 asm { sei }
|
||||
sei
|
||||
@ -3418,6 +3424,7 @@ sprites_irq_init: {
|
||||
rts
|
||||
}
|
||||
//SEG106 sprites_init
|
||||
// Setup the sprites
|
||||
sprites_init: {
|
||||
.label xpos = 2
|
||||
//SEG107 [61] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2
|
||||
@ -3474,6 +3481,9 @@ sprites_init: {
|
||||
rts
|
||||
}
|
||||
//SEG126 sprites_irq
|
||||
// Raster Interrupt Routine - sets up the sprites covering the playfield
|
||||
// Repeats 10 timers every 2 lines from line IRQ_RASTER_FIRST
|
||||
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
|
||||
sprites_irq: {
|
||||
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
|
||||
.label raster_sprite_gfx_modify = $a
|
||||
@ -4333,6 +4343,7 @@ loop: {
|
||||
jmp b4
|
||||
}
|
||||
//SEG92 sprites_irq_init
|
||||
// Setup the IRQ
|
||||
sprites_irq_init: {
|
||||
//SEG93 asm { sei }
|
||||
sei
|
||||
@ -4372,6 +4383,7 @@ sprites_irq_init: {
|
||||
rts
|
||||
}
|
||||
//SEG106 sprites_init
|
||||
// Setup the sprites
|
||||
sprites_init: {
|
||||
.label xpos = 2
|
||||
//SEG107 [61] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2
|
||||
@ -4420,6 +4432,9 @@ sprites_init: {
|
||||
rts
|
||||
}
|
||||
//SEG126 sprites_irq
|
||||
// Raster Interrupt Routine - sets up the sprites covering the playfield
|
||||
// Repeats 10 timers every 2 lines from line IRQ_RASTER_FIRST
|
||||
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
|
||||
sprites_irq: {
|
||||
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
|
||||
.label raster_sprite_gfx_modify = $a
|
||||
|
@ -220,6 +220,7 @@ main: {
|
||||
jsr render_screen_swap
|
||||
jmp b4
|
||||
}
|
||||
// Swap rendering to the other screen (used for double buffering)
|
||||
render_screen_swap: {
|
||||
lda render_screen_render
|
||||
eor #$40
|
||||
@ -229,6 +230,7 @@ render_screen_swap: {
|
||||
sta render_screen_show
|
||||
rts
|
||||
}
|
||||
// Show the current score
|
||||
render_score: {
|
||||
.label score_bytes = score_bcd
|
||||
.const score_offset = $28*5+$1c
|
||||
@ -295,6 +297,11 @@ render_score: {
|
||||
jsr render_bcd
|
||||
rts
|
||||
}
|
||||
// Render BCD digits on a screen.
|
||||
// - screen: pointer to the screen to render on
|
||||
// - offset: offset on the screen
|
||||
// - bcd: The BCD-value to render
|
||||
// - only_low: if non-zero only renders the low digit
|
||||
render_bcd: {
|
||||
.const ZERO_CHAR = $35
|
||||
.label screen = 5
|
||||
@ -335,6 +342,7 @@ render_bcd: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Render the next tetromino in the "next" area
|
||||
render_next: {
|
||||
.const next_area_offset = $28*$c+$18+4
|
||||
.label next_piece_char = $a
|
||||
@ -405,6 +413,8 @@ render_next: {
|
||||
sta (screen_next_area),y
|
||||
jmp b6
|
||||
}
|
||||
// Render the current moving piece at position (current_xpos, current_ypos)
|
||||
// Ignores cases where parts of the tetromino is outside the playfield (sides/bottom) since the movement collision routine prevents this.
|
||||
render_moving: {
|
||||
.label ypos2 = $b
|
||||
.label screen_line = 7
|
||||
@ -468,6 +478,7 @@ render_moving: {
|
||||
bne b4
|
||||
jmp b3
|
||||
}
|
||||
// Render the static playfield on the screen (all pieces already locked into place)
|
||||
render_playfield: {
|
||||
.label screen_line = 5
|
||||
.label i = $a
|
||||
@ -510,6 +521,9 @@ render_playfield: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Perform any movement of the current piece
|
||||
// key_event is the next keyboard_event() og $ff if no keyboard event is pending
|
||||
// Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed)
|
||||
play_movement: {
|
||||
.label render = 9
|
||||
.label return = 9
|
||||
@ -538,6 +552,8 @@ play_movement: {
|
||||
sta return
|
||||
jmp breturn
|
||||
}
|
||||
// Rotate the current piece based on key-presses
|
||||
// Return non-zero if a render is needed
|
||||
play_move_rotate: {
|
||||
.label orientation = $a
|
||||
cmp #KEY_Z
|
||||
@ -585,6 +601,8 @@ play_move_rotate: {
|
||||
sta orientation
|
||||
jmp b4
|
||||
}
|
||||
// Test if there is a collision between the current piece moved to (x, y) and anything on the playfield or the playfield boundaries
|
||||
// Returns information about the type of the collision detected
|
||||
play_collision: {
|
||||
.label xpos = $c
|
||||
.label ypos = $b
|
||||
@ -676,6 +694,8 @@ play_collision: {
|
||||
sta i_13
|
||||
jmp b2
|
||||
}
|
||||
// Move left/right or rotate the current piece
|
||||
// Return non-zero if a render is needed
|
||||
play_move_leftright: {
|
||||
cmp #KEY_COMMA
|
||||
beq b1
|
||||
@ -719,6 +739,8 @@ play_move_leftright: {
|
||||
dec current_xpos
|
||||
jmp b2
|
||||
}
|
||||
// Move down the current piece
|
||||
// Return non-zero if a render is needed
|
||||
play_move_down: {
|
||||
inc current_movedown_counter
|
||||
cmp #KEY_SPACE
|
||||
@ -784,6 +806,8 @@ play_move_down: {
|
||||
inc current_ypos
|
||||
jmp b7
|
||||
}
|
||||
// Spawn a new piece
|
||||
// Moves the next piece into the current and spawns a new next piece
|
||||
play_spawn_current: {
|
||||
.label _0 = 4
|
||||
.label piece_idx = $21
|
||||
@ -830,10 +854,13 @@ play_spawn_current: {
|
||||
sta piece_idx
|
||||
jmp b2
|
||||
}
|
||||
// Get a random number from the SID voice 3,
|
||||
// Must be initialized with sid_rnd_init()
|
||||
sid_rnd: {
|
||||
lda SID_VOICE3_OSC
|
||||
rts
|
||||
}
|
||||
// Update the score based on the number of lines removed
|
||||
play_update_score: {
|
||||
.label lines_before = 4
|
||||
.label add_bcd = $2b
|
||||
@ -884,6 +911,7 @@ play_update_score: {
|
||||
breturn:
|
||||
rts
|
||||
}
|
||||
// Increase the level
|
||||
play_increase_level: {
|
||||
inc level
|
||||
lda level
|
||||
@ -935,6 +963,10 @@ play_increase_level: {
|
||||
cld
|
||||
rts
|
||||
}
|
||||
// Look through the playfield for lines - and remove any lines found
|
||||
// Utilizes two cursors on the playfield - one reading cells and one writing cells
|
||||
// Whenever a full line is detected the writing cursor is instructed to write to the same line once more.
|
||||
// Returns the number of lines removed
|
||||
play_remove_lines: {
|
||||
.label c = $c
|
||||
.label x = $a
|
||||
@ -990,6 +1022,7 @@ play_remove_lines: {
|
||||
dex
|
||||
jmp b5
|
||||
}
|
||||
// Lock the current piece onto the playfield
|
||||
play_lock_current: {
|
||||
.label ypos2 = $10
|
||||
.label playfield_line = 5
|
||||
@ -1047,6 +1080,8 @@ play_lock_current: {
|
||||
sta i_9
|
||||
jmp b2
|
||||
}
|
||||
// Determine if a specific key is currently pressed based on the last keyboard_event_scan()
|
||||
// Returns 0 is not pressed and non-0 if pressed
|
||||
keyboard_event_pressed: {
|
||||
.label row_bits = $a
|
||||
.label keycode = 9
|
||||
@ -1064,6 +1099,9 @@ keyboard_event_pressed: {
|
||||
and row_bits
|
||||
rts
|
||||
}
|
||||
// Get the next event from the keyboard event buffer.
|
||||
// Returns $ff if there is no event waiting. As all events are <$7f it is enough to examine bit 7 when determining if there is any event to process.
|
||||
// The buffer is filled by keyboard_event_scan()
|
||||
keyboard_event_get: {
|
||||
lda keyboard_events_size
|
||||
cmp #0
|
||||
@ -1078,6 +1116,10 @@ keyboard_event_get: {
|
||||
breturn:
|
||||
rts
|
||||
}
|
||||
// Scans the entire matrix to determine which keys have been pressed/depressed.
|
||||
// Generates keyboard events into the event buffer. Events can be read using keyboard_event_get().
|
||||
// Handles debounce and only generates events when the status of a key changes.
|
||||
// Also stores current status of modifiers in keyboard_modifiers.
|
||||
keyboard_event_scan: {
|
||||
.label row_scan = $b
|
||||
.label keycode = $a
|
||||
@ -1175,6 +1217,11 @@ keyboard_event_scan: {
|
||||
inc keyboard_events_size
|
||||
jmp b5
|
||||
}
|
||||
// Read a single row of the keyboard matrix
|
||||
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
|
||||
// Returns the keys pressed on the row as bits according to the C64 key matrix.
|
||||
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
|
||||
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
|
||||
keyboard_matrix_read: {
|
||||
lda keyboard_matrix_row_bitmask,x
|
||||
sta CIA1_PORT_A
|
||||
@ -1182,6 +1229,7 @@ keyboard_matrix_read: {
|
||||
eor #$ff
|
||||
rts
|
||||
}
|
||||
// Update $D018 to show the current screen (used for double buffering)
|
||||
render_show: {
|
||||
.const toD0181_return = (>(PLAYFIELD_SCREEN_1&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f
|
||||
.const toD0182_return = (>(PLAYFIELD_SCREEN_2&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f
|
||||
@ -1203,6 +1251,7 @@ render_show: {
|
||||
lda #toD0181_return
|
||||
jmp b2
|
||||
}
|
||||
// Initialize play data tables
|
||||
play_init: {
|
||||
.label pli = 5
|
||||
.label idx = 2
|
||||
@ -1260,6 +1309,7 @@ play_init: {
|
||||
bne b2
|
||||
rts
|
||||
}
|
||||
// Setup the IRQ
|
||||
sprites_irq_init: {
|
||||
sei
|
||||
lda #IRQ_RASTER
|
||||
@ -1285,6 +1335,7 @@ sprites_irq_init: {
|
||||
cli
|
||||
rts
|
||||
}
|
||||
// Setup the sprites
|
||||
sprites_init: {
|
||||
.label xpos = 2
|
||||
lda #$f
|
||||
@ -1313,6 +1364,7 @@ sprites_init: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize rendering
|
||||
render_init: {
|
||||
.const vicSelectGfxBank1_toDd001_return = 3^(>PLAYFIELD_CHARSET)>>6
|
||||
.label li_1 = 5
|
||||
@ -1385,6 +1437,8 @@ render_init: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Copy the original screen data to the passed screen
|
||||
// Also copies colors to $d800
|
||||
render_screen_original: {
|
||||
.const SPACE = 0
|
||||
.label screen = $11
|
||||
@ -1476,6 +1530,7 @@ render_screen_original: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize SID voice 3 for random number generation
|
||||
sid_rnd_init: {
|
||||
lda #<$ffff
|
||||
sta SID_VOICE3_FREQ
|
||||
@ -1485,6 +1540,9 @@ sid_rnd_init: {
|
||||
sta SID_VOICE3_CONTROL
|
||||
rts
|
||||
}
|
||||
// Raster Interrupt Routine - sets up the sprites covering the playfield
|
||||
// Repeats 10 timers every 2 lines from line IRQ_RASTER_FIRST
|
||||
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
|
||||
sprites_irq: {
|
||||
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
|
||||
.label raster_sprite_gfx_modify = $2f
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// Concatenate a char to a string
|
||||
main: {
|
||||
.label screen = $400
|
||||
ldx #0
|
||||
|
@ -151,6 +151,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Concatenate a char to a string
|
||||
main: {
|
||||
.label screen = $400
|
||||
.label i = 2
|
||||
@ -220,6 +221,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Concatenate a char to a string
|
||||
main: {
|
||||
.label screen = $400
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
@ -309,6 +311,7 @@ Score: 186
|
||||
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
// Concatenate a char to a string
|
||||
main: {
|
||||
.label screen = $400
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// Ensure that if()'s with constant comparisons are identified and eliminated
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
lda #'!'
|
||||
|
@ -115,6 +115,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Ensure that if()'s with constant comparisons are identified and eliminated
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
jmp b3
|
||||
@ -163,6 +164,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Ensure that if()'s with constant comparisons are identified and eliminated
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
jmp b3
|
||||
@ -227,6 +229,7 @@ Score: 12
|
||||
//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
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
//SEG10 main::@3
|
||||
|
@ -517,7 +517,6 @@ line: {
|
||||
//SEG28 line::@3
|
||||
b3:
|
||||
//SEG29 [14] (byte) plot::x#1 ← (byte) line::x#2
|
||||
// (byte) plot::x#1 = (byte) line::x#2 // register copy reg byte x
|
||||
//SEG30 [15] call plot
|
||||
jsr plot
|
||||
jmp b8
|
||||
@ -689,7 +688,6 @@ line: {
|
||||
//SEG28 line::@3
|
||||
b3:
|
||||
//SEG29 [14] (byte) plot::x#1 ← (byte) line::x#2
|
||||
// (byte) plot::x#1 = (byte) line::x#2 // register copy reg byte x
|
||||
//SEG30 [15] call plot
|
||||
jsr plot
|
||||
//SEG31 line::@8
|
||||
|
@ -1,6 +1,7 @@
|
||||
.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)
|
||||
|
@ -115,6 +115,7 @@ bend_from_b1:
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
// Test a constant with multiplication and division
|
||||
main: {
|
||||
.label screen = $400
|
||||
.const b = 6*$e/3+mod($16,3)
|
||||
@ -159,6 +160,7 @@ bend_from_b1:
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
// Test a constant with multiplication and division
|
||||
main: {
|
||||
.label screen = $400
|
||||
.const b = 6*$e/3+mod($16,3)
|
||||
@ -218,6 +220,7 @@ Score: 12
|
||||
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG7 @end
|
||||
//SEG8 main
|
||||
// Test a constant with multiplication and division
|
||||
main: {
|
||||
.label screen = $400
|
||||
.const b = 6*$e/3+mod($16,3)
|
||||
|
@ -1,6 +1,7 @@
|
||||
.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
|
||||
|
@ -264,6 +264,7 @@ bend_from_b2:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// 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
|
||||
@ -398,6 +399,7 @@ bend_from_b2:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// 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
|
||||
@ -408,12 +410,10 @@ main: {
|
||||
lda #'c'
|
||||
jsr sum
|
||||
//SEG13 [6] (byte) sum::return#0 ← (byte) sum::return#3
|
||||
// (byte) sum::return#0 = (byte) sum::return#3 // register copy reg byte a
|
||||
jmp b1
|
||||
//SEG14 main::@1
|
||||
b1:
|
||||
//SEG15 [7] (byte~) main::$0 ← (byte) sum::return#0
|
||||
// (byte~) main::$0 = (byte) sum::return#0 // register copy reg byte a
|
||||
//SEG16 [8] *((const byte*) main::screen#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa
|
||||
sta screen
|
||||
//SEG17 [9] call sum
|
||||
@ -423,12 +423,10 @@ main: {
|
||||
lda #'m'
|
||||
jsr sum
|
||||
//SEG20 [10] (byte) sum::return#1 ← (byte) sum::return#3
|
||||
// (byte) sum::return#1 = (byte) sum::return#3 // register copy reg byte a
|
||||
jmp b2
|
||||
//SEG21 main::@2
|
||||
b2:
|
||||
//SEG22 [11] (byte~) main::$1 ← (byte) sum::return#1
|
||||
// (byte~) main::$1 = (byte) sum::return#1 // register copy reg byte a
|
||||
//SEG23 [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
|
||||
@ -438,12 +436,10 @@ main: {
|
||||
lda #'l'
|
||||
jsr sum
|
||||
//SEG27 [14] (byte) sum::return#2 ← (byte) sum::return#3
|
||||
// (byte) sum::return#2 = (byte) sum::return#3 // register copy reg byte a
|
||||
jmp b3
|
||||
//SEG28 main::@3
|
||||
b3:
|
||||
//SEG29 [15] (byte~) main::$2 ← (byte) sum::return#2
|
||||
// (byte~) main::$2 = (byte) sum::return#2 // register copy reg byte a
|
||||
//SEG30 [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
|
||||
@ -547,6 +543,7 @@ Score: 52
|
||||
//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
|
||||
main: {
|
||||
.label screen = $400
|
||||
.label reverse = $80
|
||||
@ -556,10 +553,8 @@ main: {
|
||||
lda #'c'
|
||||
jsr sum
|
||||
//SEG13 [6] (byte) sum::return#0 ← (byte) sum::return#3
|
||||
// (byte) sum::return#0 = (byte) sum::return#3 // register copy reg byte a
|
||||
//SEG14 main::@1
|
||||
//SEG15 [7] (byte~) main::$0 ← (byte) sum::return#0
|
||||
// (byte~) main::$0 = (byte) sum::return#0 // register copy reg byte a
|
||||
//SEG16 [8] *((const byte*) main::screen#0) ← (byte~) main::$0 -- _deref_pbuc1=vbuaa
|
||||
sta screen
|
||||
//SEG17 [9] call sum
|
||||
@ -568,10 +563,8 @@ main: {
|
||||
lda #'m'
|
||||
jsr sum
|
||||
//SEG20 [10] (byte) sum::return#1 ← (byte) sum::return#3
|
||||
// (byte) sum::return#1 = (byte) sum::return#3 // register copy reg byte a
|
||||
//SEG21 main::@2
|
||||
//SEG22 [11] (byte~) main::$1 ← (byte) sum::return#1
|
||||
// (byte~) main::$1 = (byte) sum::return#1 // register copy reg byte a
|
||||
//SEG23 [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
|
||||
@ -580,10 +573,8 @@ main: {
|
||||
lda #'l'
|
||||
jsr sum
|
||||
//SEG27 [14] (byte) sum::return#2 ← (byte) sum::return#3
|
||||
// (byte) sum::return#2 = (byte) sum::return#3 // register copy reg byte a
|
||||
//SEG28 main::@3
|
||||
//SEG29 [15] (byte~) main::$2 ← (byte) sum::return#2
|
||||
// (byte~) main::$2 = (byte) sum::return#2 // register copy reg byte a
|
||||
//SEG30 [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
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// Test that constant pointers are detected correctly
|
||||
main: {
|
||||
.label screen = $400
|
||||
lda #'*'
|
||||
|
@ -132,6 +132,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Test that constant pointers are detected correctly
|
||||
main: {
|
||||
.label screen = $400
|
||||
jmp b1
|
||||
@ -180,6 +181,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Test that constant pointers are detected correctly
|
||||
main: {
|
||||
.label screen = $400
|
||||
jmp b1
|
||||
@ -246,6 +248,7 @@ Score: 12
|
||||
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
// Test that constant pointers are detected correctly
|
||||
main: {
|
||||
.label screen = $400
|
||||
//SEG10 main::@1
|
||||
|
@ -1,6 +1,8 @@
|
||||
.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
|
||||
|
@ -148,6 +148,8 @@ bend_from_b1:
|
||||
//SEG7 @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.
|
||||
main: {
|
||||
.label screen = $400
|
||||
.label wp = w
|
||||
@ -235,6 +237,8 @@ bend_from_b1:
|
||||
//SEG7 @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.
|
||||
main: {
|
||||
.label screen = $400
|
||||
.label wp = w
|
||||
@ -329,6 +333,8 @@ Score: 60
|
||||
//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.
|
||||
main: {
|
||||
.label screen = $400
|
||||
.label wp = w
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// Concatenates string constants in different ways
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
ldx #0
|
||||
|
@ -191,6 +191,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Concatenates string constants in different ways
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
.label i = 2
|
||||
@ -263,6 +264,7 @@ bend_from_b1:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Concatenates string constants in different ways
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
@ -362,6 +364,7 @@ Score: 186
|
||||
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
// Concatenates string constants in different ways
|
||||
main: {
|
||||
.label SCREEN = $400
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
|
@ -14,6 +14,7 @@ main: {
|
||||
jsr test_sbytes
|
||||
rts
|
||||
}
|
||||
// Test different signed byte constants
|
||||
test_sbytes: {
|
||||
.const bb = 0
|
||||
.const bc = bb+2
|
||||
@ -103,6 +104,7 @@ assert_sbyte: {
|
||||
str1: .text "fail!@"
|
||||
str2: .text "ok@"
|
||||
}
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 2
|
||||
b1:
|
||||
@ -125,6 +127,7 @@ print_str: {
|
||||
!:
|
||||
jmp b1
|
||||
}
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
b1:
|
||||
lda print_line_cursor
|
||||
@ -144,6 +147,7 @@ print_ln: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Test different byte constants
|
||||
test_bytes: {
|
||||
.const bb = 0
|
||||
.const bc = bb+2
|
||||
@ -225,6 +229,7 @@ assert_byte: {
|
||||
str1: .text "fail!@"
|
||||
str2: .text "ok@"
|
||||
}
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
lda #<$400
|
||||
|
@ -1391,6 +1391,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG22 test_sbytes
|
||||
// Test different signed byte constants
|
||||
test_sbytes: {
|
||||
.const bb = 0
|
||||
.const bc = bb+2
|
||||
@ -1598,6 +1599,7 @@ assert_sbyte: {
|
||||
str2: .text "ok@"
|
||||
}
|
||||
//SEG92 print_str
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 8
|
||||
//SEG93 [37] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1]
|
||||
@ -1638,6 +1640,7 @@ print_str: {
|
||||
jmp b1_from_b2
|
||||
}
|
||||
//SEG104 print_ln
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
//SEG105 [44] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
|
||||
b1_from_print_ln:
|
||||
@ -1670,6 +1673,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG112 test_bytes
|
||||
// Test different byte constants
|
||||
test_bytes: {
|
||||
.const bb = 0
|
||||
.const bc = bb+2
|
||||
@ -1848,6 +1852,7 @@ assert_byte: {
|
||||
str2: .text "ok@"
|
||||
}
|
||||
//SEG173 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = $10
|
||||
//SEG174 [69] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -2026,6 +2031,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG22 test_sbytes
|
||||
// Test different signed byte constants
|
||||
test_sbytes: {
|
||||
.const bb = 0
|
||||
.const bc = bb+2
|
||||
@ -2138,7 +2144,6 @@ assert_sbyte: {
|
||||
.label msg = 2
|
||||
.label c = 4
|
||||
//SEG59 [23] (byte*) print_str::str#5 ← (byte*) assert_sbyte::msg#5
|
||||
// (byte*) print_str::str#5 = (byte*) assert_sbyte::msg#5 // register copy zp ZP_WORD:2
|
||||
//SEG60 [24] (byte*~) print_char_cursor#87 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2
|
||||
lda print_line_cursor
|
||||
sta print_char_cursor
|
||||
@ -2223,6 +2228,7 @@ assert_sbyte: {
|
||||
str2: .text "ok@"
|
||||
}
|
||||
//SEG92 print_str
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 2
|
||||
//SEG93 [37] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1]
|
||||
@ -2263,6 +2269,7 @@ print_str: {
|
||||
jmp b1_from_b2
|
||||
}
|
||||
//SEG104 print_ln
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
//SEG105 [44] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
|
||||
b1_from_print_ln:
|
||||
@ -2295,6 +2302,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG112 test_bytes
|
||||
// Test different byte constants
|
||||
test_bytes: {
|
||||
.const bb = 0
|
||||
.const bc = bb+2
|
||||
@ -2385,7 +2393,6 @@ assert_byte: {
|
||||
.label msg = 2
|
||||
.label c = 4
|
||||
//SEG141 [56] (byte*) print_str::str#1 ← (byte*) assert_byte::msg#3
|
||||
// (byte*) print_str::str#1 = (byte*) assert_byte::msg#3 // register copy zp ZP_WORD:2
|
||||
//SEG142 [57] call print_str
|
||||
//SEG143 [36] phi from assert_byte to print_str [phi:assert_byte->print_str]
|
||||
print_str_from_assert_byte:
|
||||
@ -2465,6 +2472,7 @@ assert_byte: {
|
||||
str2: .text "ok@"
|
||||
}
|
||||
//SEG173 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
//SEG174 [69] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -2786,6 +2794,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG22 test_sbytes
|
||||
// Test different signed byte constants
|
||||
test_sbytes: {
|
||||
.const bb = 0
|
||||
.const bc = bb+2
|
||||
@ -2879,7 +2888,6 @@ assert_sbyte: {
|
||||
.label msg = 2
|
||||
.label c = 4
|
||||
//SEG59 [23] (byte*) print_str::str#5 ← (byte*) assert_sbyte::msg#5
|
||||
// (byte*) print_str::str#5 = (byte*) assert_sbyte::msg#5 // register copy zp ZP_WORD:2
|
||||
//SEG60 [24] (byte*~) print_char_cursor#87 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2
|
||||
lda print_line_cursor
|
||||
sta print_char_cursor
|
||||
@ -2946,6 +2954,7 @@ assert_sbyte: {
|
||||
str2: .text "ok@"
|
||||
}
|
||||
//SEG92 print_str
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 2
|
||||
//SEG93 [37] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1]
|
||||
@ -2980,6 +2989,7 @@ print_str: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG104 print_ln
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
//SEG105 [44] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1]
|
||||
//SEG106 [44] phi (byte*) print_line_cursor#24 = (byte*) print_line_cursor#47 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy
|
||||
@ -3007,6 +3017,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG112 test_bytes
|
||||
// Test different byte constants
|
||||
test_bytes: {
|
||||
.const bb = 0
|
||||
.const bc = bb+2
|
||||
@ -3088,7 +3099,6 @@ assert_byte: {
|
||||
.label msg = 2
|
||||
.label c = 4
|
||||
//SEG141 [56] (byte*) print_str::str#1 ← (byte*) assert_byte::msg#3
|
||||
// (byte*) print_str::str#1 = (byte*) assert_byte::msg#3 // register copy zp ZP_WORD:2
|
||||
//SEG142 [57] call print_str
|
||||
//SEG143 [36] phi from assert_byte to print_str [phi:assert_byte->print_str]
|
||||
//SEG144 [36] phi (byte*) print_char_cursor#80 = (byte*) print_char_cursor#70 [phi:assert_byte->print_str#0] -- register_copy
|
||||
@ -3150,6 +3160,7 @@ assert_byte: {
|
||||
str2: .text "ok@"
|
||||
}
|
||||
//SEG173 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
//SEG174 [69] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
|
@ -1,6 +1,7 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
// Test that a double-assignment works.
|
||||
main: {
|
||||
.label screen = $400
|
||||
.const a = $c
|
||||
|
@ -105,6 +105,7 @@ bend_from_b1:
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
// Test that a double-assignment works.
|
||||
main: {
|
||||
.label screen = $400
|
||||
.const a = $c
|
||||
@ -153,6 +154,7 @@ bend_from_b1:
|
||||
//SEG7 @end
|
||||
bend:
|
||||
//SEG8 main
|
||||
// Test that a double-assignment works.
|
||||
main: {
|
||||
.label screen = $400
|
||||
.const a = $c
|
||||
@ -218,6 +220,7 @@ Score: 16
|
||||
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG7 @end
|
||||
//SEG8 main
|
||||
// Test that a double-assignment works.
|
||||
main: {
|
||||
.label screen = $400
|
||||
.const a = $c
|
||||
|
@ -2,6 +2,7 @@
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.label B = $1000
|
||||
// Error cleaning up unused blocks
|
||||
main: {
|
||||
lda #0
|
||||
b2:
|
||||
|
@ -327,6 +327,7 @@ bend_from_b3:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Error cleaning up unused blocks
|
||||
main: {
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
b1_from_main:
|
||||
@ -434,6 +435,7 @@ bend_from_b3:
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
// Error cleaning up unused blocks
|
||||
main: {
|
||||
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
|
||||
b1_from_main:
|
||||
@ -591,6 +593,7 @@ Score: 8868
|
||||
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
// Error cleaning up unused blocks
|
||||
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
|
||||
|
@ -309,6 +309,7 @@ debug_print: {
|
||||
!b1:
|
||||
rts
|
||||
}
|
||||
// Print a signed byte as hex at a specific screen position
|
||||
print_sbyte_at: {
|
||||
.label at = 6
|
||||
cpx #0
|
||||
@ -334,6 +335,7 @@ print_sbyte_at: {
|
||||
tax
|
||||
jmp b2
|
||||
}
|
||||
// Print a single char
|
||||
print_char_at: {
|
||||
.label at = 6
|
||||
.label ch = 8
|
||||
@ -342,6 +344,7 @@ print_char_at: {
|
||||
sta (at),y
|
||||
rts
|
||||
}
|
||||
// Print a byte as HEX at a specific position
|
||||
print_byte_at: {
|
||||
.label at = 6
|
||||
txa
|
||||
@ -365,6 +368,10 @@ print_byte_at: {
|
||||
jsr print_char_at
|
||||
rts
|
||||
}
|
||||
// Rotate a 3D point (x,y,z) using the rotation matrix
|
||||
// The rotation matrix is prepared by calling prepare_matrix()
|
||||
// The passed points must be in the interval [-$3f;$3f].
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
rotate_matrix: {
|
||||
.label x = 5
|
||||
lda x
|
||||
@ -461,6 +468,9 @@ rotate_matrix: {
|
||||
sta xp
|
||||
rts
|
||||
}
|
||||
// Store the rotation matrix into the rotation routine rotate()
|
||||
// After this each call to rotate() will rotate a point with the matrix
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
store_matrix: {
|
||||
lda rotation_matrix+0
|
||||
sta rotate_matrix.A1+1
|
||||
@ -500,6 +510,9 @@ store_matrix: {
|
||||
sta rotate_matrix.I2+1
|
||||
rts
|
||||
}
|
||||
// Prepare the 3x3 rotation matrix into rotation_matrix[]
|
||||
// Angles sx, sy, sz are based on 2*PI=$100
|
||||
// Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
|
||||
calculate_matrix: {
|
||||
.label sy = 3
|
||||
.label t1 = 4
|
||||
@ -1005,6 +1018,7 @@ debug_print_init: {
|
||||
str10: .text "xp@"
|
||||
str11: .text "yp@"
|
||||
}
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = 9
|
||||
.label str = 6
|
||||
@ -1028,6 +1042,7 @@ print_str_at: {
|
||||
!:
|
||||
jmp b1
|
||||
}
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 6
|
||||
lda #<print_line_cursor
|
||||
@ -1050,6 +1065,7 @@ print_cls: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize sprites
|
||||
sprites_init: {
|
||||
.label SCREEN = $400
|
||||
.label sprites_ptr = SCREEN+$3f8
|
||||
|
@ -6380,6 +6380,7 @@ debug_print: {
|
||||
rts
|
||||
}
|
||||
//SEG232 print_sbyte_at
|
||||
// Print a signed byte as hex at a specific screen position
|
||||
print_sbyte_at: {
|
||||
.label b = 9
|
||||
.label at = 7
|
||||
@ -6451,6 +6452,7 @@ print_sbyte_at: {
|
||||
jmp b2_from_b5
|
||||
}
|
||||
//SEG255 print_char_at
|
||||
// Print a single char
|
||||
print_char_at: {
|
||||
.label at = $b
|
||||
.label ch = $a
|
||||
@ -6465,6 +6467,7 @@ print_char_at: {
|
||||
rts
|
||||
}
|
||||
//SEG259 print_byte_at
|
||||
// Print a byte as HEX at a specific position
|
||||
print_byte_at: {
|
||||
.label _0 = $2c
|
||||
.label _2 = $2d
|
||||
@ -6523,6 +6526,10 @@ print_byte_at: {
|
||||
rts
|
||||
}
|
||||
//SEG277 rotate_matrix
|
||||
// Rotate a 3D point (x,y,z) using the rotation matrix
|
||||
// The rotation matrix is prepared by calling prepare_matrix()
|
||||
// The passed points must be in the interval [-$3f;$3f].
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
rotate_matrix: {
|
||||
.label x = $19
|
||||
.label y = $1a
|
||||
@ -6630,6 +6637,9 @@ rotate_matrix: {
|
||||
rts
|
||||
}
|
||||
//SEG284 store_matrix
|
||||
// Store the rotation matrix into the rotation routine rotate()
|
||||
// After this each call to rotate() will rotate a point with the matrix
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
store_matrix: {
|
||||
//SEG285 asm { ldarotation_matrix+0 starotate_matrix.A1+1 eor#$ff starotate_matrix.A2+1 ldarotation_matrix+1 starotate_matrix.B1+1 eor#$ff starotate_matrix.B2+1 ldarotation_matrix+2 starotate_matrix.C1+1 eor#$ff starotate_matrix.C2+1 ldarotation_matrix+3 starotate_matrix.D1+1 eor#$ff starotate_matrix.D2+1 ldarotation_matrix+4 starotate_matrix.E1+1 eor#$ff starotate_matrix.E2+1 ldarotation_matrix+5 starotate_matrix.F1+1 eor#$ff starotate_matrix.F2+1 ldarotation_matrix+6 starotate_matrix.G1+1 eor#$ff starotate_matrix.G2+1 ldarotation_matrix+7 starotate_matrix.H1+1 eor#$ff starotate_matrix.H2+1 ldarotation_matrix+8 starotate_matrix.I1+1 eor#$ff starotate_matrix.I2+1 }
|
||||
lda rotation_matrix+0
|
||||
@ -6675,6 +6685,9 @@ store_matrix: {
|
||||
rts
|
||||
}
|
||||
//SEG288 calculate_matrix
|
||||
// Prepare the 3x3 rotation matrix into rotation_matrix[]
|
||||
// Angles sx, sy, sz are based on 2*PI=$100
|
||||
// Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
|
||||
calculate_matrix: {
|
||||
.label _10 = $38
|
||||
.label _11 = $39
|
||||
@ -7525,6 +7538,7 @@ debug_print_init: {
|
||||
str11: .text "yp@"
|
||||
}
|
||||
//SEG478 print_str_at
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = $12
|
||||
.label str = $10
|
||||
@ -7566,6 +7580,7 @@ print_str_at: {
|
||||
jmp b1_from_b2
|
||||
}
|
||||
//SEG490 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = $14
|
||||
//SEG491 [268] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -7605,6 +7620,7 @@ print_cls: {
|
||||
rts
|
||||
}
|
||||
//SEG501 sprites_init
|
||||
// Initialize sprites
|
||||
sprites_init: {
|
||||
.label SCREEN = $400
|
||||
.label sprites_ptr = SCREEN+$3f8
|
||||
@ -8550,7 +8566,6 @@ anim: {
|
||||
//SEG44 [27] (signed byte) calculate_matrix::sx#0 ← (signed byte) sx#10 -- vbsxx=vbsz1
|
||||
ldx sx
|
||||
//SEG45 [28] (signed byte) calculate_matrix::sy#0 ← (signed byte) sy#10
|
||||
// (signed byte) calculate_matrix::sy#0 = (signed byte) sy#10 // register copy zp ZP_BYTE:3
|
||||
//SEG46 [29] call calculate_matrix
|
||||
jsr calculate_matrix
|
||||
//SEG47 [30] phi from anim::@12 to anim::@27 [phi:anim::@12->anim::@27]
|
||||
@ -8699,7 +8714,6 @@ debug_print: {
|
||||
//SEG86 debug_print::print_sbyte_pos1
|
||||
print_sbyte_pos1:
|
||||
//SEG87 [57] (signed byte) print_sbyte_at::b#4 ← (signed byte) debug_print::print_sbyte_pos1_sb#0
|
||||
// (signed byte) print_sbyte_at::b#4 = (signed byte) debug_print::print_sbyte_pos1_sb#0 // register copy reg byte x
|
||||
//SEG88 [58] call print_sbyte_at
|
||||
//SEG89 [114] phi from debug_print::print_sbyte_pos1 to print_sbyte_at [phi:debug_print::print_sbyte_pos1->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos1:
|
||||
@ -8775,7 +8789,6 @@ debug_print: {
|
||||
//SEG116 debug_print::print_sbyte_pos5
|
||||
print_sbyte_pos5:
|
||||
//SEG117 [68] (signed byte) print_sbyte_at::b#8 ← (signed byte) debug_print::print_sbyte_pos5_sb#0
|
||||
// (signed byte) print_sbyte_at::b#8 = (signed byte) debug_print::print_sbyte_pos5_sb#0 // register copy reg byte x
|
||||
//SEG118 [69] call print_sbyte_at
|
||||
//SEG119 [114] phi from debug_print::print_sbyte_pos5 to print_sbyte_at [phi:debug_print::print_sbyte_pos5->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos5:
|
||||
@ -8795,7 +8808,6 @@ debug_print: {
|
||||
//SEG124 debug_print::print_sbyte_pos6
|
||||
print_sbyte_pos6:
|
||||
//SEG125 [71] (signed byte) print_sbyte_at::b#9 ← (signed byte) debug_print::print_sbyte_pos6_sb#0
|
||||
// (signed byte) print_sbyte_at::b#9 = (signed byte) debug_print::print_sbyte_pos6_sb#0 // register copy reg byte x
|
||||
//SEG126 [72] call print_sbyte_at
|
||||
//SEG127 [114] phi from debug_print::print_sbyte_pos6 to print_sbyte_at [phi:debug_print::print_sbyte_pos6->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos6:
|
||||
@ -8815,7 +8827,6 @@ debug_print: {
|
||||
//SEG132 debug_print::print_sbyte_pos7
|
||||
print_sbyte_pos7:
|
||||
//SEG133 [74] (signed byte) print_sbyte_at::b#10 ← (signed byte) debug_print::print_sbyte_pos7_sb#0
|
||||
// (signed byte) print_sbyte_at::b#10 = (signed byte) debug_print::print_sbyte_pos7_sb#0 // register copy reg byte x
|
||||
//SEG134 [75] call print_sbyte_at
|
||||
//SEG135 [114] phi from debug_print::print_sbyte_pos7 to print_sbyte_at [phi:debug_print::print_sbyte_pos7->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos7:
|
||||
@ -8835,7 +8846,6 @@ debug_print: {
|
||||
//SEG140 debug_print::print_sbyte_pos8
|
||||
print_sbyte_pos8:
|
||||
//SEG141 [77] (signed byte) print_sbyte_at::b#11 ← (signed byte) debug_print::print_sbyte_pos8_sb#0
|
||||
// (signed byte) print_sbyte_at::b#11 = (signed byte) debug_print::print_sbyte_pos8_sb#0 // register copy reg byte x
|
||||
//SEG142 [78] call print_sbyte_at
|
||||
//SEG143 [114] phi from debug_print::print_sbyte_pos8 to print_sbyte_at [phi:debug_print::print_sbyte_pos8->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos8:
|
||||
@ -8855,7 +8865,6 @@ debug_print: {
|
||||
//SEG148 debug_print::print_sbyte_pos9
|
||||
print_sbyte_pos9:
|
||||
//SEG149 [80] (signed byte) print_sbyte_at::b#12 ← (signed byte) debug_print::print_sbyte_pos9_sb#0
|
||||
// (signed byte) print_sbyte_at::b#12 = (signed byte) debug_print::print_sbyte_pos9_sb#0 // register copy reg byte x
|
||||
//SEG150 [81] call print_sbyte_at
|
||||
//SEG151 [114] phi from debug_print::print_sbyte_pos9 to print_sbyte_at [phi:debug_print::print_sbyte_pos9->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos9:
|
||||
@ -8875,7 +8884,6 @@ debug_print: {
|
||||
//SEG156 debug_print::print_sbyte_pos10
|
||||
print_sbyte_pos10:
|
||||
//SEG157 [83] (signed byte) print_sbyte_at::b#13 ← (signed byte) debug_print::print_sbyte_pos10_sb#0
|
||||
// (signed byte) print_sbyte_at::b#13 = (signed byte) debug_print::print_sbyte_pos10_sb#0 // register copy reg byte x
|
||||
//SEG158 [84] call print_sbyte_at
|
||||
//SEG159 [114] phi from debug_print::print_sbyte_pos10 to print_sbyte_at [phi:debug_print::print_sbyte_pos10->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos10:
|
||||
@ -8895,7 +8903,6 @@ debug_print: {
|
||||
//SEG164 debug_print::print_sbyte_pos11
|
||||
print_sbyte_pos11:
|
||||
//SEG165 [86] (signed byte) print_sbyte_at::b#14 ← (signed byte) debug_print::print_sbyte_pos11_sb#0
|
||||
// (signed byte) print_sbyte_at::b#14 = (signed byte) debug_print::print_sbyte_pos11_sb#0 // register copy reg byte x
|
||||
//SEG166 [87] call print_sbyte_at
|
||||
//SEG167 [114] phi from debug_print::print_sbyte_pos11 to print_sbyte_at [phi:debug_print::print_sbyte_pos11->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos11:
|
||||
@ -8915,7 +8922,6 @@ debug_print: {
|
||||
//SEG172 debug_print::print_sbyte_pos12
|
||||
print_sbyte_pos12:
|
||||
//SEG173 [89] (signed byte) print_sbyte_at::b#15 ← (signed byte) debug_print::print_sbyte_pos12_sb#0
|
||||
// (signed byte) print_sbyte_at::b#15 = (signed byte) debug_print::print_sbyte_pos12_sb#0 // register copy reg byte x
|
||||
//SEG174 [90] call print_sbyte_at
|
||||
//SEG175 [114] phi from debug_print::print_sbyte_pos12 to print_sbyte_at [phi:debug_print::print_sbyte_pos12->print_sbyte_at]
|
||||
print_sbyte_at_from_print_sbyte_pos12:
|
||||
@ -9086,6 +9092,7 @@ debug_print: {
|
||||
rts
|
||||
}
|
||||
//SEG232 print_sbyte_at
|
||||
// Print a signed byte as hex at a specific screen position
|
||||
print_sbyte_at: {
|
||||
.label at = 6
|
||||
//SEG233 [115] if((signed byte) print_sbyte_at::b#22<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 -- vbsxx_lt_0_then_la1
|
||||
@ -9095,7 +9102,6 @@ print_sbyte_at: {
|
||||
//SEG234 print_sbyte_at::@3
|
||||
b3:
|
||||
//SEG235 [116] (byte*) print_char_at::at#1 ← (byte*) print_sbyte_at::at#21
|
||||
// (byte*) print_char_at::at#1 = (byte*) print_sbyte_at::at#21 // register copy zp ZP_WORD:6
|
||||
//SEG236 [117] call print_char_at
|
||||
//SEG237 [125] phi from print_sbyte_at::@3 to print_char_at [phi:print_sbyte_at::@3->print_char_at]
|
||||
print_char_at_from_b3:
|
||||
@ -9126,7 +9132,6 @@ print_sbyte_at: {
|
||||
//SEG247 print_sbyte_at::@1
|
||||
b1:
|
||||
//SEG248 [122] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#21
|
||||
// (byte*) print_char_at::at#0 = (byte*) print_sbyte_at::at#21 // register copy zp ZP_WORD:6
|
||||
//SEG249 [123] call print_char_at
|
||||
//SEG250 [125] phi from print_sbyte_at::@1 to print_char_at [phi:print_sbyte_at::@1->print_char_at]
|
||||
print_char_at_from_b1:
|
||||
@ -9147,6 +9152,7 @@ print_sbyte_at: {
|
||||
jmp b2_from_b5
|
||||
}
|
||||
//SEG255 print_char_at
|
||||
// Print a single char
|
||||
print_char_at: {
|
||||
.label at = 6
|
||||
.label ch = 8
|
||||
@ -9161,6 +9167,7 @@ print_char_at: {
|
||||
rts
|
||||
}
|
||||
//SEG259 print_byte_at
|
||||
// Print a byte as HEX at a specific position
|
||||
print_byte_at: {
|
||||
.label at = 6
|
||||
//SEG260 [128] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#24 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4
|
||||
@ -9174,7 +9181,6 @@ print_byte_at: {
|
||||
lda print_hextab,y
|
||||
sta print_char_at.ch
|
||||
//SEG262 [130] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0
|
||||
// (byte*) print_char_at::at#2 = (byte*) print_byte_at::at#0 // register copy zp ZP_WORD:6
|
||||
//SEG263 [131] call print_char_at
|
||||
//SEG264 [125] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at]
|
||||
print_char_at_from_print_byte_at:
|
||||
@ -9209,6 +9215,10 @@ print_byte_at: {
|
||||
rts
|
||||
}
|
||||
//SEG277 rotate_matrix
|
||||
// Rotate a 3D point (x,y,z) using the rotation matrix
|
||||
// The rotation matrix is prepared by calling prepare_matrix()
|
||||
// The passed points must be in the interval [-$3f;$3f].
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
rotate_matrix: {
|
||||
.label x = 5
|
||||
//SEG278 [137] *((const signed byte*) xr#0) ← (signed byte) rotate_matrix::x#0 -- _deref_pbsc1=vbsz1
|
||||
@ -9314,6 +9324,9 @@ rotate_matrix: {
|
||||
rts
|
||||
}
|
||||
//SEG284 store_matrix
|
||||
// Store the rotation matrix into the rotation routine rotate()
|
||||
// After this each call to rotate() will rotate a point with the matrix
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
store_matrix: {
|
||||
//SEG285 asm { ldarotation_matrix+0 starotate_matrix.A1+1 eor#$ff starotate_matrix.A2+1 ldarotation_matrix+1 starotate_matrix.B1+1 eor#$ff starotate_matrix.B2+1 ldarotation_matrix+2 starotate_matrix.C1+1 eor#$ff starotate_matrix.C2+1 ldarotation_matrix+3 starotate_matrix.D1+1 eor#$ff starotate_matrix.D2+1 ldarotation_matrix+4 starotate_matrix.E1+1 eor#$ff starotate_matrix.E2+1 ldarotation_matrix+5 starotate_matrix.F1+1 eor#$ff starotate_matrix.F2+1 ldarotation_matrix+6 starotate_matrix.G1+1 eor#$ff starotate_matrix.G2+1 ldarotation_matrix+7 starotate_matrix.H1+1 eor#$ff starotate_matrix.H2+1 ldarotation_matrix+8 starotate_matrix.I1+1 eor#$ff starotate_matrix.I2+1 }
|
||||
lda rotation_matrix+0
|
||||
@ -9359,6 +9372,9 @@ store_matrix: {
|
||||
rts
|
||||
}
|
||||
//SEG288 calculate_matrix
|
||||
// Prepare the 3x3 rotation matrix into rotation_matrix[]
|
||||
// Angles sx, sy, sz are based on 2*PI=$100
|
||||
// Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
|
||||
calculate_matrix: {
|
||||
.label sy = 3
|
||||
.label t1 = 4
|
||||
@ -10130,6 +10146,7 @@ debug_print_init: {
|
||||
str11: .text "yp@"
|
||||
}
|
||||
//SEG478 print_str_at
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = 9
|
||||
.label str = 6
|
||||
@ -10171,6 +10188,7 @@ print_str_at: {
|
||||
jmp b1_from_b2
|
||||
}
|
||||
//SEG490 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 6
|
||||
//SEG491 [268] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -10210,6 +10228,7 @@ print_cls: {
|
||||
rts
|
||||
}
|
||||
//SEG501 sprites_init
|
||||
// Initialize sprites
|
||||
sprites_init: {
|
||||
.label SCREEN = $400
|
||||
.label sprites_ptr = SCREEN+$3f8
|
||||
@ -10483,11 +10502,22 @@ Removing instruction anim_from_b2:
|
||||
Removing instruction b1:
|
||||
Removing instruction b27_from_b12:
|
||||
Removing instruction b13_from_b29:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos1:
|
||||
Removing instruction print_sbyte_pos3_from_print_sbyte_pos2:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos3:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos5:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos6:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos7:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos8:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos9:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos10:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos11:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos12:
|
||||
Removing instruction b1_from_b32:
|
||||
Removing instruction print_char_at_from_b3:
|
||||
Removing instruction b2_from_b3:
|
||||
Removing instruction b2_from_b5:
|
||||
Removing instruction print_char_at_from_b1:
|
||||
Removing instruction b5_from_debug_print_init:
|
||||
Removing instruction print_str_at_from_b5:
|
||||
Removing instruction b6_from_b5:
|
||||
@ -10533,7 +10563,6 @@ Removing instruction b25:
|
||||
Removing instruction b30:
|
||||
Removing instruction b1_from_b30:
|
||||
Removing instruction print_sbyte_pos1:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos1:
|
||||
Removing instruction b3:
|
||||
Removing instruction print_sbyte_pos2:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos2:
|
||||
@ -10543,28 +10572,20 @@ Removing instruction print_sbyte_pos4:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos4:
|
||||
Removing instruction b6:
|
||||
Removing instruction print_sbyte_pos5:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos5:
|
||||
Removing instruction b7:
|
||||
Removing instruction print_sbyte_pos6:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos6:
|
||||
Removing instruction b8:
|
||||
Removing instruction print_sbyte_pos7:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos7:
|
||||
Removing instruction b9:
|
||||
Removing instruction print_sbyte_pos8:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos8:
|
||||
Removing instruction b10:
|
||||
Removing instruction print_sbyte_pos9:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos9:
|
||||
Removing instruction b11:
|
||||
Removing instruction print_sbyte_pos10:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos10:
|
||||
Removing instruction b12:
|
||||
Removing instruction print_sbyte_pos11:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos11:
|
||||
Removing instruction b13:
|
||||
Removing instruction print_sbyte_pos12:
|
||||
Removing instruction print_sbyte_at_from_print_sbyte_pos12:
|
||||
Removing instruction b1_from_print_sbyte_pos12:
|
||||
Removing instruction print_sbyte_at_from_b1:
|
||||
Removing instruction b27:
|
||||
@ -10580,9 +10601,7 @@ Removing instruction print_sbyte_at_from_b31:
|
||||
Removing instruction b32:
|
||||
Removing instruction breturn:
|
||||
Removing instruction b3:
|
||||
Removing instruction print_char_at_from_b3:
|
||||
Removing instruction breturn:
|
||||
Removing instruction print_char_at_from_b1:
|
||||
Removing instruction b5:
|
||||
Removing instruction breturn:
|
||||
Removing instruction print_char_at_from_print_byte_at:
|
||||
@ -10633,8 +10652,8 @@ Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction bbegin:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
Fixing long branch [306] bne b1 to beq
|
||||
Fixing long branch [980] bne b2 to beq
|
||||
Fixing long branch [990] bne b1 to beq
|
||||
Fixing long branch [993] bne b2 to beq
|
||||
Fixing long branch [1003] bne b1 to beq
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(label) @33
|
||||
@ -11377,7 +11396,6 @@ anim: {
|
||||
//SEG44 [27] (signed byte) calculate_matrix::sx#0 ← (signed byte) sx#10 -- vbsxx=vbsz1
|
||||
ldx sx
|
||||
//SEG45 [28] (signed byte) calculate_matrix::sy#0 ← (signed byte) sy#10
|
||||
// (signed byte) calculate_matrix::sy#0 = (signed byte) sy#10 // register copy zp ZP_BYTE:3
|
||||
//SEG46 [29] call calculate_matrix
|
||||
jsr calculate_matrix
|
||||
//SEG47 [30] phi from anim::@12 to anim::@27 [phi:anim::@12->anim::@27]
|
||||
@ -11504,7 +11522,6 @@ debug_print: {
|
||||
ldx sx
|
||||
//SEG86 debug_print::print_sbyte_pos1
|
||||
//SEG87 [57] (signed byte) print_sbyte_at::b#4 ← (signed byte) debug_print::print_sbyte_pos1_sb#0
|
||||
// (signed byte) print_sbyte_at::b#4 = (signed byte) debug_print::print_sbyte_pos1_sb#0 // register copy reg byte x
|
||||
//SEG88 [58] call print_sbyte_at
|
||||
//SEG89 [114] phi from debug_print::print_sbyte_pos1 to print_sbyte_at [phi:debug_print::print_sbyte_pos1->print_sbyte_at]
|
||||
//SEG90 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos1_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos1_col#0 [phi:debug_print::print_sbyte_pos1->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11561,7 +11578,6 @@ debug_print: {
|
||||
ldx rotation_matrix+1
|
||||
//SEG116 debug_print::print_sbyte_pos5
|
||||
//SEG117 [68] (signed byte) print_sbyte_at::b#8 ← (signed byte) debug_print::print_sbyte_pos5_sb#0
|
||||
// (signed byte) print_sbyte_at::b#8 = (signed byte) debug_print::print_sbyte_pos5_sb#0 // register copy reg byte x
|
||||
//SEG118 [69] call print_sbyte_at
|
||||
//SEG119 [114] phi from debug_print::print_sbyte_pos5 to print_sbyte_at [phi:debug_print::print_sbyte_pos5->print_sbyte_at]
|
||||
//SEG120 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos5_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos5_col#0 [phi:debug_print::print_sbyte_pos5->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11576,7 +11592,6 @@ debug_print: {
|
||||
ldx rotation_matrix+2
|
||||
//SEG124 debug_print::print_sbyte_pos6
|
||||
//SEG125 [71] (signed byte) print_sbyte_at::b#9 ← (signed byte) debug_print::print_sbyte_pos6_sb#0
|
||||
// (signed byte) print_sbyte_at::b#9 = (signed byte) debug_print::print_sbyte_pos6_sb#0 // register copy reg byte x
|
||||
//SEG126 [72] call print_sbyte_at
|
||||
//SEG127 [114] phi from debug_print::print_sbyte_pos6 to print_sbyte_at [phi:debug_print::print_sbyte_pos6->print_sbyte_at]
|
||||
//SEG128 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos6_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos6_col#0 [phi:debug_print::print_sbyte_pos6->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11591,7 +11606,6 @@ debug_print: {
|
||||
ldx rotation_matrix+3
|
||||
//SEG132 debug_print::print_sbyte_pos7
|
||||
//SEG133 [74] (signed byte) print_sbyte_at::b#10 ← (signed byte) debug_print::print_sbyte_pos7_sb#0
|
||||
// (signed byte) print_sbyte_at::b#10 = (signed byte) debug_print::print_sbyte_pos7_sb#0 // register copy reg byte x
|
||||
//SEG134 [75] call print_sbyte_at
|
||||
//SEG135 [114] phi from debug_print::print_sbyte_pos7 to print_sbyte_at [phi:debug_print::print_sbyte_pos7->print_sbyte_at]
|
||||
//SEG136 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos7_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos7_col#0 [phi:debug_print::print_sbyte_pos7->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11606,7 +11620,6 @@ debug_print: {
|
||||
ldx rotation_matrix+4
|
||||
//SEG140 debug_print::print_sbyte_pos8
|
||||
//SEG141 [77] (signed byte) print_sbyte_at::b#11 ← (signed byte) debug_print::print_sbyte_pos8_sb#0
|
||||
// (signed byte) print_sbyte_at::b#11 = (signed byte) debug_print::print_sbyte_pos8_sb#0 // register copy reg byte x
|
||||
//SEG142 [78] call print_sbyte_at
|
||||
//SEG143 [114] phi from debug_print::print_sbyte_pos8 to print_sbyte_at [phi:debug_print::print_sbyte_pos8->print_sbyte_at]
|
||||
//SEG144 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos8_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos8_col#0 [phi:debug_print::print_sbyte_pos8->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11621,7 +11634,6 @@ debug_print: {
|
||||
ldx rotation_matrix+5
|
||||
//SEG148 debug_print::print_sbyte_pos9
|
||||
//SEG149 [80] (signed byte) print_sbyte_at::b#12 ← (signed byte) debug_print::print_sbyte_pos9_sb#0
|
||||
// (signed byte) print_sbyte_at::b#12 = (signed byte) debug_print::print_sbyte_pos9_sb#0 // register copy reg byte x
|
||||
//SEG150 [81] call print_sbyte_at
|
||||
//SEG151 [114] phi from debug_print::print_sbyte_pos9 to print_sbyte_at [phi:debug_print::print_sbyte_pos9->print_sbyte_at]
|
||||
//SEG152 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos9_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos9_col#0 [phi:debug_print::print_sbyte_pos9->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11636,7 +11648,6 @@ debug_print: {
|
||||
ldx rotation_matrix+6
|
||||
//SEG156 debug_print::print_sbyte_pos10
|
||||
//SEG157 [83] (signed byte) print_sbyte_at::b#13 ← (signed byte) debug_print::print_sbyte_pos10_sb#0
|
||||
// (signed byte) print_sbyte_at::b#13 = (signed byte) debug_print::print_sbyte_pos10_sb#0 // register copy reg byte x
|
||||
//SEG158 [84] call print_sbyte_at
|
||||
//SEG159 [114] phi from debug_print::print_sbyte_pos10 to print_sbyte_at [phi:debug_print::print_sbyte_pos10->print_sbyte_at]
|
||||
//SEG160 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos10_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos10_col#0 [phi:debug_print::print_sbyte_pos10->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11651,7 +11662,6 @@ debug_print: {
|
||||
ldx rotation_matrix+7
|
||||
//SEG164 debug_print::print_sbyte_pos11
|
||||
//SEG165 [86] (signed byte) print_sbyte_at::b#14 ← (signed byte) debug_print::print_sbyte_pos11_sb#0
|
||||
// (signed byte) print_sbyte_at::b#14 = (signed byte) debug_print::print_sbyte_pos11_sb#0 // register copy reg byte x
|
||||
//SEG166 [87] call print_sbyte_at
|
||||
//SEG167 [114] phi from debug_print::print_sbyte_pos11 to print_sbyte_at [phi:debug_print::print_sbyte_pos11->print_sbyte_at]
|
||||
//SEG168 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos11_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos11_col#0 [phi:debug_print::print_sbyte_pos11->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11666,7 +11676,6 @@ debug_print: {
|
||||
ldx rotation_matrix+8
|
||||
//SEG172 debug_print::print_sbyte_pos12
|
||||
//SEG173 [89] (signed byte) print_sbyte_at::b#15 ← (signed byte) debug_print::print_sbyte_pos12_sb#0
|
||||
// (signed byte) print_sbyte_at::b#15 = (signed byte) debug_print::print_sbyte_pos12_sb#0 // register copy reg byte x
|
||||
//SEG174 [90] call print_sbyte_at
|
||||
//SEG175 [114] phi from debug_print::print_sbyte_pos12 to print_sbyte_at [phi:debug_print::print_sbyte_pos12->print_sbyte_at]
|
||||
//SEG176 [114] phi (byte*) print_sbyte_at::at#21 = (const byte*) print_line_cursor#0+(const byte) debug_print::print_sbyte_pos12_row#0*(byte/signed byte/word/signed word/dword/signed dword) 40+(const byte) debug_print::print_sbyte_pos12_col#0 [phi:debug_print::print_sbyte_pos12->print_sbyte_at#0] -- pbuz1=pbuc1
|
||||
@ -11814,6 +11823,7 @@ debug_print: {
|
||||
rts
|
||||
}
|
||||
//SEG232 print_sbyte_at
|
||||
// Print a signed byte as hex at a specific screen position
|
||||
print_sbyte_at: {
|
||||
.label at = 6
|
||||
//SEG233 [115] if((signed byte) print_sbyte_at::b#22<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 -- vbsxx_lt_0_then_la1
|
||||
@ -11821,7 +11831,6 @@ print_sbyte_at: {
|
||||
bmi b1
|
||||
//SEG234 print_sbyte_at::@3
|
||||
//SEG235 [116] (byte*) print_char_at::at#1 ← (byte*) print_sbyte_at::at#21
|
||||
// (byte*) print_char_at::at#1 = (byte*) print_sbyte_at::at#21 // register copy zp ZP_WORD:6
|
||||
//SEG236 [117] call print_char_at
|
||||
//SEG237 [125] phi from print_sbyte_at::@3 to print_char_at [phi:print_sbyte_at::@3->print_char_at]
|
||||
//SEG238 [125] phi (byte*) print_char_at::at#4 = (byte*) print_char_at::at#1 [phi:print_sbyte_at::@3->print_char_at#0] -- register_copy
|
||||
@ -11846,7 +11855,6 @@ print_sbyte_at: {
|
||||
//SEG247 print_sbyte_at::@1
|
||||
b1:
|
||||
//SEG248 [122] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#21
|
||||
// (byte*) print_char_at::at#0 = (byte*) print_sbyte_at::at#21 // register copy zp ZP_WORD:6
|
||||
//SEG249 [123] call print_char_at
|
||||
//SEG250 [125] phi from print_sbyte_at::@1 to print_char_at [phi:print_sbyte_at::@1->print_char_at]
|
||||
//SEG251 [125] phi (byte*) print_char_at::at#4 = (byte*) print_char_at::at#0 [phi:print_sbyte_at::@1->print_char_at#0] -- register_copy
|
||||
@ -11864,6 +11872,7 @@ print_sbyte_at: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG255 print_char_at
|
||||
// Print a single char
|
||||
print_char_at: {
|
||||
.label at = 6
|
||||
.label ch = 8
|
||||
@ -11876,6 +11885,7 @@ print_char_at: {
|
||||
rts
|
||||
}
|
||||
//SEG259 print_byte_at
|
||||
// Print a byte as HEX at a specific position
|
||||
print_byte_at: {
|
||||
.label at = 6
|
||||
//SEG260 [128] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#24 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4
|
||||
@ -11889,7 +11899,6 @@ print_byte_at: {
|
||||
lda print_hextab,y
|
||||
sta print_char_at.ch
|
||||
//SEG262 [130] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0
|
||||
// (byte*) print_char_at::at#2 = (byte*) print_byte_at::at#0 // register copy zp ZP_WORD:6
|
||||
//SEG263 [131] call print_char_at
|
||||
//SEG264 [125] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at]
|
||||
//SEG265 [125] phi (byte*) print_char_at::at#4 = (byte*) print_char_at::at#2 [phi:print_byte_at->print_char_at#0] -- register_copy
|
||||
@ -11918,6 +11927,10 @@ print_byte_at: {
|
||||
rts
|
||||
}
|
||||
//SEG277 rotate_matrix
|
||||
// Rotate a 3D point (x,y,z) using the rotation matrix
|
||||
// The rotation matrix is prepared by calling prepare_matrix()
|
||||
// The passed points must be in the interval [-$3f;$3f].
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
rotate_matrix: {
|
||||
.label x = 5
|
||||
//SEG278 [137] *((const signed byte*) xr#0) ← (signed byte) rotate_matrix::x#0 -- _deref_pbsc1=vbsz1
|
||||
@ -12021,6 +12034,9 @@ rotate_matrix: {
|
||||
rts
|
||||
}
|
||||
//SEG284 store_matrix
|
||||
// Store the rotation matrix into the rotation routine rotate()
|
||||
// After this each call to rotate() will rotate a point with the matrix
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
store_matrix: {
|
||||
//SEG285 asm { ldarotation_matrix+0 starotate_matrix.A1+1 eor#$ff starotate_matrix.A2+1 ldarotation_matrix+1 starotate_matrix.B1+1 eor#$ff starotate_matrix.B2+1 ldarotation_matrix+2 starotate_matrix.C1+1 eor#$ff starotate_matrix.C2+1 ldarotation_matrix+3 starotate_matrix.D1+1 eor#$ff starotate_matrix.D2+1 ldarotation_matrix+4 starotate_matrix.E1+1 eor#$ff starotate_matrix.E2+1 ldarotation_matrix+5 starotate_matrix.F1+1 eor#$ff starotate_matrix.F2+1 ldarotation_matrix+6 starotate_matrix.G1+1 eor#$ff starotate_matrix.G2+1 ldarotation_matrix+7 starotate_matrix.H1+1 eor#$ff starotate_matrix.H2+1 ldarotation_matrix+8 starotate_matrix.I1+1 eor#$ff starotate_matrix.I2+1 }
|
||||
lda rotation_matrix+0
|
||||
@ -12064,6 +12080,9 @@ store_matrix: {
|
||||
rts
|
||||
}
|
||||
//SEG288 calculate_matrix
|
||||
// Prepare the 3x3 rotation matrix into rotation_matrix[]
|
||||
// Angles sx, sy, sz are based on 2*PI=$100
|
||||
// Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
|
||||
calculate_matrix: {
|
||||
.label sy = 3
|
||||
.label t1 = 4
|
||||
@ -12759,6 +12778,7 @@ debug_print_init: {
|
||||
str11: .text "yp@"
|
||||
}
|
||||
//SEG478 print_str_at
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = 9
|
||||
.label str = 6
|
||||
@ -12794,6 +12814,7 @@ print_str_at: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG490 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 6
|
||||
//SEG491 [268] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -12827,6 +12848,7 @@ print_cls: {
|
||||
rts
|
||||
}
|
||||
//SEG501 sprites_init
|
||||
// Initialize sprites
|
||||
sprites_init: {
|
||||
.label SCREEN = $400
|
||||
.label sprites_ptr = SCREEN+$3f8
|
||||
|
@ -82,6 +82,7 @@ do_perspective: {
|
||||
str4: .text ",@"
|
||||
str5: .text ")@"
|
||||
}
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
lda #<$400
|
||||
sta print_line_cursor
|
||||
@ -105,6 +106,7 @@ print_ln: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 2
|
||||
b1:
|
||||
@ -127,6 +129,7 @@ print_str: {
|
||||
!:
|
||||
jmp b1
|
||||
}
|
||||
// Print a byte as HEX
|
||||
print_byte: {
|
||||
txa
|
||||
lsr
|
||||
@ -143,6 +146,7 @@ print_byte: {
|
||||
jsr print_char
|
||||
rts
|
||||
}
|
||||
// Print a single char
|
||||
print_char: {
|
||||
ldy #0
|
||||
sta (print_char_cursor),y
|
||||
@ -152,6 +156,8 @@ print_char: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Apply perspective to a 3d-point. Result is returned in (*xr,*yr)
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
perspective: {
|
||||
lda #do_perspective.x
|
||||
sta xr
|
||||
@ -179,6 +185,7 @@ perspective: {
|
||||
sta xr
|
||||
rts
|
||||
}
|
||||
// Print a signed byte as HEX
|
||||
print_sbyte: {
|
||||
cpx #0
|
||||
bmi b1
|
||||
@ -197,6 +204,7 @@ print_sbyte: {
|
||||
tax
|
||||
jmp b2
|
||||
}
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
lda #<$400
|
||||
@ -219,6 +227,7 @@ print_cls: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x) and g(x) = f(1-x)
|
||||
mulf_init: {
|
||||
.label val = 6
|
||||
.label sqr = 2
|
||||
|
@ -2176,6 +2176,7 @@ do_perspective: {
|
||||
str5: .text ")@"
|
||||
}
|
||||
//SEG94 print_ln
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
//SEG95 [40] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
|
||||
b1_from_print_ln:
|
||||
@ -2215,6 +2216,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG104 print_str
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 4
|
||||
//SEG105 [45] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1]
|
||||
@ -2255,6 +2257,7 @@ print_str: {
|
||||
jmp b1_from_b2
|
||||
}
|
||||
//SEG116 print_byte
|
||||
// Print a byte as HEX
|
||||
print_byte: {
|
||||
.label _0 = $12
|
||||
.label _2 = $13
|
||||
@ -2300,6 +2303,7 @@ print_byte: {
|
||||
rts
|
||||
}
|
||||
//SEG132 print_char
|
||||
// Print a single char
|
||||
print_char: {
|
||||
.label ch = 7
|
||||
//SEG133 [60] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuz2
|
||||
@ -2318,6 +2322,8 @@ print_char: {
|
||||
rts
|
||||
}
|
||||
//SEG137 perspective
|
||||
// Apply perspective to a 3d-point. Result is returned in (*xr,*yr)
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
perspective: {
|
||||
//SEG138 [63] *((const signed byte*) xr#0) ← (const signed byte) do_perspective::x#0 -- _deref_pbsc1=vbsc2
|
||||
lda #do_perspective.x
|
||||
@ -2355,6 +2361,7 @@ perspective: {
|
||||
rts
|
||||
}
|
||||
//SEG144 print_sbyte
|
||||
// Print a signed byte as HEX
|
||||
print_sbyte: {
|
||||
.label b = $a
|
||||
//SEG145 [69] if((signed byte) print_sbyte::b#4<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1
|
||||
@ -2419,6 +2426,7 @@ print_sbyte: {
|
||||
jmp b2_from_b5
|
||||
}
|
||||
//SEG170 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = $b
|
||||
//SEG171 [80] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -2458,6 +2466,7 @@ print_cls: {
|
||||
rts
|
||||
}
|
||||
//SEG181 mulf_init
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x) and g(x) = f(1-x)
|
||||
mulf_init: {
|
||||
.label _2 = $15
|
||||
.label _4 = $16
|
||||
@ -2960,6 +2969,7 @@ do_perspective: {
|
||||
str5: .text ")@"
|
||||
}
|
||||
//SEG94 print_ln
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
//SEG95 [40] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
|
||||
b1_from_print_ln:
|
||||
@ -2999,6 +3009,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG104 print_str
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 2
|
||||
//SEG105 [45] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1]
|
||||
@ -3039,6 +3050,7 @@ print_str: {
|
||||
jmp b1_from_b2
|
||||
}
|
||||
//SEG116 print_byte
|
||||
// Print a byte as HEX
|
||||
print_byte: {
|
||||
//SEG117 [52] (byte~) print_byte::$0 ← (byte) print_byte::b#3 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4
|
||||
txa
|
||||
@ -3077,6 +3089,7 @@ print_byte: {
|
||||
rts
|
||||
}
|
||||
//SEG132 print_char
|
||||
// Print a single char
|
||||
print_char: {
|
||||
//SEG133 [60] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa
|
||||
ldy #0
|
||||
@ -3093,6 +3106,8 @@ print_char: {
|
||||
rts
|
||||
}
|
||||
//SEG137 perspective
|
||||
// Apply perspective to a 3d-point. Result is returned in (*xr,*yr)
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
perspective: {
|
||||
//SEG138 [63] *((const signed byte*) xr#0) ← (const signed byte) do_perspective::x#0 -- _deref_pbsc1=vbsc2
|
||||
lda #do_perspective.x
|
||||
@ -3130,6 +3145,7 @@ perspective: {
|
||||
rts
|
||||
}
|
||||
//SEG144 print_sbyte
|
||||
// Print a signed byte as HEX
|
||||
print_sbyte: {
|
||||
//SEG145 [69] if((signed byte) print_sbyte::b#4<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsxx_lt_0_then_la1
|
||||
cpx #0
|
||||
@ -3154,7 +3170,6 @@ print_sbyte: {
|
||||
//SEG154 print_sbyte::@2
|
||||
b2:
|
||||
//SEG155 [73] (byte~) print_byte::b#7 ← (byte)(signed byte) print_sbyte::b#6
|
||||
// (byte~) print_byte::b#7 = (byte)(signed byte) print_sbyte::b#6 // register copy reg byte x
|
||||
//SEG156 [74] call print_byte
|
||||
//SEG157 [51] phi from print_sbyte::@2 to print_byte [phi:print_sbyte::@2->print_byte]
|
||||
print_byte_from_b2:
|
||||
@ -3190,6 +3205,7 @@ print_sbyte: {
|
||||
jmp b2_from_b5
|
||||
}
|
||||
//SEG170 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
//SEG171 [80] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -3229,6 +3245,7 @@ print_cls: {
|
||||
rts
|
||||
}
|
||||
//SEG181 mulf_init
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x) and g(x) = f(1-x)
|
||||
mulf_init: {
|
||||
.label val = 6
|
||||
.label sqr = 2
|
||||
@ -3438,6 +3455,7 @@ Removing instruction b3_from_print_sbyte:
|
||||
Removing instruction print_char_from_b3:
|
||||
Removing instruction b2_from_b3:
|
||||
Removing instruction b2_from_b5:
|
||||
Removing instruction print_byte_from_b2:
|
||||
Removing instruction b1_from_print_sbyte:
|
||||
Removing instruction print_char_from_b1:
|
||||
Removing instruction b1_from_b1:
|
||||
@ -3475,7 +3493,6 @@ Removing instruction breturn:
|
||||
Removing instruction breturn:
|
||||
Removing instruction breturn:
|
||||
Removing instruction b3:
|
||||
Removing instruction print_byte_from_b2:
|
||||
Removing instruction breturn:
|
||||
Removing instruction b5:
|
||||
Removing instruction b1_from_print_cls:
|
||||
@ -3899,6 +3916,7 @@ do_perspective: {
|
||||
str5: .text ")@"
|
||||
}
|
||||
//SEG94 print_ln
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
//SEG95 [40] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
|
||||
//SEG96 [40] phi (byte*) print_line_cursor#11 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1
|
||||
@ -3932,6 +3950,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG104 print_str
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 2
|
||||
//SEG105 [45] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1]
|
||||
@ -3966,6 +3985,7 @@ print_str: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG116 print_byte
|
||||
// Print a byte as HEX
|
||||
print_byte: {
|
||||
//SEG117 [52] (byte~) print_byte::$0 ← (byte) print_byte::b#3 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4
|
||||
txa
|
||||
@ -3998,6 +4018,7 @@ print_byte: {
|
||||
rts
|
||||
}
|
||||
//SEG132 print_char
|
||||
// Print a single char
|
||||
print_char: {
|
||||
//SEG133 [60] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa
|
||||
ldy #0
|
||||
@ -4012,6 +4033,8 @@ print_char: {
|
||||
rts
|
||||
}
|
||||
//SEG137 perspective
|
||||
// Apply perspective to a 3d-point. Result is returned in (*xr,*yr)
|
||||
// Implemented in assembler to utilize seriously fast multiplication
|
||||
perspective: {
|
||||
//SEG138 [63] *((const signed byte*) xr#0) ← (const signed byte) do_perspective::x#0 -- _deref_pbsc1=vbsc2
|
||||
lda #do_perspective.x
|
||||
@ -4046,6 +4069,7 @@ perspective: {
|
||||
rts
|
||||
}
|
||||
//SEG144 print_sbyte
|
||||
// Print a signed byte as HEX
|
||||
print_sbyte: {
|
||||
//SEG145 [69] if((signed byte) print_sbyte::b#4<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsxx_lt_0_then_la1
|
||||
cpx #0
|
||||
@ -4063,7 +4087,6 @@ print_sbyte: {
|
||||
//SEG154 print_sbyte::@2
|
||||
b2:
|
||||
//SEG155 [73] (byte~) print_byte::b#7 ← (byte)(signed byte) print_sbyte::b#6
|
||||
// (byte~) print_byte::b#7 = (byte)(signed byte) print_sbyte::b#6 // register copy reg byte x
|
||||
//SEG156 [74] call print_byte
|
||||
//SEG157 [51] phi from print_sbyte::@2 to print_byte [phi:print_sbyte::@2->print_byte]
|
||||
//SEG158 [51] phi (byte*) print_char_cursor#69 = (byte*) print_char_cursor#12 [phi:print_sbyte::@2->print_byte#0] -- register_copy
|
||||
@ -4091,6 +4114,7 @@ print_sbyte: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG170 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
//SEG171 [80] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -4124,6 +4148,7 @@ print_cls: {
|
||||
rts
|
||||
}
|
||||
//SEG181 mulf_init
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x) and g(x) = f(1-x)
|
||||
mulf_init: {
|
||||
.label val = 6
|
||||
.label sqr = 2
|
||||
|
@ -47,6 +47,7 @@ lines: {
|
||||
bcc b1
|
||||
rts
|
||||
}
|
||||
// Draw a line on the bitmap
|
||||
bitmap_line: {
|
||||
.label xd = 4
|
||||
.label yd = 3
|
||||
@ -325,6 +326,7 @@ init_screen: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = 9
|
||||
.label y = 2
|
||||
@ -354,6 +356,7 @@ bitmap_clear: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize the bitmap plotter tables for a specific bitmap
|
||||
bitmap_init: {
|
||||
.label _6 = 2
|
||||
.label yoffs = 9
|
||||
|
@ -2951,6 +2951,7 @@ lines: {
|
||||
rts
|
||||
}
|
||||
//SEG42 bitmap_line
|
||||
// Draw a line on the bitmap
|
||||
bitmap_line: {
|
||||
.label xd = $2f
|
||||
.label xd_1 = $2c
|
||||
@ -3664,6 +3665,7 @@ init_screen: {
|
||||
rts
|
||||
}
|
||||
//SEG299 bitmap_clear
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = $20
|
||||
.label x = $22
|
||||
@ -3738,6 +3740,7 @@ bitmap_clear: {
|
||||
rts
|
||||
}
|
||||
//SEG325 bitmap_init
|
||||
// Initialize the bitmap plotter tables for a specific bitmap
|
||||
bitmap_init: {
|
||||
.label _0 = $3f
|
||||
.label _6 = $40
|
||||
@ -4370,6 +4373,7 @@ lines: {
|
||||
rts
|
||||
}
|
||||
//SEG42 bitmap_line
|
||||
// Draw a line on the bitmap
|
||||
bitmap_line: {
|
||||
.label xd = 4
|
||||
.label yd = 3
|
||||
@ -4415,11 +4419,8 @@ bitmap_line: {
|
||||
//SEG52 [31] (byte) bitmap_line_ydxi::x#0 ← (byte) bitmap_line::x1#0 -- vbuxx=vbuz1
|
||||
ldx x1
|
||||
//SEG53 [32] (byte) bitmap_line_ydxi::y1#0 ← (byte) bitmap_line::y0#0
|
||||
// (byte) bitmap_line_ydxi::y1#0 = (byte) bitmap_line::y0#0 // register copy zp ZP_BYTE:6
|
||||
//SEG54 [33] (byte) bitmap_line_ydxi::yd#0 ← (byte) bitmap_line::yd#1
|
||||
// (byte) bitmap_line_ydxi::yd#0 = (byte) bitmap_line::yd#1 // register copy zp ZP_BYTE:3
|
||||
//SEG55 [34] (byte) bitmap_line_ydxi::xd#0 ← (byte) bitmap_line::xd#1
|
||||
// (byte) bitmap_line_ydxi::xd#0 = (byte) bitmap_line::xd#1 // register copy zp ZP_BYTE:4
|
||||
//SEG56 [35] call bitmap_line_ydxi
|
||||
//SEG57 [109] phi from bitmap_line::@17 to bitmap_line_ydxi [phi:bitmap_line::@17->bitmap_line_ydxi]
|
||||
bitmap_line_ydxi_from_b17:
|
||||
@ -4441,11 +4442,8 @@ bitmap_line: {
|
||||
//SEG67 [38] (byte) bitmap_line_xdyi::y#0 ← (byte) bitmap_line::y1#0 -- vbuz1=vbuyy
|
||||
sty bitmap_line_xdyi.y
|
||||
//SEG68 [39] (byte) bitmap_line_xdyi::x1#0 ← (byte) bitmap_line::x0#0
|
||||
// (byte) bitmap_line_xdyi::x1#0 = (byte) bitmap_line::x0#0 // register copy zp ZP_BYTE:5
|
||||
//SEG69 [40] (byte) bitmap_line_xdyi::xd#0 ← (byte) bitmap_line::xd#1
|
||||
// (byte) bitmap_line_xdyi::xd#0 = (byte) bitmap_line::xd#1 // register copy zp ZP_BYTE:4
|
||||
//SEG70 [41] (byte) bitmap_line_xdyi::yd#0 ← (byte) bitmap_line::yd#1
|
||||
// (byte) bitmap_line_xdyi::yd#0 = (byte) bitmap_line::yd#1 // register copy zp ZP_BYTE:3
|
||||
//SEG71 [42] call bitmap_line_xdyi
|
||||
//SEG72 [87] phi from bitmap_line::@3 to bitmap_line_xdyi [phi:bitmap_line::@3->bitmap_line_xdyi]
|
||||
bitmap_line_xdyi_from_b3:
|
||||
@ -4478,9 +4476,7 @@ bitmap_line: {
|
||||
//SEG84 [47] (byte) bitmap_line_ydxd::y1#0 ← (byte) bitmap_line::y1#0 -- vbuz1=vbuyy
|
||||
sty bitmap_line_ydxd.y1
|
||||
//SEG85 [48] (byte) bitmap_line_ydxd::yd#0 ← (byte) bitmap_line::yd#0
|
||||
// (byte) bitmap_line_ydxd::yd#0 = (byte) bitmap_line::yd#0 // register copy zp ZP_BYTE:3
|
||||
//SEG86 [49] (byte) bitmap_line_ydxd::xd#0 ← (byte) bitmap_line::xd#1
|
||||
// (byte) bitmap_line_ydxd::xd#0 = (byte) bitmap_line::xd#1 // register copy zp ZP_BYTE:4
|
||||
//SEG87 [50] call bitmap_line_ydxd
|
||||
//SEG88 [139] phi from bitmap_line::@20 to bitmap_line_ydxd [phi:bitmap_line::@20->bitmap_line_ydxd]
|
||||
bitmap_line_ydxd_from_b20:
|
||||
@ -4501,9 +4497,7 @@ bitmap_line: {
|
||||
lda x0
|
||||
sta bitmap_line_xdyd.x1
|
||||
//SEG98 [54] (byte) bitmap_line_xdyd::xd#0 ← (byte) bitmap_line::xd#1
|
||||
// (byte) bitmap_line_xdyd::xd#0 = (byte) bitmap_line::xd#1 // register copy zp ZP_BYTE:4
|
||||
//SEG99 [55] (byte) bitmap_line_xdyd::yd#0 ← (byte) bitmap_line::yd#0
|
||||
// (byte) bitmap_line_xdyd::yd#0 = (byte) bitmap_line::yd#0 // register copy zp ZP_BYTE:3
|
||||
//SEG100 [56] call bitmap_line_xdyd
|
||||
//SEG101 [124] phi from bitmap_line::@6 to bitmap_line_xdyd [phi:bitmap_line::@6->bitmap_line_xdyd]
|
||||
bitmap_line_xdyd_from_b6:
|
||||
@ -4548,11 +4542,8 @@ bitmap_line: {
|
||||
//SEG115 [62] (byte) bitmap_line_ydxd::x#1 ← (byte) bitmap_line::x1#0 -- vbuxx=vbuz1
|
||||
ldx x1
|
||||
//SEG116 [63] (byte) bitmap_line_ydxd::y1#1 ← (byte) bitmap_line::y0#0
|
||||
// (byte) bitmap_line_ydxd::y1#1 = (byte) bitmap_line::y0#0 // register copy zp ZP_BYTE:6
|
||||
//SEG117 [64] (byte) bitmap_line_ydxd::yd#1 ← (byte) bitmap_line::yd#3
|
||||
// (byte) bitmap_line_ydxd::yd#1 = (byte) bitmap_line::yd#3 // register copy zp ZP_BYTE:3
|
||||
//SEG118 [65] (byte) bitmap_line_ydxd::xd#1 ← (byte) bitmap_line::xd#0
|
||||
// (byte) bitmap_line_ydxd::xd#1 = (byte) bitmap_line::xd#0 // register copy zp ZP_BYTE:4
|
||||
//SEG119 [66] call bitmap_line_ydxd
|
||||
//SEG120 [139] phi from bitmap_line::@24 to bitmap_line_ydxd [phi:bitmap_line::@24->bitmap_line_ydxd]
|
||||
bitmap_line_ydxd_from_b24:
|
||||
@ -4568,13 +4559,9 @@ bitmap_line: {
|
||||
//SEG127 [67] (byte) bitmap_line_xdyd::x#1 ← (byte) bitmap_line::x0#0 -- vbuxx=vbuz1
|
||||
ldx x0
|
||||
//SEG128 [68] (byte) bitmap_line_xdyd::y#1 ← (byte) bitmap_line::y0#0
|
||||
// (byte) bitmap_line_xdyd::y#1 = (byte) bitmap_line::y0#0 // register copy zp ZP_BYTE:6
|
||||
//SEG129 [69] (byte) bitmap_line_xdyd::x1#1 ← (byte) bitmap_line::x1#0
|
||||
// (byte) bitmap_line_xdyd::x1#1 = (byte) bitmap_line::x1#0 // register copy zp ZP_BYTE:8
|
||||
//SEG130 [70] (byte) bitmap_line_xdyd::xd#1 ← (byte) bitmap_line::xd#0
|
||||
// (byte) bitmap_line_xdyd::xd#1 = (byte) bitmap_line::xd#0 // register copy zp ZP_BYTE:4
|
||||
//SEG131 [71] (byte) bitmap_line_xdyd::yd#1 ← (byte) bitmap_line::yd#3
|
||||
// (byte) bitmap_line_xdyd::yd#1 = (byte) bitmap_line::yd#3 // register copy zp ZP_BYTE:3
|
||||
//SEG132 [72] call bitmap_line_xdyd
|
||||
//SEG133 [124] phi from bitmap_line::@10 to bitmap_line_xdyd [phi:bitmap_line::@10->bitmap_line_xdyd]
|
||||
bitmap_line_xdyd_from_b10:
|
||||
@ -4607,9 +4594,7 @@ bitmap_line: {
|
||||
//SEG145 [77] (byte) bitmap_line_ydxi::y1#1 ← (byte) bitmap_line::y1#0 -- vbuz1=vbuyy
|
||||
sty bitmap_line_ydxi.y1
|
||||
//SEG146 [78] (byte) bitmap_line_ydxi::yd#1 ← (byte) bitmap_line::yd#10
|
||||
// (byte) bitmap_line_ydxi::yd#1 = (byte) bitmap_line::yd#10 // register copy zp ZP_BYTE:3
|
||||
//SEG147 [79] (byte) bitmap_line_ydxi::xd#1 ← (byte) bitmap_line::xd#0
|
||||
// (byte) bitmap_line_ydxi::xd#1 = (byte) bitmap_line::xd#0 // register copy zp ZP_BYTE:4
|
||||
//SEG148 [80] call bitmap_line_ydxi
|
||||
//SEG149 [109] phi from bitmap_line::@27 to bitmap_line_ydxi [phi:bitmap_line::@27->bitmap_line_ydxi]
|
||||
bitmap_line_ydxi_from_b27:
|
||||
@ -4625,14 +4610,11 @@ bitmap_line: {
|
||||
//SEG156 [81] (byte) bitmap_line_xdyi::x#1 ← (byte) bitmap_line::x0#0 -- vbuxx=vbuz1
|
||||
ldx x0
|
||||
//SEG157 [82] (byte) bitmap_line_xdyi::y#1 ← (byte) bitmap_line::y0#0
|
||||
// (byte) bitmap_line_xdyi::y#1 = (byte) bitmap_line::y0#0 // register copy zp ZP_BYTE:6
|
||||
//SEG158 [83] (byte) bitmap_line_xdyi::x1#1 ← (byte) bitmap_line::x1#0 -- vbuz1=vbuz2
|
||||
lda x1
|
||||
sta bitmap_line_xdyi.x1
|
||||
//SEG159 [84] (byte) bitmap_line_xdyi::xd#1 ← (byte) bitmap_line::xd#0
|
||||
// (byte) bitmap_line_xdyi::xd#1 = (byte) bitmap_line::xd#0 // register copy zp ZP_BYTE:4
|
||||
//SEG160 [85] (byte) bitmap_line_xdyi::yd#1 ← (byte) bitmap_line::yd#10
|
||||
// (byte) bitmap_line_xdyi::yd#1 = (byte) bitmap_line::yd#10 // register copy zp ZP_BYTE:3
|
||||
//SEG161 [86] call bitmap_line_xdyi
|
||||
//SEG162 [87] phi from bitmap_line::@13 to bitmap_line_xdyi [phi:bitmap_line::@13->bitmap_line_xdyi]
|
||||
bitmap_line_xdyi_from_b13:
|
||||
@ -4666,7 +4648,6 @@ bitmap_line_xdyi: {
|
||||
//SEG174 bitmap_line_xdyi::@1
|
||||
b1:
|
||||
//SEG175 [90] (byte) bitmap_plot::x#0 ← (byte) bitmap_line_xdyi::x#3
|
||||
// (byte) bitmap_plot::x#0 = (byte) bitmap_line_xdyi::x#3 // register copy reg byte x
|
||||
//SEG176 [91] (byte) bitmap_plot::y#0 ← (byte) bitmap_line_xdyi::y#3 -- vbuyy=vbuz1
|
||||
ldy y
|
||||
//SEG177 [92] call bitmap_plot
|
||||
@ -4777,7 +4758,6 @@ bitmap_line_ydxi: {
|
||||
//SEG210 bitmap_line_ydxi::@1
|
||||
b1:
|
||||
//SEG211 [112] (byte) bitmap_plot::x#2 ← (byte) bitmap_line_ydxi::x#3
|
||||
// (byte) bitmap_plot::x#2 = (byte) bitmap_line_ydxi::x#3 // register copy reg byte x
|
||||
//SEG212 [113] (byte) bitmap_plot::y#2 ← (byte) bitmap_line_ydxi::y#3 -- vbuyy=vbuz1
|
||||
ldy y
|
||||
//SEG213 [114] call bitmap_plot
|
||||
@ -4852,7 +4832,6 @@ bitmap_line_xdyd: {
|
||||
//SEG238 bitmap_line_xdyd::@1
|
||||
b1:
|
||||
//SEG239 [127] (byte) bitmap_plot::x#1 ← (byte) bitmap_line_xdyd::x#3
|
||||
// (byte) bitmap_plot::x#1 = (byte) bitmap_line_xdyd::x#3 // register copy reg byte x
|
||||
//SEG240 [128] (byte) bitmap_plot::y#1 ← (byte) bitmap_line_xdyd::y#3 -- vbuyy=vbuz1
|
||||
ldy y
|
||||
//SEG241 [129] call bitmap_plot
|
||||
@ -4927,7 +4906,6 @@ bitmap_line_ydxd: {
|
||||
//SEG266 bitmap_line_ydxd::@1
|
||||
b1:
|
||||
//SEG267 [142] (byte) bitmap_plot::x#3 ← (byte) bitmap_line_ydxd::x#3
|
||||
// (byte) bitmap_plot::x#3 = (byte) bitmap_line_ydxd::x#3 // register copy reg byte x
|
||||
//SEG268 [143] (byte) bitmap_plot::y#3 ← (byte) bitmap_line_ydxd::y#2 -- vbuyy=vbuz1
|
||||
ldy y
|
||||
//SEG269 [144] call bitmap_plot
|
||||
@ -5020,6 +4998,7 @@ init_screen: {
|
||||
rts
|
||||
}
|
||||
//SEG299 bitmap_clear
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = 9
|
||||
.label y = 2
|
||||
@ -5030,7 +5009,6 @@ bitmap_clear: {
|
||||
lda bitmap_plot_xhi
|
||||
sta _3+1
|
||||
//SEG301 [161] (byte*~) bitmap_clear::bitmap#5 ← (byte*)(word~) bitmap_clear::$3
|
||||
// (byte*~) bitmap_clear::bitmap#5 = (byte*)(word~) bitmap_clear::$3 // register copy zp ZP_WORD:9
|
||||
//SEG302 [162] phi from bitmap_clear to bitmap_clear::@1 [phi:bitmap_clear->bitmap_clear::@1]
|
||||
b1_from_bitmap_clear:
|
||||
//SEG303 [162] phi (byte) bitmap_clear::y#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bitmap_clear->bitmap_clear::@1#0] -- vbuz1=vbuc1
|
||||
@ -5088,6 +5066,7 @@ bitmap_clear: {
|
||||
rts
|
||||
}
|
||||
//SEG325 bitmap_init
|
||||
// Initialize the bitmap plotter tables for a specific bitmap
|
||||
bitmap_init: {
|
||||
.label _6 = 2
|
||||
.label yoffs = 9
|
||||
@ -5911,6 +5890,7 @@ lines: {
|
||||
rts
|
||||
}
|
||||
//SEG42 bitmap_line
|
||||
// Draw a line on the bitmap
|
||||
bitmap_line: {
|
||||
.label xd = 4
|
||||
.label yd = 3
|
||||
@ -5948,11 +5928,8 @@ bitmap_line: {
|
||||
//SEG52 [31] (byte) bitmap_line_ydxi::x#0 ← (byte) bitmap_line::x1#0 -- vbuxx=vbuz1
|
||||
ldx x1
|
||||
//SEG53 [32] (byte) bitmap_line_ydxi::y1#0 ← (byte) bitmap_line::y0#0
|
||||
// (byte) bitmap_line_ydxi::y1#0 = (byte) bitmap_line::y0#0 // register copy zp ZP_BYTE:6
|
||||
//SEG54 [33] (byte) bitmap_line_ydxi::yd#0 ← (byte) bitmap_line::yd#1
|
||||
// (byte) bitmap_line_ydxi::yd#0 = (byte) bitmap_line::yd#1 // register copy zp ZP_BYTE:3
|
||||
//SEG55 [34] (byte) bitmap_line_ydxi::xd#0 ← (byte) bitmap_line::xd#1
|
||||
// (byte) bitmap_line_ydxi::xd#0 = (byte) bitmap_line::xd#1 // register copy zp ZP_BYTE:4
|
||||
//SEG56 [35] call bitmap_line_ydxi
|
||||
//SEG57 [109] phi from bitmap_line::@17 to bitmap_line_ydxi [phi:bitmap_line::@17->bitmap_line_ydxi]
|
||||
//SEG58 [109] phi (byte) bitmap_line_ydxi::y1#6 = (byte) bitmap_line_ydxi::y1#0 [phi:bitmap_line::@17->bitmap_line_ydxi#0] -- register_copy
|
||||
@ -5972,11 +5949,8 @@ bitmap_line: {
|
||||
//SEG67 [38] (byte) bitmap_line_xdyi::y#0 ← (byte) bitmap_line::y1#0 -- vbuz1=vbuyy
|
||||
sty bitmap_line_xdyi.y
|
||||
//SEG68 [39] (byte) bitmap_line_xdyi::x1#0 ← (byte) bitmap_line::x0#0
|
||||
// (byte) bitmap_line_xdyi::x1#0 = (byte) bitmap_line::x0#0 // register copy zp ZP_BYTE:5
|
||||
//SEG69 [40] (byte) bitmap_line_xdyi::xd#0 ← (byte) bitmap_line::xd#1
|
||||
// (byte) bitmap_line_xdyi::xd#0 = (byte) bitmap_line::xd#1 // register copy zp ZP_BYTE:4
|
||||
//SEG70 [41] (byte) bitmap_line_xdyi::yd#0 ← (byte) bitmap_line::yd#1
|
||||
// (byte) bitmap_line_xdyi::yd#0 = (byte) bitmap_line::yd#1 // register copy zp ZP_BYTE:3
|
||||
//SEG71 [42] call bitmap_line_xdyi
|
||||
//SEG72 [87] phi from bitmap_line::@3 to bitmap_line_xdyi [phi:bitmap_line::@3->bitmap_line_xdyi]
|
||||
//SEG73 [87] phi (byte) bitmap_line_xdyi::x1#6 = (byte) bitmap_line_xdyi::x1#0 [phi:bitmap_line::@3->bitmap_line_xdyi#0] -- register_copy
|
||||
@ -6005,9 +5979,7 @@ bitmap_line: {
|
||||
//SEG84 [47] (byte) bitmap_line_ydxd::y1#0 ← (byte) bitmap_line::y1#0 -- vbuz1=vbuyy
|
||||
sty bitmap_line_ydxd.y1
|
||||
//SEG85 [48] (byte) bitmap_line_ydxd::yd#0 ← (byte) bitmap_line::yd#0
|
||||
// (byte) bitmap_line_ydxd::yd#0 = (byte) bitmap_line::yd#0 // register copy zp ZP_BYTE:3
|
||||
//SEG86 [49] (byte) bitmap_line_ydxd::xd#0 ← (byte) bitmap_line::xd#1
|
||||
// (byte) bitmap_line_ydxd::xd#0 = (byte) bitmap_line::xd#1 // register copy zp ZP_BYTE:4
|
||||
//SEG87 [50] call bitmap_line_ydxd
|
||||
//SEG88 [139] phi from bitmap_line::@20 to bitmap_line_ydxd [phi:bitmap_line::@20->bitmap_line_ydxd]
|
||||
//SEG89 [139] phi (byte) bitmap_line_ydxd::y1#6 = (byte) bitmap_line_ydxd::y1#0 [phi:bitmap_line::@20->bitmap_line_ydxd#0] -- register_copy
|
||||
@ -6027,9 +5999,7 @@ bitmap_line: {
|
||||
lda x0
|
||||
sta bitmap_line_xdyd.x1
|
||||
//SEG98 [54] (byte) bitmap_line_xdyd::xd#0 ← (byte) bitmap_line::xd#1
|
||||
// (byte) bitmap_line_xdyd::xd#0 = (byte) bitmap_line::xd#1 // register copy zp ZP_BYTE:4
|
||||
//SEG99 [55] (byte) bitmap_line_xdyd::yd#0 ← (byte) bitmap_line::yd#0
|
||||
// (byte) bitmap_line_xdyd::yd#0 = (byte) bitmap_line::yd#0 // register copy zp ZP_BYTE:3
|
||||
//SEG100 [56] call bitmap_line_xdyd
|
||||
//SEG101 [124] phi from bitmap_line::@6 to bitmap_line_xdyd [phi:bitmap_line::@6->bitmap_line_xdyd]
|
||||
//SEG102 [124] phi (byte) bitmap_line_xdyd::x1#6 = (byte) bitmap_line_xdyd::x1#0 [phi:bitmap_line::@6->bitmap_line_xdyd#0] -- register_copy
|
||||
@ -6068,11 +6038,8 @@ bitmap_line: {
|
||||
//SEG115 [62] (byte) bitmap_line_ydxd::x#1 ← (byte) bitmap_line::x1#0 -- vbuxx=vbuz1
|
||||
ldx x1
|
||||
//SEG116 [63] (byte) bitmap_line_ydxd::y1#1 ← (byte) bitmap_line::y0#0
|
||||
// (byte) bitmap_line_ydxd::y1#1 = (byte) bitmap_line::y0#0 // register copy zp ZP_BYTE:6
|
||||
//SEG117 [64] (byte) bitmap_line_ydxd::yd#1 ← (byte) bitmap_line::yd#3
|
||||
// (byte) bitmap_line_ydxd::yd#1 = (byte) bitmap_line::yd#3 // register copy zp ZP_BYTE:3
|
||||
//SEG118 [65] (byte) bitmap_line_ydxd::xd#1 ← (byte) bitmap_line::xd#0
|
||||
// (byte) bitmap_line_ydxd::xd#1 = (byte) bitmap_line::xd#0 // register copy zp ZP_BYTE:4
|
||||
//SEG119 [66] call bitmap_line_ydxd
|
||||
//SEG120 [139] phi from bitmap_line::@24 to bitmap_line_ydxd [phi:bitmap_line::@24->bitmap_line_ydxd]
|
||||
//SEG121 [139] phi (byte) bitmap_line_ydxd::y1#6 = (byte) bitmap_line_ydxd::y1#1 [phi:bitmap_line::@24->bitmap_line_ydxd#0] -- register_copy
|
||||
@ -6087,13 +6054,9 @@ bitmap_line: {
|
||||
//SEG127 [67] (byte) bitmap_line_xdyd::x#1 ← (byte) bitmap_line::x0#0 -- vbuxx=vbuz1
|
||||
ldx x0
|
||||
//SEG128 [68] (byte) bitmap_line_xdyd::y#1 ← (byte) bitmap_line::y0#0
|
||||
// (byte) bitmap_line_xdyd::y#1 = (byte) bitmap_line::y0#0 // register copy zp ZP_BYTE:6
|
||||
//SEG129 [69] (byte) bitmap_line_xdyd::x1#1 ← (byte) bitmap_line::x1#0
|
||||
// (byte) bitmap_line_xdyd::x1#1 = (byte) bitmap_line::x1#0 // register copy zp ZP_BYTE:8
|
||||
//SEG130 [70] (byte) bitmap_line_xdyd::xd#1 ← (byte) bitmap_line::xd#0
|
||||
// (byte) bitmap_line_xdyd::xd#1 = (byte) bitmap_line::xd#0 // register copy zp ZP_BYTE:4
|
||||
//SEG131 [71] (byte) bitmap_line_xdyd::yd#1 ← (byte) bitmap_line::yd#3
|
||||
// (byte) bitmap_line_xdyd::yd#1 = (byte) bitmap_line::yd#3 // register copy zp ZP_BYTE:3
|
||||
//SEG132 [72] call bitmap_line_xdyd
|
||||
//SEG133 [124] phi from bitmap_line::@10 to bitmap_line_xdyd [phi:bitmap_line::@10->bitmap_line_xdyd]
|
||||
//SEG134 [124] phi (byte) bitmap_line_xdyd::x1#6 = (byte) bitmap_line_xdyd::x1#1 [phi:bitmap_line::@10->bitmap_line_xdyd#0] -- register_copy
|
||||
@ -6122,9 +6085,7 @@ bitmap_line: {
|
||||
//SEG145 [77] (byte) bitmap_line_ydxi::y1#1 ← (byte) bitmap_line::y1#0 -- vbuz1=vbuyy
|
||||
sty bitmap_line_ydxi.y1
|
||||
//SEG146 [78] (byte) bitmap_line_ydxi::yd#1 ← (byte) bitmap_line::yd#10
|
||||
// (byte) bitmap_line_ydxi::yd#1 = (byte) bitmap_line::yd#10 // register copy zp ZP_BYTE:3
|
||||
//SEG147 [79] (byte) bitmap_line_ydxi::xd#1 ← (byte) bitmap_line::xd#0
|
||||
// (byte) bitmap_line_ydxi::xd#1 = (byte) bitmap_line::xd#0 // register copy zp ZP_BYTE:4
|
||||
//SEG148 [80] call bitmap_line_ydxi
|
||||
//SEG149 [109] phi from bitmap_line::@27 to bitmap_line_ydxi [phi:bitmap_line::@27->bitmap_line_ydxi]
|
||||
//SEG150 [109] phi (byte) bitmap_line_ydxi::y1#6 = (byte) bitmap_line_ydxi::y1#1 [phi:bitmap_line::@27->bitmap_line_ydxi#0] -- register_copy
|
||||
@ -6139,14 +6100,11 @@ bitmap_line: {
|
||||
//SEG156 [81] (byte) bitmap_line_xdyi::x#1 ← (byte) bitmap_line::x0#0 -- vbuxx=vbuz1
|
||||
ldx x0
|
||||
//SEG157 [82] (byte) bitmap_line_xdyi::y#1 ← (byte) bitmap_line::y0#0
|
||||
// (byte) bitmap_line_xdyi::y#1 = (byte) bitmap_line::y0#0 // register copy zp ZP_BYTE:6
|
||||
//SEG158 [83] (byte) bitmap_line_xdyi::x1#1 ← (byte) bitmap_line::x1#0 -- vbuz1=vbuz2
|
||||
lda x1
|
||||
sta bitmap_line_xdyi.x1
|
||||
//SEG159 [84] (byte) bitmap_line_xdyi::xd#1 ← (byte) bitmap_line::xd#0
|
||||
// (byte) bitmap_line_xdyi::xd#1 = (byte) bitmap_line::xd#0 // register copy zp ZP_BYTE:4
|
||||
//SEG160 [85] (byte) bitmap_line_xdyi::yd#1 ← (byte) bitmap_line::yd#10
|
||||
// (byte) bitmap_line_xdyi::yd#1 = (byte) bitmap_line::yd#10 // register copy zp ZP_BYTE:3
|
||||
//SEG161 [86] call bitmap_line_xdyi
|
||||
//SEG162 [87] phi from bitmap_line::@13 to bitmap_line_xdyi [phi:bitmap_line::@13->bitmap_line_xdyi]
|
||||
//SEG163 [87] phi (byte) bitmap_line_xdyi::x1#6 = (byte) bitmap_line_xdyi::x1#1 [phi:bitmap_line::@13->bitmap_line_xdyi#0] -- register_copy
|
||||
@ -6176,7 +6134,6 @@ bitmap_line_xdyi: {
|
||||
//SEG174 bitmap_line_xdyi::@1
|
||||
b1:
|
||||
//SEG175 [90] (byte) bitmap_plot::x#0 ← (byte) bitmap_line_xdyi::x#3
|
||||
// (byte) bitmap_plot::x#0 = (byte) bitmap_line_xdyi::x#3 // register copy reg byte x
|
||||
//SEG176 [91] (byte) bitmap_plot::y#0 ← (byte) bitmap_line_xdyi::y#3 -- vbuyy=vbuz1
|
||||
ldy y
|
||||
//SEG177 [92] call bitmap_plot
|
||||
@ -6271,7 +6228,6 @@ bitmap_line_ydxi: {
|
||||
//SEG210 bitmap_line_ydxi::@1
|
||||
b1:
|
||||
//SEG211 [112] (byte) bitmap_plot::x#2 ← (byte) bitmap_line_ydxi::x#3
|
||||
// (byte) bitmap_plot::x#2 = (byte) bitmap_line_ydxi::x#3 // register copy reg byte x
|
||||
//SEG212 [113] (byte) bitmap_plot::y#2 ← (byte) bitmap_line_ydxi::y#3 -- vbuyy=vbuz1
|
||||
ldy y
|
||||
//SEG213 [114] call bitmap_plot
|
||||
@ -6333,7 +6289,6 @@ bitmap_line_xdyd: {
|
||||
//SEG238 bitmap_line_xdyd::@1
|
||||
b1:
|
||||
//SEG239 [127] (byte) bitmap_plot::x#1 ← (byte) bitmap_line_xdyd::x#3
|
||||
// (byte) bitmap_plot::x#1 = (byte) bitmap_line_xdyd::x#3 // register copy reg byte x
|
||||
//SEG240 [128] (byte) bitmap_plot::y#1 ← (byte) bitmap_line_xdyd::y#3 -- vbuyy=vbuz1
|
||||
ldy y
|
||||
//SEG241 [129] call bitmap_plot
|
||||
@ -6395,7 +6350,6 @@ bitmap_line_ydxd: {
|
||||
//SEG266 bitmap_line_ydxd::@1
|
||||
b1:
|
||||
//SEG267 [142] (byte) bitmap_plot::x#3 ← (byte) bitmap_line_ydxd::x#3
|
||||
// (byte) bitmap_plot::x#3 = (byte) bitmap_line_ydxd::x#3 // register copy reg byte x
|
||||
//SEG268 [143] (byte) bitmap_plot::y#3 ← (byte) bitmap_line_ydxd::y#2 -- vbuyy=vbuz1
|
||||
ldy y
|
||||
//SEG269 [144] call bitmap_plot
|
||||
@ -6472,6 +6426,7 @@ init_screen: {
|
||||
rts
|
||||
}
|
||||
//SEG299 bitmap_clear
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = 9
|
||||
.label y = 2
|
||||
@ -6482,7 +6437,6 @@ bitmap_clear: {
|
||||
lda bitmap_plot_xhi
|
||||
sta _3+1
|
||||
//SEG301 [161] (byte*~) bitmap_clear::bitmap#5 ← (byte*)(word~) bitmap_clear::$3
|
||||
// (byte*~) bitmap_clear::bitmap#5 = (byte*)(word~) bitmap_clear::$3 // register copy zp ZP_WORD:9
|
||||
//SEG302 [162] phi from bitmap_clear to bitmap_clear::@1 [phi:bitmap_clear->bitmap_clear::@1]
|
||||
//SEG303 [162] phi (byte) bitmap_clear::y#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bitmap_clear->bitmap_clear::@1#0] -- vbuz1=vbuc1
|
||||
lda #0
|
||||
@ -6528,6 +6482,7 @@ bitmap_clear: {
|
||||
rts
|
||||
}
|
||||
//SEG325 bitmap_init
|
||||
// Initialize the bitmap plotter tables for a specific bitmap
|
||||
bitmap_init: {
|
||||
.label _6 = 2
|
||||
.label yoffs = 9
|
||||
|
@ -206,6 +206,7 @@ main: {
|
||||
str2: .text "f5@"
|
||||
str3: .text "f7@"
|
||||
}
|
||||
// Render 8x8 char (ch) as pixels on char canvas #pos
|
||||
plot_chargen: {
|
||||
.label _0 = 2
|
||||
.label _1 = 2
|
||||
@ -296,6 +297,8 @@ 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
|
||||
.label mb = $b
|
||||
@ -332,6 +335,10 @@ mul8u: {
|
||||
rol mb+1
|
||||
jmp b1
|
||||
}
|
||||
// Determines whether a specific key is currently pressed by accessing the matrix directly
|
||||
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
|
||||
// All keys exist as as KEY_XXX constants.
|
||||
// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed
|
||||
keyboard_key_pressed: {
|
||||
txa
|
||||
and #7
|
||||
@ -345,6 +352,11 @@ keyboard_key_pressed: {
|
||||
and keyboard_matrix_col_bitmask,y
|
||||
rts
|
||||
}
|
||||
// Read a single row of the keyboard matrix
|
||||
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
|
||||
// Returns the keys pressed on the row as bits according to the C64 key matrix.
|
||||
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
|
||||
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
|
||||
keyboard_matrix_read: {
|
||||
lda keyboard_matrix_row_bitmask,x
|
||||
sta CIA1_PORT_A
|
||||
@ -352,10 +364,15 @@ keyboard_matrix_read: {
|
||||
eor #$ff
|
||||
rts
|
||||
}
|
||||
// Get the keycode corresponding to a specific screen code character
|
||||
// ch is the character to get the key code for ($00-$3f)
|
||||
// Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled.
|
||||
// If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) .
|
||||
keyboard_get_keycode: {
|
||||
lda keyboard_char_keycodes,x
|
||||
rts
|
||||
}
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = 9
|
||||
.label str = 2
|
||||
|
@ -3142,6 +3142,7 @@ main: {
|
||||
str3: .text "f7@"
|
||||
}
|
||||
//SEG168 plot_chargen
|
||||
// Render 8x8 char (ch) as pixels on char canvas #pos
|
||||
plot_chargen: {
|
||||
.label _0 = $2c
|
||||
.label _1 = $2e
|
||||
@ -3345,6 +3346,8 @@ plot_chargen: {
|
||||
rts
|
||||
}
|
||||
//SEG227 mul8u
|
||||
// Simple binary multiplication implementation
|
||||
// Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word
|
||||
mul8u: {
|
||||
.const b = $a
|
||||
.label _1 = $35
|
||||
@ -3418,6 +3421,10 @@ mul8u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG250 keyboard_key_pressed
|
||||
// Determines whether a specific key is currently pressed by accessing the matrix directly
|
||||
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
|
||||
// All keys exist as as KEY_XXX constants.
|
||||
// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed
|
||||
keyboard_key_pressed: {
|
||||
.label _2 = $3a
|
||||
.label colidx = $36
|
||||
@ -3466,6 +3473,11 @@ keyboard_key_pressed: {
|
||||
rts
|
||||
}
|
||||
//SEG261 keyboard_matrix_read
|
||||
// Read a single row of the keyboard matrix
|
||||
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
|
||||
// Returns the keys pressed on the row as bits according to the C64 key matrix.
|
||||
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
|
||||
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
|
||||
keyboard_matrix_read: {
|
||||
.label return = $3c
|
||||
.label rowid = $38
|
||||
@ -3485,6 +3497,10 @@ keyboard_matrix_read: {
|
||||
rts
|
||||
}
|
||||
//SEG266 keyboard_get_keycode
|
||||
// Get the keycode corresponding to a specific screen code character
|
||||
// ch is the character to get the key code for ($00-$3f)
|
||||
// Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled.
|
||||
// If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) .
|
||||
keyboard_get_keycode: {
|
||||
.label return = $3d
|
||||
.label ch = $28
|
||||
@ -3500,6 +3516,7 @@ keyboard_get_keycode: {
|
||||
rts
|
||||
}
|
||||
//SEG270 print_str_at
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = $1c
|
||||
.label str = $1a
|
||||
@ -3985,12 +4002,10 @@ main: {
|
||||
ldx #KEY_F1
|
||||
jsr keyboard_key_pressed
|
||||
//SEG62 [24] (byte) keyboard_key_pressed::return#2 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#2 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
jmp b30
|
||||
//SEG63 main::@30
|
||||
b30:
|
||||
//SEG64 [25] (byte~) main::$15 ← (byte) keyboard_key_pressed::return#2
|
||||
// (byte~) main::$15 = (byte) keyboard_key_pressed::return#2 // register copy reg byte a
|
||||
//SEG65 [26] if((byte~) main::$15==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@41 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq b41_from_b30
|
||||
@ -4009,12 +4024,10 @@ main: {
|
||||
ldx #KEY_F3
|
||||
jsr keyboard_key_pressed
|
||||
//SEG72 [29] (byte) keyboard_key_pressed::return#10 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#10 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
jmp b31
|
||||
//SEG73 main::@31
|
||||
b31:
|
||||
//SEG74 [30] (byte~) main::$18 ← (byte) keyboard_key_pressed::return#10
|
||||
// (byte~) main::$18 = (byte) keyboard_key_pressed::return#10 // register copy reg byte a
|
||||
//SEG75 [31] if((byte~) main::$18==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@42 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq b42_from_b31
|
||||
@ -4033,12 +4046,10 @@ main: {
|
||||
ldx #KEY_F5
|
||||
jsr keyboard_key_pressed
|
||||
//SEG82 [34] (byte) keyboard_key_pressed::return#11 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#11 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
jmp b32
|
||||
//SEG83 main::@32
|
||||
b32:
|
||||
//SEG84 [35] (byte~) main::$21 ← (byte) keyboard_key_pressed::return#11
|
||||
// (byte~) main::$21 = (byte) keyboard_key_pressed::return#11 // register copy reg byte a
|
||||
//SEG85 [36] if((byte~) main::$21==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@43 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq b43_from_b32
|
||||
@ -4057,12 +4068,10 @@ main: {
|
||||
ldx #KEY_F7
|
||||
jsr keyboard_key_pressed
|
||||
//SEG92 [39] (byte) keyboard_key_pressed::return#12 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#12 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
jmp b33
|
||||
//SEG93 main::@33
|
||||
b33:
|
||||
//SEG94 [40] (byte~) main::$24 ← (byte) keyboard_key_pressed::return#12
|
||||
// (byte~) main::$24 = (byte) keyboard_key_pressed::return#12 // register copy reg byte a
|
||||
//SEG95 [41] if((byte~) main::$24==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@44 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq b44_from_b33
|
||||
@ -4081,12 +4090,10 @@ main: {
|
||||
ldx #KEY_LSHIFT
|
||||
jsr keyboard_key_pressed
|
||||
//SEG102 [44] (byte) keyboard_key_pressed::return#13 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#13 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
jmp b34
|
||||
//SEG103 main::@34
|
||||
b34:
|
||||
//SEG104 [45] (byte~) main::$27 ← (byte) keyboard_key_pressed::return#13
|
||||
// (byte~) main::$27 = (byte) keyboard_key_pressed::return#13 // register copy reg byte a
|
||||
//SEG105 [46] if((byte~) main::$27!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@9 -- vbuaa_neq_0_then_la1
|
||||
cmp #0
|
||||
bne b9_from_b34
|
||||
@ -4126,12 +4133,10 @@ main: {
|
||||
//SEG119 [51] call keyboard_get_keycode
|
||||
jsr keyboard_get_keycode
|
||||
//SEG120 [52] (byte) keyboard_get_keycode::return#2 ← (byte) keyboard_get_keycode::return#0
|
||||
// (byte) keyboard_get_keycode::return#2 = (byte) keyboard_get_keycode::return#0 // register copy reg byte a
|
||||
jmp b35
|
||||
//SEG121 main::@35
|
||||
b35:
|
||||
//SEG122 [53] (byte) main::key#0 ← (byte) keyboard_get_keycode::return#2
|
||||
// (byte) main::key#0 = (byte) keyboard_get_keycode::return#2 // register copy reg byte a
|
||||
//SEG123 [54] if((byte) main::key#0==(byte/signed byte/word/signed word/dword/signed dword) 63) goto main::@11 -- vbuaa_eq_vbuc1_then_la1
|
||||
cmp #$3f
|
||||
beq b11_from_b35
|
||||
@ -4146,12 +4151,10 @@ main: {
|
||||
//SEG128 [113] phi (byte) keyboard_key_pressed::key#6 = (byte) keyboard_key_pressed::key#5 [phi:main::@21->keyboard_key_pressed#0] -- register_copy
|
||||
jsr keyboard_key_pressed
|
||||
//SEG129 [57] (byte) keyboard_key_pressed::return#14 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#14 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
jmp b36
|
||||
//SEG130 main::@36
|
||||
b36:
|
||||
//SEG131 [58] (byte) main::pressed#1 ← (byte) keyboard_key_pressed::return#14
|
||||
// (byte) main::pressed#1 = (byte) keyboard_key_pressed::return#14 // register copy reg byte a
|
||||
//SEG132 [59] phi from main::@36 to main::@11 [phi:main::@36->main::@11]
|
||||
b11_from_b36:
|
||||
//SEG133 [59] phi (byte) main::pressed#2 = (byte) main::pressed#1 [phi:main::@36->main::@11#0] -- register_copy
|
||||
@ -4237,6 +4240,7 @@ main: {
|
||||
str3: .text "f7@"
|
||||
}
|
||||
//SEG168 plot_chargen
|
||||
// Render 8x8 char (ch) as pixels on char canvas #pos
|
||||
plot_chargen: {
|
||||
.label _0 = 2
|
||||
.label _1 = 2
|
||||
@ -4298,12 +4302,10 @@ plot_chargen: {
|
||||
mul8u_from_b1:
|
||||
jsr mul8u
|
||||
//SEG183 [82] (word) mul8u::return#2 ← (word) mul8u::res#2
|
||||
// (word) mul8u::return#2 = (word) mul8u::res#2 // register copy zp ZP_WORD:9
|
||||
jmp b9
|
||||
//SEG184 plot_chargen::@9
|
||||
b9:
|
||||
//SEG185 [83] (word~) plot_chargen::$8 ← (word) mul8u::return#2
|
||||
// (word~) plot_chargen::$8 = (word) mul8u::return#2 // register copy zp ZP_WORD:9
|
||||
//SEG186 [84] (byte*) plot_chargen::sc#0 ← (const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 40+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word~) plot_chargen::$8 -- pbuz1=pbuc1_plus_vwuz1
|
||||
clc
|
||||
lda sc
|
||||
@ -4415,6 +4417,8 @@ plot_chargen: {
|
||||
rts
|
||||
}
|
||||
//SEG227 mul8u
|
||||
// Simple binary multiplication implementation
|
||||
// Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word
|
||||
mul8u: {
|
||||
.const b = $a
|
||||
.label mb = $b
|
||||
@ -4485,6 +4489,10 @@ mul8u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG250 keyboard_key_pressed
|
||||
// Determines whether a specific key is currently pressed by accessing the matrix directly
|
||||
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
|
||||
// All keys exist as as KEY_XXX constants.
|
||||
// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed
|
||||
keyboard_key_pressed: {
|
||||
//SEG251 [114] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#6 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuyy=vbuxx_band_vbuc1
|
||||
txa
|
||||
@ -4500,12 +4508,10 @@ keyboard_key_pressed: {
|
||||
//SEG254 [117] call keyboard_matrix_read
|
||||
jsr keyboard_matrix_read
|
||||
//SEG255 [118] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0
|
||||
// (byte) keyboard_matrix_read::return#2 = (byte) keyboard_matrix_read::return#0 // register copy reg byte a
|
||||
jmp b2
|
||||
//SEG256 keyboard_key_pressed::@2
|
||||
b2:
|
||||
//SEG257 [119] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_matrix_read::return#2
|
||||
// (byte~) keyboard_key_pressed::$2 = (byte) keyboard_matrix_read::return#2 // register copy reg byte a
|
||||
//SEG258 [120] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$2 & *((const byte[8]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_key_pressed::colidx#0) -- vbuaa=vbuaa_band_pbuc1_derefidx_vbuyy
|
||||
and keyboard_matrix_col_bitmask,y
|
||||
jmp breturn
|
||||
@ -4515,6 +4521,11 @@ keyboard_key_pressed: {
|
||||
rts
|
||||
}
|
||||
//SEG261 keyboard_matrix_read
|
||||
// Read a single row of the keyboard matrix
|
||||
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
|
||||
// Returns the keys pressed on the row as bits according to the C64 key matrix.
|
||||
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
|
||||
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
|
||||
keyboard_matrix_read: {
|
||||
//SEG262 [122] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuxx
|
||||
lda keyboard_matrix_row_bitmask,x
|
||||
@ -4529,6 +4540,10 @@ keyboard_matrix_read: {
|
||||
rts
|
||||
}
|
||||
//SEG266 keyboard_get_keycode
|
||||
// Get the keycode corresponding to a specific screen code character
|
||||
// ch is the character to get the key code for ($00-$3f)
|
||||
// Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled.
|
||||
// If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) .
|
||||
keyboard_get_keycode: {
|
||||
//SEG267 [125] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) -- vbuaa=pbuc1_derefidx_vbuxx
|
||||
lda keyboard_char_keycodes,x
|
||||
@ -4539,6 +4554,7 @@ keyboard_get_keycode: {
|
||||
rts
|
||||
}
|
||||
//SEG270 print_str_at
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = 9
|
||||
.label str = 2
|
||||
@ -4676,6 +4692,7 @@ Removing instruction b19_from_b34:
|
||||
Removing instruction b9_from_b19:
|
||||
Removing instruction b10_from_b9:
|
||||
Removing instruction b10_from_b12:
|
||||
Removing instruction b11_from_b36:
|
||||
Removing instruction b44_from_b33:
|
||||
Removing instruction b7_from_b44:
|
||||
Removing instruction b43_from_b32:
|
||||
@ -4719,7 +4736,6 @@ Removing instruction b35:
|
||||
Removing instruction b21:
|
||||
Removing instruction keyboard_key_pressed_from_b21:
|
||||
Removing instruction b36:
|
||||
Removing instruction b11_from_b36:
|
||||
Removing instruction b22:
|
||||
Removing instruction plot_chargen_from_b22:
|
||||
Removing instruction b3_from_b12:
|
||||
@ -5422,10 +5438,8 @@ main: {
|
||||
ldx #KEY_F1
|
||||
jsr keyboard_key_pressed
|
||||
//SEG62 [24] (byte) keyboard_key_pressed::return#2 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#2 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
//SEG63 main::@30
|
||||
//SEG64 [25] (byte~) main::$15 ← (byte) keyboard_key_pressed::return#2
|
||||
// (byte~) main::$15 = (byte) keyboard_key_pressed::return#2 // register copy reg byte a
|
||||
//SEG65 [26] if((byte~) main::$15==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@41 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq b4
|
||||
@ -5441,10 +5455,8 @@ main: {
|
||||
ldx #KEY_F3
|
||||
jsr keyboard_key_pressed
|
||||
//SEG72 [29] (byte) keyboard_key_pressed::return#10 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#10 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
//SEG73 main::@31
|
||||
//SEG74 [30] (byte~) main::$18 ← (byte) keyboard_key_pressed::return#10
|
||||
// (byte~) main::$18 = (byte) keyboard_key_pressed::return#10 // register copy reg byte a
|
||||
//SEG75 [31] if((byte~) main::$18==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@42 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq b5
|
||||
@ -5460,10 +5472,8 @@ main: {
|
||||
ldx #KEY_F5
|
||||
jsr keyboard_key_pressed
|
||||
//SEG82 [34] (byte) keyboard_key_pressed::return#11 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#11 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
//SEG83 main::@32
|
||||
//SEG84 [35] (byte~) main::$21 ← (byte) keyboard_key_pressed::return#11
|
||||
// (byte~) main::$21 = (byte) keyboard_key_pressed::return#11 // register copy reg byte a
|
||||
//SEG85 [36] if((byte~) main::$21==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@43 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq b6
|
||||
@ -5479,10 +5489,8 @@ main: {
|
||||
ldx #KEY_F7
|
||||
jsr keyboard_key_pressed
|
||||
//SEG92 [39] (byte) keyboard_key_pressed::return#12 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#12 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
//SEG93 main::@33
|
||||
//SEG94 [40] (byte~) main::$24 ← (byte) keyboard_key_pressed::return#12
|
||||
// (byte~) main::$24 = (byte) keyboard_key_pressed::return#12 // register copy reg byte a
|
||||
//SEG95 [41] if((byte~) main::$24==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@44 -- vbuaa_eq_0_then_la1
|
||||
cmp #0
|
||||
beq b7
|
||||
@ -5498,10 +5506,8 @@ main: {
|
||||
ldx #KEY_LSHIFT
|
||||
jsr keyboard_key_pressed
|
||||
//SEG102 [44] (byte) keyboard_key_pressed::return#13 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#13 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
//SEG103 main::@34
|
||||
//SEG104 [45] (byte~) main::$27 ← (byte) keyboard_key_pressed::return#13
|
||||
// (byte~) main::$27 = (byte) keyboard_key_pressed::return#13 // register copy reg byte a
|
||||
//SEG105 [46] if((byte~) main::$27!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@9 -- vbuaa_neq_0_then_la1
|
||||
cmp #0
|
||||
bne b8
|
||||
@ -5532,10 +5538,8 @@ main: {
|
||||
//SEG119 [51] call keyboard_get_keycode
|
||||
jsr keyboard_get_keycode
|
||||
//SEG120 [52] (byte) keyboard_get_keycode::return#2 ← (byte) keyboard_get_keycode::return#0
|
||||
// (byte) keyboard_get_keycode::return#2 = (byte) keyboard_get_keycode::return#0 // register copy reg byte a
|
||||
//SEG121 main::@35
|
||||
//SEG122 [53] (byte) main::key#0 ← (byte) keyboard_get_keycode::return#2
|
||||
// (byte) main::key#0 = (byte) keyboard_get_keycode::return#2 // register copy reg byte a
|
||||
//SEG123 [54] if((byte) main::key#0==(byte/signed byte/word/signed word/dword/signed dword) 63) goto main::@11 -- vbuaa_eq_vbuc1_then_la1
|
||||
cmp #$3f
|
||||
beq b13
|
||||
@ -5547,10 +5551,8 @@ main: {
|
||||
//SEG128 [113] phi (byte) keyboard_key_pressed::key#6 = (byte) keyboard_key_pressed::key#5 [phi:main::@21->keyboard_key_pressed#0] -- register_copy
|
||||
jsr keyboard_key_pressed
|
||||
//SEG129 [57] (byte) keyboard_key_pressed::return#14 ← (byte) keyboard_key_pressed::return#0
|
||||
// (byte) keyboard_key_pressed::return#14 = (byte) keyboard_key_pressed::return#0 // register copy reg byte a
|
||||
//SEG130 main::@36
|
||||
//SEG131 [58] (byte) main::pressed#1 ← (byte) keyboard_key_pressed::return#14
|
||||
// (byte) main::pressed#1 = (byte) keyboard_key_pressed::return#14 // register copy reg byte a
|
||||
//SEG132 [59] phi from main::@36 to main::@11 [phi:main::@36->main::@11]
|
||||
//SEG133 [59] phi (byte) main::pressed#2 = (byte) main::pressed#1 [phi:main::@36->main::@11#0] -- register_copy
|
||||
jmp b11
|
||||
@ -5609,6 +5611,7 @@ main: {
|
||||
str3: .text "f7@"
|
||||
}
|
||||
//SEG168 plot_chargen
|
||||
// Render 8x8 char (ch) as pixels on char canvas #pos
|
||||
plot_chargen: {
|
||||
.label _0 = 2
|
||||
.label _1 = 2
|
||||
@ -5664,10 +5667,8 @@ plot_chargen: {
|
||||
//SEG182 [103] phi from plot_chargen::@1 to mul8u [phi:plot_chargen::@1->mul8u]
|
||||
jsr mul8u
|
||||
//SEG183 [82] (word) mul8u::return#2 ← (word) mul8u::res#2
|
||||
// (word) mul8u::return#2 = (word) mul8u::res#2 // register copy zp ZP_WORD:9
|
||||
//SEG184 plot_chargen::@9
|
||||
//SEG185 [83] (word~) plot_chargen::$8 ← (word) mul8u::return#2
|
||||
// (word~) plot_chargen::$8 = (word) mul8u::return#2 // register copy zp ZP_WORD:9
|
||||
//SEG186 [84] (byte*) plot_chargen::sc#0 ← (const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 40+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word~) plot_chargen::$8 -- pbuz1=pbuc1_plus_vwuz1
|
||||
clc
|
||||
lda sc
|
||||
@ -5760,6 +5761,8 @@ plot_chargen: {
|
||||
rts
|
||||
}
|
||||
//SEG227 mul8u
|
||||
// Simple binary multiplication implementation
|
||||
// Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word
|
||||
mul8u: {
|
||||
.const b = $a
|
||||
.label mb = $b
|
||||
@ -5819,6 +5822,10 @@ mul8u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG250 keyboard_key_pressed
|
||||
// Determines whether a specific key is currently pressed by accessing the matrix directly
|
||||
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
|
||||
// All keys exist as as KEY_XXX constants.
|
||||
// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed
|
||||
keyboard_key_pressed: {
|
||||
//SEG251 [114] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#6 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuyy=vbuxx_band_vbuc1
|
||||
txa
|
||||
@ -5834,10 +5841,8 @@ keyboard_key_pressed: {
|
||||
//SEG254 [117] call keyboard_matrix_read
|
||||
jsr keyboard_matrix_read
|
||||
//SEG255 [118] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0
|
||||
// (byte) keyboard_matrix_read::return#2 = (byte) keyboard_matrix_read::return#0 // register copy reg byte a
|
||||
//SEG256 keyboard_key_pressed::@2
|
||||
//SEG257 [119] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_matrix_read::return#2
|
||||
// (byte~) keyboard_key_pressed::$2 = (byte) keyboard_matrix_read::return#2 // register copy reg byte a
|
||||
//SEG258 [120] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$2 & *((const byte[8]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_key_pressed::colidx#0) -- vbuaa=vbuaa_band_pbuc1_derefidx_vbuyy
|
||||
and keyboard_matrix_col_bitmask,y
|
||||
//SEG259 keyboard_key_pressed::@return
|
||||
@ -5845,6 +5850,11 @@ keyboard_key_pressed: {
|
||||
rts
|
||||
}
|
||||
//SEG261 keyboard_matrix_read
|
||||
// Read a single row of the keyboard matrix
|
||||
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
|
||||
// Returns the keys pressed on the row as bits according to the C64 key matrix.
|
||||
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
|
||||
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
|
||||
keyboard_matrix_read: {
|
||||
//SEG262 [122] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuxx
|
||||
lda keyboard_matrix_row_bitmask,x
|
||||
@ -5857,6 +5867,10 @@ keyboard_matrix_read: {
|
||||
rts
|
||||
}
|
||||
//SEG266 keyboard_get_keycode
|
||||
// Get the keycode corresponding to a specific screen code character
|
||||
// ch is the character to get the key code for ($00-$3f)
|
||||
// Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled.
|
||||
// If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) .
|
||||
keyboard_get_keycode: {
|
||||
//SEG267 [125] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) -- vbuaa=pbuc1_derefidx_vbuxx
|
||||
lda keyboard_char_keycodes,x
|
||||
@ -5865,6 +5879,7 @@ keyboard_get_keycode: {
|
||||
rts
|
||||
}
|
||||
//SEG270 print_str_at
|
||||
// Print a string at a specific screen position
|
||||
print_str_at: {
|
||||
.label at = 9
|
||||
.label str = 2
|
||||
|
@ -96,6 +96,7 @@ main: {
|
||||
bne b2
|
||||
rts
|
||||
}
|
||||
// Print a signed byte as hex at a specific screen position
|
||||
print_sbyte_at: {
|
||||
.label b = $a
|
||||
.label at = 8
|
||||
@ -122,6 +123,7 @@ print_sbyte_at: {
|
||||
sta b
|
||||
jmp b2
|
||||
}
|
||||
// Print a single char
|
||||
print_char_at: {
|
||||
.label at = 8
|
||||
.label ch = $b
|
||||
@ -130,6 +132,7 @@ print_char_at: {
|
||||
sta (at),y
|
||||
rts
|
||||
}
|
||||
// Print a byte as HEX at a specific position
|
||||
print_byte_at: {
|
||||
.label at = 8
|
||||
lda print_sbyte_at.b
|
||||
@ -208,6 +211,7 @@ init_screen: {
|
||||
bne b2
|
||||
rts
|
||||
}
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
lda #<print_line_cursor
|
||||
|
@ -1522,6 +1522,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG73 print_sbyte_at
|
||||
// Print a signed byte as hex at a specific screen position
|
||||
print_sbyte_at: {
|
||||
.label b = $d
|
||||
.label at = $b
|
||||
@ -1593,6 +1594,7 @@ print_sbyte_at: {
|
||||
jmp b2_from_b5
|
||||
}
|
||||
//SEG96 print_char_at
|
||||
// Print a single char
|
||||
print_char_at: {
|
||||
.label at = $f
|
||||
.label ch = $e
|
||||
@ -1607,6 +1609,7 @@ print_char_at: {
|
||||
rts
|
||||
}
|
||||
//SEG100 print_byte_at
|
||||
// Print a byte as HEX at a specific position
|
||||
print_byte_at: {
|
||||
.label _0 = $1d
|
||||
.label _2 = $1e
|
||||
@ -1784,6 +1787,7 @@ init_screen: {
|
||||
rts
|
||||
}
|
||||
//SEG152 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = $15
|
||||
//SEG153 [79] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -2139,12 +2143,10 @@ main: {
|
||||
//SEG55 [24] call fmul8
|
||||
jsr fmul8
|
||||
//SEG56 [25] (signed byte) fmul8::return#0 ← (signed byte) fmul8::return#1
|
||||
// (signed byte) fmul8::return#0 = (signed byte) fmul8::return#1 // register copy reg byte a
|
||||
jmp b10
|
||||
//SEG57 main::@10
|
||||
b10:
|
||||
//SEG58 [26] (signed byte) main::r#0 ← (signed byte) fmul8::return#0
|
||||
// (signed byte) main::r#0 = (signed byte) fmul8::return#0 // register copy reg byte a
|
||||
//SEG59 [27] (signed byte) print_sbyte_at::b#3 ← (signed byte) main::r#0 -- vbsz1=vbsaa
|
||||
sta print_sbyte_at.b
|
||||
//SEG60 [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 -- pbuz1=pbuz2
|
||||
@ -2183,6 +2185,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG73 print_sbyte_at
|
||||
// Print a signed byte as hex at a specific screen position
|
||||
print_sbyte_at: {
|
||||
.label b = $a
|
||||
.label at = 8
|
||||
@ -2193,7 +2196,6 @@ print_sbyte_at: {
|
||||
//SEG75 print_sbyte_at::@3
|
||||
b3:
|
||||
//SEG76 [37] (byte*) print_char_at::at#1 ← (byte*) print_sbyte_at::at#3
|
||||
// (byte*) print_char_at::at#1 = (byte*) print_sbyte_at::at#3 // register copy zp ZP_WORD:8
|
||||
//SEG77 [38] call print_char_at
|
||||
//SEG78 [46] phi from print_sbyte_at::@3 to print_char_at [phi:print_sbyte_at::@3->print_char_at]
|
||||
print_char_at_from_b3:
|
||||
@ -2224,7 +2226,6 @@ print_sbyte_at: {
|
||||
//SEG88 print_sbyte_at::@1
|
||||
b1:
|
||||
//SEG89 [43] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3
|
||||
// (byte*) print_char_at::at#0 = (byte*) print_sbyte_at::at#3 // register copy zp ZP_WORD:8
|
||||
//SEG90 [44] call print_char_at
|
||||
//SEG91 [46] phi from print_sbyte_at::@1 to print_char_at [phi:print_sbyte_at::@1->print_char_at]
|
||||
print_char_at_from_b1:
|
||||
@ -2245,6 +2246,7 @@ print_sbyte_at: {
|
||||
jmp b2_from_b5
|
||||
}
|
||||
//SEG96 print_char_at
|
||||
// Print a single char
|
||||
print_char_at: {
|
||||
.label at = 8
|
||||
.label ch = $b
|
||||
@ -2259,6 +2261,7 @@ print_char_at: {
|
||||
rts
|
||||
}
|
||||
//SEG100 print_byte_at
|
||||
// Print a byte as HEX at a specific position
|
||||
print_byte_at: {
|
||||
.label at = 8
|
||||
//SEG101 [49] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#6 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4
|
||||
@ -2272,7 +2275,6 @@ print_byte_at: {
|
||||
lda print_hextab,y
|
||||
sta print_char_at.ch
|
||||
//SEG103 [51] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0
|
||||
// (byte*) print_char_at::at#2 = (byte*) print_byte_at::at#0 // register copy zp ZP_WORD:8
|
||||
//SEG104 [52] call print_char_at
|
||||
//SEG105 [46] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at]
|
||||
print_char_at_from_print_byte_at:
|
||||
@ -2413,6 +2415,7 @@ init_screen: {
|
||||
rts
|
||||
}
|
||||
//SEG152 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
//SEG153 [79] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
@ -2512,8 +2515,10 @@ Removing instruction bend_from_b22:
|
||||
Removing instruction b1_from_b8:
|
||||
Removing instruction b2_from_b5:
|
||||
Removing instruction b3_from_b11:
|
||||
Removing instruction print_char_at_from_b3:
|
||||
Removing instruction b2_from_b3:
|
||||
Removing instruction b2_from_b5:
|
||||
Removing instruction print_char_at_from_b1:
|
||||
Removing instruction b1_from_b1:
|
||||
Removing instruction b2_from_b2:
|
||||
Removing instruction b1_from_b1:
|
||||
@ -2532,9 +2537,7 @@ Removing instruction b11:
|
||||
Removing instruction b5:
|
||||
Removing instruction breturn:
|
||||
Removing instruction b3:
|
||||
Removing instruction print_char_at_from_b3:
|
||||
Removing instruction breturn:
|
||||
Removing instruction print_char_at_from_b1:
|
||||
Removing instruction b5:
|
||||
Removing instruction breturn:
|
||||
Removing instruction print_char_at_from_print_byte_at:
|
||||
@ -2843,10 +2846,8 @@ main: {
|
||||
//SEG55 [24] call fmul8
|
||||
jsr fmul8
|
||||
//SEG56 [25] (signed byte) fmul8::return#0 ← (signed byte) fmul8::return#1
|
||||
// (signed byte) fmul8::return#0 = (signed byte) fmul8::return#1 // register copy reg byte a
|
||||
//SEG57 main::@10
|
||||
//SEG58 [26] (signed byte) main::r#0 ← (signed byte) fmul8::return#0
|
||||
// (signed byte) main::r#0 = (signed byte) fmul8::return#0 // register copy reg byte a
|
||||
//SEG59 [27] (signed byte) print_sbyte_at::b#3 ← (signed byte) main::r#0 -- vbsz1=vbsaa
|
||||
sta print_sbyte_at.b
|
||||
//SEG60 [28] (byte*) print_sbyte_at::at#2 ← (byte*) main::at#3 -- pbuz1=pbuz2
|
||||
@ -2878,6 +2879,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG73 print_sbyte_at
|
||||
// Print a signed byte as hex at a specific screen position
|
||||
print_sbyte_at: {
|
||||
.label b = $a
|
||||
.label at = 8
|
||||
@ -2886,7 +2888,6 @@ print_sbyte_at: {
|
||||
bmi b1
|
||||
//SEG75 print_sbyte_at::@3
|
||||
//SEG76 [37] (byte*) print_char_at::at#1 ← (byte*) print_sbyte_at::at#3
|
||||
// (byte*) print_char_at::at#1 = (byte*) print_sbyte_at::at#3 // register copy zp ZP_WORD:8
|
||||
//SEG77 [38] call print_char_at
|
||||
//SEG78 [46] phi from print_sbyte_at::@3 to print_char_at [phi:print_sbyte_at::@3->print_char_at]
|
||||
//SEG79 [46] phi (byte*) print_char_at::at#4 = (byte*) print_char_at::at#1 [phi:print_sbyte_at::@3->print_char_at#0] -- register_copy
|
||||
@ -2911,7 +2912,6 @@ print_sbyte_at: {
|
||||
//SEG88 print_sbyte_at::@1
|
||||
b1:
|
||||
//SEG89 [43] (byte*) print_char_at::at#0 ← (byte*) print_sbyte_at::at#3
|
||||
// (byte*) print_char_at::at#0 = (byte*) print_sbyte_at::at#3 // register copy zp ZP_WORD:8
|
||||
//SEG90 [44] call print_char_at
|
||||
//SEG91 [46] phi from print_sbyte_at::@1 to print_char_at [phi:print_sbyte_at::@1->print_char_at]
|
||||
//SEG92 [46] phi (byte*) print_char_at::at#4 = (byte*) print_char_at::at#0 [phi:print_sbyte_at::@1->print_char_at#0] -- register_copy
|
||||
@ -2929,6 +2929,7 @@ print_sbyte_at: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG96 print_char_at
|
||||
// Print a single char
|
||||
print_char_at: {
|
||||
.label at = 8
|
||||
.label ch = $b
|
||||
@ -2941,6 +2942,7 @@ print_char_at: {
|
||||
rts
|
||||
}
|
||||
//SEG100 print_byte_at
|
||||
// Print a byte as HEX at a specific position
|
||||
print_byte_at: {
|
||||
.label at = 8
|
||||
//SEG101 [49] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#6 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4
|
||||
@ -2954,7 +2956,6 @@ print_byte_at: {
|
||||
lda print_hextab,y
|
||||
sta print_char_at.ch
|
||||
//SEG103 [51] (byte*) print_char_at::at#2 ← (byte*) print_byte_at::at#0
|
||||
// (byte*) print_char_at::at#2 = (byte*) print_byte_at::at#0 // register copy zp ZP_WORD:8
|
||||
//SEG104 [52] call print_char_at
|
||||
//SEG105 [46] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at]
|
||||
//SEG106 [46] phi (byte*) print_char_at::at#4 = (byte*) print_char_at::at#2 [phi:print_byte_at->print_char_at#0] -- register_copy
|
||||
@ -3072,6 +3073,7 @@ init_screen: {
|
||||
rts
|
||||
}
|
||||
//SEG152 print_cls
|
||||
// Clear the screen. Also resets current line/char cursor.
|
||||
print_cls: {
|
||||
.label sc = 2
|
||||
//SEG153 [79] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1]
|
||||
|
@ -9,6 +9,7 @@ main: {
|
||||
rts
|
||||
str: .text "hello world!@"
|
||||
}
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
lda #<$400
|
||||
sta print_line_cursor
|
||||
@ -32,6 +33,7 @@ print_ln: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Print a zero-terminated string
|
||||
print_str: {
|
||||
.label str = 2
|
||||
lda #<$400
|
||||
|
@ -365,6 +365,7 @@ main: {
|
||||
str: .text "hello world!@"
|
||||
}
|
||||
//SEG18 print_ln
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
//SEG19 [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
|
||||
b1_from_print_ln:
|
||||
@ -404,6 +405,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG28 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]
|
||||
@ -524,6 +526,7 @@ main: {
|
||||
str: .text "hello world!@"
|
||||
}
|
||||
//SEG18 print_ln
|
||||
// Print a newline
|
||||
print_ln: {
|
||||
//SEG19 [10] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1]
|
||||
b1_from_print_ln:
|
||||
@ -563,6 +566,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG28 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]
|
||||
@ -718,6 +722,7 @@ main: {
|
||||
str: .text "hello world!@"
|
||||
}
|
||||
//SEG18 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
|
||||
@ -751,6 +756,7 @@ print_ln: {
|
||||
rts
|
||||
}
|
||||
//SEG28 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]
|
||||
|
@ -34,6 +34,7 @@ main: {
|
||||
cli
|
||||
rts
|
||||
}
|
||||
// Interrupt Routine 2
|
||||
irq_bottom_2: {
|
||||
lda #WHITE
|
||||
sta BORDERCOL
|
||||
@ -52,6 +53,7 @@ irq_bottom_2: {
|
||||
sta BORDERCOL
|
||||
jmp $ea31
|
||||
}
|
||||
// Interrupt Routine 1
|
||||
irq_bottom_1: {
|
||||
lda #WHITE
|
||||
sta BORDERCOL
|
||||
|
@ -620,6 +620,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG19 irq_bottom_2
|
||||
// Interrupt Routine 2
|
||||
irq_bottom_2: {
|
||||
//SEG20 entry interrupt(KERNEL_KEYBOARD)
|
||||
//SEG21 [13] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
|
||||
@ -650,6 +651,7 @@ irq_bottom_2: {
|
||||
jmp $ea31
|
||||
}
|
||||
//SEG29 irq_bottom_1
|
||||
// Interrupt Routine 1
|
||||
irq_bottom_1: {
|
||||
//SEG30 entry interrupt(KERNEL_MIN)
|
||||
//SEG31 [20] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
|
||||
@ -778,6 +780,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG19 irq_bottom_2
|
||||
// Interrupt Routine 2
|
||||
irq_bottom_2: {
|
||||
//SEG20 entry interrupt(KERNEL_KEYBOARD)
|
||||
//SEG21 [13] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
|
||||
@ -808,6 +811,7 @@ irq_bottom_2: {
|
||||
jmp $ea31
|
||||
}
|
||||
//SEG29 irq_bottom_1
|
||||
// Interrupt Routine 1
|
||||
irq_bottom_1: {
|
||||
//SEG30 entry interrupt(KERNEL_MIN)
|
||||
//SEG31 [20] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
|
||||
@ -1025,6 +1029,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG19 irq_bottom_2
|
||||
// Interrupt Routine 2
|
||||
irq_bottom_2: {
|
||||
//SEG20 entry interrupt(KERNEL_KEYBOARD)
|
||||
//SEG21 [13] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
|
||||
@ -1053,6 +1058,7 @@ irq_bottom_2: {
|
||||
jmp $ea31
|
||||
}
|
||||
//SEG29 irq_bottom_1
|
||||
// Interrupt Routine 1
|
||||
irq_bottom_1: {
|
||||
//SEG30 entry interrupt(KERNEL_MIN)
|
||||
//SEG31 [20] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
|
||||
|
@ -28,6 +28,7 @@ main: {
|
||||
jsr loop
|
||||
rts
|
||||
}
|
||||
// The raster loop
|
||||
loop: {
|
||||
.label sin_idx = 2
|
||||
.label plexFreeNextYpos1_return = 9
|
||||
@ -89,6 +90,8 @@ loop: {
|
||||
sta BORDERCOL
|
||||
jmp b4
|
||||
}
|
||||
// Show the next sprite.
|
||||
// plexSort() prepares showing the sprites
|
||||
plexShowSprite: {
|
||||
.label plex_sprite_idx2 = 9
|
||||
.label xpos_idx = $a
|
||||
@ -151,6 +154,15 @@ plexShowSprite: {
|
||||
sta SPRITES_XMSB
|
||||
jmp b2
|
||||
}
|
||||
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
|
||||
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
|
||||
// Uses an insertion sort:
|
||||
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
|
||||
// 2a. If the next element after the marker is larger that the current element
|
||||
// the marker can be moved forwards (as the sorting is correct).
|
||||
// 2b. If the next element after the marker is smaller than the current element:
|
||||
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
|
||||
// It is then inserted at the spot. Now the marker can move forward.
|
||||
plexSort: {
|
||||
.label nxt_idx = 4
|
||||
.label nxt_y = 5
|
||||
@ -198,6 +210,7 @@ plexSort: {
|
||||
bcc b3
|
||||
jmp b5
|
||||
}
|
||||
// Initialize the program
|
||||
init: {
|
||||
.label xp = 7
|
||||
lda #VIC_DEN|VIC_RSEL|3
|
||||
@ -239,6 +252,7 @@ init: {
|
||||
bne b2
|
||||
rts
|
||||
}
|
||||
// Initialize the multiplexer data structures
|
||||
plexInit: {
|
||||
ldx #0
|
||||
b1:
|
||||
|
@ -2520,6 +2520,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG20 loop
|
||||
// The raster loop
|
||||
loop: {
|
||||
.label _4 = $12
|
||||
.label y_idx = 3
|
||||
@ -2681,6 +2682,8 @@ loop: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG78 plexShowSprite
|
||||
// Show the next sprite.
|
||||
// plexSort() prepares showing the sprites
|
||||
plexShowSprite: {
|
||||
.label _3 = $19
|
||||
.label _4 = $1a
|
||||
@ -2814,6 +2817,15 @@ plexShowSprite: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG113 plexSort
|
||||
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
|
||||
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
|
||||
// Uses an insertion sort:
|
||||
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
|
||||
// 2a. If the next element after the marker is larger that the current element
|
||||
// the marker can be moved forwards (as the sorting is correct).
|
||||
// 2b. If the next element after the marker is smaller than the current element:
|
||||
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
|
||||
// It is then inserted at the spot. Now the marker can move forward.
|
||||
plexSort: {
|
||||
.label nxt_idx = $1d
|
||||
.label nxt_y = $1e
|
||||
@ -2933,6 +2945,7 @@ plexSort: {
|
||||
jmp b5
|
||||
}
|
||||
//SEG150 init
|
||||
// Initialize the program
|
||||
init: {
|
||||
.label _6 = $20
|
||||
.label xp = $e
|
||||
@ -3026,6 +3039,7 @@ init: {
|
||||
rts
|
||||
}
|
||||
//SEG179 plexInit
|
||||
// Initialize the multiplexer data structures
|
||||
plexInit: {
|
||||
.label i = $11
|
||||
//SEG180 [97] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
|
||||
@ -3333,6 +3347,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG20 loop
|
||||
// The raster loop
|
||||
loop: {
|
||||
.label sin_idx = 2
|
||||
.label plexFreeNextYpos1_return = 9
|
||||
@ -3483,6 +3498,8 @@ loop: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG78 plexShowSprite
|
||||
// Show the next sprite.
|
||||
// plexSort() prepares showing the sprites
|
||||
plexShowSprite: {
|
||||
.label plex_sprite_idx2 = 9
|
||||
.label xpos_idx = $a
|
||||
@ -3594,6 +3611,15 @@ plexShowSprite: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG113 plexSort
|
||||
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
|
||||
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
|
||||
// Uses an insertion sort:
|
||||
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
|
||||
// 2a. If the next element after the marker is larger that the current element
|
||||
// the marker can be moved forwards (as the sorting is correct).
|
||||
// 2b. If the next element after the marker is smaller than the current element:
|
||||
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
|
||||
// It is then inserted at the spot. Now the marker can move forward.
|
||||
plexSort: {
|
||||
.label nxt_idx = 4
|
||||
.label nxt_y = 5
|
||||
@ -3700,6 +3726,7 @@ plexSort: {
|
||||
jmp b5
|
||||
}
|
||||
//SEG150 init
|
||||
// Initialize the program
|
||||
init: {
|
||||
.label xp = 7
|
||||
//SEG151 [81] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2
|
||||
@ -3783,6 +3810,7 @@ init: {
|
||||
rts
|
||||
}
|
||||
//SEG179 plexInit
|
||||
// Initialize the multiplexer data structures
|
||||
plexInit: {
|
||||
//SEG180 [97] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
|
||||
plexSetScreen1_from_plexInit:
|
||||
@ -4288,6 +4316,7 @@ main: {
|
||||
rts
|
||||
}
|
||||
//SEG20 loop
|
||||
// The raster loop
|
||||
loop: {
|
||||
.label sin_idx = 2
|
||||
.label plexFreeNextYpos1_return = 9
|
||||
@ -4407,6 +4436,8 @@ loop: {
|
||||
jmp b4
|
||||
}
|
||||
//SEG78 plexShowSprite
|
||||
// Show the next sprite.
|
||||
// plexSort() prepares showing the sprites
|
||||
plexShowSprite: {
|
||||
.label plex_sprite_idx2 = 9
|
||||
.label xpos_idx = $a
|
||||
@ -4504,6 +4535,15 @@ plexShowSprite: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG113 plexSort
|
||||
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
|
||||
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
|
||||
// Uses an insertion sort:
|
||||
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
|
||||
// 2a. If the next element after the marker is larger that the current element
|
||||
// the marker can be moved forwards (as the sorting is correct).
|
||||
// 2b. If the next element after the marker is smaller than the current element:
|
||||
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
|
||||
// It is then inserted at the spot. Now the marker can move forward.
|
||||
plexSort: {
|
||||
.label nxt_idx = 4
|
||||
.label nxt_y = 5
|
||||
@ -4588,6 +4628,7 @@ plexSort: {
|
||||
jmp b5
|
||||
}
|
||||
//SEG150 init
|
||||
// Initialize the program
|
||||
init: {
|
||||
.label xp = 7
|
||||
//SEG151 [81] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2
|
||||
@ -4658,6 +4699,7 @@ init: {
|
||||
rts
|
||||
}
|
||||
//SEG179 plexInit
|
||||
// Initialize the multiplexer data structures
|
||||
plexInit: {
|
||||
//SEG180 [97] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
|
||||
//SEG181 plexInit::plexSetScreen1
|
||||
|
@ -140,6 +140,8 @@ anim: {
|
||||
sta BORDERCOL
|
||||
jmp b4
|
||||
}
|
||||
// Calculate fast multiply with a prepared unsigned byte to a word result
|
||||
// The prepared number is set by calling mulf8s_prepare(byte a)
|
||||
mulf8s_prepared: {
|
||||
.label memA = $fd
|
||||
.label m = 5
|
||||
@ -163,6 +165,8 @@ mulf8s_prepared: {
|
||||
b2:
|
||||
rts
|
||||
}
|
||||
// Calculate fast multiply with a prepared unsigned byte to a word result
|
||||
// The prepared number is set by calling mulf8u_prepare(byte a)
|
||||
mulf8u_prepared: {
|
||||
.label resL = $fe
|
||||
.label memB = $ff
|
||||
@ -186,6 +190,7 @@ mulf8u_prepared: {
|
||||
sta return+1
|
||||
rts
|
||||
}
|
||||
// Prepare for fast multiply with an unsigned byte to a word result
|
||||
mulf8u_prepare: {
|
||||
.label memA = $fd
|
||||
sta memA
|
||||
@ -212,6 +217,7 @@ init: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
|
||||
mulf_init: {
|
||||
.label sqr1_hi = 7
|
||||
.label sqr = 9
|
||||
|
@ -2647,6 +2647,8 @@ anim: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG108 mulf8s_prepared
|
||||
// Calculate fast multiply with a prepared unsigned byte to a word result
|
||||
// The prepared number is set by calling mulf8s_prepare(byte a)
|
||||
mulf8s_prepared: {
|
||||
.label memA = $fd
|
||||
.label _4 = $41
|
||||
@ -2739,6 +2741,8 @@ mulf8s_prepared: {
|
||||
rts
|
||||
}
|
||||
//SEG133 mulf8u_prepared
|
||||
// Calculate fast multiply with a prepared unsigned byte to a word result
|
||||
// The prepared number is set by calling mulf8u_prepare(byte a)
|
||||
mulf8u_prepared: {
|
||||
.label resL = $fe
|
||||
.label memB = $ff
|
||||
@ -2772,6 +2776,7 @@ mulf8u_prepared: {
|
||||
rts
|
||||
}
|
||||
//SEG139 mulf8u_prepare
|
||||
// Prepare for fast multiply with an unsigned byte to a word result
|
||||
mulf8u_prepare: {
|
||||
.label memA = $fd
|
||||
.label a = 8
|
||||
@ -2838,6 +2843,7 @@ init: {
|
||||
rts
|
||||
}
|
||||
//SEG160 mulf_init
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
|
||||
mulf_init: {
|
||||
.label _2 = $49
|
||||
.label _5 = $4a
|
||||
@ -3481,7 +3487,6 @@ anim: {
|
||||
//SEG46 [62] phi (signed byte) mulf8s_prepared::b#4 = (signed byte) mulf8s_prepared::b#0 [phi:anim::@17->mulf8s_prepared#0] -- register_copy
|
||||
jsr mulf8s_prepared
|
||||
//SEG47 [21] (signed word) mulf8s_prepared::return#2 ← (signed word)(word) mulf8s_prepared::m#4
|
||||
// (signed word) mulf8s_prepared::return#2 = (signed word)(word) mulf8s_prepared::m#4 // register copy zp ZP_WORD:5
|
||||
jmp b20
|
||||
//SEG48 anim::@20
|
||||
b20:
|
||||
@ -3501,7 +3506,6 @@ anim: {
|
||||
//SEG54 [62] phi (signed byte) mulf8s_prepared::b#4 = (signed byte) mulf8s_prepared::b#1 [phi:anim::@20->mulf8s_prepared#0] -- register_copy
|
||||
jsr mulf8s_prepared
|
||||
//SEG55 [26] (signed word) mulf8s_prepared::return#3 ← (signed word)(word) mulf8s_prepared::m#4
|
||||
// (signed word) mulf8s_prepared::return#3 = (signed word)(word) mulf8s_prepared::m#4 // register copy zp ZP_WORD:5
|
||||
jmp b21
|
||||
//SEG56 anim::@21
|
||||
b21:
|
||||
@ -3535,12 +3539,10 @@ anim: {
|
||||
//SEG68 [62] phi (signed byte) mulf8s_prepared::b#4 = (signed byte) mulf8s_prepared::b#2 [phi:anim::@18->mulf8s_prepared#0] -- register_copy
|
||||
jsr mulf8s_prepared
|
||||
//SEG69 [33] (signed word) mulf8s_prepared::return#4 ← (signed word)(word) mulf8s_prepared::m#4
|
||||
// (signed word) mulf8s_prepared::return#4 = (signed word)(word) mulf8s_prepared::m#4 // register copy zp ZP_WORD:5
|
||||
jmp b23
|
||||
//SEG70 anim::@23
|
||||
b23:
|
||||
//SEG71 [34] (signed word~) anim::$9 ← (signed word) mulf8s_prepared::return#4
|
||||
// (signed word~) anim::$9 = (signed word) mulf8s_prepared::return#4 // register copy zp ZP_WORD:5
|
||||
//SEG72 [35] (signed word~) anim::$10 ← (signed word~) anim::$9 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwsz1=vwsz1_rol_1
|
||||
asl _10
|
||||
rol _10+1
|
||||
@ -3560,12 +3562,10 @@ anim: {
|
||||
//SEG77 [62] phi (signed byte) mulf8s_prepared::b#4 = (signed byte) mulf8s_prepared::b#3 [phi:anim::@23->mulf8s_prepared#0] -- register_copy
|
||||
jsr mulf8s_prepared
|
||||
//SEG78 [39] (signed word) mulf8s_prepared::return#10 ← (signed word)(word) mulf8s_prepared::m#4
|
||||
// (signed word) mulf8s_prepared::return#10 = (signed word)(word) mulf8s_prepared::m#4 // register copy zp ZP_WORD:5
|
||||
jmp b24
|
||||
//SEG79 anim::@24
|
||||
b24:
|
||||
//SEG80 [40] (signed word~) anim::$11 ← (signed word) mulf8s_prepared::return#10
|
||||
// (signed word~) anim::$11 = (signed word) mulf8s_prepared::return#10 // register copy zp ZP_WORD:5
|
||||
//SEG81 [41] (signed word~) anim::$12 ← (signed word~) anim::$11 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwsz1=vwsz1_rol_1
|
||||
asl _12
|
||||
rol _12+1
|
||||
@ -3580,7 +3580,6 @@ anim: {
|
||||
//SEG83 [43] (byte~) anim::$13 ← > (signed word) anim::xr#1 -- vbuaa=_hi_vwsz1
|
||||
lda xr+1
|
||||
//SEG84 [44] (signed byte~) anim::$15 ← (signed byte)(byte~) anim::$13
|
||||
// (signed byte~) anim::$15 = (signed byte)(byte~) anim::$13 // register copy reg byte a
|
||||
//SEG85 [45] (signed word) anim::xpos#0 ← (signed byte~) anim::$15 + (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/word/signed word/dword/signed dword) 149 -- vwsz1=vbsaa_plus_vbuc1
|
||||
sta xpos
|
||||
ora #$7f
|
||||
@ -3656,6 +3655,8 @@ anim: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG108 mulf8s_prepared
|
||||
// Calculate fast multiply with a prepared unsigned byte to a word result
|
||||
// The prepared number is set by calling mulf8s_prepare(byte a)
|
||||
mulf8s_prepared: {
|
||||
.label memA = $fd
|
||||
.label m = 5
|
||||
@ -3663,12 +3664,10 @@ mulf8s_prepared: {
|
||||
//SEG109 [63] call mulf8u_prepared
|
||||
jsr mulf8u_prepared
|
||||
//SEG110 [64] (word) mulf8u_prepared::return#2 ← (word) mulf8u_prepared::return#0
|
||||
// (word) mulf8u_prepared::return#2 = (word) mulf8u_prepared::return#0 // register copy zp ZP_WORD:5
|
||||
jmp b6
|
||||
//SEG111 mulf8s_prepared::@6
|
||||
b6:
|
||||
//SEG112 [65] (word) mulf8s_prepared::m#0 ← (word) mulf8u_prepared::return#2
|
||||
// (word) mulf8s_prepared::m#0 = (word) mulf8u_prepared::return#2 // register copy zp ZP_WORD:5
|
||||
//SEG113 [66] if(*((const signed byte*) mulf8s_prepared::memA#0)>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mulf8s_prepared::@1 -- _deref_pbsc1_ge_0_then_la1
|
||||
lda memA
|
||||
cmp #0
|
||||
@ -3722,6 +3721,8 @@ mulf8s_prepared: {
|
||||
rts
|
||||
}
|
||||
//SEG133 mulf8u_prepared
|
||||
// Calculate fast multiply with a prepared unsigned byte to a word result
|
||||
// The prepared number is set by calling mulf8u_prepare(byte a)
|
||||
mulf8u_prepared: {
|
||||
.label resL = $fe
|
||||
.label memB = $ff
|
||||
@ -3753,6 +3754,7 @@ mulf8u_prepared: {
|
||||
rts
|
||||
}
|
||||
//SEG139 mulf8u_prepare
|
||||
// Prepare for fast multiply with an unsigned byte to a word result
|
||||
mulf8u_prepare: {
|
||||
.label memA = $fd
|
||||
//SEG140 [84] *((const byte*) mulf8u_prepare::memA#0) ← (byte) mulf8u_prepare::a#2 -- _deref_pbuc1=vbuaa
|
||||
@ -3812,6 +3814,7 @@ init: {
|
||||
rts
|
||||
}
|
||||
//SEG160 mulf_init
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
|
||||
mulf_init: {
|
||||
.label sqr1_hi = 7
|
||||
.label sqr = 9
|
||||
@ -4595,7 +4598,6 @@ anim: {
|
||||
//SEG46 [62] phi (signed byte) mulf8s_prepared::b#4 = (signed byte) mulf8s_prepared::b#0 [phi:anim::@17->mulf8s_prepared#0] -- register_copy
|
||||
jsr mulf8s_prepared
|
||||
//SEG47 [21] (signed word) mulf8s_prepared::return#2 ← (signed word)(word) mulf8s_prepared::m#4
|
||||
// (signed word) mulf8s_prepared::return#2 = (signed word)(word) mulf8s_prepared::m#4 // register copy zp ZP_WORD:5
|
||||
//SEG48 anim::@20
|
||||
//SEG49 [22] (signed word~) anim::$4 ← (signed word) mulf8s_prepared::return#2 -- vwsz1=vwsz2
|
||||
lda mulf8s_prepared.return
|
||||
@ -4612,7 +4614,6 @@ anim: {
|
||||
//SEG54 [62] phi (signed byte) mulf8s_prepared::b#4 = (signed byte) mulf8s_prepared::b#1 [phi:anim::@20->mulf8s_prepared#0] -- register_copy
|
||||
jsr mulf8s_prepared
|
||||
//SEG55 [26] (signed word) mulf8s_prepared::return#3 ← (signed word)(word) mulf8s_prepared::m#4
|
||||
// (signed word) mulf8s_prepared::return#3 = (signed word)(word) mulf8s_prepared::m#4 // register copy zp ZP_WORD:5
|
||||
//SEG56 anim::@21
|
||||
//SEG57 [27] (signed word~) anim::$6 ← (signed word) mulf8s_prepared::return#3 -- vwsz1=vwsz2
|
||||
lda mulf8s_prepared.return
|
||||
@ -4638,10 +4639,8 @@ anim: {
|
||||
//SEG68 [62] phi (signed byte) mulf8s_prepared::b#4 = (signed byte) mulf8s_prepared::b#2 [phi:anim::@18->mulf8s_prepared#0] -- register_copy
|
||||
jsr mulf8s_prepared
|
||||
//SEG69 [33] (signed word) mulf8s_prepared::return#4 ← (signed word)(word) mulf8s_prepared::m#4
|
||||
// (signed word) mulf8s_prepared::return#4 = (signed word)(word) mulf8s_prepared::m#4 // register copy zp ZP_WORD:5
|
||||
//SEG70 anim::@23
|
||||
//SEG71 [34] (signed word~) anim::$9 ← (signed word) mulf8s_prepared::return#4
|
||||
// (signed word~) anim::$9 = (signed word) mulf8s_prepared::return#4 // register copy zp ZP_WORD:5
|
||||
//SEG72 [35] (signed word~) anim::$10 ← (signed word~) anim::$9 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwsz1=vwsz1_rol_1
|
||||
asl _10
|
||||
rol _10+1
|
||||
@ -4660,10 +4659,8 @@ anim: {
|
||||
//SEG77 [62] phi (signed byte) mulf8s_prepared::b#4 = (signed byte) mulf8s_prepared::b#3 [phi:anim::@23->mulf8s_prepared#0] -- register_copy
|
||||
jsr mulf8s_prepared
|
||||
//SEG78 [39] (signed word) mulf8s_prepared::return#10 ← (signed word)(word) mulf8s_prepared::m#4
|
||||
// (signed word) mulf8s_prepared::return#10 = (signed word)(word) mulf8s_prepared::m#4 // register copy zp ZP_WORD:5
|
||||
//SEG79 anim::@24
|
||||
//SEG80 [40] (signed word~) anim::$11 ← (signed word) mulf8s_prepared::return#10
|
||||
// (signed word~) anim::$11 = (signed word) mulf8s_prepared::return#10 // register copy zp ZP_WORD:5
|
||||
//SEG81 [41] (signed word~) anim::$12 ← (signed word~) anim::$11 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwsz1=vwsz1_rol_1
|
||||
asl _12
|
||||
rol _12+1
|
||||
@ -4678,7 +4675,6 @@ anim: {
|
||||
//SEG83 [43] (byte~) anim::$13 ← > (signed word) anim::xr#1 -- vbuaa=_hi_vwsz1
|
||||
lda xr+1
|
||||
//SEG84 [44] (signed byte~) anim::$15 ← (signed byte)(byte~) anim::$13
|
||||
// (signed byte~) anim::$15 = (signed byte)(byte~) anim::$13 // register copy reg byte a
|
||||
//SEG85 [45] (signed word) anim::xpos#0 ← (signed byte~) anim::$15 + (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/word/signed word/dword/signed dword) 149 -- vwsz1=vbsaa_plus_vbuc1
|
||||
sta xpos
|
||||
ora #$7f
|
||||
@ -4747,6 +4743,8 @@ anim: {
|
||||
jmp b4
|
||||
}
|
||||
//SEG108 mulf8s_prepared
|
||||
// Calculate fast multiply with a prepared unsigned byte to a word result
|
||||
// The prepared number is set by calling mulf8s_prepare(byte a)
|
||||
mulf8s_prepared: {
|
||||
.label memA = $fd
|
||||
.label m = 5
|
||||
@ -4754,10 +4752,8 @@ mulf8s_prepared: {
|
||||
//SEG109 [63] call mulf8u_prepared
|
||||
jsr mulf8u_prepared
|
||||
//SEG110 [64] (word) mulf8u_prepared::return#2 ← (word) mulf8u_prepared::return#0
|
||||
// (word) mulf8u_prepared::return#2 = (word) mulf8u_prepared::return#0 // register copy zp ZP_WORD:5
|
||||
//SEG111 mulf8s_prepared::@6
|
||||
//SEG112 [65] (word) mulf8s_prepared::m#0 ← (word) mulf8u_prepared::return#2
|
||||
// (word) mulf8s_prepared::m#0 = (word) mulf8u_prepared::return#2 // register copy zp ZP_WORD:5
|
||||
//SEG113 [66] if(*((const signed byte*) mulf8s_prepared::memA#0)>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mulf8s_prepared::@1 -- _deref_pbsc1_ge_0_then_la1
|
||||
lda memA
|
||||
cmp #0
|
||||
@ -4797,6 +4793,8 @@ mulf8s_prepared: {
|
||||
rts
|
||||
}
|
||||
//SEG133 mulf8u_prepared
|
||||
// Calculate fast multiply with a prepared unsigned byte to a word result
|
||||
// The prepared number is set by calling mulf8u_prepare(byte a)
|
||||
mulf8u_prepared: {
|
||||
.label resL = $fe
|
||||
.label memB = $ff
|
||||
@ -4826,6 +4824,7 @@ mulf8u_prepared: {
|
||||
rts
|
||||
}
|
||||
//SEG139 mulf8u_prepare
|
||||
// Prepare for fast multiply with an unsigned byte to a word result
|
||||
mulf8u_prepare: {
|
||||
.label memA = $fd
|
||||
//SEG140 [84] *((const byte*) mulf8u_prepare::memA#0) ← (byte) mulf8u_prepare::a#2 -- _deref_pbuc1=vbuaa
|
||||
@ -4873,6 +4872,7 @@ init: {
|
||||
rts
|
||||
}
|
||||
//SEG160 mulf_init
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
|
||||
mulf_init: {
|
||||
.label sqr1_hi = 7
|
||||
.label sqr = 9
|
||||
|
@ -136,6 +136,7 @@ scroll_hard: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Find the next char of the scroll text
|
||||
next_char: {
|
||||
ldy #0
|
||||
lda (nxt),y
|
||||
@ -153,6 +154,7 @@ next_char: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Fill the screen with one char
|
||||
fillscreen: {
|
||||
.const fill = $20
|
||||
.label cursor = 3
|
||||
|
@ -1927,6 +1927,7 @@ scroll_hard: {
|
||||
rts
|
||||
}
|
||||
//SEG122 next_char
|
||||
// Find the next char of the scroll text
|
||||
next_char: {
|
||||
.label return = $10
|
||||
.label c = $d
|
||||
@ -1973,6 +1974,7 @@ next_char: {
|
||||
rts
|
||||
}
|
||||
//SEG137 fillscreen
|
||||
// Fill the screen with one char
|
||||
fillscreen: {
|
||||
.const fill = $20
|
||||
.label cursor = $e
|
||||
@ -2262,12 +2264,10 @@ scroll_bit: {
|
||||
//SEG57 [22] call next_char
|
||||
jsr next_char
|
||||
//SEG58 [23] (byte) next_char::return#0 ← (byte) next_char::return#1
|
||||
// (byte) next_char::return#0 = (byte) next_char::return#1 // register copy reg byte a
|
||||
jmp b8
|
||||
//SEG59 scroll_bit::@8
|
||||
b8:
|
||||
//SEG60 [24] (byte~) scroll_bit::$3 ← (byte) next_char::return#0
|
||||
// (byte~) scroll_bit::$3 = (byte) next_char::return#0 // register copy reg byte a
|
||||
//SEG61 [25] (word) scroll_bit::c#0 ← ((word)) (byte~) scroll_bit::$3 -- vwuz1=_word_vbuaa
|
||||
sta c
|
||||
lda #0
|
||||
@ -2437,6 +2437,7 @@ scroll_hard: {
|
||||
rts
|
||||
}
|
||||
//SEG122 next_char
|
||||
// Find the next char of the scroll text
|
||||
next_char: {
|
||||
//SEG123 [58] (byte) next_char::c#0 ← *((byte*) nxt#31) -- vbuaa=_deref_pbuz1
|
||||
ldy #0
|
||||
@ -2477,6 +2478,7 @@ next_char: {
|
||||
rts
|
||||
}
|
||||
//SEG137 fillscreen
|
||||
// Fill the screen with one char
|
||||
fillscreen: {
|
||||
.const fill = $20
|
||||
.label cursor = 3
|
||||
@ -2845,10 +2847,8 @@ scroll_bit: {
|
||||
//SEG57 [22] call next_char
|
||||
jsr next_char
|
||||
//SEG58 [23] (byte) next_char::return#0 ← (byte) next_char::return#1
|
||||
// (byte) next_char::return#0 = (byte) next_char::return#1 // register copy reg byte a
|
||||
//SEG59 scroll_bit::@8
|
||||
//SEG60 [24] (byte~) scroll_bit::$3 ← (byte) next_char::return#0
|
||||
// (byte~) scroll_bit::$3 = (byte) next_char::return#0 // register copy reg byte a
|
||||
//SEG61 [25] (word) scroll_bit::c#0 ← ((word)) (byte~) scroll_bit::$3 -- vwuz1=_word_vbuaa
|
||||
sta c
|
||||
lda #0
|
||||
@ -2992,6 +2992,7 @@ scroll_hard: {
|
||||
rts
|
||||
}
|
||||
//SEG122 next_char
|
||||
// Find the next char of the scroll text
|
||||
next_char: {
|
||||
//SEG123 [58] (byte) next_char::c#0 ← *((byte*) nxt#31) -- vbuaa=_deref_pbuz1
|
||||
ldy #0
|
||||
@ -3024,6 +3025,7 @@ next_char: {
|
||||
rts
|
||||
}
|
||||
//SEG137 fillscreen
|
||||
// Fill the screen with one char
|
||||
fillscreen: {
|
||||
.const fill = $20
|
||||
.label cursor = 3
|
||||
|
@ -228,6 +228,9 @@ render_logo: {
|
||||
iny
|
||||
jmp b11
|
||||
}
|
||||
// Generate signed word sinus table - with values in the range min-max.
|
||||
// sintab - the table to generate into
|
||||
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
|
||||
sin16s_gen2: {
|
||||
.const min = -$140
|
||||
.const max = $140
|
||||
@ -315,6 +318,8 @@ sin16s_gen2: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Multiply of two signed words to a signed double word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
mul16s: {
|
||||
.label _5 = 2
|
||||
.label _6 = $e
|
||||
@ -355,6 +360,7 @@ mul16s: {
|
||||
b2:
|
||||
rts
|
||||
}
|
||||
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
|
||||
mul16u: {
|
||||
.label mb = $12
|
||||
.label a = $10
|
||||
@ -406,6 +412,9 @@ mul16u: {
|
||||
rol mb+3
|
||||
jmp b1
|
||||
}
|
||||
// Calculate signed word sinus sin(x)
|
||||
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
|
||||
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
|
||||
sin16s: {
|
||||
.label _6 = $a
|
||||
.label x = $a
|
||||
@ -579,6 +588,8 @@ sin16s: {
|
||||
b3:
|
||||
rts
|
||||
}
|
||||
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
|
||||
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
|
||||
mulu16_sel: {
|
||||
.label _0 = $a
|
||||
.label _1 = $a
|
||||
@ -608,6 +619,8 @@ mulu16_sel: {
|
||||
sta return+1
|
||||
rts
|
||||
}
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
div32u16u: {
|
||||
.label quotient_hi = $10
|
||||
.label quotient_lo = $e
|
||||
@ -639,6 +652,10 @@ div32u16u: {
|
||||
sta return+1
|
||||
rts
|
||||
}
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
divr16u: {
|
||||
.label rem = 2
|
||||
.label dividend = 8
|
||||
@ -688,6 +705,8 @@ divr16u: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Simple routines for working with memory
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.label end = 8
|
||||
.label addr = 2
|
||||
|
@ -4731,6 +4731,9 @@ render_logo: {
|
||||
jmp b11
|
||||
}
|
||||
//SEG183 sin16s_gen2
|
||||
// Generate signed word sinus table - with values in the range min-max.
|
||||
// sintab - the table to generate into
|
||||
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
|
||||
sin16s_gen2: {
|
||||
.const min = -$140
|
||||
.const max = $140
|
||||
@ -4906,6 +4909,8 @@ sin16s_gen2: {
|
||||
rts
|
||||
}
|
||||
//SEG216 mul16s
|
||||
// Multiply of two signed words to a signed double word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
mul16s: {
|
||||
.label _5 = $6c
|
||||
.label _6 = $6e
|
||||
@ -5005,6 +5010,7 @@ mul16s: {
|
||||
rts
|
||||
}
|
||||
//SEG238 mul16u
|
||||
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
|
||||
mul16u: {
|
||||
.label _1 = $76
|
||||
.label mb = $1d
|
||||
@ -5096,6 +5102,9 @@ mul16u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG262 sin16s
|
||||
// Calculate signed word sinus sin(x)
|
||||
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
|
||||
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
|
||||
sin16s: {
|
||||
.label _6 = $77
|
||||
.label x = $22
|
||||
@ -5451,6 +5460,8 @@ sin16s: {
|
||||
jmp b3_from_b15
|
||||
}
|
||||
//SEG343 mulu16_sel
|
||||
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
|
||||
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
|
||||
mulu16_sel: {
|
||||
.label _0 = $9b
|
||||
.label _1 = $9f
|
||||
@ -5531,6 +5542,8 @@ mulu16_sel: {
|
||||
rts
|
||||
}
|
||||
//SEG357 div32u16u
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
div32u16u: {
|
||||
.label quotient_hi = $a7
|
||||
.label quotient_lo = $ab
|
||||
@ -5607,6 +5620,10 @@ div32u16u: {
|
||||
rts
|
||||
}
|
||||
//SEG376 divr16u
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
divr16u: {
|
||||
.label _1 = $b1
|
||||
.label _2 = $b2
|
||||
@ -5727,6 +5744,8 @@ divr16u: {
|
||||
rts
|
||||
}
|
||||
//SEG413 fill
|
||||
// Simple routines for working with memory
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.label end = $b5
|
||||
.label addr = $35
|
||||
@ -6438,7 +6457,6 @@ loop: {
|
||||
stx xpos
|
||||
sta xpos+1
|
||||
//SEG59 [31] (signed word) render_logo::xpos#0 ← (signed word) loop::xpos#0
|
||||
// (signed word) render_logo::xpos#0 = (signed word) loop::xpos#0 // register copy zp ZP_WORD:8
|
||||
//SEG60 [32] call render_logo
|
||||
jsr render_logo
|
||||
jmp b15
|
||||
@ -6790,6 +6808,9 @@ render_logo: {
|
||||
jmp b11
|
||||
}
|
||||
//SEG183 sin16s_gen2
|
||||
// Generate signed word sinus table - with values in the range min-max.
|
||||
// sintab - the table to generate into
|
||||
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
|
||||
sin16s_gen2: {
|
||||
.const min = -$140
|
||||
.const max = $140
|
||||
@ -6807,12 +6828,10 @@ sin16s_gen2: {
|
||||
div32u16u_from_sin16s_gen2:
|
||||
jsr div32u16u
|
||||
//SEG186 [100] (dword) div32u16u::return#2 ← (dword) div32u16u::return#0
|
||||
// (dword) div32u16u::return#2 = (dword) div32u16u::return#0 // register copy zp ZP_DWORD:27
|
||||
jmp b3
|
||||
//SEG187 sin16s_gen2::@3
|
||||
b3:
|
||||
//SEG188 [101] (dword) sin16s_gen2::step#0 ← (dword) div32u16u::return#2
|
||||
// (dword) sin16s_gen2::step#0 = (dword) div32u16u::return#2 // register copy zp ZP_DWORD:27
|
||||
//SEG189 [102] phi from sin16s_gen2::@3 to sin16s_gen2::@1 [phi:sin16s_gen2::@3->sin16s_gen2::@1]
|
||||
b1_from_b3:
|
||||
//SEG190 [102] phi (word) sin16s_gen2::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:sin16s_gen2::@3->sin16s_gen2::@1#0] -- vwuz1=vbuc1
|
||||
@ -6853,21 +6872,17 @@ sin16s_gen2: {
|
||||
//SEG199 [104] call sin16s
|
||||
jsr sin16s
|
||||
//SEG200 [105] (signed word) sin16s::return#0 ← (signed word) sin16s::return#1
|
||||
// (signed word) sin16s::return#0 = (signed word) sin16s::return#1 // register copy zp ZP_WORD:23
|
||||
jmp b4
|
||||
//SEG201 sin16s_gen2::@4
|
||||
b4:
|
||||
//SEG202 [106] (signed word) mul16s::a#0 ← (signed word) sin16s::return#0
|
||||
// (signed word) mul16s::a#0 = (signed word) sin16s::return#0 // register copy zp ZP_WORD:23
|
||||
//SEG203 [107] call mul16s
|
||||
jsr mul16s
|
||||
//SEG204 [108] (signed dword) mul16s::return#2 ← (signed dword) mul16s::return#0
|
||||
// (signed dword) mul16s::return#2 = (signed dword) mul16s::return#0 // register copy zp ZP_DWORD:10
|
||||
jmp b5
|
||||
//SEG205 sin16s_gen2::@5
|
||||
b5:
|
||||
//SEG206 [109] (signed dword~) sin16s_gen2::$5 ← (signed dword) mul16s::return#2
|
||||
// (signed dword~) sin16s_gen2::$5 = (signed dword) mul16s::return#2 // register copy zp ZP_DWORD:10
|
||||
//SEG207 [110] (word~) sin16s_gen2::$6 ← > (signed dword~) sin16s_gen2::$5 -- vwuz1=_hi_vdsz2
|
||||
lda _5+2
|
||||
sta _6
|
||||
@ -6931,6 +6946,8 @@ sin16s_gen2: {
|
||||
rts
|
||||
}
|
||||
//SEG216 mul16s
|
||||
// Multiply of two signed words to a signed double word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
mul16s: {
|
||||
.label _5 = 2
|
||||
.label _6 = $e
|
||||
@ -6954,12 +6971,10 @@ mul16s: {
|
||||
sta mul16u.b+1
|
||||
jsr mul16u
|
||||
//SEG222 [120] (dword) mul16u::return#2 ← (dword) mul16u::res#2
|
||||
// (dword) mul16u::return#2 = (dword) mul16u::res#2 // register copy zp ZP_DWORD:10
|
||||
jmp b6
|
||||
//SEG223 mul16s::@6
|
||||
b6:
|
||||
//SEG224 [121] (dword) mul16s::m#0 ← (dword) mul16u::return#2
|
||||
// (dword) mul16s::m#0 = (dword) mul16u::return#2 // register copy zp ZP_DWORD:10
|
||||
//SEG225 [122] if((signed word) mul16s::a#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul16s::@1 -- vwsz1_ge_0_then_la1
|
||||
lda a+1
|
||||
bpl b1_from_b6
|
||||
@ -7007,6 +7022,7 @@ mul16s: {
|
||||
rts
|
||||
}
|
||||
//SEG238 mul16u
|
||||
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
|
||||
mul16u: {
|
||||
.label mb = $12
|
||||
.label a = $10
|
||||
@ -7094,6 +7110,9 @@ mul16u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG262 sin16s
|
||||
// Calculate signed word sinus sin(x)
|
||||
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
|
||||
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
|
||||
sin16s: {
|
||||
.label _6 = $a
|
||||
.label x = $a
|
||||
@ -7232,7 +7251,6 @@ sin16s: {
|
||||
//SEG287 [181] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#0 [phi:sin16s::@2->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG288 [152] (word) mulu16_sel::return#0 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#0 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:14
|
||||
jmp b8
|
||||
//SEG289 sin16s::@8
|
||||
b8:
|
||||
@ -7242,7 +7260,6 @@ sin16s: {
|
||||
lda mulu16_sel.return+1
|
||||
sta x2+1
|
||||
//SEG291 [154] (word) mulu16_sel::v1#1 ← (word) sin16s::x2#0
|
||||
// (word) mulu16_sel::v1#1 = (word) sin16s::x2#0 // register copy zp ZP_WORD:25
|
||||
//SEG292 [155] (word) mulu16_sel::v2#1 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -7265,9 +7282,7 @@ sin16s: {
|
||||
//SEG299 sin16s::@9
|
||||
b9:
|
||||
//SEG300 [158] (word) sin16s::x3#0 ← (word) mulu16_sel::return#1
|
||||
// (word) sin16s::x3#0 = (word) mulu16_sel::return#1 // register copy zp ZP_WORD:25
|
||||
//SEG301 [159] (word) mulu16_sel::v1#2 ← (word) sin16s::x3#0
|
||||
// (word) mulu16_sel::v1#2 = (word) sin16s::x3#0 // register copy zp ZP_WORD:25
|
||||
//SEG302 [160] call mulu16_sel
|
||||
//SEG303 [181] phi from sin16s::@9 to mulu16_sel [phi:sin16s::@9->mulu16_sel]
|
||||
mulu16_sel_from_b9:
|
||||
@ -7281,12 +7296,10 @@ sin16s: {
|
||||
//SEG306 [181] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#2 [phi:sin16s::@9->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG307 [161] (word) mulu16_sel::return#2 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#2 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:14
|
||||
jmp b10
|
||||
//SEG308 sin16s::@10
|
||||
b10:
|
||||
//SEG309 [162] (word) sin16s::x3_6#0 ← (word) mulu16_sel::return#2
|
||||
// (word) sin16s::x3_6#0 = (word) mulu16_sel::return#2 // register copy zp ZP_WORD:14
|
||||
//SEG310 [163] (word) sin16s::usinx#0 ← (word) sin16s::x1#0 - (word) sin16s::x3_6#0 -- vwuz1=vwuz2_minus_vwuz3
|
||||
lda x1
|
||||
sec
|
||||
@ -7296,7 +7309,6 @@ sin16s: {
|
||||
sbc x3_6+1
|
||||
sta usinx+1
|
||||
//SEG311 [164] (word) mulu16_sel::v1#3 ← (word) sin16s::x3#0
|
||||
// (word) mulu16_sel::v1#3 = (word) sin16s::x3#0 // register copy zp ZP_WORD:25
|
||||
//SEG312 [165] (word) mulu16_sel::v2#3 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -7319,9 +7331,7 @@ sin16s: {
|
||||
//SEG319 sin16s::@11
|
||||
b11:
|
||||
//SEG320 [168] (word) sin16s::x4#0 ← (word) mulu16_sel::return#10
|
||||
// (word) sin16s::x4#0 = (word) mulu16_sel::return#10 // register copy zp ZP_WORD:25
|
||||
//SEG321 [169] (word) mulu16_sel::v1#4 ← (word) sin16s::x4#0
|
||||
// (word) mulu16_sel::v1#4 = (word) sin16s::x4#0 // register copy zp ZP_WORD:25
|
||||
//SEG322 [170] (word) mulu16_sel::v2#4 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -7336,12 +7346,10 @@ sin16s: {
|
||||
//SEG327 [181] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#4 [phi:sin16s::@11->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG328 [172] (word) mulu16_sel::return#11 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#11 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:14
|
||||
jmp b12
|
||||
//SEG329 sin16s::@12
|
||||
b12:
|
||||
//SEG330 [173] (word) sin16s::x5#0 ← (word) mulu16_sel::return#11
|
||||
// (word) sin16s::x5#0 = (word) mulu16_sel::return#11 // register copy zp ZP_WORD:14
|
||||
//SEG331 [174] (word) sin16s::x5_128#0 ← (word) sin16s::x5#0 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vwuz1=vwuz1_ror_4
|
||||
ldy #4
|
||||
!:
|
||||
@ -7389,10 +7397,11 @@ sin16s: {
|
||||
//SEG341 sin16s::@15
|
||||
b15:
|
||||
//SEG342 [180] (signed word~) sin16s::return#5 ← (signed word)(word) sin16s::usinx#1
|
||||
// (signed word~) sin16s::return#5 = (signed word)(word) sin16s::usinx#1 // register copy zp ZP_WORD:23
|
||||
jmp b3_from_b15
|
||||
}
|
||||
//SEG343 mulu16_sel
|
||||
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
|
||||
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
|
||||
mulu16_sel: {
|
||||
.label _0 = $a
|
||||
.label _1 = $a
|
||||
@ -7407,7 +7416,6 @@ mulu16_sel: {
|
||||
lda v1+1
|
||||
sta mul16u.a+1
|
||||
//SEG345 [183] (word) mul16u::b#1 ← (word) mulu16_sel::v2#5
|
||||
// (word) mul16u::b#1 = (word) mulu16_sel::v2#5 // register copy zp ZP_WORD:14
|
||||
//SEG346 [184] call mul16u
|
||||
//SEG347 [130] phi from mulu16_sel to mul16u [phi:mulu16_sel->mul16u]
|
||||
mul16u_from_mulu16_sel:
|
||||
@ -7415,12 +7423,10 @@ mulu16_sel: {
|
||||
//SEG349 [130] phi (word) mul16u::b#2 = (word) mul16u::b#1 [phi:mulu16_sel->mul16u#1] -- register_copy
|
||||
jsr mul16u
|
||||
//SEG350 [185] (dword) mul16u::return#3 ← (dword) mul16u::res#2
|
||||
// (dword) mul16u::return#3 = (dword) mul16u::res#2 // register copy zp ZP_DWORD:10
|
||||
jmp b2
|
||||
//SEG351 mulu16_sel::@2
|
||||
b2:
|
||||
//SEG352 [186] (dword~) mulu16_sel::$0 ← (dword) mul16u::return#3
|
||||
// (dword~) mulu16_sel::$0 = (dword) mul16u::return#3 // register copy zp ZP_DWORD:10
|
||||
//SEG353 [187] (dword~) mulu16_sel::$1 ← (dword~) mulu16_sel::$0 << (byte) mulu16_sel::select#5 -- vduz1=vduz1_rol_vbuxx
|
||||
cpx #0
|
||||
beq !e+
|
||||
@ -7444,6 +7450,8 @@ mulu16_sel: {
|
||||
rts
|
||||
}
|
||||
//SEG357 div32u16u
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
div32u16u: {
|
||||
.label quotient_hi = $10
|
||||
.label quotient_lo = $e
|
||||
@ -7463,7 +7471,6 @@ div32u16u: {
|
||||
sta divr16u.rem+1
|
||||
jsr divr16u
|
||||
//SEG362 [192] (word) divr16u::return#2 ← (word) divr16u::return#0
|
||||
// (word) divr16u::return#2 = (word) divr16u::return#0 // register copy zp ZP_WORD:14
|
||||
jmp b2
|
||||
//SEG363 div32u16u::@2
|
||||
b2:
|
||||
@ -7473,7 +7480,6 @@ div32u16u: {
|
||||
lda divr16u.return+1
|
||||
sta quotient_hi+1
|
||||
//SEG365 [194] (word) divr16u::rem#4 ← (word) rem16u#1
|
||||
// (word) divr16u::rem#4 = (word) rem16u#1 // register copy zp ZP_WORD:2
|
||||
//SEG366 [195] call divr16u
|
||||
//SEG367 [200] phi from div32u16u::@2 to divr16u [phi:div32u16u::@2->divr16u]
|
||||
divr16u_from_b2:
|
||||
@ -7485,12 +7491,10 @@ div32u16u: {
|
||||
//SEG369 [200] phi (word) divr16u::rem#10 = (word) divr16u::rem#4 [phi:div32u16u::@2->divr16u#1] -- register_copy
|
||||
jsr divr16u
|
||||
//SEG370 [196] (word) divr16u::return#3 ← (word) divr16u::return#0
|
||||
// (word) divr16u::return#3 = (word) divr16u::return#0 // register copy zp ZP_WORD:14
|
||||
jmp b3
|
||||
//SEG371 div32u16u::@3
|
||||
b3:
|
||||
//SEG372 [197] (word) div32u16u::quotient_lo#0 ← (word) divr16u::return#3
|
||||
// (word) div32u16u::quotient_lo#0 = (word) divr16u::return#3 // register copy zp ZP_WORD:14
|
||||
//SEG373 [198] (dword) div32u16u::return#0 ← (word) div32u16u::quotient_hi#0 dw= (word) div32u16u::quotient_lo#0 -- vduz1=vwuz2_dword_vwuz3
|
||||
lda quotient_hi
|
||||
sta return+2
|
||||
@ -7507,6 +7511,10 @@ div32u16u: {
|
||||
rts
|
||||
}
|
||||
//SEG376 divr16u
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
divr16u: {
|
||||
.label rem = 2
|
||||
.label dividend = 8
|
||||
@ -7605,7 +7613,6 @@ divr16u: {
|
||||
//SEG409 divr16u::@6
|
||||
b6:
|
||||
//SEG410 [216] (word) rem16u#1 ← (word) divr16u::rem#11
|
||||
// (word) rem16u#1 = (word) divr16u::rem#11 // register copy zp ZP_WORD:2
|
||||
jmp breturn
|
||||
//SEG411 divr16u::@return
|
||||
breturn:
|
||||
@ -7613,6 +7620,8 @@ divr16u: {
|
||||
rts
|
||||
}
|
||||
//SEG413 fill
|
||||
// Simple routines for working with memory
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.label end = 8
|
||||
.label addr = 2
|
||||
@ -7798,6 +7807,7 @@ Removing instruction b16_from_b15:
|
||||
Removing instruction b7_from_b16:
|
||||
Removing instruction b15_from_b11:
|
||||
Removing instruction b15_from_b35:
|
||||
Removing instruction b1_from_b3:
|
||||
Removing instruction b1_from_b5:
|
||||
Removing instruction b1_from_b3:
|
||||
Removing instruction b1_from_b6:
|
||||
@ -7807,6 +7817,7 @@ Removing instruction b4_from_b2:
|
||||
Removing instruction b4_from_b7:
|
||||
Removing instruction b2_from_b1:
|
||||
Removing instruction b2_from_b5:
|
||||
Removing instruction mulu16_sel_from_b9:
|
||||
Removing instruction b3_from_b15:
|
||||
Removing instruction b3_from_b6:
|
||||
Removing instruction breturn:
|
||||
@ -7815,6 +7826,7 @@ Removing instruction b2_from_b1:
|
||||
Removing instruction b2_from_b4:
|
||||
Removing instruction b3_from_b2:
|
||||
Removing instruction b3_from_b5:
|
||||
Removing instruction breturn:
|
||||
Removing instruction b1_from_fill:
|
||||
Removing instruction b1_from_b1:
|
||||
Succesful ASM optimization Pass5RedundantLabelElimination
|
||||
@ -7863,7 +7875,6 @@ Removing instruction b31:
|
||||
Removing instruction b11_from_b31:
|
||||
Removing instruction div32u16u_from_sin16s_gen2:
|
||||
Removing instruction b3:
|
||||
Removing instruction b1_from_b3:
|
||||
Removing instruction b4:
|
||||
Removing instruction b5:
|
||||
Removing instruction breturn:
|
||||
@ -7881,7 +7892,6 @@ Removing instruction mulu16_sel_from_b2:
|
||||
Removing instruction b8:
|
||||
Removing instruction mulu16_sel_from_b8:
|
||||
Removing instruction b9:
|
||||
Removing instruction mulu16_sel_from_b9:
|
||||
Removing instruction b10:
|
||||
Removing instruction mulu16_sel_from_b10:
|
||||
Removing instruction b11:
|
||||
@ -7901,7 +7911,6 @@ Removing instruction b4:
|
||||
Removing instruction b5:
|
||||
Removing instruction b6:
|
||||
Removing instruction breturn:
|
||||
Removing instruction breturn:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
Updating BasicUpstart to call main directly
|
||||
Removing instruction jsr main
|
||||
@ -8565,7 +8574,6 @@ loop: {
|
||||
stx xpos
|
||||
sta xpos+1
|
||||
//SEG59 [31] (signed word) render_logo::xpos#0 ← (signed word) loop::xpos#0
|
||||
// (signed word) render_logo::xpos#0 = (signed word) loop::xpos#0 // register copy zp ZP_WORD:8
|
||||
//SEG60 [32] call render_logo
|
||||
jsr render_logo
|
||||
//SEG61 loop::@15
|
||||
@ -8835,6 +8843,9 @@ render_logo: {
|
||||
jmp b11
|
||||
}
|
||||
//SEG183 sin16s_gen2
|
||||
// Generate signed word sinus table - with values in the range min-max.
|
||||
// sintab - the table to generate into
|
||||
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
|
||||
sin16s_gen2: {
|
||||
.const min = -$140
|
||||
.const max = $140
|
||||
@ -8851,10 +8862,8 @@ sin16s_gen2: {
|
||||
//SEG185 [190] phi from sin16s_gen2 to div32u16u [phi:sin16s_gen2->div32u16u]
|
||||
jsr div32u16u
|
||||
//SEG186 [100] (dword) div32u16u::return#2 ← (dword) div32u16u::return#0
|
||||
// (dword) div32u16u::return#2 = (dword) div32u16u::return#0 // register copy zp ZP_DWORD:27
|
||||
//SEG187 sin16s_gen2::@3
|
||||
//SEG188 [101] (dword) sin16s_gen2::step#0 ← (dword) div32u16u::return#2
|
||||
// (dword) sin16s_gen2::step#0 = (dword) div32u16u::return#2 // register copy zp ZP_DWORD:27
|
||||
//SEG189 [102] phi from sin16s_gen2::@3 to sin16s_gen2::@1 [phi:sin16s_gen2::@3->sin16s_gen2::@1]
|
||||
//SEG190 [102] phi (word) sin16s_gen2::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:sin16s_gen2::@3->sin16s_gen2::@1#0] -- vwuz1=vbuc1
|
||||
lda #<0
|
||||
@ -8889,17 +8898,13 @@ sin16s_gen2: {
|
||||
//SEG199 [104] call sin16s
|
||||
jsr sin16s
|
||||
//SEG200 [105] (signed word) sin16s::return#0 ← (signed word) sin16s::return#1
|
||||
// (signed word) sin16s::return#0 = (signed word) sin16s::return#1 // register copy zp ZP_WORD:23
|
||||
//SEG201 sin16s_gen2::@4
|
||||
//SEG202 [106] (signed word) mul16s::a#0 ← (signed word) sin16s::return#0
|
||||
// (signed word) mul16s::a#0 = (signed word) sin16s::return#0 // register copy zp ZP_WORD:23
|
||||
//SEG203 [107] call mul16s
|
||||
jsr mul16s
|
||||
//SEG204 [108] (signed dword) mul16s::return#2 ← (signed dword) mul16s::return#0
|
||||
// (signed dword) mul16s::return#2 = (signed dword) mul16s::return#0 // register copy zp ZP_DWORD:10
|
||||
//SEG205 sin16s_gen2::@5
|
||||
//SEG206 [109] (signed dword~) sin16s_gen2::$5 ← (signed dword) mul16s::return#2
|
||||
// (signed dword~) sin16s_gen2::$5 = (signed dword) mul16s::return#2 // register copy zp ZP_DWORD:10
|
||||
//SEG207 [110] (word~) sin16s_gen2::$6 ← > (signed dword~) sin16s_gen2::$5 -- vwuz1=_hi_vdsz2
|
||||
lda _5+2
|
||||
sta _6
|
||||
@ -8961,6 +8966,8 @@ sin16s_gen2: {
|
||||
rts
|
||||
}
|
||||
//SEG216 mul16s
|
||||
// Multiply of two signed words to a signed double word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
mul16s: {
|
||||
.label _5 = 2
|
||||
.label _6 = $e
|
||||
@ -8983,10 +8990,8 @@ mul16s: {
|
||||
sta mul16u.b+1
|
||||
jsr mul16u
|
||||
//SEG222 [120] (dword) mul16u::return#2 ← (dword) mul16u::res#2
|
||||
// (dword) mul16u::return#2 = (dword) mul16u::res#2 // register copy zp ZP_DWORD:10
|
||||
//SEG223 mul16s::@6
|
||||
//SEG224 [121] (dword) mul16s::m#0 ← (dword) mul16u::return#2
|
||||
// (dword) mul16s::m#0 = (dword) mul16u::return#2 // register copy zp ZP_DWORD:10
|
||||
//SEG225 [122] if((signed word) mul16s::a#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul16s::@1 -- vwsz1_ge_0_then_la1
|
||||
lda a+1
|
||||
bpl b2
|
||||
@ -9025,6 +9030,7 @@ mul16s: {
|
||||
rts
|
||||
}
|
||||
//SEG238 mul16u
|
||||
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
|
||||
mul16u: {
|
||||
.label mb = $12
|
||||
.label a = $10
|
||||
@ -9100,6 +9106,9 @@ mul16u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG262 sin16s
|
||||
// Calculate signed word sinus sin(x)
|
||||
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
|
||||
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
|
||||
sin16s: {
|
||||
.label _6 = $a
|
||||
.label x = $a
|
||||
@ -9228,7 +9237,6 @@ sin16s: {
|
||||
//SEG287 [181] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#0 [phi:sin16s::@2->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG288 [152] (word) mulu16_sel::return#0 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#0 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:14
|
||||
//SEG289 sin16s::@8
|
||||
//SEG290 [153] (word) sin16s::x2#0 ← (word) mulu16_sel::return#0 -- vwuz1=vwuz2
|
||||
lda mulu16_sel.return
|
||||
@ -9236,7 +9244,6 @@ sin16s: {
|
||||
lda mulu16_sel.return+1
|
||||
sta x2+1
|
||||
//SEG291 [154] (word) mulu16_sel::v1#1 ← (word) sin16s::x2#0
|
||||
// (word) mulu16_sel::v1#1 = (word) sin16s::x2#0 // register copy zp ZP_WORD:25
|
||||
//SEG292 [155] (word) mulu16_sel::v2#1 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -9256,9 +9263,7 @@ sin16s: {
|
||||
sta mulu16_sel.return_1+1
|
||||
//SEG299 sin16s::@9
|
||||
//SEG300 [158] (word) sin16s::x3#0 ← (word) mulu16_sel::return#1
|
||||
// (word) sin16s::x3#0 = (word) mulu16_sel::return#1 // register copy zp ZP_WORD:25
|
||||
//SEG301 [159] (word) mulu16_sel::v1#2 ← (word) sin16s::x3#0
|
||||
// (word) mulu16_sel::v1#2 = (word) sin16s::x3#0 // register copy zp ZP_WORD:25
|
||||
//SEG302 [160] call mulu16_sel
|
||||
//SEG303 [181] phi from sin16s::@9 to mulu16_sel [phi:sin16s::@9->mulu16_sel]
|
||||
//SEG304 [181] phi (byte) mulu16_sel::select#5 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:sin16s::@9->mulu16_sel#0] -- vbuxx=vbuc1
|
||||
@ -9271,10 +9276,8 @@ sin16s: {
|
||||
//SEG306 [181] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#2 [phi:sin16s::@9->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG307 [161] (word) mulu16_sel::return#2 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#2 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:14
|
||||
//SEG308 sin16s::@10
|
||||
//SEG309 [162] (word) sin16s::x3_6#0 ← (word) mulu16_sel::return#2
|
||||
// (word) sin16s::x3_6#0 = (word) mulu16_sel::return#2 // register copy zp ZP_WORD:14
|
||||
//SEG310 [163] (word) sin16s::usinx#0 ← (word) sin16s::x1#0 - (word) sin16s::x3_6#0 -- vwuz1=vwuz2_minus_vwuz3
|
||||
lda x1
|
||||
sec
|
||||
@ -9284,7 +9287,6 @@ sin16s: {
|
||||
sbc x3_6+1
|
||||
sta usinx+1
|
||||
//SEG311 [164] (word) mulu16_sel::v1#3 ← (word) sin16s::x3#0
|
||||
// (word) mulu16_sel::v1#3 = (word) sin16s::x3#0 // register copy zp ZP_WORD:25
|
||||
//SEG312 [165] (word) mulu16_sel::v2#3 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -9304,9 +9306,7 @@ sin16s: {
|
||||
sta mulu16_sel.return_10+1
|
||||
//SEG319 sin16s::@11
|
||||
//SEG320 [168] (word) sin16s::x4#0 ← (word) mulu16_sel::return#10
|
||||
// (word) sin16s::x4#0 = (word) mulu16_sel::return#10 // register copy zp ZP_WORD:25
|
||||
//SEG321 [169] (word) mulu16_sel::v1#4 ← (word) sin16s::x4#0
|
||||
// (word) mulu16_sel::v1#4 = (word) sin16s::x4#0 // register copy zp ZP_WORD:25
|
||||
//SEG322 [170] (word) mulu16_sel::v2#4 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -9320,10 +9320,8 @@ sin16s: {
|
||||
//SEG327 [181] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#4 [phi:sin16s::@11->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG328 [172] (word) mulu16_sel::return#11 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#11 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:14
|
||||
//SEG329 sin16s::@12
|
||||
//SEG330 [173] (word) sin16s::x5#0 ← (word) mulu16_sel::return#11
|
||||
// (word) sin16s::x5#0 = (word) mulu16_sel::return#11 // register copy zp ZP_WORD:14
|
||||
//SEG331 [174] (word) sin16s::x5_128#0 ← (word) sin16s::x5#0 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vwuz1=vwuz1_ror_4
|
||||
ldy #4
|
||||
!:
|
||||
@ -9363,9 +9361,10 @@ sin16s: {
|
||||
rts
|
||||
//SEG341 sin16s::@15
|
||||
//SEG342 [180] (signed word~) sin16s::return#5 ← (signed word)(word) sin16s::usinx#1
|
||||
// (signed word~) sin16s::return#5 = (signed word)(word) sin16s::usinx#1 // register copy zp ZP_WORD:23
|
||||
}
|
||||
//SEG343 mulu16_sel
|
||||
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
|
||||
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
|
||||
mulu16_sel: {
|
||||
.label _0 = $a
|
||||
.label _1 = $a
|
||||
@ -9380,17 +9379,14 @@ mulu16_sel: {
|
||||
lda v1+1
|
||||
sta mul16u.a+1
|
||||
//SEG345 [183] (word) mul16u::b#1 ← (word) mulu16_sel::v2#5
|
||||
// (word) mul16u::b#1 = (word) mulu16_sel::v2#5 // register copy zp ZP_WORD:14
|
||||
//SEG346 [184] call mul16u
|
||||
//SEG347 [130] phi from mulu16_sel to mul16u [phi:mulu16_sel->mul16u]
|
||||
//SEG348 [130] phi (word) mul16u::a#6 = (word) mul16u::a#2 [phi:mulu16_sel->mul16u#0] -- register_copy
|
||||
//SEG349 [130] phi (word) mul16u::b#2 = (word) mul16u::b#1 [phi:mulu16_sel->mul16u#1] -- register_copy
|
||||
jsr mul16u
|
||||
//SEG350 [185] (dword) mul16u::return#3 ← (dword) mul16u::res#2
|
||||
// (dword) mul16u::return#3 = (dword) mul16u::res#2 // register copy zp ZP_DWORD:10
|
||||
//SEG351 mulu16_sel::@2
|
||||
//SEG352 [186] (dword~) mulu16_sel::$0 ← (dword) mul16u::return#3
|
||||
// (dword~) mulu16_sel::$0 = (dword) mul16u::return#3 // register copy zp ZP_DWORD:10
|
||||
//SEG353 [187] (dword~) mulu16_sel::$1 ← (dword~) mulu16_sel::$0 << (byte) mulu16_sel::select#5 -- vduz1=vduz1_rol_vbuxx
|
||||
cpx #0
|
||||
beq !e+
|
||||
@ -9412,6 +9408,8 @@ mulu16_sel: {
|
||||
rts
|
||||
}
|
||||
//SEG357 div32u16u
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
div32u16u: {
|
||||
.label quotient_hi = $10
|
||||
.label quotient_lo = $e
|
||||
@ -9429,7 +9427,6 @@ div32u16u: {
|
||||
sta divr16u.rem+1
|
||||
jsr divr16u
|
||||
//SEG362 [192] (word) divr16u::return#2 ← (word) divr16u::return#0
|
||||
// (word) divr16u::return#2 = (word) divr16u::return#0 // register copy zp ZP_WORD:14
|
||||
//SEG363 div32u16u::@2
|
||||
//SEG364 [193] (word) div32u16u::quotient_hi#0 ← (word) divr16u::return#2 -- vwuz1=vwuz2
|
||||
lda divr16u.return
|
||||
@ -9437,7 +9434,6 @@ div32u16u: {
|
||||
lda divr16u.return+1
|
||||
sta quotient_hi+1
|
||||
//SEG365 [194] (word) divr16u::rem#4 ← (word) rem16u#1
|
||||
// (word) divr16u::rem#4 = (word) rem16u#1 // register copy zp ZP_WORD:2
|
||||
//SEG366 [195] call divr16u
|
||||
//SEG367 [200] phi from div32u16u::@2 to divr16u [phi:div32u16u::@2->divr16u]
|
||||
//SEG368 [200] phi (word) divr16u::dividend#5 = <(const dword) PI2_u4f28#0 [phi:div32u16u::@2->divr16u#0] -- vwuz1=vwuc1
|
||||
@ -9448,10 +9444,8 @@ div32u16u: {
|
||||
//SEG369 [200] phi (word) divr16u::rem#10 = (word) divr16u::rem#4 [phi:div32u16u::@2->divr16u#1] -- register_copy
|
||||
jsr divr16u
|
||||
//SEG370 [196] (word) divr16u::return#3 ← (word) divr16u::return#0
|
||||
// (word) divr16u::return#3 = (word) divr16u::return#0 // register copy zp ZP_WORD:14
|
||||
//SEG371 div32u16u::@3
|
||||
//SEG372 [197] (word) div32u16u::quotient_lo#0 ← (word) divr16u::return#3
|
||||
// (word) div32u16u::quotient_lo#0 = (word) divr16u::return#3 // register copy zp ZP_WORD:14
|
||||
//SEG373 [198] (dword) div32u16u::return#0 ← (word) div32u16u::quotient_hi#0 dw= (word) div32u16u::quotient_lo#0 -- vduz1=vwuz2_dword_vwuz3
|
||||
lda quotient_hi
|
||||
sta return+2
|
||||
@ -9466,6 +9460,10 @@ div32u16u: {
|
||||
rts
|
||||
}
|
||||
//SEG376 divr16u
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
divr16u: {
|
||||
.label rem = 2
|
||||
.label dividend = 8
|
||||
@ -9547,12 +9545,13 @@ divr16u: {
|
||||
bne b1
|
||||
//SEG409 divr16u::@6
|
||||
//SEG410 [216] (word) rem16u#1 ← (word) divr16u::rem#11
|
||||
// (word) rem16u#1 = (word) divr16u::rem#11 // register copy zp ZP_WORD:2
|
||||
//SEG411 divr16u::@return
|
||||
//SEG412 [217] return
|
||||
rts
|
||||
}
|
||||
//SEG413 fill
|
||||
// Simple routines for working with memory
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.label end = 8
|
||||
.label addr = 2
|
||||
|
@ -60,6 +60,7 @@ main: {
|
||||
inc $d020
|
||||
jmp b3
|
||||
}
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.label end = 2
|
||||
.label addr = 4
|
||||
|
@ -998,6 +998,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG43 fill
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.label end = 8
|
||||
.label addr = 6
|
||||
@ -1220,6 +1221,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG43 fill
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.label end = 2
|
||||
.label addr = 4
|
||||
@ -1565,6 +1567,7 @@ main: {
|
||||
jmp b3
|
||||
}
|
||||
//SEG43 fill
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.label end = 2
|
||||
.label addr = 4
|
||||
|
@ -151,6 +151,7 @@ render_sine: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Plot a single dot in the bitmap
|
||||
bitmap_plot: {
|
||||
.label _1 = $10
|
||||
.label plotter = 6
|
||||
@ -216,6 +217,9 @@ wrap_y: {
|
||||
sta y+1
|
||||
jmp b1
|
||||
}
|
||||
// Generate signed word sinus table - with values in the range min-max.
|
||||
// sintab - the table to generate into
|
||||
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
|
||||
sin16s_gen2: {
|
||||
.const min = -$140
|
||||
.const max = $140
|
||||
@ -303,6 +307,8 @@ sin16s_gen2: {
|
||||
!:
|
||||
rts
|
||||
}
|
||||
// Multiply of two signed words to a signed double word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
mul16s: {
|
||||
.label _5 = 2
|
||||
.label _6 = 6
|
||||
@ -343,6 +349,7 @@ mul16s: {
|
||||
b2:
|
||||
rts
|
||||
}
|
||||
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
|
||||
mul16u: {
|
||||
.label mb = $12
|
||||
.label a = $10
|
||||
@ -394,6 +401,9 @@ mul16u: {
|
||||
rol mb+3
|
||||
jmp b1
|
||||
}
|
||||
// Calculate signed word sinus sin(x)
|
||||
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
|
||||
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
|
||||
sin16s: {
|
||||
.label _6 = $c
|
||||
.label x = $c
|
||||
@ -567,6 +577,8 @@ sin16s: {
|
||||
b3:
|
||||
rts
|
||||
}
|
||||
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
|
||||
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
|
||||
mulu16_sel: {
|
||||
.label _0 = $c
|
||||
.label _1 = $c
|
||||
@ -596,6 +608,8 @@ mulu16_sel: {
|
||||
sta return+1
|
||||
rts
|
||||
}
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
div32u16u: {
|
||||
.label quotient_hi = $10
|
||||
.label quotient_lo = 6
|
||||
@ -627,6 +641,10 @@ div32u16u: {
|
||||
sta return+1
|
||||
rts
|
||||
}
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
divr16u: {
|
||||
.label rem = 2
|
||||
.label dividend = 4
|
||||
@ -676,6 +694,7 @@ divr16u: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = 2
|
||||
.label y = $16
|
||||
@ -705,6 +724,7 @@ bitmap_clear: {
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Initialize bitmap plotting tables
|
||||
bitmap_init: {
|
||||
.label _3 = $16
|
||||
.label yoffs = 2
|
||||
@ -751,6 +771,8 @@ bitmap_init: {
|
||||
bne b3
|
||||
rts
|
||||
}
|
||||
// Simple routines for working with memory
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.const size = $3e8
|
||||
.label end = SCREEN+size
|
||||
|
@ -4070,6 +4070,7 @@ render_sine: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG101 bitmap_plot
|
||||
// Plot a single dot in the bitmap
|
||||
bitmap_plot: {
|
||||
.label _1 = $53
|
||||
.label _2 = $57
|
||||
@ -4181,6 +4182,9 @@ wrap_y: {
|
||||
jmp b1_from_b2
|
||||
}
|
||||
//SEG126 sin16s_gen2
|
||||
// Generate signed word sinus table - with values in the range min-max.
|
||||
// sintab - the table to generate into
|
||||
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
|
||||
sin16s_gen2: {
|
||||
.const min = -$140
|
||||
.const max = $140
|
||||
@ -4356,6 +4360,8 @@ sin16s_gen2: {
|
||||
rts
|
||||
}
|
||||
//SEG159 mul16s
|
||||
// Multiply of two signed words to a signed double word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
mul16s: {
|
||||
.label _5 = $75
|
||||
.label _6 = $77
|
||||
@ -4455,6 +4461,7 @@ mul16s: {
|
||||
rts
|
||||
}
|
||||
//SEG181 mul16u
|
||||
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
|
||||
mul16u: {
|
||||
.label _1 = $7f
|
||||
.label mb = $1f
|
||||
@ -4546,6 +4553,9 @@ mul16u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG205 sin16s
|
||||
// Calculate signed word sinus sin(x)
|
||||
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
|
||||
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
|
||||
sin16s: {
|
||||
.label _6 = $80
|
||||
.label x = $24
|
||||
@ -4901,6 +4911,8 @@ sin16s: {
|
||||
jmp b3_from_b15
|
||||
}
|
||||
//SEG286 mulu16_sel
|
||||
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
|
||||
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
|
||||
mulu16_sel: {
|
||||
.label _0 = $a4
|
||||
.label _1 = $a8
|
||||
@ -4981,6 +4993,8 @@ mulu16_sel: {
|
||||
rts
|
||||
}
|
||||
//SEG300 div32u16u
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
div32u16u: {
|
||||
.label quotient_hi = $b0
|
||||
.label quotient_lo = $b4
|
||||
@ -5057,6 +5071,10 @@ div32u16u: {
|
||||
rts
|
||||
}
|
||||
//SEG319 divr16u
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
divr16u: {
|
||||
.label _1 = $ba
|
||||
.label _2 = $bb
|
||||
@ -5177,6 +5195,7 @@ divr16u: {
|
||||
rts
|
||||
}
|
||||
//SEG356 bitmap_clear
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = $37
|
||||
.label x = $39
|
||||
@ -5251,6 +5270,7 @@ bitmap_clear: {
|
||||
rts
|
||||
}
|
||||
//SEG382 bitmap_init
|
||||
// Initialize bitmap plotting tables
|
||||
bitmap_init: {
|
||||
.label _3 = $c0
|
||||
.label _4 = $c1
|
||||
@ -5389,6 +5409,8 @@ bitmap_init: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG426 fill
|
||||
// Simple routines for working with memory
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.const size = $3e8
|
||||
.label end = SCREEN+size
|
||||
@ -6081,23 +6103,19 @@ render_sine: {
|
||||
stx sin_val
|
||||
sta sin_val+1
|
||||
//SEG57 [30] (signed word) wrap_y::y#0 ← (signed word) render_sine::sin_val#0
|
||||
// (signed word) wrap_y::y#0 = (signed word) render_sine::sin_val#0 // register copy zp ZP_WORD:6
|
||||
//SEG58 [31] call wrap_y
|
||||
//SEG59 [61] phi from render_sine::@1 to wrap_y [phi:render_sine::@1->wrap_y]
|
||||
wrap_y_from_b1:
|
||||
//SEG60 [61] phi (signed word) wrap_y::y#9 = (signed word) wrap_y::y#0 [phi:render_sine::@1->wrap_y#0] -- register_copy
|
||||
jsr wrap_y
|
||||
//SEG61 [32] (byte) wrap_y::return#0 ← (byte) wrap_y::return#2
|
||||
// (byte) wrap_y::return#0 = (byte) wrap_y::return#2 // register copy reg byte a
|
||||
jmp b5
|
||||
//SEG62 render_sine::@5
|
||||
b5:
|
||||
//SEG63 [33] (byte) render_sine::ypos#0 ← (byte) wrap_y::return#0 -- vbuxx=vbuaa
|
||||
tax
|
||||
//SEG64 [34] (word) bitmap_plot::x#0 ← (word) render_sine::xpos#3
|
||||
// (word) bitmap_plot::x#0 = (word) render_sine::xpos#3 // register copy zp ZP_WORD:4
|
||||
//SEG65 [35] (byte) bitmap_plot::y#0 ← (byte) render_sine::ypos#0
|
||||
// (byte) bitmap_plot::y#0 = (byte) render_sine::ypos#0 // register copy reg byte x
|
||||
//SEG66 [36] call bitmap_plot
|
||||
//SEG67 [54] phi from render_sine::@5 to bitmap_plot [phi:render_sine::@5->bitmap_plot]
|
||||
bitmap_plot_from_b5:
|
||||
@ -6144,16 +6162,13 @@ render_sine: {
|
||||
//SEG77 [61] phi (signed word) wrap_y::y#9 = (signed word) wrap_y::y#1 [phi:render_sine::@6->wrap_y#0] -- register_copy
|
||||
jsr wrap_y
|
||||
//SEG78 [42] (byte) wrap_y::return#1 ← (byte) wrap_y::return#2
|
||||
// (byte) wrap_y::return#1 = (byte) wrap_y::return#2 // register copy reg byte a
|
||||
jmp b7
|
||||
//SEG79 render_sine::@7
|
||||
b7:
|
||||
//SEG80 [43] (byte) render_sine::ypos2#0 ← (byte) wrap_y::return#1 -- vbuxx=vbuaa
|
||||
tax
|
||||
//SEG81 [44] (word) bitmap_plot::x#1 ← (word) render_sine::xpos#3
|
||||
// (word) bitmap_plot::x#1 = (word) render_sine::xpos#3 // register copy zp ZP_WORD:4
|
||||
//SEG82 [45] (byte) bitmap_plot::y#1 ← (byte) render_sine::ypos2#0
|
||||
// (byte) bitmap_plot::y#1 = (byte) render_sine::ypos2#0 // register copy reg byte x
|
||||
//SEG83 [46] call bitmap_plot
|
||||
//SEG84 [54] phi from render_sine::@7 to bitmap_plot [phi:render_sine::@7->bitmap_plot]
|
||||
bitmap_plot_from_b7:
|
||||
@ -6215,6 +6230,7 @@ render_sine: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG101 bitmap_plot
|
||||
// Plot a single dot in the bitmap
|
||||
bitmap_plot: {
|
||||
.label _1 = $10
|
||||
.label plotter = 6
|
||||
@ -6318,6 +6334,9 @@ wrap_y: {
|
||||
jmp b1_from_b2
|
||||
}
|
||||
//SEG126 sin16s_gen2
|
||||
// Generate signed word sinus table - with values in the range min-max.
|
||||
// sintab - the table to generate into
|
||||
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
|
||||
sin16s_gen2: {
|
||||
.const min = -$140
|
||||
.const max = $140
|
||||
@ -6335,12 +6354,10 @@ sin16s_gen2: {
|
||||
div32u16u_from_sin16s_gen2:
|
||||
jsr div32u16u
|
||||
//SEG129 [72] (dword) div32u16u::return#2 ← (dword) div32u16u::return#0
|
||||
// (dword) div32u16u::return#2 = (dword) div32u16u::return#0 // register copy zp ZP_DWORD:27
|
||||
jmp b3
|
||||
//SEG130 sin16s_gen2::@3
|
||||
b3:
|
||||
//SEG131 [73] (dword) sin16s_gen2::step#0 ← (dword) div32u16u::return#2
|
||||
// (dword) sin16s_gen2::step#0 = (dword) div32u16u::return#2 // register copy zp ZP_DWORD:27
|
||||
//SEG132 [74] phi from sin16s_gen2::@3 to sin16s_gen2::@1 [phi:sin16s_gen2::@3->sin16s_gen2::@1]
|
||||
b1_from_b3:
|
||||
//SEG133 [74] phi (word) sin16s_gen2::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:sin16s_gen2::@3->sin16s_gen2::@1#0] -- vwuz1=vbuc1
|
||||
@ -6381,21 +6398,17 @@ sin16s_gen2: {
|
||||
//SEG142 [76] call sin16s
|
||||
jsr sin16s
|
||||
//SEG143 [77] (signed word) sin16s::return#0 ← (signed word) sin16s::return#1
|
||||
// (signed word) sin16s::return#0 = (signed word) sin16s::return#1 // register copy zp ZP_WORD:23
|
||||
jmp b4
|
||||
//SEG144 sin16s_gen2::@4
|
||||
b4:
|
||||
//SEG145 [78] (signed word) mul16s::a#0 ← (signed word) sin16s::return#0
|
||||
// (signed word) mul16s::a#0 = (signed word) sin16s::return#0 // register copy zp ZP_WORD:23
|
||||
//SEG146 [79] call mul16s
|
||||
jsr mul16s
|
||||
//SEG147 [80] (signed dword) mul16s::return#2 ← (signed dword) mul16s::return#0
|
||||
// (signed dword) mul16s::return#2 = (signed dword) mul16s::return#0 // register copy zp ZP_DWORD:12
|
||||
jmp b5
|
||||
//SEG148 sin16s_gen2::@5
|
||||
b5:
|
||||
//SEG149 [81] (signed dword~) sin16s_gen2::$5 ← (signed dword) mul16s::return#2
|
||||
// (signed dword~) sin16s_gen2::$5 = (signed dword) mul16s::return#2 // register copy zp ZP_DWORD:12
|
||||
//SEG150 [82] (word~) sin16s_gen2::$6 ← > (signed dword~) sin16s_gen2::$5 -- vwuz1=_hi_vdsz2
|
||||
lda _5+2
|
||||
sta _6
|
||||
@ -6459,6 +6472,8 @@ sin16s_gen2: {
|
||||
rts
|
||||
}
|
||||
//SEG159 mul16s
|
||||
// Multiply of two signed words to a signed double word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
mul16s: {
|
||||
.label _5 = 2
|
||||
.label _6 = 6
|
||||
@ -6482,12 +6497,10 @@ mul16s: {
|
||||
sta mul16u.b+1
|
||||
jsr mul16u
|
||||
//SEG165 [92] (dword) mul16u::return#2 ← (dword) mul16u::res#2
|
||||
// (dword) mul16u::return#2 = (dword) mul16u::res#2 // register copy zp ZP_DWORD:12
|
||||
jmp b6
|
||||
//SEG166 mul16s::@6
|
||||
b6:
|
||||
//SEG167 [93] (dword) mul16s::m#0 ← (dword) mul16u::return#2
|
||||
// (dword) mul16s::m#0 = (dword) mul16u::return#2 // register copy zp ZP_DWORD:12
|
||||
//SEG168 [94] if((signed word) mul16s::a#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul16s::@1 -- vwsz1_ge_0_then_la1
|
||||
lda a+1
|
||||
bpl b1_from_b6
|
||||
@ -6535,6 +6548,7 @@ mul16s: {
|
||||
rts
|
||||
}
|
||||
//SEG181 mul16u
|
||||
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
|
||||
mul16u: {
|
||||
.label mb = $12
|
||||
.label a = $10
|
||||
@ -6622,6 +6636,9 @@ mul16u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG205 sin16s
|
||||
// Calculate signed word sinus sin(x)
|
||||
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
|
||||
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
|
||||
sin16s: {
|
||||
.label _6 = $c
|
||||
.label x = $c
|
||||
@ -6760,7 +6777,6 @@ sin16s: {
|
||||
//SEG230 [153] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#0 [phi:sin16s::@2->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG231 [124] (word) mulu16_sel::return#0 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#0 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:6
|
||||
jmp b8
|
||||
//SEG232 sin16s::@8
|
||||
b8:
|
||||
@ -6770,7 +6786,6 @@ sin16s: {
|
||||
lda mulu16_sel.return+1
|
||||
sta x2+1
|
||||
//SEG234 [126] (word) mulu16_sel::v1#1 ← (word) sin16s::x2#0
|
||||
// (word) mulu16_sel::v1#1 = (word) sin16s::x2#0 // register copy zp ZP_WORD:25
|
||||
//SEG235 [127] (word) mulu16_sel::v2#1 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -6793,9 +6808,7 @@ sin16s: {
|
||||
//SEG242 sin16s::@9
|
||||
b9:
|
||||
//SEG243 [130] (word) sin16s::x3#0 ← (word) mulu16_sel::return#1
|
||||
// (word) sin16s::x3#0 = (word) mulu16_sel::return#1 // register copy zp ZP_WORD:25
|
||||
//SEG244 [131] (word) mulu16_sel::v1#2 ← (word) sin16s::x3#0
|
||||
// (word) mulu16_sel::v1#2 = (word) sin16s::x3#0 // register copy zp ZP_WORD:25
|
||||
//SEG245 [132] call mulu16_sel
|
||||
//SEG246 [153] phi from sin16s::@9 to mulu16_sel [phi:sin16s::@9->mulu16_sel]
|
||||
mulu16_sel_from_b9:
|
||||
@ -6809,12 +6822,10 @@ sin16s: {
|
||||
//SEG249 [153] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#2 [phi:sin16s::@9->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG250 [133] (word) mulu16_sel::return#2 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#2 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:6
|
||||
jmp b10
|
||||
//SEG251 sin16s::@10
|
||||
b10:
|
||||
//SEG252 [134] (word) sin16s::x3_6#0 ← (word) mulu16_sel::return#2
|
||||
// (word) sin16s::x3_6#0 = (word) mulu16_sel::return#2 // register copy zp ZP_WORD:6
|
||||
//SEG253 [135] (word) sin16s::usinx#0 ← (word) sin16s::x1#0 - (word) sin16s::x3_6#0 -- vwuz1=vwuz2_minus_vwuz3
|
||||
lda x1
|
||||
sec
|
||||
@ -6824,7 +6835,6 @@ sin16s: {
|
||||
sbc x3_6+1
|
||||
sta usinx+1
|
||||
//SEG254 [136] (word) mulu16_sel::v1#3 ← (word) sin16s::x3#0
|
||||
// (word) mulu16_sel::v1#3 = (word) sin16s::x3#0 // register copy zp ZP_WORD:25
|
||||
//SEG255 [137] (word) mulu16_sel::v2#3 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -6847,9 +6857,7 @@ sin16s: {
|
||||
//SEG262 sin16s::@11
|
||||
b11:
|
||||
//SEG263 [140] (word) sin16s::x4#0 ← (word) mulu16_sel::return#10
|
||||
// (word) sin16s::x4#0 = (word) mulu16_sel::return#10 // register copy zp ZP_WORD:25
|
||||
//SEG264 [141] (word) mulu16_sel::v1#4 ← (word) sin16s::x4#0
|
||||
// (word) mulu16_sel::v1#4 = (word) sin16s::x4#0 // register copy zp ZP_WORD:25
|
||||
//SEG265 [142] (word) mulu16_sel::v2#4 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -6864,12 +6872,10 @@ sin16s: {
|
||||
//SEG270 [153] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#4 [phi:sin16s::@11->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG271 [144] (word) mulu16_sel::return#11 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#11 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:6
|
||||
jmp b12
|
||||
//SEG272 sin16s::@12
|
||||
b12:
|
||||
//SEG273 [145] (word) sin16s::x5#0 ← (word) mulu16_sel::return#11
|
||||
// (word) sin16s::x5#0 = (word) mulu16_sel::return#11 // register copy zp ZP_WORD:6
|
||||
//SEG274 [146] (word) sin16s::x5_128#0 ← (word) sin16s::x5#0 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vwuz1=vwuz1_ror_4
|
||||
ldy #4
|
||||
!:
|
||||
@ -6917,10 +6923,11 @@ sin16s: {
|
||||
//SEG284 sin16s::@15
|
||||
b15:
|
||||
//SEG285 [152] (signed word~) sin16s::return#5 ← (signed word)(word) sin16s::usinx#1
|
||||
// (signed word~) sin16s::return#5 = (signed word)(word) sin16s::usinx#1 // register copy zp ZP_WORD:23
|
||||
jmp b3_from_b15
|
||||
}
|
||||
//SEG286 mulu16_sel
|
||||
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
|
||||
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
|
||||
mulu16_sel: {
|
||||
.label _0 = $c
|
||||
.label _1 = $c
|
||||
@ -6935,7 +6942,6 @@ mulu16_sel: {
|
||||
lda v1+1
|
||||
sta mul16u.a+1
|
||||
//SEG288 [155] (word) mul16u::b#1 ← (word) mulu16_sel::v2#5
|
||||
// (word) mul16u::b#1 = (word) mulu16_sel::v2#5 // register copy zp ZP_WORD:6
|
||||
//SEG289 [156] call mul16u
|
||||
//SEG290 [102] phi from mulu16_sel to mul16u [phi:mulu16_sel->mul16u]
|
||||
mul16u_from_mulu16_sel:
|
||||
@ -6943,12 +6949,10 @@ mulu16_sel: {
|
||||
//SEG292 [102] phi (word) mul16u::b#2 = (word) mul16u::b#1 [phi:mulu16_sel->mul16u#1] -- register_copy
|
||||
jsr mul16u
|
||||
//SEG293 [157] (dword) mul16u::return#3 ← (dword) mul16u::res#2
|
||||
// (dword) mul16u::return#3 = (dword) mul16u::res#2 // register copy zp ZP_DWORD:12
|
||||
jmp b2
|
||||
//SEG294 mulu16_sel::@2
|
||||
b2:
|
||||
//SEG295 [158] (dword~) mulu16_sel::$0 ← (dword) mul16u::return#3
|
||||
// (dword~) mulu16_sel::$0 = (dword) mul16u::return#3 // register copy zp ZP_DWORD:12
|
||||
//SEG296 [159] (dword~) mulu16_sel::$1 ← (dword~) mulu16_sel::$0 << (byte) mulu16_sel::select#5 -- vduz1=vduz1_rol_vbuxx
|
||||
cpx #0
|
||||
beq !e+
|
||||
@ -6972,6 +6976,8 @@ mulu16_sel: {
|
||||
rts
|
||||
}
|
||||
//SEG300 div32u16u
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
div32u16u: {
|
||||
.label quotient_hi = $10
|
||||
.label quotient_lo = 6
|
||||
@ -6991,7 +6997,6 @@ div32u16u: {
|
||||
sta divr16u.rem+1
|
||||
jsr divr16u
|
||||
//SEG305 [164] (word) divr16u::return#2 ← (word) divr16u::return#0
|
||||
// (word) divr16u::return#2 = (word) divr16u::return#0 // register copy zp ZP_WORD:6
|
||||
jmp b2
|
||||
//SEG306 div32u16u::@2
|
||||
b2:
|
||||
@ -7001,7 +7006,6 @@ div32u16u: {
|
||||
lda divr16u.return+1
|
||||
sta quotient_hi+1
|
||||
//SEG308 [166] (word) divr16u::rem#4 ← (word) rem16u#1
|
||||
// (word) divr16u::rem#4 = (word) rem16u#1 // register copy zp ZP_WORD:2
|
||||
//SEG309 [167] call divr16u
|
||||
//SEG310 [172] phi from div32u16u::@2 to divr16u [phi:div32u16u::@2->divr16u]
|
||||
divr16u_from_b2:
|
||||
@ -7013,12 +7017,10 @@ div32u16u: {
|
||||
//SEG312 [172] phi (word) divr16u::rem#10 = (word) divr16u::rem#4 [phi:div32u16u::@2->divr16u#1] -- register_copy
|
||||
jsr divr16u
|
||||
//SEG313 [168] (word) divr16u::return#3 ← (word) divr16u::return#0
|
||||
// (word) divr16u::return#3 = (word) divr16u::return#0 // register copy zp ZP_WORD:6
|
||||
jmp b3
|
||||
//SEG314 div32u16u::@3
|
||||
b3:
|
||||
//SEG315 [169] (word) div32u16u::quotient_lo#0 ← (word) divr16u::return#3
|
||||
// (word) div32u16u::quotient_lo#0 = (word) divr16u::return#3 // register copy zp ZP_WORD:6
|
||||
//SEG316 [170] (dword) div32u16u::return#0 ← (word) div32u16u::quotient_hi#0 dw= (word) div32u16u::quotient_lo#0 -- vduz1=vwuz2_dword_vwuz3
|
||||
lda quotient_hi
|
||||
sta return+2
|
||||
@ -7035,6 +7037,10 @@ div32u16u: {
|
||||
rts
|
||||
}
|
||||
//SEG319 divr16u
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
divr16u: {
|
||||
.label rem = 2
|
||||
.label dividend = 4
|
||||
@ -7133,7 +7139,6 @@ divr16u: {
|
||||
//SEG352 divr16u::@6
|
||||
b6:
|
||||
//SEG353 [188] (word) rem16u#1 ← (word) divr16u::rem#11
|
||||
// (word) rem16u#1 = (word) divr16u::rem#11 // register copy zp ZP_WORD:2
|
||||
jmp breturn
|
||||
//SEG354 divr16u::@return
|
||||
breturn:
|
||||
@ -7141,6 +7146,7 @@ divr16u: {
|
||||
rts
|
||||
}
|
||||
//SEG356 bitmap_clear
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = 2
|
||||
.label y = $16
|
||||
@ -7151,7 +7157,6 @@ bitmap_clear: {
|
||||
lda bitmap_plot_yhi
|
||||
sta _3+1
|
||||
//SEG358 [191] (byte*~) bitmap_clear::bitmap#5 ← (byte*)(word~) bitmap_clear::$3
|
||||
// (byte*~) bitmap_clear::bitmap#5 = (byte*)(word~) bitmap_clear::$3 // register copy zp ZP_WORD:2
|
||||
//SEG359 [192] phi from bitmap_clear to bitmap_clear::@1 [phi:bitmap_clear->bitmap_clear::@1]
|
||||
b1_from_bitmap_clear:
|
||||
//SEG360 [192] phi (byte) bitmap_clear::y#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bitmap_clear->bitmap_clear::@1#0] -- vbuz1=vbuc1
|
||||
@ -7209,6 +7214,7 @@ bitmap_clear: {
|
||||
rts
|
||||
}
|
||||
//SEG382 bitmap_init
|
||||
// Initialize bitmap plotting tables
|
||||
bitmap_init: {
|
||||
.label _3 = $16
|
||||
.label yoffs = 2
|
||||
@ -7321,6 +7327,8 @@ bitmap_init: {
|
||||
jmp b2
|
||||
}
|
||||
//SEG426 fill
|
||||
// Simple routines for working with memory
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.const size = $3e8
|
||||
.label end = SCREEN+size
|
||||
@ -7514,6 +7522,7 @@ Removing instruction b1_from_wrap_y:
|
||||
Removing instruction b1_from_b2:
|
||||
Removing instruction b4_from_b1:
|
||||
Removing instruction b4_from_b5:
|
||||
Removing instruction b1_from_b3:
|
||||
Removing instruction b1_from_b5:
|
||||
Removing instruction b1_from_b3:
|
||||
Removing instruction b1_from_b6:
|
||||
@ -7523,6 +7532,7 @@ Removing instruction b4_from_b2:
|
||||
Removing instruction b4_from_b7:
|
||||
Removing instruction b2_from_b1:
|
||||
Removing instruction b2_from_b5:
|
||||
Removing instruction mulu16_sel_from_b9:
|
||||
Removing instruction b3_from_b15:
|
||||
Removing instruction b3_from_b6:
|
||||
Removing instruction breturn:
|
||||
@ -7531,6 +7541,7 @@ Removing instruction b2_from_b1:
|
||||
Removing instruction b2_from_b4:
|
||||
Removing instruction b3_from_b2:
|
||||
Removing instruction b3_from_b5:
|
||||
Removing instruction breturn:
|
||||
Removing instruction b1_from_b3:
|
||||
Removing instruction b2_from_b1:
|
||||
Removing instruction b2_from_b2:
|
||||
@ -7568,7 +7579,6 @@ Removing instruction b6:
|
||||
Removing instruction breturn:
|
||||
Removing instruction div32u16u_from_sin16s_gen2:
|
||||
Removing instruction b3:
|
||||
Removing instruction b1_from_b3:
|
||||
Removing instruction b4:
|
||||
Removing instruction b5:
|
||||
Removing instruction breturn:
|
||||
@ -7586,7 +7596,6 @@ Removing instruction mulu16_sel_from_b2:
|
||||
Removing instruction b8:
|
||||
Removing instruction mulu16_sel_from_b8:
|
||||
Removing instruction b9:
|
||||
Removing instruction mulu16_sel_from_b9:
|
||||
Removing instruction b10:
|
||||
Removing instruction mulu16_sel_from_b10:
|
||||
Removing instruction b11:
|
||||
@ -7605,7 +7614,6 @@ Removing instruction b1_from_divr16u:
|
||||
Removing instruction b4:
|
||||
Removing instruction b5:
|
||||
Removing instruction b6:
|
||||
Removing instruction breturn:
|
||||
Removing instruction b1_from_bitmap_clear:
|
||||
Removing instruction b3:
|
||||
Removing instruction breturn:
|
||||
@ -8313,20 +8321,16 @@ render_sine: {
|
||||
stx sin_val
|
||||
sta sin_val+1
|
||||
//SEG57 [30] (signed word) wrap_y::y#0 ← (signed word) render_sine::sin_val#0
|
||||
// (signed word) wrap_y::y#0 = (signed word) render_sine::sin_val#0 // register copy zp ZP_WORD:6
|
||||
//SEG58 [31] call wrap_y
|
||||
//SEG59 [61] phi from render_sine::@1 to wrap_y [phi:render_sine::@1->wrap_y]
|
||||
//SEG60 [61] phi (signed word) wrap_y::y#9 = (signed word) wrap_y::y#0 [phi:render_sine::@1->wrap_y#0] -- register_copy
|
||||
jsr wrap_y
|
||||
//SEG61 [32] (byte) wrap_y::return#0 ← (byte) wrap_y::return#2
|
||||
// (byte) wrap_y::return#0 = (byte) wrap_y::return#2 // register copy reg byte a
|
||||
//SEG62 render_sine::@5
|
||||
//SEG63 [33] (byte) render_sine::ypos#0 ← (byte) wrap_y::return#0 -- vbuxx=vbuaa
|
||||
tax
|
||||
//SEG64 [34] (word) bitmap_plot::x#0 ← (word) render_sine::xpos#3
|
||||
// (word) bitmap_plot::x#0 = (word) render_sine::xpos#3 // register copy zp ZP_WORD:4
|
||||
//SEG65 [35] (byte) bitmap_plot::y#0 ← (byte) render_sine::ypos#0
|
||||
// (byte) bitmap_plot::y#0 = (byte) render_sine::ypos#0 // register copy reg byte x
|
||||
//SEG66 [36] call bitmap_plot
|
||||
//SEG67 [54] phi from render_sine::@5 to bitmap_plot [phi:render_sine::@5->bitmap_plot]
|
||||
//SEG68 [54] phi (word) bitmap_plot::x#2 = (word) bitmap_plot::x#0 [phi:render_sine::@5->bitmap_plot#0] -- register_copy
|
||||
@ -8369,14 +8373,11 @@ render_sine: {
|
||||
//SEG77 [61] phi (signed word) wrap_y::y#9 = (signed word) wrap_y::y#1 [phi:render_sine::@6->wrap_y#0] -- register_copy
|
||||
jsr wrap_y
|
||||
//SEG78 [42] (byte) wrap_y::return#1 ← (byte) wrap_y::return#2
|
||||
// (byte) wrap_y::return#1 = (byte) wrap_y::return#2 // register copy reg byte a
|
||||
//SEG79 render_sine::@7
|
||||
//SEG80 [43] (byte) render_sine::ypos2#0 ← (byte) wrap_y::return#1 -- vbuxx=vbuaa
|
||||
tax
|
||||
//SEG81 [44] (word) bitmap_plot::x#1 ← (word) render_sine::xpos#3
|
||||
// (word) bitmap_plot::x#1 = (word) render_sine::xpos#3 // register copy zp ZP_WORD:4
|
||||
//SEG82 [45] (byte) bitmap_plot::y#1 ← (byte) render_sine::ypos2#0
|
||||
// (byte) bitmap_plot::y#1 = (byte) render_sine::ypos2#0 // register copy reg byte x
|
||||
//SEG83 [46] call bitmap_plot
|
||||
//SEG84 [54] phi from render_sine::@7 to bitmap_plot [phi:render_sine::@7->bitmap_plot]
|
||||
//SEG85 [54] phi (word) bitmap_plot::x#2 = (word) bitmap_plot::x#1 [phi:render_sine::@7->bitmap_plot#0] -- register_copy
|
||||
@ -8429,6 +8430,7 @@ render_sine: {
|
||||
//SEG100 [49] phi (word) render_sine::xpos#8 = (word) render_sine::xpos#1 [phi:render_sine::@10->render_sine::@2#0] -- register_copy
|
||||
}
|
||||
//SEG101 bitmap_plot
|
||||
// Plot a single dot in the bitmap
|
||||
bitmap_plot: {
|
||||
.label _1 = $10
|
||||
.label plotter = 6
|
||||
@ -8519,6 +8521,9 @@ wrap_y: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG126 sin16s_gen2
|
||||
// Generate signed word sinus table - with values in the range min-max.
|
||||
// sintab - the table to generate into
|
||||
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
|
||||
sin16s_gen2: {
|
||||
.const min = -$140
|
||||
.const max = $140
|
||||
@ -8535,10 +8540,8 @@ sin16s_gen2: {
|
||||
//SEG128 [162] phi from sin16s_gen2 to div32u16u [phi:sin16s_gen2->div32u16u]
|
||||
jsr div32u16u
|
||||
//SEG129 [72] (dword) div32u16u::return#2 ← (dword) div32u16u::return#0
|
||||
// (dword) div32u16u::return#2 = (dword) div32u16u::return#0 // register copy zp ZP_DWORD:27
|
||||
//SEG130 sin16s_gen2::@3
|
||||
//SEG131 [73] (dword) sin16s_gen2::step#0 ← (dword) div32u16u::return#2
|
||||
// (dword) sin16s_gen2::step#0 = (dword) div32u16u::return#2 // register copy zp ZP_DWORD:27
|
||||
//SEG132 [74] phi from sin16s_gen2::@3 to sin16s_gen2::@1 [phi:sin16s_gen2::@3->sin16s_gen2::@1]
|
||||
//SEG133 [74] phi (word) sin16s_gen2::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:sin16s_gen2::@3->sin16s_gen2::@1#0] -- vwuz1=vbuc1
|
||||
lda #<0
|
||||
@ -8573,17 +8576,13 @@ sin16s_gen2: {
|
||||
//SEG142 [76] call sin16s
|
||||
jsr sin16s
|
||||
//SEG143 [77] (signed word) sin16s::return#0 ← (signed word) sin16s::return#1
|
||||
// (signed word) sin16s::return#0 = (signed word) sin16s::return#1 // register copy zp ZP_WORD:23
|
||||
//SEG144 sin16s_gen2::@4
|
||||
//SEG145 [78] (signed word) mul16s::a#0 ← (signed word) sin16s::return#0
|
||||
// (signed word) mul16s::a#0 = (signed word) sin16s::return#0 // register copy zp ZP_WORD:23
|
||||
//SEG146 [79] call mul16s
|
||||
jsr mul16s
|
||||
//SEG147 [80] (signed dword) mul16s::return#2 ← (signed dword) mul16s::return#0
|
||||
// (signed dword) mul16s::return#2 = (signed dword) mul16s::return#0 // register copy zp ZP_DWORD:12
|
||||
//SEG148 sin16s_gen2::@5
|
||||
//SEG149 [81] (signed dword~) sin16s_gen2::$5 ← (signed dword) mul16s::return#2
|
||||
// (signed dword~) sin16s_gen2::$5 = (signed dword) mul16s::return#2 // register copy zp ZP_DWORD:12
|
||||
//SEG150 [82] (word~) sin16s_gen2::$6 ← > (signed dword~) sin16s_gen2::$5 -- vwuz1=_hi_vdsz2
|
||||
lda _5+2
|
||||
sta _6
|
||||
@ -8645,6 +8644,8 @@ sin16s_gen2: {
|
||||
rts
|
||||
}
|
||||
//SEG159 mul16s
|
||||
// Multiply of two signed words to a signed double word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
mul16s: {
|
||||
.label _5 = 2
|
||||
.label _6 = 6
|
||||
@ -8667,10 +8668,8 @@ mul16s: {
|
||||
sta mul16u.b+1
|
||||
jsr mul16u
|
||||
//SEG165 [92] (dword) mul16u::return#2 ← (dword) mul16u::res#2
|
||||
// (dword) mul16u::return#2 = (dword) mul16u::res#2 // register copy zp ZP_DWORD:12
|
||||
//SEG166 mul16s::@6
|
||||
//SEG167 [93] (dword) mul16s::m#0 ← (dword) mul16u::return#2
|
||||
// (dword) mul16s::m#0 = (dword) mul16u::return#2 // register copy zp ZP_DWORD:12
|
||||
//SEG168 [94] if((signed word) mul16s::a#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul16s::@1 -- vwsz1_ge_0_then_la1
|
||||
lda a+1
|
||||
bpl b2
|
||||
@ -8709,6 +8708,7 @@ mul16s: {
|
||||
rts
|
||||
}
|
||||
//SEG181 mul16u
|
||||
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
|
||||
mul16u: {
|
||||
.label mb = $12
|
||||
.label a = $10
|
||||
@ -8784,6 +8784,9 @@ mul16u: {
|
||||
jmp b1
|
||||
}
|
||||
//SEG205 sin16s
|
||||
// Calculate signed word sinus sin(x)
|
||||
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
|
||||
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
|
||||
sin16s: {
|
||||
.label _6 = $c
|
||||
.label x = $c
|
||||
@ -8912,7 +8915,6 @@ sin16s: {
|
||||
//SEG230 [153] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#0 [phi:sin16s::@2->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG231 [124] (word) mulu16_sel::return#0 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#0 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:6
|
||||
//SEG232 sin16s::@8
|
||||
//SEG233 [125] (word) sin16s::x2#0 ← (word) mulu16_sel::return#0 -- vwuz1=vwuz2
|
||||
lda mulu16_sel.return
|
||||
@ -8920,7 +8922,6 @@ sin16s: {
|
||||
lda mulu16_sel.return+1
|
||||
sta x2+1
|
||||
//SEG234 [126] (word) mulu16_sel::v1#1 ← (word) sin16s::x2#0
|
||||
// (word) mulu16_sel::v1#1 = (word) sin16s::x2#0 // register copy zp ZP_WORD:25
|
||||
//SEG235 [127] (word) mulu16_sel::v2#1 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -8940,9 +8941,7 @@ sin16s: {
|
||||
sta mulu16_sel.return_1+1
|
||||
//SEG242 sin16s::@9
|
||||
//SEG243 [130] (word) sin16s::x3#0 ← (word) mulu16_sel::return#1
|
||||
// (word) sin16s::x3#0 = (word) mulu16_sel::return#1 // register copy zp ZP_WORD:25
|
||||
//SEG244 [131] (word) mulu16_sel::v1#2 ← (word) sin16s::x3#0
|
||||
// (word) mulu16_sel::v1#2 = (word) sin16s::x3#0 // register copy zp ZP_WORD:25
|
||||
//SEG245 [132] call mulu16_sel
|
||||
//SEG246 [153] phi from sin16s::@9 to mulu16_sel [phi:sin16s::@9->mulu16_sel]
|
||||
//SEG247 [153] phi (byte) mulu16_sel::select#5 = (byte/signed byte/word/signed word/dword/signed dword) 1 [phi:sin16s::@9->mulu16_sel#0] -- vbuxx=vbuc1
|
||||
@ -8955,10 +8954,8 @@ sin16s: {
|
||||
//SEG249 [153] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#2 [phi:sin16s::@9->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG250 [133] (word) mulu16_sel::return#2 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#2 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:6
|
||||
//SEG251 sin16s::@10
|
||||
//SEG252 [134] (word) sin16s::x3_6#0 ← (word) mulu16_sel::return#2
|
||||
// (word) sin16s::x3_6#0 = (word) mulu16_sel::return#2 // register copy zp ZP_WORD:6
|
||||
//SEG253 [135] (word) sin16s::usinx#0 ← (word) sin16s::x1#0 - (word) sin16s::x3_6#0 -- vwuz1=vwuz2_minus_vwuz3
|
||||
lda x1
|
||||
sec
|
||||
@ -8968,7 +8965,6 @@ sin16s: {
|
||||
sbc x3_6+1
|
||||
sta usinx+1
|
||||
//SEG254 [136] (word) mulu16_sel::v1#3 ← (word) sin16s::x3#0
|
||||
// (word) mulu16_sel::v1#3 = (word) sin16s::x3#0 // register copy zp ZP_WORD:25
|
||||
//SEG255 [137] (word) mulu16_sel::v2#3 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -8988,9 +8984,7 @@ sin16s: {
|
||||
sta mulu16_sel.return_10+1
|
||||
//SEG262 sin16s::@11
|
||||
//SEG263 [140] (word) sin16s::x4#0 ← (word) mulu16_sel::return#10
|
||||
// (word) sin16s::x4#0 = (word) mulu16_sel::return#10 // register copy zp ZP_WORD:25
|
||||
//SEG264 [141] (word) mulu16_sel::v1#4 ← (word) sin16s::x4#0
|
||||
// (word) mulu16_sel::v1#4 = (word) sin16s::x4#0 // register copy zp ZP_WORD:25
|
||||
//SEG265 [142] (word) mulu16_sel::v2#4 ← (word) sin16s::x1#0 -- vwuz1=vwuz2
|
||||
lda x1
|
||||
sta mulu16_sel.v2
|
||||
@ -9004,10 +8998,8 @@ sin16s: {
|
||||
//SEG270 [153] phi (word) mulu16_sel::v1#5 = (word) mulu16_sel::v1#4 [phi:sin16s::@11->mulu16_sel#2] -- register_copy
|
||||
jsr mulu16_sel
|
||||
//SEG271 [144] (word) mulu16_sel::return#11 ← (word) mulu16_sel::return#12
|
||||
// (word) mulu16_sel::return#11 = (word) mulu16_sel::return#12 // register copy zp ZP_WORD:6
|
||||
//SEG272 sin16s::@12
|
||||
//SEG273 [145] (word) sin16s::x5#0 ← (word) mulu16_sel::return#11
|
||||
// (word) sin16s::x5#0 = (word) mulu16_sel::return#11 // register copy zp ZP_WORD:6
|
||||
//SEG274 [146] (word) sin16s::x5_128#0 ← (word) sin16s::x5#0 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vwuz1=vwuz1_ror_4
|
||||
ldy #4
|
||||
!:
|
||||
@ -9047,9 +9039,10 @@ sin16s: {
|
||||
rts
|
||||
//SEG284 sin16s::@15
|
||||
//SEG285 [152] (signed word~) sin16s::return#5 ← (signed word)(word) sin16s::usinx#1
|
||||
// (signed word~) sin16s::return#5 = (signed word)(word) sin16s::usinx#1 // register copy zp ZP_WORD:23
|
||||
}
|
||||
//SEG286 mulu16_sel
|
||||
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
|
||||
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
|
||||
mulu16_sel: {
|
||||
.label _0 = $c
|
||||
.label _1 = $c
|
||||
@ -9064,17 +9057,14 @@ mulu16_sel: {
|
||||
lda v1+1
|
||||
sta mul16u.a+1
|
||||
//SEG288 [155] (word) mul16u::b#1 ← (word) mulu16_sel::v2#5
|
||||
// (word) mul16u::b#1 = (word) mulu16_sel::v2#5 // register copy zp ZP_WORD:6
|
||||
//SEG289 [156] call mul16u
|
||||
//SEG290 [102] phi from mulu16_sel to mul16u [phi:mulu16_sel->mul16u]
|
||||
//SEG291 [102] phi (word) mul16u::a#6 = (word) mul16u::a#2 [phi:mulu16_sel->mul16u#0] -- register_copy
|
||||
//SEG292 [102] phi (word) mul16u::b#2 = (word) mul16u::b#1 [phi:mulu16_sel->mul16u#1] -- register_copy
|
||||
jsr mul16u
|
||||
//SEG293 [157] (dword) mul16u::return#3 ← (dword) mul16u::res#2
|
||||
// (dword) mul16u::return#3 = (dword) mul16u::res#2 // register copy zp ZP_DWORD:12
|
||||
//SEG294 mulu16_sel::@2
|
||||
//SEG295 [158] (dword~) mulu16_sel::$0 ← (dword) mul16u::return#3
|
||||
// (dword~) mulu16_sel::$0 = (dword) mul16u::return#3 // register copy zp ZP_DWORD:12
|
||||
//SEG296 [159] (dword~) mulu16_sel::$1 ← (dword~) mulu16_sel::$0 << (byte) mulu16_sel::select#5 -- vduz1=vduz1_rol_vbuxx
|
||||
cpx #0
|
||||
beq !e+
|
||||
@ -9096,6 +9086,8 @@ mulu16_sel: {
|
||||
rts
|
||||
}
|
||||
//SEG300 div32u16u
|
||||
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
|
||||
// The 16-bit word remainder can be found in rem16u after the division
|
||||
div32u16u: {
|
||||
.label quotient_hi = $10
|
||||
.label quotient_lo = 6
|
||||
@ -9113,7 +9105,6 @@ div32u16u: {
|
||||
sta divr16u.rem+1
|
||||
jsr divr16u
|
||||
//SEG305 [164] (word) divr16u::return#2 ← (word) divr16u::return#0
|
||||
// (word) divr16u::return#2 = (word) divr16u::return#0 // register copy zp ZP_WORD:6
|
||||
//SEG306 div32u16u::@2
|
||||
//SEG307 [165] (word) div32u16u::quotient_hi#0 ← (word) divr16u::return#2 -- vwuz1=vwuz2
|
||||
lda divr16u.return
|
||||
@ -9121,7 +9112,6 @@ div32u16u: {
|
||||
lda divr16u.return+1
|
||||
sta quotient_hi+1
|
||||
//SEG308 [166] (word) divr16u::rem#4 ← (word) rem16u#1
|
||||
// (word) divr16u::rem#4 = (word) rem16u#1 // register copy zp ZP_WORD:2
|
||||
//SEG309 [167] call divr16u
|
||||
//SEG310 [172] phi from div32u16u::@2 to divr16u [phi:div32u16u::@2->divr16u]
|
||||
//SEG311 [172] phi (word) divr16u::dividend#5 = <(const dword) PI2_u4f28#0 [phi:div32u16u::@2->divr16u#0] -- vwuz1=vwuc1
|
||||
@ -9132,10 +9122,8 @@ div32u16u: {
|
||||
//SEG312 [172] phi (word) divr16u::rem#10 = (word) divr16u::rem#4 [phi:div32u16u::@2->divr16u#1] -- register_copy
|
||||
jsr divr16u
|
||||
//SEG313 [168] (word) divr16u::return#3 ← (word) divr16u::return#0
|
||||
// (word) divr16u::return#3 = (word) divr16u::return#0 // register copy zp ZP_WORD:6
|
||||
//SEG314 div32u16u::@3
|
||||
//SEG315 [169] (word) div32u16u::quotient_lo#0 ← (word) divr16u::return#3
|
||||
// (word) div32u16u::quotient_lo#0 = (word) divr16u::return#3 // register copy zp ZP_WORD:6
|
||||
//SEG316 [170] (dword) div32u16u::return#0 ← (word) div32u16u::quotient_hi#0 dw= (word) div32u16u::quotient_lo#0 -- vduz1=vwuz2_dword_vwuz3
|
||||
lda quotient_hi
|
||||
sta return+2
|
||||
@ -9150,6 +9138,10 @@ div32u16u: {
|
||||
rts
|
||||
}
|
||||
//SEG319 divr16u
|
||||
// Performs division on two 16 bit unsigned words and an initial remainder
|
||||
// Returns the quotient dividend/divisor.
|
||||
// The final remainder will be set into the global variable rem16u
|
||||
// Implemented using simple binary division
|
||||
divr16u: {
|
||||
.label rem = 2
|
||||
.label dividend = 4
|
||||
@ -9231,12 +9223,12 @@ divr16u: {
|
||||
bne b1
|
||||
//SEG352 divr16u::@6
|
||||
//SEG353 [188] (word) rem16u#1 ← (word) divr16u::rem#11
|
||||
// (word) rem16u#1 = (word) divr16u::rem#11 // register copy zp ZP_WORD:2
|
||||
//SEG354 divr16u::@return
|
||||
//SEG355 [189] return
|
||||
rts
|
||||
}
|
||||
//SEG356 bitmap_clear
|
||||
// Clear all graphics on the bitmap
|
||||
bitmap_clear: {
|
||||
.label bitmap = 2
|
||||
.label y = $16
|
||||
@ -9247,7 +9239,6 @@ bitmap_clear: {
|
||||
lda bitmap_plot_yhi
|
||||
sta _3+1
|
||||
//SEG358 [191] (byte*~) bitmap_clear::bitmap#5 ← (byte*)(word~) bitmap_clear::$3
|
||||
// (byte*~) bitmap_clear::bitmap#5 = (byte*)(word~) bitmap_clear::$3 // register copy zp ZP_WORD:2
|
||||
//SEG359 [192] phi from bitmap_clear to bitmap_clear::@1 [phi:bitmap_clear->bitmap_clear::@1]
|
||||
//SEG360 [192] phi (byte) bitmap_clear::y#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bitmap_clear->bitmap_clear::@1#0] -- vbuz1=vbuc1
|
||||
lda #0
|
||||
@ -9293,6 +9284,7 @@ bitmap_clear: {
|
||||
rts
|
||||
}
|
||||
//SEG382 bitmap_init
|
||||
// Initialize bitmap plotting tables
|
||||
bitmap_init: {
|
||||
.label _3 = $16
|
||||
.label yoffs = 2
|
||||
@ -9383,6 +9375,8 @@ bitmap_init: {
|
||||
//SEG425 [206] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@10->bitmap_init::@2#0] -- register_copy
|
||||
}
|
||||
//SEG426 fill
|
||||
// Simple routines for working with memory
|
||||
// Fill some memory with a value
|
||||
fill: {
|
||||
.const size = $3e8
|
||||
.label end = SCREEN+size
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user