1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-11 04:29:53 +00:00

Changed interrupt clobber handling to use (new!) ASM tags instead of replacing the fragment. #599

This commit is contained in:
jespergravgaard 2020-12-21 15:05:10 +01:00
parent 0bdaa77876
commit ea97e20319
72 changed files with 7822 additions and 7939 deletions

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 15355792e7 153557b11b
//KICKC FRAGMENT CACHE 15355793f5 153557b229
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 15355792e7 153557b11b
//KICKC FRAGMENT CACHE 15355793f5 153557b229
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 15355792e7 153557b11b
//KICKC FRAGMENT CACHE 15355793f5 153557b229
//FRAGMENT vwuz1=vwuc1
lda #<{c1}
sta {z1}
@ -268,6 +268,63 @@ sta {z1}
lda {z1}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT vbuz1=vbuz2_plus_1
lda {z2}
inc
sta {z1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT vbuz1=vbuaa_plus_1
inc
sta {z1}
//FRAGMENT vbuz1=vbuxx_plus_1
inx
stx {z1}
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuz1=vbuyy_plus_1
iny
sty {z1}
//FRAGMENT vbuaa=vbuz1_plus_1
lda {z1}
inc
//FRAGMENT vbuaa=vbuaa_plus_1
inc
//FRAGMENT vbuaa=vbuxx_plus_1
txa
inc
//FRAGMENT vbuaa=vbuyy_plus_1
tya
inc
//FRAGMENT vbuxx=vbuz1_plus_1
ldx {z1}
inx
//FRAGMENT vbuxx=vbuaa_plus_1
tax
inx
//FRAGMENT vbuxx=vbuxx_plus_1
inx
//FRAGMENT vbuxx=vbuyy_plus_1
tya
inc
tax
//FRAGMENT vbuyy=vbuz1_plus_1
ldy {z1}
iny
//FRAGMENT vbuyy=vbuaa_plus_1
tay
iny
//FRAGMENT vbuyy=vbuxx_plus_1
txa
inc
tay
//FRAGMENT vbuyy=vbuyy_plus_1
iny
//FRAGMENT 0_neq_pbuc1_derefidx_vbuz1_then_la1
ldy {z1}
lda {c1},y
@ -474,60 +531,3 @@ inc
//FRAGMENT vbuyy_neq_vbuc1_then_la1
cpy #{c1}
bne {la1}
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT vbuz1=vbuz2_plus_1
lda {z2}
inc
sta {z1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT vbuz1=vbuaa_plus_1
inc
sta {z1}
//FRAGMENT vbuz1=vbuxx_plus_1
inx
stx {z1}
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuz1=vbuyy_plus_1
iny
sty {z1}
//FRAGMENT vbuaa=vbuz1_plus_1
lda {z1}
inc
//FRAGMENT vbuaa=vbuaa_plus_1
inc
//FRAGMENT vbuaa=vbuxx_plus_1
txa
inc
//FRAGMENT vbuaa=vbuyy_plus_1
tya
inc
//FRAGMENT vbuxx=vbuz1_plus_1
ldx {z1}
inx
//FRAGMENT vbuxx=vbuaa_plus_1
tax
inx
//FRAGMENT vbuxx=vbuxx_plus_1
inx
//FRAGMENT vbuxx=vbuyy_plus_1
tya
inc
tax
//FRAGMENT vbuyy=vbuz1_plus_1
ldy {z1}
iny
//FRAGMENT vbuyy=vbuaa_plus_1
tay
iny
//FRAGMENT vbuyy=vbuxx_plus_1
txa
inc
tay
//FRAGMENT vbuyy=vbuyy_plus_1
iny

View File

@ -1,4 +1,4 @@
pha
phx
phy
phz
pha @clob_a
phx @clob_x
phy @clob_y
phz @clob_z

View File

@ -1,5 +1,5 @@
plz
ply
plx
pla
plz @clob_z
ply @clob_y
plx @clob_x
pla @clob_a
rti

View File

@ -1,5 +1,5 @@
pha
txa
pha
tya
pha
pha @clob_none
txa @clob_x
pha @clob_x
tya @clob_y
pha @clob_y

View File

@ -1,6 +1,6 @@
pla
tay
pla
tax
pla
pla @clob_y
tay @clob_y
pla @clob_x
tax @clob_x
pla @clob_none
rti

View File

@ -1,3 +1,3 @@
sta rega+1
stx regx+1
sty regy+1
sta rega+1 @clob_a
stx regx+1 @clob_x
sty regy+1 @clob_y

View File

@ -1,4 +1,4 @@
rega: lda #0
regx: ldx #0
regy: ldy #0
rega: @clob_a lda #0 @clob_a
regx: @clob_x ldx #0 @clob_x
regy: @clob_y ldy #0 @clob_y
rti

View File

@ -1,3 +1,3 @@
pha
phx
phy
pha @clob_a
phx @clob_x
phy @clob_y

View File

@ -1,4 +1,4 @@
ply
plx
pla
ply @clob_y
plx @clob_x
pla @clob_a
rti

View File

@ -1,10 +1,9 @@
package dk.camelot64.kickc.asm;
/** Set the program counter */
public class AsmBasicUpstart implements AsmLine {
public class AsmBasicUpstart extends AsmLine {
private String label;
private int index;
public AsmBasicUpstart(String label) {
this.label = label;
@ -33,13 +32,4 @@ public class AsmBasicUpstart implements AsmLine {
return ":BasicUpstart(" + label + ")";
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -1,12 +1,10 @@
package dk.camelot64.kickc.asm;
/** An assembler comment */
public class AsmComment implements AsmLine {
public class AsmComment extends AsmLine {
private String comment;
private int index;
private boolean isBlock;
public AsmComment(String comment, boolean isBlock) {
@ -38,16 +36,6 @@ public class AsmComment implements AsmLine {
}
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
@Override
public String toString() {
return getAsm();
@ -62,5 +50,4 @@ public class AsmComment implements AsmLine {
return comment.chars().filter(x -> x == '\n').count() + 1;
}
}

View File

@ -1,10 +1,9 @@
package dk.camelot64.kickc.asm;
/** ASM constant declaration */
public class AsmConstant implements AsmLine {
public class AsmConstant extends AsmLine {
private final String name;
private final String value;
private int index;
public AsmConstant(String name, String value) {
@ -27,13 +26,4 @@ public class AsmConstant implements AsmLine {
return ".const " + name + " = " + value;
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -1,10 +1,9 @@
package dk.camelot64.kickc.asm;
/** Data alignment directive. */
public class AsmDataAlignment implements AsmLine {
public class AsmDataAlignment extends AsmLine {
private String alignment;
private int index;
public AsmDataAlignment(String alignment) {
this.alignment = alignment;
@ -28,14 +27,4 @@ public class AsmDataAlignment implements AsmLine {
return asm.toString();
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -1,7 +1,7 @@
package dk.camelot64.kickc.asm;
/** A labelled data array initialized by kickasm code. */
public class AsmDataKickAsm implements AsmLine {
public class AsmDataKickAsm extends AsmLine {
private String label;
@ -9,8 +9,6 @@ public class AsmDataKickAsm implements AsmLine {
private String kickAsmCode;
private int index;
public AsmDataKickAsm(String label, int bytes, String kickAsmCode) {
this.label = label;
this.bytes = bytes;
@ -25,7 +23,6 @@ public class AsmDataKickAsm implements AsmLine {
this.kickAsmCode = kickAsmCode;
}
@Override
public int getLineBytes() {
return bytes;
@ -53,14 +50,4 @@ public class AsmDataKickAsm implements AsmLine {
return kickAsmCode.chars().filter(x -> x == '\n').count() + 2;
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -5,7 +5,7 @@ import java.util.List;
/**
* A numeric data directive with an optional label.
*/
public class AsmDataNumeric implements AsmLine {
public class AsmDataNumeric extends AsmLine {
/** Label - may be null. */
private String label;
@ -14,8 +14,6 @@ public class AsmDataNumeric implements AsmLine {
/** The data elements. */
private List<String> values;
private int index;
public AsmDataNumeric(String label, Type type, List<String> values) {
this.label = label;
this.type = type;
@ -53,16 +51,6 @@ public class AsmDataNumeric implements AsmLine {
return asm.toString();
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
public enum Type {
BYTE("byte", 1),
WORD("word", 2),

View File

@ -1,11 +1,10 @@
package dk.camelot64.kickc.asm;
/** A labelled string data directive. */
public class AsmDataString implements AsmLine {
public class AsmDataString extends AsmLine {
private String label;
private String value;
private int index;
public AsmDataString(String label, String value) {
this.label = label;
@ -32,14 +31,4 @@ public class AsmDataString implements AsmLine {
return asm.toString();
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -1,7 +1,7 @@
package dk.camelot64.kickc.asm;
/** A labelled zero-filled data directive. */
public class AsmDataZeroFill implements AsmLine {
public class AsmDataZeroFill extends AsmLine {
private String label;
/** The calculation of the total number of bytes in ASM-format */
@ -11,8 +11,6 @@ public class AsmDataZeroFill implements AsmLine {
/** The number of elements*/
private int numElements;
private int index;
public AsmDataZeroFill(String label, AsmDataNumeric.Type type, String totalByteSizeAsm, int numElements) {
this.label = label;
this.type = type;
@ -46,14 +44,4 @@ public class AsmDataZeroFill implements AsmLine {
return asm.toString();
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -1,14 +1,14 @@
package dk.camelot64.kickc.asm;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** Define a KickAss output file */
public class AsmFile implements AsmLine {
public class AsmFile extends AsmLine {
private final String name;
private final Map<String,String> parameters;
private int index;
public AsmFile(String name, Map<String, String> parameters) {
this.name = name;
@ -48,13 +48,4 @@ public class AsmFile implements AsmLine {
return asm.toString();
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -4,12 +4,10 @@ package dk.camelot64.kickc.asm;
* Inlined KickAssembler code.
* If no cycles/byte size is specified it defaults to 256/256.
*/
public class AsmInlineKickAsm implements AsmLine {
public class AsmInlineKickAsm extends AsmLine {
private String kickAsmCode;
private int index;
private int bytes;
private double cycles;
@ -68,16 +66,6 @@ public class AsmInlineKickAsm implements AsmLine {
return kickAsmCode;
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
@Override
public String toString() {
return getAsm();

View File

@ -4,8 +4,11 @@ import dk.camelot64.cpufamily6502.CpuAddressingMode;
import dk.camelot64.cpufamily6502.CpuOpcode;
import dk.camelot64.kickc.model.InternalError;
import java.util.ArrayList;
import java.util.List;
/** A specific assembler instruction line (opcode, addressing mode and specific parameter value) */
public class AsmInstruction implements AsmLine {
public class AsmInstruction extends AsmLine {
/** The instruction opcode. */
private CpuOpcode cpuOpcode;
@ -16,24 +19,9 @@ public class AsmInstruction implements AsmLine {
/** The second ASM opcode parameter. Null if not used. Only used for addressing mode Zeropage Test Relative {@link CpuAddressingMode#REZ} - eg. BBR0 $12,label */
private String operand2;
/** The index of the instruction in the program. */
private int index;
/** If true the instruction will not be optimized away. */
private boolean dontOptimize;
public AsmInstruction(CpuOpcode cpuOpcode) {
this.cpuOpcode = cpuOpcode;
this.operand1 = null;
this.operand2 = null;
}
public AsmInstruction(CpuOpcode cpuOpcode, String operand1) {
this.cpuOpcode = cpuOpcode;
this.operand1 = operand1;
this.operand2 = null;
}
public AsmInstruction(CpuOpcode cpuOpcode, String operand1, String operand2) {
this.cpuOpcode = cpuOpcode;
this.operand1 = operand1;
@ -84,16 +72,6 @@ public class AsmInstruction implements AsmLine {
return getAsm();
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
public boolean isDontOptimize() {
return dontOptimize;
}

View File

@ -1,12 +1,10 @@
package dk.camelot64.kickc.asm;
/** A label / jump target */
public class AsmLabel implements AsmLine {
public class AsmLabel extends AsmLine {
private String label;
private int index;
private boolean dontOptimize;
public AsmLabel(String label) {
@ -36,16 +34,6 @@ public class AsmLabel implements AsmLine {
return label + ":";
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
public boolean isDontOptimize() {
return dontOptimize;
}

View File

@ -1,10 +1,9 @@
package dk.camelot64.kickc.asm;
/** A label declaration .label lbl = val */
public class AsmLabelDecl implements AsmLine {
public class AsmLabelDecl extends AsmLine {
private final String name;
private final String value;
private int index;
public AsmLabelDecl(String name, String value) {
@ -27,13 +26,5 @@ public class AsmLabelDecl implements AsmLine {
return ".label " + name + " = " + value;
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -1,15 +1,39 @@
package dk.camelot64.kickc.asm;
/** A line of 6502 assembler code */
public interface AsmLine {
public abstract class AsmLine {
int getLineBytes();
private int index;
double getLineCycles();
private AsmTags tags;
String getAsm();
public AsmLine() {
this.tags = new AsmTags();
}
int getIndex();
public abstract int getLineBytes();
public abstract double getLineCycles();
public abstract String getAsm();
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
/**
* Get the tags of the ASM line.
* <p>
* Tags are used by the compiler for marking up ASM lines in fragments that the compiler should treat in different ways
*
* @return The tags of the ASM line
*/
public AsmTags getTags() {
return tags;
}
void setIndex(int index);
}

View File

@ -118,7 +118,7 @@ public class AsmProgram {
public AsmInstruction addInstruction(String mnemonic, CpuAddressingMode addressingMode, String operand1, boolean isOperandZp) {
CpuOpcode cpuOpcode = targetCpu.getCpu65xx().getOpcode(mnemonic, addressingMode, isOperandZp);
AsmInstruction asmInstruction = new AsmInstruction(cpuOpcode, operand1);
AsmInstruction asmInstruction = new AsmInstruction(cpuOpcode, operand1, null);
addLine(asmInstruction);
return asmInstruction;
}

View File

@ -1,12 +1,10 @@
package dk.camelot64.kickc.asm;
/** The beginning of a named scope (typically a procedure) */
public class AsmScopeBegin implements AsmLine {
public class AsmScopeBegin extends AsmLine {
private String label;
private int index;
public AsmScopeBegin(String label) {
this.label = label;
}
@ -30,16 +28,6 @@ public class AsmScopeBegin implements AsmLine {
return label + ":" + " {";
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
@Override
public String toString() {
return getAsm();

View File

@ -1,9 +1,7 @@
package dk.camelot64.kickc.asm;
/** The end of a scope */
public class AsmScopeEnd implements AsmLine {
private int index;
public class AsmScopeEnd extends AsmLine {
public AsmScopeEnd() {
}
@ -23,16 +21,6 @@ public class AsmScopeEnd implements AsmLine {
return "}";
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
@Override
public String toString() {
return getAsm();

View File

@ -1,14 +1,14 @@
package dk.camelot64.kickc.asm;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** Selects a KickAss segment (defined using AsmSegmentDef)*/
public class AsmSegment implements AsmLine {
public class AsmSegment extends AsmLine {
private final String name;
private final Map<String,String> parameters;
private int index;
public AsmSegment(String name, Map<String, String> parameters) {
this.name = name;
@ -52,13 +52,4 @@ public class AsmSegment implements AsmLine {
return asm.toString();
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -1,14 +1,14 @@
package dk.camelot64.kickc.asm;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** Define a KickAss segment */
public class AsmSegmentDef implements AsmLine {
public class AsmSegmentDef extends AsmLine {
private final String name;
private final Map<String,String> parameters;
private int index;
public AsmSegmentDef(String name, Map<String, String> parameters) {
this.name = name;
@ -49,13 +49,4 @@ public class AsmSegmentDef implements AsmLine {
return asm.toString();
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -3,10 +3,9 @@ package dk.camelot64.kickc.asm;
import dk.camelot64.kickc.model.TargetCpu;
/** Set the current CPU */
public class AsmSetCpu implements AsmLine {
public class AsmSetCpu extends AsmLine {
private final TargetCpu cpu;
private int index;
public AsmSetCpu(TargetCpu cpu) {
this.cpu = cpu;
@ -28,16 +27,6 @@ public class AsmSetCpu implements AsmLine {
return ".cpu " + cpuName;
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
public TargetCpu getCpu() {
return cpu;
}

View File

@ -3,10 +3,9 @@ package dk.camelot64.kickc.asm;
import dk.camelot64.kickc.model.values.StringEncoding;
/** Set the text encoding */
public class AsmSetEncoding implements AsmLine {
public class AsmSetEncoding extends AsmLine {
private final StringEncoding encoding;
private int index;
public AsmSetEncoding(StringEncoding encoding) {
this.encoding = encoding;
@ -27,16 +26,6 @@ public class AsmSetEncoding implements AsmLine {
return ".encoding \"" + encoding.asmEncoding+ "\"";
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
public StringEncoding getEncoding() {
return encoding;
}

View File

@ -1,11 +1,10 @@
package dk.camelot64.kickc.asm;
/** Set the program counter */
public class AsmSetPc implements AsmLine {
public class AsmSetPc extends AsmLine {
private final String name;
private final String address;
private int index;
public AsmSetPc(String name, String address) {
this.name = name;
@ -27,13 +26,4 @@ public class AsmSetPc implements AsmLine {
return ".pc = " + address + " \"" + name + "\"";
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -0,0 +1,39 @@
package dk.camelot64.kickc.asm;
import java.util.ArrayList;
import java.util.List;
/** Tags on AsmLines.
* <p>
* Tags are used by the compiler for marking up ASM lines in fragments that the compiler should treat in different ways
* <p>
* The syntax for adding tags directly in ASM files is through a comment with a special syntax such as
**/
public class AsmTags {
/** The tags. */
private List<String> tags;
AsmTags() {
this.tags = new ArrayList<>();
}
/**
* Add a tag
*
* @param The tag to add
*/
public void add(String tag) {
tags.add(tag);
}
/**
* Add a tag
*
* @param The tag to add
*/
public boolean has(String tag) {
return tags.contains(tag);
}
}

View File

@ -200,14 +200,24 @@ public class AsmFragmentInstance {
@Override
public Object visitAsmLabelName(KickCParser.AsmLabelNameContext ctx) {
asmProgram.addLine(new AsmLabel(ctx.ASM_NAME().getText()));
final AsmLabel labelLine = new AsmLabel(ctx.ASM_NAME().getText());
if(ctx.ASM_TAG()!=null) {
final String tagName = ctx.ASM_TAG().getText().substring(1);
labelLine.getTags().add(tagName);
}
asmProgram.addLine(labelLine);
return null;
}
@Override
public Object visitAsmLabelMulti(KickCParser.AsmLabelMultiContext ctx) {
String label = ctx.ASM_MULTI_NAME().getText();
asmProgram.addLine(new AsmLabel(label));
final AsmLabel labelLine = new AsmLabel(label);
if(ctx.ASM_TAG()!=null) {
final String tagName = ctx.ASM_TAG().getText().substring(1);
labelLine.getTags().add(tagName);
}
asmProgram.addLine(labelLine);
return null;
}
@ -230,6 +240,10 @@ public class AsmFragmentInstance {
} else {
instruction = (AsmInstruction) this.visit(paramModeCtx);
}
if(ctx.ASM_TAG()!=null) {
final String tagName = ctx.ASM_TAG().getText().substring(1);
instruction.getTags().add(tagName);
}
if(instruction != null) {
asmProgram.addLine(instruction);
} else {

View File

@ -212,6 +212,9 @@ ASM_NAME : ASM_NAME_START ASM_NAME_CHAR* ;
fragment ASM_NAME_START : [a-zA-Z_];
fragment ASM_NAME_CHAR : [a-zA-Z0-9_];
// Tags
ASM_TAG : '@' ASM_NAME;
// White space on hidden channel 1
ASM_WS : [ \t\r\n\u00a0]+ -> channel(1);
// Comments on hidden channel 2

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -143,14 +143,15 @@ ASM_CHAR=142
ASM_MULTI_REL=143
ASM_MULTI_NAME=144
ASM_NAME=145
ASM_WS=146
ASM_COMMENT_LINE=147
ASM_COMMENT_BLOCK=148
IMPORT_SYSTEMFILE=149
IMPORT_LOCALFILE=150
IMPORT_WS=151
IMPORT_COMMENT_LINE=152
IMPORT_COMMENT_BLOCK=153
ASM_TAG=146
ASM_WS=147
ASM_COMMENT_LINE=148
ASM_COMMENT_BLOCK=149
IMPORT_SYSTEMFILE=150
IMPORT_LOCALFILE=151
IMPORT_WS=152
IMPORT_COMMENT_LINE=153
IMPORT_COMMENT_BLOCK=154
';'=8
'..'=11
'...'=12

View File

@ -279,16 +279,16 @@ asmLine
;
asmLabel
: ASM_NAME ASM_COLON #asmLabelName
| ASM_MULTI_NAME ASM_COLON #asmLabelMulti
: ASM_NAME ASM_COLON ASM_TAG? #asmLabelName
| ASM_MULTI_NAME ASM_COLON ASM_TAG? #asmLabelMulti
;
asmInstruction
: ASM_MNEMONIC (asmParamMode)?
: ASM_MNEMONIC (asmParamMode)? ASM_TAG?
;
asmBytes
: ASM_BYTE asmExpr ( ASM_COMMA asmExpr)*
: ASM_BYTE asmExpr ( ASM_COMMA asmExpr)* ASM_TAG?
;
asmParamMode

File diff suppressed because one or more lines are too long

View File

@ -45,9 +45,9 @@ public class KickCParser extends Parser {
ASM_NUMBER=133, ASM_NUMFLOAT=134, ASM_BINFLOAT=135, ASM_DECFLOAT=136,
ASM_HEXFLOAT=137, ASM_NUMINT=138, ASM_BININTEGER=139, ASM_DECINTEGER=140,
ASM_HEXINTEGER=141, ASM_CHAR=142, ASM_MULTI_REL=143, ASM_MULTI_NAME=144,
ASM_NAME=145, ASM_WS=146, ASM_COMMENT_LINE=147, ASM_COMMENT_BLOCK=148,
IMPORT_SYSTEMFILE=149, IMPORT_LOCALFILE=150, IMPORT_WS=151, IMPORT_COMMENT_LINE=152,
IMPORT_COMMENT_BLOCK=153;
ASM_NAME=145, ASM_TAG=146, ASM_WS=147, ASM_COMMENT_LINE=148, ASM_COMMENT_BLOCK=149,
IMPORT_SYSTEMFILE=150, IMPORT_LOCALFILE=151, IMPORT_WS=152, IMPORT_COMMENT_LINE=153,
IMPORT_COMMENT_BLOCK=154;
public static final int
RULE_file = 0, RULE_asmFile = 1, RULE_declSeq = 2, RULE_decl = 3, RULE_declVariables = 4,
RULE_declVariableList = 5, RULE_typeDef = 6, RULE_declVariableInit = 7,
@ -122,9 +122,9 @@ public class KickCParser extends Parser {
"ASM_MULTIPLY", "ASM_DIVIDE", "ASM_CURLY_BEGIN", "ASM_CURLY_END", "ASM_NUMBER",
"ASM_NUMFLOAT", "ASM_BINFLOAT", "ASM_DECFLOAT", "ASM_HEXFLOAT", "ASM_NUMINT",
"ASM_BININTEGER", "ASM_DECINTEGER", "ASM_HEXINTEGER", "ASM_CHAR", "ASM_MULTI_REL",
"ASM_MULTI_NAME", "ASM_NAME", "ASM_WS", "ASM_COMMENT_LINE", "ASM_COMMENT_BLOCK",
"IMPORT_SYSTEMFILE", "IMPORT_LOCALFILE", "IMPORT_WS", "IMPORT_COMMENT_LINE",
"IMPORT_COMMENT_BLOCK"
"ASM_MULTI_NAME", "ASM_NAME", "ASM_TAG", "ASM_WS", "ASM_COMMENT_LINE",
"ASM_COMMENT_BLOCK", "IMPORT_SYSTEMFILE", "IMPORT_LOCALFILE", "IMPORT_WS",
"IMPORT_COMMENT_LINE", "IMPORT_COMMENT_BLOCK"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
@ -6119,6 +6119,7 @@ public class KickCParser extends Parser {
public static class AsmLabelNameContext extends AsmLabelContext {
public TerminalNode ASM_NAME() { return getToken(KickCParser.ASM_NAME, 0); }
public TerminalNode ASM_COLON() { return getToken(KickCParser.ASM_COLON, 0); }
public TerminalNode ASM_TAG() { return getToken(KickCParser.ASM_TAG, 0); }
public AsmLabelNameContext(AsmLabelContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
@ -6137,6 +6138,7 @@ public class KickCParser extends Parser {
public static class AsmLabelMultiContext extends AsmLabelContext {
public TerminalNode ASM_MULTI_NAME() { return getToken(KickCParser.ASM_MULTI_NAME, 0); }
public TerminalNode ASM_COLON() { return getToken(KickCParser.ASM_COLON, 0); }
public TerminalNode ASM_TAG() { return getToken(KickCParser.ASM_TAG, 0); }
public AsmLabelMultiContext(AsmLabelContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
@ -6156,8 +6158,9 @@ public class KickCParser extends Parser {
public final AsmLabelContext asmLabel() throws RecognitionException {
AsmLabelContext _localctx = new AsmLabelContext(_ctx, getState());
enterRule(_localctx, 84, RULE_asmLabel);
int _la;
try {
setState(755);
setState(761);
_errHandler.sync(this);
switch (_input.LA(1)) {
case ASM_NAME:
@ -6168,16 +6171,36 @@ public class KickCParser extends Parser {
match(ASM_NAME);
setState(752);
match(ASM_COLON);
setState(754);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==ASM_TAG) {
{
setState(753);
match(ASM_TAG);
}
}
}
break;
case ASM_MULTI_NAME:
_localctx = new AsmLabelMultiContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(753);
setState(756);
match(ASM_MULTI_NAME);
setState(754);
setState(757);
match(ASM_COLON);
setState(759);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==ASM_TAG) {
{
setState(758);
match(ASM_TAG);
}
}
}
break;
default:
@ -6200,6 +6223,7 @@ public class KickCParser extends Parser {
public AsmParamModeContext asmParamMode() {
return getRuleContext(AsmParamModeContext.class,0);
}
public TerminalNode ASM_TAG() { return getToken(KickCParser.ASM_TAG, 0); }
public AsmInstructionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@ -6222,21 +6246,32 @@ public class KickCParser extends Parser {
public final AsmInstructionContext asmInstruction() throws RecognitionException {
AsmInstructionContext _localctx = new AsmInstructionContext(_ctx, getState());
enterRule(_localctx, 86, RULE_asmInstruction);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(757);
setState(763);
match(ASM_MNEMONIC);
setState(759);
setState(765);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,80,_ctx) ) {
switch ( getInterpreter().adaptivePredict(_input,82,_ctx) ) {
case 1:
{
setState(758);
setState(764);
asmParamMode();
}
break;
}
setState(768);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==ASM_TAG) {
{
setState(767);
match(ASM_TAG);
}
}
}
}
catch (RecognitionException re) {
@ -6262,6 +6297,7 @@ public class KickCParser extends Parser {
public TerminalNode ASM_COMMA(int i) {
return getToken(KickCParser.ASM_COMMA, i);
}
public TerminalNode ASM_TAG() { return getToken(KickCParser.ASM_TAG, 0); }
public AsmBytesContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@ -6288,26 +6324,36 @@ public class KickCParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(761);
setState(770);
match(ASM_BYTE);
setState(762);
setState(771);
asmExpr(0);
setState(767);
setState(776);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==ASM_COMMA) {
{
{
setState(763);
setState(772);
match(ASM_COMMA);
setState(764);
setState(773);
asmExpr(0);
}
}
setState(769);
setState(778);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(780);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==ASM_TAG) {
{
setState(779);
match(ASM_TAG);
}
}
}
}
catch (RecognitionException re) {
@ -6551,14 +6597,14 @@ public class KickCParser extends Parser {
AsmParamModeContext _localctx = new AsmParamModeContext(_ctx, getState());
enterRule(_localctx, 90, RULE_asmParamMode);
try {
setState(815);
setState(827);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,82,_ctx) ) {
switch ( getInterpreter().adaptivePredict(_input,86,_ctx) ) {
case 1:
_localctx = new AsmModeAbsContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(770);
setState(782);
asmExpr(0);
}
break;
@ -6566,9 +6612,9 @@ public class KickCParser extends Parser {
_localctx = new AsmModeImmContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(771);
setState(783);
match(ASM_IMM);
setState(772);
setState(784);
asmExpr(0);
}
break;
@ -6576,11 +6622,11 @@ public class KickCParser extends Parser {
_localctx = new AsmModeAbsXYContext(_localctx);
enterOuterAlt(_localctx, 3);
{
setState(773);
setState(785);
asmExpr(0);
setState(774);
setState(786);
match(ASM_COMMA);
setState(775);
setState(787);
asmExpr(0);
}
break;
@ -6588,15 +6634,15 @@ public class KickCParser extends Parser {
_localctx = new AsmModeIndIdxXYContext(_localctx);
enterOuterAlt(_localctx, 4);
{
setState(777);
setState(789);
match(ASM_PAR_BEGIN);
setState(778);
setState(790);
asmExpr(0);
setState(779);
setState(791);
match(ASM_PAR_END);
setState(780);
setState(792);
match(ASM_COMMA);
setState(781);
setState(793);
match(ASM_NAME);
}
break;
@ -6604,19 +6650,19 @@ public class KickCParser extends Parser {
_localctx = new AsmModeIndLongIdxXYContext(_localctx);
enterOuterAlt(_localctx, 5);
{
setState(783);
setState(795);
match(ASM_PAR_BEGIN);
setState(784);
setState(796);
match(ASM_PAR_BEGIN);
setState(785);
setState(797);
asmExpr(0);
setState(786);
setState(798);
match(ASM_PAR_END);
setState(787);
setState(799);
match(ASM_PAR_END);
setState(788);
setState(800);
match(ASM_COMMA);
setState(789);
setState(801);
match(ASM_NAME);
}
break;
@ -6624,19 +6670,19 @@ public class KickCParser extends Parser {
_localctx = new AsmModeSPIndIdxContext(_localctx);
enterOuterAlt(_localctx, 6);
{
setState(791);
setState(803);
match(ASM_PAR_BEGIN);
setState(792);
setState(804);
asmExpr(0);
setState(793);
setState(805);
match(ASM_COMMA);
setState(794);
setState(806);
match(ASM_NAME);
setState(795);
setState(807);
match(ASM_PAR_END);
setState(796);
setState(808);
match(ASM_COMMA);
setState(797);
setState(809);
match(ASM_NAME);
}
break;
@ -6644,15 +6690,15 @@ public class KickCParser extends Parser {
_localctx = new AsmModeIdxIndXYContext(_localctx);
enterOuterAlt(_localctx, 7);
{
setState(799);
setState(811);
match(ASM_PAR_BEGIN);
setState(800);
setState(812);
asmExpr(0);
setState(801);
setState(813);
match(ASM_COMMA);
setState(802);
setState(814);
match(ASM_NAME);
setState(803);
setState(815);
match(ASM_PAR_END);
}
break;
@ -6660,11 +6706,11 @@ public class KickCParser extends Parser {
_localctx = new AsmModeIndContext(_localctx);
enterOuterAlt(_localctx, 8);
{
setState(805);
setState(817);
match(ASM_PAR_BEGIN);
setState(806);
setState(818);
asmExpr(0);
setState(807);
setState(819);
match(ASM_PAR_END);
}
break;
@ -6672,15 +6718,15 @@ public class KickCParser extends Parser {
_localctx = new AsmModeIndLongContext(_localctx);
enterOuterAlt(_localctx, 9);
{
setState(809);
setState(821);
match(ASM_PAR_BEGIN);
setState(810);
setState(822);
match(ASM_PAR_BEGIN);
setState(811);
setState(823);
asmExpr(0);
setState(812);
setState(824);
match(ASM_PAR_END);
setState(813);
setState(825);
match(ASM_PAR_END);
}
break;
@ -6885,7 +6931,7 @@ public class KickCParser extends Parser {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(831);
setState(843);
_errHandler.sync(this);
switch (_input.LA(1)) {
case ASM_BRACKET_BEGIN:
@ -6894,11 +6940,11 @@ public class KickCParser extends Parser {
_ctx = _localctx;
_prevctx = _localctx;
setState(818);
setState(830);
match(ASM_BRACKET_BEGIN);
setState(819);
setState(831);
asmExpr(0);
setState(820);
setState(832);
match(ASM_BRACKET_END);
}
break;
@ -6910,7 +6956,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprUnaryContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(822);
setState(834);
_la = _input.LA(1);
if ( !(((((_la - 125)) & ~0x3f) == 0 && ((1L << (_la - 125)) & ((1L << (ASM_PLUS - 125)) | (1L << (ASM_MINUS - 125)) | (1L << (ASM_LESS_THAN - 125)) | (1L << (ASM_GREATER_THAN - 125)))) != 0)) ) {
_errHandler.recoverInline(this);
@ -6920,7 +6966,7 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
setState(823);
setState(835);
asmExpr(8);
}
break;
@ -6929,7 +6975,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprLabelContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(824);
setState(836);
match(ASM_NAME);
}
break;
@ -6938,7 +6984,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprLabelRelContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(825);
setState(837);
match(ASM_MULTI_REL);
}
break;
@ -6947,11 +6993,11 @@ public class KickCParser extends Parser {
_localctx = new AsmExprReplaceContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(826);
setState(838);
match(ASM_CURLY_BEGIN);
setState(827);
setState(839);
match(ASM_NAME);
setState(828);
setState(840);
match(ASM_CURLY_END);
}
break;
@ -6960,7 +7006,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprIntContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(829);
setState(841);
match(ASM_NUMBER);
}
break;
@ -6969,7 +7015,7 @@ public class KickCParser extends Parser {
_localctx = new AsmExprCharContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(830);
setState(842);
match(ASM_CHAR);
}
break;
@ -6977,28 +7023,28 @@ public class KickCParser extends Parser {
throw new NoViableAltException(this);
}
_ctx.stop = _input.LT(-1);
setState(847);
setState(859);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,85,_ctx);
_alt = getInterpreter().adaptivePredict(_input,89,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(845);
setState(857);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,84,_ctx) ) {
switch ( getInterpreter().adaptivePredict(_input,88,_ctx) ) {
case 1:
{
_localctx = new AsmExprBinaryContext(new AsmExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_asmExpr);
setState(833);
setState(845);
if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)");
{
setState(834);
setState(846);
match(ASM_DOT);
}
setState(835);
setState(847);
asmExpr(11);
}
break;
@ -7006,9 +7052,9 @@ public class KickCParser extends Parser {
{
_localctx = new AsmExprBinaryContext(new AsmExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_asmExpr);
setState(836);
setState(848);
if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)");
setState(837);
setState(849);
_la = _input.LA(1);
if ( !(_la==ASM_SHIFT_LEFT || _la==ASM_SHIFT_RIGHT) ) {
_errHandler.recoverInline(this);
@ -7018,7 +7064,7 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
setState(838);
setState(850);
asmExpr(10);
}
break;
@ -7026,9 +7072,9 @@ public class KickCParser extends Parser {
{
_localctx = new AsmExprBinaryContext(new AsmExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_asmExpr);
setState(839);
setState(851);
if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
setState(840);
setState(852);
_la = _input.LA(1);
if ( !(_la==ASM_MULTIPLY || _la==ASM_DIVIDE) ) {
_errHandler.recoverInline(this);
@ -7038,7 +7084,7 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
setState(841);
setState(853);
asmExpr(8);
}
break;
@ -7046,9 +7092,9 @@ public class KickCParser extends Parser {
{
_localctx = new AsmExprBinaryContext(new AsmExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_asmExpr);
setState(842);
setState(854);
if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
setState(843);
setState(855);
_la = _input.LA(1);
if ( !(_la==ASM_PLUS || _la==ASM_MINUS) ) {
_errHandler.recoverInline(this);
@ -7058,16 +7104,16 @@ public class KickCParser extends Parser {
_errHandler.reportMatch(this);
consume();
}
setState(844);
setState(856);
asmExpr(7);
}
break;
}
}
}
setState(849);
setState(861);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,85,_ctx);
_alt = getInterpreter().adaptivePredict(_input,89,_ctx);
}
}
}
@ -7194,7 +7240,7 @@ public class KickCParser extends Parser {
}
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\u009b\u0355\4\2\t"+
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\u009c\u0361\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
@ -7249,26 +7295,27 @@ public class KickCParser extends Parser {
"\u02bd\n%\f%\16%\u02c0\13%\3&\3&\3&\7&\u02c5\n&\f&\16&\u02c8\13&\3\'\3"+
"\'\5\'\u02cc\n\'\3\'\3\'\3(\3(\3(\3(\7(\u02d4\n(\f(\16(\u02d7\13(\3(\3"+
"(\3)\3)\3)\3)\3)\3)\3)\3)\3)\3)\5)\u02e5\n)\3*\7*\u02e8\n*\f*\16*\u02eb"+
"\13*\3+\3+\3+\5+\u02f0\n+\3,\3,\3,\3,\5,\u02f6\n,\3-\3-\5-\u02fa\n-\3"+
".\3.\3.\3.\7.\u0300\n.\f.\16.\u0303\13.\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/"+
"\13*\3+\3+\3+\5+\u02f0\n+\3,\3,\3,\5,\u02f5\n,\3,\3,\3,\5,\u02fa\n,\5"+
",\u02fc\n,\3-\3-\5-\u0300\n-\3-\5-\u0303\n-\3.\3.\3.\3.\7.\u0309\n.\f"+
".\16.\u030c\13.\3.\5.\u030f\n.\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/"+
"\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/"+
"\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\5/\u0332\n/\3\60\3\60\3\60\3\60\3"+
"\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\5\60\u0342\n\60\3\60"+
"\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\7\60\u0350\n\60"+
"\f\60\16\60\u0353\13\60\3\60\2\t\f\30\32&FH^\61\2\4\6\b\n\f\16\20\22\24"+
"\26\30\32\34\36 \"$&(*,.\60\62\64\668:<>@BDFHJLNPRTVXZ\\^\2\r\3\2\27\30"+
"\5\2\22\23\31\32RR\4\2!!$$\3\2\35\36\3\2\24\26\3\2\22\23\3\2\37$\3\2\177"+
"\u0082\3\2}~\3\2\u0083\u0084\3\2\177\u0080\2\u03d2\2`\3\2\2\2\4c\3\2\2"+
"\2\6i\3\2\2\2\bz\3\2\2\2\n|\3\2\2\2\f\177\3\2\2\2\16\u0096\3\2\2\2\20"+
"\u00bb\3\2\2\2\22\u00c0\3\2\2\2\24\u00ca\3\2\2\2\26\u00d1\3\2\2\2\30\u00d7"+
"\3\2\2\2\32\u00f6\3\2\2\2\34\u0106\3\2\2\2\36\u0109\3\2\2\2 \u0115\3\2"+
"\2\2\"\u0118\3\2\2\2$\u011b\3\2\2\2&\u0123\3\2\2\2(\u012e\3\2\2\2*\u0133"+
"\3/\3/\3/\3/\3/\3/\3/\3/\3/\5/\u033e\n/\3\60\3\60\3\60\3\60\3\60\3\60"+
"\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\5\60\u034e\n\60\3\60\3\60\3\60"+
"\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\7\60\u035c\n\60\f\60\16"+
"\60\u035f\13\60\3\60\2\t\f\30\32&FH^\61\2\4\6\b\n\f\16\20\22\24\26\30"+
"\32\34\36 \"$&(*,.\60\62\64\668:<>@BDFHJLNPRTVXZ\\^\2\r\3\2\27\30\5\2"+
"\22\23\31\32RR\4\2!!$$\3\2\35\36\3\2\24\26\3\2\22\23\3\2\37$\3\2\177\u0082"+
"\3\2}~\3\2\u0083\u0084\3\2\177\u0080\2\u03e2\2`\3\2\2\2\4c\3\2\2\2\6i"+
"\3\2\2\2\bz\3\2\2\2\n|\3\2\2\2\f\177\3\2\2\2\16\u0096\3\2\2\2\20\u00bb"+
"\3\2\2\2\22\u00c0\3\2\2\2\24\u00ca\3\2\2\2\26\u00d1\3\2\2\2\30\u00d7\3"+
"\2\2\2\32\u00f6\3\2\2\2\34\u0106\3\2\2\2\36\u0109\3\2\2\2 \u0115\3\2\2"+
"\2\"\u0118\3\2\2\2$\u011b\3\2\2\2&\u0123\3\2\2\2(\u012e\3\2\2\2*\u0133"+
"\3\2\2\2,\u0144\3\2\2\2.\u014a\3\2\2\2\60\u015d\3\2\2\2\62\u015f\3\2\2"+
"\2\64\u0173\3\2\2\2\66\u01a2\3\2\2\28\u01a5\3\2\2\2:\u01fe\3\2\2\2<\u0201"+
"\3\2\2\2>\u020c\3\2\2\2@\u022a\3\2\2\2B\u0230\3\2\2\2D\u0232\3\2\2\2F"+
"\u0234\3\2\2\2H\u0280\3\2\2\2J\u02c1\3\2\2\2L\u02c9\3\2\2\2N\u02cf\3\2"+
"\2\2P\u02e4\3\2\2\2R\u02e9\3\2\2\2T\u02ef\3\2\2\2V\u02f5\3\2\2\2X\u02f7"+
"\3\2\2\2Z\u02fb\3\2\2\2\\\u0331\3\2\2\2^\u0341\3\2\2\2`a\5\6\4\2ab\7\2"+
"\2\2P\u02e4\3\2\2\2R\u02e9\3\2\2\2T\u02ef\3\2\2\2V\u02fb\3\2\2\2X\u02fd"+
"\3\2\2\2Z\u0304\3\2\2\2\\\u033d\3\2\2\2^\u034d\3\2\2\2`a\5\6\4\2ab\7\2"+
"\2\3b\3\3\2\2\2cd\5R*\2de\7\2\2\3e\5\3\2\2\2fh\5\b\5\2gf\3\2\2\2hk\3\2"+
"\2\2ig\3\2\2\2ij\3\2\2\2j\7\3\2\2\2ki\3\2\2\2lm\5\n\6\2mn\7\n\2\2n{\3"+
"\2\2\2op\5\36\20\2pq\7\n\2\2q{\3\2\2\2rs\5$\23\2st\7\n\2\2t{\3\2\2\2u"+
@ -7488,48 +7535,52 @@ public class KickCParser extends Parser {
"\u02eb\3\2\2\2\u02e9\u02e7\3\2\2\2\u02e9\u02ea\3\2\2\2\u02eaS\3\2\2\2"+
"\u02eb\u02e9\3\2\2\2\u02ec\u02f0\5V,\2\u02ed\u02f0\5X-\2\u02ee\u02f0\5"+
"Z.\2\u02ef\u02ec\3\2\2\2\u02ef\u02ed\3\2\2\2\u02ef\u02ee\3\2\2\2\u02f0"+
"U\3\2\2\2\u02f1\u02f2\7\u0093\2\2\u02f2\u02f6\7v\2\2\u02f3\u02f4\7\u0092"+
"\2\2\u02f4\u02f6\7v\2\2\u02f5\u02f1\3\2\2\2\u02f5\u02f3\3\2\2\2\u02f6"+
"W\3\2\2\2\u02f7\u02f9\7t\2\2\u02f8\u02fa\5\\/\2\u02f9\u02f8\3\2\2\2\u02f9"+
"\u02fa\3\2\2\2\u02faY\3\2\2\2\u02fb\u02fc\7s\2\2\u02fc\u0301\5^\60\2\u02fd"+
"\u02fe\7w\2\2\u02fe\u0300\5^\60\2\u02ff\u02fd\3\2\2\2\u0300\u0303\3\2"+
"\2\2\u0301\u02ff\3\2\2\2\u0301\u0302\3\2\2\2\u0302[\3\2\2\2\u0303\u0301"+
"\3\2\2\2\u0304\u0332\5^\60\2\u0305\u0306\7u\2\2\u0306\u0332\5^\60\2\u0307"+
"\u0308\5^\60\2\u0308\u0309\7w\2\2\u0309\u030a\5^\60\2\u030a\u0332\3\2"+
"\2\2\u030b\u030c\7x\2\2\u030c\u030d\5^\60\2\u030d\u030e\7y\2\2\u030e\u030f"+
"\7w\2\2\u030f\u0310\7\u0093\2\2\u0310\u0332\3\2\2\2\u0311\u0312\7x\2\2"+
"\u0312\u0313\7x\2\2\u0313\u0314\5^\60\2\u0314\u0315\7y\2\2\u0315\u0316"+
"\7y\2\2\u0316\u0317\7w\2\2\u0317\u0318\7\u0093\2\2\u0318\u0332\3\2\2\2"+
"\u0319\u031a\7x\2\2\u031a\u031b\5^\60\2\u031b\u031c\7w\2\2\u031c\u031d"+
"\7\u0093\2\2\u031d\u031e\7y\2\2\u031e\u031f\7w\2\2\u031f\u0320\7\u0093"+
"\2\2\u0320\u0332\3\2\2\2\u0321\u0322\7x\2\2\u0322\u0323\5^\60\2\u0323"+
"\u0324\7w\2\2\u0324\u0325\7\u0093\2\2\u0325\u0326\7y\2\2\u0326\u0332\3"+
"\2\2\2\u0327\u0328\7x\2\2\u0328\u0329\5^\60\2\u0329\u032a\7y\2\2\u032a"+
"\u0332\3\2\2\2\u032b\u032c\7x\2\2\u032c\u032d\7x\2\2\u032d\u032e\5^\60"+
"\2\u032e\u032f\7y\2\2\u032f\u0330\7y\2\2\u0330\u0332\3\2\2\2\u0331\u0304"+
"\3\2\2\2\u0331\u0305\3\2\2\2\u0331\u0307\3\2\2\2\u0331\u030b\3\2\2\2\u0331"+
"\u0311\3\2\2\2\u0331\u0319\3\2\2\2\u0331\u0321\3\2\2\2\u0331\u0327\3\2"+
"\2\2\u0331\u032b\3\2\2\2\u0332]\3\2\2\2\u0333\u0334\b\60\1\2\u0334\u0335"+
"\7z\2\2\u0335\u0336\5^\60\2\u0336\u0337\7{\2\2\u0337\u0342\3\2\2\2\u0338"+
"\u0339\t\t\2\2\u0339\u0342\5^\60\n\u033a\u0342\7\u0093\2\2\u033b\u0342"+
"\7\u0091\2\2\u033c\u033d\7\u0085\2\2\u033d\u033e\7\u0093\2\2\u033e\u0342"+
"\7\u0086\2\2\u033f\u0342\7\u0087\2\2\u0340\u0342\7\u0090\2\2\u0341\u0333"+
"\3\2\2\2\u0341\u0338\3\2\2\2\u0341\u033a\3\2\2\2\u0341\u033b\3\2\2\2\u0341"+
"\u033c\3\2\2\2\u0341\u033f\3\2\2\2\u0341\u0340\3\2\2\2\u0342\u0351\3\2"+
"\2\2\u0343\u0344\f\f\2\2\u0344\u0345\7|\2\2\u0345\u0350\5^\60\r\u0346"+
"\u0347\f\13\2\2\u0347\u0348\t\n\2\2\u0348\u0350\5^\60\f\u0349\u034a\f"+
"\t\2\2\u034a\u034b\t\13\2\2\u034b\u0350\5^\60\n\u034c\u034d\f\b\2\2\u034d"+
"\u034e\t\f\2\2\u034e\u0350\5^\60\t\u034f\u0343\3\2\2\2\u034f\u0346\3\2"+
"\2\2\u034f\u0349\3\2\2\2\u034f\u034c\3\2\2\2\u0350\u0353\3\2\2\2\u0351"+
"\u034f\3\2\2\2\u0351\u0352\3\2\2\2\u0352_\3\2\2\2\u0353\u0351\3\2\2\2"+
"Xiz\u0083\u008d\u0093\u009b\u00a2\u00ab\u00b0\u00b6\u00bb\u00c0\u00c7"+
"\u00ce\u00d3\u00df\u00e2\u00e4\u00ef\u00f6\u00fb\u0101\u0103\u010b\u0111"+
"\u011d\u012b\u0131\u0137\u013d\u0142\u0146\u014f\u0156\u015d\u0167\u0173"+
"\u017e\u0193\u019c\u01a2\u01a7\u01ae\u01bb\u01c0\u01cc\u01da\u01ed\u01f6"+
"\u01fe\u0203\u0208\u020a\u0210\u0215\u0219\u021f\u0222\u022a\u022d\u0230"+
"\u023c\u0248\u0250\u0256\u025a\u026f\u0273\u027c\u0280\u02b2\u02bc\u02be"+
"\u02c6\u02cb\u02d5\u02e4\u02e9\u02ef\u02f5\u02f9\u0301\u0331\u0341\u034f"+
"\u0351";
"U\3\2\2\2\u02f1\u02f2\7\u0093\2\2\u02f2\u02f4\7v\2\2\u02f3\u02f5\7\u0094"+
"\2\2\u02f4\u02f3\3\2\2\2\u02f4\u02f5\3\2\2\2\u02f5\u02fc\3\2\2\2\u02f6"+
"\u02f7\7\u0092\2\2\u02f7\u02f9\7v\2\2\u02f8\u02fa\7\u0094\2\2\u02f9\u02f8"+
"\3\2\2\2\u02f9\u02fa\3\2\2\2\u02fa\u02fc\3\2\2\2\u02fb\u02f1\3\2\2\2\u02fb"+
"\u02f6\3\2\2\2\u02fcW\3\2\2\2\u02fd\u02ff\7t\2\2\u02fe\u0300\5\\/\2\u02ff"+
"\u02fe\3\2\2\2\u02ff\u0300\3\2\2\2\u0300\u0302\3\2\2\2\u0301\u0303\7\u0094"+
"\2\2\u0302\u0301\3\2\2\2\u0302\u0303\3\2\2\2\u0303Y\3\2\2\2\u0304\u0305"+
"\7s\2\2\u0305\u030a\5^\60\2\u0306\u0307\7w\2\2\u0307\u0309\5^\60\2\u0308"+
"\u0306\3\2\2\2\u0309\u030c\3\2\2\2\u030a\u0308\3\2\2\2\u030a\u030b\3\2"+
"\2\2\u030b\u030e\3\2\2\2\u030c\u030a\3\2\2\2\u030d\u030f\7\u0094\2\2\u030e"+
"\u030d\3\2\2\2\u030e\u030f\3\2\2\2\u030f[\3\2\2\2\u0310\u033e\5^\60\2"+
"\u0311\u0312\7u\2\2\u0312\u033e\5^\60\2\u0313\u0314\5^\60\2\u0314\u0315"+
"\7w\2\2\u0315\u0316\5^\60\2\u0316\u033e\3\2\2\2\u0317\u0318\7x\2\2\u0318"+
"\u0319\5^\60\2\u0319\u031a\7y\2\2\u031a\u031b\7w\2\2\u031b\u031c\7\u0093"+
"\2\2\u031c\u033e\3\2\2\2\u031d\u031e\7x\2\2\u031e\u031f\7x\2\2\u031f\u0320"+
"\5^\60\2\u0320\u0321\7y\2\2\u0321\u0322\7y\2\2\u0322\u0323\7w\2\2\u0323"+
"\u0324\7\u0093\2\2\u0324\u033e\3\2\2\2\u0325\u0326\7x\2\2\u0326\u0327"+
"\5^\60\2\u0327\u0328\7w\2\2\u0328\u0329\7\u0093\2\2\u0329\u032a\7y\2\2"+
"\u032a\u032b\7w\2\2\u032b\u032c\7\u0093\2\2\u032c\u033e\3\2\2\2\u032d"+
"\u032e\7x\2\2\u032e\u032f\5^\60\2\u032f\u0330\7w\2\2\u0330\u0331\7\u0093"+
"\2\2\u0331\u0332\7y\2\2\u0332\u033e\3\2\2\2\u0333\u0334\7x\2\2\u0334\u0335"+
"\5^\60\2\u0335\u0336\7y\2\2\u0336\u033e\3\2\2\2\u0337\u0338\7x\2\2\u0338"+
"\u0339\7x\2\2\u0339\u033a\5^\60\2\u033a\u033b\7y\2\2\u033b\u033c\7y\2"+
"\2\u033c\u033e\3\2\2\2\u033d\u0310\3\2\2\2\u033d\u0311\3\2\2\2\u033d\u0313"+
"\3\2\2\2\u033d\u0317\3\2\2\2\u033d\u031d\3\2\2\2\u033d\u0325\3\2\2\2\u033d"+
"\u032d\3\2\2\2\u033d\u0333\3\2\2\2\u033d\u0337\3\2\2\2\u033e]\3\2\2\2"+
"\u033f\u0340\b\60\1\2\u0340\u0341\7z\2\2\u0341\u0342\5^\60\2\u0342\u0343"+
"\7{\2\2\u0343\u034e\3\2\2\2\u0344\u0345\t\t\2\2\u0345\u034e\5^\60\n\u0346"+
"\u034e\7\u0093\2\2\u0347\u034e\7\u0091\2\2\u0348\u0349\7\u0085\2\2\u0349"+
"\u034a\7\u0093\2\2\u034a\u034e\7\u0086\2\2\u034b\u034e\7\u0087\2\2\u034c"+
"\u034e\7\u0090\2\2\u034d\u033f\3\2\2\2\u034d\u0344\3\2\2\2\u034d\u0346"+
"\3\2\2\2\u034d\u0347\3\2\2\2\u034d\u0348\3\2\2\2\u034d\u034b\3\2\2\2\u034d"+
"\u034c\3\2\2\2\u034e\u035d\3\2\2\2\u034f\u0350\f\f\2\2\u0350\u0351\7|"+
"\2\2\u0351\u035c\5^\60\r\u0352\u0353\f\13\2\2\u0353\u0354\t\n\2\2\u0354"+
"\u035c\5^\60\f\u0355\u0356\f\t\2\2\u0356\u0357\t\13\2\2\u0357\u035c\5"+
"^\60\n\u0358\u0359\f\b\2\2\u0359\u035a\t\f\2\2\u035a\u035c\5^\60\t\u035b"+
"\u034f\3\2\2\2\u035b\u0352\3\2\2\2\u035b\u0355\3\2\2\2\u035b\u0358\3\2"+
"\2\2\u035c\u035f\3\2\2\2\u035d\u035b\3\2\2\2\u035d\u035e\3\2\2\2\u035e"+
"_\3\2\2\2\u035f\u035d\3\2\2\2\\iz\u0083\u008d\u0093\u009b\u00a2\u00ab"+
"\u00b0\u00b6\u00bb\u00c0\u00c7\u00ce\u00d3\u00df\u00e2\u00e4\u00ef\u00f6"+
"\u00fb\u0101\u0103\u010b\u0111\u011d\u012b\u0131\u0137\u013d\u0142\u0146"+
"\u014f\u0156\u015d\u0167\u0173\u017e\u0193\u019c\u01a2\u01a7\u01ae\u01bb"+
"\u01c0\u01cc\u01da\u01ed\u01f6\u01fe\u0203\u0208\u020a\u0210\u0215\u0219"+
"\u021f\u0222\u022a\u022d\u0230\u023c\u0248\u0250\u0256\u025a\u026f\u0273"+
"\u027c\u0280\u02b2\u02bc\u02be\u02c6\u02cb\u02d5\u02e4\u02e9\u02ef\u02f4"+
"\u02f9\u02fb\u02ff\u0302\u030a\u030e\u033d\u034d\u035b\u035d";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {

View File

@ -143,14 +143,15 @@ ASM_CHAR=142
ASM_MULTI_REL=143
ASM_MULTI_NAME=144
ASM_NAME=145
ASM_WS=146
ASM_COMMENT_LINE=147
ASM_COMMENT_BLOCK=148
IMPORT_SYSTEMFILE=149
IMPORT_LOCALFILE=150
IMPORT_WS=151
IMPORT_COMMENT_LINE=152
IMPORT_COMMENT_BLOCK=153
ASM_TAG=146
ASM_WS=147
ASM_COMMENT_LINE=148
ASM_COMMENT_BLOCK=149
IMPORT_SYSTEMFILE=150
IMPORT_LOCALFILE=151
IMPORT_WS=152
IMPORT_COMMENT_LINE=153
IMPORT_COMMENT_BLOCK=154
';'=8
'..'=11
'...'=12

View File

@ -13,6 +13,7 @@ import dk.camelot64.kickc.model.values.ScopeRef;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
/*** Ensure that all interrupt procedures with CLOBBER type only saves the necessary registers. */
public class Pass4InterruptClobberFix extends Pass2Base {
@ -51,11 +52,11 @@ public class Pass4InterruptClobberFix extends Pass2Base {
if(interruptEntry == null || interruptExit == null) {
throw new RuntimeException("Cannot find interrupt entry/exit for interrupt " + procedure.getFullName());
}
String clobberedRegisters = getClobberedRegisterNames(procClobber);
String clobberedRegisterNames = getClobberedRegisterNames(procClobber);
// Update the interrupt entry ASM with the proper clobber fragment
updateClobberFragment(interruptEntry, clobberedRegisters);
pruneFragmentClobber(interruptEntry, clobberedRegisterNames);
// Update the interrupt exit ASM with the proper clobber fragment
updateClobberFragment(interruptExit, clobberedRegisters);
pruneFragmentClobber(interruptExit, clobberedRegisterNames);
}
}
@ -113,52 +114,26 @@ public class Pass4InterruptClobberFix extends Pass2Base {
}
/**
* Replace the current code with the proper version handling only the clobbered registers
* Prune the interrupt entry/exit fragment removing code handling non-clobbered registers
*
* @param interruptAsmChunk The AsmFragment representing an interrupt entry/exit
* @param clobberedRegisters The clobbered registers
* @param nonClobberedRegisters The non-clobbered registers
*/
private void updateClobberFragment(AsmChunk interruptAsmChunk, String clobberedRegisters) {
// find the clobber fragment sub-name
String clobberName = "clob" + clobberedRegisters;
if(clobberedRegisters.equals(""))
clobberName = "none";
String allRegisters = "axy" + (getProgram().getTargetCpu().getCpu65xx().hasRegisterZ() ? "z" : "");
if(clobberedRegisters.equals(allRegisters))
clobberName = "all";
// Find the interrupt type name (including "isr_" and "_entry"/"_exit"
String interruptType = interruptAsmChunk.getSource();
interruptType = interruptType.substring(("interrupt(".length()), interruptType.length() - 1);
// Find the correct clobber name based on the clobbered registers
final String interruptSignatureFinal = interruptType.replace("clobber", clobberName);
AsmFragmentInstanceSpecBuilder interruptFragment = AsmFragmentInstanceSpecBuilder.interrupt(interruptSignatureFinal, getProgram());
String interruptFragmentName = interruptFragment.getAsmFragmentInstanceSpec().getSignature();
// Generate the fragment
final AsmFragmentTemplateSynthesizer cpuSynthesizer = getProgram().getAsmFragmentMasterSynthesizer().getSynthesizer(getProgram().getTargetCpu());
final AsmFragmentInstance fragmentInstance = cpuSynthesizer.getFragmentInstance(interruptFragment.getAsmFragmentInstanceSpec(), getProgram().getLog());
interruptAsmChunk.setFragment(fragmentInstance.getFragmentName());
final AsmProgram asmLines = new AsmProgram(getProgram().getTargetCpu());
asmLines.startChunk(getProgram().getScope().getRef(), interruptAsmChunk.getStatementIdx(), interruptAsmChunk.getSource());
fragmentInstance.generate(asmLines);
// Replace the chunk lines with the generated lines
final List<AsmLine> interruptAsmChunkLines = interruptAsmChunk.getLines();
int line_idx = interruptAsmChunkLines.get(0).getIndex();
boolean hasScopeEnd = interruptAsmChunkLines.get(interruptAsmChunkLines.size() - 1) instanceof AsmScopeEnd;
interruptAsmChunkLines.clear();
interruptAsmChunk.setSource("interrupt(" + interruptFragmentName+ ")");
for(AsmChunk chunk : asmLines.getChunks()) {
for(AsmLine line : chunk.getLines()) {
interruptAsmChunk.addLine(line);
line.setIndex(line_idx++);
if(line instanceof AsmLabel) ((AsmLabel) line).setDontOptimize(true);
}
private void pruneFragmentClobber(AsmChunk interruptAsmChunk, String clobberedRegisters) {
final ListIterator<AsmLine> asmLineListIterator = interruptAsmChunk.getLines().listIterator();
while(asmLineListIterator.hasNext()) {
AsmLine asmLine = asmLineListIterator.next();
if(asmLine.getTags().has("clob_a") && !clobberedRegisters.contains("a"))
asmLineListIterator.remove();
if(asmLine.getTags().has("clob_x") && !clobberedRegisters.contains("x"))
asmLineListIterator.remove();
if(asmLine.getTags().has("clob_y") && !clobberedRegisters.contains("y"))
asmLineListIterator.remove();
if(asmLine.getTags().has("clob_z") && !clobberedRegisters.contains("z"))
asmLineListIterator.remove();
if(asmLine.getTags().has("clob_none") && clobberedRegisters.equals(""))
asmLineListIterator.remove();
}
if(hasScopeEnd)
interruptAsmChunkLines.add(new AsmScopeEnd());
}
}

View File

@ -55,7 +55,7 @@ public class Pass5AddMainRts extends Pass5AsmOptimization {
}
private void addRts(ListIterator<AsmLine> lineIterator) {
lineIterator.add(new AsmInstruction(getAsmProgram().getTargetCpu().getCpu65xx().getOpcode("rts", CpuAddressingMode.NON, false)));
lineIterator.add(new AsmInstruction(getAsmProgram().getTargetCpu().getCpu65xx().getOpcode("rts", CpuAddressingMode.NON, false), null, null));
getLog().append("Adding RTS to root block ");
}

View File

@ -141,7 +141,7 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
String newLabel = AsmFormat.asmFix("!" + branchDest);
asmInstruction.setOperandJumpTarget(newLabel+"+");
CpuOpcode jmpOpcode = getAsmProgram().getTargetCpu().getCpu65xx().getOpcode("jmp", CpuAddressingMode.ABS, false);
AsmInstruction jmpInstruction = new AsmInstruction(jmpOpcode, branchDest);
AsmInstruction jmpInstruction = new AsmInstruction(jmpOpcode, branchDest, null);
asmChunk.addLineAfter(asmInstruction, jmpInstruction);
asmChunk.addLineAfter(jmpInstruction, new AsmLabel(newLabel));
return true;

View File

@ -57,7 +57,7 @@ __start: {
}
// Interrupt Routine counting frames
irq: {
pha
sta rega+1
// *BG_COLOR = WHITE
lda #WHITE
sta BG_COLOR
@ -76,7 +76,8 @@ irq: {
lda #IRQ_RASTER
sta IRQ_STATUS
// }
pla
rega:
lda #0
rti
}
main: {

View File

@ -1720,8 +1720,8 @@ __start: {
// irq
// Interrupt Routine counting frames
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// [5] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta BG_COLOR
@ -1748,8 +1748,9 @@ irq: {
// irq::@return
__breturn:
// [10] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main
@ -2266,6 +2267,7 @@ Replacing label __b3_from___b4 with __b3
Replacing label __b2_from___b3 with __b2
Removing instruction __b1_from___init1:
Removing instruction main_from___b1:
Removing instruction __breturn:
Removing instruction __b8_from_main:
Removing instruction bitmap_clear_from___b8:
Removing instruction toD0181_from___b9:
@ -2291,7 +2293,6 @@ Removing instruction __init1:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __b2:
Removing instruction __breturn:
Removing instruction bitmap_init_from_main:
Removing instruction __b8:
Removing instruction __b9:
@ -2442,7 +2443,7 @@ reg byte x [ bitmap_plot::$1 ]
FINAL ASSEMBLER
Score: 3232
Score: 3222
// File Comments
// Tests the simple bitmap plotter - and counts plots per frame in an IRQ
@ -2516,8 +2517,8 @@ __start: {
// irq
// Interrupt Routine counting frames
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// *BG_COLOR = WHITE
// [5] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
@ -2545,8 +2546,9 @@ irq: {
// irq::@return
// }
// [10] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main

View File

@ -66,7 +66,7 @@ __start: {
}
// Interrupt Routine counting frames
irq: {
pha
sta rega+1
// *BG_COLOR = WHITE
lda #WHITE
sta BG_COLOR
@ -85,7 +85,8 @@ irq: {
lda #IRQ_RASTER
sta IRQ_STATUS
// }
pla
rega:
lda #0
rti
}
main: {

View File

@ -4142,8 +4142,8 @@ __start: {
// irq
// Interrupt Routine counting frames
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// [5] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta BG_COLOR
@ -4170,8 +4170,9 @@ irq: {
// irq::@return
__breturn:
// [10] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main
@ -5747,6 +5748,7 @@ Replacing label __b3_from___b2 with __b3
Replacing label __b1_from___b3 with __b1
Removing instruction __b1_from___init1:
Removing instruction main_from___b1:
Removing instruction __breturn:
Removing instruction __b6_from_main:
Removing instruction bitmap_init_from___b6:
Removing instruction __b7_from___b6:
@ -5796,7 +5798,6 @@ Removing instruction __init1:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __b2:
Removing instruction __breturn:
Removing instruction sin16s_gen2_from_main:
Removing instruction __b6:
Removing instruction __b7:
@ -6211,7 +6212,7 @@ zp[2]:44 [ rem16u#0 ]
FINAL ASSEMBLER
Score: 20504
Score: 20494
// File Comments
// Tests the simple bitmap plotter - and counts plots per frame in an IRQ
@ -6294,8 +6295,8 @@ __start: {
// irq
// Interrupt Routine counting frames
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// *BG_COLOR = WHITE
// [5] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
@ -6323,8 +6324,9 @@ irq: {
// irq::@return
// }
// [10] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main

View File

@ -67,7 +67,7 @@ __start: {
}
// Interrupt Routine counting frames
irq: {
pha
sta rega+1
// *BG_COLOR = WHITE
lda #WHITE
sta BG_COLOR
@ -86,7 +86,8 @@ irq: {
lda #IRQ_RASTER
sta IRQ_STATUS
// }
pla
rega:
lda #0
rti
}
main: {

View File

@ -4375,8 +4375,8 @@ __start: {
// irq
// Interrupt Routine counting frames
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// [5] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta BG_COLOR
@ -4403,8 +4403,9 @@ irq: {
// irq::@return
__breturn:
// [10] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main
@ -6045,6 +6046,7 @@ Replacing label __b3_from___b2 with __b3
Replacing label __b1_from___b3 with __b1
Removing instruction __b1_from___init1:
Removing instruction main_from___b1:
Removing instruction __breturn:
Removing instruction __b9_from_main:
Removing instruction bitmap_init_from___b9:
Removing instruction __b10_from___b9:
@ -6096,7 +6098,6 @@ Removing instruction __init1:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __b2:
Removing instruction __breturn:
Removing instruction sin16s_gen2_from_main:
Removing instruction __b9:
Removing instruction __b10:
@ -6528,7 +6529,7 @@ zp[2]:47 [ rem16u#0 ]
FINAL ASSEMBLER
Score: 20664
Score: 20654
// File Comments
// Tests the simple bitmap plotter - and counts plots per frame in an IRQ
@ -6612,8 +6613,8 @@ __start: {
// irq
// Interrupt Routine counting frames
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// *BG_COLOR = WHITE
// [5] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
@ -6641,8 +6642,9 @@ irq: {
// irq::@return
// }
// [10] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main

View File

@ -246,7 +246,7 @@ __start: {
}
// irq
irq: {
// interrupt(isr_hardware_clobax_entry) -- isr_hardware_clobax_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
stx regx+1
// [5] *BORDER_COLOR = DARK_GREY -- _deref_pbuc1=vbuc2
@ -286,7 +286,7 @@ irq: {
// irq::@return
__breturn:
// [14] return
// interrupt(isr_hardware_clobax_exit) -- isr_hardware_clobax_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regx:
@ -391,7 +391,7 @@ __start: {
}
// irq
irq: {
// interrupt(isr_hardware_clobax_entry) -- isr_hardware_clobax_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
stx regx+1
// *BORDER_COLOR = DARK_GREY
@ -432,7 +432,7 @@ irq: {
// irq::@return
// }
// [14] return
// interrupt(isr_hardware_clobax_exit) -- isr_hardware_clobax_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regx:

View File

@ -189,14 +189,14 @@ main: {
}
// nmiHandler
nmiHandler: {
// interrupt(isr_hardware_none_entry) -- isr_hardware_none_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
// [2] *BG_COLOR = ++ *BG_COLOR -- _deref_pbuc1=_inc__deref_pbuc1
inc BG_COLOR
jmp __breturn
// nmiHandler::@return
__breturn:
// [3] return
// interrupt(isr_hardware_none_exit) -- isr_hardware_none_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rti
}
// entryPoint
@ -299,14 +299,14 @@ main: {
}
// nmiHandler
nmiHandler: {
// interrupt(isr_hardware_none_entry) -- isr_hardware_none_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
// (*BG_COLOR)++;
// [2] *BG_COLOR = ++ *BG_COLOR -- _deref_pbuc1=_inc__deref_pbuc1
inc BG_COLOR
// nmiHandler::@return
// }
// [3] return
// interrupt(isr_hardware_none_exit) -- isr_hardware_none_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rti
}
// entryPoint

View File

@ -145,7 +145,7 @@ irqBottom: {
}
// Raster Interrupt at the top of the screen
irqTop: {
pha
sta rega+1
// *RASTER = RASTER_IRQ_MIDDLE
// Trigger IRQ at the middle of the screen
lda #RASTER_IRQ_MIDDLE
@ -160,7 +160,8 @@ irqTop: {
lda #IRQ_RASTER
sta IRQ_STATUS
// }
pla
rega:
lda #0
rti
}
// Allocates a block of size chars of memory, returning a pointer to the beginning of the block.

View File

@ -5215,7 +5215,7 @@ __start: {
// irqBottom
// Raster Interrupt at the bottom of the screen
irqBottom: {
// interrupt(isr_hardware_all_entry) -- isr_hardware_all_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
stx regx+1
sty regy+1
@ -5248,7 +5248,7 @@ irqBottom: {
// irqBottom::@return
__breturn:
// [15] return
// interrupt(isr_hardware_all_exit) -- isr_hardware_all_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regx:
@ -5260,8 +5260,9 @@ irqBottom: {
// irqTop
// Raster Interrupt at the top of the screen
irqTop: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
jmp __b1
// irqTop::@1
__b1:
// [17] *RASTER = RASTER_IRQ_MIDDLE -- _deref_pbuc1=vbuc2
@ -5281,8 +5282,9 @@ irqTop: {
// irqTop::@return
__breturn:
// [20] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// malloc
@ -7072,6 +7074,7 @@ Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __breturn
Removing instruction jmp __b9
@ -7189,6 +7192,7 @@ Removing instruction __b1_from___b3:
Removing instruction __b1_from_irqBottom:
Removing instruction processChars_from___b1:
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __b3_from___b3:
Removing instruction __b4_from___b3:
Removing instruction __b10_from___b4:
@ -7237,7 +7241,6 @@ Removing instruction __b1:
Removing instruction __b2:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __b9:
Removing instruction __b1_from___b9:
Removing instruction __b3_from___b1:
@ -7306,23 +7309,23 @@ Removing instruction jmp __b6
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldy #OFFSET_STRUCT_PROCESSINGSPRITE_STATUS
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Fixing long branch [498] bne __b1 to beq
Fixing long branch [1072] bne __b2 to beq
Fixing long branch [1199] beq __b12 to bne
Fixing long branch [303] beq __b2 to bne
Fixing long branch [363] bne __b4 to beq
Fixing long branch [396] bcc __b6 to bcs
Fixing long branch [403] bcc __b6 to bcs
Fixing long branch [410] bcc __b6 to bcs
Fixing long branch [417] bcc __b6 to bcs
Fixing long branch [425] bcc __b6 to bcs
Fixing long branch [432] bcc __b6 to bcs
Fixing long branch [440] bcc __b6 to bcs
Fixing long branch [738] beq __b11 to bne
Fixing long branch [870] bne __b3 to beq
Fixing long branch [876] beq __b8 to bne
Fixing long branch [1118] bpl __b1 to bmi
Fixing long branch [1130] bpl __b4 to bmi
Fixing long branch [499] bne __b1 to beq
Fixing long branch [1073] bne __b2 to beq
Fixing long branch [1200] beq __b12 to bne
Fixing long branch [304] beq __b2 to bne
Fixing long branch [364] bne __b4 to beq
Fixing long branch [397] bcc __b6 to bcs
Fixing long branch [404] bcc __b6 to bcs
Fixing long branch [411] bcc __b6 to bcs
Fixing long branch [418] bcc __b6 to bcs
Fixing long branch [426] bcc __b6 to bcs
Fixing long branch [433] bcc __b6 to bcs
Fixing long branch [441] bcc __b6 to bcs
Fixing long branch [739] beq __b11 to bne
Fixing long branch [871] bne __b3 to beq
Fixing long branch [877] beq __b8 to bne
Fixing long branch [1119] bpl __b1 to bmi
Fixing long branch [1131] bpl __b4 to bmi
FINAL SYMBOL TABLE
const struct ProcessingSprite $0 = { x: 0, y: 0, vx: 0, vy: 0, id: 0, ptr: 0, col: 0, status: STATUS_FREE, screenPtr: (byte*) 0 }
@ -7767,7 +7770,7 @@ reg byte a [ atan2_16::$22 ]
FINAL ASSEMBLER
Score: 1110964
Score: 1110954
// File Comments
// Clears start screen throwing around the letters (by turning them into sprites)
@ -7909,7 +7912,7 @@ __start: {
// irqBottom
// Raster Interrupt at the bottom of the screen
irqBottom: {
// interrupt(isr_hardware_all_entry) -- isr_hardware_all_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
stx regx+1
sty regy+1
@ -7939,7 +7942,7 @@ irqBottom: {
// irqBottom::@return
// }
// [15] return
// interrupt(isr_hardware_all_exit) -- isr_hardware_all_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regx:
@ -7951,8 +7954,8 @@ irqBottom: {
// irqTop
// Raster Interrupt at the top of the screen
irqTop: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// irqTop::@1
// *RASTER = RASTER_IRQ_MIDDLE
// [17] *RASTER = RASTER_IRQ_MIDDLE -- _deref_pbuc1=vbuc2
@ -7973,8 +7976,9 @@ irqTop: {
// irqTop::@return
// }
// [20] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// malloc

View File

@ -2775,7 +2775,7 @@ __start: {
// vblank
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
vblank: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
pha
// [6] *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 -- _deref_pbuc1=vbuc2
// Set scroll
@ -2802,7 +2802,7 @@ vblank: {
// vblank::@return
__breturn:
// [11] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
pla
rti
}
@ -4041,7 +4041,7 @@ __start: {
// vblank
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
vblank: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
pha
// PPU->PPUSCROLL = 0
// [6] *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 -- _deref_pbuc1=vbuc2
@ -4068,7 +4068,7 @@ vblank: {
// vblank::@return
// }
// [11] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
pla
rti
}

View File

@ -2904,7 +2904,7 @@ __start: {
// vblank
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
vblank: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
pha
// [6] *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 -- _deref_pbuc1=vbuc2
// Set scroll
@ -2931,7 +2931,7 @@ vblank: {
// vblank::@return
__breturn:
// [11] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
pla
rti
}
@ -4330,7 +4330,7 @@ __start: {
// vblank
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
vblank: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
pha
// PPU->PPUSCROLL = 0
// [6] *((byte*)PPU+OFFSET_STRUCT_RICOH_2C02_PPUSCROLL) = 0 -- _deref_pbuc1=vbuc2
@ -4357,7 +4357,7 @@ vblank: {
// vblank::@return
// }
// [11] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
pla
rti
}

View File

@ -1799,7 +1799,7 @@ __start: {
sprites_irq: {
.const toSpritePtr1_return = $ff&PLAYFIELD_SPRITES/$40
.label raster_sprite_gfx_modify = $b
// interrupt(isr_hardware_clobax_entry) -- isr_hardware_clobax_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
stx regx+1
// asm { cld }
@ -1902,7 +1902,7 @@ sprites_irq: {
// sprites_irq::@return
__breturn:
// [35] return
// interrupt(isr_hardware_clobax_exit) -- isr_hardware_clobax_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regx:
@ -2668,7 +2668,7 @@ __start: {
sprites_irq: {
.const toSpritePtr1_return = $ff&PLAYFIELD_SPRITES/$40
.label raster_sprite_gfx_modify = $b
// interrupt(isr_hardware_clobax_entry) -- isr_hardware_clobax_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
stx regx+1
// asm
@ -2784,7 +2784,7 @@ sprites_irq: {
// sprites_irq::@return
// }
// [35] return
// interrupt(isr_hardware_clobax_exit) -- isr_hardware_clobax_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regx:

View File

@ -12773,7 +12773,7 @@ __start: {
sprites_irq: {
.const toSpritePtr1_return = $ff&PLAYFIELD_SPRITES/$40
.label raster_sprite_gfx_modify = $2d
// interrupt(isr_hardware_clobax_entry) -- isr_hardware_clobax_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
stx regx+1
// asm { cld }
@ -12876,7 +12876,7 @@ sprites_irq: {
// sprites_irq::@return
__breturn:
// [36] return
// interrupt(isr_hardware_clobax_exit) -- isr_hardware_clobax_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regx:
@ -17824,7 +17824,7 @@ __start: {
sprites_irq: {
.const toSpritePtr1_return = $ff&PLAYFIELD_SPRITES/$40
.label raster_sprite_gfx_modify = $2d
// interrupt(isr_hardware_clobax_entry) -- isr_hardware_clobax_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
stx regx+1
// asm
@ -17940,7 +17940,7 @@ sprites_irq: {
// sprites_irq::@return
// }
// [36] return
// interrupt(isr_hardware_clobax_exit) -- isr_hardware_clobax_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regx:

View File

@ -41,7 +41,7 @@
.segment Code
// Interrupt Routine 2
irq_bottom_2: {
pha
sta rega+1
// VICII->BORDER_COLOR = WHITE
lda #WHITE
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
@ -67,12 +67,13 @@ irq_bottom_2: {
lda #RED
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
// }
pla
rega:
lda #0
rti
}
// Interrupt Routine 1
irq_bottom_1: {
pha
sta rega+1
// VICII->BORDER_COLOR = WHITE
lda #WHITE
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
@ -98,7 +99,8 @@ irq_bottom_1: {
lda #RED
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
// }
pla
rega:
lda #0
rti
}
main: {

View File

@ -276,8 +276,8 @@ ASSEMBLER BEFORE OPTIMIZATION
// irq_bottom_2
// Interrupt Routine 2
irq_bottom_2: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// [0] *((byte*)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
@ -306,15 +306,16 @@ irq_bottom_2: {
// irq_bottom_2::@return
__breturn:
// [6] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// irq_bottom_1
// Interrupt Routine 1
irq_bottom_1: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// [7] *((byte*)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
@ -343,8 +344,9 @@ irq_bottom_1: {
// irq_bottom_1::@return
__breturn:
// [13] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main
@ -401,12 +403,11 @@ Removing instruction jmp __breturn
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b1 with __b1
Removing instruction __breturn:
Removing instruction __breturn:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
const nomodify struct MOS6526_CIA* CIA1 = (struct MOS6526_CIA*) 56320
@ -435,7 +436,7 @@ void main()
FINAL ASSEMBLER
Score: 444
Score: 424
// File Comments
// A raster IRQ that opens the top/bottom border.
@ -484,8 +485,8 @@ Score: 444
// irq_bottom_2
// Interrupt Routine 2
irq_bottom_2: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// VICII->BORDER_COLOR = WHITE
// [0] *((byte*)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
@ -519,15 +520,16 @@ irq_bottom_2: {
// irq_bottom_2::@return
// }
// [6] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// irq_bottom_1
// Interrupt Routine 1
irq_bottom_1: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// VICII->BORDER_COLOR = WHITE
// [7] *((byte*)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
@ -561,8 +563,9 @@ irq_bottom_1: {
// irq_bottom_1::@return
// }
// [13] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main

View File

@ -1112,7 +1112,7 @@ ASSEMBLER BEFORE OPTIMIZATION
// irq
// Raster IRQ routine
irq: {
// interrupt(isr_hardware_all_entry) -- isr_hardware_all_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
pha
phx
phy
@ -1172,7 +1172,7 @@ irq: {
// irq::@return
__breturn:
// [8] return
// interrupt(isr_hardware_all_exit) -- isr_hardware_all_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
plz
ply
plx
@ -1788,7 +1788,7 @@ Score: 3054
// irq
// Raster IRQ routine
irq: {
// interrupt(isr_hardware_all_entry) -- isr_hardware_all_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
pha
phx
phy
@ -1843,7 +1843,7 @@ irq: {
// irq::@return
// }
// [8] return
// interrupt(isr_hardware_all_exit) -- isr_hardware_all_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
plz
ply
plx

View File

@ -2194,7 +2194,7 @@ __start: {
irq: {
.label sin_bar = 3
.label barcnt = 2
// interrupt(isr_hardware_all_entry) -- isr_hardware_all_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
pha
phx
phy
@ -2375,7 +2375,7 @@ irq: {
// irq::@return
__breturn:
// [43] return
// interrupt(isr_hardware_all_exit) -- isr_hardware_all_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
plz
ply
plx
@ -3359,7 +3359,7 @@ __start: {
irq: {
.label sin_bar = 3
.label barcnt = 2
// interrupt(isr_hardware_all_entry) -- isr_hardware_all_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
pha
phx
phy
@ -3537,7 +3537,7 @@ irq: {
__breturn:
// }
// [43] return
// interrupt(isr_hardware_all_exit) -- isr_hardware_all_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
plz
ply
plx

View File

@ -338,7 +338,7 @@ __start: {
}
// nmi2
nmi2: {
// interrupt(isr_hardware_clobay_entry) -- isr_hardware_clobay_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
sty regy+1
// [5] *((byte*)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = ++ *((byte*)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) -- _deref_pbuc1=_inc__deref_pbuc1
@ -386,7 +386,7 @@ nmi2: {
// nmi2::@return
__breturn:
// [15] return
// interrupt(isr_hardware_clobay_exit) -- isr_hardware_clobay_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regy:
@ -395,7 +395,7 @@ nmi2: {
}
// nmi
nmi: {
// interrupt(isr_hardware_clobay_entry) -- isr_hardware_clobay_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
sty regy+1
// [16] *((byte*)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) = ++ *((byte*)VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) -- _deref_pbuc1=_inc__deref_pbuc1
@ -419,7 +419,7 @@ nmi: {
// nmi::@return
__breturn:
// [22] return
// interrupt(isr_hardware_clobay_exit) -- isr_hardware_clobay_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regy:
@ -580,7 +580,7 @@ __start: {
}
// nmi2
nmi2: {
// interrupt(isr_hardware_clobay_entry) -- isr_hardware_clobay_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
sty regy+1
// (VICII->BORDER_COLOR)++;
@ -634,7 +634,7 @@ nmi2: {
// nmi2::@return
// }
// [15] return
// interrupt(isr_hardware_clobay_exit) -- isr_hardware_clobay_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regy:
@ -643,7 +643,7 @@ nmi2: {
}
// nmi
nmi: {
// interrupt(isr_hardware_clobay_entry) -- isr_hardware_clobay_entry
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
sty regy+1
// (VICII->BORDER_COLOR)++;
@ -672,7 +672,7 @@ nmi: {
// nmi::@return
// }
// [22] return
// interrupt(isr_hardware_clobay_exit) -- isr_hardware_clobay_exit
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
regy:

View File

@ -41,11 +41,12 @@
.segment Code
// Interrupt Routine
irq: {
pha
sta rega+1
// do_irq()
jsr do_irq
// }
pla
rega:
lda #0
rti
}
main: {

View File

@ -245,16 +245,17 @@ ASSEMBLER BEFORE OPTIMIZATION
// irq
// Interrupt Routine
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// [1] call do_irq
jsr do_irq
jmp __breturn
// irq::@return
__breturn:
// [2] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main
@ -325,6 +326,7 @@ Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -353,7 +355,7 @@ void main()
FINAL ASSEMBLER
Score: 306
Score: 296
// File Comments
// A minimal working raster hardware IRQ with clobber-based register savings
@ -402,16 +404,17 @@ Score: 306
// irq
// Interrupt Routine
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// do_irq()
// [1] call do_irq
jsr do_irq
// irq::@return
// }
// [2] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main

View File

@ -30,7 +30,7 @@
.segment Code
// Interrupt Routine
irq: {
pha
sta rega+1
// *BG_COLOR = WHITE
lda #WHITE
sta BG_COLOR
@ -42,7 +42,8 @@ irq: {
lda #IRQ_RASTER
sta IRQ_STATUS
// }
pla
rega:
lda #0
rti
}
// RAM in $A000, $E000 CHAR ROM in $D000

View File

@ -198,8 +198,8 @@ ASSEMBLER BEFORE OPTIMIZATION
// irq
// Interrupt Routine
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// [0] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta BG_COLOR
@ -214,8 +214,9 @@ irq: {
// irq::@return
__breturn:
// [3] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main
@ -268,7 +269,7 @@ Removing instruction jmp __breturn
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Succesful ASM optimization Pass5RedundantLabelElimination
FINAL SYMBOL TABLE
const nomodify byte* BG_COLOR = (byte*) 53280
@ -293,7 +294,7 @@ void main()
FINAL ASSEMBLER
Score: 294
Score: 284
// File Comments
// A minimal working raster hardware IRQ with clobber-based register savings
@ -331,8 +332,8 @@ Score: 294
// irq
// Interrupt Routine
irq: {
// interrupt(isr_hardware_cloba_entry) -- isr_hardware_cloba_entry
pha
// interrupt(isr_hardware_clobber_entry) -- isr_hardware_all_entry
sta rega+1
// *BG_COLOR = WHITE
// [0] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
@ -349,8 +350,9 @@ irq: {
// irq::@return
// }
// [3] return
// interrupt(isr_hardware_cloba_exit) -- isr_hardware_cloba_exit
pla
// interrupt(isr_hardware_clobber_exit) -- isr_hardware_all_exit
rega:
lda #0
rti
}
// main