mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-03 12:07:26 +00:00
Added black hole test. Added a bunch of fragments. Added struct member assertion. Added some tests with stuff to fix.
This commit is contained in:
parent
7c4a60aea4
commit
c4d24caa72
@ -0,0 +1,4 @@
|
||||
lda ({z1}),y
|
||||
sec
|
||||
sbc #1
|
||||
sta ({z1}),y
|
@ -0,0 +1,4 @@
|
||||
lda ({z1}),y
|
||||
clc
|
||||
adc #1
|
||||
sta ({z1}),y
|
@ -0,0 +1,7 @@
|
||||
lda {c1},x
|
||||
cmp #<{c2}
|
||||
bne !+
|
||||
lda {c1}+1,x
|
||||
cmp #>{c2}
|
||||
beq {la1}
|
||||
!:
|
@ -0,0 +1,6 @@
|
||||
lda {c1}+1,x
|
||||
cmp #>{c2}
|
||||
bne {la1}
|
||||
lda {c1},x
|
||||
cmp #<{c2}
|
||||
bne {la1}
|
@ -0,0 +1,7 @@
|
||||
lda {c1},y
|
||||
cmp #<{c2}
|
||||
bne !+
|
||||
lda {c1}+1,y
|
||||
cmp #>{c2}
|
||||
beq {la1}
|
||||
!:
|
@ -0,0 +1,6 @@
|
||||
lda {c1}+1,y
|
||||
cmp #>{c2}
|
||||
bne {la1}
|
||||
lda {c1},y
|
||||
cmp #<{c2}
|
||||
bne {la1}
|
@ -0,0 +1,7 @@
|
||||
lda {c1},x
|
||||
clc
|
||||
adc {c1},y
|
||||
sta {z1}
|
||||
lda {c1}+1,x
|
||||
adc {c1}+1,y
|
||||
sta {z1}+1
|
@ -0,0 +1,7 @@
|
||||
lda {c1},x
|
||||
clc
|
||||
adc {c2},y
|
||||
sta {z1}
|
||||
lda {c1}+1,x
|
||||
adc {c2}+1,y
|
||||
sta {z1}+1
|
@ -0,0 +1,7 @@
|
||||
lda {c1},y
|
||||
clc
|
||||
adc {c1},x
|
||||
sta {z1}
|
||||
lda {c1}+1,y
|
||||
adc {c1}+1,x
|
||||
sta {z1}+1
|
@ -0,0 +1,7 @@
|
||||
lda {c1},y
|
||||
clc
|
||||
adc {c2},x
|
||||
sta {z1}
|
||||
lda {c1}+1,y
|
||||
adc {c2}+1,x
|
||||
sta {z1}+1
|
@ -160,6 +160,7 @@ public class Compiler {
|
||||
|
||||
new Pass1GenerateControlFlowGraph(program).execute();
|
||||
new Pass1ResolveForwardReferences(program).execute();
|
||||
new PassNAssertStructMembers(program).execute();
|
||||
new Pass1UnwindBlockScopes(program).execute();
|
||||
new Pass1Procedures(program).execute();
|
||||
new PassNTypeInference(program).execute();
|
||||
|
@ -0,0 +1,42 @@
|
||||
package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.model.CompileError;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.iterator.ProgramValueIterator;
|
||||
import dk.camelot64.kickc.model.symbols.StructDefinition;
|
||||
import dk.camelot64.kickc.model.symbols.Variable;
|
||||
import dk.camelot64.kickc.model.types.SymbolType;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypeInference;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypeStruct;
|
||||
import dk.camelot64.kickc.model.values.StructMemberRef;
|
||||
|
||||
/**
|
||||
* Asserts that all struct references point to members that exist
|
||||
*/
|
||||
public class PassNAssertStructMembers extends Pass2SsaOptimization {
|
||||
|
||||
public PassNAssertStructMembers(Program program) {
|
||||
super(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean step() {
|
||||
ProgramValueIterator.execute(getGraph(), (programValue, currentStmt, stmtIt, currentBlock) -> {
|
||||
if(programValue.get() instanceof StructMemberRef) {
|
||||
StructMemberRef structMemberRef = (StructMemberRef) programValue.get();
|
||||
SymbolType type = SymbolTypeInference.inferType(getScope(), structMemberRef.getStruct());
|
||||
if(type instanceof SymbolTypeStruct) {
|
||||
SymbolTypeStruct structType = (SymbolTypeStruct) type;
|
||||
StructDefinition structDefinition = structType.getStructDefinition(getScope());
|
||||
Variable member = structDefinition.getMember(structMemberRef.getMemberName());
|
||||
if(member==null) {
|
||||
throw new CompileError("Unknown struct member "+structMemberRef.getMemberName()+" in struct "+structType.getTypeName(), currentStmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -35,11 +35,30 @@ public class TestPrograms {
|
||||
public TestPrograms() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlackhole() throws IOException, URISyntaxException {
|
||||
compileAndCompare("complex/blackhole/blackhole");
|
||||
}
|
||||
|
||||
// TODO: Optimize unused IRQ's away (and other unused funtions that reference each other circularly)
|
||||
@Test
|
||||
public void testUnusedIrq() throws IOException, URISyntaxException {
|
||||
compileAndCompare("unused-irq");
|
||||
}
|
||||
|
||||
/** TODO: Fix error with number resolving
|
||||
@Test
|
||||
public void testNumberTernaryFail() throws IOException, URISyntaxException {
|
||||
compileAndCompare("number-ternary-fail");
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testTextbox() throws IOException, URISyntaxException {
|
||||
compileAndCompare("textbox");
|
||||
}
|
||||
/*
|
||||
|
||||
/* TODO: Implemente & / address-of for struct values
|
||||
@Test
|
||||
public void testStructPtr12Ref() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-ptr-12-ref", log());
|
||||
@ -47,7 +66,7 @@ public class TestPrograms {
|
||||
|
||||
@Test
|
||||
public void testStructPtr12() throws IOException, URISyntaxException {
|
||||
compileAndCompare("struct-ptr-12");
|
||||
compileAndCompare("struct-ptr-12", log().verboseCreateSsa().verboseParse().verboseStatementSequence());
|
||||
}
|
||||
*/
|
||||
|
||||
@ -111,6 +130,16 @@ public class TestPrograms {
|
||||
compileAndCompare("struct-ptr-0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructError5() throws IOException, URISyntaxException {
|
||||
assertError("struct-err-5", "Unknown struct member");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructError4() throws IOException, URISyntaxException {
|
||||
assertError("struct-err-4", "Unknown struct member");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructError3() throws IOException, URISyntaxException {
|
||||
assertError("struct-err-3", "Parameters type mismatch in call");
|
||||
|
190
src/test/kc/complex/blackhole/blackhole.kc
Normal file
190
src/test/kc/complex/blackhole/blackhole.kc
Normal file
@ -0,0 +1,190 @@
|
||||
// Black Hole at the center of the BASIC screen sucking in any letters
|
||||
|
||||
import "c64"
|
||||
import "multiply"
|
||||
|
||||
const byte* SCREEN = 0x0400;
|
||||
|
||||
// Copy of the screen used for finding chars to process
|
||||
byte[1000] SCREEN_COPY;
|
||||
|
||||
// Struct holding char being processed
|
||||
struct ProcessingChar {
|
||||
// x-position (0-39)
|
||||
byte x;
|
||||
// y-position (0-24)
|
||||
byte y;
|
||||
// squared distance to center (0-569)
|
||||
word dist;
|
||||
};
|
||||
|
||||
// Distance value meaning not found
|
||||
const word NOT_FOUND = 0xffff;
|
||||
|
||||
void main() {
|
||||
|
||||
// Init processing array
|
||||
for( byte i: 0..7 ) PROCESSING[i] = { 0, 0, NOT_FOUND };
|
||||
|
||||
// Set-up raster interrupts
|
||||
setupRasterIrq(RASTER_IRQ_TOP, &irqTop);
|
||||
|
||||
// Fill screen with some chars
|
||||
for( byte* sc: SCREEN..SCREEN+999) *sc = 'a'+(<sc&0x1f);
|
||||
|
||||
// Copy screen to screen copy
|
||||
for( byte* src=SCREEN, dst=SCREEN_COPY; src!=SCREEN+999; src++, dst++) *dst = *src;
|
||||
|
||||
// Init squares table
|
||||
initSquareTables();
|
||||
|
||||
// Main loop
|
||||
do {
|
||||
// Look for the non-space closest to the screen center
|
||||
struct ProcessingChar center = getCenterChar();
|
||||
if(center.dist==NOT_FOUND)
|
||||
break;
|
||||
startProcessing(center);
|
||||
} while(true);
|
||||
do {
|
||||
(*(SCREEN+999))++;
|
||||
} while (true);
|
||||
|
||||
}
|
||||
|
||||
// Chars currently being processed in the interrupt
|
||||
struct ProcessingChar[8] PROCESSING;
|
||||
|
||||
// Start processing a char - by inserting it into the PROCESSING array
|
||||
void startProcessing(struct ProcessingChar center) {
|
||||
// Busy-wait while finding an empty slot in the PROCESSING array
|
||||
byte freeIdx = 0xff;
|
||||
do {
|
||||
for( byte i: 0..7 ) {
|
||||
if(PROCESSING[i].dist==NOT_FOUND) {
|
||||
freeIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (freeIdx==0xff);
|
||||
|
||||
// Put the char into the PROCESSING array
|
||||
PROCESSING[freeIdx] = center;
|
||||
}
|
||||
|
||||
// Process any chars in the PROCESSING array
|
||||
void processChars() {
|
||||
for( byte i: 0..7 ) {
|
||||
if(PROCESSING[i].dist!=NOT_FOUND) {
|
||||
struct ProcessingChar processing = PROCESSING[i];
|
||||
*(COLS+(word)processing.y*40+processing.x) = WHITE;
|
||||
byte* processing_ptr = SCREEN+(word)processing.y*40+processing.x;
|
||||
if(*processing_ptr==' ')
|
||||
PROCESSING[i].dist = NOT_FOUND;
|
||||
else if(*processing_ptr>' ')
|
||||
(*processing_ptr)--;
|
||||
else // must be <' '
|
||||
(*processing_ptr)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SQUARES_X[i] = (i-20)*(i-20)
|
||||
word[40] SQUARES_X;
|
||||
// SQUARES_Y[i] = (i-12)*(i-12)
|
||||
word[25] SQUARES_Y;
|
||||
|
||||
// initialize SQUARES table
|
||||
void initSquareTables() {
|
||||
for(byte x: 0..39) {
|
||||
byte x_dist = (x<20)?20-x:x-20;
|
||||
SQUARES_X[x] = mul8u(x_dist, x_dist);
|
||||
}
|
||||
for(byte y: 0..24) {
|
||||
byte y_dist = (y<12)?12-y:y-12;
|
||||
SQUARES_Y[y] = mul8u(y_dist, y_dist);
|
||||
}
|
||||
}
|
||||
|
||||
// Find the non-space char closest to the center of the screen
|
||||
// If no non-space char is found the distance will be 0xffff
|
||||
struct ProcessingChar getCenterChar() {
|
||||
struct ProcessingChar closest = { 0, 0, NOT_FOUND };
|
||||
byte* screen_line = SCREEN_COPY;
|
||||
for( byte y: 0..24) {
|
||||
for( byte x: 0..39) {
|
||||
if(screen_line[x]!=' ') {
|
||||
word dist = SQUARES_X[x]+SQUARES_Y[y];
|
||||
if(dist<closest.dist) {
|
||||
// Update closest char
|
||||
closest = { x, y, dist };
|
||||
}
|
||||
}
|
||||
}
|
||||
screen_line += 40;
|
||||
}
|
||||
if(closest.dist != NOT_FOUND) {
|
||||
// clear the found char on the screen copy
|
||||
*(SCREEN_COPY+(word)closest.y*40+closest.x) = ' ';
|
||||
}
|
||||
return closest;
|
||||
}
|
||||
|
||||
|
||||
// Setup Raster IRQ
|
||||
void setupRasterIrq(word raster, void()* irqRoutine) {
|
||||
asm { sei }
|
||||
// Disable kernal & basic
|
||||
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
|
||||
*PROCPORT = PROCPORT_RAM_IO;
|
||||
// Disable CIA 1 Timer IRQ
|
||||
*CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR;
|
||||
if(raster<0x100) {
|
||||
*VIC_CONTROL &=0x7f;
|
||||
} else {
|
||||
*VIC_CONTROL |=0x80;
|
||||
}
|
||||
*RASTER = <raster;
|
||||
// Enable Raster Interrupt
|
||||
*IRQ_ENABLE = IRQ_RASTER;
|
||||
// Set the IRQ routine
|
||||
*HARDWARE_IRQ = irqRoutine;
|
||||
asm { cli }
|
||||
}
|
||||
|
||||
const byte RASTER_IRQ_TOP = 0x30;
|
||||
|
||||
// Raster Interrupt at the top of the screen
|
||||
interrupt(hardware_all) void irqTop() {
|
||||
for( byte i: 0..4) {}
|
||||
*BORDERCOL = WHITE;
|
||||
*BGCOL = WHITE;
|
||||
for( byte i: 0..7) {}
|
||||
*BORDERCOL = LIGHT_BLUE;
|
||||
*BGCOL = BLUE;
|
||||
|
||||
// Trigger IRQ at the middle of the screen
|
||||
*RASTER = RASTER_IRQ_MIDDLE;
|
||||
*HARDWARE_IRQ = &irqBottom;
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
}
|
||||
|
||||
const byte RASTER_IRQ_MIDDLE = 0xff;
|
||||
|
||||
// Raster Interrupt at the middle of the screen
|
||||
interrupt(hardware_all) void irqBottom() {
|
||||
for( byte i: 0..4) {}
|
||||
*BORDERCOL = WHITE;
|
||||
*BGCOL = WHITE;
|
||||
processChars();
|
||||
*BORDERCOL = LIGHT_BLUE;
|
||||
*BGCOL = BLUE;
|
||||
|
||||
|
||||
// Trigger IRQ at the top of the screen
|
||||
*RASTER = RASTER_IRQ_TOP;
|
||||
*HARDWARE_IRQ = &irqTop;
|
||||
// Acknowledge the IRQ
|
||||
*IRQ_STATUS = IRQ_RASTER;
|
||||
}
|
9
src/test/kc/number-ternary-fail.kc
Normal file
9
src/test/kc/number-ternary-fail.kc
Normal file
@ -0,0 +1,9 @@
|
||||
// Failing number type resolving in ternary operator
|
||||
// Currently fails in the ternary operator with number-issues if integer literal is not specified!
|
||||
|
||||
const byte* SCREEN = 0x0400;
|
||||
void main() {
|
||||
for( byte i: 0..40) {
|
||||
SCREEN[i] = (i&1)?0:0x80;
|
||||
}
|
||||
}
|
14
src/test/kc/struct-err-4.kc
Normal file
14
src/test/kc/struct-err-4.kc
Normal file
@ -0,0 +1,14 @@
|
||||
// Access to non-existing member
|
||||
|
||||
struct Point {
|
||||
byte x;
|
||||
byte y;
|
||||
};
|
||||
|
||||
const byte* SCREEN = 0x0400;
|
||||
|
||||
void main() {
|
||||
struct Point p;
|
||||
SCREEN[0] = p.z;
|
||||
}
|
||||
|
16
src/test/kc/struct-err-5.kc
Normal file
16
src/test/kc/struct-err-5.kc
Normal file
@ -0,0 +1,16 @@
|
||||
// Access to non-existing member
|
||||
|
||||
struct Point {
|
||||
byte x;
|
||||
byte y;
|
||||
};
|
||||
|
||||
const byte* SCREEN = 0x0400;
|
||||
|
||||
void main() {
|
||||
struct Point p;
|
||||
do {
|
||||
SCREEN[0] = p.x;
|
||||
} while(p.z!=0xff);
|
||||
}
|
||||
|
19
src/test/kc/unused-irq.kc
Normal file
19
src/test/kc/unused-irq.kc
Normal file
@ -0,0 +1,19 @@
|
||||
// Unused interrupts pointing to each other but never used from main loop - should be optimized away
|
||||
|
||||
const byte* SCREEN = 0x0400;
|
||||
|
||||
void main() {
|
||||
*SCREEN = 'x';
|
||||
}
|
||||
|
||||
const void()** HARDWARE_IRQ = $fffe;
|
||||
|
||||
// Unused Interrupt Routine
|
||||
interrupt void irq1() {
|
||||
*HARDWARE_IRQ = &irq2;
|
||||
}
|
||||
|
||||
// Unused Interrupt Routine
|
||||
interrupt void irq2() {
|
||||
*HARDWARE_IRQ = &irq1;
|
||||
}
|
690
src/test/ref/complex/blackhole/blackhole.asm
Normal file
690
src/test/ref/complex/blackhole/blackhole.asm
Normal file
@ -0,0 +1,690 @@
|
||||
// Black Hole at the center of the BASIC screen sucking in any letters
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.const OFFSET_STRUCT_PROCESSINGCHAR_Y = 1
|
||||
.const OFFSET_STRUCT_PROCESSINGCHAR_DIST = 2
|
||||
// Processor port data direction register
|
||||
.label PROCPORT_DDR = 0
|
||||
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
|
||||
.const PROCPORT_DDR_MEMORY_MASK = 7
|
||||
// Processor Port Register controlling RAM/ROM configuration and the datasette
|
||||
.label PROCPORT = 1
|
||||
// RAM in $A000, $E000 I/O in $D000
|
||||
.const PROCPORT_RAM_IO = $35
|
||||
.label RASTER = $d012
|
||||
.label BORDERCOL = $d020
|
||||
.label BGCOL = $d021
|
||||
.label VIC_CONTROL = $d011
|
||||
// VIC II IRQ Status Register
|
||||
.label IRQ_STATUS = $d019
|
||||
// VIC II IRQ Enable Register
|
||||
.label IRQ_ENABLE = $d01a
|
||||
// Bits for the IRQ Status/Enable Registers
|
||||
.const IRQ_RASTER = 1
|
||||
// Color Ram
|
||||
.label COLS = $d800
|
||||
// CIA#1 Interrupt Status & Control Register
|
||||
.label CIA1_INTERRUPT = $dc0d
|
||||
// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
|
||||
.const CIA_INTERRUPT_CLEAR = $7f
|
||||
// The vector used when the HARDWARE serves IRQ interrupts
|
||||
.label HARDWARE_IRQ = $fffe
|
||||
.const WHITE = 1
|
||||
.const BLUE = 6
|
||||
.const LIGHT_BLUE = $e
|
||||
.label SCREEN = $400
|
||||
// Distance value meaning not found
|
||||
.const NOT_FOUND = $ffff
|
||||
.const RASTER_IRQ_TOP = $30
|
||||
.const RASTER_IRQ_MIDDLE = $ff
|
||||
main: {
|
||||
.label sc = 2
|
||||
.label src = 4
|
||||
.label dst = 6
|
||||
.label center_dist = $11
|
||||
ldx #0
|
||||
// Init processing array
|
||||
b1:
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
lda #0
|
||||
sta PROCESSING,y
|
||||
sta PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_Y,y
|
||||
lda #<NOT_FOUND
|
||||
sta PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST,y
|
||||
lda #>NOT_FOUND
|
||||
sta PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST+1,y
|
||||
inx
|
||||
cpx #8
|
||||
bne b1
|
||||
jsr setupRasterIrq
|
||||
lda #<SCREEN
|
||||
sta sc
|
||||
lda #>SCREEN
|
||||
sta sc+1
|
||||
// Fill screen with some chars
|
||||
b3:
|
||||
lda sc
|
||||
and #$1f
|
||||
clc
|
||||
adc #'a'
|
||||
ldy #0
|
||||
sta (sc),y
|
||||
inc sc
|
||||
bne !+
|
||||
inc sc+1
|
||||
!:
|
||||
lda sc+1
|
||||
cmp #>SCREEN+$3e7+1
|
||||
bne b3
|
||||
lda sc
|
||||
cmp #<SCREEN+$3e7+1
|
||||
bne b3
|
||||
lda #<SCREEN_COPY
|
||||
sta dst
|
||||
lda #>SCREEN_COPY
|
||||
sta dst+1
|
||||
lda #<SCREEN
|
||||
sta src
|
||||
lda #>SCREEN
|
||||
sta src+1
|
||||
// Copy screen to screen copy
|
||||
b4:
|
||||
ldy #0
|
||||
lda (src),y
|
||||
sta (dst),y
|
||||
inc src
|
||||
bne !+
|
||||
inc src+1
|
||||
!:
|
||||
inc dst
|
||||
bne !+
|
||||
inc dst+1
|
||||
!:
|
||||
lda src+1
|
||||
cmp #>SCREEN+$3e7
|
||||
bne b4
|
||||
lda src
|
||||
cmp #<SCREEN+$3e7
|
||||
bne b4
|
||||
jsr initSquareTables
|
||||
b2:
|
||||
// Main loop
|
||||
jsr getCenterChar
|
||||
ldx getCenterChar.return_x
|
||||
ldy getCenterChar.return_y
|
||||
lda center_dist+1
|
||||
cmp #>NOT_FOUND
|
||||
bne b7
|
||||
lda center_dist
|
||||
cmp #<NOT_FOUND
|
||||
bne b7
|
||||
b8:
|
||||
inc SCREEN+$3e7
|
||||
jmp b8
|
||||
b7:
|
||||
stx startProcessing.center_x
|
||||
sty startProcessing.center_y
|
||||
jsr startProcessing
|
||||
jmp b2
|
||||
}
|
||||
// Start processing a char - by inserting it into the PROCESSING array
|
||||
// startProcessing(byte zeropage($19) center_x, byte zeropage($1a) center_y, word zeropage($11) center_dist)
|
||||
startProcessing: {
|
||||
.label center_x = $19
|
||||
.label center_y = $1a
|
||||
.label center_dist = $11
|
||||
.label freeIdx = 8
|
||||
lda #$ff
|
||||
sta freeIdx
|
||||
b1:
|
||||
ldx #0
|
||||
b2:
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
lda PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST+1,y
|
||||
cmp #>NOT_FOUND
|
||||
bne b3
|
||||
lda PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST,y
|
||||
cmp #<NOT_FOUND
|
||||
bne b3
|
||||
b4:
|
||||
cpx #$ff
|
||||
beq b6
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
tax
|
||||
lda center_x
|
||||
sta PROCESSING,x
|
||||
lda center_y
|
||||
sta PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_Y,x
|
||||
lda center_dist
|
||||
sta PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST,x
|
||||
lda center_dist+1
|
||||
sta PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST+1,x
|
||||
rts
|
||||
b6:
|
||||
stx freeIdx
|
||||
jmp b1
|
||||
b3:
|
||||
inx
|
||||
cpx #8
|
||||
bne b2
|
||||
ldx freeIdx
|
||||
jmp b4
|
||||
}
|
||||
// Find the non-space char closest to the center of the screen
|
||||
// If no non-space char is found the distance will be 0xffff
|
||||
getCenterChar: {
|
||||
.label _9 = $1b
|
||||
.label _10 = $1b
|
||||
.label _11 = $1b
|
||||
.label return_dist = $11
|
||||
.label x = $c
|
||||
.label dist = $11
|
||||
.label screen_line = 9
|
||||
.label y = $b
|
||||
.label return_x = $f
|
||||
.label return_y = $10
|
||||
.label closest_dist = $d
|
||||
.label closest_x = $f
|
||||
.label closest_y = $10
|
||||
.label _15 = $1d
|
||||
.label _16 = $1b
|
||||
lda #0
|
||||
sta closest_y
|
||||
sta closest_x
|
||||
lda #<NOT_FOUND
|
||||
sta closest_dist
|
||||
lda #>NOT_FOUND
|
||||
sta closest_dist+1
|
||||
lda #0
|
||||
sta y
|
||||
lda #<SCREEN_COPY
|
||||
sta screen_line
|
||||
lda #>SCREEN_COPY
|
||||
sta screen_line+1
|
||||
b1:
|
||||
lda #0
|
||||
sta x
|
||||
b2:
|
||||
ldy x
|
||||
lda (screen_line),y
|
||||
cmp #' '
|
||||
bne !b11+
|
||||
jmp b11
|
||||
!b11:
|
||||
tya
|
||||
asl
|
||||
tax
|
||||
lda y
|
||||
asl
|
||||
tay
|
||||
lda SQUARES_X,x
|
||||
clc
|
||||
adc SQUARES_Y,y
|
||||
sta dist
|
||||
lda SQUARES_X+1,x
|
||||
adc SQUARES_Y+1,y
|
||||
sta dist+1
|
||||
lda closest_dist+1
|
||||
cmp dist+1
|
||||
bne !+
|
||||
lda closest_dist
|
||||
cmp dist
|
||||
bne !b12+
|
||||
jmp b12
|
||||
!b12:
|
||||
!:
|
||||
bcs !b12+
|
||||
jmp b12
|
||||
!b12:
|
||||
lda x
|
||||
sta return_x
|
||||
lda y
|
||||
sta return_y
|
||||
b3:
|
||||
inc x
|
||||
lda #$28
|
||||
cmp x
|
||||
bne b10
|
||||
clc
|
||||
adc screen_line
|
||||
sta screen_line
|
||||
bcc !+
|
||||
inc screen_line+1
|
||||
!:
|
||||
inc y
|
||||
lda #$19
|
||||
cmp y
|
||||
bne b9
|
||||
lda return_dist
|
||||
cmp #<NOT_FOUND
|
||||
bne !+
|
||||
lda return_dist+1
|
||||
cmp #>NOT_FOUND
|
||||
beq breturn
|
||||
!:
|
||||
lda return_y
|
||||
sta _9
|
||||
lda #0
|
||||
sta _9+1
|
||||
lda _9
|
||||
asl
|
||||
sta _15
|
||||
lda _9+1
|
||||
rol
|
||||
sta _15+1
|
||||
asl _15
|
||||
rol _15+1
|
||||
lda _16
|
||||
clc
|
||||
adc _15
|
||||
sta _16
|
||||
lda _16+1
|
||||
adc _15+1
|
||||
sta _16+1
|
||||
asl _10
|
||||
rol _10+1
|
||||
asl _10
|
||||
rol _10+1
|
||||
asl _10
|
||||
rol _10+1
|
||||
clc
|
||||
lda _11
|
||||
adc #<SCREEN_COPY
|
||||
sta _11
|
||||
lda _11+1
|
||||
adc #>SCREEN_COPY
|
||||
sta _11+1
|
||||
// clear the found char on the screen copy
|
||||
lda #' '
|
||||
ldy return_x
|
||||
sta (_11),y
|
||||
breturn:
|
||||
rts
|
||||
b9:
|
||||
lda return_dist
|
||||
sta closest_dist
|
||||
lda return_dist+1
|
||||
sta closest_dist+1
|
||||
jmp b1
|
||||
b10:
|
||||
lda return_dist
|
||||
sta closest_dist
|
||||
lda return_dist+1
|
||||
sta closest_dist+1
|
||||
jmp b2
|
||||
b12:
|
||||
lda closest_dist
|
||||
sta return_dist
|
||||
lda closest_dist+1
|
||||
sta return_dist+1
|
||||
jmp b3
|
||||
b11:
|
||||
lda closest_dist
|
||||
sta return_dist
|
||||
lda closest_dist+1
|
||||
sta return_dist+1
|
||||
jmp b3
|
||||
}
|
||||
// initialize SQUARES table
|
||||
initSquareTables: {
|
||||
.label _6 = $15
|
||||
.label _14 = $15
|
||||
.label x = $13
|
||||
.label y = $14
|
||||
lda #0
|
||||
sta x
|
||||
b1:
|
||||
lda x
|
||||
cmp #$14
|
||||
bcc b2
|
||||
sec
|
||||
sbc #$14
|
||||
b4:
|
||||
tax
|
||||
sta mul8u.mb
|
||||
lda #0
|
||||
sta mul8u.mb+1
|
||||
jsr mul8u
|
||||
lda x
|
||||
asl
|
||||
tay
|
||||
lda _6
|
||||
sta SQUARES_X,y
|
||||
lda _6+1
|
||||
sta SQUARES_X+1,y
|
||||
inc x
|
||||
lda #$28
|
||||
cmp x
|
||||
bne b1
|
||||
lda #0
|
||||
sta y
|
||||
b5:
|
||||
lda y
|
||||
cmp #$c
|
||||
bcc b6
|
||||
sec
|
||||
sbc #$c
|
||||
b8:
|
||||
tax
|
||||
sta mul8u.mb
|
||||
lda #0
|
||||
sta mul8u.mb+1
|
||||
jsr mul8u
|
||||
lda y
|
||||
asl
|
||||
tay
|
||||
lda _14
|
||||
sta SQUARES_Y,y
|
||||
lda _14+1
|
||||
sta SQUARES_Y+1,y
|
||||
inc y
|
||||
lda #$19
|
||||
cmp y
|
||||
bne b5
|
||||
rts
|
||||
b6:
|
||||
lda #$c
|
||||
sec
|
||||
sbc y
|
||||
jmp b8
|
||||
b2:
|
||||
lda #$14
|
||||
sec
|
||||
sbc x
|
||||
jmp b4
|
||||
}
|
||||
// Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word
|
||||
// mul8u(byte register(X) a, byte register(A) b)
|
||||
mul8u: {
|
||||
.label mb = $17
|
||||
.label res = $15
|
||||
.label return = $15
|
||||
lda #0
|
||||
sta res
|
||||
sta res+1
|
||||
b1:
|
||||
cpx #0
|
||||
bne b2
|
||||
rts
|
||||
b2:
|
||||
txa
|
||||
and #1
|
||||
cmp #0
|
||||
beq b3
|
||||
lda res
|
||||
clc
|
||||
adc mb
|
||||
sta res
|
||||
lda res+1
|
||||
adc mb+1
|
||||
sta res+1
|
||||
b3:
|
||||
txa
|
||||
lsr
|
||||
tax
|
||||
asl mb
|
||||
rol mb+1
|
||||
jmp b1
|
||||
}
|
||||
// Setup Raster IRQ
|
||||
setupRasterIrq: {
|
||||
.label irqRoutine = irqTop
|
||||
sei
|
||||
// Disable kernal & basic
|
||||
lda #PROCPORT_DDR_MEMORY_MASK
|
||||
sta PROCPORT_DDR
|
||||
lda #PROCPORT_RAM_IO
|
||||
sta PROCPORT
|
||||
// Disable CIA 1 Timer IRQ
|
||||
lda #CIA_INTERRUPT_CLEAR
|
||||
sta CIA1_INTERRUPT
|
||||
lda #$7f
|
||||
and VIC_CONTROL
|
||||
sta VIC_CONTROL
|
||||
lda #RASTER_IRQ_TOP
|
||||
sta RASTER
|
||||
// Enable Raster Interrupt
|
||||
lda #IRQ_RASTER
|
||||
sta IRQ_ENABLE
|
||||
// Set the IRQ routine
|
||||
lda #<irqRoutine
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irqRoutine
|
||||
sta HARDWARE_IRQ+1
|
||||
cli
|
||||
rts
|
||||
}
|
||||
// Raster Interrupt at the middle of the screen
|
||||
irqBottom: {
|
||||
sta rega+1
|
||||
stx regx+1
|
||||
sty regy+1
|
||||
ldx #0
|
||||
b1:
|
||||
inx
|
||||
cpx #5
|
||||
bne b1
|
||||
lda #WHITE
|
||||
sta BORDERCOL
|
||||
sta BGCOL
|
||||
jsr processChars
|
||||
lda #LIGHT_BLUE
|
||||
sta BORDERCOL
|
||||
lda #BLUE
|
||||
sta BGCOL
|
||||
// Trigger IRQ at the top of the screen
|
||||
lda #RASTER_IRQ_TOP
|
||||
sta RASTER
|
||||
lda #<irqTop
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irqTop
|
||||
sta HARDWARE_IRQ+1
|
||||
// Acknowledge the IRQ
|
||||
lda #IRQ_RASTER
|
||||
sta IRQ_STATUS
|
||||
rega:
|
||||
lda #00
|
||||
regx:
|
||||
ldx #00
|
||||
regy:
|
||||
ldy #00
|
||||
rti
|
||||
}
|
||||
// Process any chars in the PROCESSING array
|
||||
processChars: {
|
||||
.label _2 = $21
|
||||
.label _3 = $21
|
||||
.label _4 = $21
|
||||
.label _6 = $25
|
||||
.label _7 = $25
|
||||
.label _8 = $25
|
||||
.label processing_x = $1f
|
||||
.label processing_y = $20
|
||||
.label _21 = $23
|
||||
.label _22 = $21
|
||||
.label _24 = $27
|
||||
.label _25 = $25
|
||||
ldx #0
|
||||
b1:
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
lda PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST,y
|
||||
cmp #<NOT_FOUND
|
||||
bne !+
|
||||
lda PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST+1,y
|
||||
cmp #>NOT_FOUND
|
||||
bne !b2+
|
||||
jmp b2
|
||||
!b2:
|
||||
!:
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
lda PROCESSING,y
|
||||
sta processing_x
|
||||
lda PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_Y,y
|
||||
sta processing_y
|
||||
sta _2
|
||||
lda #0
|
||||
sta _2+1
|
||||
lda _2
|
||||
asl
|
||||
sta _21
|
||||
lda _2+1
|
||||
rol
|
||||
sta _21+1
|
||||
asl _21
|
||||
rol _21+1
|
||||
lda _22
|
||||
clc
|
||||
adc _21
|
||||
sta _22
|
||||
lda _22+1
|
||||
adc _21+1
|
||||
sta _22+1
|
||||
asl _3
|
||||
rol _3+1
|
||||
asl _3
|
||||
rol _3+1
|
||||
asl _3
|
||||
rol _3+1
|
||||
clc
|
||||
lda _4
|
||||
adc #<COLS
|
||||
sta _4
|
||||
lda _4+1
|
||||
adc #>COLS
|
||||
sta _4+1
|
||||
lda #WHITE
|
||||
ldy processing_x
|
||||
sta (_4),y
|
||||
lda processing_y
|
||||
sta _6
|
||||
lda #0
|
||||
sta _6+1
|
||||
lda _6
|
||||
asl
|
||||
sta _24
|
||||
lda _6+1
|
||||
rol
|
||||
sta _24+1
|
||||
asl _24
|
||||
rol _24+1
|
||||
lda _25
|
||||
clc
|
||||
adc _24
|
||||
sta _25
|
||||
lda _25+1
|
||||
adc _24+1
|
||||
sta _25+1
|
||||
asl _7
|
||||
rol _7+1
|
||||
asl _7
|
||||
rol _7+1
|
||||
asl _7
|
||||
rol _7+1
|
||||
clc
|
||||
lda _8
|
||||
adc #<SCREEN
|
||||
sta _8
|
||||
lda _8+1
|
||||
adc #>SCREEN
|
||||
sta _8+1
|
||||
lda (_8),y
|
||||
cmp #' '
|
||||
beq b3
|
||||
lda (_8),y
|
||||
cmp #' '
|
||||
beq !+
|
||||
bcs b4
|
||||
!:
|
||||
ldy processing_x
|
||||
lda (_8),y
|
||||
clc
|
||||
adc #1
|
||||
sta (_8),y
|
||||
b2:
|
||||
inx
|
||||
cpx #8
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b1:
|
||||
rts
|
||||
b4:
|
||||
ldy processing_x
|
||||
lda (_8),y
|
||||
sec
|
||||
sbc #1
|
||||
sta (_8),y
|
||||
jmp b2
|
||||
b3:
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
lda #<NOT_FOUND
|
||||
sta PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST,y
|
||||
lda #>NOT_FOUND
|
||||
sta PROCESSING+OFFSET_STRUCT_PROCESSINGCHAR_DIST+1,y
|
||||
jmp b2
|
||||
}
|
||||
// Raster Interrupt at the top of the screen
|
||||
irqTop: {
|
||||
sta rega+1
|
||||
stx regx+1
|
||||
sty regy+1
|
||||
ldx #0
|
||||
b1:
|
||||
inx
|
||||
cpx #5
|
||||
bne b1
|
||||
lda #WHITE
|
||||
sta BORDERCOL
|
||||
sta BGCOL
|
||||
ldx #0
|
||||
b3:
|
||||
inx
|
||||
cpx #8
|
||||
bne b3
|
||||
lda #LIGHT_BLUE
|
||||
sta BORDERCOL
|
||||
lda #BLUE
|
||||
sta BGCOL
|
||||
// Trigger IRQ at the middle of the screen
|
||||
lda #RASTER_IRQ_MIDDLE
|
||||
sta RASTER
|
||||
lda #<irqBottom
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irqBottom
|
||||
sta HARDWARE_IRQ+1
|
||||
// Acknowledge the IRQ
|
||||
lda #IRQ_RASTER
|
||||
sta IRQ_STATUS
|
||||
rega:
|
||||
lda #00
|
||||
regx:
|
||||
ldx #00
|
||||
regy:
|
||||
ldy #00
|
||||
rti
|
||||
}
|
||||
// Copy of the screen used for finding chars to process
|
||||
SCREEN_COPY: .fill $3e8, 0
|
||||
// Chars currently being processed in the interrupt
|
||||
PROCESSING: .fill 4*8, 0
|
||||
// SQUARES_X[i] = (i-20)*(i-20)
|
||||
SQUARES_X: .fill 2*$28, 0
|
||||
// SQUARES_Y[i] = (i-12)*(i-12)
|
||||
SQUARES_Y: .fill 2*$19, 0
|
359
src/test/ref/complex/blackhole/blackhole.cfg
Normal file
359
src/test/ref/complex/blackhole/blackhole.cfg
Normal file
@ -0,0 +1,359 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi()
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] phi()
|
||||
[2] call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
[3] phi()
|
||||
main: scope:[main] from @1
|
||||
[4] phi()
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@1
|
||||
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
|
||||
[6] (byte~) main::$18 ← (byte) main::i#2 << (byte) 2
|
||||
[7] *((byte*)(const struct ProcessingChar[8]) PROCESSING#0 + (byte~) main::$18) ← (byte) 0
|
||||
[8] *((byte*)(const struct ProcessingChar[8]) PROCESSING#0+(const byte) OFFSET_STRUCT_PROCESSINGCHAR_Y + (byte~) main::$18) ← (byte) 0
|
||||
[9] *((word*)(const struct ProcessingChar[8]) PROCESSING#0+(const byte) OFFSET_STRUCT_PROCESSINGCHAR_DIST + (byte~) main::$18) ← (const word) NOT_FOUND#0
|
||||
[10] (byte) main::i#1 ← ++ (byte) main::i#2
|
||||
[11] if((byte) main::i#1!=(byte) 8) goto main::@1
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
[12] phi()
|
||||
[13] call setupRasterIrq
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2 main::@3
|
||||
[14] (byte*) main::sc#2 ← phi( main::@2/(const byte*) SCREEN#0 main::@3/(byte*) main::sc#1 )
|
||||
[15] (byte~) main::$5 ← < (byte*) main::sc#2
|
||||
[16] (byte~) main::$6 ← (byte~) main::$5 & (byte) $1f
|
||||
[17] (byte~) main::$7 ← (byte) 'a' + (byte~) main::$6
|
||||
[18] *((byte*) main::sc#2) ← (byte~) main::$7
|
||||
[19] (byte*) main::sc#1 ← ++ (byte*) main::sc#2
|
||||
[20] if((byte*) main::sc#1!=(const byte*) SCREEN#0+(word) $3e7+(byte) 1) goto main::@3
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3 main::@4
|
||||
[21] (byte*) main::dst#2 ← phi( main::@3/(const byte[$3e8]) SCREEN_COPY#0 main::@4/(byte*) main::dst#1 )
|
||||
[21] (byte*) main::src#2 ← phi( main::@3/(const byte*) SCREEN#0 main::@4/(byte*) main::src#1 )
|
||||
[22] *((byte*) main::dst#2) ← *((byte*) main::src#2)
|
||||
[23] (byte*) main::src#1 ← ++ (byte*) main::src#2
|
||||
[24] (byte*) main::dst#1 ← ++ (byte*) main::dst#2
|
||||
[25] if((byte*) main::src#1!=(const byte*) SCREEN#0+(word) $3e7) goto main::@4
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@4
|
||||
[26] phi()
|
||||
[27] call initSquareTables
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@5 main::@7
|
||||
[28] phi()
|
||||
[29] call getCenterChar
|
||||
[30] (byte) getCenterChar::return_x#0 ← (byte) getCenterChar::return_x#1
|
||||
[31] (byte) getCenterChar::return_y#0 ← (byte) getCenterChar::return_y#1
|
||||
[32] (word) getCenterChar::return_dist#0 ← (word) getCenterChar::return_dist#1
|
||||
to:main::@9
|
||||
main::@9: scope:[main] from main::@6
|
||||
[33] (byte) main::center_x#0 ← (byte) getCenterChar::return_x#0
|
||||
[34] (byte) main::center_y#0 ← (byte) getCenterChar::return_y#0
|
||||
[35] (word) main::center_dist#0 ← (word) getCenterChar::return_dist#0
|
||||
[36] if((word) main::center_dist#0!=(const word) NOT_FOUND#0) goto main::@7
|
||||
to:main::@8
|
||||
main::@8: scope:[main] from main::@8 main::@9
|
||||
[37] *((const byte*) SCREEN#0+(word) $3e7) ← ++ *((const byte*) SCREEN#0+(word) $3e7)
|
||||
to:main::@8
|
||||
main::@7: scope:[main] from main::@9
|
||||
[38] (byte) startProcessing::center_x#0 ← (byte) main::center_x#0
|
||||
[39] (byte) startProcessing::center_y#0 ← (byte) main::center_y#0
|
||||
[40] (word) startProcessing::center_dist#0 ← (word) main::center_dist#0
|
||||
[41] call startProcessing
|
||||
to:main::@6
|
||||
startProcessing: scope:[startProcessing] from main::@7
|
||||
[42] phi()
|
||||
to:startProcessing::@1
|
||||
startProcessing::@1: scope:[startProcessing] from startProcessing startProcessing::@6
|
||||
[43] (byte) startProcessing::freeIdx#6 ← phi( startProcessing/(byte) $ff startProcessing::@6/(byte~) startProcessing::freeIdx#7 )
|
||||
to:startProcessing::@2
|
||||
startProcessing::@2: scope:[startProcessing] from startProcessing::@1 startProcessing::@3
|
||||
[44] (byte) startProcessing::i#2 ← phi( startProcessing::@1/(byte) 0 startProcessing::@3/(byte) startProcessing::i#1 )
|
||||
[45] (byte~) startProcessing::$4 ← (byte) startProcessing::i#2 << (byte) 2
|
||||
[46] if(*((word*)(const struct ProcessingChar[8]) PROCESSING#0+(const byte) OFFSET_STRUCT_PROCESSINGCHAR_DIST + (byte~) startProcessing::$4)!=(const word) NOT_FOUND#0) goto startProcessing::@3
|
||||
to:startProcessing::@4
|
||||
startProcessing::@4: scope:[startProcessing] from startProcessing::@2 startProcessing::@7
|
||||
[47] (byte) startProcessing::freeIdx#2 ← phi( startProcessing::@7/(byte~) startProcessing::freeIdx#8 startProcessing::@2/(byte) startProcessing::i#2 )
|
||||
[48] if((byte) startProcessing::freeIdx#2==(byte) $ff) goto startProcessing::@6
|
||||
to:startProcessing::@5
|
||||
startProcessing::@5: scope:[startProcessing] from startProcessing::@4
|
||||
[49] (byte~) startProcessing::$5 ← (byte) startProcessing::freeIdx#2 << (byte) 2
|
||||
[50] *((byte*)(const struct ProcessingChar[8]) PROCESSING#0 + (byte~) startProcessing::$5) ← (byte) startProcessing::center_x#0
|
||||
[51] *((byte*)(const struct ProcessingChar[8]) PROCESSING#0+(const byte) OFFSET_STRUCT_PROCESSINGCHAR_Y + (byte~) startProcessing::$5) ← (byte) startProcessing::center_y#0
|
||||
[52] *((word*)(const struct ProcessingChar[8]) PROCESSING#0+(const byte) OFFSET_STRUCT_PROCESSINGCHAR_DIST + (byte~) startProcessing::$5) ← (word) startProcessing::center_dist#0
|
||||
to:startProcessing::@return
|
||||
startProcessing::@return: scope:[startProcessing] from startProcessing::@5
|
||||
[53] return
|
||||
to:@return
|
||||
startProcessing::@6: scope:[startProcessing] from startProcessing::@4
|
||||
[54] (byte~) startProcessing::freeIdx#7 ← (byte) startProcessing::freeIdx#2
|
||||
to:startProcessing::@1
|
||||
startProcessing::@3: scope:[startProcessing] from startProcessing::@2
|
||||
[55] (byte) startProcessing::i#1 ← ++ (byte) startProcessing::i#2
|
||||
[56] if((byte) startProcessing::i#1!=(byte) 8) goto startProcessing::@2
|
||||
to:startProcessing::@7
|
||||
startProcessing::@7: scope:[startProcessing] from startProcessing::@3
|
||||
[57] (byte~) startProcessing::freeIdx#8 ← (byte) startProcessing::freeIdx#6
|
||||
to:startProcessing::@4
|
||||
getCenterChar: scope:[getCenterChar] from main::@6
|
||||
[58] phi()
|
||||
to:getCenterChar::@1
|
||||
getCenterChar::@1: scope:[getCenterChar] from getCenterChar getCenterChar::@9
|
||||
[59] (byte) getCenterChar::closest_y#9 ← phi( getCenterChar/(byte) 0 getCenterChar::@9/(byte) getCenterChar::return_y#1 )
|
||||
[59] (byte) getCenterChar::closest_x#9 ← phi( getCenterChar/(byte) 0 getCenterChar::@9/(byte) getCenterChar::return_x#1 )
|
||||
[59] (word) getCenterChar::closest_dist#8 ← phi( getCenterChar/(const word) NOT_FOUND#0 getCenterChar::@9/(word~) getCenterChar::closest_dist#10 )
|
||||
[59] (byte) getCenterChar::y#7 ← phi( getCenterChar/(byte) 0 getCenterChar::@9/(byte) getCenterChar::y#1 )
|
||||
[59] (byte*) getCenterChar::screen_line#4 ← phi( getCenterChar/(const byte[$3e8]) SCREEN_COPY#0 getCenterChar::@9/(byte*) getCenterChar::screen_line#1 )
|
||||
to:getCenterChar::@2
|
||||
getCenterChar::@2: scope:[getCenterChar] from getCenterChar::@1 getCenterChar::@10
|
||||
[60] (byte) getCenterChar::closest_y#7 ← phi( getCenterChar::@1/(byte) getCenterChar::closest_y#9 getCenterChar::@10/(byte) getCenterChar::return_y#1 )
|
||||
[60] (byte) getCenterChar::closest_x#7 ← phi( getCenterChar::@1/(byte) getCenterChar::closest_x#9 getCenterChar::@10/(byte) getCenterChar::return_x#1 )
|
||||
[60] (word) getCenterChar::closest_dist#2 ← phi( getCenterChar::@1/(word) getCenterChar::closest_dist#8 getCenterChar::@10/(word~) getCenterChar::closest_dist#12 )
|
||||
[60] (byte) getCenterChar::x#2 ← phi( getCenterChar::@1/(byte) 0 getCenterChar::@10/(byte) getCenterChar::x#1 )
|
||||
[61] if(*((byte*) getCenterChar::screen_line#4 + (byte) getCenterChar::x#2)==(byte) ' ') goto getCenterChar::@11
|
||||
to:getCenterChar::@4
|
||||
getCenterChar::@4: scope:[getCenterChar] from getCenterChar::@2
|
||||
[62] (byte~) getCenterChar::$13 ← (byte) getCenterChar::x#2 << (byte) 1
|
||||
[63] (byte~) getCenterChar::$14 ← (byte) getCenterChar::y#7 << (byte) 1
|
||||
[64] (word) getCenterChar::dist#0 ← *((const word[$28]) SQUARES_X#0 + (byte~) getCenterChar::$13) + *((const word[$19]) SQUARES_Y#0 + (byte~) getCenterChar::$14)
|
||||
[65] if((word) getCenterChar::dist#0>=(word) getCenterChar::closest_dist#2) goto getCenterChar::@12
|
||||
to:getCenterChar::@5
|
||||
getCenterChar::@5: scope:[getCenterChar] from getCenterChar::@4
|
||||
[66] (byte~) getCenterChar::return_x#7 ← (byte) getCenterChar::x#2
|
||||
[67] (byte~) getCenterChar::return_y#7 ← (byte) getCenterChar::y#7
|
||||
to:getCenterChar::@3
|
||||
getCenterChar::@3: scope:[getCenterChar] from getCenterChar::@11 getCenterChar::@12 getCenterChar::@5
|
||||
[68] (byte) getCenterChar::return_y#1 ← phi( getCenterChar::@11/(byte) getCenterChar::closest_y#7 getCenterChar::@12/(byte) getCenterChar::closest_y#7 getCenterChar::@5/(byte~) getCenterChar::return_y#7 )
|
||||
[68] (byte) getCenterChar::return_x#1 ← phi( getCenterChar::@11/(byte) getCenterChar::closest_x#7 getCenterChar::@12/(byte) getCenterChar::closest_x#7 getCenterChar::@5/(byte~) getCenterChar::return_x#7 )
|
||||
[68] (word) getCenterChar::return_dist#1 ← phi( getCenterChar::@11/(word~) getCenterChar::return_dist#5 getCenterChar::@12/(word~) getCenterChar::return_dist#6 getCenterChar::@5/(word) getCenterChar::dist#0 )
|
||||
[69] (byte) getCenterChar::x#1 ← ++ (byte) getCenterChar::x#2
|
||||
[70] if((byte) getCenterChar::x#1!=(byte) $28) goto getCenterChar::@10
|
||||
to:getCenterChar::@6
|
||||
getCenterChar::@6: scope:[getCenterChar] from getCenterChar::@3
|
||||
[71] (byte*) getCenterChar::screen_line#1 ← (byte*) getCenterChar::screen_line#4 + (byte) $28
|
||||
[72] (byte) getCenterChar::y#1 ← ++ (byte) getCenterChar::y#7
|
||||
[73] if((byte) getCenterChar::y#1!=(byte) $19) goto getCenterChar::@9
|
||||
to:getCenterChar::@7
|
||||
getCenterChar::@7: scope:[getCenterChar] from getCenterChar::@6
|
||||
[74] if((word) getCenterChar::return_dist#1==(const word) NOT_FOUND#0) goto getCenterChar::@return
|
||||
to:getCenterChar::@8
|
||||
getCenterChar::@8: scope:[getCenterChar] from getCenterChar::@7
|
||||
[75] (word~) getCenterChar::$9 ← (word)(byte) getCenterChar::return_y#1
|
||||
[76] (word) getCenterChar::$15 ← (word~) getCenterChar::$9 << (byte) 2
|
||||
[77] (word) getCenterChar::$16 ← (word) getCenterChar::$15 + (word~) getCenterChar::$9
|
||||
[78] (word~) getCenterChar::$10 ← (word) getCenterChar::$16 << (byte) 3
|
||||
[79] (byte*~) getCenterChar::$11 ← (const byte[$3e8]) SCREEN_COPY#0 + (word~) getCenterChar::$10
|
||||
[80] *((byte*~) getCenterChar::$11 + (byte) getCenterChar::return_x#1) ← (byte) ' '
|
||||
to:getCenterChar::@return
|
||||
getCenterChar::@return: scope:[getCenterChar] from getCenterChar::@7 getCenterChar::@8
|
||||
[81] return
|
||||
to:@return
|
||||
getCenterChar::@9: scope:[getCenterChar] from getCenterChar::@6
|
||||
[82] (word~) getCenterChar::closest_dist#10 ← (word) getCenterChar::return_dist#1
|
||||
to:getCenterChar::@1
|
||||
getCenterChar::@10: scope:[getCenterChar] from getCenterChar::@3
|
||||
[83] (word~) getCenterChar::closest_dist#12 ← (word) getCenterChar::return_dist#1
|
||||
to:getCenterChar::@2
|
||||
getCenterChar::@12: scope:[getCenterChar] from getCenterChar::@4
|
||||
[84] (word~) getCenterChar::return_dist#6 ← (word) getCenterChar::closest_dist#2
|
||||
to:getCenterChar::@3
|
||||
getCenterChar::@11: scope:[getCenterChar] from getCenterChar::@2
|
||||
[85] (word~) getCenterChar::return_dist#5 ← (word) getCenterChar::closest_dist#2
|
||||
to:getCenterChar::@3
|
||||
initSquareTables: scope:[initSquareTables] from main::@5
|
||||
[86] phi()
|
||||
to:initSquareTables::@1
|
||||
initSquareTables::@1: scope:[initSquareTables] from initSquareTables initSquareTables::@9
|
||||
[87] (byte) initSquareTables::x#2 ← phi( initSquareTables/(byte) 0 initSquareTables::@9/(byte) initSquareTables::x#1 )
|
||||
[88] if((byte) initSquareTables::x#2<(byte) $14) goto initSquareTables::@2
|
||||
to:initSquareTables::@3
|
||||
initSquareTables::@3: scope:[initSquareTables] from initSquareTables::@1
|
||||
[89] (byte~) initSquareTables::$2 ← (byte) initSquareTables::x#2 - (byte) $14
|
||||
to:initSquareTables::@4
|
||||
initSquareTables::@4: scope:[initSquareTables] from initSquareTables::@2 initSquareTables::@3
|
||||
[90] (byte) initSquareTables::x_dist#0 ← phi( initSquareTables::@2/(byte~) initSquareTables::$4 initSquareTables::@3/(byte~) initSquareTables::$2 )
|
||||
[91] (byte) mul8u::a#1 ← (byte) initSquareTables::x_dist#0
|
||||
[92] (byte) mul8u::b#0 ← (byte) initSquareTables::x_dist#0
|
||||
[93] call mul8u
|
||||
[94] (word) mul8u::return#2 ← (word) mul8u::res#2
|
||||
to:initSquareTables::@9
|
||||
initSquareTables::@9: scope:[initSquareTables] from initSquareTables::@4
|
||||
[95] (word~) initSquareTables::$6 ← (word) mul8u::return#2
|
||||
[96] (byte~) initSquareTables::$16 ← (byte) initSquareTables::x#2 << (byte) 1
|
||||
[97] *((const word[$28]) SQUARES_X#0 + (byte~) initSquareTables::$16) ← (word~) initSquareTables::$6
|
||||
[98] (byte) initSquareTables::x#1 ← ++ (byte) initSquareTables::x#2
|
||||
[99] if((byte) initSquareTables::x#1!=(byte) $28) goto initSquareTables::@1
|
||||
to:initSquareTables::@5
|
||||
initSquareTables::@5: scope:[initSquareTables] from initSquareTables::@10 initSquareTables::@9
|
||||
[100] (byte) initSquareTables::y#2 ← phi( initSquareTables::@10/(byte) initSquareTables::y#1 initSquareTables::@9/(byte) 0 )
|
||||
[101] if((byte) initSquareTables::y#2<(byte) $c) goto initSquareTables::@6
|
||||
to:initSquareTables::@7
|
||||
initSquareTables::@7: scope:[initSquareTables] from initSquareTables::@5
|
||||
[102] (byte~) initSquareTables::$10 ← (byte) initSquareTables::y#2 - (byte) $c
|
||||
to:initSquareTables::@8
|
||||
initSquareTables::@8: scope:[initSquareTables] from initSquareTables::@6 initSquareTables::@7
|
||||
[103] (byte) initSquareTables::y_dist#0 ← phi( initSquareTables::@6/(byte~) initSquareTables::$12 initSquareTables::@7/(byte~) initSquareTables::$10 )
|
||||
[104] (byte) mul8u::a#2 ← (byte) initSquareTables::y_dist#0
|
||||
[105] (byte) mul8u::b#1 ← (byte) initSquareTables::y_dist#0
|
||||
[106] call mul8u
|
||||
[107] (word) mul8u::return#3 ← (word) mul8u::res#2
|
||||
to:initSquareTables::@10
|
||||
initSquareTables::@10: scope:[initSquareTables] from initSquareTables::@8
|
||||
[108] (word~) initSquareTables::$14 ← (word) mul8u::return#3
|
||||
[109] (byte~) initSquareTables::$17 ← (byte) initSquareTables::y#2 << (byte) 1
|
||||
[110] *((const word[$19]) SQUARES_Y#0 + (byte~) initSquareTables::$17) ← (word~) initSquareTables::$14
|
||||
[111] (byte) initSquareTables::y#1 ← ++ (byte) initSquareTables::y#2
|
||||
[112] if((byte) initSquareTables::y#1!=(byte) $19) goto initSquareTables::@5
|
||||
to:initSquareTables::@return
|
||||
initSquareTables::@return: scope:[initSquareTables] from initSquareTables::@10
|
||||
[113] return
|
||||
to:@return
|
||||
initSquareTables::@6: scope:[initSquareTables] from initSquareTables::@5
|
||||
[114] (byte~) initSquareTables::$12 ← (byte) $c - (byte) initSquareTables::y#2
|
||||
to:initSquareTables::@8
|
||||
initSquareTables::@2: scope:[initSquareTables] from initSquareTables::@1
|
||||
[115] (byte~) initSquareTables::$4 ← (byte) $14 - (byte) initSquareTables::x#2
|
||||
to:initSquareTables::@4
|
||||
mul8u: scope:[mul8u] from initSquareTables::@4 initSquareTables::@8
|
||||
[116] (byte) mul8u::a#6 ← phi( initSquareTables::@8/(byte) mul8u::a#2 initSquareTables::@4/(byte) mul8u::a#1 )
|
||||
[116] (word) mul8u::mb#0 ← phi( initSquareTables::@8/(byte) mul8u::b#1 initSquareTables::@4/(byte) mul8u::b#0 )
|
||||
to:mul8u::@1
|
||||
mul8u::@1: scope:[mul8u] from mul8u mul8u::@3
|
||||
[117] (word) mul8u::mb#2 ← phi( mul8u/(word) mul8u::mb#0 mul8u::@3/(word) mul8u::mb#1 )
|
||||
[117] (word) mul8u::res#2 ← phi( mul8u/(byte) 0 mul8u::@3/(word) mul8u::res#6 )
|
||||
[117] (byte) mul8u::a#3 ← phi( mul8u/(byte) mul8u::a#6 mul8u::@3/(byte) mul8u::a#0 )
|
||||
[118] if((byte) mul8u::a#3!=(byte) 0) goto mul8u::@2
|
||||
to:mul8u::@return
|
||||
mul8u::@return: scope:[mul8u] from mul8u::@1
|
||||
[119] return
|
||||
to:@return
|
||||
mul8u::@2: scope:[mul8u] from mul8u::@1
|
||||
[120] (byte~) mul8u::$1 ← (byte) mul8u::a#3 & (byte) 1
|
||||
[121] if((byte~) mul8u::$1==(byte) 0) goto mul8u::@3
|
||||
to:mul8u::@4
|
||||
mul8u::@4: scope:[mul8u] from mul8u::@2
|
||||
[122] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2
|
||||
to:mul8u::@3
|
||||
mul8u::@3: scope:[mul8u] from mul8u::@2 mul8u::@4
|
||||
[123] (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#2 mul8u::@4/(word) mul8u::res#1 )
|
||||
[124] (byte) mul8u::a#0 ← (byte) mul8u::a#3 >> (byte) 1
|
||||
[125] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte) 1
|
||||
to:mul8u::@1
|
||||
setupRasterIrq: scope:[setupRasterIrq] from main::@2
|
||||
asm { sei }
|
||||
[127] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0
|
||||
[128] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0
|
||||
[129] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0
|
||||
to:setupRasterIrq::@1
|
||||
setupRasterIrq::@1: scope:[setupRasterIrq] from setupRasterIrq
|
||||
[130] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte) $7f
|
||||
to:setupRasterIrq::@2
|
||||
setupRasterIrq::@2: scope:[setupRasterIrq] from setupRasterIrq::@1
|
||||
[131] *((const byte*) RASTER#0) ← <(const byte) RASTER_IRQ_TOP#0
|
||||
[132] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0
|
||||
[133] *((const void()**) HARDWARE_IRQ#0) ← (const void()*) setupRasterIrq::irqRoutine#0
|
||||
asm { cli }
|
||||
to:setupRasterIrq::@return
|
||||
setupRasterIrq::@return: scope:[setupRasterIrq] from setupRasterIrq::@2
|
||||
[135] return
|
||||
to:@return
|
||||
irqBottom: scope:[irqBottom] from
|
||||
[136] phi()
|
||||
to:irqBottom::@1
|
||||
irqBottom::@1: scope:[irqBottom] from irqBottom irqBottom::@1
|
||||
[137] (byte) irqBottom::i#2 ← phi( irqBottom/(byte) 0 irqBottom::@1/(byte) irqBottom::i#1 )
|
||||
[138] (byte) irqBottom::i#1 ← ++ (byte) irqBottom::i#2
|
||||
[139] if((byte) irqBottom::i#1!=(byte) 5) goto irqBottom::@1
|
||||
to:irqBottom::@2
|
||||
irqBottom::@2: scope:[irqBottom] from irqBottom::@1
|
||||
[140] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0
|
||||
[141] *((const byte*) BGCOL#0) ← (const byte) WHITE#0
|
||||
[142] call processChars
|
||||
to:irqBottom::@3
|
||||
irqBottom::@3: scope:[irqBottom] from irqBottom::@2
|
||||
[143] *((const byte*) BORDERCOL#0) ← (const byte) LIGHT_BLUE#0
|
||||
[144] *((const byte*) BGCOL#0) ← (const byte) BLUE#0
|
||||
[145] *((const byte*) RASTER#0) ← (const byte) RASTER_IRQ_TOP#0
|
||||
[146] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_ALL)(void()) irqTop()
|
||||
[147] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0
|
||||
to:irqBottom::@return
|
||||
irqBottom::@return: scope:[irqBottom] from irqBottom::@3
|
||||
[148] return
|
||||
to:@return
|
||||
processChars: scope:[processChars] from irqBottom::@2
|
||||
[149] phi()
|
||||
to:processChars::@1
|
||||
processChars::@1: scope:[processChars] from processChars processChars::@2
|
||||
[150] (byte) processChars::i#2 ← phi( processChars/(byte) 0 processChars::@2/(byte) processChars::i#1 )
|
||||
[151] (byte~) processChars::$13 ← (byte) processChars::i#2 << (byte) 2
|
||||
[152] if(*((word*)(const struct ProcessingChar[8]) PROCESSING#0+(const byte) OFFSET_STRUCT_PROCESSINGCHAR_DIST + (byte~) processChars::$13)==(const word) NOT_FOUND#0) goto processChars::@2
|
||||
to:processChars::@5
|
||||
processChars::@5: scope:[processChars] from processChars::@1
|
||||
[153] (byte~) processChars::$14 ← (byte) processChars::i#2 << (byte) 2
|
||||
[154] (byte) processChars::processing_x#0 ← *((byte*)(const struct ProcessingChar[8]) PROCESSING#0 + (byte~) processChars::$14)
|
||||
[155] (byte) processChars::processing_y#0 ← *((byte*)(const struct ProcessingChar[8]) PROCESSING#0+(const byte) OFFSET_STRUCT_PROCESSINGCHAR_Y + (byte~) processChars::$14)
|
||||
[156] (word~) processChars::$2 ← (word)(byte) processChars::processing_y#0
|
||||
[157] (word) processChars::$21 ← (word~) processChars::$2 << (byte) 2
|
||||
[158] (word) processChars::$22 ← (word) processChars::$21 + (word~) processChars::$2
|
||||
[159] (word~) processChars::$3 ← (word) processChars::$22 << (byte) 3
|
||||
[160] (byte*~) processChars::$4 ← (const byte*) COLS#0 + (word~) processChars::$3
|
||||
[161] *((byte*~) processChars::$4 + (byte) processChars::processing_x#0) ← (const byte) WHITE#0
|
||||
[162] (word~) processChars::$6 ← (word)(byte) processChars::processing_y#0
|
||||
[163] (word) processChars::$24 ← (word~) processChars::$6 << (byte) 2
|
||||
[164] (word) processChars::$25 ← (word) processChars::$24 + (word~) processChars::$6
|
||||
[165] (word~) processChars::$7 ← (word) processChars::$25 << (byte) 3
|
||||
[166] (byte*~) processChars::$8 ← (const byte*) SCREEN#0 + (word~) processChars::$7
|
||||
[167] if(*((byte*~) processChars::$8 + (byte) processChars::processing_x#0)==(byte) ' ') goto processChars::@3
|
||||
to:processChars::@6
|
||||
processChars::@6: scope:[processChars] from processChars::@5
|
||||
[168] if(*((byte*~) processChars::$8 + (byte) processChars::processing_x#0)>(byte) ' ') goto processChars::@4
|
||||
to:processChars::@7
|
||||
processChars::@7: scope:[processChars] from processChars::@6
|
||||
[169] *((byte*~) processChars::$8 + (byte) processChars::processing_x#0) ← ++ *((byte*~) processChars::$8 + (byte) processChars::processing_x#0)
|
||||
to:processChars::@2
|
||||
processChars::@2: scope:[processChars] from processChars::@1 processChars::@3 processChars::@4 processChars::@7
|
||||
[170] (byte) processChars::i#1 ← ++ (byte) processChars::i#2
|
||||
[171] if((byte) processChars::i#1!=(byte) 8) goto processChars::@1
|
||||
to:processChars::@return
|
||||
processChars::@return: scope:[processChars] from processChars::@2
|
||||
[172] return
|
||||
to:@return
|
||||
processChars::@4: scope:[processChars] from processChars::@6
|
||||
[173] *((byte*~) processChars::$8 + (byte) processChars::processing_x#0) ← -- *((byte*~) processChars::$8 + (byte) processChars::processing_x#0)
|
||||
to:processChars::@2
|
||||
processChars::@3: scope:[processChars] from processChars::@5
|
||||
[174] (byte~) processChars::$15 ← (byte) processChars::i#2 << (byte) 2
|
||||
[175] *((word*)(const struct ProcessingChar[8]) PROCESSING#0+(const byte) OFFSET_STRUCT_PROCESSINGCHAR_DIST + (byte~) processChars::$15) ← (const word) NOT_FOUND#0
|
||||
to:processChars::@2
|
||||
irqTop: scope:[irqTop] from
|
||||
[176] phi()
|
||||
to:irqTop::@1
|
||||
irqTop::@1: scope:[irqTop] from irqTop irqTop::@1
|
||||
[177] (byte) irqTop::i#2 ← phi( irqTop/(byte) 0 irqTop::@1/(byte) irqTop::i#1 )
|
||||
[178] (byte) irqTop::i#1 ← ++ (byte) irqTop::i#2
|
||||
[179] if((byte) irqTop::i#1!=(byte) 5) goto irqTop::@1
|
||||
to:irqTop::@2
|
||||
irqTop::@2: scope:[irqTop] from irqTop::@1
|
||||
[180] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0
|
||||
[181] *((const byte*) BGCOL#0) ← (const byte) WHITE#0
|
||||
to:irqTop::@3
|
||||
irqTop::@3: scope:[irqTop] from irqTop::@2 irqTop::@3
|
||||
[182] (byte) irqTop::i1#2 ← phi( irqTop::@2/(byte) 0 irqTop::@3/(byte) irqTop::i1#1 )
|
||||
[183] (byte) irqTop::i1#1 ← ++ (byte) irqTop::i1#2
|
||||
[184] if((byte) irqTop::i1#1!=(byte) 8) goto irqTop::@3
|
||||
to:irqTop::@4
|
||||
irqTop::@4: scope:[irqTop] from irqTop::@3
|
||||
[185] *((const byte*) BORDERCOL#0) ← (const byte) LIGHT_BLUE#0
|
||||
[186] *((const byte*) BGCOL#0) ← (const byte) BLUE#0
|
||||
[187] *((const byte*) RASTER#0) ← (const byte) RASTER_IRQ_MIDDLE#0
|
||||
[188] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_ALL)(void()) irqBottom()
|
||||
[189] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0
|
||||
to:irqTop::@return
|
||||
irqTop::@return: scope:[irqTop] from irqTop::@4
|
||||
[190] return
|
||||
to:@return
|
7297
src/test/ref/complex/blackhole/blackhole.log
Normal file
7297
src/test/ref/complex/blackhole/blackhole.log
Normal file
File diff suppressed because it is too large
Load Diff
348
src/test/ref/complex/blackhole/blackhole.sym
Normal file
348
src/test/ref/complex/blackhole/blackhole.sym
Normal file
@ -0,0 +1,348 @@
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
(const byte*) BGCOL#0 BGCOL = (byte*) 53281
|
||||
(byte) BLUE
|
||||
(const byte) BLUE#0 BLUE = (byte) 6
|
||||
(byte*) BORDERCOL
|
||||
(const byte*) BORDERCOL#0 BORDERCOL = (byte*) 53280
|
||||
(byte*) CIA1_INTERRUPT
|
||||
(const byte*) CIA1_INTERRUPT#0 CIA1_INTERRUPT = (byte*) 56333
|
||||
(byte) CIA_INTERRUPT_CLEAR
|
||||
(const byte) CIA_INTERRUPT_CLEAR#0 CIA_INTERRUPT_CLEAR = (byte) $7f
|
||||
(byte*) COLS
|
||||
(const byte*) COLS#0 COLS = (byte*) 55296
|
||||
(void()**) HARDWARE_IRQ
|
||||
(const void()**) HARDWARE_IRQ#0 HARDWARE_IRQ = (void()**) 65534
|
||||
(byte*) IRQ_ENABLE
|
||||
(const byte*) IRQ_ENABLE#0 IRQ_ENABLE = (byte*) 53274
|
||||
(byte) IRQ_RASTER
|
||||
(const byte) IRQ_RASTER#0 IRQ_RASTER = (byte) 1
|
||||
(byte*) IRQ_STATUS
|
||||
(const byte*) IRQ_STATUS#0 IRQ_STATUS = (byte*) 53273
|
||||
(byte) LIGHT_BLUE
|
||||
(const byte) LIGHT_BLUE#0 LIGHT_BLUE = (byte) $e
|
||||
(word) NOT_FOUND
|
||||
(const word) NOT_FOUND#0 NOT_FOUND = (word) $ffff
|
||||
(const byte) OFFSET_STRUCT_PROCESSINGCHAR_DIST OFFSET_STRUCT_PROCESSINGCHAR_DIST = (byte) 2
|
||||
(const byte) OFFSET_STRUCT_PROCESSINGCHAR_Y OFFSET_STRUCT_PROCESSINGCHAR_Y = (byte) 1
|
||||
(struct ProcessingChar[8]) PROCESSING
|
||||
(const struct ProcessingChar[8]) PROCESSING#0 PROCESSING = { fill( 8, 0) }
|
||||
(byte*) PROCPORT
|
||||
(const byte*) PROCPORT#0 PROCPORT = (byte*) 1
|
||||
(byte*) PROCPORT_DDR
|
||||
(const byte*) PROCPORT_DDR#0 PROCPORT_DDR = (byte*) 0
|
||||
(byte) PROCPORT_DDR_MEMORY_MASK
|
||||
(const byte) PROCPORT_DDR_MEMORY_MASK#0 PROCPORT_DDR_MEMORY_MASK = (byte) 7
|
||||
(byte) PROCPORT_RAM_IO
|
||||
(const byte) PROCPORT_RAM_IO#0 PROCPORT_RAM_IO = (byte) $35
|
||||
(word) ProcessingChar::dist
|
||||
(byte) ProcessingChar::x
|
||||
(byte) ProcessingChar::y
|
||||
(byte*) RASTER
|
||||
(const byte*) RASTER#0 RASTER = (byte*) 53266
|
||||
(byte) RASTER_IRQ_MIDDLE
|
||||
(const byte) RASTER_IRQ_MIDDLE#0 RASTER_IRQ_MIDDLE = (byte) $ff
|
||||
(byte) RASTER_IRQ_TOP
|
||||
(const byte) RASTER_IRQ_TOP#0 RASTER_IRQ_TOP = (byte) $30
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
|
||||
(byte[$3e8]) SCREEN_COPY
|
||||
(const byte[$3e8]) SCREEN_COPY#0 SCREEN_COPY = { fill( $3e8, 0) }
|
||||
(word[$28]) SQUARES_X
|
||||
(const word[$28]) SQUARES_X#0 SQUARES_X = { fill( $28, 0) }
|
||||
(word[$19]) SQUARES_Y
|
||||
(const word[$19]) SQUARES_Y#0 SQUARES_Y = { fill( $19, 0) }
|
||||
(byte*) VIC_CONTROL
|
||||
(const byte*) VIC_CONTROL#0 VIC_CONTROL = (byte*) 53265
|
||||
(byte) WHITE
|
||||
(const byte) WHITE#0 WHITE = (byte) 1
|
||||
(struct ProcessingChar()) getCenterChar()
|
||||
(word~) getCenterChar::$10 $10 zp ZP_WORD:27 4.0
|
||||
(byte*~) getCenterChar::$11 $11 zp ZP_WORD:27 4.0
|
||||
(byte~) getCenterChar::$13 reg byte x 1001.0
|
||||
(byte~) getCenterChar::$14 reg byte a 2002.0
|
||||
(word) getCenterChar::$15 $15 zp ZP_WORD:29 4.0
|
||||
(word) getCenterChar::$16 $16 zp ZP_WORD:27 4.0
|
||||
(word~) getCenterChar::$9 $9 zp ZP_WORD:27 3.0
|
||||
(label) getCenterChar::@1
|
||||
(label) getCenterChar::@10
|
||||
(label) getCenterChar::@11
|
||||
(label) getCenterChar::@12
|
||||
(label) getCenterChar::@2
|
||||
(label) getCenterChar::@3
|
||||
(label) getCenterChar::@4
|
||||
(label) getCenterChar::@5
|
||||
(label) getCenterChar::@6
|
||||
(label) getCenterChar::@7
|
||||
(label) getCenterChar::@8
|
||||
(label) getCenterChar::@9
|
||||
(label) getCenterChar::@return
|
||||
(struct ProcessingChar) getCenterChar::closest
|
||||
(word) getCenterChar::closest_dist
|
||||
(word~) getCenterChar::closest_dist#10 closest_dist zp ZP_WORD:13 202.0
|
||||
(word~) getCenterChar::closest_dist#12 closest_dist zp ZP_WORD:13 2002.0
|
||||
(word) getCenterChar::closest_dist#2 closest_dist zp ZP_WORD:13 684.1666666666667
|
||||
(word) getCenterChar::closest_dist#8 closest_dist zp ZP_WORD:13 202.0
|
||||
(byte) getCenterChar::closest_x
|
||||
(byte) getCenterChar::closest_x#7 closest_x zp ZP_BYTE:15 388.0
|
||||
(byte) getCenterChar::closest_x#9 closest_x zp ZP_BYTE:15 202.0
|
||||
(byte) getCenterChar::closest_y
|
||||
(byte) getCenterChar::closest_y#7 closest_y zp ZP_BYTE:16 388.0
|
||||
(byte) getCenterChar::closest_y#9 closest_y zp ZP_BYTE:16 202.0
|
||||
(word) getCenterChar::dist
|
||||
(word) getCenterChar::dist#0 dist zp ZP_WORD:17 750.75
|
||||
(struct ProcessingChar) getCenterChar::return
|
||||
(word) getCenterChar::return_dist
|
||||
(word) getCenterChar::return_dist#0 return_dist zp ZP_WORD:17 7.333333333333333
|
||||
(word) getCenterChar::return_dist#1 return_dist zp ZP_WORD:17 242.23529411764704
|
||||
(word~) getCenterChar::return_dist#5 return_dist zp ZP_WORD:17 2002.0
|
||||
(word~) getCenterChar::return_dist#6 return_dist zp ZP_WORD:17 2002.0
|
||||
(byte) getCenterChar::return_x
|
||||
(byte) getCenterChar::return_x#0 reg byte x 7.333333333333333
|
||||
(byte) getCenterChar::return_x#1 return_x zp ZP_BYTE:15 242.23529411764704
|
||||
(byte~) getCenterChar::return_x#7 return_x zp ZP_BYTE:15 1001.0
|
||||
(byte) getCenterChar::return_y
|
||||
(byte) getCenterChar::return_y#0 reg byte y 7.333333333333333
|
||||
(byte) getCenterChar::return_y#1 return_y zp ZP_BYTE:16 228.66666666666669
|
||||
(byte~) getCenterChar::return_y#7 return_y zp ZP_BYTE:16 2002.0
|
||||
(byte*) getCenterChar::screen_line
|
||||
(byte*) getCenterChar::screen_line#1 screen_line zp ZP_WORD:9 50.5
|
||||
(byte*) getCenterChar::screen_line#4 screen_line zp ZP_WORD:9 80.2
|
||||
(byte) getCenterChar::x
|
||||
(byte) getCenterChar::x#1 x zp ZP_BYTE:12 1001.0
|
||||
(byte) getCenterChar::x#2 x zp ZP_BYTE:12 455.0
|
||||
(byte) getCenterChar::y
|
||||
(byte) getCenterChar::y#1 y zp ZP_BYTE:11 101.0
|
||||
(byte) getCenterChar::y#7 y zp ZP_BYTE:11 137.75
|
||||
(void()) initSquareTables()
|
||||
(byte~) initSquareTables::$10 reg byte a 22.0
|
||||
(byte~) initSquareTables::$12 reg byte a 22.0
|
||||
(word~) initSquareTables::$14 $14 zp ZP_WORD:21 11.0
|
||||
(byte~) initSquareTables::$16 reg byte a 22.0
|
||||
(byte~) initSquareTables::$17 reg byte a 22.0
|
||||
(byte~) initSquareTables::$2 reg byte a 22.0
|
||||
(byte~) initSquareTables::$4 reg byte a 22.0
|
||||
(word~) initSquareTables::$6 $6 zp ZP_WORD:21 11.0
|
||||
(label) initSquareTables::@1
|
||||
(label) initSquareTables::@10
|
||||
(label) initSquareTables::@2
|
||||
(label) initSquareTables::@3
|
||||
(label) initSquareTables::@4
|
||||
(label) initSquareTables::@5
|
||||
(label) initSquareTables::@6
|
||||
(label) initSquareTables::@7
|
||||
(label) initSquareTables::@8
|
||||
(label) initSquareTables::@9
|
||||
(label) initSquareTables::@return
|
||||
(byte) initSquareTables::x
|
||||
(byte) initSquareTables::x#1 x zp ZP_BYTE:19 16.5
|
||||
(byte) initSquareTables::x#2 x zp ZP_BYTE:19 5.5
|
||||
(byte) initSquareTables::x_dist
|
||||
(byte) initSquareTables::x_dist#0 reg byte a 22.0
|
||||
(byte) initSquareTables::y
|
||||
(byte) initSquareTables::y#1 y zp ZP_BYTE:20 16.5
|
||||
(byte) initSquareTables::y#2 y zp ZP_BYTE:20 5.5
|
||||
(byte) initSquareTables::y_dist
|
||||
(byte) initSquareTables::y_dist#0 reg byte a 22.0
|
||||
interrupt(HARDWARE_ALL)(void()) irqBottom()
|
||||
(label) irqBottom::@1
|
||||
(label) irqBottom::@2
|
||||
(label) irqBottom::@3
|
||||
(label) irqBottom::@return
|
||||
(byte) irqBottom::i
|
||||
(byte) irqBottom::i#1 reg byte x 16.5
|
||||
(byte) irqBottom::i#2 reg byte x 22.0
|
||||
interrupt(HARDWARE_ALL)(void()) irqTop()
|
||||
(label) irqTop::@1
|
||||
(label) irqTop::@2
|
||||
(label) irqTop::@3
|
||||
(label) irqTop::@4
|
||||
(label) irqTop::@return
|
||||
(byte) irqTop::i
|
||||
(byte) irqTop::i#1 reg byte x 16.5
|
||||
(byte) irqTop::i#2 reg byte x 22.0
|
||||
(byte) irqTop::i1
|
||||
(byte) irqTop::i1#1 reg byte x 16.5
|
||||
(byte) irqTop::i1#2 reg byte x 22.0
|
||||
(void()) main()
|
||||
(struct ProcessingChar~) main::$11
|
||||
(byte~) main::$18 reg byte y 14.666666666666666
|
||||
(byte~) main::$5 reg byte a 22.0
|
||||
(byte~) main::$6 reg byte a 22.0
|
||||
(byte~) main::$7 reg byte a 22.0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@9
|
||||
(struct ProcessingChar) main::center
|
||||
(word) main::center_dist
|
||||
(word) main::center_dist#0 center_dist zp ZP_WORD:17 8.25
|
||||
(byte) main::center_x
|
||||
(byte) main::center_x#0 reg byte x 5.5
|
||||
(byte) main::center_y
|
||||
(byte) main::center_y#0 reg byte y 5.5
|
||||
(byte*) main::dst
|
||||
(byte*) main::dst#1 dst zp ZP_WORD:6 11.0
|
||||
(byte*) main::dst#2 dst zp ZP_WORD:6 11.0
|
||||
(byte) main::i
|
||||
(byte) main::i#1 reg byte x 16.5
|
||||
(byte) main::i#2 reg byte x 6.6000000000000005
|
||||
(byte*) main::sc
|
||||
(byte*) main::sc#1 sc zp ZP_WORD:2 16.5
|
||||
(byte*) main::sc#2 sc zp ZP_WORD:2 8.8
|
||||
(byte*) main::src
|
||||
(byte*) main::src#1 src zp ZP_WORD:4 11.0
|
||||
(byte*) main::src#2 src zp ZP_WORD:4 16.5
|
||||
(word()) mul8u((byte) mul8u::a , (byte) mul8u::b)
|
||||
(byte~) mul8u::$1 reg byte a 202.0
|
||||
(label) mul8u::@1
|
||||
(label) mul8u::@2
|
||||
(label) mul8u::@3
|
||||
(label) mul8u::@4
|
||||
(label) mul8u::@return
|
||||
(byte) mul8u::a
|
||||
(byte) mul8u::a#0 reg byte x 101.0
|
||||
(byte) mul8u::a#1 reg byte x 11.0
|
||||
(byte) mul8u::a#2 reg byte x 11.0
|
||||
(byte) mul8u::a#3 reg byte x 67.66666666666666
|
||||
(byte) mul8u::a#6 reg byte x 24.0
|
||||
(byte) mul8u::b
|
||||
(byte) mul8u::b#0 reg byte a 22.0
|
||||
(byte) mul8u::b#1 reg byte a 22.0
|
||||
(word) mul8u::mb
|
||||
(word) mul8u::mb#0 mb zp ZP_WORD:23 24.0
|
||||
(word) mul8u::mb#1 mb zp ZP_WORD:23 202.0
|
||||
(word) mul8u::mb#2 mb zp ZP_WORD:23 43.57142857142858
|
||||
(word) mul8u::res
|
||||
(word) mul8u::res#1 res zp ZP_WORD:21 202.0
|
||||
(word) mul8u::res#2 res zp ZP_WORD:21 46.42857142857143
|
||||
(word) mul8u::res#6 res zp ZP_WORD:21 101.0
|
||||
(word) mul8u::return
|
||||
(word) mul8u::return#2 return zp ZP_WORD:21 22.0
|
||||
(word) mul8u::return#3 return zp ZP_WORD:21 22.0
|
||||
(void()) processChars()
|
||||
(byte~) processChars::$13 reg byte a 22.0
|
||||
(byte~) processChars::$14 reg byte y 16.5
|
||||
(byte~) processChars::$15 reg byte a 22.0
|
||||
(word~) processChars::$2 $2 zp ZP_WORD:33 16.5
|
||||
(word) processChars::$21 $21 zp ZP_WORD:35 22.0
|
||||
(word) processChars::$22 $22 zp ZP_WORD:33 22.0
|
||||
(word) processChars::$24 $24 zp ZP_WORD:39 22.0
|
||||
(word) processChars::$25 $25 zp ZP_WORD:37 22.0
|
||||
(word~) processChars::$3 $3 zp ZP_WORD:33 22.0
|
||||
(byte*~) processChars::$4 $4 zp ZP_WORD:33 22.0
|
||||
(word~) processChars::$6 $6 zp ZP_WORD:37 16.5
|
||||
(word~) processChars::$7 $7 zp ZP_WORD:37 22.0
|
||||
(byte*~) processChars::$8 $8 zp ZP_WORD:37 25.666666666666668
|
||||
(label) processChars::@1
|
||||
(label) processChars::@2
|
||||
(label) processChars::@3
|
||||
(label) processChars::@4
|
||||
(label) processChars::@5
|
||||
(label) processChars::@6
|
||||
(label) processChars::@7
|
||||
(label) processChars::@return
|
||||
(byte) processChars::i
|
||||
(byte) processChars::i#1 reg byte x 16.5
|
||||
(byte) processChars::i#2 reg byte x 2.391304347826087
|
||||
(struct ProcessingChar) processChars::processing
|
||||
(byte*) processChars::processing_ptr
|
||||
(byte) processChars::processing_x
|
||||
(byte) processChars::processing_x#0 processing_x zp ZP_BYTE:31 5.866666666666666
|
||||
(byte) processChars::processing_y
|
||||
(byte) processChars::processing_y#0 processing_y zp ZP_BYTE:32 1.5714285714285714
|
||||
(void()) setupRasterIrq((word) setupRasterIrq::raster , (void()*) setupRasterIrq::irqRoutine)
|
||||
(label) setupRasterIrq::@1
|
||||
(label) setupRasterIrq::@2
|
||||
(label) setupRasterIrq::@return
|
||||
(void()*) setupRasterIrq::irqRoutine
|
||||
(const void()*) setupRasterIrq::irqRoutine#0 irqRoutine = &interrupt(HARDWARE_ALL)(void()) irqTop()
|
||||
(word) setupRasterIrq::raster
|
||||
(void()) startProcessing((byte) startProcessing::center_x , (byte) startProcessing::center_y , (word) startProcessing::center_dist)
|
||||
(byte~) startProcessing::$4 reg byte a 2002.0
|
||||
(byte~) startProcessing::$5 reg byte x 2.6666666666666665
|
||||
(label) startProcessing::@1
|
||||
(label) startProcessing::@2
|
||||
(label) startProcessing::@3
|
||||
(label) startProcessing::@4
|
||||
(label) startProcessing::@5
|
||||
(label) startProcessing::@6
|
||||
(label) startProcessing::@7
|
||||
(label) startProcessing::@return
|
||||
(struct ProcessingChar) startProcessing::center
|
||||
(word) startProcessing::center_dist
|
||||
(word) startProcessing::center_dist#0 center_dist zp ZP_WORD:17 0.8666666666666666
|
||||
(byte) startProcessing::center_x
|
||||
(byte) startProcessing::center_x#0 center_x zp ZP_BYTE:25 0.8666666666666666
|
||||
(byte) startProcessing::center_y
|
||||
(byte) startProcessing::center_y#0 center_y zp ZP_BYTE:26 0.8666666666666666
|
||||
(byte) startProcessing::freeIdx
|
||||
(byte) startProcessing::freeIdx#2 reg byte x 653.0
|
||||
(byte) startProcessing::freeIdx#6 freeIdx zp ZP_BYTE:8 33.666666666666664
|
||||
(byte~) startProcessing::freeIdx#7 freeIdx zp ZP_BYTE:8 202.0
|
||||
(byte~) startProcessing::freeIdx#8 reg byte x 202.0
|
||||
(byte) startProcessing::i
|
||||
(byte) startProcessing::i#1 reg byte x 1501.5
|
||||
(byte) startProcessing::i#2 reg byte x 1334.6666666666667
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
zp ZP_WORD:2 [ main::sc#2 main::sc#1 ]
|
||||
zp ZP_WORD:4 [ main::src#2 main::src#1 ]
|
||||
zp ZP_WORD:6 [ main::dst#2 main::dst#1 ]
|
||||
zp ZP_BYTE:8 [ startProcessing::freeIdx#6 startProcessing::freeIdx#7 ]
|
||||
reg byte x [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ]
|
||||
zp ZP_WORD:9 [ getCenterChar::screen_line#4 getCenterChar::screen_line#1 ]
|
||||
zp ZP_BYTE:11 [ getCenterChar::y#7 getCenterChar::y#1 ]
|
||||
zp ZP_BYTE:12 [ getCenterChar::x#2 getCenterChar::x#1 ]
|
||||
zp ZP_WORD:13 [ getCenterChar::closest_dist#2 getCenterChar::closest_dist#8 getCenterChar::closest_dist#10 getCenterChar::closest_dist#12 ]
|
||||
zp ZP_BYTE:15 [ getCenterChar::closest_x#7 getCenterChar::closest_x#9 getCenterChar::return_x#1 getCenterChar::return_x#7 ]
|
||||
zp ZP_BYTE:16 [ getCenterChar::closest_y#7 getCenterChar::closest_y#9 getCenterChar::return_y#1 getCenterChar::return_y#7 ]
|
||||
zp ZP_WORD:17 [ getCenterChar::return_dist#1 getCenterChar::return_dist#5 getCenterChar::return_dist#6 getCenterChar::dist#0 getCenterChar::return_dist#0 main::center_dist#0 startProcessing::center_dist#0 ]
|
||||
zp ZP_BYTE:19 [ initSquareTables::x#2 initSquareTables::x#1 ]
|
||||
reg byte a [ initSquareTables::x_dist#0 initSquareTables::$4 initSquareTables::$2 ]
|
||||
zp ZP_BYTE:20 [ initSquareTables::y#2 initSquareTables::y#1 ]
|
||||
reg byte a [ initSquareTables::y_dist#0 initSquareTables::$12 initSquareTables::$10 ]
|
||||
reg byte a [ mul8u::b#1 ]
|
||||
reg byte a [ mul8u::b#0 ]
|
||||
reg byte x [ mul8u::a#3 mul8u::a#6 mul8u::a#2 mul8u::a#1 mul8u::a#0 ]
|
||||
zp ZP_WORD:21 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 mul8u::return#3 initSquareTables::$6 initSquareTables::$14 ]
|
||||
zp ZP_WORD:23 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ]
|
||||
reg byte x [ irqBottom::i#2 irqBottom::i#1 ]
|
||||
reg byte x [ processChars::i#2 processChars::i#1 ]
|
||||
reg byte x [ irqTop::i#2 irqTop::i#1 ]
|
||||
reg byte x [ irqTop::i1#2 irqTop::i1#1 ]
|
||||
reg byte y [ main::$18 ]
|
||||
reg byte a [ main::$5 ]
|
||||
reg byte a [ main::$6 ]
|
||||
reg byte a [ main::$7 ]
|
||||
reg byte x [ getCenterChar::return_x#0 ]
|
||||
reg byte y [ getCenterChar::return_y#0 ]
|
||||
reg byte x [ main::center_x#0 ]
|
||||
reg byte y [ main::center_y#0 ]
|
||||
zp ZP_BYTE:25 [ startProcessing::center_x#0 ]
|
||||
zp ZP_BYTE:26 [ startProcessing::center_y#0 ]
|
||||
reg byte a [ startProcessing::$4 ]
|
||||
reg byte x [ startProcessing::$5 ]
|
||||
reg byte x [ getCenterChar::$13 ]
|
||||
reg byte a [ getCenterChar::$14 ]
|
||||
zp ZP_WORD:27 [ getCenterChar::$9 getCenterChar::$16 getCenterChar::$10 getCenterChar::$11 ]
|
||||
zp ZP_WORD:29 [ getCenterChar::$15 ]
|
||||
reg byte a [ initSquareTables::$16 ]
|
||||
reg byte a [ initSquareTables::$17 ]
|
||||
reg byte a [ mul8u::$1 ]
|
||||
reg byte a [ processChars::$13 ]
|
||||
reg byte y [ processChars::$14 ]
|
||||
zp ZP_BYTE:31 [ processChars::processing_x#0 ]
|
||||
zp ZP_BYTE:32 [ processChars::processing_y#0 ]
|
||||
zp ZP_WORD:33 [ processChars::$2 processChars::$22 processChars::$3 processChars::$4 ]
|
||||
zp ZP_WORD:35 [ processChars::$21 ]
|
||||
zp ZP_WORD:37 [ processChars::$6 processChars::$25 processChars::$7 processChars::$8 ]
|
||||
zp ZP_WORD:39 [ processChars::$24 ]
|
||||
reg byte a [ processChars::$15 ]
|
27
src/test/ref/unused-irq.asm
Normal file
27
src/test/ref/unused-irq.asm
Normal file
@ -0,0 +1,27 @@
|
||||
// Unused interrupts pointing to each other but never used from main loop - should be optimized away
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.label SCREEN = $400
|
||||
.label HARDWARE_IRQ = $fffe
|
||||
main: {
|
||||
lda #'x'
|
||||
sta SCREEN
|
||||
rts
|
||||
}
|
||||
// Unused Interrupt Routine
|
||||
irq2: {
|
||||
lda #<irq1
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq1
|
||||
sta HARDWARE_IRQ+1
|
||||
jmp $ea81
|
||||
}
|
||||
// Unused Interrupt Routine
|
||||
irq1: {
|
||||
lda #<irq2
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq2
|
||||
sta HARDWARE_IRQ+1
|
||||
jmp $ea81
|
||||
}
|
27
src/test/ref/unused-irq.cfg
Normal file
27
src/test/ref/unused-irq.cfg
Normal file
@ -0,0 +1,27 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi()
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] phi()
|
||||
[2] call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
[3] phi()
|
||||
main: scope:[main] from @1
|
||||
[4] *((const byte*) SCREEN#0) ← (byte) 'x'
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[5] return
|
||||
to:@return
|
||||
irq2: scope:[irq2] from
|
||||
[6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1()
|
||||
to:irq2::@return
|
||||
irq2::@return: scope:[irq2] from irq2
|
||||
[7] return
|
||||
to:@return
|
||||
irq1: scope:[irq1] from
|
||||
[8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2()
|
||||
to:irq1::@return
|
||||
irq1::@return: scope:[irq1] from irq1
|
||||
[9] return
|
||||
to:@return
|
373
src/test/ref/unused-irq.log
Normal file
373
src/test/ref/unused-irq.log
Normal file
@ -0,0 +1,373 @@
|
||||
Resolved forward reference irq2 to interrupt(KERNEL_MIN)(void()) irq2()
|
||||
Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $400
|
||||
Adding pointer type conversion cast (void()**) HARDWARE_IRQ in (void()**) HARDWARE_IRQ ← (number) $fffe
|
||||
Culled Empty Block (label) @2
|
||||
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@begin: scope:[] from
|
||||
(byte*) SCREEN#0 ← ((byte*)) (number) $400
|
||||
to:@1
|
||||
main: scope:[main] from @3
|
||||
*((byte*) SCREEN#0) ← (byte) 'x'
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@1: scope:[] from @begin
|
||||
(void()**) HARDWARE_IRQ#0 ← ((void()**)) (number) $fffe
|
||||
to:@3
|
||||
irq1: scope:[irq1] from
|
||||
(void()*~) irq1::$0 ← & interrupt(KERNEL_MIN)(void()) irq2()
|
||||
*((void()**) HARDWARE_IRQ#0) ← (void()*~) irq1::$0
|
||||
to:irq1::@return
|
||||
irq1::@return: scope:[irq1] from irq1
|
||||
return
|
||||
to:@return
|
||||
irq2: scope:[irq2] from
|
||||
(void()*~) irq2::$0 ← & interrupt(KERNEL_MIN)(void()) irq1()
|
||||
*((void()**) HARDWARE_IRQ#0) ← (void()*~) irq2::$0
|
||||
to:irq2::@return
|
||||
irq2::@return: scope:[irq2] from irq2
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @1
|
||||
call main
|
||||
to:@4
|
||||
@4: scope:[] from @3
|
||||
to:@end
|
||||
@end: scope:[] from @4
|
||||
|
||||
SYMBOL TABLE SSA
|
||||
(label) @1
|
||||
(label) @3
|
||||
(label) @4
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()**) HARDWARE_IRQ
|
||||
(void()**) HARDWARE_IRQ#0
|
||||
(byte*) SCREEN
|
||||
(byte*) SCREEN#0
|
||||
interrupt(KERNEL_MIN)(void()) irq1()
|
||||
(void()*~) irq1::$0
|
||||
(label) irq1::@return
|
||||
interrupt(KERNEL_MIN)(void()) irq2()
|
||||
(void()*~) irq2::$0
|
||||
(label) irq2::@return
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400
|
||||
Inlining cast (void()**) HARDWARE_IRQ#0 ← (void()**)(number) $fffe
|
||||
Successful SSA optimization Pass2InlineCast
|
||||
Simplifying constant pointer cast (byte*) 1024
|
||||
Simplifying constant pointer cast (void()**) 65534
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Constant right-side identified [4] (void()*~) irq1::$0 ← & interrupt(KERNEL_MIN)(void()) irq2()
|
||||
Constant right-side identified [7] (void()*~) irq2::$0 ← & interrupt(KERNEL_MIN)(void()) irq1()
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant (const byte*) SCREEN#0 = (byte*) 1024
|
||||
Constant (const void()**) HARDWARE_IRQ#0 = (void()**) 65534
|
||||
Constant (const void()*) irq1::$0 = &irq2
|
||||
Constant (const void()*) irq2::$0 = &irq1
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Constant inlined irq1::$0 = &interrupt(KERNEL_MIN)(void()) irq2()
|
||||
Constant inlined irq2::$0 = &interrupt(KERNEL_MIN)(void()) irq1()
|
||||
Successful SSA optimization Pass2ConstantInlining
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @3
|
||||
Adding NOP phi() at start of @4
|
||||
Adding NOP phi() at start of @end
|
||||
CALL GRAPH
|
||||
Calls in [] to main:3
|
||||
|
||||
Created 0 initial phi equivalence classes
|
||||
Coalesced down to 0 phi equivalence classes
|
||||
Culled Empty Block (label) @1
|
||||
Culled Empty Block (label) @4
|
||||
Renumbering block @3 to @1
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @1
|
||||
Adding NOP phi() at start of @end
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
[0] phi()
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
[1] phi()
|
||||
[2] call main
|
||||
to:@end
|
||||
@end: scope:[] from @1
|
||||
[3] phi()
|
||||
main: scope:[main] from @1
|
||||
[4] *((const byte*) SCREEN#0) ← (byte) 'x'
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main
|
||||
[5] return
|
||||
to:@return
|
||||
irq2: scope:[irq2] from
|
||||
[6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1()
|
||||
to:irq2::@return
|
||||
irq2::@return: scope:[irq2] from irq2
|
||||
[7] return
|
||||
to:@return
|
||||
irq1: scope:[irq1] from
|
||||
[8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2()
|
||||
to:irq1::@return
|
||||
irq1::@return: scope:[irq1] from irq1
|
||||
[9] return
|
||||
to:@return
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
(void()**) HARDWARE_IRQ
|
||||
(byte*) SCREEN
|
||||
interrupt(KERNEL_MIN)(void()) irq1()
|
||||
interrupt(KERNEL_MIN)(void()) irq2()
|
||||
(void()) main()
|
||||
|
||||
Initial phi equivalence classes
|
||||
Complete equivalence classes
|
||||
|
||||
INITIAL ASM
|
||||
//SEG0 File Comments
|
||||
// Unused interrupts pointing to each other but never used from main loop - should be optimized away
|
||||
//SEG1 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(bbegin)
|
||||
.pc = $80d "Program"
|
||||
//SEG2 Global Constants & labels
|
||||
.label SCREEN = $400
|
||||
.label HARDWARE_IRQ = $fffe
|
||||
//SEG3 @begin
|
||||
bbegin:
|
||||
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
|
||||
b1_from_bbegin:
|
||||
jmp b1
|
||||
//SEG5 @1
|
||||
b1:
|
||||
//SEG6 [2] call main
|
||||
jsr main
|
||||
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
|
||||
bend_from_b1:
|
||||
jmp bend
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
main: {
|
||||
//SEG10 [4] *((const byte*) SCREEN#0) ← (byte) 'x' -- _deref_pbuc1=vbuc2
|
||||
lda #'x'
|
||||
sta SCREEN
|
||||
jmp breturn
|
||||
//SEG11 main::@return
|
||||
breturn:
|
||||
//SEG12 [5] return
|
||||
rts
|
||||
}
|
||||
//SEG13 irq2
|
||||
// Unused Interrupt Routine
|
||||
irq2: {
|
||||
//SEG14 entry interrupt(KERNEL_MIN)
|
||||
//SEG15 [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1() -- _deref_pptc1=pprc2
|
||||
lda #<irq1
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq1
|
||||
sta HARDWARE_IRQ+1
|
||||
jmp breturn
|
||||
//SEG16 irq2::@return
|
||||
breturn:
|
||||
//SEG17 [7] return - exit interrupt(KERNEL_MIN)
|
||||
jmp $ea81
|
||||
}
|
||||
//SEG18 irq1
|
||||
// Unused Interrupt Routine
|
||||
irq1: {
|
||||
//SEG19 entry interrupt(KERNEL_MIN)
|
||||
//SEG20 [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2() -- _deref_pptc1=pprc2
|
||||
lda #<irq2
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq2
|
||||
sta HARDWARE_IRQ+1
|
||||
jmp breturn
|
||||
//SEG21 irq1::@return
|
||||
breturn:
|
||||
//SEG22 [9] return - exit interrupt(KERNEL_MIN)
|
||||
jmp $ea81
|
||||
}
|
||||
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [4] *((const byte*) SCREEN#0) ← (byte) 'x' [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||
Statement [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1() [ ] ( [ ] ) always clobbers reg byte a
|
||||
Statement [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2() [ ] ( [ ] ) always clobbers reg byte a
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main]
|
||||
Uplift Scope [irq1]
|
||||
Uplift Scope [irq2]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 63 combination
|
||||
Uplifting [irq1] best 63 combination
|
||||
Uplifting [irq2] best 63 combination
|
||||
Uplifting [] best 63 combination
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
//SEG0 File Comments
|
||||
// Unused interrupts pointing to each other but never used from main loop - should be optimized away
|
||||
//SEG1 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(bbegin)
|
||||
.pc = $80d "Program"
|
||||
//SEG2 Global Constants & labels
|
||||
.label SCREEN = $400
|
||||
.label HARDWARE_IRQ = $fffe
|
||||
//SEG3 @begin
|
||||
bbegin:
|
||||
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
|
||||
b1_from_bbegin:
|
||||
jmp b1
|
||||
//SEG5 @1
|
||||
b1:
|
||||
//SEG6 [2] call main
|
||||
jsr main
|
||||
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
|
||||
bend_from_b1:
|
||||
jmp bend
|
||||
//SEG8 @end
|
||||
bend:
|
||||
//SEG9 main
|
||||
main: {
|
||||
//SEG10 [4] *((const byte*) SCREEN#0) ← (byte) 'x' -- _deref_pbuc1=vbuc2
|
||||
lda #'x'
|
||||
sta SCREEN
|
||||
jmp breturn
|
||||
//SEG11 main::@return
|
||||
breturn:
|
||||
//SEG12 [5] return
|
||||
rts
|
||||
}
|
||||
//SEG13 irq2
|
||||
// Unused Interrupt Routine
|
||||
irq2: {
|
||||
//SEG14 entry interrupt(KERNEL_MIN)
|
||||
//SEG15 [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1() -- _deref_pptc1=pprc2
|
||||
lda #<irq1
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq1
|
||||
sta HARDWARE_IRQ+1
|
||||
jmp breturn
|
||||
//SEG16 irq2::@return
|
||||
breturn:
|
||||
//SEG17 [7] return - exit interrupt(KERNEL_MIN)
|
||||
jmp $ea81
|
||||
}
|
||||
//SEG18 irq1
|
||||
// Unused Interrupt Routine
|
||||
irq1: {
|
||||
//SEG19 entry interrupt(KERNEL_MIN)
|
||||
//SEG20 [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2() -- _deref_pptc1=pprc2
|
||||
lda #<irq2
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq2
|
||||
sta HARDWARE_IRQ+1
|
||||
jmp breturn
|
||||
//SEG21 irq1::@return
|
||||
breturn:
|
||||
//SEG22 [9] return - exit interrupt(KERNEL_MIN)
|
||||
jmp $ea81
|
||||
}
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp b1
|
||||
Removing instruction jmp bend
|
||||
Removing instruction jmp breturn
|
||||
Removing instruction jmp breturn
|
||||
Removing instruction jmp breturn
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction b1_from_bbegin:
|
||||
Removing instruction b1:
|
||||
Removing instruction bend_from_b1:
|
||||
Succesful ASM optimization Pass5RedundantLabelElimination
|
||||
Removing instruction bend:
|
||||
Removing instruction breturn:
|
||||
Removing instruction breturn:
|
||||
Removing instruction breturn:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
Updating BasicUpstart to call main directly
|
||||
Removing instruction jsr main
|
||||
Succesful ASM optimization Pass5SkipBegin
|
||||
Removing instruction bbegin:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()**) HARDWARE_IRQ
|
||||
(const void()**) HARDWARE_IRQ#0 HARDWARE_IRQ = (void()**) 65534
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
|
||||
interrupt(KERNEL_MIN)(void()) irq1()
|
||||
(label) irq1::@return
|
||||
interrupt(KERNEL_MIN)(void()) irq2()
|
||||
(label) irq2::@return
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 42
|
||||
|
||||
//SEG0 File Comments
|
||||
// Unused interrupts pointing to each other but never used from main loop - should be optimized away
|
||||
//SEG1 Basic Upstart
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
//SEG2 Global Constants & labels
|
||||
.label SCREEN = $400
|
||||
.label HARDWARE_IRQ = $fffe
|
||||
//SEG3 @begin
|
||||
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
|
||||
//SEG5 @1
|
||||
//SEG6 [2] call main
|
||||
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
main: {
|
||||
//SEG10 [4] *((const byte*) SCREEN#0) ← (byte) 'x' -- _deref_pbuc1=vbuc2
|
||||
lda #'x'
|
||||
sta SCREEN
|
||||
//SEG11 main::@return
|
||||
//SEG12 [5] return
|
||||
rts
|
||||
}
|
||||
//SEG13 irq2
|
||||
// Unused Interrupt Routine
|
||||
irq2: {
|
||||
//SEG14 entry interrupt(KERNEL_MIN)
|
||||
//SEG15 [6] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq1() -- _deref_pptc1=pprc2
|
||||
lda #<irq1
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq1
|
||||
sta HARDWARE_IRQ+1
|
||||
//SEG16 irq2::@return
|
||||
//SEG17 [7] return - exit interrupt(KERNEL_MIN)
|
||||
jmp $ea81
|
||||
}
|
||||
//SEG18 irq1
|
||||
// Unused Interrupt Routine
|
||||
irq1: {
|
||||
//SEG19 entry interrupt(KERNEL_MIN)
|
||||
//SEG20 [8] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq2() -- _deref_pptc1=pprc2
|
||||
lda #<irq2
|
||||
sta HARDWARE_IRQ
|
||||
lda #>irq2
|
||||
sta HARDWARE_IRQ+1
|
||||
//SEG21 irq1::@return
|
||||
//SEG22 [9] return - exit interrupt(KERNEL_MIN)
|
||||
jmp $ea81
|
||||
}
|
||||
|
14
src/test/ref/unused-irq.sym
Normal file
14
src/test/ref/unused-irq.sym
Normal file
@ -0,0 +1,14 @@
|
||||
(label) @1
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()**) HARDWARE_IRQ
|
||||
(const void()**) HARDWARE_IRQ#0 HARDWARE_IRQ = (void()**) 65534
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
|
||||
interrupt(KERNEL_MIN)(void()) irq1()
|
||||
(label) irq1::@return
|
||||
interrupt(KERNEL_MIN)(void()) irq2()
|
||||
(label) irq2::@return
|
||||
(void()) main()
|
||||
(label) main::@return
|
||||
|
Loading…
Reference in New Issue
Block a user