mirror of https://gitlab.com/camelot/kickc.git
Compare commits
11 Commits
8d6d5e06d8
...
73a68a619d
Author | SHA1 | Date |
---|---|---|
Sven Van de Velde | 73a68a619d | |
Jesper Gravgaard | 294bb27eec | |
Jesper Gravgaard | 8416086294 | |
Jesper Gravgaard | 771fa9dbcd | |
Sven Van de Velde | 137053f093 | |
Sven Van de Velde | 6f0caee5fa | |
Sven Van de Velde | efc9ed5fab | |
Sven Van de Velde | 7b856a0f74 | |
Sven Van de Velde | f0dc36b205 | |
Sven Van de Velde | 8359ffde8a | |
Sven Van de Velde | 3b571bbe6a |
|
@ -6,6 +6,10 @@
|
|||
*/*.brk
|
||||
*/*.prg
|
||||
*/*.sym
|
||||
*/src/*.md
|
||||
*/src/*.mmd
|
||||
*/src/*.mermaid
|
||||
*/src/*.markdown
|
||||
*/.tmpdirs
|
||||
*/bin/
|
||||
**/.DS_Store
|
||||
|
@ -15,6 +19,7 @@ kickc.iml
|
|||
**/.vscode/*
|
||||
**/.vscode/*.log
|
||||
**/target/*
|
||||
**/.target/*
|
||||
*/workspace.xml
|
||||
/gen/*
|
||||
/src/main/fragment/cache
|
|
@ -27,6 +27,12 @@ public class CompileLog {
|
|||
*/
|
||||
private boolean verboseAsmOptimize = false;
|
||||
|
||||
/**
|
||||
* Should ASM output be verbose.
|
||||
*/
|
||||
|
||||
private boolean verboseAsm = true;
|
||||
|
||||
/**
|
||||
* Should SSA optimization be verbose.
|
||||
*/
|
||||
|
@ -62,10 +68,6 @@ public class CompileLog {
|
|||
*/
|
||||
private boolean verboseParse = false;
|
||||
|
||||
/**
|
||||
* Should the creation of the SSA be verbose.
|
||||
*/
|
||||
private boolean verboseCreateSsa = false;
|
||||
|
||||
/**
|
||||
* Output information about struct unwinding
|
||||
|
@ -95,6 +97,24 @@ public class CompileLog {
|
|||
*/
|
||||
private boolean sysOut = false;
|
||||
|
||||
/**
|
||||
* Create .mmd files containing the Control Block Flow Graph in mermaid.
|
||||
*/
|
||||
|
||||
private boolean reportsCFGMermaid = false;
|
||||
|
||||
|
||||
/**
|
||||
* Create .mmd files containing the Call Graph in mermaid.
|
||||
*/
|
||||
private boolean reportsCGMermaid = false;
|
||||
|
||||
/**
|
||||
* Create .md files containing the Register Interference Graph of the alive
|
||||
* variables in mermaid. The RIG is input for the register coalesce.
|
||||
*/
|
||||
private boolean reportsRIGMermaid = false;
|
||||
|
||||
public CompileLog() {
|
||||
this.log = new StringBuilder();
|
||||
}
|
||||
|
@ -273,6 +293,10 @@ public class CompileLog {
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isVerboseAsm() { return verboseAsm; }
|
||||
|
||||
public void setVerboseAsm(boolean verboseAsm) { this.verboseAsm = verboseAsm; }
|
||||
|
||||
public boolean isVerboseAsmOptimize() {
|
||||
return verboseAsmOptimize;
|
||||
}
|
||||
|
@ -335,4 +359,30 @@ public class CompileLog {
|
|||
public boolean isVerboseComments() {
|
||||
return verboseComments;
|
||||
}
|
||||
|
||||
private boolean verboseCreateSsa = false;
|
||||
|
||||
public boolean isReportsCFGMermaid() {
|
||||
return reportsCFGMermaid;
|
||||
}
|
||||
|
||||
public void setReportsCFGMermaid(boolean reportsCFGMermaid) {
|
||||
this.reportsCFGMermaid = reportsCFGMermaid;
|
||||
}
|
||||
|
||||
public boolean isReportsCGMermaid() {
|
||||
return reportsCGMermaid;
|
||||
}
|
||||
|
||||
public void setReportsCGMermaid(boolean reportsCGMermaid) {
|
||||
this.reportsCGMermaid = reportsCGMermaid;
|
||||
}
|
||||
|
||||
public boolean isReportsRIGMermaid() {
|
||||
return reportsRIGMermaid;
|
||||
}
|
||||
|
||||
public void setReportsRIGMermaid(boolean reportsRIGMermaid) {
|
||||
this.reportsRIGMermaid = reportsRIGMermaid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import dk.camelot64.kickc.model.values.StringEncoding;
|
|||
import dk.camelot64.kickc.parser.CParser;
|
||||
import dk.camelot64.kickc.parser.KickCParser;
|
||||
import dk.camelot64.kickc.passes.*;
|
||||
import dk.camelot64.kickc.passes.reports.*;
|
||||
import dk.camelot64.kickc.preprocessor.CPreprocessor;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.TokenSource;
|
||||
|
@ -220,6 +221,8 @@ public class Compiler {
|
|||
new Pass1GenerateControlFlowGraph(program).execute();
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("FIRST CONTROL FLOW GRAPH");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass1-cfg-after-parsing", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
new Pass1ResolveForwardReferences(program).execute();
|
||||
|
@ -249,13 +252,17 @@ public class Compiler {
|
|||
new Pass1AssertNoLValueIntermediate(program).execute();
|
||||
new PassNAddTypeConversionAssignment(program, true).execute();
|
||||
new Pass1AddressOfHandling(program).execute();
|
||||
|
||||
new Pass1AsmUsesHandling(program).execute();
|
||||
|
||||
new Pass1AssertProcedureCallParameters(program).execute();
|
||||
new Pass1ModifiedVarsAnalysis(program).execute();
|
||||
new Pass1CallStackVarPrepare(program).execute();
|
||||
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("CONTROL FLOW GRAPH BEFORE SIZEOF FIX");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass1-cfg-before-sizeof-fix", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
|
||||
|
@ -270,6 +277,8 @@ public class Compiler {
|
|||
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("CONTROL FLOW GRAPH AFTER UNWIND");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program,"pass1-cfg-after-unwind", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
|
||||
|
@ -283,6 +292,8 @@ public class Compiler {
|
|||
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("CONTROL FLOW GRAPH BEFORE INLINING");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass1-cfg-before-inlining", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
new Pass1ProcedureInline(program).execute();
|
||||
|
@ -293,6 +304,8 @@ public class Compiler {
|
|||
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("INITIAL CONTROL FLOW GRAPH");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass1-cfg-initial", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
|
||||
|
@ -314,6 +327,8 @@ public class Compiler {
|
|||
new Pass1CallStackVarConvert(program).execute();
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("PROCEDURE CALLS");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass1-cfg-procedure-calls", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
new Pass1CallStack(program).execute();
|
||||
|
@ -321,6 +336,8 @@ public class Compiler {
|
|||
new Pass1CallPhiParameters(program).execute();
|
||||
if(getLog().isVerbosePass1CreateSsa()) {
|
||||
getLog().append("PROCEDURE PARAMETERS");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass1-cfg-procedure-parameters", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
new PassNUnwindLValueLists(program).execute();
|
||||
|
@ -334,6 +351,8 @@ public class Compiler {
|
|||
|
||||
|
||||
getLog().append("\nCONTROL FLOW GRAPH SSA");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass1-cfg-final-ssa", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
|
||||
getLog().append("SYMBOL TABLE SSA");
|
||||
|
@ -465,6 +484,8 @@ public class Compiler {
|
|||
|
||||
if(getLog().isVerboseLoopUnroll()) {
|
||||
getLog().append("CONTROL FLOW GRAPH BEFORE UNROLLING");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass2-cfg-before-unrolling", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
|
||||
|
@ -474,6 +495,8 @@ public class Compiler {
|
|||
if(unrolled) {
|
||||
if(getLog().isVerboseLoopUnroll()) {
|
||||
getLog().append("UNROLLED CONTROL FLOW GRAPH");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass2-cfg-after-unrolling", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
pass2Optimize();
|
||||
|
@ -560,6 +583,8 @@ public class Compiler {
|
|||
getLog().append("Successful SSA optimization " + optimization.getClass().getSimpleName() + "");
|
||||
if(getLog().isVerboseSSAOptimize()) {
|
||||
getLog().append("CONTROL FLOW GRAPH");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass-2-cfg-ssa-" + optimization.getClass().getSimpleName(), "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
}
|
||||
|
@ -604,16 +629,22 @@ public class Compiler {
|
|||
|
||||
if(getLog().isVerboseSSAOptimize()) {
|
||||
getLog().append("CONTROL FLOW GRAPH");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass3x-cfg-optimized", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
new PassNCullEmptyBlocks(program, false).step();
|
||||
if(getLog().isVerboseSSAOptimize()) {
|
||||
getLog().append("CONTROL FLOW GRAPH");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass3-cfg-empty-blocks-culled", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
new PassNRenumberLabels(program, false).execute();
|
||||
if(getLog().isVerboseSSAOptimize()) {
|
||||
getLog().append("CONTROL FLOW GRAPH");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass3-cfg-labels-renumbered", "md").generateReport();
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
}
|
||||
new PassNBlockSequencePlanner(program).step();
|
||||
|
@ -637,6 +668,11 @@ public class Compiler {
|
|||
program.getLiveRangeVariablesEffective();
|
||||
|
||||
getLog().append("\nFINAL CONTROL FLOW GRAPH");
|
||||
if(getLog().isReportsCFGMermaid())
|
||||
new ReportCFG(program, "pass3-cfg-final", "md").generateReport();
|
||||
if(getLog().isReportsCGMermaid()) {
|
||||
new ReportCG(program, "pass3-cg-final", "md").generateReport();
|
||||
}
|
||||
getLog().append(program.prettyControlFlowGraph());
|
||||
|
||||
}
|
||||
|
@ -717,6 +753,8 @@ public class Compiler {
|
|||
new Pass4RegisterUpliftRemains(program).performUplift(upliftCombinations);
|
||||
}
|
||||
|
||||
if(getLog().isReportsRIGMermaid())
|
||||
new ReportRIG(program, "pass4-rig", "md").generateReport();
|
||||
// Register coalesce on assignment (saving bytes & cycles)
|
||||
new Pass4MemoryCoalesceAssignment(program).coalesce();
|
||||
|
||||
|
@ -747,8 +785,10 @@ public class Compiler {
|
|||
|
||||
private void pass5GenerateAndOptimizeAsm() {
|
||||
|
||||
getLog().append("\nASSEMBLER BEFORE OPTIMIZATION");
|
||||
getLog().append(program.getAsm().toString(new AsmProgram.AsmPrintState(true), program));
|
||||
if(getLog().isVerboseAsm()) {
|
||||
getLog().append("\nASSEMBLER BEFORE OPTIMIZATION");
|
||||
getLog().append(program.getAsm().toString(new AsmProgram.AsmPrintState(true), program));
|
||||
}
|
||||
|
||||
getLog().append("ASSEMBLER OPTIMIZATIONS");
|
||||
List<Pass5AsmOptimization> pass5Optimizations = new ArrayList<>();
|
||||
|
@ -769,8 +809,10 @@ public class Compiler {
|
|||
getLog().append("Succesful ASM optimization " + optimization.getClass().getSimpleName());
|
||||
asmOptimized = true;
|
||||
if(getLog().isVerboseAsmOptimize()) {
|
||||
getLog().append("ASSEMBLER");
|
||||
getLog().append(program.getAsm().toString());
|
||||
if(getLog().isVerboseAsm()) {
|
||||
getLog().append("ASSEMBLER");
|
||||
getLog().append(program.getAsm().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -786,9 +828,11 @@ public class Compiler {
|
|||
getLog().append("\nFINAL SYMBOL TABLE");
|
||||
getLog().append(program.getScope().toStringVars(program, false));
|
||||
|
||||
getLog().append("\nFINAL ASSEMBLER");
|
||||
getLog().append("Score: " + Pass4RegisterUpliftCombinations.getAsmScore(program) + "\n");
|
||||
getLog().append(program.getAsm().toString(new AsmProgram.AsmPrintState(false, true, true, false), program));
|
||||
if(getLog().isVerboseAsm()) {
|
||||
getLog().append("\nFINAL ASSEMBLER");
|
||||
getLog().append("Score: " + Pass4RegisterUpliftCombinations.getAsmScore(program) + "\n");
|
||||
getLog().append(program.getAsm().toString(new AsmProgram.AsmPrintState(false, true, true, false), program));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -114,6 +114,9 @@ public class KickC implements Callable<Integer> {
|
|||
@CommandLine.Option(names = {"-v"}, description = "Verbose output describing the compilation process")
|
||||
private boolean verbose = false;
|
||||
|
||||
@CommandLine.Option(names = {"-vnoasm"}, description = "Verbosity Option. Don't show any generated assembler during compilation.")
|
||||
private boolean verboseAsm = false;
|
||||
|
||||
@CommandLine.Option(names = {"-vasmout"}, description = "Verbosity Option. Show KickAssembler standard output during compilation.")
|
||||
private boolean verboseAsmOut = false;
|
||||
|
||||
|
@ -123,6 +126,7 @@ public class KickC implements Callable<Integer> {
|
|||
@CommandLine.Option(names = {"-vcreate"}, description = "Verbosity Option. Creation of the Single Static Assignment Control Flow Graph.")
|
||||
private boolean verboseCreateSsa = false;
|
||||
|
||||
|
||||
@CommandLine.Option(names = {"-voptimize"}, description = "Verbosity Option. Control Flow Graph Optimization.")
|
||||
private boolean verboseSSAOptimize = false;
|
||||
|
||||
|
@ -156,6 +160,15 @@ public class KickC implements Callable<Integer> {
|
|||
@CommandLine.Option(names = {"-vfixlongbranch"}, description = "Verbosity Option. Fix Long ASM branches.")
|
||||
private boolean verboseFixLongBranch = false;
|
||||
|
||||
@CommandLine.Option(names = {"-rcfg", "-reportcfg"}, description = "Report Option. Visualize the Control block Flow Graph in Mermaid.")
|
||||
private boolean reportCFGMermaid = false;
|
||||
|
||||
@CommandLine.Option(names = {"-rcg", "-reportcg"}, description = "Report Option. Visualize the Call Graph between the different functions in Mermaid.")
|
||||
private boolean reportCGMermaid = false;
|
||||
|
||||
@CommandLine.Option(names = {"-rrig", "-reportrig"}, description = "Report Option. Visualize the Register Interference Graph between the different alive variables per procedure in Mermaid.")
|
||||
private boolean reportRIGMermaid = false;
|
||||
|
||||
@CommandLine.Option(names = {"-Wfragment"}, description = "Warning Option. Missing fragments produces a warning instead of an error.")
|
||||
private boolean warnFragmentMissing = false;
|
||||
|
||||
|
@ -192,6 +205,7 @@ public class KickC implements Callable<Integer> {
|
|||
@CommandLine.Option(names = {"-calling"}, description = "Configure calling convention. Default is __phicall. See #pragma calling")
|
||||
private String calling = null;
|
||||
|
||||
|
||||
/** Program Exit Code signaling a compile error. */
|
||||
public static final int COMPILE_ERROR = CommandLine.ExitCode.SOFTWARE;
|
||||
|
||||
|
@ -499,34 +513,25 @@ public class KickC implements Callable<Integer> {
|
|||
|
||||
// Execute the binary file if instructed
|
||||
if(emulator != null) {
|
||||
List<String> emulatorCommand = new ArrayList<>();
|
||||
emulatorCommand.addAll(Arrays.asList(emulator.split(" ")));
|
||||
|
||||
// Find commandline options for the emulator
|
||||
if( emulator.equals("C64Debugger") ) {
|
||||
String emuOptions = "";
|
||||
if(emulator.equals("C64Debugger")) {
|
||||
Path viceSymbolsPath = program.getOutputFileManager().getOutputFile("vs");
|
||||
emulatorCommand.add("-symbol");
|
||||
emulatorCommand.add(viceSymbolsPath.toString());
|
||||
emulatorCommand.add("-autojmp");
|
||||
emulatorCommand.add("-prg");
|
||||
emuOptions = "-symbols " + viceSymbolsPath + " -autojmp -prg ";
|
||||
}
|
||||
// The program names used by VICE emulators
|
||||
List<String> viceEmus = Arrays.asList("x64", "x64sc", "x128", "x64dtv", "xcbm2", "xcbm5x0", "xpet", "xplus4", "xscpu64", "xvic");
|
||||
if(viceEmus.contains(emulator)) {
|
||||
Path viceSymbolsPath = program.getOutputFileManager().getOutputFile("vs");
|
||||
emulatorCommand.add("-moncommands");
|
||||
emulatorCommand.add(viceSymbolsPath.toAbsolutePath().toString());
|
||||
emuOptions = "-moncommands " + viceSymbolsPath.toAbsolutePath().toString() + " ";
|
||||
}
|
||||
emulatorCommand.add(outputBinaryFilePath.toAbsolutePath().toString());
|
||||
System.out.println("Executing " + outputBinaryFilePath + " using " + emulator);
|
||||
String executeCommand = emulator + " " + emuOptions + outputBinaryFilePath.toAbsolutePath().toString();
|
||||
if(verbose) {
|
||||
System.out.println("Executing command: " + String.join(" ", emulatorCommand));
|
||||
System.out.println("Executing command: " + executeCommand);
|
||||
}
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder();
|
||||
processBuilder.command(emulatorCommand);
|
||||
processBuilder.inheritIO();
|
||||
Process process = processBuilder.start();
|
||||
Process process = Runtime.getRuntime().exec(executeCommand);
|
||||
process.waitFor();
|
||||
} catch(Throwable e) {
|
||||
System.err.println("Executing emulator failed! " + e.getMessage());
|
||||
|
@ -594,11 +599,26 @@ public class KickC implements Callable<Integer> {
|
|||
compiler.getLog().setVerboseAsmOptimize(true);
|
||||
compiler.getLog().setSysOut(true);
|
||||
}
|
||||
if(verboseAsm) {
|
||||
compiler.getLog().setVerboseAsm(false);
|
||||
compiler.getLog().setSysOut(true);
|
||||
}
|
||||
if(verboseFixLongBranch) {
|
||||
compiler.getLog().setVerboseFixLongBranch(true);
|
||||
compiler.getLog().setSysOut(true);
|
||||
}
|
||||
|
||||
if(reportCFGMermaid) {
|
||||
compiler.getLog().setReportsCFGMermaid(true);
|
||||
compiler.getLog().setSysOut(true);
|
||||
}
|
||||
if(reportCGMermaid) {
|
||||
compiler.getLog().setReportsCGMermaid(true);
|
||||
compiler.getLog().setSysOut(true);
|
||||
}
|
||||
if(reportRIGMermaid) {
|
||||
compiler.getLog().setReportsRIGMermaid(true);
|
||||
compiler.getLog().setSysOut(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -129,6 +129,20 @@ public class OutputFileManager {
|
|||
return outputFile.normalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extended output file name in a specific directory with a name and specific extension
|
||||
*
|
||||
* @return The output file.
|
||||
*/
|
||||
public Path getMermaidOutputFile(String name, String extension) {
|
||||
Path outputDir = getOutputDirectory();
|
||||
String fileName = getOutputBaseName();
|
||||
fileName += "-" + name;
|
||||
if(extension.length() > 0) fileName += "." + extension;
|
||||
final Path outputFile = outputDir.resolve(fileName);
|
||||
return outputFile.normalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output directory
|
||||
* <i>Output-path</i> is the directory where the output files are generated. The following is a prioritized list specifying how the compiler finds this folder:
|
||||
|
|
|
@ -5,10 +5,7 @@ import dk.camelot64.kickc.model.symbols.Procedure;
|
|||
import dk.camelot64.kickc.model.values.LabelRef;
|
||||
import dk.camelot64.kickc.model.values.ScopeRef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* A named/labelled sequence of SSA statements connected to other basic blocks.
|
||||
|
@ -191,6 +188,7 @@ public class ControlFlowBlock implements Graph.Block {
|
|||
return out.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(this == o) return true;
|
||||
|
|
|
@ -33,6 +33,17 @@ public class LiveRange {
|
|||
return s;
|
||||
}
|
||||
|
||||
public String toString(int maxIndex) {
|
||||
StringBuilder range = new StringBuilder();
|
||||
range.append(" ").append(String.format("%4d", size())).append(" : ");
|
||||
StringBuilder canvas = new StringBuilder(" ".repeat(maxIndex+1));
|
||||
for(LiveInterval interval : intervals) {
|
||||
interval.paintOn(canvas);
|
||||
}
|
||||
range.append(canvas);
|
||||
return range.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying statement intervals
|
||||
* @return The intervals
|
||||
|
@ -185,6 +196,11 @@ public class LiveRange {
|
|||
return lastStatementIdx - firstStatementIdx + 1;
|
||||
}
|
||||
|
||||
public void paintOn(StringBuilder canvas) {
|
||||
for(int i=firstStatementIdx; i<=lastStatementIdx;i++) {
|
||||
canvas.setCharAt(i, '*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class LiveRangeEquivalenceClassSet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Consolidates two live range equivalence calsses into one.
|
||||
* Consolidates two live range equivalence classes into one.
|
||||
* All variables and live ranges from the other class is added to the first one - and the other one is deleted.
|
||||
*
|
||||
* @param equivalenceClass The first live range equivalence class.
|
||||
|
@ -73,7 +73,7 @@ public class LiveRangeEquivalenceClassSet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Informs the set that class of a variable has ben set - called by add/remove methods inside LiveRangeEquivalenceClass
|
||||
* Informs the set that class of a variable has been set - called by add/remove methods inside LiveRangeEquivalenceClass
|
||||
*
|
||||
* @param variable The variable
|
||||
* @param equivalenceClass The class
|
||||
|
|
|
@ -86,6 +86,20 @@ public class LiveRangeVariables {
|
|||
return liveRanges.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum index of all live ranges
|
||||
* @return The maximum index of all live ranges
|
||||
*/
|
||||
public int getMaxIndex() {
|
||||
int maxIndex = 0;
|
||||
for(LiveRange liveRange: liveRanges.values()) {
|
||||
int liveRangeMaxIndex = liveRange.getMaxIndex();
|
||||
if(maxIndex < liveRangeMaxIndex)
|
||||
maxIndex = liveRangeMaxIndex;
|
||||
}
|
||||
return maxIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get variable live ranges by statement index. Usable for quick access if you plan to iterate many statements.
|
||||
* @return variable live ranges by statement index
|
||||
|
|
|
@ -12,6 +12,8 @@ import dk.camelot64.kickc.model.values.ScopeRef;
|
|||
import dk.camelot64.kickc.passes.calcs.*;
|
||||
import dk.camelot64.kickc.passes.utils.ProcedureUtils;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -181,11 +183,14 @@ public class Program {
|
|||
public String prettyControlFlowGraph() {
|
||||
StringBuilder graphPretty = new StringBuilder();
|
||||
for(ProcedureCompilation procedureCompilation : getProcedureCompilations()) {
|
||||
graphPretty.append(procedureCompilation.getGraph().toString(this));
|
||||
Graph graph = procedureCompilation.getGraph();
|
||||
if(graph != null)
|
||||
graphPretty.append(graph.toString(this));
|
||||
}
|
||||
return graphPretty.toString();
|
||||
}
|
||||
|
||||
|
||||
public OutputFileManager getOutputFileManager() {
|
||||
return outputFileManager;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,25 @@ public class Pass4LiveRangeEquivalenceClassesFinalize extends Pass2Base {
|
|||
addToEquivalenceClassSet(variable.getVariableRef(), new ArrayList<>(), liveRangeEquivalenceClassSet);
|
||||
}
|
||||
|
||||
getLog().append("Overlapping live ranges variables");
|
||||
LiveRangeVariables liveRanges = getProgram().getLiveRangeVariables();
|
||||
int maxIndex = liveRanges.getMaxIndex();
|
||||
StringBuilder div = new StringBuilder();
|
||||
div.append(" ".repeat(8));
|
||||
for(int i=0; i<=maxIndex; i++) {
|
||||
if(i % 10 != 0)
|
||||
div.append("-");
|
||||
else
|
||||
div.append("x");
|
||||
}
|
||||
getLog().append(div.toString());
|
||||
for(Variable variable: getProgram().getScope().getAllVariables(true)) {
|
||||
LiveRange liveRange = liveRanges.getLiveRange(variable.getVariableRef());
|
||||
if (liveRange != null) {
|
||||
getLog().append(liveRange.toString(maxIndex) + " : " + variable.toString(getProgram()));
|
||||
}
|
||||
}
|
||||
|
||||
getLog().append("Complete equivalence classes");
|
||||
for(LiveRangeEquivalenceClass liveRangeEquivalenceClass : liveRangeEquivalenceClassSet.getEquivalenceClasses()) {
|
||||
getLog().append(liveRangeEquivalenceClass.toString());
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
|
||||
/**
|
||||
* A structure to generate reports expressed in the mermaid syntax for graphics generation.
|
||||
*/
|
||||
public abstract class Mermaid {
|
||||
|
||||
protected String id;
|
||||
protected String title;
|
||||
|
||||
|
||||
public Mermaid(String id, String title) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public static String toID(String label) {
|
||||
return label.replace(":","_").replace("@","_");
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
|
||||
/**
|
||||
* Create the flow components for mermaid report generation.
|
||||
* Flows are interconnecting mermaid nodes or sub graphs.
|
||||
*/
|
||||
public class MermaidFlow extends Mermaid{
|
||||
|
||||
public enum Type {
|
||||
FULL, DOTTED, LINED
|
||||
}
|
||||
|
||||
public enum Direction {
|
||||
UNI, BI
|
||||
}
|
||||
|
||||
private MermaidNode from, to;
|
||||
|
||||
private Type type;
|
||||
|
||||
private Direction direction;
|
||||
|
||||
MermaidFlow(MermaidNode from, MermaidNode to, String title, Type type, Direction direction) {
|
||||
super(from + "_" + to, title);
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.type = type;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getText(Program program) {
|
||||
StringBuilder text = new StringBuilder();
|
||||
|
||||
text.append(from.getId());
|
||||
if(direction == Direction.BI) {
|
||||
text.append("<");
|
||||
}
|
||||
switch(type) {
|
||||
case FULL -> {
|
||||
String title = getTitle();
|
||||
if(title != null)
|
||||
text.append("--").append(getTitle()).append("-->");
|
||||
else
|
||||
text.append("-->");
|
||||
}
|
||||
case DOTTED -> {
|
||||
String title = getTitle();
|
||||
if(title != null)
|
||||
text.append("-.").append(getTitle()).append(".->");
|
||||
else
|
||||
text.append("-.->");
|
||||
}
|
||||
}
|
||||
text.append(to.getId()).append("\n");
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
public MermaidNode getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public void setFrom(MermaidNode from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public MermaidNode getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public void setTo(MermaidNode to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Direction getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(Direction direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Create a flow chart for mermaid report generation.
|
||||
* Flowcharts contain nodes or sub graphs and flows, and can either be located as a single entity in root, or embedded in other sub graphs.
|
||||
*/
|
||||
public class MermaidGraph extends Mermaid {
|
||||
|
||||
public enum Direction {
|
||||
TOP_DOWN ("TD"),
|
||||
BOTTOM_UP ("BU"),
|
||||
LEFT_RIGHT("LR"),
|
||||
RIGHT_LEFT("RL");
|
||||
|
||||
private final String direction;
|
||||
|
||||
Direction(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.direction;
|
||||
}
|
||||
}
|
||||
|
||||
protected Direction direction;
|
||||
protected HashMap<String, MermaidNode> nodes;
|
||||
protected HashMap<String, MermaidFlow> flows;
|
||||
protected HashMap<String, MermaidSubGraph> subGraphs;
|
||||
|
||||
public MermaidGraph(Direction direction) {
|
||||
super(toID(""), "");
|
||||
this.direction = direction;
|
||||
this.nodes = new HashMap<String, MermaidNode>();
|
||||
this.flows = new HashMap<String, MermaidFlow>();
|
||||
this.subGraphs = new HashMap<String, MermaidSubGraph>();
|
||||
}
|
||||
|
||||
public String getText(Program program) {
|
||||
StringBuilder text = new StringBuilder();
|
||||
|
||||
// graph with direction
|
||||
text.append("graph ").append(this.direction.toString()).append("\n");
|
||||
|
||||
// sub graphs
|
||||
for(MermaidSubGraph subGraph : getSubGraphs().values()) {
|
||||
text.append(subGraph.getText(program));
|
||||
}
|
||||
|
||||
// nodes of the graph
|
||||
for(MermaidNode node : nodes.values()) {
|
||||
text.append(node.getText(program));
|
||||
}
|
||||
|
||||
// flows to and from nodes
|
||||
for(MermaidFlow flow : flows.values()) {
|
||||
text.append(flow.getText(program));
|
||||
}
|
||||
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
public HashMap<String, MermaidNode> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public void setNodes(HashMap<String, MermaidNode> nodes) {
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
public MermaidNode addNode(MermaidNode node) {
|
||||
this.nodes.putIfAbsent(node.id, node);
|
||||
return node;
|
||||
}
|
||||
|
||||
public MermaidNode addNode(String nodeName) {
|
||||
MermaidNode node = new MermaidNode(nodeName);
|
||||
this.nodes.putIfAbsent(node.id, node);
|
||||
return node;
|
||||
}
|
||||
|
||||
public HashMap<String, MermaidFlow> getFlows() {
|
||||
return flows;
|
||||
}
|
||||
|
||||
public void setFlows(HashMap<String, MermaidFlow> flows) {
|
||||
this.flows = flows;
|
||||
}
|
||||
|
||||
public void addFlow(MermaidFlow flow) {
|
||||
this.flows.put(flow.getFrom().getId() + "::" + flow.getTo().getId(), flow);
|
||||
}
|
||||
|
||||
public void addFlow(MermaidNode from, MermaidNode to, String title, MermaidFlow.Type type, MermaidFlow.Direction direction) {
|
||||
MermaidFlow flow = new MermaidFlow(from, to, title, type, direction);
|
||||
this.flows.put(from.getId() + "::" + to.getId(), flow);
|
||||
}
|
||||
|
||||
public MermaidFlow getFlow(MermaidNode from, MermaidNode to) {
|
||||
return this.flows.get(from.getId() + "::" + to.getId());
|
||||
}
|
||||
|
||||
public void removeFlow(MermaidFlow flow) {
|
||||
this.flows.remove(flow.getFrom().getId() + "::" + flow.getTo().getId());
|
||||
}
|
||||
|
||||
public HashMap<String, MermaidSubGraph> getSubGraphs() {
|
||||
return subGraphs;
|
||||
}
|
||||
|
||||
public void setSubGraphs(HashMap<String, MermaidSubGraph> subGraphs) {
|
||||
this.subGraphs = subGraphs;
|
||||
}
|
||||
|
||||
public MermaidSubGraph addProcedureSubGraph(MermaidSubGraph subGraph) {
|
||||
this.subGraphs.putIfAbsent(subGraph.id, subGraph);
|
||||
return subGraph;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.statements.StatementCall;
|
||||
import dk.camelot64.kickc.model.statements.StatementConditionalJump;
|
||||
|
||||
import javax.swing.text.AbstractDocument;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Create nodes for mermaid report generation.
|
||||
* Nodes are the final element in sub graphs or root.
|
||||
* They are expressed with an Id and a Title. The Id represents the
|
||||
* key to be interconnected through flows, while the Title is displayed
|
||||
* inside the graphics box. The title is expressed in markdown.
|
||||
* Each node can have statements, which is a list of Statements and are
|
||||
* shown in the graphics box expressed in markdown.
|
||||
*/
|
||||
public class MermaidNode extends Mermaid {
|
||||
|
||||
public MermaidNode(String title) {
|
||||
super(toID(title), title);
|
||||
this.type = Type.SEQUENCE;
|
||||
this.statements = new LinkedList<Statement>();
|
||||
this.flows = new HashSet<MermaidFlow>();
|
||||
}
|
||||
|
||||
public MermaidNode(String id, String title) {
|
||||
super(id, title);
|
||||
this.type = Type.SEQUENCE;
|
||||
this.statements = new LinkedList<Statement>();
|
||||
this.flows = new HashSet<MermaidFlow>();
|
||||
}
|
||||
|
||||
public enum Type { SEQUENCE, CALL, BRANCH }
|
||||
|
||||
private Type type;
|
||||
|
||||
protected HashSet<MermaidFlow> flows;
|
||||
|
||||
private List<Statement> statements;
|
||||
|
||||
public List<Statement> getStatements() {
|
||||
return statements;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setStatements(List<Statement> statements) {
|
||||
this.statements = statements;
|
||||
if(!statements.isEmpty()) {
|
||||
Statement lastStatement = this.statements.get(this.statements.size() - 1);
|
||||
|
||||
if (lastStatement instanceof StatementCall) {
|
||||
type = Type.CALL;
|
||||
} else if (lastStatement instanceof StatementConditionalJump) {
|
||||
type = Type.BRANCH;
|
||||
} else {
|
||||
type = Type.SEQUENCE;
|
||||
}
|
||||
} else {
|
||||
type = Type.SEQUENCE;
|
||||
}
|
||||
}
|
||||
|
||||
public String toStringStatements() {
|
||||
StringBuilder stmtString = new StringBuilder();
|
||||
for(Statement statement : getStatements()) {
|
||||
stmtString.append(statement).append("\n");
|
||||
}
|
||||
return stmtString.toString();
|
||||
}
|
||||
|
||||
public String getText(Program program) {
|
||||
StringBuilder text = new StringBuilder();
|
||||
|
||||
text.append(getId());
|
||||
|
||||
switch(getType()) {
|
||||
case SEQUENCE -> {
|
||||
text.append("[\"`");
|
||||
}
|
||||
case CALL -> {
|
||||
text.append("[[\"`");
|
||||
}
|
||||
case BRANCH -> {
|
||||
text.append("{{\"`");
|
||||
}
|
||||
}
|
||||
|
||||
text.append("**").append(getTitle()).append("**").append("\n\n");
|
||||
|
||||
for(Statement statement: getStatements()) {
|
||||
text.append(statement.toString(program, program.getLog().isVerboseLiveRanges())).append("\n");
|
||||
}
|
||||
|
||||
switch(getType()) {
|
||||
case SEQUENCE -> {
|
||||
text.append("`\"]\n");
|
||||
}
|
||||
case CALL -> {
|
||||
text.append("`\"]]\n");
|
||||
}
|
||||
case BRANCH -> {
|
||||
text.append("`\"}}\n");
|
||||
}
|
||||
}
|
||||
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
public HashSet<MermaidFlow> getFlows() {
|
||||
return flows;
|
||||
}
|
||||
|
||||
public void setFlows(HashSet<MermaidFlow> flows) {
|
||||
this.flows = flows;
|
||||
}
|
||||
|
||||
public void addFlow(MermaidFlow flow) {
|
||||
this.flows.add(flow);
|
||||
}
|
||||
|
||||
public void addFlow(MermaidNode from, MermaidNode to, String title, MermaidFlow.Type type, MermaidFlow.Direction direction) {
|
||||
MermaidFlow flow = new MermaidFlow(from, to, title, type, direction);
|
||||
this.flows.add(flow);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Create sub graphics for mermaid report generation.
|
||||
* Sub graphs contain nodes, and can either be located as a single entity in root, or embedded in other sub graphs.
|
||||
* A sub graph models dependencies to other sub graphs.
|
||||
*/
|
||||
public class MermaidSubGraph extends Mermaid {
|
||||
|
||||
protected HashMap<String, MermaidNode> nodes;
|
||||
protected HashSet<MermaidFlow> flows;
|
||||
protected HashMap<String, MermaidSubGraph> procedureSubGraphs;
|
||||
|
||||
public MermaidSubGraph(String title) {
|
||||
super(toID(title), title);
|
||||
this.nodes = new HashMap<String, MermaidNode>();
|
||||
this.flows = new HashSet<MermaidFlow>();
|
||||
this.procedureSubGraphs = new HashMap<String, MermaidSubGraph>();
|
||||
}
|
||||
|
||||
public MermaidSubGraph(String id, String title) {
|
||||
super(id, title);
|
||||
this.nodes = new HashMap<String, MermaidNode>();
|
||||
this.flows = new HashSet<MermaidFlow>();
|
||||
this.procedureSubGraphs = new HashMap<String, MermaidSubGraph>();
|
||||
}
|
||||
|
||||
public String getText(Program program) {
|
||||
StringBuilder text = new StringBuilder();
|
||||
|
||||
// subgraph and nodes
|
||||
text.append("subgraph ").append("sg_" + id).append("[\"").append(title).append("\"]\n");
|
||||
for(MermaidNode node : nodes.values()) {
|
||||
text.append(node.getText(program));
|
||||
}
|
||||
text.append("end\n\n");
|
||||
|
||||
// procedure subgraphs
|
||||
for(MermaidSubGraph procedureSubGraph : getProcedureSubGraphs().values()) {
|
||||
text.append(procedureSubGraph.getText(program));
|
||||
}
|
||||
|
||||
// flows to and from nodes (outside the subgraph)
|
||||
for(MermaidFlow flow : flows) {
|
||||
text.append(flow.getText(program));
|
||||
}
|
||||
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
public HashMap<String, MermaidNode> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public void setNodes(HashMap<String, MermaidNode> nodes) {
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
public MermaidNode addNode(MermaidNode node) {
|
||||
this.nodes.putIfAbsent(node.id, node);
|
||||
return node;
|
||||
}
|
||||
|
||||
public MermaidNode addNode(String nodeName) {
|
||||
MermaidNode node = new MermaidNode(nodeName);
|
||||
this.nodes.putIfAbsent(node.id, node);
|
||||
return node;
|
||||
}
|
||||
|
||||
public HashSet<MermaidFlow> getFlows() {
|
||||
return flows;
|
||||
}
|
||||
|
||||
public void setFlows(HashSet<MermaidFlow> flows) {
|
||||
this.flows = flows;
|
||||
}
|
||||
|
||||
public void addFlow(MermaidFlow flow) {
|
||||
this.flows.add(flow);
|
||||
}
|
||||
|
||||
public void addFlow(MermaidNode from, MermaidNode to, String title, MermaidFlow.Type type, MermaidFlow.Direction direction) {
|
||||
MermaidFlow flow = new MermaidFlow(from, to, title, type, direction);
|
||||
this.flows.add(flow);
|
||||
}
|
||||
|
||||
public HashMap<String, MermaidSubGraph> getProcedureSubGraphs() {
|
||||
return procedureSubGraphs;
|
||||
}
|
||||
|
||||
public void setProcedureSubGraphs(HashMap<String, MermaidSubGraph> procedureSubGraphs) {
|
||||
this.procedureSubGraphs = procedureSubGraphs;
|
||||
}
|
||||
|
||||
public MermaidSubGraph addProcedureSubGraph(MermaidSubGraph subGraph) {
|
||||
this.procedureSubGraphs.putIfAbsent(subGraph.id, subGraph);
|
||||
return subGraph;
|
||||
}
|
||||
|
||||
public MermaidSubGraph addProcedureSubGraph(String subGraphName) {
|
||||
MermaidSubGraph subGraph = new MermaidSubGraph(subGraphName);
|
||||
this.procedureSubGraphs.putIfAbsent(subGraph.id, subGraph);
|
||||
return subGraph;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
import dk.camelot64.kickc.model.InternalError;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* Base class for compiler reports generated in separate files in the compiler output directory.
|
||||
*/
|
||||
public abstract class Report {
|
||||
|
||||
final protected Program program;
|
||||
protected String pass;
|
||||
protected String extension;
|
||||
|
||||
public String configureReport() {
|
||||
StringBuilder report = new StringBuilder();
|
||||
report.append("---\n");
|
||||
report.append("config:\n");
|
||||
report.append(" theme: dark\n");
|
||||
report.append(" flowchart:\n");
|
||||
report.append(" wrappingWidth: 800\n");
|
||||
report.append(" nodeSpacing : 40\n");
|
||||
report.append(" rankSpacing : 40\n");
|
||||
report.append(" titleTopMargin : 40\n");
|
||||
report.append(" padding : 10\n");
|
||||
report.append(" htmlLabels: false\n");
|
||||
report.append("---\n");
|
||||
return report.toString();
|
||||
}
|
||||
|
||||
abstract String generateReport(Program program);
|
||||
|
||||
Report(Program program, String pass, String extension) {
|
||||
this.program = program;
|
||||
this.pass = pass;
|
||||
this.extension = extension;
|
||||
};
|
||||
|
||||
public void generateReport() {
|
||||
Path reportPath = program.getOutputFileManager().getMermaidOutputFile(pass, extension);
|
||||
System.out.println("Generating report " + reportPath);
|
||||
try {
|
||||
FileOutputStream reportOutputStream = new FileOutputStream(reportPath.toFile());
|
||||
OutputStreamWriter reportWriter = new OutputStreamWriter(reportOutputStream);
|
||||
String reportDiagramString = generateReport(this.program);
|
||||
reportWriter.write(reportDiagramString);
|
||||
reportWriter.close();
|
||||
reportOutputStream.close();
|
||||
} catch(Exception e) {
|
||||
throw new InternalError("Error generating report " + reportPath, e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
import dk.camelot64.kickc.model.Graph;
|
||||
import dk.camelot64.kickc.model.ProcedureCompilation;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.statements.StatementCall;
|
||||
import dk.camelot64.kickc.model.symbols.Procedure;
|
||||
import dk.camelot64.kickc.model.values.LabelRef;
|
||||
import dk.camelot64.kickc.model.values.ProcedureRef;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Create a report of the Control Block Flow Graph (CFG) of the whole Program.
|
||||
* This class generates a markdown report with embedded mermaid graphics of
|
||||
* the whole Program CFGs.
|
||||
*/
|
||||
public class ReportCFG extends Report {
|
||||
|
||||
private MermaidGraph mermaidGraph;
|
||||
|
||||
public ReportCFG(Program program, String pass, String extension) {
|
||||
super(program, pass, extension);
|
||||
}
|
||||
|
||||
public void mermaidCFGBlock(Graph graph, Graph.Block block, MermaidSubGraph mermaidSubGraph) {
|
||||
|
||||
String blockName = block.getLabel().getFullName();
|
||||
|
||||
MermaidNode node = mermaidSubGraph.addNode(new MermaidNode(blockName));
|
||||
|
||||
node.setStatements(block.getStatements());
|
||||
|
||||
List<Graph.Block> predecessors = program.getGraph().getPredecessors(block);
|
||||
if(!predecessors.isEmpty()) {
|
||||
for(Graph.Block predecessor : predecessors) {
|
||||
|
||||
String predecessorNodeName = predecessor.getLabel().getFullName();
|
||||
String predecessorLocalNodeName = predecessor.getScope().getLocalName();
|
||||
|
||||
if (program.isProcedureEntry(block)) {
|
||||
MermaidSubGraph procedureSubGraph = mermaidSubGraph.addProcedureSubGraph(predecessorLocalNodeName);
|
||||
MermaidNode nodePredecessor = procedureSubGraph.addNode(predecessorNodeName);
|
||||
mermaidSubGraph.addFlow(nodePredecessor, node, "call", MermaidFlow.Type.FULL, MermaidFlow.Direction.UNI);
|
||||
String blockReturnName = block.getLabel().getLocalName() + "::@return";
|
||||
MermaidNode nodeReturn = mermaidSubGraph.addNode(blockReturnName);
|
||||
mermaidSubGraph.addFlow(nodeReturn, nodePredecessor, "return", MermaidFlow.Type.FULL, MermaidFlow.Direction.UNI);
|
||||
} else {
|
||||
MermaidNode nodePredecessor = mermaidSubGraph.addNode(predecessorNodeName);
|
||||
LabelRef successorLabel = predecessor.getConditionalSuccessor();
|
||||
Graph.Block successor = null;
|
||||
if(successorLabel != null) {
|
||||
successor = graph.getBlock(successorLabel);
|
||||
}
|
||||
if( successor != null && successor.equals(block)) {
|
||||
mermaidSubGraph.addFlow(nodePredecessor, node, "true", MermaidFlow.Type.DOTTED, MermaidFlow.Direction.UNI);
|
||||
} else {
|
||||
mermaidSubGraph.addFlow(nodePredecessor, node, null, MermaidFlow.Type.DOTTED, MermaidFlow.Direction.UNI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!block.getStatements().isEmpty()) {
|
||||
for (Statement statement : block.getStatements()) {
|
||||
if(statement instanceof StatementCall) {
|
||||
String procedureName = ((StatementCall) statement).getProcedureName();
|
||||
MermaidSubGraph procedureSubGraph = mermaidSubGraph.addProcedureSubGraph(procedureName);
|
||||
MermaidNode procedureNode = procedureSubGraph.addNode(procedureName);
|
||||
mermaidSubGraph.addFlow(node, procedureNode,"call", MermaidFlow.Type.FULL, MermaidFlow.Direction.BI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String mermaidCFGProcedure(Procedure procedure, Graph graph) {
|
||||
String procedureName = procedure.getLocalName();
|
||||
String procedureTitle = procedure.toString(program);
|
||||
|
||||
MermaidSubGraph subGraphProcedure = new MermaidSubGraph(procedureName, procedureTitle);
|
||||
mermaidGraph.addProcedureSubGraph(subGraphProcedure);
|
||||
for(Graph.Block block : graph.getAllBlocks()) {
|
||||
mermaidCFGBlock(graph, block, subGraphProcedure);
|
||||
}
|
||||
|
||||
return mermaidGraph.getText(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateReport(Program program) {
|
||||
StringBuilder report = new StringBuilder();
|
||||
for(ProcedureCompilation procedureCompilation : program.getProcedureCompilations()) {
|
||||
Procedure procedure = program.getScope().getProcedure(procedureCompilation.getProcedureRef());
|
||||
Graph graph = procedureCompilation.getGraph();
|
||||
if(graph != null) {
|
||||
mermaidGraph = new MermaidGraph(MermaidGraph.Direction.TOP_DOWN);
|
||||
report.append("Procedure " + procedure.getFullName() + "\n");
|
||||
report.append("```mermaid\n");
|
||||
report.append(configureReport());
|
||||
report.append(mermaidCFGProcedure(procedure, graph));
|
||||
report.append("```\n\n");
|
||||
}
|
||||
}
|
||||
return report.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
import dk.camelot64.kickc.model.Graph;
|
||||
import dk.camelot64.kickc.model.ProcedureCompilation;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.statements.StatementCall;
|
||||
import dk.camelot64.kickc.model.symbols.Procedure;
|
||||
import dk.camelot64.kickc.model.values.LabelRef;
|
||||
import dk.camelot64.kickc.model.values.ProcedureRef;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Create a report of the Call Graph (CFG) of the procedures of the whole Program.
|
||||
* The report is generated in markdown with embedded mermaid graphics.
|
||||
*/
|
||||
public class ReportCG extends Report {
|
||||
|
||||
public MermaidGraph mermaidGraph;
|
||||
|
||||
public ReportCG(Program program, String pass, String extension) {
|
||||
super(program, pass, extension);
|
||||
this.mermaidGraph = new MermaidGraph(MermaidGraph.Direction.TOP_DOWN);
|
||||
generateReport();
|
||||
}
|
||||
|
||||
public ReportCG(Program program, String pass, String extension, MermaidGraph mermaidGraph) {
|
||||
super(program, pass, extension);
|
||||
this.mermaidGraph = mermaidGraph;
|
||||
generateReport();
|
||||
}
|
||||
|
||||
public void mermaidCGBlock(Graph.Block block, MermaidNode node) {
|
||||
|
||||
if(!block.getStatements().isEmpty()) {
|
||||
for (Statement statement : block.getStatements()) {
|
||||
if(statement instanceof StatementCall) {
|
||||
String procedureName = ((StatementCall) statement).getProcedureName();
|
||||
Procedure procedure = program.getScope().getProcedure(new ProcedureRef(procedureName));
|
||||
ProcedureCompilation procedureCompilation = program.getProcedureCompilation(new ProcedureRef(procedureName));
|
||||
Graph procedureGraph = procedureCompilation.getGraph();
|
||||
MermaidNode procedureNode = mermaidCGProcedure(procedure, procedureGraph);
|
||||
MermaidFlow flow = mermaidGraph.getFlow(node, procedureNode);
|
||||
String flowTitle = "1";
|
||||
if(flow != null) {
|
||||
flowTitle = flow.getTitle();
|
||||
Integer count = Integer.parseInt(flowTitle);
|
||||
count++;
|
||||
flowTitle = count.toString();
|
||||
mermaidGraph.removeFlow(flow);
|
||||
}
|
||||
mermaidGraph.addFlow(node, procedureNode, flowTitle, MermaidFlow.Type.FULL, MermaidFlow.Direction.BI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private MermaidNode mermaidCGProcedure(Procedure procedure, Graph graph) {
|
||||
String procedureName = procedure.getLocalName();
|
||||
String procedureTitle = procedure.toString(program);
|
||||
|
||||
MermaidNode node = new MermaidNode(procedureName, procedureTitle);
|
||||
for(Graph.Block block : graph.getAllBlocks()) {
|
||||
mermaidCGBlock(block, node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
private String mermaidCGRoot(Procedure procedure, Graph graph) {
|
||||
String procedureName = procedure.getLocalName();
|
||||
String procedureTitle = procedure.toString(program);
|
||||
|
||||
MermaidNode node = new MermaidNode(procedureName, procedureTitle);
|
||||
mermaidGraph.addNode(node);
|
||||
for(Graph.Block block : graph.getAllBlocks()) {
|
||||
mermaidCGBlock(block, node);
|
||||
}
|
||||
return mermaidGraph.getText(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateReport(Program program) {
|
||||
StringBuilder report = new StringBuilder();
|
||||
ProcedureCompilation procedureCompilation = program.getProcedureCompilation(new ProcedureRef("main"));
|
||||
if(procedureCompilation != null) {
|
||||
Procedure procedure = program.getScope().getProcedure(procedureCompilation.getProcedureRef());
|
||||
Graph graph = procedureCompilation.getGraph();
|
||||
if(graph != null) {
|
||||
report.append("Procedure " + procedure.getFullName() + "\n");
|
||||
report.append("```mermaid\n");
|
||||
report.append(configureReport());
|
||||
report.append(mermaidCGRoot(procedure, graph));
|
||||
report.append("```\n\n");
|
||||
}
|
||||
}
|
||||
return report.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package dk.camelot64.kickc.passes.reports;
|
||||
|
||||
import dk.camelot64.kickc.model.*;
|
||||
import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.symbols.Procedure;
|
||||
import dk.camelot64.kickc.model.values.VariableRef;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Creates a reference interference graph from the liveliness analysis and coalesce actions.
|
||||
*/
|
||||
public class ReportRIG extends Report {
|
||||
|
||||
public MermaidGraph mermaidGraph;
|
||||
|
||||
public ReportRIG(Program program, String pass, String extension) {
|
||||
super(program, pass, extension);
|
||||
}
|
||||
|
||||
public void mermaidRIGBlock(Graph.Block block, LiveRangeVariables liveRanges) {
|
||||
if(!block.getStatements().isEmpty()) {
|
||||
for (Statement statement : block.getStatements()) {
|
||||
List<VariableRef> aliveVariables = liveRanges.getAlive(statement.getIndex());
|
||||
int size = aliveVariables.size();
|
||||
if(size > 2) {
|
||||
for (int i = 0; i < size - 1; i++) {
|
||||
VariableRef varInner = aliveVariables.get(i);
|
||||
MermaidNode innerNode = mermaidGraph.addNode(varInner.getFullName());
|
||||
for (int o = i+1; o < size; o++) {
|
||||
VariableRef varOuter = aliveVariables.get(o);
|
||||
MermaidNode outerNode = mermaidGraph.addNode(varOuter.getFullName());
|
||||
mermaidGraph.addFlow(innerNode, outerNode, null, MermaidFlow.Type.FULL, MermaidFlow.Direction.BI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String mermaidLiveRanges(Procedure procedure, Graph graph, LiveRangeVariables liveRanges) {
|
||||
|
||||
for(Graph.Block block : graph.getAllBlocks()) {
|
||||
mermaidRIGBlock(block, liveRanges);
|
||||
}
|
||||
|
||||
return mermaidGraph.getText(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateReport(Program program) {
|
||||
StringBuilder report = new StringBuilder();
|
||||
LiveRangeVariables liveRanges = program.getLiveRangeVariables();
|
||||
for(ProcedureCompilation procedureCompilation : program.getProcedureCompilations()) {
|
||||
Procedure procedure = program.getScope().getProcedure(procedureCompilation.getProcedureRef());
|
||||
Graph graph = procedureCompilation.getGraph();
|
||||
if(graph != null) {
|
||||
report.append("Procedure " + procedure.getFullName() + "\n");
|
||||
report.append("```mermaid\n");
|
||||
mermaidGraph = new MermaidGraph(MermaidGraph.Direction.TOP_DOWN);
|
||||
report.append(configureReport());
|
||||
report.append(mermaidLiveRanges(procedure, graph, liveRanges));
|
||||
report.append("```\n\n");
|
||||
}
|
||||
}
|
||||
return report.toString();
|
||||
}
|
||||
}
|
|
@ -21,70 +21,70 @@
|
|||
/// Keyboard Codes for all 63 keys.
|
||||
/// Keyboard Codes are %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7).
|
||||
/// See C64 Keyboard Matrix Reference http://codebase64.org/doku.php?id=base:reading_the_keyboard
|
||||
const char KEY_DEL = $00;
|
||||
const char KEY_RETURN = $01;
|
||||
const char KEY_CRSR_RIGHT = $02;
|
||||
const char KEY_F7 = $03;
|
||||
const char KEY_F1 = $04;
|
||||
const char KEY_F3 = $05;
|
||||
const char KEY_F5 = $06;
|
||||
const char KEY_CRSR_DOWN = $07;
|
||||
const char KEY_3 = $08;
|
||||
const char KEY_W = $09;
|
||||
const char KEY_A = $0a;
|
||||
const char KEY_4 = $0b;
|
||||
const char KEY_Z = $0c;
|
||||
const char KEY_S = $0d;
|
||||
const char KEY_E = $0e;
|
||||
const char KEY_LSHIFT = $0f;
|
||||
const char KEY_5 = $10;
|
||||
const char KEY_R = $11;
|
||||
const char KEY_D = $12;
|
||||
const char KEY_6 = $13;
|
||||
const char KEY_C = $14;
|
||||
const char KEY_F = $15;
|
||||
const char KEY_T = $16;
|
||||
const char KEY_X = $17;
|
||||
const char KEY_7 = $18;
|
||||
const char KEY_Y = $19;
|
||||
const char KEY_G = $1a;
|
||||
const char KEY_8 = $1b;
|
||||
const char KEY_B = $1c;
|
||||
const char KEY_H = $1d;
|
||||
const char KEY_U = $1e;
|
||||
const char KEY_V = $1f;
|
||||
const char KEY_9 = $20;
|
||||
const char KEY_I = $21;
|
||||
const char KEY_J = $22;
|
||||
const char KEY_0 = $23;
|
||||
const char KEY_M = $24;
|
||||
const char KEY_K = $25;
|
||||
const char KEY_O = $26;
|
||||
const char KEY_N = $27;
|
||||
const char KEY_PLUS = $28;
|
||||
const char KEY_P = $29;
|
||||
const char KEY_L = $2a;
|
||||
const char KEY_MINUS = $2b;
|
||||
const char KEY_DOT = $2c;
|
||||
const char KEY_COLON = $2d;
|
||||
const char KEY_AT = $2e;
|
||||
const char KEY_COMMA = $2f;
|
||||
const char KEY_POUND = $30;
|
||||
const char KEY_ASTERISK = $31;
|
||||
const char KEY_SEMICOLON = $32;
|
||||
const char KEY_HOME = $33;
|
||||
const char KEY_RSHIFT = $34;
|
||||
const char KEY_EQUALS = $35;
|
||||
const char KEY_ARROW_UP = $36;
|
||||
const char KEY_SLASH = $37;
|
||||
const char KEY_1 = $38;
|
||||
const char KEY_ARROW_LEFT = $39;
|
||||
const char KEY_CTRL = $3a;
|
||||
const char KEY_2 = $3b;
|
||||
const char KEY_SPACE = $3c;
|
||||
const char KEY_COMMODORE = $3d;
|
||||
const char KEY_Q = $3e;
|
||||
const char KEY_RUNSTOP = $3f;
|
||||
const char KEY_DEL = 0x00;
|
||||
const char KEY_RETURN = 0x01;
|
||||
const char KEY_CRSR_RIGHT = 0x02;
|
||||
const char KEY_F7 = 0x03;
|
||||
const char KEY_F1 = 0x04;
|
||||
const char KEY_F3 = 0x05;
|
||||
const char KEY_F5 = 0x06;
|
||||
const char KEY_CRSR_DOWN = 0x07;
|
||||
const char KEY_3 = 0x08;
|
||||
const char KEY_W = 0x09;
|
||||
const char KEY_A = 0x0a;
|
||||
const char KEY_4 = 0x0b;
|
||||
const char KEY_Z = 0x0c;
|
||||
const char KEY_S = 0x0d;
|
||||
const char KEY_E = 0x0e;
|
||||
const char KEY_LSHIFT = 0x0f;
|
||||
const char KEY_5 = 0x10;
|
||||
const char KEY_R = 0x11;
|
||||
const char KEY_D = 0x12;
|
||||
const char KEY_6 = 0x13;
|
||||
const char KEY_C = 0x14;
|
||||
const char KEY_F = 0x15;
|
||||
const char KEY_T = 0x16;
|
||||
const char KEY_X = 0x17;
|
||||
const char KEY_7 = 0x18;
|
||||
const char KEY_Y = 0x19;
|
||||
const char KEY_G = 0x1a;
|
||||
const char KEY_8 = 0x1b;
|
||||
const char KEY_B = 0x1c;
|
||||
const char KEY_H = 0x1d;
|
||||
const char KEY_U = 0x1e;
|
||||
const char KEY_V = 0x1f;
|
||||
const char KEY_9 = 0x20;
|
||||
const char KEY_I = 0x21;
|
||||
const char KEY_J = 0x22;
|
||||
const char KEY_0 = 0x23;
|
||||
const char KEY_M = 0x24;
|
||||
const char KEY_K = 0x25;
|
||||
const char KEY_O = 0x26;
|
||||
const char KEY_N = 0x27;
|
||||
const char KEY_PLUS = 0x28;
|
||||
const char KEY_P = 0x29;
|
||||
const char KEY_L = 0x2a;
|
||||
const char KEY_MINUS = 0x2b;
|
||||
const char KEY_DOT = 0x2c;
|
||||
const char KEY_COLON = 0x2d;
|
||||
const char KEY_AT = 0x2e;
|
||||
const char KEY_COMMA = 0x2f;
|
||||
const char KEY_POUND = 0x30;
|
||||
const char KEY_ASTERISK = 0x31;
|
||||
const char KEY_SEMICOLON = 0x32;
|
||||
const char KEY_HOME = 0x33;
|
||||
const char KEY_RSHIFT = 0x34;
|
||||
const char KEY_EQUALS = 0x35;
|
||||
const char KEY_ARROW_UP = 0x36;
|
||||
const char KEY_SLASH = 0x37;
|
||||
const char KEY_1 = 0x38;
|
||||
const char KEY_ARROW_LEFT = 0x39;
|
||||
const char KEY_CTRL = 0x3a;
|
||||
const char KEY_2 = 0x3b;
|
||||
const char KEY_SPACE = 0x3c;
|
||||
const char KEY_COMMODORE = 0x3d;
|
||||
const char KEY_Q = 0x3e;
|
||||
const char KEY_RUNSTOP = 0x3f;
|
||||
|
||||
/// Initialize keyboard reading by setting CIA#$ Data Direction Registers
|
||||
void keyboard_init();
|
||||
|
|
|
@ -47,8 +47,18 @@ char * const DEFAULT_FONT_MIXED = (char*)0x1800;
|
|||
struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *)0xdc00;
|
||||
/// The CIA#2: Serial bus, RS-232, VIC memory bank
|
||||
struct MOS6526_CIA * const CIA2 = (struct MOS6526_CIA *)0xdd00;
|
||||
/// CIA#1 timer A
|
||||
unsigned int* const CIA1_TIMER_A = (unsigned int*)0xdc04;
|
||||
/// CIA#1 timer B
|
||||
unsigned int* const CIA1_TIMER_B = (unsigned int*)0xdc06;
|
||||
/// CIA#1 timer A&B as one single 32-bit value
|
||||
unsigned long* const CIA1_TIMER_AB = (unsigned long*)0xdc04;
|
||||
/// CIA#1 Interrupt for reading in ASM
|
||||
char * const CIA1_INTERRUPT = (char*)0xdc0d;
|
||||
/// CIA#2 timer A
|
||||
unsigned int* const CIA2_TIMER_A = (unsigned int*)0xdd04;
|
||||
/// CIA#2 timer B
|
||||
unsigned int* const CIA2_TIMER_B = (unsigned int*)0xdd06;
|
||||
/// CIA#2 timer A&B as one single 32-bit value
|
||||
unsigned long* const CIA2_TIMER_AB = (unsigned long*)0xdd04;
|
||||
/// CIA#2 Interrupt for reading in ASM
|
||||
|
|
|
@ -9,58 +9,58 @@
|
|||
#include <c64.h>
|
||||
|
||||
/// Feature enables or disables the extra C64 DTV features
|
||||
char* const DTV_FEATURE = (char*)$d03f;
|
||||
char* const DTV_FEATURE = (char*)0xd03f;
|
||||
const char DTV_FEATURE_ENABLE = 1;
|
||||
const char DTV_FEATURE_DISABLE_TIL_RESET = 2;
|
||||
|
||||
/// Controls the graphics modes of the C64 DTV
|
||||
char* const DTV_CONTROL = (char*)$d03c;
|
||||
const char DTV_LINEAR = $01;
|
||||
const char DTV_BORDER_OFF = $02;
|
||||
const char DTV_HIGHCOLOR = $04;
|
||||
const char DTV_OVERSCAN = $08;
|
||||
const char DTV_COLORRAM_OFF = $10;
|
||||
const char DTV_BADLINE_OFF = $20;
|
||||
const char DTV_CHUNKY = $40;
|
||||
char* const DTV_CONTROL = (char*)0xd03c;
|
||||
const char DTV_LINEAR = 0x01;
|
||||
const char DTV_BORDER_OFF = 0x02;
|
||||
const char DTV_HIGHCOLOR = 0x04;
|
||||
const char DTV_OVERSCAN = 0x08;
|
||||
const char DTV_COLORRAM_OFF = 0x10;
|
||||
const char DTV_BADLINE_OFF = 0x20;
|
||||
const char DTV_CHUNKY = 0x40;
|
||||
|
||||
/// Defines colors for the 16 first colors ($00-$0f)
|
||||
char* const DTV_PALETTE = (char*)$d200;
|
||||
char* const DTV_PALETTE = (char*)0xd200;
|
||||
|
||||
/// Default vallues for the palette
|
||||
char DTV_PALETTE_DEFAULT[16] = { $00, $0f, $36, $be, $58, $db, $86, $ff, $29, $26, $3b, $05, $07, $df, $9a, $0a };
|
||||
char DTV_PALETTE_DEFAULT[16] = { 0x00, 0x0f, 0x36, 0xbe, 0x58, 0xdb, 0x86, 0xff, 0x29, 0x26, 0x3b, 0x05, 0x07, 0xdf, 0x9a, 0x0a };
|
||||
|
||||
/// Linear Graphics Plane A Counter Control
|
||||
char* const DTV_PLANEA_START_LO = (char*)$d03a;
|
||||
char* const DTV_PLANEA_START_MI = (char*)$d03b;
|
||||
char* const DTV_PLANEA_START_HI = (char*)$d045;
|
||||
char* const DTV_PLANEA_STEP = (char*)$d046;
|
||||
char* const DTV_PLANEA_MODULO_LO = (char*)$d038;
|
||||
char* const DTV_PLANEA_MODULO_HI = (char*)$d039;
|
||||
char* const DTV_PLANEA_START_LO = (char*)0xd03a;
|
||||
char* const DTV_PLANEA_START_MI = (char*)0xd03b;
|
||||
char* const DTV_PLANEA_START_HI = (char*)0xd045;
|
||||
char* const DTV_PLANEA_STEP = (char*)0xd046;
|
||||
char* const DTV_PLANEA_MODULO_LO = (char*)0xd038;
|
||||
char* const DTV_PLANEA_MODULO_HI = (char*)0xd039;
|
||||
|
||||
/// Linear Graphics Plane B Counter Control
|
||||
char* const DTV_PLANEB_START_LO = (char*)$d049;
|
||||
char* const DTV_PLANEB_START_MI = (char*)$d04a;
|
||||
char* const DTV_PLANEB_START_HI = (char*)$d04b;
|
||||
char* const DTV_PLANEB_STEP = (char*)$d04c;
|
||||
char* const DTV_PLANEB_MODULO_LO = (char*)$d047;
|
||||
char* const DTV_PLANEB_MODULO_HI = (char*)$d048;
|
||||
char* const DTV_PLANEB_START_LO = (char*)0xd049;
|
||||
char* const DTV_PLANEB_START_MI = (char*)0xd04a;
|
||||
char* const DTV_PLANEB_START_HI = (char*)0xd04b;
|
||||
char* const DTV_PLANEB_STEP = (char*)0xd04c;
|
||||
char* const DTV_PLANEB_MODULO_LO = (char*)0xd047;
|
||||
char* const DTV_PLANEB_MODULO_HI = (char*)0xd048;
|
||||
|
||||
/// Select memory bank where sprite data is fetched from (bits 5:0) - source only (J)
|
||||
/// Memory address of Sprite RAM is SpriteBank*$10000
|
||||
char* const DTV_SPRITE_BANK = (char*)$d04d;
|
||||
char* const DTV_SPRITE_BANK = (char*)0xd04d;
|
||||
|
||||
/// Select memory bank where color data is fetched from (bits 11:0)
|
||||
/// Memory address of Color RAM is ColorBank*$400
|
||||
char* const DTV_COLOR_BANK_LO = (char*)$d036;
|
||||
char* const DTV_COLOR_BANK_HI = (char*)$d037;
|
||||
char* const DTV_COLOR_BANK_LO = (char*)0xd036;
|
||||
char* const DTV_COLOR_BANK_HI = (char*)0xd037;
|
||||
|
||||
const unsigned long DTV_COLOR_BANK_DEFAULT = $1d800;
|
||||
const unsigned long DTV_COLOR_BANK_DEFAULT = 0x1d800;
|
||||
|
||||
/// Selects memory bank for normal VIC color mode and lower data for high color modes. (bits 5:0)
|
||||
/// Memory address of VIC Graphics is GraphicsBank*$10000
|
||||
char* const DTV_GRAPHICS_VIC_BANK = (char*)$d03d;
|
||||
char* const DTV_GRAPHICS_VIC_BANK = (char*)0xd03d;
|
||||
/// Selects memory bank for upper data for high color modes. (bits 5:0) - source only (H)
|
||||
char* const DTV_GRAPHICS_HICOL_BANK = (char*)$d03e;
|
||||
char* const DTV_GRAPHICS_HICOL_BANK = (char*)0xd03e;
|
||||
|
||||
/// 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
|
||||
|
@ -68,107 +68,107 @@ char* const DTV_GRAPHICS_HICOL_BANK = (char*)$d03e;
|
|||
void dtvSetCpuBankSegment1(char cpuBankIdx);
|
||||
|
||||
/// Blitter Source A Start
|
||||
char* const DTV_BLITTER_SRCA_LO = (char*)$d320;
|
||||
char* const DTV_BLITTER_SRCA_MI = (char*)$d321;
|
||||
char* const DTV_BLITTER_SRCA_HI = (char*)$d322;
|
||||
char* const DTV_BLITTER_SRCA_LO = (char*)0xd320;
|
||||
char* const DTV_BLITTER_SRCA_MI = (char*)0xd321;
|
||||
char* const DTV_BLITTER_SRCA_HI = (char*)0xd322;
|
||||
/// Blitter Source A Modulo
|
||||
char* const DTV_BLITTER_SRCA_MOD_LO = (char*)$d323;
|
||||
char* const DTV_BLITTER_SRCA_MOD_HI = (char*)$d324;
|
||||
char* const DTV_BLITTER_SRCA_MOD_LO = (char*)0xd323;
|
||||
char* const DTV_BLITTER_SRCA_MOD_HI = (char*)0xd324;
|
||||
/// Blitter Source A Line Length
|
||||
char* const DTV_BLITTER_SRCA_LIN_LO = (char*)$d325;
|
||||
char* const DTV_BLITTER_SRCA_LIN_HI = (char*)$d326;
|
||||
char* const DTV_BLITTER_SRCA_LIN_LO = (char*)0xd325;
|
||||
char* const DTV_BLITTER_SRCA_LIN_HI = (char*)0xd326;
|
||||
/// Blitter Source A Step ([7:4] integral part, [3:0] fractional part)
|
||||
char* const DTV_BLITTER_SRCA_STEP = (char*)$d327;
|
||||
char* const DTV_BLITTER_SRCA_STEP = (char*)0xd327;
|
||||
/// Blitter Source B Start
|
||||
char* const DTV_BLITTER_SRCB_LO = (char*)$d328;
|
||||
char* const DTV_BLITTER_SRCB_MI = (char*)$d329;
|
||||
char* const DTV_BLITTER_SRCB_HI = (char*)$d32a;
|
||||
char* const DTV_BLITTER_SRCB_LO = (char*)0xd328;
|
||||
char* const DTV_BLITTER_SRCB_MI = (char*)0xd329;
|
||||
char* const DTV_BLITTER_SRCB_HI = (char*)0xd32a;
|
||||
/// Blitter Source B Modulo
|
||||
char* const DTV_BLITTER_SRCB_MOD_LO = (char*)$d32b;
|
||||
char* const DTV_BLITTER_SRCB_MOD_HI = (char*)$d32c;
|
||||
char* const DTV_BLITTER_SRCB_MOD_LO = (char*)0xd32b;
|
||||
char* const DTV_BLITTER_SRCB_MOD_HI = (char*)0xd32c;
|
||||
/// Blitter Source B Line Length
|
||||
char* const DTV_BLITTER_SRCB_LIN_LO = (char*)$d32d;
|
||||
char* const DTV_BLITTER_SRCB_LIN_HI = (char*)$d32e;
|
||||
char* const DTV_BLITTER_SRCB_LIN_LO = (char*)0xd32d;
|
||||
char* const DTV_BLITTER_SRCB_LIN_HI = (char*)0xd32e;
|
||||
/// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
|
||||
char* const DTV_BLITTER_SRCB_STEP = (char*)$d32f;
|
||||
char* const DTV_BLITTER_SRCB_STEP = (char*)0xd32f;
|
||||
/// Blitter Destination Start
|
||||
char* const DTV_BLITTER_DEST_LO = (char*)$d330;
|
||||
char* const DTV_BLITTER_DEST_MI = (char*)$d331;
|
||||
char* const DTV_BLITTER_DEST_HI = (char*)$d332;
|
||||
char* const DTV_BLITTER_DEST_LO = (char*)0xd330;
|
||||
char* const DTV_BLITTER_DEST_MI = (char*)0xd331;
|
||||
char* const DTV_BLITTER_DEST_HI = (char*)0xd332;
|
||||
/// Blitter Source B Modulo
|
||||
char* const DTV_BLITTER_DEST_MOD_LO = (char*)$d333;
|
||||
char* const DTV_BLITTER_DEST_MOD_HI = (char*)$d334;
|
||||
char* const DTV_BLITTER_DEST_MOD_LO = (char*)0xd333;
|
||||
char* const DTV_BLITTER_DEST_MOD_HI = (char*)0xd334;
|
||||
/// Blitter Source B Line Length
|
||||
char* const DTV_BLITTER_DEST_LIN_LO = (char*)$d335;
|
||||
char* const DTV_BLITTER_DEST_LIN_HI = (char*)$d336;
|
||||
char* const DTV_BLITTER_DEST_LIN_LO = (char*)0xd335;
|
||||
char* const DTV_BLITTER_DEST_LIN_HI = (char*)0xd336;
|
||||
/// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
|
||||
char* const DTV_BLITTER_DEST_STEP = (char*)$d337;
|
||||
char* const DTV_BLITTER_DEST_STEP = (char*)0xd337;
|
||||
/// Blitter Blit Length
|
||||
char* const DTV_BLITTER_LEN_LO = (char*)$d338;
|
||||
char* const DTV_BLITTER_LEN_HI = (char*)$d339;
|
||||
char* const DTV_BLITTER_LEN_LO = (char*)0xd338;
|
||||
char* const DTV_BLITTER_LEN_HI = (char*)0xd339;
|
||||
/// Blitter Control
|
||||
char* const DTV_BLITTER_CONTROL = (char*)$d33a;
|
||||
char* const DTV_BLITTER_CONTROL = (char*)0xd33a;
|
||||
/// Bit[0] Force Start Strobe when set
|
||||
const char DTV_BLIT_FORCE_START = %00000001;
|
||||
const char DTV_BLIT_FORCE_START = 0b00000001;
|
||||
/// Bit[1] Source A Direction Positive when set
|
||||
const char DTV_BLIT_SRCA_FWD = %00000010;
|
||||
const char DTV_BLIT_SRCA_FWD = 0b00000010;
|
||||
/// Bit[2] Source B Direction Positive when set
|
||||
const char DTV_BLIT_SRCB_FWD = %00000100;
|
||||
const char DTV_BLIT_SRCB_FWD = 0b00000100;
|
||||
/// Bit[3] Destination Direction Positive when set
|
||||
const char DTV_BLIT_DEST_FWD = %00001000;
|
||||
const char DTV_BLIT_DEST_FWD = 0b00001000;
|
||||
/// Bit[4] VIC IRQ Start when set
|
||||
const char DTV_BLIT_VIC_IRQ = %00010000;
|
||||
const char DTV_BLIT_VIC_IRQ = 0b00010000;
|
||||
/// Bit[5] CIA IRQ Start when set($DCXX CIA)
|
||||
const char DTV_BLIT_CIA_IRQ = %00100000;
|
||||
const char DTV_BLIT_CIA_IRQ = 0b00100000;
|
||||
/// Bit[6] V Blank Start when set
|
||||
const char DTV_BLIT_VBLANK = %01000000;
|
||||
const char DTV_BLIT_VBLANK = 0b01000000;
|
||||
/// Bit[7] Blitter IRQ Enable when set
|
||||
const char DTV_BLIT_IRQ_EN = %10000000;
|
||||
const char DTV_BLIT_IRQ_EN = 0b10000000;
|
||||
/// Blitter Transparency
|
||||
char* const DTV_BLITTER_TRANSPARANCY = (char*)$d33b;
|
||||
char* const DTV_BLITTER_TRANSPARANCY = (char*)0xd33b;
|
||||
/// Bit[0] Disable Channel B.
|
||||
/// (data into b port of ALU is forced to %00000000. ALU functions as normal)
|
||||
const char DTV_BLIT_DISABLE_B = %00000001;
|
||||
const char DTV_BLIT_DISABLE_B = 0b00000001;
|
||||
/// Bit[1] Write Transparent Data when set
|
||||
//(Data will be written if source a data *IS* %00000000. This can be used with channel b and ALU set to OR to write Data masked by source A.) Cycles will be saved if No writes.
|
||||
const char DTV_BLIT_WRITE_TRANSPARENT = %00000010;
|
||||
const char DTV_BLIT_WRITE_TRANSPARENT = 0b00000010;
|
||||
/// Bit[2] Write Non Transparent
|
||||
/// when set (Data will be written if SourceA fetched data is *NOT* %00000000. This may be used combined with channel b data and/or ALU) Cycles will be Saved if no write. Bit[2]==Bit[1]==0: write in any case
|
||||
const char DTV_BLIT_WRITE_NONTRANSPARENT = %00000100;
|
||||
const char DTV_BLIT_WRITE_NONTRANSPARENT = 0b00000100;
|
||||
/// No transparancy
|
||||
/// Bit[2]==Bit[1]==0: write in any case
|
||||
const char DTV_BLIT_TRANSPARANCY_NONE = %00000000;
|
||||
const char DTV_BLIT_TRANSPARANCY_NONE = 0b00000000;
|
||||
/// Controls the ALU operation
|
||||
char* DTV_BLITTER_ALU = (char*)$d33e;
|
||||
char* DTV_BLITTER_ALU = (char*)0xd33e;
|
||||
/// Bit[2:0] Source A right Shift: 000 SourceA Data, 001 LastA[0],SourceA[7:1], ..., 111 LastA[6:0],SourceA[7]
|
||||
const char DTV_BLIT_SHIFT0 = %00000000;
|
||||
const char DTV_BLIT_SHIFT1 = %00000001;
|
||||
const char DTV_BLIT_SHIFT2 = %00000010;
|
||||
const char DTV_BLIT_SHIFT3 = %00000011;
|
||||
const char DTV_BLIT_SHIFT4 = %00000100;
|
||||
const char DTV_BLIT_SHIFT5 = %00000101;
|
||||
const char DTV_BLIT_SHIFT6 = %00000110;
|
||||
const char DTV_BLIT_SHIFT7 = %00000111;
|
||||
const char DTV_BLIT_SHIFT0 = 0b00000000;
|
||||
const char DTV_BLIT_SHIFT1 = 0b00000001;
|
||||
const char DTV_BLIT_SHIFT2 = 0b00000010;
|
||||
const char DTV_BLIT_SHIFT3 = 0b00000011;
|
||||
const char DTV_BLIT_SHIFT4 = 0b00000100;
|
||||
const char DTV_BLIT_SHIFT5 = 0b00000101;
|
||||
const char DTV_BLIT_SHIFT6 = 0b00000110;
|
||||
const char DTV_BLIT_SHIFT7 = 0b00000111;
|
||||
/// Bit[5:3] Minterms/ALU
|
||||
const char DTV_BLIT_AND = %00000000;
|
||||
const char DTV_BLIT_NAND = %00001000;
|
||||
const char DTV_BLIT_NOR = %00010000;
|
||||
const char DTV_BLIT_OR = %00011000;
|
||||
const char DTV_BLIT_XOR = %00100000;
|
||||
const char DTV_BLIT_XNOR = %00101000;
|
||||
const char DTV_BLIT_ADD = %00110000;
|
||||
const char DTV_BLIT_SUB = %00111000;
|
||||
const char DTV_BLIT_AND = 0b00000000;
|
||||
const char DTV_BLIT_NAND = 0b00001000;
|
||||
const char DTV_BLIT_NOR = 0b00010000;
|
||||
const char DTV_BLIT_OR = 0b00011000;
|
||||
const char DTV_BLIT_XOR = 0b00100000;
|
||||
const char DTV_BLIT_XNOR = 0b00101000;
|
||||
const char DTV_BLIT_ADD = 0b00110000;
|
||||
const char DTV_BLIT_SUB = 0b00111000;
|
||||
/// Blitter Control 2
|
||||
char* const DTV_BLITTER_CONTROL2 = (char*)$d33f;
|
||||
char* const DTV_BLITTER_CONTROL2 = (char*)0xd33f;
|
||||
/// Bit[0] Clear Blitter IRQ
|
||||
const char DTV_BLIT_CLEAR_IRQ = %00000001;
|
||||
const char DTV_BLIT_CLEAR_IRQ = 0b00000001;
|
||||
/// Bit[1] Source A Continue
|
||||
const char DTV_BLIT_SRCA_CONT = %00000010;
|
||||
const char DTV_BLIT_SRCA_CONT = 0b00000010;
|
||||
/// Bit[2] Source B Continue
|
||||
const char DTV_BLIT_SRCB_CONT = %00000100;
|
||||
const char DTV_BLIT_SRCB_CONT = 0b00000100;
|
||||
/// Bit[3] Destination Continue
|
||||
const char DTV_BLIT_DEST_CONT = %00001000;
|
||||
const char DTV_BLIT_DEST_CONT = 0b00001000;
|
||||
/// Bit[0] Busy when set (When reading)
|
||||
const char DTV_BLIT_STATUS_BUSY = %00000001;
|
||||
const char DTV_BLIT_STATUS_BUSY = 0b00000001;
|
||||
/// Bit[1] IRQ when set (When reading)
|
||||
const char DTV_BLIT_STATUS_IRQ = %00000010;
|
||||
const char DTV_BLIT_STATUS_IRQ = 0b00000010;
|
||||
|
|
|
@ -37,7 +37,7 @@ struct MOS6526_CIA {
|
|||
};
|
||||
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
const char CIA_INTERRUPT_CLEAR_ALL = $7f;
|
||||
const char CIA_INTERRUPT_CLEAR_ALL = 0x7f;
|
||||
/// CIA Interrupt: Mask for clearing CIA interrupt flags.
|
||||
const char CIA_INTERRUPT_CLEAR = 0x00;
|
||||
/// CIA Interrupt: Mask for setting CIA interrupt flags.
|
||||
|
|
|
@ -216,19 +216,19 @@ char* const VICII_CONTROL1 = (char*)0xd011;
|
|||
/// @see #VICII_CONTROL1
|
||||
char* const D011 = (char*)0xd011;
|
||||
/// $D011 Control Register #1 Bit#7: RST8 9th Bit for $D012 Rasterline counter
|
||||
const char VICII_RST8 = %10000000;
|
||||
const char VICII_RST8 = 0b10000000;
|
||||
/// $D011 Control Register #1 Bit#6: ECM Turn Extended Color Mode on/off
|
||||
const char VICII_ECM = %01000000;
|
||||
const char VICII_ECM = 0b01000000;
|
||||
/// $D011 Control Register #1 Bit#5: BMM Turn Bitmap Mode on/off
|
||||
const char VICII_BMM = %00100000;
|
||||
const char VICII_BMM = 0b00100000;
|
||||
/// $D011 Control Register #1 Bit#4: DEN Switch VIC-II output on/off
|
||||
const char VICII_DEN = %00010000;
|
||||
const char VICII_DEN = 0b00010000;
|
||||
/// $D011 Control Register #1 Bit#3: RSEL Switch betweem 25 or 24 visible rows
|
||||
/// RSEL| Display window height | First line | Last line
|
||||
/// ----+--------------------------+-------------+----------
|
||||
/// 0 | 24 text lines/192 pixels | 55 ($37) | 246 ($f6)
|
||||
/// 1 | 25 text lines/200 pixels | 51 ($33) | 250 ($fa)
|
||||
const char VICII_RSEL = %00001000;
|
||||
const char VICII_RSEL = 0b00001000;
|
||||
|
||||
/// $D016 Control register 2
|
||||
/// - Bit#0-#2: XSCROLL Screen Soft Scroll Horizontal
|
||||
|
@ -245,13 +245,13 @@ char* const VICII_CONTROL2 = (char*)0xd016;
|
|||
/// @see #VICII_CONTROL2
|
||||
char* const D016 = (char*)0xd016;
|
||||
/// $D016 Control register #2 Bit#4: MCM Turn Multicolor Mode on/off
|
||||
const char VICII_MCM = %00010000;
|
||||
const char VICII_MCM = 0b00010000;
|
||||
/// $D016 Control register #2 Bit#3: CSEL Switch betweem 40 or 38 visible columns
|
||||
/// CSEL| Display window width | First X coo. | Last X coo.
|
||||
/// ----+--------------------------+--------------+------------
|
||||
/// 0 | 38 characters/304 pixels | 31 ($1f) | 334 ($14e)
|
||||
/// 1 | 40 characters/320 pixels | 24 ($18) | 343 ($157)
|
||||
const char VICII_CSEL = %00001000;
|
||||
const char VICII_CSEL = 0b00001000;
|
||||
|
||||
/// $D018 VIC-II base addresses
|
||||
/// - Bit#0: not used
|
||||
|
@ -275,20 +275,20 @@ char* const IRQ_ENABLE = (char*)0xd01a;
|
|||
/// | | the VIC for the raster compare. The test for reaching the
|
||||
/// | | interrupt raster line is done in cycle 0 of every line (for line
|
||||
/// | | 0, in cycle 1).
|
||||
const char IRQ_RASTER = %00000001;
|
||||
const char IRQ_RASTER = 0b00000001;
|
||||
/// VICII IRQ Status/Enable Background Collision
|
||||
// @see #IRQ_ENABLE #IRQ_STATUS
|
||||
/// 1 | MBC| Collision of at least one sprite with the text/bitmap graphics
|
||||
/// | | (one sprite data sequencer outputs non-transparent pixel at the
|
||||
/// | | same time at which the graphics data sequencer outputs a
|
||||
/// | | foreground pixel)
|
||||
const char IRQ_COLLISION_BG = %00000010;
|
||||
const char IRQ_COLLISION_BG = 0b00000010;
|
||||
/// VICII IRQ Status/Enable Sprite Collision
|
||||
// @see #IRQ_ENABLE #IRQ_STATUS
|
||||
/// 2 | MMC| Collision of two or more sprites (two sprite data sequencers
|
||||
/// | | output a non-transparent pixel at the same time)
|
||||
const char IRQ_COLLISION_SPRITE = %00000100;
|
||||
const char IRQ_COLLISION_SPRITE = 0b00000100;
|
||||
/// VICII IRQ Status/Enable Lightpen
|
||||
// @see #IRQ_ENABLE #IRQ_STATUS
|
||||
/// 3 | LP | Negative edge on the LP input (lightpen)const char IRQ_RASTER = %00000001;
|
||||
const char IRQ_LIGHTPEN = %00001000;
|
||||
const char IRQ_LIGHTPEN = 0b00001000;
|
||||
|
|
|
@ -16,19 +16,19 @@ const char bitmap_plot_bit[256];
|
|||
void bitmap_init(char* gfx, char* screen) {
|
||||
bitmap_gfx = gfx;
|
||||
bitmap_screen = screen;
|
||||
char bits = $80;
|
||||
char bits = 0x80;
|
||||
for(char x : 0..255) {
|
||||
bitmap_plot_bit[x] = bits;
|
||||
bits >>= 1;
|
||||
if(bits==0) {
|
||||
bits = $80;
|
||||
bits = 0x80;
|
||||
}
|
||||
}
|
||||
char* yoffs = gfx;
|
||||
for(char y : 0..255) {
|
||||
bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs);
|
||||
bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs);
|
||||
bitmap_plot_yhi[y] = BYTE1(yoffs);
|
||||
if((y&$7)==7) {
|
||||
if((y&0x7)==7) {
|
||||
yoffs = yoffs + 40*8;
|
||||
}
|
||||
}
|
||||
|
@ -46,13 +46,13 @@ void bitmap_clear(char bgcol, char fgcol) {
|
|||
// Plot a single dot in the bitmap
|
||||
void bitmap_plot(unsigned int x, char y) {
|
||||
char* plotter = (char*) MAKEWORD( bitmap_plot_yhi[y], bitmap_plot_ylo[y] );
|
||||
plotter += ( x & $fff8 );
|
||||
plotter += ( x & 0xfff8 );
|
||||
*plotter |= bitmap_plot_bit[BYTE0(x)];
|
||||
}
|
||||
|
||||
void bitmap_unplot(unsigned int x, char y) {
|
||||
char* plotter = (char*) MAKEWORD( bitmap_plot_yhi[y], bitmap_plot_ylo[y] );
|
||||
plotter += ( x & $fff8 );
|
||||
plotter += ( x & 0xfff8 );
|
||||
*plotter &= ~(bitmap_plot_bit[BYTE0(x)]);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,25 +25,25 @@ const char keyboard_char_keycodes[] = {
|
|||
/*@*/KEY_AT, /*a*/KEY_A, /*b*/KEY_B, /*c*/KEY_C, /*d*/KEY_D, /*e*/KEY_E, /*f*/KEY_F, /*g*/KEY_G,
|
||||
/*h*/KEY_H, /*i*/KEY_I, /*j*/KEY_J, /*k*/KEY_K, /*l*/KEY_L, /*m*/KEY_M, /*n*/KEY_N, /*o*/KEY_O,
|
||||
/*p*/KEY_P, /*q*/KEY_Q, /*r*/KEY_R, /*s*/KEY_S, /*t*/KEY_T, /*u*/KEY_U, /*v*/KEY_V, /*w*/KEY_W,
|
||||
/*x*/KEY_X, /*y*/KEY_Y, /*z*/KEY_Z, /*[*/$3f, /*£*/KEY_POUND, /*]*/$3f, /*^*/KEY_ARROW_UP, /*<-*/KEY_ARROW_LEFT,
|
||||
/* */KEY_SPACE, /*!*/$3f, /*"*/$3f, /*#*/$3f, /*$*/$3f, /*%*/$3f, /*&*/$3f, /*´*/$3f,
|
||||
/*(*/$3f, /*)*/$3f, /***/KEY_ASTERISK, /*+*/KEY_PLUS, /*,*/KEY_COMMA, /*-*/KEY_MINUS, /*.*/KEY_DOT, /*/*/KEY_SLASH,
|
||||
/*x*/KEY_X, /*y*/KEY_Y, /*z*/KEY_Z, /*[*/0x3f, /*£*/KEY_POUND, /*]*/0x3f, /*^*/KEY_ARROW_UP, /*<-*/KEY_ARROW_LEFT,
|
||||
/* */KEY_SPACE, /*!*/0x3f, /*"*/0x3f, /*#*/0x3f, /*$*/0x3f, /*%*/0x3f, /*&*/0x3f, /*´*/0x3f,
|
||||
/*(*/0x3f, /*)*/0x3f, /***/KEY_ASTERISK, /*+*/KEY_PLUS, /*,*/KEY_COMMA, /*-*/KEY_MINUS, /*.*/KEY_DOT, /*/*/KEY_SLASH,
|
||||
/*0*/KEY_0, /*1*/KEY_1, /*2*/KEY_2, /*3*/KEY_3, /*4*/KEY_4, /*5*/KEY_5, /*6*/KEY_6, /*7*/KEY_7,
|
||||
/*8*/KEY_8, /*9*/KEY_9, /*:*/KEY_COLON, /*;*/KEY_SEMICOLON, /*<*/$3f, /*=*/KEY_EQUALS, /*>*/$3f, /*?*/$3f
|
||||
/*8*/KEY_8, /*9*/KEY_9, /*:*/KEY_COLON, /*;*/KEY_SEMICOLON, /*<*/0x3f, /*=*/KEY_EQUALS, /*>*/0x3f, /*?*/0x3f
|
||||
};
|
||||
|
||||
// Keyboard row bitmask as expected by CIA#1 Port A when reading a specific keyboard matrix row (rows are numbered 0-7)
|
||||
char keyboard_matrix_row_bitmask[8] = { %11111110, %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111 };
|
||||
char keyboard_matrix_row_bitmask[8] = { 0b11111110, 0b11111101, 0b11111011, 0b11110111, 0b11101111, 0b11011111, 0b10111111, 0b01111111 };
|
||||
|
||||
// Keyboard matrix column bitmasks for a specific keybooard matrix column when reading the keyboard. (columns are numbered 0-7)
|
||||
char keyboard_matrix_col_bitmask[8] = { %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 };
|
||||
char keyboard_matrix_col_bitmask[8] = { 0b00000001, 0b00000010, 0b00000100, 0b00001000, 0b00010000, 0b00100000, 0b01000000, 0b10000000 };
|
||||
|
||||
// Initialize keyboard reading by setting CIA#1 Data Direction Registers
|
||||
void keyboard_init() {
|
||||
// Keyboard Matrix Columns Write Mode
|
||||
CIA1->PORT_A_DDR = $ff;
|
||||
CIA1->PORT_A_DDR = 0xff;
|
||||
// Keyboard Matrix Columns Read Mode
|
||||
CIA1->PORT_B_DDR = $00;
|
||||
CIA1->PORT_B_DDR = 0x00;
|
||||
}
|
||||
|
||||
// Check if any key is currently pressed on the keyboard matrix
|
||||
|
@ -121,7 +121,7 @@ void keyboard_event_scan() {
|
|||
char event_type = row_scan&keyboard_matrix_col_bitmask[col];
|
||||
if(event_type==0) {
|
||||
// Key released
|
||||
keyboard_events[keyboard_events_size++] = keycode|$40;
|
||||
keyboard_events[keyboard_events_size++] = keycode|0x40;
|
||||
} else {
|
||||
// Key pressed
|
||||
keyboard_events[keyboard_events_size++] = keycode;
|
||||
|
@ -165,7 +165,7 @@ char keyboard_event_pressed(char keycode) {
|
|||
// The buffer is filled by keyboard_event_scan()
|
||||
char keyboard_event_get() {
|
||||
if(keyboard_events_size==0) {
|
||||
return $ff;
|
||||
return 0xff;
|
||||
} else {
|
||||
return keyboard_events[--keyboard_events_size];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char* print_screen = (char*)$0400;
|
||||
char* print_screen = (char*)0x0400;
|
||||
char* print_line_cursor = print_screen;
|
||||
char* print_char_cursor = print_line_cursor;
|
||||
|
||||
|
@ -41,7 +41,7 @@ void print_str_at(char* str, char* at) {
|
|||
// Print a newline
|
||||
void print_ln() {
|
||||
do {
|
||||
print_line_cursor = print_line_cursor + $28;
|
||||
print_line_cursor = print_line_cursor + 0x28;
|
||||
} while (print_line_cursor<print_char_cursor);
|
||||
print_char_cursor = print_line_cursor;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ const char print_hextab[] = "0123456789abcdef"z;
|
|||
void print_uchar(char b) {
|
||||
// Table of hexadecimal digits
|
||||
print_char(print_hextab[b>>4]);
|
||||
print_char(print_hextab[b&$f]);
|
||||
print_char(print_hextab[b&0xf]);
|
||||
}
|
||||
|
||||
// Prints a char as HEX at a specific position on the screen
|
||||
|
@ -176,7 +176,7 @@ inline void print_uchar_pos(char b, char row, char col) {
|
|||
void print_uchar_at(char b, char* at) {
|
||||
// Table of hexadecimal digits
|
||||
print_char_at(print_hextab[b>>4], at);
|
||||
print_char_at(print_hextab[b&$f], at+1);
|
||||
print_char_at(print_hextab[b&0xf], at+1);
|
||||
}
|
||||
|
||||
// Print a single char
|
||||
|
|
|
@ -4,25 +4,25 @@
|
|||
// Get the value to store into D018 to display a specific screen and charset/bitmap
|
||||
// Optimized for ASM from (char)((((unsigned int)screen&$3fff)/$40)|(((unsigned int)charset&$3fff)/$400));
|
||||
inline char toD018(char* screen, char* gfx) {
|
||||
return BYTE1(((unsigned int)screen&$3fff)*4)|(((BYTE1((unsigned int)gfx))/4)&$f);
|
||||
return BYTE1(((unsigned int)screen&0x3fff)*4)|(((BYTE1((unsigned int)gfx))/4)&0xf);
|
||||
}
|
||||
|
||||
// Get the value to store into DD00 (CIA 2 port A) to choose a specific VIC bank
|
||||
// Optimized for ASM from %00000011 ^ (char)((unsigned int)gfx/$4000)
|
||||
inline char toDd00(char* gfx) {
|
||||
return %00000011 ^ (BYTE1((unsigned int)gfx))/$40;
|
||||
return 0b00000011 ^ (BYTE1((unsigned int)gfx))/0x40;
|
||||
}
|
||||
|
||||
// Get the sprite pointer for a sprite.
|
||||
// The sprite pointer is the index of the sprite within the graphics bank and equal to the sprite (char)(sprite_addr/64)
|
||||
// The sprite pointers are stored SCREEN+$3f8+sprite_id to set the pointer of each sprite
|
||||
inline char toSpritePtr(char* sprite) {
|
||||
return (char)(((unsigned int)sprite)/$40);
|
||||
return (char)(((unsigned int)sprite)/0x40);
|
||||
}
|
||||
|
||||
// Select a specific VIC graphics bank by setting the CIA 2 port A ($dd00) as needed
|
||||
inline void vicSelectGfxBank(char* gfx) {
|
||||
CIA2->PORT_A_DDR = %00000011;
|
||||
CIA2->PORT_A_DDR = 0b00000011;
|
||||
CIA2->PORT_A = toDd00(gfx);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The actual memory addressed will be $4000*cpuSegmentIdx
|
||||
void dtvSetCpuBankSegment1(char cpuBankIdx) {
|
||||
// Move CPU BANK 1 SEGMENT ($4000-$7fff)
|
||||
char* cpuBank = (char*)$ff;
|
||||
char* cpuBank = (char*)0xff;
|
||||
*cpuBank = cpuBankIdx;
|
||||
asm {
|
||||
// SAC $dd - A register points to 13 BANK 1 segment
|
||||
|
|
|
@ -233,8 +233,8 @@ inline unsigned char convertToScreenCode(unsigned char* v) {
|
|||
char rawmap[0x100] = kickasm {{
|
||||
.var ht = Hashtable().put(0,64, 1,0, 2,32, 3,96) // the table for converting bit 6,7 into ora value
|
||||
.for(var i=0; i<256; i++) {
|
||||
.var idx = (i & $60) / 32
|
||||
.var mask = i & $9f
|
||||
.var idx = (i & 0x60) / 32
|
||||
.var mask = i & 0x9f
|
||||
.byte mask | ht.get(idx)
|
||||
}
|
||||
}};
|
||||
|
|
|
@ -391,7 +391,7 @@ void vera_layer_set_tilebase_address(byte layer, dword tilebase_address) {
|
|||
dword vera_layer_get_tilebase_address(byte layer) {
|
||||
byte tilebase = *vera_layer_tilebase[layer];
|
||||
dword address = tilebase;
|
||||
address &= $FC;
|
||||
address &= 0xFC;
|
||||
address <<= 8;
|
||||
address <<= 1;
|
||||
return address;
|
||||
|
|
|
@ -23,7 +23,7 @@ char divr8u(char dividend, char divisor, char rem) {
|
|||
char quotient = 0;
|
||||
for( char i : 0..7) {
|
||||
rem = rem << 1;
|
||||
if( (dividend & $80) != 0 ) {
|
||||
if( (dividend & 0x80) != 0 ) {
|
||||
rem = rem | 1;
|
||||
}
|
||||
dividend = dividend << 1;
|
||||
|
@ -57,7 +57,7 @@ unsigned int divr16u(unsigned int dividend, unsigned int divisor, unsigned int r
|
|||
unsigned int quotient = 0;
|
||||
for( char i : 0..15) {
|
||||
rem = rem << 1;
|
||||
if( (BYTE1(dividend) & $80) != 0 ) {
|
||||
if( (BYTE1(dividend) & 0x80) != 0 ) {
|
||||
rem = rem | 1;
|
||||
}
|
||||
dividend = dividend << 1;
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
// mulf_sqr tables will contain f(x)=int(x*x/4) and g(x) = f(x-255).
|
||||
// <f(x) = <(( x * x )/4)
|
||||
char __align($100) mulf_sqr1_lo[512];
|
||||
char __align(0x100) mulf_sqr1_lo[512];
|
||||
// >f(x) = >(( x * x )/4)
|
||||
char __align($100) mulf_sqr1_hi[512];
|
||||
char __align(0x100) mulf_sqr1_hi[512];
|
||||
// <g(x) = <((( x - 255) * ( x - 255 ))/4)
|
||||
char __align($100) mulf_sqr2_lo[512];
|
||||
char __align(0x100) mulf_sqr2_lo[512];
|
||||
// >g(x) = >((( x - 255) * ( x - 255 ))/4)
|
||||
char __align($100) mulf_sqr2_hi[512];
|
||||
char __align(0x100) mulf_sqr2_hi[512];
|
||||
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
|
||||
void mulf_init() {
|
||||
|
@ -33,7 +33,7 @@ void mulf_init() {
|
|||
// Fill mulf_sqr2 = g(x) = f(x-255) : If x-255<0 then g(x)=f(255-x) (because x*x = -x*-x)
|
||||
// g(0) = f(255), g(1) = f(254), ..., g(254) = f(1), g(255) = f(0), g(256) = f(1), ..., g(510) = f(255), g(511) = f(256)
|
||||
char x_255 = (char)-1; //Start with g(0)=f(255)
|
||||
char dir = $ff; // Decrease or increase x_255 - initially we decrease
|
||||
char dir = 0xff; // Decrease or increase x_255 - initially we decrease
|
||||
char* sqr2_hi = mulf_sqr2_hi;
|
||||
for(char* sqr2_lo = mulf_sqr2_lo; sqr2_lo!=mulf_sqr2_lo+511; sqr2_lo++) {
|
||||
*sqr2_lo = mulf_sqr1_lo[x_255];
|
||||
|
@ -50,7 +50,7 @@ void mulf_init() {
|
|||
|
||||
// Prepare for fast multiply with an unsigned char to a unsigned int result
|
||||
void mulf8u_prepare(char a) {
|
||||
char* const memA = (char*)$fd;
|
||||
char* const memA = (char*)0xfd;
|
||||
*memA = a;
|
||||
asm {
|
||||
lda memA
|
||||
|
@ -65,8 +65,8 @@ void mulf8u_prepare(char a) {
|
|||
// Calculate fast multiply with a prepared unsigned char to a unsigned int result
|
||||
// The prepared number is set by calling mulf8u_prepare(char a)
|
||||
unsigned int mulf8u_prepared(char b) {
|
||||
char* const resL = (char*)$fe;
|
||||
char* const memB = (char*)$ff;
|
||||
char* const resL = (char*)0xfe;
|
||||
char* const memB = (char*)0xff;
|
||||
*memB = b;
|
||||
asm {
|
||||
ldx memB
|
||||
|
@ -99,7 +99,7 @@ inline void mulf8s_prepare(signed char a) {
|
|||
// Calculate fast multiply with a prepared unsigned char to a unsigned int result
|
||||
// The prepared number is set by calling mulf8s_prepare(char a)
|
||||
signed int mulf8s_prepared(signed char b) {
|
||||
signed char* const memA = (signed char*)$fd;
|
||||
signed char* const memA = (signed char*)0xfd;
|
||||
unsigned int m = mulf8u_prepared((char) b);
|
||||
if(*memA<0) {
|
||||
BYTE1(m) = BYTE1(m)-(char)b;
|
||||
|
@ -119,9 +119,9 @@ signed int mulf8s(signed char a, signed char b) {
|
|||
// Fast multiply two unsigned ints to a double unsigned int result
|
||||
// Done in assembler to utilize fast addition A+X
|
||||
unsigned long mulf16u(unsigned int a, unsigned int b) {
|
||||
unsigned int* const memA = (unsigned int*)$f8;
|
||||
unsigned int* const memB = (unsigned int*)$fa;
|
||||
unsigned long* const memR = (unsigned long*)$fc;
|
||||
unsigned int* const memA = (unsigned int*)0xf8;
|
||||
unsigned int* const memB = (unsigned int*)0xfa;
|
||||
unsigned long* const memR = (unsigned long*)0xfc;
|
||||
*memA = a;
|
||||
*memB = b;
|
||||
asm {
|
||||
|
|
|
@ -59,7 +59,7 @@ void memoryRemapBlock(unsigned char blockPage, unsigned int memoryPage) {
|
|||
// Find the page offset (the number of pages to offset the block)
|
||||
unsigned int pageOffset = memoryPage-blockPage;
|
||||
// Which block is being remapped? (0-7)
|
||||
char block = blockPage / $20;
|
||||
char block = blockPage / 0x20;
|
||||
char blockBits = 1<<block;
|
||||
memoryRemap(blockBits, pageOffset, pageOffset);
|
||||
}
|
||||
|
|
|
@ -4,24 +4,24 @@
|
|||
// Get the value to store into D018 to display a specific screen and charset/bitmap
|
||||
// Optimized for ASM from (char)((((unsigned int)screen&$3fff)/$40)|(((unsigned int)charset&$3fff)/$400));
|
||||
inline char toD018(char* screen, char* gfx) {
|
||||
return BYTE1(((unsigned int)screen&$3fff)*4)|(((BYTE1((unsigned int)gfx))/4)&$f);
|
||||
return BYTE1(((unsigned int)screen&0x3fff)*4)|(((BYTE1((unsigned int)gfx))/4)&0xf);
|
||||
}
|
||||
|
||||
// Get the value to store into DD00 (CIA 2 port A) to choose a specific VIC bank
|
||||
// Optimized for ASM from %00000011 ^ (char)((unsigned int)gfx/$4000)
|
||||
inline char toDd00(char* gfx) {
|
||||
return %00000011 ^ BYTE1((unsigned int)gfx)/$40;
|
||||
return 0b00000011 ^ BYTE1((unsigned int)gfx)/0x40;
|
||||
}
|
||||
|
||||
// Get the sprite pointer for a sprite.
|
||||
// The sprite pointer is the index of the sprite within the graphics bank and equal to the sprite (char)(sprite_addr/64)
|
||||
// The sprite pointers are stored SCREEN+$3f8+sprite_id to set the pointer of each sprite
|
||||
inline char toSpritePtr(char* sprite) {
|
||||
return (char)(((unsigned int)sprite)/$40);
|
||||
return (char)(((unsigned int)sprite)/0x40);
|
||||
}
|
||||
|
||||
// Select a specific VIC graphics bank by setting the CIA 2 port A ($dd00) as needed
|
||||
inline void vicSelectGfxBank(char* gfx) {
|
||||
CIA2->PORT_A_DDR = %00000011;
|
||||
CIA2->PORT_A_DDR = 0b00000011;
|
||||
CIA2->PORT_A = toDd00(gfx);
|
||||
}
|
|
@ -9,18 +9,18 @@
|
|||
#include <multiply.h>
|
||||
|
||||
// PI*2 in u[4.28] format
|
||||
const unsigned long PI2_u4f28 = $6487ed51;
|
||||
const unsigned long PI2_u4f28 = 0x6487ed51;
|
||||
// PI in u[4.28] format
|
||||
const unsigned long PI_u4f28 = $3243f6a9;
|
||||
const unsigned long PI_u4f28 = 0x3243f6a9;
|
||||
// PI/2 in u[4.28] format
|
||||
const unsigned long PI_HALF_u4f28 = $1921FB54;
|
||||
const unsigned long PI_HALF_u4f28 = 0x1921FB54;
|
||||
|
||||
// PI*2 in u[4.12] format
|
||||
const unsigned int PI2_u4f12 = $6488;
|
||||
const unsigned int PI2_u4f12 = 0x6488;
|
||||
// PI in u[4.12] format
|
||||
const unsigned int PI_u4f12 = $3244;
|
||||
const unsigned int PI_u4f12 = 0x3244;
|
||||
// PI/2 in u[4.12] format
|
||||
const unsigned int PI_HALF_u4f12 = $1922;
|
||||
const unsigned int PI_HALF_u4f12 = 0x1922;
|
||||
|
||||
// Generate signed (large) unsigned int sine table - on the full -$7fff - $7fff range
|
||||
// sintab - the table to generate into
|
||||
|
@ -83,7 +83,7 @@ signed int sin16s(unsigned long x) {
|
|||
unsigned int x1 = WORD1(x<<3); // u[1.15]
|
||||
unsigned int x2 = mulu16_sel(x1, x1, 0); // u[2.14] x^2
|
||||
unsigned int x3 = mulu16_sel(x2, x1, 1); // u[2.14] x^3
|
||||
unsigned int x3_6 = mulu16_sel(x3, $10000/6, 1); // u[1.15] x^3/6;
|
||||
unsigned int x3_6 = mulu16_sel(x3, 0x10000/6, 1); // u[1.15] x^3/6;
|
||||
unsigned int usinx = x1 - x3_6; // u[1.15] x - x^3/6
|
||||
unsigned int x4 = mulu16_sel(x3, x1, 0); // u[3.13] x^4
|
||||
unsigned int x5 = mulu16_sel(x4, x1, 0); // u[4.12] x^5
|
||||
|
@ -113,7 +113,7 @@ signed char sin8s(unsigned int x) {
|
|||
char x1 = BYTE1(x<<3); // u[1.7]
|
||||
char x2 = mulu8_sel(x1, x1, 0); // u[2.6] x^2
|
||||
char x3 = mulu8_sel(x2, x1, 1); // u[2.6] x^3
|
||||
const char DIV_6 = $2b; // u[0.7] - $2a.aa rounded to $2b
|
||||
const char DIV_6 = 0x2b; // u[0.7] - $2a.aa rounded to $2b
|
||||
char x3_6 = mulu8_sel(x3, DIV_6, 1); // u[1.7] x^3/6;
|
||||
char usinx = x1 - x3_6; // u[1.7] x - x^3/6
|
||||
char x4 = mulu8_sel(x3, x1, 0); // u[3.5] x^4
|
||||
|
|
|
@ -38,7 +38,7 @@ void init_irq() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -45,7 +45,7 @@ void init_irq() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -54,7 +54,7 @@ void init_irq() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
__export char p = *((char*)0x400);
|
||||
__export char a = *((char*)0x401);
|
||||
__export char b = *((char*)0x402);
|
||||
__export char r;
|
||||
|
||||
void main() {
|
||||
r = calc(a, b, p);
|
||||
}
|
||||
|
||||
char calc(char a, char b, char p) {
|
||||
|
||||
char x, y;
|
||||
|
||||
if(a<b) {
|
||||
x = 12;
|
||||
y = b;
|
||||
|
||||
} else {
|
||||
x = 42+b;
|
||||
y = a;
|
||||
}
|
||||
|
||||
return x+a+p;
|
||||
|
||||
}
|
|
@ -203,7 +203,7 @@ void splash_run() {
|
|||
// Stop kernel IRQ
|
||||
SEI();
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Disable kernal & basic & IO
|
||||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_ALL;
|
||||
|
|
|
@ -78,7 +78,7 @@ void demo_init() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Acknowledge any timer IRQ
|
||||
asm { lda CIA1_INTERRUPT }
|
||||
// Acknowledge any VIC IRQ
|
||||
|
|
|
@ -122,7 +122,7 @@ void part1_run() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Acknowledge any timer IRQ
|
||||
asm { lda CIA1_INTERRUPT }
|
||||
// Acknowledge any VIC IRQ
|
||||
|
|
|
@ -295,7 +295,7 @@ void part2_run() {
|
|||
// Enable & initialize sprites
|
||||
*SPRITES_ENABLE = 0xff;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Acknowledge any timer IRQ
|
||||
asm { lda CIA1_INTERRUPT }
|
||||
// Acknowledge any VIC IRQ
|
||||
|
|
|
@ -7,7 +7,7 @@ void main() {
|
|||
*GHOST_BYTE = 0;
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to 0xfa
|
||||
VICII->CONTROL1 &= 0x7f;
|
||||
VICII->RASTER = 0xfa;
|
||||
|
|
|
@ -18,7 +18,7 @@ void main() {
|
|||
asm { sei }
|
||||
(*musicInit)();
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $fd
|
||||
VICII->CONTROL1 &=$7f;
|
||||
VICII->RASTER = $fd;
|
||||
|
|
|
@ -24,7 +24,7 @@ void main() {
|
|||
sta $d412
|
||||
}
|
||||
asm { sei }
|
||||
CIA2->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA2->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
*KERNEL_NMI = &nmi;
|
||||
CIA2->TIMER_A = 0x88; // speed
|
||||
CIA2->INTERRUPT = 0x81;
|
||||
|
|
|
@ -36,7 +36,7 @@ void main() {
|
|||
|
||||
// Set up raster interrupts C64 style
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to 0xff
|
||||
VICII->RASTER = 0xff;
|
||||
VICII->CONTROL1 &= 0x7f;
|
||||
|
|
|
@ -73,7 +73,7 @@ void main() {
|
|||
// Set up raster interrupts C64 style
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to 0x16
|
||||
VICII->RASTER = IRQ_Y;
|
||||
VICII->CONTROL1 &= 0x7f;
|
||||
|
|
|
@ -7,7 +7,7 @@ void main() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -17,7 +17,7 @@ const byte WHITE = 1;
|
|||
const byte BLACK = 0;
|
||||
|
||||
byte* const CIA1_INTERRUPT = (byte*)$dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
const byte CIA_INTERRUPT_CLEAR_ALL = $7f;
|
||||
|
||||
// Processor port data direction register
|
||||
byte* const PROCPORT_DDR = (byte*)$00;
|
||||
|
@ -36,7 +36,7 @@ void main() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -19,7 +19,7 @@ const byte WHITE = 1;
|
|||
const byte BLACK = 0;
|
||||
|
||||
byte* const CIA1_INTERRUPT = (byte*)$dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
const byte CIA_INTERRUPT_CLEAR_ALL = $7f;
|
||||
|
||||
// Processor port data direction register
|
||||
byte* const PROCPORT_DDR = (byte*)$00;
|
||||
|
@ -38,7 +38,7 @@ void main() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -17,7 +17,7 @@ const byte WHITE = 1;
|
|||
const byte BLACK = 0;
|
||||
|
||||
byte* const CIA1_INTERRUPT = (byte*)$dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
const byte CIA_INTERRUPT_CLEAR_ALL = $7f;
|
||||
|
||||
// Processor port data direction register
|
||||
byte* const PROCPORT_DDR = (byte*)$00;
|
||||
|
@ -36,7 +36,7 @@ void main() {
|
|||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -6,7 +6,7 @@ byte* const SCREEN = (byte*)$400;
|
|||
void main() {
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $60
|
||||
*VICII_CONTROL1 &=$7f;
|
||||
*RASTER = $60;
|
||||
|
|
|
@ -15,12 +15,12 @@ const byte WHITE = 1;
|
|||
const byte BLACK = 0;
|
||||
|
||||
byte* const CIA1_INTERRUPT = (byte*)$dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
const byte CIA_INTERRUPT_CLEAR_ALL = $7f;
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -11,13 +11,13 @@ byte* const BG_COLOR = (byte*)$d020;
|
|||
byte* const FGCOL = (byte*)$d021;
|
||||
|
||||
byte* const CIA1_INTERRUPT = (byte*)$dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
const byte CIA_INTERRUPT_CLEAR_ALL = $7f;
|
||||
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $0fd
|
||||
*VICII_CONTROL1 &=$7f;
|
||||
*RASTER = $fd;
|
||||
|
|
|
@ -16,12 +16,12 @@ const byte WHITE = 1;
|
|||
const byte BLACK = 0;
|
||||
|
||||
byte* const CIA1_INTERRUPT = (byte*)$dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
const byte CIA_INTERRUPT_CLEAR_ALL = $7f;
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $100
|
||||
*VICII_CONTROL1 |=$80;
|
||||
*RASTER = $00;
|
||||
|
|
|
@ -11,13 +11,13 @@ const byte IRQ_RASTER = %00000001;
|
|||
byte* const BG_COLOR = (byte*)$d020;
|
||||
|
||||
byte* const CIA1_INTERRUPT = (byte*)$dc0d;
|
||||
const byte CIA_INTERRUPT_CLEAR = $7f;
|
||||
const byte CIA_INTERRUPT_CLEAR_ALL = $7f;
|
||||
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
// Set raster line to $0fd
|
||||
*VICII_CONTROL1 &=$7f;
|
||||
*RASTER = $fd;
|
||||
|
|
|
@ -40,7 +40,7 @@ void init() {
|
|||
}
|
||||
// enable the interrupt
|
||||
asm { sei }
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL;
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
*KERNEL_IRQ = &plex_irq;
|
||||
|
|
|
@ -94,20 +94,20 @@ bitmap_init: {
|
|||
sta.z yoffs+1
|
||||
ldx #0
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
lda.z yoffs+1
|
||||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
lda #7
|
||||
cmp.z __7
|
||||
bne __b4
|
||||
|
@ -515,14 +515,14 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
sta.z __1
|
||||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
clc
|
||||
lda.z plotter
|
||||
adc.z __1
|
||||
|
|
|
@ -3584,17 +3584,17 @@ bitmap_init: {
|
|||
// [22] phi bitmap_init::y#2 = bitmap_init::y#1 [phi:bitmap_init::@4->bitmap_init::@3#1] -- register_copy
|
||||
// bitmap_init::@3
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
// [23] bitmap_init::$7 = bitmap_init::y#2 & 7 -- vbuz1=vbuxx_band_vbuc1
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
// [24] bitmap_init::$4 = byte0 bitmap_init::yoffs#2 -- vbuaa=_byte0_pbuz1
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
// [25] bitmap_init::$5 = bitmap_init::$7 | bitmap_init::$4 -- vbuaa=vbuz1_bor_vbuaa
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
// [26] bitmap_plot_ylo[bitmap_init::y#2] = bitmap_init::$5 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
|
@ -3603,7 +3603,7 @@ bitmap_init: {
|
|||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
// [28] bitmap_plot_yhi[bitmap_init::y#2] = bitmap_init::$6 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
// [29] if(bitmap_init::$7!=7) goto bitmap_init::@4 -- vbuz1_neq_vbuc1_then_la1
|
||||
lda #7
|
||||
cmp.z __7
|
||||
|
@ -4194,7 +4194,7 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
// [119] bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 -- vwuz1=vwuz2_band_vwuc1
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
|
@ -4202,7 +4202,7 @@ bitmap_plot: {
|
|||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
// [120] bitmap_plot::plotter#1 = (char *)bitmap_plot::plotter#0 + bitmap_plot::$1 -- pbuz1=pbuz1_plus_vwuz2
|
||||
clc
|
||||
lda.z plotter
|
||||
|
|
|
@ -103,20 +103,20 @@ bitmap_init: {
|
|||
sta.z yoffs+1
|
||||
ldx #0
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
lda.z yoffs+1
|
||||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
lda #7
|
||||
cmp.z __7
|
||||
bne __b4
|
||||
|
@ -496,14 +496,14 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
sta.z __1
|
||||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
clc
|
||||
lda.z plotter
|
||||
adc.z __1
|
||||
|
|
|
@ -3545,17 +3545,17 @@ bitmap_init: {
|
|||
// [23] phi bitmap_init::y#2 = bitmap_init::y#1 [phi:bitmap_init::@4->bitmap_init::@3#1] -- register_copy
|
||||
// bitmap_init::@3
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
// [24] bitmap_init::$7 = bitmap_init::y#2 & 7 -- vbuz1=vbuxx_band_vbuc1
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
// [25] bitmap_init::$4 = byte0 bitmap_init::yoffs#2 -- vbuaa=_byte0_pbuz1
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
// [26] bitmap_init::$5 = bitmap_init::$7 | bitmap_init::$4 -- vbuaa=vbuz1_bor_vbuaa
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
// [27] bitmap_plot_ylo[bitmap_init::y#2] = bitmap_init::$5 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
|
@ -3564,7 +3564,7 @@ bitmap_init: {
|
|||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
// [29] bitmap_plot_yhi[bitmap_init::y#2] = bitmap_init::$6 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
// [30] if(bitmap_init::$7!=7) goto bitmap_init::@4 -- vbuz1_neq_vbuc1_then_la1
|
||||
lda #7
|
||||
cmp.z __7
|
||||
|
@ -4115,7 +4115,7 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
// [114] bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 -- vwuz1=vwuz2_band_vwuc1
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
|
@ -4123,7 +4123,7 @@ bitmap_plot: {
|
|||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
// [115] bitmap_plot::plotter#1 = (char *)bitmap_plot::plotter#0 + bitmap_plot::$1 -- pbuz1=pbuz1_plus_vwuz2
|
||||
clc
|
||||
lda.z plotter
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
.segment Basic
|
||||
:BasicUpstart(__start)
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// $D011 Control Register #1 Bit#5: BMM Turn Bitmap Mode on/off
|
||||
.const VICII_BMM = $20
|
||||
/// $D011 Control Register #1 Bit#4: DEN Switch VIC-II output on/off
|
||||
|
@ -223,20 +223,20 @@ bitmap_init: {
|
|||
sta.z yoffs+1
|
||||
ldx #0
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
lda.z yoffs+1
|
||||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
lda #7
|
||||
cmp.z __7
|
||||
bne __b4
|
||||
|
@ -298,9 +298,9 @@ init_irq: {
|
|||
// *PROCPORT = PROCPORT_RAM_IO
|
||||
lda #PROCPORT_RAM_IO
|
||||
sta.z PROCPORT
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// *VICII_CONTROL1 |=$80
|
||||
// Set raster line to $100
|
||||
|
@ -336,14 +336,14 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
sta.z __1
|
||||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
clc
|
||||
lda.z plotter
|
||||
adc.z __1
|
||||
|
|
|
@ -146,7 +146,7 @@ init_irq: scope:[init_irq] from main::@7
|
|||
asm { sei }
|
||||
[62] *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK
|
||||
[63] *PROCPORT = PROCPORT_RAM_IO
|
||||
[64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
[64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
[65] *VICII_CONTROL1 = *VICII_CONTROL1 | $80
|
||||
[66] *RASTER = 0
|
||||
[67] *IRQ_ENABLE = IRQ_RASTER
|
||||
|
|
|
@ -333,7 +333,7 @@ init_irq: scope:[init_irq] from main::@7
|
|||
asm { sei }
|
||||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK
|
||||
*PROCPORT = PROCPORT_RAM_IO
|
||||
*((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
*((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
*VICII_CONTROL1 = *VICII_CONTROL1 | $80
|
||||
*RASTER = 0
|
||||
*IRQ_ENABLE = IRQ_RASTER
|
||||
|
@ -394,7 +394,7 @@ __constant char * const BG_COLOR = (char *)$d021
|
|||
__constant char *BITMAP = (char *)$2000
|
||||
__constant const char BLACK = 0
|
||||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *)$dc00
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant char * const D011 = (char *)$d011
|
||||
__constant char * const D018 = (char *)$d018
|
||||
__constant void (** const HARDWARE_IRQ)() = (void (**)())$fffe
|
||||
|
@ -1272,7 +1272,7 @@ init_irq: scope:[init_irq] from main::@7
|
|||
asm { sei }
|
||||
[62] *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK
|
||||
[63] *PROCPORT = PROCPORT_RAM_IO
|
||||
[64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
[64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
[65] *VICII_CONTROL1 = *VICII_CONTROL1 | $80
|
||||
[66] *RASTER = 0
|
||||
[67] *IRQ_ENABLE = IRQ_RASTER
|
||||
|
@ -1493,7 +1493,7 @@ Statement [51] bitmap_init::yoffs#1 = bitmap_init::yoffs#2 + (unsigned int)$28*8
|
|||
Removing always clobbered register reg byte a as potential for zp[1]:9 [ bitmap_init::y#2 bitmap_init::y#1 ]
|
||||
Statement [62] *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [63] *PROCPORT = PROCPORT_RAM_IO [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [65] *VICII_CONTROL1 = *VICII_CONTROL1 | $80 [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [66] *RASTER = 0 [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [67] *IRQ_ENABLE = IRQ_RASTER [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
|
@ -1533,7 +1533,7 @@ Statement [44] bitmap_init::$7 = bitmap_init::y#2 & 7 [ bitmap_init::y#2 bitmap_
|
|||
Statement [51] bitmap_init::yoffs#1 = bitmap_init::yoffs#2 + (unsigned int)$28*8 [ bitmap_init::y#2 bitmap_init::yoffs#1 ] ( main:3::bitmap_init:12 [ frame_cnt bitmap_init::y#2 bitmap_init::yoffs#1 ] { } ) always clobbers reg byte a
|
||||
Statement [62] *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [63] *PROCPORT = PROCPORT_RAM_IO [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [65] *VICII_CONTROL1 = *VICII_CONTROL1 | $80 [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [66] *RASTER = 0 [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
Statement [67] *IRQ_ENABLE = IRQ_RASTER [ ] ( main:3::init_irq:18 [ frame_cnt ] { } ) always clobbers reg byte a
|
||||
|
@ -1649,7 +1649,7 @@ ASSEMBLER BEFORE OPTIMIZATION
|
|||
:BasicUpstart(__start)
|
||||
// Global Constants & labels
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// $D011 Control Register #1 Bit#5: BMM Turn Bitmap Mode on/off
|
||||
.const VICII_BMM = $20
|
||||
/// $D011 Control Register #1 Bit#4: DEN Switch VIC-II output on/off
|
||||
|
@ -2101,9 +2101,9 @@ init_irq: {
|
|||
// [63] *PROCPORT = PROCPORT_RAM_IO -- _deref_pbuc1=vbuc2
|
||||
lda #PROCPORT_RAM_IO
|
||||
sta.z PROCPORT
|
||||
// [64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
|
||||
// [64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// [65] *VICII_CONTROL1 = *VICII_CONTROL1 | $80 -- _deref_pbuc1=_deref_pbuc1_bor_vbuc2
|
||||
// Set raster line to $100
|
||||
|
@ -2344,7 +2344,7 @@ __constant char * const BG_COLOR = (char *) 53281
|
|||
__constant char *BITMAP = (char *) 8192
|
||||
__constant const char BLACK = 0
|
||||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *) 56320
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant char * const D011 = (char *) 53265
|
||||
__constant char * const D018 = (char *) 53272
|
||||
__constant void (** const HARDWARE_IRQ)() = (void (**)()) 65534
|
||||
|
@ -2485,7 +2485,7 @@ Score: 3198
|
|||
:BasicUpstart(__start)
|
||||
// Global Constants & labels
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// $D011 Control Register #1 Bit#5: BMM Turn Bitmap Mode on/off
|
||||
.const VICII_BMM = $20
|
||||
/// $D011 Control Register #1 Bit#4: DEN Switch VIC-II output on/off
|
||||
|
@ -2790,17 +2790,17 @@ bitmap_init: {
|
|||
// [43] phi bitmap_init::y#2 = bitmap_init::y#1 [phi:bitmap_init::@4->bitmap_init::@3#1] -- register_copy
|
||||
// bitmap_init::@3
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
// [44] bitmap_init::$7 = bitmap_init::y#2 & 7 -- vbuz1=vbuxx_band_vbuc1
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
// [45] bitmap_init::$4 = byte0 bitmap_init::yoffs#2 -- vbuaa=_byte0_pbuz1
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
// [46] bitmap_init::$5 = bitmap_init::$7 | bitmap_init::$4 -- vbuaa=vbuz1_bor_vbuaa
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
// [47] bitmap_plot_ylo[bitmap_init::y#2] = bitmap_init::$5 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
|
@ -2809,7 +2809,7 @@ bitmap_init: {
|
|||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
// [49] bitmap_plot_yhi[bitmap_init::y#2] = bitmap_init::$6 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
// [50] if(bitmap_init::$7!=7) goto bitmap_init::@4 -- vbuz1_neq_vbuc1_then_la1
|
||||
lda #7
|
||||
cmp.z __7
|
||||
|
@ -2900,10 +2900,10 @@ init_irq: {
|
|||
// [63] *PROCPORT = PROCPORT_RAM_IO -- _deref_pbuc1=vbuc2
|
||||
lda #PROCPORT_RAM_IO
|
||||
sta.z PROCPORT
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// [64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
||||
// [64] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// *VICII_CONTROL1 |=$80
|
||||
// [65] *VICII_CONTROL1 = *VICII_CONTROL1 | $80 -- _deref_pbuc1=_deref_pbuc1_bor_vbuc2
|
||||
|
@ -2948,7 +2948,7 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
// [72] bitmap_plot::$1 = bitmap_plot::x#0 & $fff8 -- vwuz1=vwuz2_band_vwuc1
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
|
@ -2956,7 +2956,7 @@ bitmap_plot: {
|
|||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
// [73] bitmap_plot::plotter#1 = (char *)bitmap_plot::plotter#0 + bitmap_plot::$1 -- pbuz1=pbuz1_plus_vwuz2
|
||||
clc
|
||||
lda.z plotter
|
||||
|
|
|
@ -2,7 +2,7 @@ __constant char * const BG_COLOR = (char *) 53281
|
|||
__constant char *BITMAP = (char *) 8192
|
||||
__constant const char BLACK = 0
|
||||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *) 56320
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant char * const D011 = (char *) 53265
|
||||
__constant char * const D018 = (char *) 53272
|
||||
__constant void (** const HARDWARE_IRQ)() = (void (**)()) 65534
|
||||
|
|
|
@ -137,20 +137,20 @@ bitmap_init: {
|
|||
sta.z yoffs+1
|
||||
ldx #0
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
lda.z yoffs+1
|
||||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
lda #7
|
||||
cmp.z __7
|
||||
bne __b4
|
||||
|
@ -522,14 +522,14 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
sta.z __1
|
||||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
clc
|
||||
lda.z plotter
|
||||
adc.z __1
|
||||
|
|
|
@ -3853,17 +3853,17 @@ bitmap_init: {
|
|||
// [28] phi bitmap_init::y#2 = bitmap_init::y#1 [phi:bitmap_init::@4->bitmap_init::@3#1] -- register_copy
|
||||
// bitmap_init::@3
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
// [29] bitmap_init::$7 = bitmap_init::y#2 & 7 -- vbuz1=vbuxx_band_vbuc1
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
// [30] bitmap_init::$4 = byte0 bitmap_init::yoffs#2 -- vbuaa=_byte0_pbuz1
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
// [31] bitmap_init::$5 = bitmap_init::$7 | bitmap_init::$4 -- vbuaa=vbuz1_bor_vbuaa
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
// [32] bitmap_plot_ylo[bitmap_init::y#2] = bitmap_init::$5 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
|
@ -3872,7 +3872,7 @@ bitmap_init: {
|
|||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
// [34] bitmap_plot_yhi[bitmap_init::y#2] = bitmap_init::$6 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
// [35] if(bitmap_init::$7!=7) goto bitmap_init::@4 -- vbuz1_neq_vbuc1_then_la1
|
||||
lda #7
|
||||
cmp.z __7
|
||||
|
@ -4410,7 +4410,7 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
// [122] bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 -- vwuz1=vwuz2_band_vwuc1
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
|
@ -4418,7 +4418,7 @@ bitmap_plot: {
|
|||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
// [123] bitmap_plot::plotter#1 = (char *)bitmap_plot::plotter#0 + bitmap_plot::$1 -- pbuz1=pbuz1_plus_vwuz2
|
||||
clc
|
||||
lda.z plotter
|
||||
|
|
|
@ -298,10 +298,10 @@ print_uchar: {
|
|||
lda print_hextab,y
|
||||
// Table of hexadecimal digits
|
||||
jsr print_char
|
||||
// b&$f
|
||||
// b&0xf
|
||||
lda #$f
|
||||
axs #0
|
||||
// print_char(print_hextab[b&$f])
|
||||
// print_char(print_hextab[b&0xf])
|
||||
lda print_hextab,x
|
||||
jsr print_char
|
||||
// }
|
||||
|
@ -337,7 +337,7 @@ print_schar: {
|
|||
// Print a newline
|
||||
print_ln: {
|
||||
__b1:
|
||||
// print_line_cursor + $28
|
||||
// print_line_cursor + 0x28
|
||||
lda #$28
|
||||
clc
|
||||
adc.z print_line_cursor
|
||||
|
|
|
@ -3978,11 +3978,11 @@ print_uchar: {
|
|||
// [95] phi print_char::ch#17 = print_char::ch#7 [phi:print_uchar->print_char#1] -- register_copy
|
||||
jsr print_char
|
||||
// print_uchar::@1
|
||||
// b&$f
|
||||
// b&0xf
|
||||
// [91] print_uchar::$2 = print_uchar::b#5 & $f -- vbuxx=vbuxx_band_vbuc1
|
||||
lda #$f
|
||||
axs #0
|
||||
// print_char(print_hextab[b&$f])
|
||||
// print_char(print_hextab[b&0xf])
|
||||
// [92] print_char::ch#8 = print_hextab[print_uchar::$2] -- vbuaa=pbuc1_derefidx_vbuxx
|
||||
lda print_hextab,x
|
||||
// [93] call print_char
|
||||
|
@ -4049,7 +4049,7 @@ print_ln: {
|
|||
// [106] phi print_line_cursor#21 = print_line_cursor#41 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy
|
||||
// print_ln::@1
|
||||
__b1:
|
||||
// print_line_cursor + $28
|
||||
// print_line_cursor + 0x28
|
||||
// [107] print_line_cursor#0 = print_line_cursor#21 + $28 -- pbuz1=pbuz1_plus_vbuc1
|
||||
lda #$28
|
||||
clc
|
||||
|
|
|
@ -180,11 +180,11 @@ print_uchar_at: {
|
|||
sta.z print_char_at.at+1
|
||||
// Table of hexadecimal digits
|
||||
jsr print_char_at
|
||||
// b&$f
|
||||
// b&0xf
|
||||
lda #$f
|
||||
and.z b
|
||||
tay
|
||||
// print_char_at(print_hextab[b&$f], at+1)
|
||||
// print_char_at(print_hextab[b&0xf], at+1)
|
||||
clc
|
||||
lda.z at
|
||||
adc #1
|
||||
|
|
|
@ -1313,12 +1313,12 @@ print_uchar_at: {
|
|||
// [43] phi print_char_at::ch#2 = print_char_at::ch#0 [phi:print_uchar_at->print_char_at#1] -- register_copy
|
||||
jsr print_char_at
|
||||
// print_uchar_at::@1
|
||||
// b&$f
|
||||
// b&0xf
|
||||
// [38] print_uchar_at::$2 = print_uchar_at::b#2 & $f -- vbuyy=vbuz1_band_vbuc1
|
||||
lda #$f
|
||||
and.z b
|
||||
tay
|
||||
// print_char_at(print_hextab[b&$f], at+1)
|
||||
// print_char_at(print_hextab[b&0xf], at+1)
|
||||
// [39] print_char_at::at#1 = print_uchar_at::at#2 + 1 -- pbuz1=pbuz2_plus_1
|
||||
clc
|
||||
lda.z at
|
||||
|
|
|
@ -157,11 +157,11 @@ print_uchar_at: {
|
|||
sta.z print_char_at.at+1
|
||||
// Table of hexadecimal digits
|
||||
jsr print_char_at
|
||||
// b&$f
|
||||
// b&0xf
|
||||
lda #$f
|
||||
and.z b
|
||||
tay
|
||||
// print_char_at(print_hextab[b&$f], at+1)
|
||||
// print_char_at(print_hextab[b&0xf], at+1)
|
||||
clc
|
||||
lda.z at
|
||||
adc #1
|
||||
|
|
|
@ -1227,12 +1227,12 @@ print_uchar_at: {
|
|||
// [40] phi print_char_at::ch#2 = print_char_at::ch#0 [phi:print_uchar_at->print_char_at#1] -- register_copy
|
||||
jsr print_char_at
|
||||
// print_uchar_at::@1
|
||||
// b&$f
|
||||
// b&0xf
|
||||
// [35] print_uchar_at::$2 = print_uchar_at::b#2 & $f -- vbuyy=vbuz1_band_vbuc1
|
||||
lda #$f
|
||||
and.z b
|
||||
tay
|
||||
// print_char_at(print_hextab[b&$f], at+1)
|
||||
// print_char_at(print_hextab[b&0xf], at+1)
|
||||
// [36] print_char_at::at#1 = print_uchar_at::at#2 + 1 -- pbuz1=pbuz2_plus_1
|
||||
clc
|
||||
lda.z at
|
||||
|
|
|
@ -297,7 +297,7 @@ print_str: {
|
|||
// Print a newline
|
||||
print_ln: {
|
||||
__b1:
|
||||
// print_line_cursor + $28
|
||||
// print_line_cursor + 0x28
|
||||
lda #$28
|
||||
clc
|
||||
adc.z print_line_cursor
|
||||
|
|
|
@ -2892,7 +2892,7 @@ print_ln: {
|
|||
// [69] phi print_line_cursor#25 = print_line_cursor#49 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy
|
||||
// print_ln::@1
|
||||
__b1:
|
||||
// print_line_cursor + $28
|
||||
// print_line_cursor + 0x28
|
||||
// [70] print_line_cursor#0 = print_line_cursor#25 + $28 -- pbuz1=pbuz1_plus_vbuc1
|
||||
lda #$28
|
||||
clc
|
||||
|
|
|
@ -1917,11 +1917,11 @@ divr8u: {
|
|||
__b1:
|
||||
// rem = rem << 1
|
||||
asl.z rem
|
||||
// dividend & $80
|
||||
// dividend & 0x80
|
||||
lda #$80
|
||||
and.z dividend
|
||||
sta.z __1
|
||||
// if( (dividend & $80) != 0 )
|
||||
// if( (dividend & 0x80) != 0 )
|
||||
beq __b2
|
||||
// rem = rem | 1
|
||||
lda #1
|
||||
|
|
|
@ -16613,12 +16613,12 @@ divr8u: {
|
|||
// rem = rem << 1
|
||||
// [458] divr8u::rem#0 = divr8u::rem#5 << 1 -- vbuz1=vbuz1_rol_1
|
||||
asl.z rem
|
||||
// dividend & $80
|
||||
// dividend & 0x80
|
||||
// [459] divr8u::$1 = divr8u::dividend#3 & $80 -- vbuz1=vbuz2_band_vbuc1
|
||||
lda #$80
|
||||
and.z dividend
|
||||
sta.z __1
|
||||
// if( (dividend & $80) != 0 )
|
||||
// if( (dividend & 0x80) != 0 )
|
||||
// [460] if(divr8u::$1==0) goto divr8u::@2 -- vbuz1_eq_0_then_la1
|
||||
beq __b2
|
||||
// divr8u::@4
|
||||
|
|
|
@ -169,10 +169,10 @@ print_uchar: {
|
|||
lda print_hextab,y
|
||||
// Table of hexadecimal digits
|
||||
jsr print_char
|
||||
// b&$f
|
||||
// b&0xf
|
||||
lda #$f
|
||||
axs #0
|
||||
// print_char(print_hextab[b&$f])
|
||||
// print_char(print_hextab[b&0xf])
|
||||
lda print_hextab,x
|
||||
jsr print_char
|
||||
// }
|
||||
|
@ -223,7 +223,7 @@ euclid: {
|
|||
// Print a newline
|
||||
print_ln: {
|
||||
__b1:
|
||||
// print_line_cursor + $28
|
||||
// print_line_cursor + 0x28
|
||||
lda #$28
|
||||
clc
|
||||
adc.z print_line_cursor
|
||||
|
|
|
@ -2155,11 +2155,11 @@ print_uchar: {
|
|||
// [50] phi print_char::ch#4 = print_char::ch#0 [phi:print_uchar->print_char#1] -- register_copy
|
||||
jsr print_char
|
||||
// print_uchar::@1
|
||||
// b&$f
|
||||
// b&0xf
|
||||
// [46] print_uchar::$2 = print_uchar::b#3 & $f -- vbuxx=vbuxx_band_vbuc1
|
||||
lda #$f
|
||||
axs #0
|
||||
// print_char(print_hextab[b&$f])
|
||||
// print_char(print_hextab[b&0xf])
|
||||
// [47] print_char::ch#1 = print_hextab[print_uchar::$2] -- vbuaa=pbuc1_derefidx_vbuxx
|
||||
lda print_hextab,x
|
||||
// [48] call print_char
|
||||
|
@ -2240,7 +2240,7 @@ print_ln: {
|
|||
// [62] phi print_line_cursor#17 = print_line_cursor#35 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy
|
||||
// print_ln::@1
|
||||
__b1:
|
||||
// print_line_cursor + $28
|
||||
// print_line_cursor + 0x28
|
||||
// [63] print_line_cursor#0 = print_line_cursor#17 + $28 -- pbuz1=pbuz1_plus_vbuc1
|
||||
lda #$28
|
||||
clc
|
||||
|
|
|
@ -350,10 +350,10 @@ print_uchar: {
|
|||
lda print_hextab,y
|
||||
// Table of hexadecimal digits
|
||||
jsr print_char
|
||||
// b&$f
|
||||
// b&0xf
|
||||
lda #$f
|
||||
axs #0
|
||||
// print_char(print_hextab[b&$f])
|
||||
// print_char(print_hextab[b&0xf])
|
||||
lda print_hextab,x
|
||||
jsr print_char
|
||||
// }
|
||||
|
@ -366,7 +366,7 @@ print_ln: {
|
|||
lda #>print_screen
|
||||
sta.z print_line_cursor+1
|
||||
__b1:
|
||||
// print_line_cursor + $28
|
||||
// print_line_cursor + 0x28
|
||||
lda #$28
|
||||
clc
|
||||
adc.z print_line_cursor
|
||||
|
|
|
@ -3271,11 +3271,11 @@ print_uchar: {
|
|||
// [107] phi print_char::ch#5 = print_char::ch#3 [phi:print_uchar->print_char#1] -- register_copy
|
||||
jsr print_char
|
||||
// print_uchar::@1
|
||||
// b&$f
|
||||
// b&0xf
|
||||
// [98] print_uchar::$2 = print_uchar::b#3 & $f -- vbuxx=vbuxx_band_vbuc1
|
||||
lda #$f
|
||||
axs #0
|
||||
// print_char(print_hextab[b&$f])
|
||||
// print_char(print_hextab[b&0xf])
|
||||
// [99] print_char::ch#4 = print_hextab[print_uchar::$2] -- vbuaa=pbuc1_derefidx_vbuxx
|
||||
lda print_hextab,x
|
||||
// [100] call print_char
|
||||
|
@ -3301,7 +3301,7 @@ print_ln: {
|
|||
// [103] phi print_line_cursor#12 = print_line_cursor#0 [phi:print_ln::@1->print_ln::@1#0] -- register_copy
|
||||
// print_ln::@1
|
||||
__b1:
|
||||
// print_line_cursor + $28
|
||||
// print_line_cursor + 0x28
|
||||
// [104] print_line_cursor#0 = print_line_cursor#12 + $28 -- pbuz1=pbuz1_plus_vbuc1
|
||||
lda #$28
|
||||
clc
|
||||
|
|
|
@ -90,20 +90,20 @@ bitmap_init: {
|
|||
sta.z yoffs+1
|
||||
ldx #0
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
lda.z yoffs+1
|
||||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
lda #7
|
||||
cmp.z __7
|
||||
bne __b4
|
||||
|
@ -538,14 +538,14 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
sta.z __1
|
||||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
clc
|
||||
lda.z plotter
|
||||
adc.z __1
|
||||
|
|
|
@ -3672,17 +3672,17 @@ bitmap_init: {
|
|||
// [20] phi bitmap_init::y#2 = bitmap_init::y#1 [phi:bitmap_init::@4->bitmap_init::@3#1] -- register_copy
|
||||
// bitmap_init::@3
|
||||
__b3:
|
||||
// y&$7
|
||||
// y&0x7
|
||||
// [21] bitmap_init::$7 = bitmap_init::y#2 & 7 -- vbuz1=vbuxx_band_vbuc1
|
||||
lda #7
|
||||
sax.z __7
|
||||
// BYTE0(yoffs)
|
||||
// [22] bitmap_init::$4 = byte0 bitmap_init::yoffs#2 -- vbuaa=_byte0_pbuz1
|
||||
lda.z yoffs
|
||||
// y&$7 | BYTE0(yoffs)
|
||||
// y&0x7 | BYTE0(yoffs)
|
||||
// [23] bitmap_init::$5 = bitmap_init::$7 | bitmap_init::$4 -- vbuaa=vbuz1_bor_vbuaa
|
||||
ora.z __7
|
||||
// bitmap_plot_ylo[y] = y&$7 | BYTE0(yoffs)
|
||||
// bitmap_plot_ylo[y] = y&0x7 | BYTE0(yoffs)
|
||||
// [24] bitmap_plot_ylo[bitmap_init::y#2] = bitmap_init::$5 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_ylo,x
|
||||
// BYTE1(yoffs)
|
||||
|
@ -3691,7 +3691,7 @@ bitmap_init: {
|
|||
// bitmap_plot_yhi[y] = BYTE1(yoffs)
|
||||
// [26] bitmap_plot_yhi[bitmap_init::y#2] = bitmap_init::$6 -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta bitmap_plot_yhi,x
|
||||
// if((y&$7)==7)
|
||||
// if((y&0x7)==7)
|
||||
// [27] if(bitmap_init::$7!=7) goto bitmap_init::@4 -- vbuz1_neq_vbuc1_then_la1
|
||||
lda #7
|
||||
cmp.z __7
|
||||
|
@ -4321,7 +4321,7 @@ bitmap_plot: {
|
|||
sta.z plotter+1
|
||||
lda bitmap_plot_ylo,x
|
||||
sta.z plotter
|
||||
// x & $fff8
|
||||
// x & 0xfff8
|
||||
// [130] bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 -- vwuz1=vwuz2_band_vwuc1
|
||||
lda.z x
|
||||
and #<$fff8
|
||||
|
@ -4329,7 +4329,7 @@ bitmap_plot: {
|
|||
lda.z x+1
|
||||
and #>$fff8
|
||||
sta.z __1+1
|
||||
// plotter += ( x & $fff8 )
|
||||
// plotter += ( x & 0xfff8 )
|
||||
// [131] bitmap_plot::plotter#1 = (char *)bitmap_plot::plotter#0 + bitmap_plot::$1 -- pbuz1=pbuz1_plus_vwuz2
|
||||
clc
|
||||
lda.z plotter
|
||||
|
|
|
@ -258,11 +258,11 @@ print_uchar_at: {
|
|||
ldx print_hextab,y
|
||||
// Table of hexadecimal digits
|
||||
jsr print_char_at
|
||||
// b&$f
|
||||
// b&0xf
|
||||
lda #$f
|
||||
and.z b
|
||||
tay
|
||||
// print_char_at(print_hextab[b&$f], at+1)
|
||||
// print_char_at(print_hextab[b&0xf], at+1)
|
||||
inc.z print_char_at.at
|
||||
bne !+
|
||||
inc.z print_char_at.at+1
|
||||
|
|
|
@ -2444,12 +2444,12 @@ print_uchar_at: {
|
|||
// [65] phi print_char_at::ch#4 = print_char_at::ch#2 [phi:print_uchar_at->print_char_at#1] -- register_copy
|
||||
jsr print_char_at
|
||||
// print_uchar_at::@1
|
||||
// b&$f
|
||||
// b&0xf
|
||||
// [72] print_uchar_at::$2 = print_uchar_at::b#0 & $f -- vbuyy=vbuz1_band_vbuc1
|
||||
lda #$f
|
||||
and.z b
|
||||
tay
|
||||
// print_char_at(print_hextab[b&$f], at+1)
|
||||
// print_char_at(print_hextab[b&0xf], at+1)
|
||||
// [73] print_char_at::at#3 = print_uchar_at::at#0 + 1 -- pbuz1=pbuz1_plus_1
|
||||
inc.z print_char_at.at
|
||||
bne !+
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
.segment Basic
|
||||
:BasicUpstart(main)
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// $D011 Control Register #1 Bit#3: RSEL Switch betweem 25 or 24 visible rows
|
||||
/// RSEL| Display window height | First line | Last line
|
||||
/// ----+--------------------------+-------------+----------
|
||||
|
@ -123,9 +123,9 @@ main: {
|
|||
sta GHOST_BYTE
|
||||
// asm
|
||||
sei
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// VICII->CONTROL1 &= 0x7f
|
||||
// Set raster line to 0xfa
|
||||
|
|
|
@ -29,7 +29,7 @@ void main()
|
|||
main: scope:[main] from
|
||||
[14] *GHOST_BYTE = 0
|
||||
asm { sei }
|
||||
[16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
[16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
[17] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f
|
||||
[18] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) = $fa
|
||||
[19] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) = IRQ_RASTER
|
||||
|
|
|
@ -8,7 +8,7 @@ void main()
|
|||
main: scope:[main] from __start
|
||||
*GHOST_BYTE = 0
|
||||
asm { sei }
|
||||
*((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
*((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f
|
||||
*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) = $fa
|
||||
*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) = IRQ_RASTER
|
||||
|
@ -61,7 +61,7 @@ __start::@return: scope:[__start] from __start::@1
|
|||
|
||||
SYMBOL TABLE SSA
|
||||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *)$dc00
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant char * const GHOST_BYTE = (char *)$3fff
|
||||
__constant void (** const HARDWARE_IRQ)() = (void (**)())$fffe
|
||||
__constant const char IRQ_RASTER = 1
|
||||
|
@ -164,7 +164,7 @@ void main()
|
|||
main: scope:[main] from
|
||||
[14] *GHOST_BYTE = 0
|
||||
asm { sei }
|
||||
[16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
[16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
[17] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f
|
||||
[18] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) = $fa
|
||||
[19] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) = IRQ_RASTER
|
||||
|
@ -201,7 +201,7 @@ Statement [11] *HARDWARE_IRQ = &irq_bottom_2 [ ] ( [ ] { } ) always clobbers r
|
|||
Statement [12] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = RED [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [13] return [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y
|
||||
Statement [14] *GHOST_BYTE = 0 [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [17] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [18] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) = $fa [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [19] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) = IRQ_RASTER [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
|
@ -248,7 +248,7 @@ ASSEMBLER BEFORE OPTIMIZATION
|
|||
:BasicUpstart(main)
|
||||
// Global Constants & labels
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// $D011 Control Register #1 Bit#3: RSEL Switch betweem 25 or 24 visible rows
|
||||
/// RSEL| Display window height | First line | Last line
|
||||
/// ----+--------------------------+-------------+----------
|
||||
|
@ -370,9 +370,9 @@ main: {
|
|||
sta GHOST_BYTE
|
||||
// asm { sei }
|
||||
sei
|
||||
// [16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
|
||||
// [16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// [17] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
|
||||
// Set raster line to 0xfa
|
||||
|
@ -425,7 +425,7 @@ Succesful ASM optimization Pass5RedundantLabelElimination
|
|||
|
||||
FINAL SYMBOL TABLE
|
||||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *) 56320
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant char * const GHOST_BYTE = (char *) 16383
|
||||
__constant void (** const HARDWARE_IRQ)() = (void (**)()) 65534
|
||||
__constant const char IRQ_RASTER = 1
|
||||
|
@ -471,7 +471,7 @@ Score: 422
|
|||
:BasicUpstart(main)
|
||||
// Global Constants & labels
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// $D011 Control Register #1 Bit#3: RSEL Switch betweem 25 or 24 visible rows
|
||||
/// RSEL| Display window height | First line | Last line
|
||||
/// ----+--------------------------+-------------+----------
|
||||
|
@ -605,10 +605,10 @@ main: {
|
|||
// asm
|
||||
// asm { sei }
|
||||
sei
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// [16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
||||
// [16] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// VICII->CONTROL1 &= 0x7f
|
||||
// [17] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *) 56320
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant char * const GHOST_BYTE = (char *) 16383
|
||||
__constant void (** const HARDWARE_IRQ)() = (void (**)()) 65534
|
||||
__constant const char IRQ_RASTER = 1
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
.segment Basic
|
||||
:BasicUpstart(main)
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// VICII IRQ Status/Enable Raster
|
||||
// @see #IRQ_ENABLE #IRQ_STATUS
|
||||
/// 0 | RST| Reaching a certain raster line. The line is specified by writing
|
||||
|
@ -62,9 +62,9 @@ main: {
|
|||
sei
|
||||
// (*musicInit)()
|
||||
jsr musicInit
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// VICII->CONTROL1 &=$7f
|
||||
// Set raster line to $fd
|
||||
|
|
|
@ -18,7 +18,7 @@ main: scope:[main] from
|
|||
[6] callexecute *musicInit
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
[7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
[7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
[8] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f
|
||||
[9] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) = $fd
|
||||
[10] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) = IRQ_RASTER
|
||||
|
|
|
@ -12,7 +12,7 @@ main: scope:[main] from __start::@1
|
|||
callexecute *musicInit
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
*((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
*((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f
|
||||
*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) = $fd
|
||||
*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) = IRQ_RASTER
|
||||
|
@ -52,7 +52,7 @@ __start::@return: scope:[__start] from __start::@2
|
|||
|
||||
SYMBOL TABLE SSA
|
||||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *)$dc00
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant const char IRQ_RASTER = 1
|
||||
__constant void (** const KERNEL_IRQ)() = (void (**)())$314
|
||||
__constant char MUSIC[] = kickasm {{ .const music = LoadSid("toiletrensdyr.sid")
|
||||
|
@ -125,7 +125,7 @@ main: scope:[main] from
|
|||
[6] callexecute *musicInit
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
[7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
[7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
[8] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f
|
||||
[9] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) = $fd
|
||||
[10] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) = IRQ_RASTER
|
||||
|
@ -147,7 +147,7 @@ REGISTER UPLIFT POTENTIAL REGISTERS
|
|||
Statement [1] callexecute *musicPlay [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y
|
||||
Statement [2] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS) = IRQ_RASTER [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [6] callexecute *musicInit [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y
|
||||
Statement [7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [8] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [9] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) = $fd [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [10] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) = IRQ_RASTER [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
|
@ -188,7 +188,7 @@ ASSEMBLER BEFORE OPTIMIZATION
|
|||
:BasicUpstart(main)
|
||||
// Global Constants & labels
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// VICII IRQ Status/Enable Raster
|
||||
// @see #IRQ_ENABLE #IRQ_STATUS
|
||||
/// 0 | RST| Reaching a certain raster line. The line is specified by writing
|
||||
|
@ -249,9 +249,9 @@ main: {
|
|||
jmp __b1
|
||||
// main::@1
|
||||
__b1:
|
||||
// [7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
|
||||
// [7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// [8] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
|
||||
// Set raster line to $fd
|
||||
|
@ -302,7 +302,7 @@ Succesful ASM optimization Pass5UnusedLabelElimination
|
|||
|
||||
FINAL SYMBOL TABLE
|
||||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *) 56320
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant const char IRQ_RASTER = 1
|
||||
__constant void (** const KERNEL_IRQ)() = (void (**)()) 788
|
||||
__constant char MUSIC[] = kickasm {{ .const music = LoadSid("toiletrensdyr.sid")
|
||||
|
@ -344,7 +344,7 @@ Score: 110
|
|||
:BasicUpstart(main)
|
||||
// Global Constants & labels
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
/// VICII IRQ Status/Enable Raster
|
||||
// @see #IRQ_ENABLE #IRQ_STATUS
|
||||
/// 0 | RST| Reaching a certain raster line. The line is specified by writing
|
||||
|
@ -406,10 +406,10 @@ main: {
|
|||
// [6] callexecute *musicInit -- call__deref_pprc1
|
||||
jsr musicInit
|
||||
// main::@1
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// [7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
|
||||
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
||||
// [7] *((char *)CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// VICII->CONTROL1 &=$7f
|
||||
// [8] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
__constant struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *) 56320
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant const char IRQ_RASTER = 1
|
||||
__constant void (** const KERNEL_IRQ)() = (void (**)()) 788
|
||||
__constant char MUSIC[] = kickasm {{ .const music = LoadSid("toiletrensdyr.sid")
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
.segment Basic
|
||||
:BasicUpstart(__start)
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
.const SAMPLE_SIZE = $6100
|
||||
.const OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
||||
.const OFFSET_STRUCT_MOS6526_CIA_TIMER_A = 4
|
||||
|
@ -124,8 +124,8 @@ main: {
|
|||
sta $d40b
|
||||
sta $d412
|
||||
sei
|
||||
// CIA2->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
// CIA2->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// *KERNEL_NMI = &nmi
|
||||
lda #<nmi
|
||||
|
|
|
@ -52,7 +52,7 @@ void main()
|
|||
main: scope:[main] from __start::@1
|
||||
asm { lda#$ff sta$d406 sta$d40d sta$d414 lda#$49 sta$d404 sta$d40b sta$d412 }
|
||||
asm { sei }
|
||||
[25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
[25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
[26] *KERNEL_NMI = &nmi
|
||||
[27] *((unsigned int *)CIA2+OFFSET_STRUCT_MOS6526_CIA_TIMER_A) = $88
|
||||
[28] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = $81
|
||||
|
|
|
@ -9,7 +9,7 @@ void main()
|
|||
main: scope:[main] from __start::@1
|
||||
asm { lda#$ff sta$d406 sta$d40d sta$d414 lda#$49 sta$d404 sta$d40b sta$d412 }
|
||||
asm { sei }
|
||||
*((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
*((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
*KERNEL_NMI = &nmi
|
||||
*((unsigned int *)CIA2+OFFSET_STRUCT_MOS6526_CIA_TIMER_A) = $88
|
||||
*((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = $81
|
||||
|
@ -74,7 +74,7 @@ __start::@return: scope:[__start] from __start::@2
|
|||
SYMBOL TABLE SSA
|
||||
__constant struct MOS6526_CIA * const CIA2 = (struct MOS6526_CIA *)$dd00
|
||||
__constant char * const CIA2_INTERRUPT = (char *)$dd0d
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant void (** const KERNEL_NMI)() = (void (**)())$318
|
||||
__constant char OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
||||
__constant char OFFSET_STRUCT_MOS6526_CIA_TIMER_A = 4
|
||||
|
@ -199,7 +199,7 @@ void main()
|
|||
main: scope:[main] from __start::@1
|
||||
asm { lda#$ff sta$d406 sta$d40d sta$d414 lda#$49 sta$d404 sta$d40b sta$d412 }
|
||||
asm { sei }
|
||||
[25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR
|
||||
[25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL
|
||||
[26] *KERNEL_NMI = &nmi
|
||||
[27] *((unsigned int *)CIA2+OFFSET_STRUCT_MOS6526_CIA_TIMER_A) = $88
|
||||
[28] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = $81
|
||||
|
@ -247,7 +247,7 @@ Statement [18] nmi::$1 = *sample & $f [ nmi::$1 ] ( [ nmi::$1 ] { } ) always c
|
|||
Statement [20] *KERNEL_NMI = &nmi2 [ ] ( [ ] { } ) always clobbers reg byte a
|
||||
Statement [22] return [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y
|
||||
Statement asm { lda#$ff sta$d406 sta$d40d sta$d414 lda#$49 sta$d404 sta$d40b sta$d412 } always clobbers reg byte a
|
||||
Statement [25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR [ ] ( main:3 [ ] { } ) always clobbers reg byte a
|
||||
Statement [25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL [ ] ( main:3 [ ] { } ) always clobbers reg byte a
|
||||
Statement [26] *KERNEL_NMI = &nmi [ ] ( main:3 [ ] { } ) always clobbers reg byte a
|
||||
Statement [27] *((unsigned int *)CIA2+OFFSET_STRUCT_MOS6526_CIA_TIMER_A) = $88 [ ] ( main:3 [ ] { } ) always clobbers reg byte a
|
||||
Statement [28] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = $81 [ ] ( main:3 [ ] { } ) always clobbers reg byte a
|
||||
|
@ -295,7 +295,7 @@ ASSEMBLER BEFORE OPTIMIZATION
|
|||
:BasicUpstart(__start)
|
||||
// Global Constants & labels
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
.const SAMPLE_SIZE = $6100
|
||||
.const OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
||||
.const OFFSET_STRUCT_MOS6526_CIA_TIMER_A = 4
|
||||
|
@ -442,8 +442,8 @@ main: {
|
|||
sta $d412
|
||||
// asm { sei }
|
||||
sei
|
||||
// [25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
// [25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// [26] *KERNEL_NMI = &nmi -- _deref_qprc1=pprc2
|
||||
lda #<nmi
|
||||
|
@ -499,7 +499,7 @@ Succesful ASM optimization Pass5UnusedLabelElimination
|
|||
FINAL SYMBOL TABLE
|
||||
__constant struct MOS6526_CIA * const CIA2 = (struct MOS6526_CIA *) 56576
|
||||
__constant char * const CIA2_INTERRUPT = (char *) 56589
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant void (** const KERNEL_NMI)() = (void (**)()) 792
|
||||
__constant char OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
||||
__constant char OFFSET_STRUCT_MOS6526_CIA_TIMER_A = 4
|
||||
|
@ -543,7 +543,7 @@ Score: 579
|
|||
:BasicUpstart(__start)
|
||||
// Global Constants & labels
|
||||
/// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
.const CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
.const SAMPLE_SIZE = $6100
|
||||
.const OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
||||
.const OFFSET_STRUCT_MOS6526_CIA_TIMER_A = 4
|
||||
|
@ -696,9 +696,9 @@ main: {
|
|||
sta $d412
|
||||
// asm { sei }
|
||||
sei
|
||||
// CIA2->INTERRUPT = CIA_INTERRUPT_CLEAR
|
||||
// [25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR -- _deref_pbuc1=vbuc2
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
// CIA2->INTERRUPT = CIA_INTERRUPT_CLEAR_ALL
|
||||
// [25] *((char *)CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) = CIA_INTERRUPT_CLEAR_ALL -- _deref_pbuc1=vbuc2
|
||||
lda #CIA_INTERRUPT_CLEAR_ALL
|
||||
sta CIA2+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
|
||||
// *KERNEL_NMI = &nmi
|
||||
// [26] *KERNEL_NMI = &nmi -- _deref_qprc1=pprc2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
__constant struct MOS6526_CIA * const CIA2 = (struct MOS6526_CIA *) 56576
|
||||
__constant char * const CIA2_INTERRUPT = (char *) 56589
|
||||
__constant const char CIA_INTERRUPT_CLEAR = $7f
|
||||
__constant const char CIA_INTERRUPT_CLEAR_ALL = $7f
|
||||
__constant void (** const KERNEL_NMI)() = (void (**)()) 792
|
||||
__constant char OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
|
||||
__constant char OFFSET_STRUCT_MOS6526_CIA_TIMER_A = 4
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue