1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-10-21 17:24:39 +00:00

Added missing fragment.

This commit is contained in:
jespergravgaard 2020-05-07 08:42:27 +02:00
parent 21ee39aafa
commit 42aa2d9a8f
8 changed files with 275 additions and 238 deletions

View File

@ -0,0 +1,4 @@
lsr {m1}+1
ror {m1}
lsr {m1}+1
ror {m1}

View File

@ -11,11 +11,16 @@ void main() {
memset(SCREEN, ' ', 1000);
unsigned int count = 0;
char* sc = SCREEN;
for(char y=0;y<25;y++) {
for(char x=0;x<40;x++) {
signed char xd = (signed char)x*2-39;
signed char yd = (signed char)y*2-24;
for(signed char y=0;y<25;y++) {
for(signed char x=0;x<40;x++) {
// xd = x-19.5
// Multiply everything by 2 to allow integer math to calculate with .5 precision
signed char xd = x*2-39;
// yd = y-12
signed char yd = y*2-24;
// dist_sq = xd*xd + yd*yd
signed int dist_sq = mul8s(xd,xd) + mul8s(yd,yd);
// is dist_sq < 9*9 (distance to center is less than 9)
if(dist_sq<2*9*2*9) {
*sc = '*';
count++;

View File

@ -1,15 +1,13 @@
*Line Buffer*
### Line Buffer
Used for rendering lines into. Organized with linear addressed columns of 8 bits, allowing the line routine to addess the y-coordinate using X/Y-addressing.
*Screen Buffer*
### Screen Buffer
Used for filling & showing to the user. There are 2 screen buffers allowing for double buffering.
Memory organization is be adapted to the specific display. This means the same line routines can be used for charsets, bitmaps, sprites etc.
*Algorithm*
### Algorithm
1. Move points
2. Clear line buffer
@ -18,7 +16,7 @@ Memory organization is be adapted to the specific display. This means the same
5. EOR-fill from line buffer into screen buffer
6. Mark screen buffer for showing, swap screen buffer
*Line Drawing*
### Line Drawing
Optimized line drawing routines for the 8 different cases. (xd positive/negative, yd , xd-yd positive/negative)
@ -29,11 +27,11 @@ Optimized line drawing routines for the 8 different cases. (xd positive/negative
- unrolled line routines can be called by writing an RTS at code of the stop x-position and JSR'ing into the code for the start X-position.
- The RTS must be fixed again after return.
*EOR filling*
### EOR filling
Unrolled EOR-filler from the line buffer. The screen buffer does not need to be cleared because the filler always fills all bytes.
*Effective Canvas Shape*
### Effective Canvas Shape
Both the line canvas and screen canvas can benefit from identifying the effective canvas shape where an object can be rendered.
For instance a freely 3D-rotated object may only occupy a circular shaped canvas.
@ -41,5 +39,3 @@ By only clearing & filling this effective canvas these time consuming routines a
It might also be worth dynamically detecting the canvas shape for each rendered frame - to allow even faster clear/fill.
This will require an efficient way of identifying min/max y-value in for each column that consumes less time than the time saved by not clearing/filling.

View File

@ -81,14 +81,14 @@ void main() {
line(canvas, x0, y0, x1, y1);
char x2 = COSTAB[p2_idx];
char y2 = SINTAB[p2_idx];
//line(canvas, x1, y1, x2, y2);
//line(canvas, x2, y2, x0, y0);
line(canvas, x1, y1, x2, y2);
line(canvas, x2, y2, x0, y0);
// Move idx
//p0_idx++;
//p1_idx++;
//p2_idx++;
p0_idx++;
p1_idx++;
p2_idx++;
// Fill canvas
//eorfill(canvas);
eorfill(canvas);
// Swap canvas to show on screen (using XOR)
canvas_show_memory ^= toD018(SCREEN,CANVAS1)^toD018(SCREEN,CANVAS2);
// swap canvas being rendered to (using XOR)
@ -100,7 +100,9 @@ void main() {
printf("(%02x,%02x)-(%02x,%02x)", x0, y0, x1, y1);
// Wait until the canvas on screen has been switched before starting work on the next frame
canvas_show_flag = 1;
VICII->BORDER_COLOR = RED;
while(canvas_show_flag) {}
VICII->BORDER_COLOR = BLACK;
}
}

View File

@ -69,10 +69,14 @@ main: {
sta.z count+1
sta.z y
__b1:
// for(char y=0;y<25;y++)
// for(signed char y=0;y<25;y++)
lda.z y
cmp #$19
bcc __b2
sec
sbc #$19
bvc !+
eor #$80
!:
bmi __b2
// gotoxy(0,0)
jsr gotoxy
// printf("%u chars",count)
@ -89,24 +93,28 @@ main: {
lda #0
sta.z x
__b3:
// for(char x=0;x<40;x++)
// for(signed char x=0;x<40;x++)
lda.z x
cmp #$28
bcc __b4
// for(char y=0;y<25;y++)
sec
sbc #$28
bvc !+
eor #$80
!:
bmi __b4
// for(signed char y=0;y<25;y++)
inc.z y
jmp __b1
__b4:
// (signed char)x*2
// x*2
lda.z x
asl
// xd = (signed char)x*2-39
// xd = x*2-39
tax
axs #$27
// (signed char)y*2
// y*2
lda.z y
asl
// yd = (signed char)y*2-24
// yd = y*2-24
sec
sbc #$18
sta.z yd
@ -158,7 +166,7 @@ main: {
bne !+
inc.z sc+1
!:
// for(char x=0;x<40;x++)
// for(signed char x=0;x<40;x++)
inc.z x
jmp __b3
s: .text " chars"

View File

@ -22,8 +22,8 @@ main: scope:[main] from @2
main::@1: scope:[main] from main main::@5
[10] (byte*) main::sc#8 ← phi( main::@5/(byte*) main::sc#10 main/(const nomodify byte*) SCREEN )
[10] (word) main::count#11 ← phi( main::@5/(word) main::count#10 main/(word) 0 )
[10] (byte) main::y#2 ← phi( main::@5/(byte) main::y#1 main/(byte) 0 )
[11] if((byte) main::y#2<(byte) $19) goto main::@3
[10] (signed byte) main::y#2 ← phi( main::@5/(signed byte) main::y#1 main/(signed byte) 0 )
[11] if((signed byte) main::y#2<(signed byte) $19) goto main::@3
to:main::@2
main::@2: scope:[main] from main::@1
[12] phi()
@ -43,16 +43,16 @@ main::@return: scope:[main] from main::@9
main::@3: scope:[main] from main::@1 main::@6
[19] (word) main::count#10 ← phi( main::@1/(word) main::count#11 main::@6/(word) main::count#12 )
[19] (byte*) main::sc#10 ← phi( main::@1/(byte*) main::sc#8 main::@6/(byte*) main::sc#1 )
[19] (byte) main::x#2 ← phi( main::@1/(byte) 0 main::@6/(byte) main::x#1 )
[20] if((byte) main::x#2<(byte) $28) goto main::@4
[19] (signed byte) main::x#2 ← phi( main::@1/(signed byte) 0 main::@6/(signed byte) main::x#1 )
[20] if((signed byte) main::x#2<(signed byte) $28) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@3
[21] (byte) main::y#1 ← ++ (byte) main::y#2
[21] (signed byte) main::y#1 ← ++ (signed byte) main::y#2
to:main::@1
main::@4: scope:[main] from main::@3
[22] (signed byte~) main::$5 ← (signed byte)(byte) main::x#2 << (byte) 1
[22] (signed byte~) main::$5 ← (signed byte) main::x#2 << (byte) 1
[23] (signed byte) main::xd#0 ← (signed byte~) main::$5 - (signed byte) $27
[24] (signed byte~) main::$7 ← (signed byte)(byte) main::y#2 << (byte) 1
[24] (signed byte~) main::$7 ← (signed byte) main::y#2 << (byte) 1
[25] (signed byte) main::yd#0 ← (signed byte~) main::$7 - (signed byte) $18
[26] (signed byte) mul8s::a#0 ← (signed byte) main::xd#0
[27] (signed byte) mul8s::b#0 ← (signed byte) main::xd#0
@ -76,7 +76,7 @@ main::@7: scope:[main] from main::@11
main::@6: scope:[main] from main::@11 main::@7
[38] (word) main::count#12 ← phi( main::@11/(word) main::count#10 main::@7/(word) main::count#1 )
[39] (byte*) main::sc#1 ← ++ (byte*) main::sc#10
[40] (byte) main::x#1 ← ++ (byte) main::x#2
[40] (signed byte) main::x#1 ← ++ (signed byte) main::x#2
to:main::@3
(signed word()) mul8s((signed byte) mul8s::a , (signed byte) mul8s::b)

View File

@ -971,20 +971,20 @@ main: scope:[main] from @2
main::@9: scope:[main] from main
(word) main::count#0 ← (word) 0
(byte*) main::sc#0 ← (const nomodify byte*) SCREEN
(byte) main::y#0 ← (byte) 0
(signed byte) main::y#0 ← (signed byte) 0
to:main::@1
main::@1: scope:[main] from main::@6 main::@9
(byte*) main::sc#9 ← phi( main::@6/(byte*) main::sc#10 main::@9/(byte*) main::sc#0 )
(word) main::count#6 ← phi( main::@6/(word) main::count#8 main::@9/(word) main::count#0 )
(byte) main::y#2 ← phi( main::@6/(byte) main::y#1 main::@9/(byte) main::y#0 )
(bool~) main::$3 ← (byte) main::y#2 < (number) $19
(signed byte) main::y#2 ← phi( main::@6/(signed byte) main::y#1 main::@9/(signed byte) main::y#0 )
(bool~) main::$3 ← (signed byte) main::y#2 < (number) $19
if((bool~) main::$3) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
(word) main::count#11 ← phi( main::@1/(word) main::count#6 )
(byte*) main::sc#8 ← phi( main::@1/(byte*) main::sc#9 )
(byte) main::y#6 ← phi( main::@1/(byte) main::y#2 )
(byte) main::x#0 ← (byte) 0
(signed byte) main::y#6 ← phi( main::@1/(signed byte) main::y#2 )
(signed byte) main::x#0 ← (signed byte) 0
to:main::@4
main::@3: scope:[main] from main::@1
(word) main::count#4 ← phi( main::@1/(word) main::count#6 )
@ -1012,22 +1012,20 @@ main::@12: scope:[main] from main::@11
main::@4: scope:[main] from main::@2 main::@7
(word) main::count#10 ← phi( main::@2/(word) main::count#11 main::@7/(word) main::count#12 )
(byte*) main::sc#7 ← phi( main::@2/(byte*) main::sc#8 main::@7/(byte*) main::sc#1 )
(byte) main::y#5 ← phi( main::@2/(byte) main::y#6 main::@7/(byte) main::y#7 )
(byte) main::x#2 ← phi( main::@2/(byte) main::x#0 main::@7/(byte) main::x#1 )
(bool~) main::$4 ← (byte) main::x#2 < (number) $28
(signed byte) main::y#5 ← phi( main::@2/(signed byte) main::y#6 main::@7/(signed byte) main::y#7 )
(signed byte) main::x#2 ← phi( main::@2/(signed byte) main::x#0 main::@7/(signed byte) main::x#1 )
(bool~) main::$4 ← (signed byte) main::x#2 < (number) $28
if((bool~) main::$4) goto main::@5
to:main::@6
main::@5: scope:[main] from main::@4
(word) main::count#9 ← phi( main::@4/(word) main::count#10 )
(byte*) main::sc#6 ← phi( main::@4/(byte*) main::sc#7 )
(byte) main::y#3 ← phi( main::@4/(byte) main::y#5 )
(byte) main::x#3 ← phi( main::@4/(byte) main::x#2 )
(signed byte~) main::$14 ← (signed byte)(byte) main::x#3
(number~) main::$5 ← (signed byte~) main::$14 * (number) 2
(signed byte) main::y#3 ← phi( main::@4/(signed byte) main::y#5 )
(signed byte) main::x#3 ← phi( main::@4/(signed byte) main::x#2 )
(number~) main::$5 ← (signed byte) main::x#3 * (number) 2
(number~) main::$6 ← (number~) main::$5 - (number) $27
(signed byte) main::xd#0 ← (number~) main::$6
(signed byte~) main::$15 ← (signed byte)(byte) main::y#3
(number~) main::$7 ← (signed byte~) main::$15 * (number) 2
(number~) main::$7 ← (signed byte) main::y#3 * (number) 2
(number~) main::$8 ← (number~) main::$7 - (number) $18
(signed byte) main::yd#0 ← (number~) main::$8
(signed byte) mul8s::a#0 ← (signed byte) main::xd#0
@ -1036,9 +1034,9 @@ main::@5: scope:[main] from main::@4
(signed word) mul8s::return#2 ← (signed word) mul8s::return#1
to:main::@13
main::@13: scope:[main] from main::@5
(byte) main::y#10 ← phi( main::@5/(byte) main::y#3 )
(signed byte) main::y#10 ← phi( main::@5/(signed byte) main::y#3 )
(word) main::count#7 ← phi( main::@5/(word) main::count#9 )
(byte) main::x#7 ← phi( main::@5/(byte) main::x#3 )
(signed byte) main::x#7 ← phi( main::@5/(signed byte) main::x#3 )
(byte*) main::sc#5 ← phi( main::@5/(byte*) main::sc#6 )
(signed byte) main::yd#1 ← phi( main::@5/(signed byte) main::yd#0 )
(signed word) mul8s::return#5 ← phi( main::@5/(signed word) mul8s::return#2 )
@ -1049,9 +1047,9 @@ main::@13: scope:[main] from main::@5
(signed word) mul8s::return#3 ← (signed word) mul8s::return#1
to:main::@14
main::@14: scope:[main] from main::@13
(byte) main::y#8 ← phi( main::@13/(byte) main::y#10 )
(signed byte) main::y#8 ← phi( main::@13/(signed byte) main::y#10 )
(word) main::count#5 ← phi( main::@13/(word) main::count#7 )
(byte) main::x#5 ← phi( main::@13/(byte) main::x#7 )
(signed byte) main::x#5 ← phi( main::@13/(signed byte) main::x#7 )
(byte*) main::sc#4 ← phi( main::@13/(byte*) main::sc#5 )
(signed word) mul8s::return#6 ← phi( main::@13/(signed word) mul8s::return#3 )
(signed word~) main::$10 ← (signed word) mul8s::return#6
@ -1064,20 +1062,20 @@ main::@14: scope:[main] from main::@13
main::@6: scope:[main] from main::@4
(byte*) main::sc#10 ← phi( main::@4/(byte*) main::sc#7 )
(word) main::count#8 ← phi( main::@4/(word) main::count#10 )
(byte) main::y#4 ← phi( main::@4/(byte) main::y#5 )
(byte) main::y#1 ← ++ (byte) main::y#4
(signed byte) main::y#4 ← phi( main::@4/(signed byte) main::y#5 )
(signed byte) main::y#1 ← ++ (signed byte) main::y#4
to:main::@1
main::@7: scope:[main] from main::@14 main::@8
(word) main::count#12 ← phi( main::@14/(word) main::count#5 main::@8/(word) main::count#1 )
(byte) main::y#7 ← phi( main::@14/(byte) main::y#8 main::@8/(byte) main::y#9 )
(byte) main::x#4 ← phi( main::@14/(byte) main::x#5 main::@8/(byte) main::x#6 )
(signed byte) main::y#7 ← phi( main::@14/(signed byte) main::y#8 main::@8/(signed byte) main::y#9 )
(signed byte) main::x#4 ← phi( main::@14/(signed byte) main::x#5 main::@8/(signed byte) main::x#6 )
(byte*) main::sc#2 ← phi( main::@14/(byte*) main::sc#4 main::@8/(byte*) main::sc#3 )
(byte*) main::sc#1 ← ++ (byte*) main::sc#2
(byte) main::x#1 ← ++ (byte) main::x#4
(signed byte) main::x#1 ← ++ (signed byte) main::x#4
to:main::@4
main::@8: scope:[main] from main::@14
(byte) main::y#9 ← phi( main::@14/(byte) main::y#8 )
(byte) main::x#6 ← phi( main::@14/(byte) main::x#5 )
(signed byte) main::y#9 ← phi( main::@14/(signed byte) main::y#8 )
(signed byte) main::x#6 ← phi( main::@14/(signed byte) main::x#5 )
(word) main::count#3 ← phi( main::@14/(word) main::count#5 )
(byte*) main::sc#3 ← phi( main::@14/(byte*) main::sc#4 )
*((byte*) main::sc#3) ← (byte) '*'
@ -1220,8 +1218,6 @@ SYMBOL TABLE SSA
(signed word~) main::$11
(bool~) main::$12
(bool~) main::$13
(signed byte~) main::$14
(signed byte~) main::$15
(bool~) main::$3
(bool~) main::$4
(number~) main::$5
@ -1273,29 +1269,29 @@ SYMBOL TABLE SSA
(byte*) main::sc#7
(byte*) main::sc#8
(byte*) main::sc#9
(byte) main::x
(byte) main::x#0
(byte) main::x#1
(byte) main::x#2
(byte) main::x#3
(byte) main::x#4
(byte) main::x#5
(byte) main::x#6
(byte) main::x#7
(signed byte) main::x
(signed byte) main::x#0
(signed byte) main::x#1
(signed byte) main::x#2
(signed byte) main::x#3
(signed byte) main::x#4
(signed byte) main::x#5
(signed byte) main::x#6
(signed byte) main::x#7
(signed byte) main::xd
(signed byte) main::xd#0
(byte) main::y
(byte) main::y#0
(byte) main::y#1
(byte) main::y#10
(byte) main::y#2
(byte) main::y#3
(byte) main::y#4
(byte) main::y#5
(byte) main::y#6
(byte) main::y#7
(byte) main::y#8
(byte) main::y#9
(signed byte) main::y
(signed byte) main::y#0
(signed byte) main::y#1
(signed byte) main::y#10
(signed byte) main::y#2
(signed byte) main::y#3
(signed byte) main::y#4
(signed byte) main::y#5
(signed byte) main::y#6
(signed byte) main::y#7
(signed byte) main::y#8
(signed byte) main::y#9
(signed byte) main::yd
(signed byte) main::yd#0
(signed byte) main::yd#1
@ -2070,16 +2066,16 @@ Adding number conversion cast (unumber) 0 in (bool~) printf_number_buffer::$30
Adding number conversion cast (unumber) 0 in (bool~) printf_number_buffer::$31 ← (number) 0 != (byte) printf_number_buffer::format_upper_case#1
Adding number conversion cast (unumber) 0 in (bool~) printf_number_buffer::$32 ← (number) 0 != (byte) printf_number_buffer::format_zero_padding#3
Adding number conversion cast (unumber) $3e8 in (word) memset::num#2 ← (number) $3e8
Adding number conversion cast (unumber) $19 in (bool~) main::$3 ← (byte) main::y#2 < (number) $19
Adding number conversion cast (snumber) $19 in (bool~) main::$3 ← (signed byte) main::y#2 < (number) $19
Adding number conversion cast (unumber) 0 in (byte) gotoxy::x#2 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) gotoxy::y#2 ← (number) 0
Adding number conversion cast (unumber) $28 in (bool~) main::$4 ← (byte) main::x#2 < (number) $28
Adding number conversion cast (snumber) 2 in (number~) main::$5 ← (signed byte~) main::$14 * (number) 2
Adding number conversion cast (snumber) main::$5 in (number~) main::$5 ← (signed byte~) main::$14 * (snumber)(number) 2
Adding number conversion cast (snumber) $28 in (bool~) main::$4 ← (signed byte) main::x#2 < (number) $28
Adding number conversion cast (snumber) 2 in (number~) main::$5 ← (signed byte) main::x#3 * (number) 2
Adding number conversion cast (snumber) main::$5 in (number~) main::$5 ← (signed byte) main::x#3 * (snumber)(number) 2
Adding number conversion cast (snumber) $27 in (number~) main::$6 ← (snumber~) main::$5 - (number) $27
Adding number conversion cast (snumber) main::$6 in (number~) main::$6 ← (snumber~) main::$5 - (snumber)(number) $27
Adding number conversion cast (snumber) 2 in (number~) main::$7 ← (signed byte~) main::$15 * (number) 2
Adding number conversion cast (snumber) main::$7 in (number~) main::$7 ← (signed byte~) main::$15 * (snumber)(number) 2
Adding number conversion cast (snumber) 2 in (number~) main::$7 ← (signed byte) main::y#3 * (number) 2
Adding number conversion cast (snumber) main::$7 in (number~) main::$7 ← (signed byte) main::y#3 * (snumber)(number) 2
Adding number conversion cast (snumber) $18 in (number~) main::$8 ← (snumber~) main::$7 - (number) $18
Adding number conversion cast (snumber) main::$8 in (number~) main::$8 ← (snumber~) main::$7 - (snumber)(number) $18
Adding number conversion cast (snumber) 2*9*2*9 in (bool~) main::$12 ← (signed word) main::dist_sq#0 < (number) 2*(number) 9*(number) 2*(number) 9
@ -2228,10 +2224,10 @@ Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (word) $3e8
Finalized unsigned number type (byte) $19
Finalized signed number type (signed byte) $19
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $28
Finalized signed number type (signed byte) $28
Finalized signed number type (signed byte) 2
Finalized signed number type (signed byte) $27
Finalized signed number type (signed byte) 2
@ -2244,9 +2240,9 @@ Inferred type updated to byte in (unumber~) cputln::$0 ← (byte) $28 - (byte) c
Inferred type updated to byte in (unumber~) utoa::$4 ← (byte) utoa::max_digits#5 - (byte) 1
Inferred type updated to byte in (unumber~) printf_uint::$0 ← (byte) 0
Inferred type updated to byte for (unumber~) printf_uint::$2
Inferred type updated to signed byte in (snumber~) main::$5 ← (signed byte~) main::$14 * (signed byte) 2
Inferred type updated to signed byte in (snumber~) main::$5 ← (signed byte) main::x#3 * (signed byte) 2
Inferred type updated to signed byte in (snumber~) main::$6 ← (signed byte~) main::$5 - (signed byte) $27
Inferred type updated to signed byte in (snumber~) main::$7 ← (signed byte~) main::$15 * (signed byte) 2
Inferred type updated to signed byte in (snumber~) main::$7 ← (signed byte) main::y#3 * (signed byte) 2
Inferred type updated to signed byte in (snumber~) main::$8 ← (signed byte~) main::$7 - (signed byte) $18
Inversing boolean not [33] (bool~) memset::$1 ← (word) memset::num#3 <= (byte) 0 from [32] (bool~) memset::$0 ← (word) memset::num#3 > (byte) 0
Inversing boolean not [91] (bool~) mul8u::$3 ← (byte~) mul8u::$1 == (byte) 0 from [90] (bool~) mul8u::$2 ← (byte~) mul8u::$1 != (byte) 0
@ -2264,7 +2260,7 @@ Inversing boolean not [386] (bool~) printf_number_buffer::$23 ← (signed byte)
Inversing boolean not [394] (bool~) printf_number_buffer::$7 ← (byte) 0 == (byte) printf_number_buffer::buffer_sign#2 from [393] (bool~) printf_number_buffer::$30 ← (byte) 0 != (byte) printf_number_buffer::buffer_sign#2
Inversing boolean not [411] (bool~) printf_number_buffer::$12 ← (byte) 0 == (byte) printf_number_buffer::format_upper_case#1 from [410] (bool~) printf_number_buffer::$31 ← (byte) 0 != (byte) printf_number_buffer::format_upper_case#1
Inversing boolean not [423] (bool~) printf_number_buffer::$14 ← (byte) 0 == (byte) printf_number_buffer::format_zero_padding#3 from [422] (bool~) printf_number_buffer::$32 ← (byte) 0 != (byte) printf_number_buffer::format_zero_padding#3
Inversing boolean not [493] (bool~) main::$13 ← (signed word) main::dist_sq#0 >= (signed word)(number) 2*(number) 9*(number) 2*(number) 9 from [492] (bool~) main::$12 ← (signed word) main::dist_sq#0 < (signed word)(number) 2*(number) 9*(number) 2*(number) 9
Inversing boolean not [491] (bool~) main::$13 ← (signed word) main::dist_sq#0 >= (signed word)(number) 2*(number) 9*(number) 2*(number) 9 from [490] (bool~) main::$12 ← (signed word) main::dist_sq#0 < (signed word)(number) 2*(number) 9*(number) 2*(number) 9
Successful SSA optimization Pass2UnaryNotSimplification
Alias candidate removed (volatile)conio_cursor_text = gotoxy::$6 cputln::$1 cscroll::$7
Alias candidate removed (volatile)conio_cursor_color = gotoxy::$7 cputln::$2 cscroll::$8
@ -2478,7 +2474,7 @@ Identical Phi Values (byte) printf_number_buffer::format_zero_padding#1 (byte) p
Identical Phi Values (byte*) printf_number_buffer::buffer_digits#1 (byte*) printf_number_buffer::buffer_digits#0
Identical Phi Values (byte) printf_number_buffer::buffer_sign#1 (byte) printf_number_buffer::buffer_sign#0
Identical Phi Values (byte) printf_number_buffer::format_upper_case#1 (byte) printf_number_buffer::format_upper_case#0
Identical Phi Values (byte) main::y#10 (byte) main::y#2
Identical Phi Values (signed byte) main::y#10 (signed byte) main::y#2
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (void*) memset::return#0 (void*) memset::str#4
Successful SSA optimization Pass2IdenticalPhiElimination
@ -2512,9 +2508,9 @@ Simple Condition (bool~) printf_number_buffer::$20 [290] if((byte) 0==(byte) pri
Simple Condition (bool~) printf_number_buffer::$23 [295] if((signed byte) printf_number_buffer::padding#1>=(signed byte) 0) goto printf_number_buffer::@1
Simple Condition (bool~) printf_number_buffer::$7 [299] if((byte) 0==(byte) printf_number_buffer::buffer_sign#0) goto printf_number_buffer::@3
Simple Condition (bool~) printf_number_buffer::$12 [309] if((byte) 0==(byte) printf_number_buffer::format_upper_case#0) goto printf_number_buffer::@5
Simple Condition (bool~) main::$3 [337] if((byte) main::y#2<(byte) $19) goto main::@2
Simple Condition (bool~) main::$4 [354] if((byte) main::x#2<(byte) $28) goto main::@5
Simple Condition (bool~) main::$13 [373] if((signed word) main::dist_sq#0>=(signed word)(number) 2*(number) 9*(number) 2*(number) 9) goto main::@7
Simple Condition (bool~) main::$3 [337] if((signed byte) main::y#2<(signed byte) $19) goto main::@2
Simple Condition (bool~) main::$4 [354] if((signed byte) main::x#2<(signed byte) $28) goto main::@5
Simple Condition (bool~) main::$13 [371] if((signed word) main::dist_sq#0>=(signed word)(number) 2*(number) 9*(number) 2*(number) 9) goto main::@7
Successful SSA optimization Pass2ConditionalJumpSimplification
Rewriting && if()-condition to two if()s [3] (bool~) toupper::$2 ← (bool~) toupper::$0 && (bool~) toupper::$1
Rewriting ! if()-condition to reversed if() [218] (bool~) utoa::$8 ← ! (bool~) utoa::$7
@ -2584,8 +2580,8 @@ Constant (const byte) memset::c#2 = ' '
Constant (const word) memset::num#2 = $3e8
Constant (const word) main::count#0 = 0
Constant (const byte*) main::sc#0 = SCREEN
Constant (const byte) main::y#0 = 0
Constant (const byte) main::x#0 = 0
Constant (const signed byte) main::y#0 = 0
Constant (const signed byte) main::x#0 = 0
Constant (const byte) gotoxy::x#2 = 0
Constant (const byte) gotoxy::y#2 = 0
Constant (const byte) printf_uint::format_min_length#0 = 0
@ -2772,18 +2768,18 @@ Simple Condition (bool~) utoa::$12 [120] if((byte) 0!=(byte) utoa::started#2) go
Simple Condition (bool~) printf_number_buffer::$1 [157] if((byte) 0==(const byte) printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@23
Simple Condition (bool~) printf_number_buffer::$33 [162] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@24
Simple Condition (bool~) printf_number_buffer::$34 [170] if((byte) 0!=(const byte) printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@26
Simple Condition (bool~) utoa::$6 [209] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@14
Simple Condition (bool~) printf_number_buffer::$35 [211] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@8
Simple Condition (bool~) printf_number_buffer::$2 [212] if((byte) 0==(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@22
Simple Condition (bool~) printf_number_buffer::$36 [214] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@10
Simple Condition (bool~) printf_number_buffer::$37 [216] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@12
Simple Condition (bool~) printf_number_buffer::$14 [217] if((byte) 0==(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@25
Simple Condition (bool~) utoa::$6 [207] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@14
Simple Condition (bool~) printf_number_buffer::$35 [209] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@8
Simple Condition (bool~) printf_number_buffer::$2 [210] if((byte) 0==(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@22
Simple Condition (bool~) printf_number_buffer::$36 [212] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@10
Simple Condition (bool~) printf_number_buffer::$37 [214] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@12
Simple Condition (bool~) printf_number_buffer::$14 [215] if((byte) 0==(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@25
Successful SSA optimization Pass2ConditionalJumpSimplification
Negating conditional jump and destination [157] if((byte) 0!=(const byte) printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@2
Negating conditional jump and destination [162] if((byte) 0==(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@4
Negating conditional jump and destination [170] if((byte) 0==(const byte) printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@return
Negating conditional jump and destination [212] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@2
Negating conditional jump and destination [217] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@return
Negating conditional jump and destination [210] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@2
Negating conditional jump and destination [215] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@return
Successful SSA optimization Pass2ConditionalJumpSequenceImprovement
Constant right-side identified [114] (byte~) utoa::$4 ← (const byte) utoa::max_digits#1 - (byte) 1
Constant right-side identified [159] (byte) printf_padding::length#0 ← (byte)(const signed byte) printf_number_buffer::padding#0
@ -2800,11 +2796,11 @@ if() condition always true - replacing block destination [58] if((const byte) go
if() condition always false - eliminating [157] if((byte) 0!=(const byte) printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@2
if() condition always true - replacing block destination [162] if((byte) 0==(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@4
if() condition always true - replacing block destination [170] if((byte) 0==(const byte) printf_number_buffer::format_justify_left#0) goto printf_number_buffer::@return
if() condition always false - eliminating [211] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@8
if() condition always false - eliminating [212] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@2
if() condition always false - eliminating [214] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@10
if() condition always false - eliminating [216] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@12
if() condition always false - eliminating [217] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@return
if() condition always false - eliminating [209] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@8
if() condition always false - eliminating [210] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@2
if() condition always false - eliminating [212] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@10
if() condition always false - eliminating [214] if((signed byte) 0!=(const signed byte) printf_number_buffer::padding#0) goto printf_number_buffer::@12
if() condition always false - eliminating [215] if((byte) 0!=(const byte) printf_number_buffer::format_zero_padding#0) goto printf_number_buffer::@return
Successful SSA optimization Pass2ConstantIfs
Simplifying constant evaluating to zero (byte)(const signed byte) printf_number_buffer::padding#0 in
Simplifying constant evaluating to zero (byte)(const signed byte) printf_number_buffer::padding#0 in
@ -2906,15 +2902,13 @@ Inlining Noop Cast [15] (byte*) memset::dst#0 ← (byte*)(void*) memset::str#4 k
Inlining Noop Cast [41] (byte~) mul8s::$13 ← (byte)(signed byte) mul8s::b#2 keeping mul8s::b#2
Inlining Noop Cast [45] (signed word) mul8s::return#0 ← (signed word)(word) mul8s::m#4 keeping mul8s::m#4
Inlining Noop Cast [47] (byte~) mul8s::$14 ← (byte)(signed byte) mul8s::a#2 keeping mul8s::a#2
Inlining Noop Cast [146] (signed byte~) main::$14 ← (signed byte)(byte) main::x#2 keeping main::x#2
Inlining Noop Cast [149] (signed byte~) main::$15 ← (signed byte)(byte) main::y#2 keeping main::y#2
Successful SSA optimization Pass2NopCastInlining
Inlining Noop Cast [155] (signed word) mul8s::return#2 ← (signed word)(word) mul8s::m#4 keeping mul8s::m#4
Inlining Noop Cast [160] (signed word) mul8s::return#3 ← (signed word)(word) mul8s::m#4 keeping mul8s::m#4
Inlining Noop Cast [153] (signed word) mul8s::return#2 ← (signed word)(word) mul8s::m#4 keeping mul8s::m#4
Inlining Noop Cast [158] (signed word) mul8s::return#3 ← (signed word)(word) mul8s::m#4 keeping mul8s::m#4
Successful SSA optimization Pass2NopCastInlining
Rewriting multiplication to use shift [104] (byte~) utoa::$10 ← (byte) utoa::digit#2 * (const byte) SIZEOF_WORD
Rewriting multiplication to use shift [147] (signed byte~) main::$5 ← (signed byte)(byte) main::x#2 * (signed byte) 2
Rewriting multiplication to use shift [150] (signed byte~) main::$7 ← (signed byte)(byte) main::y#2 * (signed byte) 2
Rewriting multiplication to use shift [146] (signed byte~) main::$5 ← (signed byte) main::x#2 * (signed byte) 2
Rewriting multiplication to use shift [148] (signed byte~) main::$7 ← (signed byte) main::y#2 * (signed byte) 2
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings (const void*) memcpy::destination#0
Inlining constant with var siblings (const void*) memcpy::source#0
@ -2941,8 +2935,8 @@ Inlining constant with var siblings (const byte*) utoa::buffer#5
Inlining constant with var siblings (const byte) utoa_append::digit#0
Inlining constant with var siblings (const word) main::count#0
Inlining constant with var siblings (const byte*) main::sc#0
Inlining constant with var siblings (const byte) main::y#0
Inlining constant with var siblings (const byte) main::x#0
Inlining constant with var siblings (const signed byte) main::y#0
Inlining constant with var siblings (const signed byte) main::x#0
Constant inlined utoa_append::digit#0 = (byte) 0
Constant inlined utoa::digit_values#1 = (const word*) RADIX_DECIMAL_VALUES
Constant inlined cputs::s#1 = (const byte*) printf_number_buffer::buffer_digits#0
@ -2965,8 +2959,8 @@ Constant inlined gotoxy::$7 = (const nomodify byte*) CONIO_SCREEN_COLORS
Constant inlined utoa::started#1 = (byte) 1
Constant inlined main::sc#0 = (const nomodify byte*) SCREEN
Constant inlined utoa::started#0 = (byte) 0
Constant inlined main::x#0 = (byte) 0
Constant inlined main::y#0 = (byte) 0
Constant inlined main::x#0 = (signed byte) 0
Constant inlined main::y#0 = (signed byte) 0
Constant inlined memcpy::source#0 = (void*)(const nomodify byte*) CONIO_SCREEN_TEXT+(byte) $28
Constant inlined memcpy::num#1 = (word)(number) $19*(number) $28-(number) $28
Constant inlined memcpy::num#0 = (word)(number) $19*(number) $28-(number) $28
@ -3191,8 +3185,8 @@ main: scope:[main] from @2
main::@1: scope:[main] from main main::@5
[10] (byte*) main::sc#8 ← phi( main::@5/(byte*) main::sc#10 main/(const nomodify byte*) SCREEN )
[10] (word) main::count#11 ← phi( main::@5/(word) main::count#10 main/(word) 0 )
[10] (byte) main::y#2 ← phi( main::@5/(byte) main::y#1 main/(byte) 0 )
[11] if((byte) main::y#2<(byte) $19) goto main::@3
[10] (signed byte) main::y#2 ← phi( main::@5/(signed byte) main::y#1 main/(signed byte) 0 )
[11] if((signed byte) main::y#2<(signed byte) $19) goto main::@3
to:main::@2
main::@2: scope:[main] from main::@1
[12] phi()
@ -3212,16 +3206,16 @@ main::@return: scope:[main] from main::@9
main::@3: scope:[main] from main::@1 main::@6
[19] (word) main::count#10 ← phi( main::@1/(word) main::count#11 main::@6/(word) main::count#12 )
[19] (byte*) main::sc#10 ← phi( main::@1/(byte*) main::sc#8 main::@6/(byte*) main::sc#1 )
[19] (byte) main::x#2 ← phi( main::@1/(byte) 0 main::@6/(byte) main::x#1 )
[20] if((byte) main::x#2<(byte) $28) goto main::@4
[19] (signed byte) main::x#2 ← phi( main::@1/(signed byte) 0 main::@6/(signed byte) main::x#1 )
[20] if((signed byte) main::x#2<(signed byte) $28) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@3
[21] (byte) main::y#1 ← ++ (byte) main::y#2
[21] (signed byte) main::y#1 ← ++ (signed byte) main::y#2
to:main::@1
main::@4: scope:[main] from main::@3
[22] (signed byte~) main::$5 ← (signed byte)(byte) main::x#2 << (byte) 1
[22] (signed byte~) main::$5 ← (signed byte) main::x#2 << (byte) 1
[23] (signed byte) main::xd#0 ← (signed byte~) main::$5 - (signed byte) $27
[24] (signed byte~) main::$7 ← (signed byte)(byte) main::y#2 << (byte) 1
[24] (signed byte~) main::$7 ← (signed byte) main::y#2 << (byte) 1
[25] (signed byte) main::yd#0 ← (signed byte~) main::$7 - (signed byte) $18
[26] (signed byte) mul8s::a#0 ← (signed byte) main::xd#0
[27] (signed byte) mul8s::b#0 ← (signed byte) main::xd#0
@ -3245,7 +3239,7 @@ main::@7: scope:[main] from main::@11
main::@6: scope:[main] from main::@11 main::@7
[38] (word) main::count#12 ← phi( main::@11/(word) main::count#10 main::@7/(word) main::count#1 )
[39] (byte*) main::sc#1 ← ++ (byte*) main::sc#10
[40] (byte) main::x#1 ← ++ (byte) main::x#2
[40] (signed byte) main::x#1 ← ++ (signed byte) main::x#2
to:main::@3
(signed word()) mul8s((signed byte) mul8s::a , (signed byte) mul8s::b)
@ -3610,14 +3604,14 @@ VARIABLE REGISTER WEIGHTS
(byte*) main::sc#1 1001.0
(byte*) main::sc#10 160.25
(byte*) main::sc#8 101.0
(byte) main::x
(byte) main::x#1 2002.0
(byte) main::x#2 150.14999999999998
(signed byte) main::x
(signed byte) main::x#1 2002.0
(signed byte) main::x#2 200.2
(signed byte) main::xd
(signed byte) main::xd#0 750.75
(byte) main::y
(byte) main::y#1 202.0
(byte) main::y#2 13.173913043478262
(signed byte) main::y
(signed byte) main::y#1 202.0
(signed byte) main::y#2 56.69565217391305
(signed byte) main::yd
(signed byte) main::yd#0 500.5
(void*()) memcpy((void*) memcpy::destination , (void*) memcpy::source , (word) memcpy::num)
@ -4056,16 +4050,20 @@ main: {
sta.z count
lda #>0
sta.z count+1
// [10] phi (byte) main::y#2 = (byte) 0 [phi:main->main::@1#2] -- vbuz1=vbuc1
// [10] phi (signed byte) main::y#2 = (signed byte) 0 [phi:main->main::@1#2] -- vbsz1=vbsc1
lda #0
sta.z y
jmp __b1
// main::@1
__b1:
// [11] if((byte) main::y#2<(byte) $19) goto main::@3 -- vbuz1_lt_vbuc1_then_la1
// [11] if((signed byte) main::y#2<(signed byte) $19) goto main::@3 -- vbsz1_lt_vbsc1_then_la1
lda.z y
cmp #$19
bcc __b3_from___b1
sec
sbc #$19
bvc !+
eor #$80
!:
bmi __b3_from___b1
// [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
__b2_from___b1:
jmp __b2
@ -4110,30 +4108,34 @@ main: {
__b3_from___b1:
// [19] phi (word) main::count#10 = (word) main::count#11 [phi:main::@1->main::@3#0] -- register_copy
// [19] phi (byte*) main::sc#10 = (byte*) main::sc#8 [phi:main::@1->main::@3#1] -- register_copy
// [19] phi (byte) main::x#2 = (byte) 0 [phi:main::@1->main::@3#2] -- vbuz1=vbuc1
// [19] phi (signed byte) main::x#2 = (signed byte) 0 [phi:main::@1->main::@3#2] -- vbsz1=vbsc1
lda #0
sta.z x
jmp __b3
// main::@3
__b3:
// [20] if((byte) main::x#2<(byte) $28) goto main::@4 -- vbuz1_lt_vbuc1_then_la1
// [20] if((signed byte) main::x#2<(signed byte) $28) goto main::@4 -- vbsz1_lt_vbsc1_then_la1
lda.z x
cmp #$28
bcc __b4
sec
sbc #$28
bvc !+
eor #$80
!:
bmi __b4
jmp __b5
// main::@5
__b5:
// [21] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
// [21] (signed byte) main::y#1 ← ++ (signed byte) main::y#2 -- vbsz1=_inc_vbsz1
inc.z y
// [10] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
__b1_from___b5:
// [10] phi (byte*) main::sc#8 = (byte*) main::sc#10 [phi:main::@5->main::@1#0] -- register_copy
// [10] phi (word) main::count#11 = (word) main::count#10 [phi:main::@5->main::@1#1] -- register_copy
// [10] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#2] -- register_copy
// [10] phi (signed byte) main::y#2 = (signed byte) main::y#1 [phi:main::@5->main::@1#2] -- register_copy
jmp __b1
// main::@4
__b4:
// [22] (signed byte~) main::$5 ← (signed byte)(byte) main::x#2 << (byte) 1 -- vbsz1=vbsz2_rol_1
// [22] (signed byte~) main::$5 ← (signed byte) main::x#2 << (byte) 1 -- vbsz1=vbsz2_rol_1
lda.z x
asl
sta.z __5
@ -4141,7 +4143,7 @@ main: {
lax.z __5
axs #$27
stx.z xd
// [24] (signed byte~) main::$7 ← (signed byte)(byte) main::y#2 << (byte) 1 -- vbsz1=vbsz2_rol_1
// [24] (signed byte~) main::$7 ← (signed byte) main::y#2 << (byte) 1 -- vbsz1=vbsz2_rol_1
lda.z y
asl
sta.z __7
@ -4230,13 +4232,13 @@ main: {
bne !+
inc.z sc+1
!:
// [40] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuz1=_inc_vbuz1
// [40] (signed byte) main::x#1 ← ++ (signed byte) main::x#2 -- vbsz1=_inc_vbsz1
inc.z x
// [19] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
__b3_from___b6:
// [19] phi (word) main::count#10 = (word) main::count#12 [phi:main::@6->main::@3#0] -- register_copy
// [19] phi (byte*) main::sc#10 = (byte*) main::sc#1 [phi:main::@6->main::@3#1] -- register_copy
// [19] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@6->main::@3#2] -- register_copy
// [19] phi (signed byte) main::x#2 = (signed byte) main::x#1 [phi:main::@6->main::@3#2] -- register_copy
jmp __b3
s: .text " chars"
.byte 0
@ -5173,11 +5175,13 @@ Statement [1] (byte) conio_cursor_x ← (byte) 0 [ printf_buffer ] ( [ printf_b
Statement [2] (byte) conio_cursor_y ← (byte) 0 [ printf_buffer ] ( [ printf_buffer ] { } ) always clobbers reg byte a
Statement [3] (byte*) conio_cursor_text ← (const nomodify byte*) CONIO_SCREEN_TEXT [ printf_buffer ] ( [ printf_buffer ] { } ) always clobbers reg byte a
Statement [4] (byte*) conio_cursor_color ← (const nomodify byte*) CONIO_SCREEN_COLORS [ printf_buffer ] ( [ printf_buffer ] { } ) always clobbers reg byte a
Statement [14] (word) printf_uint::uvalue#0 ← (word) main::count#11 [ conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color printf_uint::uvalue#0 printf_buffer ] ( main:6 [ conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color printf_uint::uvalue#0 printf_buffer ] { { printf_uint::uvalue#0 = main::count#11 } } ) always clobbers reg byte a
Statement [22] (signed byte~) main::$5 ← (signed byte)(byte) main::x#2 << (byte) 1 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$5 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$5 printf_buffer ] { { mul8s::b#0 = mul8s::b#2 mul8s::a#2 mul8s::a#0 main::xd#0 } } ) always clobbers reg byte a
Statement [11] if((signed byte) main::y#2<(signed byte) $19) goto main::@3 [ main::y#2 main::count#11 main::sc#8 printf_buffer ] ( main:6 [ main::y#2 main::count#11 main::sc#8 printf_buffer ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::y#2 main::y#1 ]
Statement [14] (word) printf_uint::uvalue#0 ← (word) main::count#11 [ conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color printf_uint::uvalue#0 printf_buffer ] ( main:6 [ conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color printf_uint::uvalue#0 printf_buffer ] { { printf_uint::uvalue#0 = main::count#11 } } ) always clobbers reg byte a
Statement [20] if((signed byte) main::x#2<(signed byte) $28) goto main::@4 [ main::y#2 main::count#10 main::sc#10 main::x#2 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 printf_buffer ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:7 [ main::x#2 main::x#1 ]
Statement [24] (signed byte~) main::$7 ← (signed byte)(byte) main::y#2 << (byte) 1 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::xd#0 main::$7 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::xd#0 main::$7 printf_buffer ] { { mul8s::b#0 = mul8s::b#2 mul8s::a#2 mul8s::a#0 main::xd#0 } } ) always clobbers reg byte a
Statement [22] (signed byte~) main::$5 ← (signed byte) main::x#2 << (byte) 1 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$5 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$5 printf_buffer ] { { mul8s::b#0 = mul8s::b#2 mul8s::a#2 mul8s::a#0 main::xd#0 } } ) always clobbers reg byte a
Statement [24] (signed byte~) main::$7 ← (signed byte) main::y#2 << (byte) 1 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::xd#0 main::$7 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::xd#0 main::$7 printf_buffer ] { { mul8s::b#0 = mul8s::b#2 mul8s::a#2 mul8s::a#0 main::xd#0 } } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:53 [ main::xd#0 ]
Statement [29] (signed word~) main::$9 ← (signed word)(word) mul8s::m#4 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::yd#0 main::$9 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::yd#0 main::$9 printf_buffer ] { { mul8s::b#1 = mul8s::b#2 mul8s::a#2 mul8s::a#1 main::yd#0 } } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:55 [ main::yd#0 ]
@ -5254,9 +5258,11 @@ Statement [1] (byte) conio_cursor_x ← (byte) 0 [ printf_buffer ] ( [ printf_b
Statement [2] (byte) conio_cursor_y ← (byte) 0 [ printf_buffer ] ( [ printf_buffer ] { } ) always clobbers reg byte a
Statement [3] (byte*) conio_cursor_text ← (const nomodify byte*) CONIO_SCREEN_TEXT [ printf_buffer ] ( [ printf_buffer ] { } ) always clobbers reg byte a
Statement [4] (byte*) conio_cursor_color ← (const nomodify byte*) CONIO_SCREEN_COLORS [ printf_buffer ] ( [ printf_buffer ] { } ) always clobbers reg byte a
Statement [11] if((signed byte) main::y#2<(signed byte) $19) goto main::@3 [ main::y#2 main::count#11 main::sc#8 printf_buffer ] ( main:6 [ main::y#2 main::count#11 main::sc#8 printf_buffer ] { } ) always clobbers reg byte a
Statement [14] (word) printf_uint::uvalue#0 ← (word) main::count#11 [ conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color printf_uint::uvalue#0 printf_buffer ] ( main:6 [ conio_cursor_x conio_cursor_y conio_cursor_text conio_cursor_color printf_uint::uvalue#0 printf_buffer ] { { printf_uint::uvalue#0 = main::count#11 } } ) always clobbers reg byte a
Statement [22] (signed byte~) main::$5 ← (signed byte)(byte) main::x#2 << (byte) 1 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$5 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$5 printf_buffer ] { { mul8s::b#0 = mul8s::b#2 mul8s::a#2 mul8s::a#0 main::xd#0 } } ) always clobbers reg byte a
Statement [24] (signed byte~) main::$7 ← (signed byte)(byte) main::y#2 << (byte) 1 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::xd#0 main::$7 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::xd#0 main::$7 printf_buffer ] { { mul8s::b#0 = mul8s::b#2 mul8s::a#2 mul8s::a#0 main::xd#0 } } ) always clobbers reg byte a
Statement [20] if((signed byte) main::x#2<(signed byte) $28) goto main::@4 [ main::y#2 main::count#10 main::sc#10 main::x#2 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 printf_buffer ] { } ) always clobbers reg byte a
Statement [22] (signed byte~) main::$5 ← (signed byte) main::x#2 << (byte) 1 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$5 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$5 printf_buffer ] { { mul8s::b#0 = mul8s::b#2 mul8s::a#2 mul8s::a#0 main::xd#0 } } ) always clobbers reg byte a
Statement [24] (signed byte~) main::$7 ← (signed byte) main::y#2 << (byte) 1 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::xd#0 main::$7 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::xd#0 main::$7 printf_buffer ] { { mul8s::b#0 = mul8s::b#2 mul8s::a#2 mul8s::a#0 main::xd#0 } } ) always clobbers reg byte a
Statement [29] (signed word~) main::$9 ← (signed word)(word) mul8s::m#4 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::yd#0 main::$9 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::yd#0 main::$9 printf_buffer ] { { mul8s::b#1 = mul8s::b#2 mul8s::a#2 mul8s::a#1 main::yd#0 } } ) always clobbers reg byte a
Statement [33] (signed word~) main::$10 ← (signed word)(word) mul8s::m#4 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$9 main::$10 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::$9 main::$10 printf_buffer ] { } ) always clobbers reg byte a
Statement [34] (signed word) main::dist_sq#0 ← (signed word~) main::$9 + (signed word~) main::$10 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::dist_sq#0 printf_buffer ] ( main:6 [ main::y#2 main::count#10 main::sc#10 main::x#2 main::dist_sq#0 printf_buffer ] { } ) always clobbers reg byte a
@ -5391,7 +5397,7 @@ Uplift Scope [cputc] 1,252,506: zp[1]:19 [ cputc::c#3 cputc::c#0 cputc::c#2 ]
Uplift Scope [cputs] 215,003.5: zp[2]:17 [ cputs::s#3 cputs::s#4 cputs::s#0 ] 100,001: zp[1]:70 [ cputs::c#1 ]
Uplift Scope [mul8s] 67,506.75: zp[2]:10 [ mul8s::m#4 mul8s::m#5 mul8s::m#1 mul8s::m#0 mul8s::m#2 ] 20,002: zp[1]:65 [ mul8s::$6 ] 20,002: zp[1]:66 [ mul8s::$11 ] 20,002: zp[1]:67 [ mul8s::$9 ] 20,002: zp[1]:68 [ mul8s::$12 ] 5,095.18: zp[1]:9 [ mul8s::b#2 mul8s::b#1 mul8s::b#0 ] 2,925.31: zp[1]:8 [ mul8s::a#2 mul8s::a#1 mul8s::a#0 ]
Uplift Scope [utoa] 38,003.93: zp[2]:39 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] 31,411.36: zp[2]:36 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] 22,859.43: zp[1]:35 [ utoa::digit#2 utoa::digit#1 ] 20,002: zp[1]:89 [ utoa::$10 ] 15,001.5: zp[1]:38 [ utoa::started#2 utoa::started#4 ] 6,000.6: zp[2]:90 [ utoa::digit_value#0 ] 2,002: zp[1]:86 [ utoa::$11 ] 2,002: zp[2]:87 [ utoa::buffer#3 ]
Uplift Scope [main] 3,234.31: zp[2]:3 [ main::count#11 main::count#10 main::count#12 main::count#1 ] 2,152.15: zp[1]:7 [ main::x#2 main::x#1 ] 2,002: zp[1]:52 [ main::$5 ] 2,002: zp[1]:54 [ main::$7 ] 2,002: zp[2]:58 [ main::$10 ] 2,002: zp[2]:60 [ main::dist_sq#0 ] 1,262.25: zp[2]:5 [ main::sc#8 main::sc#10 main::sc#1 ] 750.75: zp[1]:53 [ main::xd#0 ] 500.5: zp[1]:55 [ main::yd#0 ] 400.4: zp[2]:56 [ main::$9 ] 215.17: zp[1]:2 [ main::y#2 main::y#1 ]
Uplift Scope [main] 3,234.31: zp[2]:3 [ main::count#11 main::count#10 main::count#12 main::count#1 ] 2,202.2: zp[1]:7 [ main::x#2 main::x#1 ] 2,002: zp[1]:52 [ main::$5 ] 2,002: zp[1]:54 [ main::$7 ] 2,002: zp[2]:58 [ main::$10 ] 2,002: zp[2]:60 [ main::dist_sq#0 ] 1,262.25: zp[2]:5 [ main::sc#8 main::sc#10 main::sc#1 ] 750.75: zp[1]:53 [ main::xd#0 ] 500.5: zp[1]:55 [ main::yd#0 ] 400.4: zp[2]:56 [ main::$9 ] 258.7: zp[1]:2 [ main::y#2 main::y#1 ]
Uplift Scope [printf_number_buffer] 701: zp[1]:85 [ printf_number_buffer::buffer_sign#0 ]
Uplift Scope [printf_uint] 37.33: zp[2]:50 [ printf_uint::uvalue#0 ]
Uplift Scope [gotoxy]
@ -5400,43 +5406,43 @@ Uplift Scope [printf_format_number]
Uplift Scope [printf_buffer_number]
Uplift Scope [printf_format_string]
Uplifting [memcpy] best 118348 combination zp[2]:31 [ memcpy::src#2 memcpy::src#4 memcpy::src#1 ] zp[2]:33 [ memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 ] zp[2]:83 [ memcpy::src_end#0 ] zp[2]:27 [ memcpy::source#2 ] zp[2]:29 [ memcpy::destination#2 ]
Uplifting [memset] best 118329 combination zp[2]:25 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:81 [ memset::end#0 ] reg byte x [ memset::c#5 ] zp[2]:20 [ memset::num#3 ] zp[2]:22 [ memset::str#4 ]
Uplifting [mul8u] best 109320 combination zp[2]:13 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp[2]:15 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp[2]:63 [ mul8u::return#2 ] reg byte a [ mul8u::b#0 ]
Uplifting [cscroll] best 109320 combination zp[2]:77 [ cscroll::$7 ] zp[2]:79 [ cscroll::$8 ]
Uplifting [cputln] best 109320 combination zp[2]:73 [ cputln::$1 ] zp[2]:75 [ cputln::$2 ] zp[2]:71 [ cputln::ln_offset#0 ]
Uplifting [utoa_append] best 108717 combination zp[2]:41 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] zp[2]:94 [ utoa_append::sub#0 ] zp[2]:96 [ utoa_append::return#0 ] zp[2]:92 [ utoa_append::buffer#0 ]
Uplifting [] best 108717 combination zp[1]:45 [ conio_cursor_y ] zp[2]:48 [ conio_cursor_color ] zp[2]:46 [ conio_cursor_text ] zp[1]:44 [ conio_cursor_x ] mem[12] [ printf_buffer ]
Uplifting [cputc] best 108678 combination reg byte a [ cputc::c#3 cputc::c#0 cputc::c#2 ]
Uplifting [cputs] best 108588 combination zp[2]:17 [ cputs::s#3 cputs::s#4 cputs::s#0 ] reg byte a [ cputs::c#1 ]
Uplifting [mul8s] best 108564 combination zp[2]:10 [ mul8s::m#4 mul8s::m#5 mul8s::m#1 mul8s::m#0 mul8s::m#2 ] reg byte a [ mul8s::$6 ] reg byte a [ mul8s::$11 ] reg byte a [ mul8s::$9 ] reg byte a [ mul8s::$12 ] zp[1]:9 [ mul8s::b#2 mul8s::b#1 mul8s::b#0 ] zp[1]:8 [ mul8s::a#2 mul8s::a#1 mul8s::a#0 ]
Uplifting [memcpy] best 119063 combination zp[2]:31 [ memcpy::src#2 memcpy::src#4 memcpy::src#1 ] zp[2]:33 [ memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 ] zp[2]:83 [ memcpy::src_end#0 ] zp[2]:27 [ memcpy::source#2 ] zp[2]:29 [ memcpy::destination#2 ]
Uplifting [memset] best 119044 combination zp[2]:25 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:81 [ memset::end#0 ] reg byte x [ memset::c#5 ] zp[2]:20 [ memset::num#3 ] zp[2]:22 [ memset::str#4 ]
Uplifting [mul8u] best 110035 combination zp[2]:13 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp[2]:15 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp[2]:63 [ mul8u::return#2 ] reg byte a [ mul8u::b#0 ]
Uplifting [cscroll] best 110035 combination zp[2]:77 [ cscroll::$7 ] zp[2]:79 [ cscroll::$8 ]
Uplifting [cputln] best 110035 combination zp[2]:73 [ cputln::$1 ] zp[2]:75 [ cputln::$2 ] zp[2]:71 [ cputln::ln_offset#0 ]
Uplifting [utoa_append] best 109432 combination zp[2]:41 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] zp[2]:94 [ utoa_append::sub#0 ] zp[2]:96 [ utoa_append::return#0 ] zp[2]:92 [ utoa_append::buffer#0 ]
Uplifting [] best 109432 combination zp[1]:45 [ conio_cursor_y ] zp[2]:48 [ conio_cursor_color ] zp[2]:46 [ conio_cursor_text ] zp[1]:44 [ conio_cursor_x ] mem[12] [ printf_buffer ]
Uplifting [cputc] best 109393 combination reg byte a [ cputc::c#3 cputc::c#0 cputc::c#2 ]
Uplifting [cputs] best 109303 combination zp[2]:17 [ cputs::s#3 cputs::s#4 cputs::s#0 ] reg byte a [ cputs::c#1 ]
Uplifting [mul8s] best 109279 combination zp[2]:10 [ mul8s::m#4 mul8s::m#5 mul8s::m#1 mul8s::m#0 mul8s::m#2 ] reg byte a [ mul8s::$6 ] reg byte a [ mul8s::$11 ] reg byte a [ mul8s::$9 ] reg byte a [ mul8s::$12 ] zp[1]:9 [ mul8s::b#2 mul8s::b#1 mul8s::b#0 ] zp[1]:8 [ mul8s::a#2 mul8s::a#1 mul8s::a#0 ]
Limited combination testing to 100 combinations of 2304 possible.
Uplifting [utoa] best 108430 combination zp[2]:39 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:36 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:35 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$10 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:90 [ utoa::digit_value#0 ] reg byte a [ utoa::$11 ] zp[2]:87 [ utoa::buffer#3 ]
Uplifting [main] best 106730 combination zp[2]:3 [ main::count#11 main::count#10 main::count#12 main::count#1 ] zp[1]:7 [ main::x#2 main::x#1 ] reg byte a [ main::$5 ] reg byte a [ main::$7 ] zp[2]:58 [ main::$10 ] zp[2]:60 [ main::dist_sq#0 ] zp[2]:5 [ main::sc#8 main::sc#10 main::sc#1 ] reg byte x [ main::xd#0 ] zp[1]:55 [ main::yd#0 ] zp[2]:56 [ main::$9 ] zp[1]:2 [ main::y#2 main::y#1 ]
Uplifting [utoa] best 109145 combination zp[2]:39 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:36 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:35 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$10 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:90 [ utoa::digit_value#0 ] reg byte a [ utoa::$11 ] zp[2]:87 [ utoa::buffer#3 ]
Uplifting [main] best 107445 combination zp[2]:3 [ main::count#11 main::count#10 main::count#12 main::count#1 ] zp[1]:7 [ main::x#2 main::x#1 ] reg byte a [ main::$5 ] reg byte a [ main::$7 ] zp[2]:58 [ main::$10 ] zp[2]:60 [ main::dist_sq#0 ] zp[2]:5 [ main::sc#8 main::sc#10 main::sc#1 ] reg byte x [ main::xd#0 ] zp[1]:55 [ main::yd#0 ] zp[2]:56 [ main::$9 ] zp[1]:2 [ main::y#2 main::y#1 ]
Limited combination testing to 100 combinations of 576 possible.
Uplifting [printf_number_buffer] best 106721 combination reg byte a [ printf_number_buffer::buffer_sign#0 ]
Uplifting [printf_uint] best 106721 combination zp[2]:50 [ printf_uint::uvalue#0 ]
Uplifting [gotoxy] best 106721 combination
Uplifting [RADIX] best 106721 combination
Uplifting [printf_format_number] best 106721 combination
Uplifting [printf_buffer_number] best 106721 combination
Uplifting [printf_format_string] best 106721 combination
Uplifting [printf_number_buffer] best 107436 combination reg byte a [ printf_number_buffer::buffer_sign#0 ]
Uplifting [printf_uint] best 107436 combination zp[2]:50 [ printf_uint::uvalue#0 ]
Uplifting [gotoxy] best 107436 combination
Uplifting [RADIX] best 107436 combination
Uplifting [printf_format_number] best 107436 combination
Uplifting [printf_buffer_number] best 107436 combination
Uplifting [printf_format_string] best 107436 combination
Attempting to uplift remaining variables inzp[1]:45 [ conio_cursor_y ]
Uplifting [] best 106721 combination zp[1]:45 [ conio_cursor_y ]
Uplifting [] best 107436 combination zp[1]:45 [ conio_cursor_y ]
Attempting to uplift remaining variables inzp[1]:44 [ conio_cursor_x ]
Uplifting [] best 106721 combination zp[1]:44 [ conio_cursor_x ]
Uplifting [] best 107436 combination zp[1]:44 [ conio_cursor_x ]
Attempting to uplift remaining variables inzp[1]:35 [ utoa::digit#2 utoa::digit#1 ]
Uplifting [utoa] best 106721 combination zp[1]:35 [ utoa::digit#2 utoa::digit#1 ]
Uplifting [utoa] best 107436 combination zp[1]:35 [ utoa::digit#2 utoa::digit#1 ]
Attempting to uplift remaining variables inzp[1]:9 [ mul8s::b#2 mul8s::b#1 mul8s::b#0 ]
Uplifting [mul8s] best 106520 combination reg byte y [ mul8s::b#2 mul8s::b#1 mul8s::b#0 ]
Uplifting [mul8s] best 107235 combination reg byte y [ mul8s::b#2 mul8s::b#1 mul8s::b#0 ]
Attempting to uplift remaining variables inzp[1]:8 [ mul8s::a#2 mul8s::a#1 mul8s::a#0 ]
Uplifting [mul8s] best 106520 combination zp[1]:8 [ mul8s::a#2 mul8s::a#1 mul8s::a#0 ]
Uplifting [mul8s] best 107235 combination zp[1]:8 [ mul8s::a#2 mul8s::a#1 mul8s::a#0 ]
Attempting to uplift remaining variables inzp[1]:7 [ main::x#2 main::x#1 ]
Uplifting [main] best 106520 combination zp[1]:7 [ main::x#2 main::x#1 ]
Uplifting [main] best 107235 combination zp[1]:7 [ main::x#2 main::x#1 ]
Attempting to uplift remaining variables inzp[1]:55 [ main::yd#0 ]
Uplifting [main] best 106520 combination zp[1]:55 [ main::yd#0 ]
Uplifting [main] best 107235 combination zp[1]:55 [ main::yd#0 ]
Attempting to uplift remaining variables inzp[1]:2 [ main::y#2 main::y#1 ]
Uplifting [main] best 106520 combination zp[1]:2 [ main::y#2 main::y#1 ]
Uplifting [main] best 107235 combination zp[1]:2 [ main::y#2 main::y#1 ]
Coalescing zero page register [ zp[2]:46 [ conio_cursor_text ] ] with [ zp[2]:73 [ cputln::$1 ] ] - score: 2
Coalescing zero page register [ zp[2]:46 [ conio_cursor_text cputln::$1 ] ] with [ zp[2]:77 [ cscroll::$7 ] ] - score: 2
Coalescing zero page register [ zp[2]:48 [ conio_cursor_color ] ] with [ zp[2]:75 [ cputln::$2 ] ] - score: 2
@ -5581,16 +5587,20 @@ main: {
sta.z count
lda #>0
sta.z count+1
// [10] phi (byte) main::y#2 = (byte) 0 [phi:main->main::@1#2] -- vbuz1=vbuc1
// [10] phi (signed byte) main::y#2 = (signed byte) 0 [phi:main->main::@1#2] -- vbsz1=vbsc1
lda #0
sta.z y
jmp __b1
// main::@1
__b1:
// [11] if((byte) main::y#2<(byte) $19) goto main::@3 -- vbuz1_lt_vbuc1_then_la1
// [11] if((signed byte) main::y#2<(signed byte) $19) goto main::@3 -- vbsz1_lt_vbsc1_then_la1
lda.z y
cmp #$19
bcc __b3_from___b1
sec
sbc #$19
bvc !+
eor #$80
!:
bmi __b3_from___b1
// [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
__b2_from___b1:
jmp __b2
@ -5631,36 +5641,40 @@ main: {
__b3_from___b1:
// [19] phi (word) main::count#10 = (word) main::count#11 [phi:main::@1->main::@3#0] -- register_copy
// [19] phi (byte*) main::sc#10 = (byte*) main::sc#8 [phi:main::@1->main::@3#1] -- register_copy
// [19] phi (byte) main::x#2 = (byte) 0 [phi:main::@1->main::@3#2] -- vbuz1=vbuc1
// [19] phi (signed byte) main::x#2 = (signed byte) 0 [phi:main::@1->main::@3#2] -- vbsz1=vbsc1
lda #0
sta.z x
jmp __b3
// main::@3
__b3:
// [20] if((byte) main::x#2<(byte) $28) goto main::@4 -- vbuz1_lt_vbuc1_then_la1
// [20] if((signed byte) main::x#2<(signed byte) $28) goto main::@4 -- vbsz1_lt_vbsc1_then_la1
lda.z x
cmp #$28
bcc __b4
sec
sbc #$28
bvc !+
eor #$80
!:
bmi __b4
jmp __b5
// main::@5
__b5:
// [21] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
// [21] (signed byte) main::y#1 ← ++ (signed byte) main::y#2 -- vbsz1=_inc_vbsz1
inc.z y
// [10] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
__b1_from___b5:
// [10] phi (byte*) main::sc#8 = (byte*) main::sc#10 [phi:main::@5->main::@1#0] -- register_copy
// [10] phi (word) main::count#11 = (word) main::count#10 [phi:main::@5->main::@1#1] -- register_copy
// [10] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#2] -- register_copy
// [10] phi (signed byte) main::y#2 = (signed byte) main::y#1 [phi:main::@5->main::@1#2] -- register_copy
jmp __b1
// main::@4
__b4:
// [22] (signed byte~) main::$5 ← (signed byte)(byte) main::x#2 << (byte) 1 -- vbsaa=vbsz1_rol_1
// [22] (signed byte~) main::$5 ← (signed byte) main::x#2 << (byte) 1 -- vbsaa=vbsz1_rol_1
lda.z x
asl
// [23] (signed byte) main::xd#0 ← (signed byte~) main::$5 - (signed byte) $27 -- vbsxx=vbsaa_minus_vbsc1
tax
axs #$27
// [24] (signed byte~) main::$7 ← (signed byte)(byte) main::y#2 << (byte) 1 -- vbsaa=vbsz1_rol_1
// [24] (signed byte~) main::$7 ← (signed byte) main::y#2 << (byte) 1 -- vbsaa=vbsz1_rol_1
lda.z y
asl
// [25] (signed byte) main::yd#0 ← (signed byte~) main::$7 - (signed byte) $18 -- vbsz1=vbsaa_minus_vbsc1
@ -5742,13 +5756,13 @@ main: {
bne !+
inc.z sc+1
!:
// [40] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuz1=_inc_vbuz1
// [40] (signed byte) main::x#1 ← ++ (signed byte) main::x#2 -- vbsz1=_inc_vbsz1
inc.z x
// [19] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
__b3_from___b6:
// [19] phi (word) main::count#10 = (word) main::count#12 [phi:main::@6->main::@3#0] -- register_copy
// [19] phi (byte*) main::sc#10 = (byte*) main::sc#1 [phi:main::@6->main::@3#1] -- register_copy
// [19] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@6->main::@3#2] -- register_copy
// [19] phi (signed byte) main::x#2 = (signed byte) main::x#1 [phi:main::@6->main::@3#2] -- register_copy
jmp __b3
s: .text " chars"
.byte 0
@ -6847,14 +6861,14 @@ FINAL SYMBOL TABLE
(byte*) main::sc#1 sc zp[2]:4 1001.0
(byte*) main::sc#10 sc zp[2]:4 160.25
(byte*) main::sc#8 sc zp[2]:4 101.0
(byte) main::x
(byte) main::x#1 x zp[1]:12 2002.0
(byte) main::x#2 x zp[1]:12 150.14999999999998
(signed byte) main::x
(signed byte) main::x#1 x zp[1]:12 2002.0
(signed byte) main::x#2 x zp[1]:12 200.2
(signed byte) main::xd
(signed byte) main::xd#0 reg byte x 750.75
(byte) main::y
(byte) main::y#1 y zp[1]:11 202.0
(byte) main::y#2 y zp[1]:11 13.173913043478262
(signed byte) main::y
(signed byte) main::y#1 y zp[1]:11 202.0
(signed byte) main::y#2 y zp[1]:11 56.69565217391305
(signed byte) main::yd
(signed byte) main::yd#0 yd zp[1]:17 500.5
(void*()) memcpy((void*) memcpy::destination , (void*) memcpy::source , (word) memcpy::num)
@ -7075,7 +7089,7 @@ mem[12] [ printf_buffer ]
FINAL ASSEMBLER
Score: 85370
Score: 86085
// File Comments
// Plot a r=9 circle on the screen using chars - count how many chars are used
@ -7170,15 +7184,19 @@ main: {
lda #<0
sta.z count
sta.z count+1
// [10] phi (byte) main::y#2 = (byte) 0 [phi:main->main::@1#2] -- vbuz1=vbuc1
// [10] phi (signed byte) main::y#2 = (signed byte) 0 [phi:main->main::@1#2] -- vbsz1=vbsc1
sta.z y
// main::@1
__b1:
// for(char y=0;y<25;y++)
// [11] if((byte) main::y#2<(byte) $19) goto main::@3 -- vbuz1_lt_vbuc1_then_la1
// for(signed char y=0;y<25;y++)
// [11] if((signed byte) main::y#2<(signed byte) $19) goto main::@3 -- vbsz1_lt_vbsc1_then_la1
lda.z y
cmp #$19
bcc __b2
sec
sbc #$19
bvc !+
eor #$80
!:
bmi __b2
// [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// main::@2
// gotoxy(0,0)
@ -7210,40 +7228,44 @@ main: {
__b2:
// [19] phi (word) main::count#10 = (word) main::count#11 [phi:main::@1->main::@3#0] -- register_copy
// [19] phi (byte*) main::sc#10 = (byte*) main::sc#8 [phi:main::@1->main::@3#1] -- register_copy
// [19] phi (byte) main::x#2 = (byte) 0 [phi:main::@1->main::@3#2] -- vbuz1=vbuc1
// [19] phi (signed byte) main::x#2 = (signed byte) 0 [phi:main::@1->main::@3#2] -- vbsz1=vbsc1
lda #0
sta.z x
// main::@3
__b3:
// for(char x=0;x<40;x++)
// [20] if((byte) main::x#2<(byte) $28) goto main::@4 -- vbuz1_lt_vbuc1_then_la1
// for(signed char x=0;x<40;x++)
// [20] if((signed byte) main::x#2<(signed byte) $28) goto main::@4 -- vbsz1_lt_vbsc1_then_la1
lda.z x
cmp #$28
bcc __b4
sec
sbc #$28
bvc !+
eor #$80
!:
bmi __b4
// main::@5
// for(char y=0;y<25;y++)
// [21] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1
// for(signed char y=0;y<25;y++)
// [21] (signed byte) main::y#1 ← ++ (signed byte) main::y#2 -- vbsz1=_inc_vbsz1
inc.z y
// [10] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
// [10] phi (byte*) main::sc#8 = (byte*) main::sc#10 [phi:main::@5->main::@1#0] -- register_copy
// [10] phi (word) main::count#11 = (word) main::count#10 [phi:main::@5->main::@1#1] -- register_copy
// [10] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@5->main::@1#2] -- register_copy
// [10] phi (signed byte) main::y#2 = (signed byte) main::y#1 [phi:main::@5->main::@1#2] -- register_copy
jmp __b1
// main::@4
__b4:
// (signed char)x*2
// [22] (signed byte~) main::$5 ← (signed byte)(byte) main::x#2 << (byte) 1 -- vbsaa=vbsz1_rol_1
// x*2
// [22] (signed byte~) main::$5 ← (signed byte) main::x#2 << (byte) 1 -- vbsaa=vbsz1_rol_1
lda.z x
asl
// xd = (signed char)x*2-39
// xd = x*2-39
// [23] (signed byte) main::xd#0 ← (signed byte~) main::$5 - (signed byte) $27 -- vbsxx=vbsaa_minus_vbsc1
tax
axs #$27
// (signed char)y*2
// [24] (signed byte~) main::$7 ← (signed byte)(byte) main::y#2 << (byte) 1 -- vbsaa=vbsz1_rol_1
// y*2
// [24] (signed byte~) main::$7 ← (signed byte) main::y#2 << (byte) 1 -- vbsaa=vbsz1_rol_1
lda.z y
asl
// yd = (signed char)y*2-24
// yd = y*2-24
// [25] (signed byte) main::yd#0 ← (signed byte~) main::$7 - (signed byte) $18 -- vbsz1=vbsaa_minus_vbsc1
sec
sbc #$18
@ -7321,13 +7343,13 @@ main: {
bne !+
inc.z sc+1
!:
// for(char x=0;x<40;x++)
// [40] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuz1=_inc_vbuz1
// for(signed char x=0;x<40;x++)
// [40] (signed byte) main::x#1 ← ++ (signed byte) main::x#2 -- vbsz1=_inc_vbsz1
inc.z x
// [19] phi from main::@6 to main::@3 [phi:main::@6->main::@3]
// [19] phi (word) main::count#10 = (word) main::count#12 [phi:main::@6->main::@3#0] -- register_copy
// [19] phi (byte*) main::sc#10 = (byte*) main::sc#1 [phi:main::@6->main::@3#1] -- register_copy
// [19] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@6->main::@3#2] -- register_copy
// [19] phi (signed byte) main::x#2 = (signed byte) main::x#1 [phi:main::@6->main::@3#2] -- register_copy
jmp __b3
s: .text " chars"
.byte 0

View File

@ -89,14 +89,14 @@
(byte*) main::sc#1 sc zp[2]:4 1001.0
(byte*) main::sc#10 sc zp[2]:4 160.25
(byte*) main::sc#8 sc zp[2]:4 101.0
(byte) main::x
(byte) main::x#1 x zp[1]:12 2002.0
(byte) main::x#2 x zp[1]:12 150.14999999999998
(signed byte) main::x
(signed byte) main::x#1 x zp[1]:12 2002.0
(signed byte) main::x#2 x zp[1]:12 200.2
(signed byte) main::xd
(signed byte) main::xd#0 reg byte x 750.75
(byte) main::y
(byte) main::y#1 y zp[1]:11 202.0
(byte) main::y#2 y zp[1]:11 13.173913043478262
(signed byte) main::y
(signed byte) main::y#1 y zp[1]:11 202.0
(signed byte) main::y#2 y zp[1]:11 56.69565217391305
(signed byte) main::yd
(signed byte) main::yd#0 yd zp[1]:17 500.5
(void*()) memcpy((void*) memcpy::destination , (void*) memcpy::source , (word) memcpy::num)