1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-14 23:04:57 +00:00

refactored addpoint to increment its own counter

This commit is contained in:
jespergravgaard 2017-08-12 00:31:14 +02:00
parent 7c7e0ec08f
commit 9334e435da
6 changed files with 1202 additions and 1436 deletions

View File

@ -141,8 +141,10 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
if(currentBlock.getLabel().equals(predecessor.getCallSuccessor())) {
// Add to last statement before call in predecessor
StatementCall callStatement = (StatementCall) predecessorStatements.get(predecessorStatements.size() - 1);
Statement predecessorLastStatementBeforeCall = predecessorStatements.get(predecessorStatements.size() - 2);
liveRanges.addAlive((VariableRef) phiRValue.getrValue(), predecessorLastStatementBeforeCall);
if(predecessorStatements.size()>1) {
Statement predecessorLastStatementBeforeCall = predecessorStatements.get(predecessorStatements.size() - 2);
liveRanges.addAlive((VariableRef) phiRValue.getrValue(), predecessorLastStatementBeforeCall);
}
} else {
// Add to last statement of predecessor
Statement predecessorLastStatement = predecessorStatements.get(predecessorStatements.size() - 1);

View File

@ -5,48 +5,44 @@ main:
addpoint_from_main:
lda #1
sta 2
ldx #5
ldy #0
ldy #5
lda #0
sta 8
lda #5
jsr addpoint
main__B3:
addpoint_from_B3:
lda #2
sta 2
ldx #8
ldy #1
ldy #8
lda #15
jsr addpoint
main__B4:
addpoint_from_B4:
lda #3
sta 2
ldx #14
ldy #2
ldy #14
lda #6
jsr addpoint
main__B5:
addpoint_from_B5:
lda #4
sta 2
ldx #2
ldy #3
ldy #2
lda #34
jsr addpoint
main__B6:
addpoint_from_B6:
lda #5
sta 2
ldx #17
ldy #4
ldy #17
lda #21
jsr addpoint
main__B7:
addpoint_from_B7:
lda #7
sta 2
ldx #22
ldy #5
ldy #22
lda #31
jsr addpoint
main__B8:
@ -148,9 +144,9 @@ render__B2_from_B1:
render__B2_from_B5:
render__B2:
lda 5
sta 8
lda 2
sta 9
lda 2
sta 10
jsr findcol
render__B5:
tya
@ -185,28 +181,28 @@ findcol__B1:
lda 4096,x
sta 7
lda 4352,x
sta 10
lda 8
sta 11
lda 9
cmp 7
beq findcol__B2
findcol__B3:
lda 8
lda 9
cmp 7
bcc findcol__B6
findcol__B7:
lda 8
lda 9
sec
sbc 7
sta 7
findcol__B8_from_B7:
findcol__B8:
lda 9
cmp 10
lda 10
cmp 11
bcc findcol__B9
findcol__B10:
lda 9
lda 10
sec
sbc 10
sbc 11
clc
adc 7
findcol__B11_from_B10:
@ -216,7 +212,7 @@ findcol__B11:
findcol__B13_from_B11:
findcol__B13:
inx
cpx #6
cpx 8
bcc findcol__B1_from_B13
findcol__Breturn_from_B13:
jmp findcol__Breturn
@ -230,9 +226,9 @@ findcol__B12:
findcol__B13_from_B12:
jmp findcol__B13
findcol__B9:
lda 10
lda 11
sec
sbc 9
sbc 10
clc
adc 7
findcol__B11_from_B9:
@ -240,13 +236,13 @@ findcol__B11_from_B9:
findcol__B6:
lda 7
sec
sbc 8
sbc 9
sta 7
findcol__B8_from_B6:
jmp findcol__B8
findcol__B2:
lda 9
cmp 10
lda 10
cmp 11
beq findcol__Breturn_from_B2
jmp findcol__B3
initscreen:
@ -275,10 +271,14 @@ initscreen__B1:
initscreen__Breturn:
rts
addpoint:
sta 4096,y
txa
ldx 8
sta 4096,x
tya
ldy 8
sta 4352,y
lda 2
sta 4608,y
ldx 8
sta 4608,x
inc 8
addpoint__Breturn:
rts

View File

@ -101,25 +101,25 @@ animate::@1: from animate
render: from main::@1
to:render::@1
render::@1: from render render::@3
[51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 render::colline#2 ]
[51] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 render::colline#2 ]
[51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 render::colline#2 numpoints#1 ]
[51] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 render::colline#2 numpoints#1 ]
to:render::@2
render::@2: from render::@1 render::@5
[52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::x#2 render::y#2 render::colline#2 ]
[53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 ]
[54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 ]
[55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ]
[52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::x#2 render::y#2 render::colline#2 numpoints#1 ]
[53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 numpoints#1 ]
[54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 numpoints#1 ]
[55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 numpoints#1 ]
to:render::@5
render::@5: from render::@2
[56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ]
[57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ]
[58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ]
[59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ]
[56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 numpoints#1 ]
[57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 numpoints#1 ]
[58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 numpoints#1 ]
[59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 numpoints#1 ]
to:render::@3
render::@3: from render::@5
[60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ]
[61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ]
[62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ]
[60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 numpoints#1 ]
[61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ]
[62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ]
to:render::@return
render::@return: from render::@3
[63] return [ ]
@ -127,54 +127,54 @@ render::@return: from render::@3
findcol: from render::@2
to:findcol::@1
findcol::@1: from findcol findcol::@13
[64] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@13/(byte) findcol::mincol#2 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ]
[64] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@13/(byte) findcol::mindiff#11 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ]
[64] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@13/(byte) findcol::i#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ]
[65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ]
[66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ]
[67] if((byte) findcol::x#0==(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ]
[64] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@13/(byte) findcol::mincol#2 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[64] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@13/(byte) findcol::mindiff#11 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[64] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@13/(byte) findcol::i#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[67] if((byte) findcol::x#0==(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@3
findcol::@3: from findcol::@1 findcol::@2
[68] if((byte) findcol::x#0<(byte) findcol::xp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ]
[68] if((byte) findcol::x#0<(byte) findcol::xp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@7
findcol::@7: from findcol::@3
[69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ]
[69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@8
findcol::@8: from findcol::@6 findcol::@7
[70] (byte) findcol::diff#4 ← phi( findcol::@6/(byte) findcol::diff#0 findcol::@7/(byte) findcol::diff#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 ]
[71] if((byte) findcol::y#0<(byte) findcol::yp#0) goto findcol::@9 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 ]
[70] (byte) findcol::diff#4 ← phi( findcol::@6/(byte) findcol::diff#0 findcol::@7/(byte) findcol::diff#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[71] if((byte) findcol::y#0<(byte) findcol::yp#0) goto findcol::@9 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@10
findcol::@10: from findcol::@8
[72] (byte~) findcol::$10 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$10 findcol::mindiff#10 findcol::mincol#11 ]
[73] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 ]
[72] (byte~) findcol::$10 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$10 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[73] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@11
findcol::@11: from findcol::@10 findcol::@9
[74] (byte) findcol::diff#6 ← phi( findcol::@10/(byte) findcol::diff#3 findcol::@9/(byte) findcol::diff#2 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 ]
[75] if((byte) findcol::diff#6<(byte) findcol::mindiff#10) goto findcol::@12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 ]
[74] (byte) findcol::diff#6 ← phi( findcol::@10/(byte) findcol::diff#3 findcol::@9/(byte) findcol::diff#2 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[75] if((byte) findcol::diff#6<(byte) findcol::mindiff#10) goto findcol::@12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@13
findcol::@13: from findcol::@11 findcol::@12
[76] (byte) findcol::mindiff#11 ← phi( findcol::@11/(byte) findcol::mindiff#10 findcol::@12/(byte~) findcol::diff#13 ) [ render::x#2 render::y#2 render::colline#2 findcol::mindiff#11 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 ]
[76] (byte) findcol::mincol#2 ← phi( findcol::@11/(byte) findcol::mincol#11 findcol::@12/(byte) findcol::mincol#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::mindiff#11 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 ]
[77] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ]
[78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ]
[76] (byte) findcol::mindiff#11 ← phi( findcol::@11/(byte) findcol::mindiff#10 findcol::@12/(byte~) findcol::diff#13 ) [ render::x#2 render::y#2 render::colline#2 findcol::mindiff#11 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 numpoints#1 ]
[76] (byte) findcol::mincol#2 ← phi( findcol::@11/(byte) findcol::mincol#11 findcol::@12/(byte) findcol::mincol#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::mindiff#11 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 numpoints#1 ]
[77] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ]
[78] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ]
to:findcol::@return
findcol::@return: from findcol::@13 findcol::@2
[79] (byte) findcol::return#0 ← phi( findcol::@13/(byte) findcol::mincol#2 findcol::@2/(byte) 0 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ]
[80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ]
[79] (byte) findcol::return#0 ← phi( findcol::@13/(byte) findcol::mincol#2 findcol::@2/(byte) 0 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 numpoints#1 ]
[80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 numpoints#1 ]
to:@RETURN
findcol::@12: from findcol::@11
[81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ]
[82] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#1 findcol::diff#13 ]
[81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 numpoints#1 ]
[82] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#1 findcol::diff#13 numpoints#1 ]
to:findcol::@13
findcol::@9: from findcol::@8
[83] (byte~) findcol::$8 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 findcol::$8 ]
[84] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$8 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 ]
[83] (byte~) findcol::$8 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$8 ]
[84] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$8 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@11
findcol::@6: from findcol::@3
[85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ]
[85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@8
findcol::@2: from findcol::@1
[86] if((byte) findcol::y#0==(byte) findcol::yp#0) goto findcol::@return [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ]
[86] if((byte) findcol::y#0==(byte) findcol::yp#0) goto findcol::@return [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
to:findcol::@3
initscreen: from main::@8
to:initscreen::@1
@ -188,14 +188,15 @@ initscreen::@return: from initscreen::@1
[91] return [ ]
to:@RETURN
addpoint: from main main::@3 main::@4 main::@5 main::@6 main::@7
[92] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[92] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[92] (byte) addpoint::idx#6 ← phi( main/(byte) 0 main::@3/(byte) 1 main::@4/(byte) 2 main::@5/(byte) 3 main::@6/(byte) 4 main::@7/(byte) 5 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[92] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ addpoint::idx#6 addpoint::y#6 addpoint::c#6 ]
[94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ addpoint::idx#6 addpoint::c#6 ]
[95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ ]
[92] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[92] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[92] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte) numpoints#1 main::@4/(byte) numpoints#1 main::@5/(byte) numpoints#1 main::@6/(byte) numpoints#1 main::@7/(byte) numpoints#1 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[92] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[93] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ]
[94] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ]
[95] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ]
[96] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ]
to:addpoint::@return
addpoint::@return: from addpoint
[96] return [ ]
[97] return [ ]
to:@RETURN

File diff suppressed because it is too large Load Diff

View File

@ -6,16 +6,14 @@
(byte*) SCREEN
(byte[256]) XPOS
(byte[256]) YPOS
(void()) addpoint((byte) addpoint::idx , (byte) addpoint::x , (byte) addpoint::y , (byte) addpoint::c)
(void()) addpoint((byte) addpoint::x , (byte) addpoint::y , (byte) addpoint::c)
(label) addpoint::@return
(byte) addpoint::c
(byte) addpoint::c#6 zp byte:2 0.6666666666666666
(byte) addpoint::idx
(byte) addpoint::idx#6 reg byte y 2.0
(byte) addpoint::x
(byte) addpoint::x#6 reg byte a 2.0
(byte) addpoint::y
(byte) addpoint::y#6 reg byte x 1.0
(byte) addpoint::y#6 reg byte y 1.0
(void()) animate()
(byte~) animate::$0 reg byte a 4.0
(byte~) animate::$1 reg byte a 4.0
@ -84,13 +82,13 @@
(byte) findcol::return
(byte) findcol::return#0 reg byte y 3667.333333333333
(byte) findcol::x
(byte) findcol::x#0 zp byte:8 1782.8260869565217
(byte) findcol::x#0 zp byte:9 1782.8260869565217
(byte) findcol::xp
(byte) findcol::xp#0 zp byte:7 10001.0
(byte) findcol::y
(byte) findcol::y#0 zp byte:9 1863.8636363636363
(byte) findcol::y#0 zp byte:10 1863.8636363636363
(byte) findcol::yp
(byte) findcol::yp#0 zp byte:10 6250.625
(byte) findcol::yp#0 zp byte:11 6250.625
(void()) initscreen()
(label) initscreen::@1
(label) initscreen::@return
@ -109,6 +107,8 @@
(label) main::@8
(label) main::@return
(byte) numpoints
(byte) numpoints#1 zp byte:8 286.0857142857144
(byte) numpoints#19 zp byte:8 4.5
(void()) render()
(label) render::@1
(label) render::@2
@ -136,8 +136,8 @@ zp byte:7 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 findcol::xp#0 ]
reg byte a [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ]
reg byte y [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ]
reg byte a [ addpoint::x#6 ]
reg byte y [ addpoint::idx#6 ]
reg byte x [ addpoint::y#6 ]
zp byte:8 [ numpoints#19 numpoints#1 ]
reg byte y [ addpoint::y#6 ]
reg byte a [ animate::$0 ]
reg byte a [ animate::$1 ]
reg byte a [ animate::$2 ]
@ -158,9 +158,9 @@ reg byte a [ animate::$21 ]
reg byte a [ animate::$22 ]
reg byte a [ animate::$24 ]
reg byte a [ animate::$25 ]
zp byte:8 [ findcol::x#0 ]
zp byte:9 [ findcol::y#0 ]
zp byte:9 [ findcol::x#0 ]
zp byte:10 [ findcol::y#0 ]
reg byte a [ render::col#0 ]
zp byte:10 [ findcol::yp#0 ]
zp byte:11 [ findcol::yp#0 ]
reg byte a [ findcol::$10 ]
reg byte a [ findcol::$8 ]

View File

@ -5,7 +5,7 @@ byte *COLORS = $D800;
byte FILL = 230;
// The total number of voronoi points
byte numpoints = 6;
byte numpoints = 0;
// Points to create the Voronoi from
byte[$100] XPOS = $1000;
@ -15,12 +15,12 @@ byte[$100] COLS = $1200;
main();
void main() {
addpoint(0, 5, 5, 1);
addpoint(1, 15, 8, 2);
addpoint(2, 6, 14, 3);
addpoint(3, 34, 2, 4);
addpoint(4, 21, 17, 5);
addpoint(5, 31, 22, 7);
addpoint(5, 5, 1);
addpoint(15, 8, 2);
addpoint(6, 14, 3);
addpoint(34, 2, 4);
addpoint(21, 17, 5);
addpoint(31, 22, 7);
initscreen();
do {
render();
@ -55,10 +55,11 @@ void animate() {
}
}
void addpoint(byte idx, byte x, byte y, byte c) {
XPOS[idx] = x;
YPOS[idx] = y;
COLS[idx] = c;
void addpoint(byte x, byte y, byte c) {
XPOS[numpoints] = x;
YPOS[numpoints] = y;
COLS[numpoints] = c;
numpoints++;
}
void initscreen() {