1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-19 14:31:25 +00:00

Fixed constant elimination optimization. Added (unfinished) 3D example.

This commit is contained in:
jespergravgaard 2018-10-21 16:03:19 +02:00
parent 5896f483b7
commit 8421b47760
20 changed files with 5328 additions and 834 deletions

View File

@ -0,0 +1,3 @@
eor #$ff
clc
adc #$01

View File

@ -0,0 +1,7 @@
lda {z1}
clc
adc #2
sta {z1}
bcc !+
inc {z1}+1
!:

View File

@ -200,11 +200,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
}
}
if(assignment != null && assignment.getOperator() != null && "-".equals(assignment.getOperator().getOperator())) {
if(assignment.getrValue1() instanceof ConstantValue) {
ConstantValue constant = (ConstantValue) assignment.getrValue1();
assignment.setrValue1(null);
return constant;
} else if(assignment.getrValue2() instanceof ConstantValue) {
if(assignment.getrValue2() instanceof ConstantValue) {
ConstantValue constant = (ConstantValue) assignment.getrValue2();
assignment.setrValue2(assignment.getrValue1());
assignment.setOperator(null);

View File

@ -46,36 +46,6 @@ void mulf_init() {
*(mulf_sqr2_hi+511) = *(mulf_sqr1_hi+256);
}
// Fast multiply two unsigned bytes to a word result
// Done in assembler to utilize fast addition A+X
word mulf8u_old(byte a, byte b) {
const byte* memA = $fe;
const byte* memB = $ff;
*memA = a;
*memB = b;
asm {
lda memA
sta sm1+1
sta sm3+1
eor #$ff
sta sm2+1
sta sm4+1
ldx memB
sec
sm1:
lda mulf_sqr1_lo,x
sm2:
sbc mulf_sqr2_lo,x
sta memA
sm3:
lda mulf_sqr1_hi,x
sm4:
sbc mulf_sqr2_hi,x
sta memB
}
return { *memB, *memA };
}
// Prepare for fast multiply with an unsigned byte to a word result
void mulf8u_prepare(byte a) {
const byte* memA = $fd;
@ -144,19 +114,6 @@ signed word mulf8s(signed byte a, signed byte b) {
return mulf8s_prepared(b);
}
// Fast multiply of two signed bytes to a signed word
// Fixes offsets introduced by using unsigned multiplication
signed word mulf8s_old(signed byte a, signed byte b) {
word m = mulf8u((byte)a, (byte) b);
if(a<0) {
>m = (>m)-(byte)b;
}
if(b<0) {
>m = (>m)-(byte)a;
}
return (signed word)m;
}
// Fast multiply two unsigned words to a double word result
// Done in assembler to utilize fast addition A+X
dword mulf16u(word a, word b) {

View File

@ -44,6 +44,16 @@ public class TestPrograms {
AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false);
}
@Test
public void test3D() throws IOException, URISyntaxException {
compileAndCompare("examples/3d/3d");
}
@Test
public void testTypeInferenceProblem() throws IOException, URISyntaxException {
compileAndCompare("typeinference-problem");
}
@Test
public void testRotate() throws IOException, URISyntaxException {
compileAndCompare("examples/rotate/rotate");

View File

@ -0,0 +1,214 @@
// 3D Rotation using a Rotation Matrix
// Based on:
// - C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
// - Codebase64 Article http://codebase64.org/doku.php?id=base:3d_rotation
import "c64"
// Sine and Cosine Tables
// Angles: $00=0, $80=PI,$100=2*PI
// Half Sine/Cosine: signed fixed [-$1f,$1f]
signed byte* COSH = $2000;
signed byte* SINH = COSH+$40; // sin(x) = cos(x+PI/2)
// Quarter Sine/Cosine: signed fixed [-$0f,$0f]
signed byte* COSQ = $2200;
signed byte* SINQ = COSQ+$40; // sin(x) = cos(x+PI/2)
kickasm(pc COSH) {{
{
.var min = -$1fff
.var max = $1fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}
}}
kickasm(pc COSQ) {{
{
.var min = -$0fff
.var max = $0fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}
}}
// mulf_sqr tables will contain f(x)=int(x*x/2) and g(x) = f(1-x).
// f(x) = >(( x * x )/2)
byte[512] align($100) mulf_sqr1;
// g(x) = >((( 1 - x ) * ( 1 - x ))/2)
byte[512] align($100) mulf_sqr2;
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/2) and g(x) = f(1-x)
void mulf_init() {
signed word sqr1 = 0;
signed word add = 1;
for( byte i:0..128) {
mulf_sqr1[i] = >sqr1;
mulf_sqr1[-i] = >sqr1;
mulf_sqr2[i+1] = >sqr1;
mulf_sqr2[1-i] = >sqr1;
sqr1 += add;
add +=2;
}
}
// The rotated point - updated by calling rotate()
signed byte* xr = $f0;
signed byte* yr = $f1;
signed byte* zr = $f2;
void main() {
byte* SCREEN = $400;
asm { sei }
mulf_init();
prepare_matrix(0,0,0);
while(true) {
while(*RASTER!=$ff) {}
(*BORDERCOL)++;
rotate(0,0,$3f);
SCREEN[0] = (byte)*xr;
SCREEN[1] = (byte)*yr;
SCREEN[2] = (byte)*zr;
(*BORDERCOL)++;
rotate(0,$3f,0);
SCREEN[40] = (byte)*xr;
SCREEN[41] = (byte)*yr;
SCREEN[42] = (byte)*zr;
(*BORDERCOL)++;
rotate($3f,0,0);
SCREEN[80] = (byte)*xr;
SCREEN[81] = (byte)*yr;
SCREEN[82] = (byte)*zr;
*BORDERCOL = LIGHT_BLUE;
}
}
// The rotation matrix
signed byte[9] rotation_matrix;
// Prepare the rotation matrix [ [A,B,C],[D,E,F],[G,H,I]]
// Angles sx, sy, sz are based on 2*PI=$100
// Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt
void prepare_matrix(signed byte sx, signed byte sy, signed byte sz) {
signed byte t1 = sy-sz;
signed byte t2 = sy+sz;
signed byte t3 = sx+sz;
signed byte t4 = sx-sz;
signed byte t5 = sx+t2; // = sx+sy+sz
signed byte t6 = sx-t1; // = sx-sy+sz
signed byte t7 = sx+t1; // = sx+sy-sz
signed byte t8 = t2-sx; // = sy+sz-sx
signed byte t9 = sy-sx;
signed byte t10 = sy+sx;
rotation_matrix[0] = COSH[t1]+COSH[t2];
rotation_matrix[1] = SINH[t1]-SINH[t2];
rotation_matrix[2] = SINH[sy]+SINH[sy];
rotation_matrix[3] = SINH[t3]-SINH[t4] + COSQ[t6]-COSQ[t5]+COSQ[t8]-COSQ[t7];
rotation_matrix[4] = COSH[t3]+COSH[t4] + SINQ[t5]-SINQ[t6]-SINQ[t7]-SINQ[t8];
rotation_matrix[5] = SINH[t9]-SINH[t10];
rotation_matrix[6] = COSH[t4]-COSH[t3] + SINQ[t6]-SINQ[t5]-SINQ[t8]-SINQ[t7];
rotation_matrix[7] = SINH[t3]+SINH[t4] + COSQ[t6]-COSQ[t5]+COSQ[t7]-COSQ[t8];
rotation_matrix[8] = COSH[t9]+COSH[t10];
asm {
lda rotation_matrix+0
sta rotate.A1+1
eor #$ff
sta rotate.A2+1
lda rotation_matrix+1
sta rotate.B1+1
eor #$ff
sta rotate.B2+1
lda rotation_matrix+2
sta rotate.C1+1
eor #$ff
sta rotate.C2+1
lda rotation_matrix+3
sta rotate.D1+1
eor #$ff
sta rotate.D2+1
lda rotation_matrix+4
sta rotate.E1+1
eor #$ff
sta rotate.E2+1
lda rotation_matrix+5
sta rotate.F1+1
eor #$ff
sta rotate.F2+1
lda rotation_matrix+6
sta rotate.G1+1
eor #$ff
sta rotate.G2+1
lda rotation_matrix+7
sta rotate.H1+1
eor #$ff
sta rotate.H2+1
lda rotation_matrix+8
sta rotate.I1+1
eor #$ff
sta rotate.I2+1
}
}
// Rotate a 3D point (x,y,z) using the rotation matrix
// The rotation matrix is prepared by calling prepare_matrix()
// The passed points must be in the interval [-$3f;$3f].
// Implemented in assembler to utilize seriously fast multiplication
void rotate(signed byte x, signed byte y, signed byte z) {
*xr = x;
*yr = y;
*zr = z;
asm {
clc
ldx zr //z
// C*z
lda #$80
C1: adc mulf_sqr1,x
C2: sbc mulf_sqr2,x
sta C3+1
// F*z
lda #$80
F1: adc mulf_sqr1,x
F2: sbc mulf_sqr2,x
sta F3+1
// I*z
lda #$80
I1: adc mulf_sqr1,x
I2: sbc mulf_sqr2,x
sta I3+1
ldx xr //x
ldy yr //y
C3: lda #0 // C*z
A1: adc mulf_sqr1,x
A2: sbc mulf_sqr2,x
B1: adc mulf_sqr1,y
B2: sbc mulf_sqr2,y
sta xr
F3: lda #0 // F*z
D1: adc mulf_sqr1,x
D2: sbc mulf_sqr2,x
E1: adc mulf_sqr1,y
E2: sbc mulf_sqr2,y
sta yr
I3: lda #0 // I*z
G1: adc mulf_sqr1,x
G2: sbc mulf_sqr2,x
H1: adc mulf_sqr1,y
H2: sbc mulf_sqr2,y
sta zr
}
}

View File

@ -4,13 +4,23 @@ import "c64"
import "fastmultiply"
byte* SCREEN = $0400;
byte* SPRITE = $3000;
// Sine and Cosine tables
// Angles: $00=0, $80=PI,$100=2*PI
// Sine/Cosine: signed fixed [-$7f,$7f]
byte* COS = $2000;
byte* SIN = COS+$40; // sin(x) = cos(x+PI/2)
kickasm(pc COS) {{
{
.var min = -$7fff
.var max = $7fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}
}}
void main() {
asm { sei }
@ -65,18 +75,8 @@ void anim() {
}
}
kickasm(pc COS) {{
{
.var min = -$7fff
.var max = $7fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}
}}
// A single sprite
byte* SPRITE = $3000;
kickasm(pc SPRITE, resource "balloon.png") {{
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
.for (var y=0; y<21; y++)

View File

@ -0,0 +1,10 @@
// java.lang.NullPointerException during Pass2TypeInference.java
byte[256] table;
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/2) and g(x) = f(1-x)
void main() {
for( byte i:0..128) {
table[255-i] = 0;
}
}

View File

@ -0,0 +1,382 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label RASTER = $d012
.label BORDERCOL = $d020
.const LIGHT_BLUE = $e
.label COSH = $2000
.label COSQ = $2200
.label xr = $f0
.label yr = $f1
.label zr = $f2
.label SINH = COSH+$40
.label SINQ = COSQ+$40
jsr main
main: {
.label SCREEN = $400
sei
jsr mulf_init
jsr prepare_matrix
b4:
lda RASTER
cmp #$ff
bne b4
inc BORDERCOL
lda #$3f
sta rotate.z
lda #0
tax
tay
jsr rotate
lda xr
sta SCREEN
lda yr
sta SCREEN+1
lda zr
sta SCREEN+2
inc BORDERCOL
lda #0
sta rotate.z
lda #$3f
tax
lda #0
tay
jsr rotate
lda xr
sta SCREEN+$28
lda yr
sta SCREEN+$29
lda zr
sta SCREEN+$2a
inc BORDERCOL
lda #0
sta rotate.z
tax
lda #$3f
tay
jsr rotate
lda xr
sta SCREEN+$50
lda yr
sta SCREEN+$51
lda zr
sta SCREEN+$52
lda #LIGHT_BLUE
sta BORDERCOL
jmp b4
}
rotate: {
.label z = 2
tya
sta xr
txa
sta yr
lda z
sta zr
clc
tax
lda #$80
C1:
adc mulf_sqr1,x
C2:
sbc mulf_sqr2,x
sta C3+1
lda #$80
F1:
adc mulf_sqr1,x
F2:
sbc mulf_sqr2,x
sta F3+1
lda #$80
I1:
adc mulf_sqr1,x
I2:
sbc mulf_sqr2,x
sta I3+1
ldx xr
ldy yr
C3:
lda #0
A1:
adc mulf_sqr1,x
A2:
sbc mulf_sqr2,x
B1:
adc mulf_sqr1,y
B2:
sbc mulf_sqr2,y
sta xr
F3:
lda #0
D1:
adc mulf_sqr1,x
D2:
sbc mulf_sqr2,x
E1:
adc mulf_sqr1,y
E2:
sbc mulf_sqr2,y
sta yr
I3:
lda #0
G1:
adc mulf_sqr1,x
G2:
sbc mulf_sqr2,x
H1:
adc mulf_sqr1,y
H2:
sbc mulf_sqr2,y
sta zr
rts
}
prepare_matrix: {
.const sx = 0
.const sy = 0
.const sz = 0
.const t1 = sy-sz
.const t2 = sy+sz
.const t3 = sx+sz
.const t4 = sx-sz
.const t9 = sy-sx
.const t10 = sy+sx
.const t5 = sx+t2
.const t6 = sx-t1
.const t7 = sx+t1
.const t8 = t2-sx
.label _13 = 2
.label _15 = 2
.label _18 = 2
.label _24 = 2
.label _29 = 2
.label _31 = 2
lda COSH+t1
ldy COSH+t2
sty $ff
clc
adc $ff
sta rotation_matrix
lda SINH+t1
ldy SINH+t2
sty $ff
sec
sbc $ff
sta rotation_matrix+1
lda SINH+sy
tay
sty $ff
clc
adc $ff
sta rotation_matrix+2
lda SINH+t3
ldy SINH+t4
sty $ff
sec
sbc $ff
sta _13
lda COSQ+t6
clc
adc _13
ldy COSQ+t5
sty $ff
sec
sbc $ff
sta _15
lda COSQ+t8
clc
adc _15
ldy COSQ+t7
sty $ff
sec
sbc $ff
sta rotation_matrix+3
lda COSH+t3
ldy COSH+t4
sty $ff
clc
adc $ff
sta _18
lda SINQ+t5
clc
adc _18
ldy SINQ+t6
sty $ff
sec
sbc $ff
ldy SINQ+t7
sty $ff
sec
sbc $ff
ldy SINQ+t8
sty $ff
sec
sbc $ff
sta rotation_matrix+4
lda SINH+t9
ldy SINH+t10
sty $ff
sec
sbc $ff
sta rotation_matrix+5
lda COSH+t4
ldy COSH+t3
sty $ff
sec
sbc $ff
sta _24
lda SINQ+t6
clc
adc _24
ldy SINQ+t5
sty $ff
sec
sbc $ff
ldy SINQ+t8
sty $ff
sec
sbc $ff
ldy SINQ+t7
sty $ff
sec
sbc $ff
sta rotation_matrix+6
lda SINH+t3
ldy SINH+t4
sty $ff
clc
adc $ff
sta _29
lda COSQ+t6
clc
adc _29
ldy COSQ+t5
sty $ff
sec
sbc $ff
sta _31
lda COSQ+t7
clc
adc _31
ldy COSQ+t8
sty $ff
sec
sbc $ff
sta rotation_matrix+7
lda COSH+t9
ldy COSH+t10
sty $ff
clc
adc $ff
sta rotation_matrix+8
lda rotation_matrix+0
sta rotate.A1+1
eor #$ff
sta rotate.A2+1
lda rotation_matrix+1
sta rotate.B1+1
eor #$ff
sta rotate.B2+1
lda rotation_matrix+2
sta rotate.C1+1
eor #$ff
sta rotate.C2+1
lda rotation_matrix+3
sta rotate.D1+1
eor #$ff
sta rotate.D2+1
lda rotation_matrix+4
sta rotate.E1+1
eor #$ff
sta rotate.E2+1
lda rotation_matrix+5
sta rotate.F1+1
eor #$ff
sta rotate.F2+1
lda rotation_matrix+6
sta rotate.G1+1
eor #$ff
sta rotate.G2+1
lda rotation_matrix+7
sta rotate.H1+1
eor #$ff
sta rotate.H2+1
lda rotation_matrix+8
sta rotate.I1+1
eor #$ff
sta rotate.I2+1
rts
}
mulf_init: {
.label sqr1 = 3
.label add = 5
lda #<1
sta add
lda #>1
sta add+1
tax
sta sqr1
sta sqr1+1
b1:
lda sqr1+1
sta mulf_sqr1,x
txa
eor #$ff
clc
adc #1
tay
lda sqr1+1
sta mulf_sqr1,y
sta mulf_sqr2+1,x
txa
eor #$ff
clc
adc #1+1
tay
lda sqr1+1
sta mulf_sqr2,y
lda sqr1
clc
adc add
sta sqr1
lda sqr1+1
adc add+1
sta sqr1+1
lda add
clc
adc #2
sta add
bcc !+
inc add+1
!:
inx
cpx #$81
bne b1
rts
}
.align $100
mulf_sqr1: .fill $200, 0
.align $100
mulf_sqr2: .fill $200, 0
rotation_matrix: .fill 9, 0
.pc = COSH "Inline"
{
.var min = -$1fff
.var max = $1fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}
.pc = COSQ "Inline"
{
.var min = -$0fff
.var max = $0fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}

View File

@ -0,0 +1,143 @@
@begin: scope:[] from
[0] phi() [ ] ( )
to:@3
@3: scope:[] from @begin
kickasm(location (const signed byte*) COSH#0) {{ {
.var min = -$1fff
.var max = $1fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}
}}
kickasm(location (const signed byte*) COSQ#0) {{ {
.var min = -$0fff
.var max = $0fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}
}}
to:@7
@7: scope:[] from @3
[3] phi() [ ] ( )
[4] call main [ ] ( )
to:@end
@end: scope:[] from @7
[5] phi() [ ] ( )
main: scope:[main] from @7
asm { sei }
[7] call mulf_init [ ] ( main:4 [ ] )
to:main::@13
main::@13: scope:[main] from main
[8] phi() [ ] ( main:4 [ ] )
[9] call prepare_matrix [ ] ( main:4 [ ] )
to:main::@4
main::@4: scope:[main] from main::@13 main::@17 main::@4
[10] if(*((const byte*) RASTER#0)!=(byte/word/signed word/dword/signed dword) 255) goto main::@4 [ ] ( main:4 [ ] )
to:main::@6
main::@6: scope:[main] from main::@4
[11] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) [ ] ( main:4 [ ] )
[12] call rotate [ ] ( main:4 [ ] )
to:main::@15
main::@15: scope:[main] from main::@6
[13] *((const byte*) main::SCREEN#0) ← (byte)*((const signed byte*) xr#0) [ ] ( main:4 [ ] )
[14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte)*((const signed byte*) yr#0) [ ] ( main:4 [ ] )
[15] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte)*((const signed byte*) zr#0) [ ] ( main:4 [ ] )
[16] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) [ ] ( main:4 [ ] )
[17] call rotate [ ] ( main:4 [ ] )
to:main::@16
main::@16: scope:[main] from main::@15
[18] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 40) ← (byte)*((const signed byte*) xr#0) [ ] ( main:4 [ ] )
[19] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 41) ← (byte)*((const signed byte*) yr#0) [ ] ( main:4 [ ] )
[20] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 42) ← (byte)*((const signed byte*) zr#0) [ ] ( main:4 [ ] )
[21] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) [ ] ( main:4 [ ] )
[22] call rotate [ ] ( main:4 [ ] )
to:main::@17
main::@17: scope:[main] from main::@16
[23] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 80) ← (byte)*((const signed byte*) xr#0) [ ] ( main:4 [ ] )
[24] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 81) ← (byte)*((const signed byte*) yr#0) [ ] ( main:4 [ ] )
[25] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 82) ← (byte)*((const signed byte*) zr#0) [ ] ( main:4 [ ] )
[26] *((const byte*) BORDERCOL#0) ← (const byte) LIGHT_BLUE#0 [ ] ( main:4 [ ] )
to:main::@4
rotate: scope:[rotate] from main::@15 main::@16 main::@6
[27] (signed byte) rotate::z#3 ← phi( main::@15/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@16/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(byte/signed byte/word/signed word/dword/signed dword) 63 ) [ rotate::x#3 rotate::y#3 rotate::z#3 ] ( main:4::rotate:12 [ rotate::x#3 rotate::y#3 rotate::z#3 ] main:4::rotate:17 [ rotate::x#3 rotate::y#3 rotate::z#3 ] main:4::rotate:22 [ rotate::x#3 rotate::y#3 rotate::z#3 ] )
[27] (signed byte) rotate::y#3 ← phi( main::@15/(byte/signed byte/word/signed word/dword/signed dword) 63 main::@16/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ rotate::x#3 rotate::y#3 rotate::z#3 ] ( main:4::rotate:12 [ rotate::x#3 rotate::y#3 rotate::z#3 ] main:4::rotate:17 [ rotate::x#3 rotate::y#3 rotate::z#3 ] main:4::rotate:22 [ rotate::x#3 rotate::y#3 rotate::z#3 ] )
[27] (signed byte) rotate::x#3 ← phi( main::@15/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@16/(byte/signed byte/word/signed word/dword/signed dword) 63 main::@6/(byte/signed byte/word/signed word/dword/signed dword) 0 ) [ rotate::x#3 rotate::y#3 rotate::z#3 ] ( main:4::rotate:12 [ rotate::x#3 rotate::y#3 rotate::z#3 ] main:4::rotate:17 [ rotate::x#3 rotate::y#3 rotate::z#3 ] main:4::rotate:22 [ rotate::x#3 rotate::y#3 rotate::z#3 ] )
[28] *((const signed byte*) xr#0) ← (signed byte) rotate::x#3 [ rotate::y#3 rotate::z#3 ] ( main:4::rotate:12 [ rotate::y#3 rotate::z#3 ] main:4::rotate:17 [ rotate::y#3 rotate::z#3 ] main:4::rotate:22 [ rotate::y#3 rotate::z#3 ] )
[29] *((const signed byte*) yr#0) ← (signed byte) rotate::y#3 [ rotate::z#3 ] ( main:4::rotate:12 [ rotate::z#3 ] main:4::rotate:17 [ rotate::z#3 ] main:4::rotate:22 [ rotate::z#3 ] )
[30] *((const signed byte*) zr#0) ← (signed byte) rotate::z#3 [ ] ( main:4::rotate:12 [ ] main:4::rotate:17 [ ] main:4::rotate:22 [ ] )
asm { clc ldxzr lda#$80 C1: adcmulf_sqr1,x C2: sbcmulf_sqr2,x staC3+1 lda#$80 F1: adcmulf_sqr1,x F2: sbcmulf_sqr2,x staF3+1 lda#$80 I1: adcmulf_sqr1,x I2: sbcmulf_sqr2,x staI3+1 ldxxr ldyyr C3: lda#0 A1: adcmulf_sqr1,x A2: sbcmulf_sqr2,x B1: adcmulf_sqr1,y B2: sbcmulf_sqr2,y staxr F3: lda#0 D1: adcmulf_sqr1,x D2: sbcmulf_sqr2,x E1: adcmulf_sqr1,y E2: sbcmulf_sqr2,y stayr I3: lda#0 G1: adcmulf_sqr1,x G2: sbcmulf_sqr2,x H1: adcmulf_sqr1,y H2: sbcmulf_sqr2,y stazr }
to:rotate::@return
rotate::@return: scope:[rotate] from rotate
[32] return [ ] ( main:4::rotate:12 [ ] main:4::rotate:17 [ ] main:4::rotate:22 [ ] )
to:@return
prepare_matrix: scope:[prepare_matrix] from main::@13
[33] (signed byte~) prepare_matrix::$10 ← *((const signed byte*) COSH#0+(const signed byte) prepare_matrix::t1#0) + *((const signed byte*) COSH#0+(const signed byte) prepare_matrix::t2#0) [ prepare_matrix::$10 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$10 ] )
[34] *((const signed byte[9]) rotation_matrix#0) ← (signed byte~) prepare_matrix::$10 [ ] ( main:4::prepare_matrix:9 [ ] )
[35] (signed byte~) prepare_matrix::$11 ← *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::t1#0) - *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::t2#0) [ prepare_matrix::$11 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$11 ] )
[36] *((const signed byte[9]) rotation_matrix#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (signed byte~) prepare_matrix::$11 [ ] ( main:4::prepare_matrix:9 [ ] )
[37] (signed byte~) prepare_matrix::$12 ← *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::sy#0) + *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::sy#0) [ prepare_matrix::$12 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$12 ] )
[38] *((const signed byte[9]) rotation_matrix#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (signed byte~) prepare_matrix::$12 [ ] ( main:4::prepare_matrix:9 [ ] )
[39] (signed byte~) prepare_matrix::$13 ← *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::t3#0) - *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::t4#0) [ prepare_matrix::$13 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$13 ] )
[40] (signed byte~) prepare_matrix::$14 ← (signed byte~) prepare_matrix::$13 + *((const signed byte*) COSQ#0+(const signed byte) prepare_matrix::t6#0) [ prepare_matrix::$14 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$14 ] )
[41] (signed byte~) prepare_matrix::$15 ← (signed byte~) prepare_matrix::$14 - *((const signed byte*) COSQ#0+(const signed byte) prepare_matrix::t5#0) [ prepare_matrix::$15 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$15 ] )
[42] (signed byte~) prepare_matrix::$16 ← (signed byte~) prepare_matrix::$15 + *((const signed byte*) COSQ#0+(const signed byte) prepare_matrix::t8#0) [ prepare_matrix::$16 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$16 ] )
[43] (signed byte~) prepare_matrix::$17 ← (signed byte~) prepare_matrix::$16 - *((const signed byte*) COSQ#0+(const signed byte) prepare_matrix::t7#0) [ prepare_matrix::$17 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$17 ] )
[44] *((const signed byte[9]) rotation_matrix#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (signed byte~) prepare_matrix::$17 [ ] ( main:4::prepare_matrix:9 [ ] )
[45] (signed byte~) prepare_matrix::$18 ← *((const signed byte*) COSH#0+(const signed byte) prepare_matrix::t3#0) + *((const signed byte*) COSH#0+(const signed byte) prepare_matrix::t4#0) [ prepare_matrix::$18 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$18 ] )
[46] (signed byte~) prepare_matrix::$19 ← (signed byte~) prepare_matrix::$18 + *((const signed byte*) SINQ#0+(const signed byte) prepare_matrix::t5#0) [ prepare_matrix::$19 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$19 ] )
[47] (signed byte~) prepare_matrix::$20 ← (signed byte~) prepare_matrix::$19 - *((const signed byte*) SINQ#0+(const signed byte) prepare_matrix::t6#0) [ prepare_matrix::$20 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$20 ] )
[48] (signed byte~) prepare_matrix::$21 ← (signed byte~) prepare_matrix::$20 - *((const signed byte*) SINQ#0+(const signed byte) prepare_matrix::t7#0) [ prepare_matrix::$21 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$21 ] )
[49] (signed byte~) prepare_matrix::$22 ← (signed byte~) prepare_matrix::$21 - *((const signed byte*) SINQ#0+(const signed byte) prepare_matrix::t8#0) [ prepare_matrix::$22 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$22 ] )
[50] *((const signed byte[9]) rotation_matrix#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (signed byte~) prepare_matrix::$22 [ ] ( main:4::prepare_matrix:9 [ ] )
[51] (signed byte~) prepare_matrix::$23 ← *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::t9#0) - *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::t10#0) [ prepare_matrix::$23 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$23 ] )
[52] *((const signed byte[9]) rotation_matrix#0+(byte/signed byte/word/signed word/dword/signed dword) 5) ← (signed byte~) prepare_matrix::$23 [ ] ( main:4::prepare_matrix:9 [ ] )
[53] (signed byte~) prepare_matrix::$24 ← *((const signed byte*) COSH#0+(const signed byte) prepare_matrix::t4#0) - *((const signed byte*) COSH#0+(const signed byte) prepare_matrix::t3#0) [ prepare_matrix::$24 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$24 ] )
[54] (signed byte~) prepare_matrix::$25 ← (signed byte~) prepare_matrix::$24 + *((const signed byte*) SINQ#0+(const signed byte) prepare_matrix::t6#0) [ prepare_matrix::$25 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$25 ] )
[55] (signed byte~) prepare_matrix::$26 ← (signed byte~) prepare_matrix::$25 - *((const signed byte*) SINQ#0+(const signed byte) prepare_matrix::t5#0) [ prepare_matrix::$26 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$26 ] )
[56] (signed byte~) prepare_matrix::$27 ← (signed byte~) prepare_matrix::$26 - *((const signed byte*) SINQ#0+(const signed byte) prepare_matrix::t8#0) [ prepare_matrix::$27 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$27 ] )
[57] (signed byte~) prepare_matrix::$28 ← (signed byte~) prepare_matrix::$27 - *((const signed byte*) SINQ#0+(const signed byte) prepare_matrix::t7#0) [ prepare_matrix::$28 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$28 ] )
[58] *((const signed byte[9]) rotation_matrix#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (signed byte~) prepare_matrix::$28 [ ] ( main:4::prepare_matrix:9 [ ] )
[59] (signed byte~) prepare_matrix::$29 ← *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::t3#0) + *((const signed byte*) SINH#0+(const signed byte) prepare_matrix::t4#0) [ prepare_matrix::$29 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$29 ] )
[60] (signed byte~) prepare_matrix::$30 ← (signed byte~) prepare_matrix::$29 + *((const signed byte*) COSQ#0+(const signed byte) prepare_matrix::t6#0) [ prepare_matrix::$30 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$30 ] )
[61] (signed byte~) prepare_matrix::$31 ← (signed byte~) prepare_matrix::$30 - *((const signed byte*) COSQ#0+(const signed byte) prepare_matrix::t5#0) [ prepare_matrix::$31 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$31 ] )
[62] (signed byte~) prepare_matrix::$32 ← (signed byte~) prepare_matrix::$31 + *((const signed byte*) COSQ#0+(const signed byte) prepare_matrix::t7#0) [ prepare_matrix::$32 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$32 ] )
[63] (signed byte~) prepare_matrix::$33 ← (signed byte~) prepare_matrix::$32 - *((const signed byte*) COSQ#0+(const signed byte) prepare_matrix::t8#0) [ prepare_matrix::$33 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$33 ] )
[64] *((const signed byte[9]) rotation_matrix#0+(byte/signed byte/word/signed word/dword/signed dword) 7) ← (signed byte~) prepare_matrix::$33 [ ] ( main:4::prepare_matrix:9 [ ] )
[65] (signed byte~) prepare_matrix::$34 ← *((const signed byte*) COSH#0+(const signed byte) prepare_matrix::t9#0) + *((const signed byte*) COSH#0+(const signed byte) prepare_matrix::t10#0) [ prepare_matrix::$34 ] ( main:4::prepare_matrix:9 [ prepare_matrix::$34 ] )
[66] *((const signed byte[9]) rotation_matrix#0+(byte/signed byte/word/signed word/dword/signed dword) 8) ← (signed byte~) prepare_matrix::$34 [ ] ( main:4::prepare_matrix:9 [ ] )
asm { ldarotation_matrix+0 starotate.A1+1 eor#$ff starotate.A2+1 ldarotation_matrix+1 starotate.B1+1 eor#$ff starotate.B2+1 ldarotation_matrix+2 starotate.C1+1 eor#$ff starotate.C2+1 ldarotation_matrix+3 starotate.D1+1 eor#$ff starotate.D2+1 ldarotation_matrix+4 starotate.E1+1 eor#$ff starotate.E2+1 ldarotation_matrix+5 starotate.F1+1 eor#$ff starotate.F2+1 ldarotation_matrix+6 starotate.G1+1 eor#$ff starotate.G2+1 ldarotation_matrix+7 starotate.H1+1 eor#$ff starotate.H2+1 ldarotation_matrix+8 starotate.I1+1 eor#$ff starotate.I2+1 }
to:prepare_matrix::@return
prepare_matrix::@return: scope:[prepare_matrix] from prepare_matrix
[68] return [ ] ( main:4::prepare_matrix:9 [ ] )
to:@return
mulf_init: scope:[mulf_init] from main
[69] phi() [ ] ( main:4::mulf_init:7 [ ] )
to:mulf_init::@1
mulf_init::@1: scope:[mulf_init] from mulf_init mulf_init::@1
[70] (signed word) mulf_init::add#2 ← phi( mulf_init/(byte/signed byte/word/signed word/dword/signed dword) 1 mulf_init::@1/(signed word) mulf_init::add#1 ) [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] )
[70] (byte) mulf_init::i#2 ← phi( mulf_init/(byte/signed byte/word/signed word/dword/signed dword) 0 mulf_init::@1/(byte) mulf_init::i#1 ) [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] )
[70] (signed word) mulf_init::sqr1#2 ← phi( mulf_init/(byte/signed byte/word/signed word/dword/signed dword) 0 mulf_init::@1/(signed word) mulf_init::sqr1#1 ) [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] )
[71] (byte~) mulf_init::$0 ← > (signed word) mulf_init::sqr1#2 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$0 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$0 ] )
[72] *((const byte[512]) mulf_sqr1#0 + (byte) mulf_init::i#2) ← (byte~) mulf_init::$0 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] )
[73] (byte~) mulf_init::$1 ← - (byte) mulf_init::i#2 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$1 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$1 ] )
[74] (byte~) mulf_init::$2 ← > (signed word) mulf_init::sqr1#2 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$1 mulf_init::$2 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$1 mulf_init::$2 ] )
[75] *((const byte[512]) mulf_sqr1#0 + (byte~) mulf_init::$1) ← (byte~) mulf_init::$2 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] )
[76] (byte~) mulf_init::$4 ← > (signed word) mulf_init::sqr1#2 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$4 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$4 ] )
[77] *((const byte[512]) mulf_sqr2#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) mulf_init::i#2) ← (byte~) mulf_init::$4 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] )
[78] (byte/signed word/word/dword/signed dword~) mulf_init::$5 ← (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) mulf_init::i#2 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$5 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$5 ] )
[79] (byte~) mulf_init::$6 ← > (signed word) mulf_init::sqr1#2 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$5 mulf_init::$6 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 mulf_init::$5 mulf_init::$6 ] )
[80] *((const byte[512]) mulf_sqr2#0 + (byte/signed word/word/dword/signed dword~) mulf_init::$5) ← (byte~) mulf_init::$6 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#2 mulf_init::i#2 mulf_init::add#2 ] )
[81] (signed word) mulf_init::sqr1#1 ← (signed word) mulf_init::sqr1#2 + (signed word) mulf_init::add#2 [ mulf_init::i#2 mulf_init::add#2 mulf_init::sqr1#1 ] ( main:4::mulf_init:7 [ mulf_init::i#2 mulf_init::add#2 mulf_init::sqr1#1 ] )
[82] (signed word) mulf_init::add#1 ← (signed word) mulf_init::add#2 + (byte/signed byte/word/signed word/dword/signed dword) 2 [ mulf_init::i#2 mulf_init::sqr1#1 mulf_init::add#1 ] ( main:4::mulf_init:7 [ mulf_init::i#2 mulf_init::sqr1#1 mulf_init::add#1 ] )
[83] (byte) mulf_init::i#1 ← ++ (byte) mulf_init::i#2 [ mulf_init::sqr1#1 mulf_init::i#1 mulf_init::add#1 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#1 mulf_init::i#1 mulf_init::add#1 ] )
[84] if((byte) mulf_init::i#1!=(byte/word/signed word/dword/signed dword) 129) goto mulf_init::@1 [ mulf_init::sqr1#1 mulf_init::i#1 mulf_init::add#1 ] ( main:4::mulf_init:7 [ mulf_init::sqr1#1 mulf_init::i#1 mulf_init::add#1 ] )
to:mulf_init::@return
mulf_init::@return: scope:[mulf_init] from mulf_init::@1
[85] return [ ] ( main:4::mulf_init:7 [ ] )
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,150 @@
(label) @3
(label) @7
(label) @begin
(label) @end
(byte*) BORDERCOL
(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53280
(signed byte*) COSH
(const signed byte*) COSH#0 COSH = ((signed byte*))(word/signed word/dword/signed dword) 8192
(signed byte*) COSQ
(const signed byte*) COSQ#0 COSQ = ((signed byte*))(word/signed word/dword/signed dword) 8704
(byte) LIGHT_BLUE
(const byte) LIGHT_BLUE#0 LIGHT_BLUE = (byte/signed byte/word/signed word/dword/signed dword) 14
(byte*) RASTER
(const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266
(signed byte*) SINH
(const signed byte*) SINH#0 SINH = (const signed byte*) COSH#0+(byte/signed byte/word/signed word/dword/signed dword) 64
(signed byte*) SINQ
(const signed byte*) SINQ#0 SINQ = (const signed byte*) COSQ#0+(byte/signed byte/word/signed word/dword/signed dword) 64
(void()) main()
(label) main::@13
(label) main::@15
(label) main::@16
(label) main::@17
(label) main::@4
(label) main::@6
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
(void()) mulf_init()
(byte~) mulf_init::$0 reg byte a 22.0
(byte~) mulf_init::$1 reg byte y 11.0
(byte~) mulf_init::$2 reg byte a 22.0
(byte~) mulf_init::$4 reg byte a 22.0
(byte/signed word/word/dword/signed dword~) mulf_init::$5 reg byte y 11.0
(byte~) mulf_init::$6 reg byte a 22.0
(label) mulf_init::@1
(label) mulf_init::@return
(signed word) mulf_init::add
(signed word) mulf_init::add#1 add zp ZP_WORD:5 7.333333333333333
(signed word) mulf_init::add#2 add zp ZP_WORD:5 2.75
(byte) mulf_init::i
(byte) mulf_init::i#1 reg byte x 16.5
(byte) mulf_init::i#2 reg byte x 5.076923076923077
(signed word) mulf_init::sqr1
(signed word) mulf_init::sqr1#1 sqr1 zp ZP_WORD:3 5.5
(signed word) mulf_init::sqr1#2 sqr1 zp ZP_WORD:3 6.0
(byte[512]) mulf_sqr1
(const byte[512]) mulf_sqr1#0 mulf_sqr1 = { fill( 512, 0) }
(byte[512]) mulf_sqr2
(const byte[512]) mulf_sqr2#0 mulf_sqr2 = { fill( 512, 0) }
(void()) prepare_matrix((signed byte) prepare_matrix::sx , (signed byte) prepare_matrix::sy , (signed byte) prepare_matrix::sz)
(signed byte~) prepare_matrix::$10 reg byte a 4.0
(signed byte~) prepare_matrix::$11 reg byte a 4.0
(signed byte~) prepare_matrix::$12 reg byte a 4.0
(signed byte~) prepare_matrix::$13 $13 zp ZP_BYTE:2 4.0
(signed byte~) prepare_matrix::$14 reg byte a 4.0
(signed byte~) prepare_matrix::$15 $15 zp ZP_BYTE:2 4.0
(signed byte~) prepare_matrix::$16 reg byte a 4.0
(signed byte~) prepare_matrix::$17 reg byte a 4.0
(signed byte~) prepare_matrix::$18 $18 zp ZP_BYTE:2 4.0
(signed byte~) prepare_matrix::$19 reg byte a 4.0
(signed byte~) prepare_matrix::$20 reg byte a 4.0
(signed byte~) prepare_matrix::$21 reg byte a 4.0
(signed byte~) prepare_matrix::$22 reg byte a 4.0
(signed byte~) prepare_matrix::$23 reg byte a 4.0
(signed byte~) prepare_matrix::$24 $24 zp ZP_BYTE:2 4.0
(signed byte~) prepare_matrix::$25 reg byte a 4.0
(signed byte~) prepare_matrix::$26 reg byte a 4.0
(signed byte~) prepare_matrix::$27 reg byte a 4.0
(signed byte~) prepare_matrix::$28 reg byte a 4.0
(signed byte~) prepare_matrix::$29 $29 zp ZP_BYTE:2 4.0
(signed byte~) prepare_matrix::$30 reg byte a 4.0
(signed byte~) prepare_matrix::$31 $31 zp ZP_BYTE:2 4.0
(signed byte~) prepare_matrix::$32 reg byte a 4.0
(signed byte~) prepare_matrix::$33 reg byte a 4.0
(signed byte~) prepare_matrix::$34 reg byte a 4.0
(label) prepare_matrix::@return
(signed byte) prepare_matrix::sx
(const signed byte) prepare_matrix::sx#0 sx = (byte/signed byte/word/signed word/dword/signed dword) 0
(signed byte) prepare_matrix::sy
(const signed byte) prepare_matrix::sy#0 sy = (byte/signed byte/word/signed word/dword/signed dword) 0
(signed byte) prepare_matrix::sz
(const signed byte) prepare_matrix::sz#0 sz = (byte/signed byte/word/signed word/dword/signed dword) 0
(signed byte) prepare_matrix::t1
(const signed byte) prepare_matrix::t1#0 t1 = (const signed byte) prepare_matrix::sy#0-(const signed byte) prepare_matrix::sz#0
(signed byte) prepare_matrix::t10
(const signed byte) prepare_matrix::t10#0 t10 = (const signed byte) prepare_matrix::sy#0+(const signed byte) prepare_matrix::sx#0
(signed byte) prepare_matrix::t2
(const signed byte) prepare_matrix::t2#0 t2 = (const signed byte) prepare_matrix::sy#0+(const signed byte) prepare_matrix::sz#0
(signed byte) prepare_matrix::t3
(const signed byte) prepare_matrix::t3#0 t3 = (const signed byte) prepare_matrix::sx#0+(const signed byte) prepare_matrix::sz#0
(signed byte) prepare_matrix::t4
(const signed byte) prepare_matrix::t4#0 t4 = (const signed byte) prepare_matrix::sx#0-(const signed byte) prepare_matrix::sz#0
(signed byte) prepare_matrix::t5
(const signed byte) prepare_matrix::t5#0 t5 = (const signed byte) prepare_matrix::sx#0+(const signed byte) prepare_matrix::t2#0
(signed byte) prepare_matrix::t6
(const signed byte) prepare_matrix::t6#0 t6 = (const signed byte) prepare_matrix::sx#0-(const signed byte) prepare_matrix::t1#0
(signed byte) prepare_matrix::t7
(const signed byte) prepare_matrix::t7#0 t7 = (const signed byte) prepare_matrix::sx#0+(const signed byte) prepare_matrix::t1#0
(signed byte) prepare_matrix::t8
(const signed byte) prepare_matrix::t8#0 t8 = (const signed byte) prepare_matrix::t2#0-(const signed byte) prepare_matrix::sx#0
(signed byte) prepare_matrix::t9
(const signed byte) prepare_matrix::t9#0 t9 = (const signed byte) prepare_matrix::sy#0-(const signed byte) prepare_matrix::sx#0
(void()) rotate((signed byte) rotate::x , (signed byte) rotate::y , (signed byte) rotate::z)
(label) rotate::@return
(signed byte) rotate::x
(signed byte) rotate::x#3 reg byte y 2.0
(signed byte) rotate::y
(signed byte) rotate::y#3 reg byte x 1.0
(signed byte) rotate::z
(signed byte) rotate::z#3 z zp ZP_BYTE:2 0.6666666666666666
(signed byte[9]) rotation_matrix
(const signed byte[9]) rotation_matrix#0 rotation_matrix = { fill( 9, 0) }
(signed byte*) xr
(const signed byte*) xr#0 xr = ((signed byte*))(byte/word/signed word/dword/signed dword) 240
(signed byte*) yr
(const signed byte*) yr#0 yr = ((signed byte*))(byte/word/signed word/dword/signed dword) 241
(signed byte*) zr
(const signed byte*) zr#0 zr = ((signed byte*))(byte/word/signed word/dword/signed dword) 242
reg byte y [ rotate::x#3 ]
reg byte x [ rotate::y#3 ]
zp ZP_BYTE:2 [ rotate::z#3 prepare_matrix::$13 prepare_matrix::$15 prepare_matrix::$18 prepare_matrix::$24 prepare_matrix::$29 prepare_matrix::$31 ]
zp ZP_WORD:3 [ mulf_init::sqr1#2 mulf_init::sqr1#1 ]
reg byte x [ mulf_init::i#2 mulf_init::i#1 ]
zp ZP_WORD:5 [ mulf_init::add#2 mulf_init::add#1 ]
reg byte a [ prepare_matrix::$10 ]
reg byte a [ prepare_matrix::$11 ]
reg byte a [ prepare_matrix::$12 ]
reg byte a [ prepare_matrix::$14 ]
reg byte a [ prepare_matrix::$16 ]
reg byte a [ prepare_matrix::$17 ]
reg byte a [ prepare_matrix::$19 ]
reg byte a [ prepare_matrix::$20 ]
reg byte a [ prepare_matrix::$21 ]
reg byte a [ prepare_matrix::$22 ]
reg byte a [ prepare_matrix::$23 ]
reg byte a [ prepare_matrix::$25 ]
reg byte a [ prepare_matrix::$26 ]
reg byte a [ prepare_matrix::$27 ]
reg byte a [ prepare_matrix::$28 ]
reg byte a [ prepare_matrix::$30 ]
reg byte a [ prepare_matrix::$32 ]
reg byte a [ prepare_matrix::$33 ]
reg byte a [ prepare_matrix::$34 ]
reg byte a [ mulf_init::$0 ]
reg byte y [ mulf_init::$1 ]
reg byte a [ mulf_init::$2 ]
reg byte a [ mulf_init::$4 ]
reg byte y [ mulf_init::$5 ]
reg byte a [ mulf_init::$6 ]

View File

@ -11,8 +11,8 @@
.const GREEN = 5
.const LIGHT_BLUE = $e
.label SCREEN = $400
.label SPRITE = $3000
.label COS = $2000
.label SPRITE = $3000
.label SIN = COS+$40
jsr main
main: {
@ -335,7 +335,7 @@ mulf_init: {
.var max = $7fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}

View File

@ -1,17 +1,19 @@
@begin: scope:[] from
[0] phi() [ ] ( )
to:@17
@17: scope:[] from @begin
to:@12
@12: scope:[] from @begin
kickasm(location (const byte*) COS#0) {{ {
.var min = -$7fff
.var max = $7fff
.var ampl = max-min;
.for(var i=0;i<$140;i++) {
.var rad = i*2*PI/256;
.var rad = i*2*PI/256;
.byte >round(min+(ampl/2)+(ampl/2)*cos(rad))
}
}
}}
to:@15
@15: scope:[] from @12
kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
.for (var y=0; y<21; y++)
.for (var x=0;x<3; x++)
@ -19,9 +21,9 @@
}}
[3] call main [ ] ( )
to:@end
@end: scope:[] from @17
@end: scope:[] from @15
[4] phi() [ ] ( )
main: scope:[main] from @17
main: scope:[main] from @15
asm { sei }
[6] call init [ ] ( main:3 [ ] )
to:main::@1

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
(label) @17
(label) @12
(label) @15
(label) @begin
(label) @end
(byte*) BORDERCOL

View File

@ -0,0 +1,20 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
jsr main
main: {
ldx #0
b1:
txa
eor #$ff
clc
adc #$ff+1
tay
lda #0
sta table,y
inx
cpx #$81
bne b1
rts
}
table: .fill $100, 0

View File

@ -0,0 +1,22 @@
@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() [ ] ( main:2 [ ] )
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] ( main:2 [ main::i#2 ] )
[6] (byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 255 - (byte) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] )
[7] *((const byte[256]) table#0 + (byte/word/signed word/dword/signed dword~) main::$0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 ] ( main:2 [ main::i#2 ] )
[8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] )
[9] if((byte) main::i#1!=(byte/word/signed word/dword/signed dword) 129) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] )
to:main::@return
main::@return: scope:[main] from main::@1
[10] return [ ] ( main:2 [ ] )
to:@return

View File

@ -0,0 +1,332 @@
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte[256]) table#0 ← { fill( 256, 0) }
to:@1
main: scope:[main] from @1
(byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
(byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 255 - (byte) main::i#2
*((byte[256]) table#0 + (byte/word/signed word/dword/signed dword~) main::$0) ← (byte/signed byte/word/signed word/dword/signed dword) 0
(byte) main::i#1 ← (byte) main::i#2 + rangenext(0,128)
(bool~) main::$1 ← (byte) main::i#1 != rangelast(0,128)
if((bool~) main::$1) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(void()) main()
(byte/word/signed word/dword/signed dword~) main::$0
(bool~) main::$1
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte[256]) table
(byte[256]) table#0
Culled Empty Block (label) @2
Successful SSA optimization Pass2CullEmptyBlocks
Simple Condition (bool~) main::$1 if((byte) main::i#1!=rangelast(0,128)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte[256]) table#0 = { fill( 256, 0) }
Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,128)) goto main::@1 to (byte/word/signed word/dword/signed dword) 129
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@3(between main::@1 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Coalesced [11] main::i#3 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) main::@3
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
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] phi() [ ] ( main:2 [ ] )
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] ( main:2 [ main::i#2 ] )
[6] (byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 255 - (byte) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] )
[7] *((const byte[256]) table#0 + (byte/word/signed word/dword/signed dword~) main::$0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 ] ( main:2 [ main::i#2 ] )
[8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] )
[9] if((byte) main::i#1!=(byte/word/signed word/dword/signed dword) 129) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] )
to:main::@return
main::@return: scope:[main] from main::@1
[10] return [ ] ( main:2 [ ] )
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte/word/signed word/dword/signed dword~) main::$0 22.0
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 11.0
(byte[256]) table
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
Added variable main::$0 to zero page equivalence class [ main::$0 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::$0 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::$0 ]
INITIAL ASM
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
b1:
//SEG5 [2] call main [ ] ( )
//SEG6 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
bend:
//SEG9 main
main: {
.label _0 = 3
.label i = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
b1:
//SEG15 [6] (byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 255 - (byte) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) -- vbuz1=vbuc1_minus_vbuz2
lda #$ff
sec
sbc i
sta _0
//SEG16 [7] *((const byte[256]) table#0 + (byte/word/signed word/dword/signed dword~) main::$0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2
ldy _0
lda #0
sta table,y
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuz1=_inc_vbuz1
inc i
//SEG18 [9] if((byte) main::i#1!=(byte/word/signed word/dword/signed dword) 129) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$81
bne b1_from_b1
jmp breturn
//SEG19 main::@return
breturn:
//SEG20 [10] return [ ] ( main:2 [ ] )
rts
}
table: .fill $100, 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 255 - (byte) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [7] *((const byte[256]) table#0 + (byte/word/signed word/dword/signed dword~) main::$0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Statement [6] (byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 255 - (byte) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) always clobbers reg byte a
Statement [7] *((const byte[256]) table#0 + (byte/word/signed word/dword/signed dword~) main::$0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::$0 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 22: zp ZP_BYTE:3 [ main::$0 ]
Uplift Scope []
Uplifting [main] best 363 combination reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$0 ]
Uplifting [] best 363 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
b1:
//SEG5 [2] call main [ ] ( )
//SEG6 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
bend:
//SEG9 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
b1_from_b1:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
b1:
//SEG15 [6] (byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 255 - (byte) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) -- vbuaa=vbuc1_minus_vbuxx
txa
eor #$ff
clc
adc #$ff+1
//SEG16 [7] *((const byte[256]) table#0 + (byte/word/signed word/dword/signed dword~) main::$0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuaa=vbuc2
tay
lda #0
sta table,y
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx=_inc_vbuxx
inx
//SEG18 [9] if((byte) main::i#1!=(byte/word/signed word/dword/signed dword) 129) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1
cpx #$81
bne b1_from_b1
jmp breturn
//SEG19 main::@return
breturn:
//SEG20 [10] return [ ] ( main:2 [ ] )
rts
}
table: .fill $100, 0
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b1 with b1
Removing instruction bbegin:
Removing instruction b1_from_bbegin:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction b1:
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(byte/word/signed word/dword/signed dword~) main::$0 reg byte a 22.0
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 11.0
(byte[256]) table
(const byte[256]) table#0 table = { fill( 256, 0) }
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ main::$0 ]
FINAL ASSEMBLER
Score: 267
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main [ ] ( )
//SEG6 [4] phi from @1 to main [phi:@1->main]
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG12 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG14 main::@1
b1:
//SEG15 [6] (byte/word/signed word/dword/signed dword~) main::$0 ← (byte/word/signed word/dword/signed dword) 255 - (byte) main::i#2 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) -- vbuaa=vbuc1_minus_vbuxx
txa
eor #$ff
clc
adc #$ff+1
//SEG16 [7] *((const byte[256]) table#0 + (byte/word/signed word/dword/signed dword~) main::$0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuaa=vbuc2
tay
lda #0
sta table,y
//SEG17 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx=_inc_vbuxx
inx
//SEG18 [9] if((byte) main::i#1!=(byte/word/signed word/dword/signed dword) 129) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1
cpx #$81
bne b1
//SEG19 main::@return
//SEG20 [10] return [ ] ( main:2 [ ] )
rts
}
table: .fill $100, 0

View File

@ -0,0 +1,15 @@
(label) @1
(label) @begin
(label) @end
(void()) main()
(byte/word/signed word/dword/signed dword~) main::$0 reg byte a 22.0
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 11.0
(byte[256]) table
(const byte[256]) table#0 table = { fill( 256, 0) }
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ main::$0 ]