diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 697544aad..a7dd1fcd0 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -37,6 +37,21 @@ public class TestPrograms { public TestPrograms() { } + @Test + public void testMillforkPlasma() throws IOException, URISyntaxException { + compileAndCompare("millfork-benchmarks/plasma-kc"); + } + + @Test + public void testMillforkRomsum() throws IOException, URISyntaxException { + compileAndCompare("millfork-benchmarks/romsum-kc"); + } + + @Test + public void testMillforkSieve() throws IOException, URISyntaxException { + compileAndCompare("millfork-benchmarks/sieve-kc"); + } + @Test public void testMillforkLinkedlist() throws IOException, URISyntaxException { compileAndCompare("millfork-benchmarks/linkedlist-kc"); diff --git a/src/test/kc/millfork-benchmarks/benchcommon.kc b/src/test/kc/millfork-benchmarks/benchcommon.kc index 617474d91..d0783f632 100644 --- a/src/test/kc/millfork-benchmarks/benchcommon.kc +++ b/src/test/kc/millfork-benchmarks/benchcommon.kc @@ -24,9 +24,9 @@ void end(void) { print_ln(); } -word rand_seed; +unsigned int rand_seed; -byte rand() { +char rand() { const unsigned int* RAND_SEED = &rand_seed; asm{ ldx #8 @@ -41,5 +41,5 @@ byte rand() { bne __rand_loop sta RAND_SEED+0 } - return (byte)rand_seed; + return (char)rand_seed; } \ No newline at end of file diff --git a/src/test/kc/millfork-benchmarks/plasma-kc.kc b/src/test/kc/millfork-benchmarks/plasma-kc.kc new file mode 100644 index 000000000..f27f1c64f --- /dev/null +++ b/src/test/kc/millfork-benchmarks/plasma-kc.kc @@ -0,0 +1,149 @@ +import "benchcommon" +import "c64" + +const char* SCREEN1 = 0xE000; +const char* SCREEN2 = 0xE400; +const char* CHARSET = 0xE800; +const char PAGE1 = ((((unsigned int)SCREEN1) >> 6) & 0xF0) | (((unsigned int)CHARSET >> 10) & 0x0E); +const char PAGE2 = ((((unsigned int)SCREEN2) >> 6) & 0xF0) | (((unsigned int)CHARSET >> 10) & 0x0E); + +const char [0x100] align($100) sinustable = { + 0x80, 0x7d, 0x7a, 0x77, 0x74, 0x70, 0x6d, 0x6a, + 0x67, 0x64, 0x61, 0x5e, 0x5b, 0x58, 0x55, 0x52, + 0x4f, 0x4d, 0x4a, 0x47, 0x44, 0x41, 0x3f, 0x3c, + 0x39, 0x37, 0x34, 0x32, 0x2f, 0x2d, 0x2b, 0x28, + 0x26, 0x24, 0x22, 0x20, 0x1e, 0x1c, 0x1a, 0x18, + 0x16, 0x15, 0x13, 0x11, 0x10, 0x0f, 0x0d, 0x0c, + 0x0b, 0x0a, 0x08, 0x07, 0x06, 0x06, 0x05, 0x04, + 0x03, 0x03, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, + 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x0a, + 0x0b, 0x0c, 0x0d, 0x0f, 0x10, 0x11, 0x13, 0x15, + 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, + 0x26, 0x28, 0x2b, 0x2d, 0x2f, 0x32, 0x34, 0x37, + 0x39, 0x3c, 0x3f, 0x41, 0x44, 0x47, 0x4a, 0x4d, + 0x4f, 0x52, 0x55, 0x58, 0x5b, 0x5e, 0x61, 0x64, + 0x67, 0x6a, 0x6d, 0x70, 0x74, 0x77, 0x7a, 0x7d, + 0x80, 0x83, 0x86, 0x89, 0x8c, 0x90, 0x93, 0x96, + 0x99, 0x9c, 0x9f, 0xa2, 0xa5, 0xa8, 0xab, 0xae, + 0xb1, 0xb3, 0xb6, 0xb9, 0xbc, 0xbf, 0xc1, 0xc4, + 0xc7, 0xc9, 0xcc, 0xce, 0xd1, 0xd3, 0xd5, 0xd8, + 0xda, 0xdc, 0xde, 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, + 0xea, 0xeb, 0xed, 0xef, 0xf0, 0xf1, 0xf3, 0xf4, + 0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfa, 0xfb, 0xfc, + 0xfd, 0xfd, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfd, + 0xfd, 0xfc, 0xfb, 0xfa, 0xfa, 0xf9, 0xf8, 0xf6, + 0xf5, 0xf4, 0xf3, 0xf1, 0xf0, 0xef, 0xed, 0xeb, + 0xea, 0xe8, 0xe6, 0xe4, 0xe2, 0xe0, 0xde, 0xdc, + 0xda, 0xd8, 0xd5, 0xd3, 0xd1, 0xce, 0xcc, 0xc9, + 0xc7, 0xc4, 0xc1, 0xbf, 0xbc, 0xb9, 0xb6, 0xb3, + 0xb1, 0xae, 0xab, 0xa8, 0xa5, 0xa2, 0x9f, 0x9c, + 0x99, 0x96, 0x93, 0x90, 0x8c, 0x89, 0x86, 0x83 +}; + + +char[40] xbuf; +char[25] ybuf; + +void doplasma (char* scrn) +{ + char c1a,c1b; + char c2a,c2b; + char c1A,c1B; + char c2A,c2B; + char i, ii; + char j, jj; + + c1a = c1A; + c1b = c1B; + for (ii = 0; ii < 25; ++ii) { + ybuf[ii] = (sinustable[c1a] + sinustable[c1b]); + c1a += 4; + c1b += 9; + } + c1A += 3; + c1B -= 5; + c2a = c2A; + c2b = c2B; + for (i = 0; i < 40; ++i) { + xbuf[i] = (sinustable[c2a] + sinustable[c2b]); + c2a += 3; + c2b += 7; + } + c2A += 2; + c2B -= 3; + for (jj = 0; jj < 25; ++jj) { + for (j = 0; j < 40; ++j) { + scrn[j] = (xbuf[j] + ybuf[jj]); + } + scrn += 40; + } + +} + + +const char[] bittab = { + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 +}; + +void makechar (void) +{ + char i, ii, b, s; + unsigned int c; + + for (c = 0; c < 0x100; ++c) { + s = sinustable[(char)c]; + for (i = 0; i < 8; ++i){ + b = 0; + for (ii = 0; ii < 8; ++ii) { + if ((rand() & 0xFF) > s) { + b |= bittab[ii]; + } + } + ((char*)CHARSET) [(c<<3) + i] = b; + } + } +} + + + +int main (void) +{ + char v; + char block; + unsigned int count = 500; + + rand_seed = 6474; + makechar(); + start(); + + block = *CIA2_PORT_A; + char tmp; + tmp = block & 0xFC; + tmp |= (char)((((unsigned int)SCREEN1) >> 14) ^ 0x03); + *CIA2_PORT_A = tmp; + v = *VIC_MEMORY; + + /* Run the demo until a key was hit */ + while (count) { + /* Build page 1, then make it visible */ + doplasma ((char*)SCREEN1); + *VIC_MEMORY = PAGE1; + + /* Build page 2, then make it visible */ + doplasma ((char*)SCREEN2); + *VIC_MEMORY = PAGE2; + + /* Count frames */ + --count; + } + + *VIC_MEMORY = v; + *CIA2_PORT_A = block; + + /* Reset screen colors */ + end(); + + return 0; +} diff --git a/src/test/kc/millfork-benchmarks/romsum-kc.kc b/src/test/kc/millfork-benchmarks/romsum-kc.kc new file mode 100644 index 000000000..3d6da6cdb --- /dev/null +++ b/src/test/kc/millfork-benchmarks/romsum-kc.kc @@ -0,0 +1,40 @@ +import "benchcommon" +import "print" + +const byte* rom = (byte*)0xe000; + +unsigned int sum(void) { + unsigned int s; + byte* p; + byte page; + byte i; + byte tmp; + p = rom; + s = 0; + /* doing it page-by-page is faster than doing just one huge loop */ + for (page = 0; page < 0x20; page++) { + i = 0; + do { + tmp = p[i]; + s += tmp; + i++; + } while (i); + p += 0x100; + } + return s; +} + + + + +int main (void) +{ + unsigned int i; + start(); + for(i=0;i<6;i++) { + print_word_decimal(sum()); + print_ln(); + } + end(); + return 0; +} diff --git a/src/test/kc/millfork-benchmarks/sieve-kc.kc b/src/test/kc/millfork-benchmarks/sieve-kc.kc new file mode 100644 index 000000000..7bece0bc6 --- /dev/null +++ b/src/test/kc/millfork-benchmarks/sieve-kc.kc @@ -0,0 +1,48 @@ +import "print" +import "benchcommon" + +const unsigned int COUNT = 16384; +const char SQRT_COUNT = 128; + +align(0x0100) char[COUNT] Sieve; + +void round(void) { + register char* S; + register char I; + for(char* p=Sieve;p> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E); + .const PAGE2 = $9a + .label print_line_cursor = 4 + .label print_char_cursor = 6 + .label last_time = $a + .label rand_seed = $c + .label Ticks = $10 + .label Ticks_1 = $13 +__b1: + lda #<0 + sta.z last_time + sta.z last_time+1 + sta.z rand_seed + sta.z rand_seed+1 + jsr main + rts +main: { + .label block = $e + .label v = $f + .label count = 4 + jsr start + jsr makechar + lda CIA2_PORT_A + sta.z block + lda #$fc + and.z block + sta CIA2_PORT_A + lda VIC_MEMORY + sta.z v + lda #<$1f4 + sta.z count + lda #>$1f4 + sta.z count+1 + /* Run the demo until a key was hit */ + __b1: + lda.z count+1 + cmp #>0 + bne __b2 + lda.z count + cmp #<0 + bne __b2 + lda.z v + sta VIC_MEMORY + lda.z block + sta CIA2_PORT_A + jsr end + rts + __b2: + lda #SCREEN1 + sta.z doplasma.scrn+1 + jsr doplasma + lda #PAGE1 + sta VIC_MEMORY + lda #SCREEN2 + sta.z doplasma.scrn+1 + jsr doplasma + lda #PAGE2 + sta VIC_MEMORY + lda.z count + bne !+ + dec.z count+1 + !: + dec.z count + jmp __b1 +} +// doplasma(byte* zeropage(6) scrn) +doplasma: { + .const c2A = 0 + .const c2B = 0 + .label c1a = 9 + .label c1b = $12 + .label ii = 8 + .label c2a = 2 + .label c2b = 3 + .label i = $15 + .label scrn = 6 + lda #0 + sta.z c1b + sta.z c1a + sta.z ii + __b1: + lda.z ii + cmp #$19 + bcc __b2 + lda #c2B + sta.z c2b + lda #c2A + sta.z c2a + lda #0 + sta.z i + __b3: + lda.z i + cmp #$28 + bcc __b4 + ldx #0 + __b5: + cpx #$19 + bcc b1 + rts + b1: + ldy #0 + __b6: + cpy #$28 + bcc __b7 + lda #$28 + clc + adc.z scrn + sta.z scrn + bcc !+ + inc.z scrn+1 + !: + inx + jmp __b5 + __b7: + lda xbuf,y + clc + adc ybuf,x + sta (scrn),y + iny + jmp __b6 + __b4: + ldy.z c2a + lda sinustable,y + ldy.z c2b + clc + adc sinustable,y + ldy.z i + sta xbuf,y + lax.z c2a + axs #-[3] + stx.z c2a + lax.z c2b + axs #-[7] + stx.z c2b + inc.z i + jmp __b3 + __b2: + ldy.z c1a + lda sinustable,y + ldy.z c1b + clc + adc sinustable,y + ldy.z ii + sta ybuf,y + lax.z c1a + axs #-[4] + stx.z c1a + lax.z c1b + axs #-[9] + stx.z c1b + inc.z ii + jmp __b1 +} +end: { + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + jsr start + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + jsr print_word + jsr print_ln + rts +} +// Print a newline +print_ln: { + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + __b1: + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1 + !: + rts +} +// Print a word as HEX +// print_word(word zeropage($13) w) +print_word: { + .label w = $13 + lda.z w+1 + tax + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + jsr print_byte + lda.z w + tax + jsr print_byte + rts +} +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + txa + lsr + lsr + lsr + lsr + tay + lda print_hextab,y + jsr print_char + lda #$f + axs #0 + lda print_hextab,x + jsr print_char + rts +} +// Print a single char +// print_char(byte register(A) ch) +print_char: { + ldy #0 + sta (print_char_cursor),y + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + rts +} +start: { + .label LAST_TIME = last_time + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + rts +} +makechar: { + .label __5 = $15 + .label __8 = $13 + .label __9 = $13 + .label s = $12 + .label c = $10 + .label i = 8 + .label b = 9 + .label __10 = $13 + lda #<0 + sta.z c + sta.z c+1 + __b1: + lda.z c+1 + cmp #>$100 + bcc __b2 + bne !+ + lda.z c + cmp #<$100 + bcc __b2 + !: + rts + __b2: + lda.z c + tay + lda sinustable,y + sta.z s + lda #0 + sta.z i + __b3: + lda.z i + cmp #8 + bcc b1 + inc.z c + bne !+ + inc.z c+1 + !: + jmp __b1 + b1: + lda #0 + sta.z b + tay + __b5: + cpy #8 + bcc __b6 + lda.z c + asl + sta.z __8 + lda.z c+1 + rol + sta.z __8+1 + asl.z __8 + rol.z __8+1 + asl.z __8 + rol.z __8+1 + lda.z i + clc + adc.z __9 + sta.z __9 + bcc !+ + inc.z __9+1 + !: + clc + lda.z __10 + adc #CHARSET + sta.z __10+1 + lda.z b + ldy #0 + sta (__10),y + inc.z i + jmp __b3 + __b6: + jsr rand + and #$ff + sta.z __5 + lda.z s + cmp.z __5 + bcs __b8 + lda bittab,y + ora.z b + sta.z b + __b8: + iny + jmp __b5 +} +rand: { + .label RAND_SEED = rand_seed + ldx #8 + lda RAND_SEED+0 + __rand_loop: + asl + rol RAND_SEED+1 + bcc __no_eor + eor #$2d + __no_eor: + dex + bne __rand_loop + sta RAND_SEED+0 + lda.z rand_seed + rts +} + print_hextab: .text "0123456789abcdef" + // ((SCREEN2 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E); + .align $100 + sinustable: .byte $80, $7d, $7a, $77, $74, $70, $6d, $6a, $67, $64, $61, $5e, $5b, $58, $55, $52, $4f, $4d, $4a, $47, $44, $41, $3f, $3c, $39, $37, $34, $32, $2f, $2d, $2b, $28, $26, $24, $22, $20, $1e, $1c, $1a, $18, $16, $15, $13, $11, $10, $f, $d, $c, $b, $a, 8, 7, 6, 6, 5, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 6, 7, 8, $a, $b, $c, $d, $f, $10, $11, $13, $15, $16, $18, $1a, $1c, $1e, $20, $22, $24, $26, $28, $2b, $2d, $2f, $32, $34, $37, $39, $3c, $3f, $41, $44, $47, $4a, $4d, $4f, $52, $55, $58, $5b, $5e, $61, $64, $67, $6a, $6d, $70, $74, $77, $7a, $7d, $80, $83, $86, $89, $8c, $90, $93, $96, $99, $9c, $9f, $a2, $a5, $a8, $ab, $ae, $b1, $b3, $b6, $b9, $bc, $bf, $c1, $c4, $c7, $c9, $cc, $ce, $d1, $d3, $d5, $d8, $da, $dc, $de, $e0, $e2, $e4, $e6, $e8, $ea, $eb, $ed, $ef, $f0, $f1, $f3, $f4, $f5, $f6, $f8, $f9, $fa, $fa, $fb, $fc, $fd, $fd, $fe, $fe, $fe, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $fe, $fe, $fe, $fd, $fd, $fc, $fb, $fa, $fa, $f9, $f8, $f6, $f5, $f4, $f3, $f1, $f0, $ef, $ed, $eb, $ea, $e8, $e6, $e4, $e2, $e0, $de, $dc, $da, $d8, $d5, $d3, $d1, $ce, $cc, $c9, $c7, $c4, $c1, $bf, $bc, $b9, $b6, $b3, $b1, $ae, $ab, $a8, $a5, $a2, $9f, $9c, $99, $96, $93, $90, $8c, $89, $86, $83 + xbuf: .fill $28, 0 + ybuf: .fill $19, 0 + bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 diff --git a/src/test/ref/millfork-benchmarks/plasma-kc.cfg b/src/test/ref/millfork-benchmarks/plasma-kc.cfg new file mode 100644 index 000000000..6b85d3017 --- /dev/null +++ b/src/test/ref/millfork-benchmarks/plasma-kc.cfg @@ -0,0 +1,251 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] (word) last_time#0 ← (word) 0 + to:@2 +@2: scope:[] from @1 + [2] (word) rand_seed#22 ← (word) 0 + to:@3 +@3: scope:[] from @2 + [3] phi() + [4] call main + to:@end +@end: scope:[] from @3 + [5] phi() + +(signed word()) main() +main: scope:[main] from @3 + [6] phi() + [7] call start + to:main::@4 +main::@4: scope:[main] from main + [8] phi() + [9] call makechar + to:main::@5 +main::@5: scope:[main] from main::@4 + [10] (byte) main::block#1 ← *((const byte*) CIA2_PORT_A) + [11] (byte) main::tmp#1 ← (byte) main::block#1 & (byte) $fc + [12] *((const byte*) CIA2_PORT_A) ← (byte) main::tmp#1 + [13] (byte) main::v#1 ← *((const byte*) VIC_MEMORY) + to:main::@1 +main::@1: scope:[main] from main::@5 main::@7 + [14] (word) main::count#2 ← phi( main::@7/(word) main::count#1 main::@5/(word) $1f4 ) + [15] if((byte) 0!=(word) main::count#2) goto main::@2 + to:main::@3 +main::@3: scope:[main] from main::@1 + [16] *((const byte*) VIC_MEMORY) ← (byte) main::v#1 + [17] *((const byte*) CIA2_PORT_A) ← (byte) main::block#1 + [18] call end + to:main::@return +main::@return: scope:[main] from main::@3 + [19] return + to:@return +main::@2: scope:[main] from main::@1 + [20] phi() + [21] call doplasma + to:main::@6 +main::@6: scope:[main] from main::@2 + [22] *((const byte*) VIC_MEMORY) ← (const byte) PAGE1 + [23] call doplasma + to:main::@7 +main::@7: scope:[main] from main::@6 + [24] *((const byte*) VIC_MEMORY) ← (const byte) PAGE2 + [25] (word) main::count#1 ← -- (word) main::count#2 + to:main::@1 + +(void()) doplasma((byte*) doplasma::scrn) +doplasma: scope:[doplasma] from main::@2 main::@6 + [26] (byte*) doplasma::scrn#13 ← phi( main::@6/(byte*)(const word) SCREEN2 main::@2/(byte*)(const word) SCREEN1 ) + to:doplasma::@1 +doplasma::@1: scope:[doplasma] from doplasma doplasma::@2 + [27] (byte) doplasma::c1b#3 ← phi( doplasma/(byte) 0 doplasma::@2/(byte) doplasma::c1b#2 ) + [27] (byte) doplasma::c1a#3 ← phi( doplasma/(byte) 0 doplasma::@2/(byte) doplasma::c1a#2 ) + [27] (byte) doplasma::ii#3 ← phi( doplasma/(byte) 0 doplasma::@2/(byte) doplasma::ii#2 ) + [28] if((byte) doplasma::ii#3<(byte) $19) goto doplasma::@2 + to:doplasma::@3 +doplasma::@3: scope:[doplasma] from doplasma::@1 doplasma::@4 + [29] (byte) doplasma::c2b#3 ← phi( doplasma::@1/(const byte) doplasma::c2B#0 doplasma::@4/(byte) doplasma::c2b#2 ) + [29] (byte) doplasma::c2a#3 ← phi( doplasma::@1/(const byte) doplasma::c2A#0 doplasma::@4/(byte) doplasma::c2a#2 ) + [29] (byte) doplasma::i#3 ← phi( doplasma::@1/(byte) 0 doplasma::@4/(byte) doplasma::i#2 ) + [30] if((byte) doplasma::i#3<(byte) $28) goto doplasma::@4 + to:doplasma::@5 +doplasma::@5: scope:[doplasma] from doplasma::@3 doplasma::@8 + [31] (byte*) doplasma::scrn#6 ← phi( doplasma::@8/(byte*) doplasma::scrn#0 doplasma::@3/(byte*) doplasma::scrn#13 ) + [31] (byte) doplasma::jj#3 ← phi( doplasma::@8/(byte) doplasma::jj#2 doplasma::@3/(byte) 0 ) + [32] if((byte) doplasma::jj#3<(byte) $19) goto doplasma::@6 + to:doplasma::@return +doplasma::@return: scope:[doplasma] from doplasma::@5 + [33] return + to:@return +doplasma::@6: scope:[doplasma] from doplasma::@5 doplasma::@7 + [34] (byte) doplasma::j#3 ← phi( doplasma::@5/(byte) 0 doplasma::@7/(byte) doplasma::j#2 ) + [35] if((byte) doplasma::j#3<(byte) $28) goto doplasma::@7 + to:doplasma::@8 +doplasma::@8: scope:[doplasma] from doplasma::@6 + [36] (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#6 + (byte) $28 + [37] (byte) doplasma::jj#2 ← ++ (byte) doplasma::jj#3 + to:doplasma::@5 +doplasma::@7: scope:[doplasma] from doplasma::@6 + [38] (byte~) doplasma::$6 ← *((const byte*) xbuf + (byte) doplasma::j#3) + *((const byte*) ybuf + (byte) doplasma::jj#3) + [39] *((byte*) doplasma::scrn#6 + (byte) doplasma::j#3) ← (byte~) doplasma::$6 + [40] (byte) doplasma::j#2 ← ++ (byte) doplasma::j#3 + to:doplasma::@6 +doplasma::@4: scope:[doplasma] from doplasma::@3 + [41] (byte~) doplasma::$3 ← *((const byte*) sinustable + (byte) doplasma::c2a#3) + *((const byte*) sinustable + (byte) doplasma::c2b#3) + [42] *((const byte*) xbuf + (byte) doplasma::i#3) ← (byte~) doplasma::$3 + [43] (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (byte) 3 + [44] (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (byte) 7 + [45] (byte) doplasma::i#2 ← ++ (byte) doplasma::i#3 + to:doplasma::@3 +doplasma::@2: scope:[doplasma] from doplasma::@1 + [46] (byte~) doplasma::$1 ← *((const byte*) sinustable + (byte) doplasma::c1a#3) + *((const byte*) sinustable + (byte) doplasma::c1b#3) + [47] *((const byte*) ybuf + (byte) doplasma::ii#3) ← (byte~) doplasma::$1 + [48] (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (byte) 4 + [49] (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (byte) 9 + [50] (byte) doplasma::ii#2 ← ++ (byte) doplasma::ii#3 + to:doplasma::@1 + +(void()) end() +end: scope:[end] from main::@3 + [51] (word) Ticks#1 ← (word) last_time#0 + [52] call start + to:end::@1 +end::@1: scope:[end] from end + [53] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 + [54] (word) Ticks#2 ← (word) last_time#1 + [55] (word) print_word::w#0 ← (word) Ticks#2 + [56] call print_word + to:end::@2 +end::@2: scope:[end] from end::@1 + [57] phi() + [58] call print_ln + to:end::@return +end::@return: scope:[end] from end::@2 + [59] (word) last_time#2 ← (word) last_time#1 + [60] return + to:@return + +(void()) print_ln() +print_ln: scope:[print_ln] from end::@2 + [61] phi() + to:print_ln::@1 +print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 + [62] (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) 1024 print_ln::@1/(byte*) print_line_cursor#1 ) + [63] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 + [64] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 + to:print_ln::@return +print_ln::@return: scope:[print_ln] from print_ln::@1 + [65] return + to:@return + +(void()) print_word((word) print_word::w) +print_word: scope:[print_word] from end::@1 + [66] (byte) print_byte::b#0 ← > (word) print_word::w#0 + [67] call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + [68] (byte) print_byte::b#1 ← < (word) print_word::w#0 + [69] call print_byte + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@1 + [70] return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + [71] (byte*) print_char_cursor#35 ← phi( print_word/(byte*) 1024 print_word::@1/(byte*) print_char_cursor#10 ) + [71] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + [72] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 + [73] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) + [74] call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + [75] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f + [76] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) + [77] call print_char + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@1 + [78] return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + [79] (byte*) print_char_cursor#25 ← phi( print_byte/(byte*) print_char_cursor#35 print_byte::@1/(byte*) print_char_cursor#10 ) + [79] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + [80] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 + [81] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + [82] return + to:@return + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + [84] (word) rand_seed#0 ← (word) $194a + to:start::@return +start::@return: scope:[start] from start + [85] return + to:@return + +(void()) makechar() +makechar: scope:[makechar] from main::@4 + [86] phi() + to:makechar::@1 +makechar::@1: scope:[makechar] from makechar makechar::@4 + [87] (word) makechar::c#3 ← phi( makechar/(byte) 0 makechar::@4/(word) makechar::c#2 ) + [88] if((word) makechar::c#3<(word) $100) goto makechar::@2 + to:makechar::@return +makechar::@return: scope:[makechar] from makechar::@1 + [89] return + to:@return +makechar::@2: scope:[makechar] from makechar::@1 + [90] (byte~) makechar::$1 ← (byte)(word) makechar::c#3 + [91] (byte) makechar::s#1 ← *((const byte*) sinustable + (byte~) makechar::$1) + to:makechar::@3 +makechar::@3: scope:[makechar] from makechar::@2 makechar::@7 + [92] (byte) makechar::i#3 ← phi( makechar::@2/(byte) 0 makechar::@7/(byte) makechar::i#2 ) + [93] if((byte) makechar::i#3<(byte) 8) goto makechar::@5 + to:makechar::@4 +makechar::@4: scope:[makechar] from makechar::@3 + [94] (word) makechar::c#2 ← ++ (word) makechar::c#3 + to:makechar::@1 +makechar::@5: scope:[makechar] from makechar::@3 makechar::@8 + [95] (byte) makechar::b#3 ← phi( makechar::@8/(byte) makechar::b#7 makechar::@3/(byte) 0 ) + [95] (byte) makechar::ii#3 ← phi( makechar::@8/(byte) makechar::ii#2 makechar::@3/(byte) 0 ) + [96] if((byte) makechar::ii#3<(byte) 8) goto makechar::@6 + to:makechar::@7 +makechar::@7: scope:[makechar] from makechar::@5 + [97] (word~) makechar::$8 ← (word) makechar::c#3 << (byte) 3 + [98] (word~) makechar::$9 ← (word~) makechar::$8 + (byte) makechar::i#3 + [99] (byte*~) makechar::$10 ← (byte*)(const word) CHARSET + (word~) makechar::$9 + [100] *((byte*~) makechar::$10) ← (byte) makechar::b#3 + [101] (byte) makechar::i#2 ← ++ (byte) makechar::i#3 + to:makechar::@3 +makechar::@6: scope:[makechar] from makechar::@5 + [102] phi() + [103] call rand + [104] (byte) rand::return#2 ← (byte) rand::return#0 + to:makechar::@10 +makechar::@10: scope:[makechar] from makechar::@6 + [105] (byte~) makechar::$4 ← (byte) rand::return#2 + [106] (byte~) makechar::$5 ← (byte~) makechar::$4 & (byte) $ff + [107] if((byte~) makechar::$5<=(byte) makechar::s#1) goto makechar::@8 + to:makechar::@9 +makechar::@9: scope:[makechar] from makechar::@10 + [108] (byte) makechar::b#2 ← (byte) makechar::b#3 | *((const byte*) bittab + (byte) makechar::ii#3) + to:makechar::@8 +makechar::@8: scope:[makechar] from makechar::@10 makechar::@9 + [109] (byte) makechar::b#7 ← phi( makechar::@9/(byte) makechar::b#2 makechar::@10/(byte) makechar::b#3 ) + [110] (byte) makechar::ii#2 ← ++ (byte) makechar::ii#3 + to:makechar::@5 + +(byte()) rand() +rand: scope:[rand] from makechar::@6 + asm { ldx#8 ldaRAND_SEED+0 __rand_loop: asl rolRAND_SEED+1 bcc__no_eor eor#$2D __no_eor: dex bne__rand_loop staRAND_SEED+0 } + [112] (byte) rand::return#0 ← (byte)(word) rand_seed#0 + to:rand::@return +rand::@return: scope:[rand] from rand + [113] return + to:@return diff --git a/src/test/ref/millfork-benchmarks/plasma-kc.log b/src/test/ref/millfork-benchmarks/plasma-kc.log new file mode 100644 index 000000000..f1597e04c --- /dev/null +++ b/src/test/ref/millfork-benchmarks/plasma-kc.log @@ -0,0 +1,5156 @@ +Resolved forward reference rand_seed to (word) rand_seed +Setting inferred volatile on symbol affected by address-of (word) last_time +Setting inferred volatile on symbol affected by address-of (word) rand_seed +Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6 +Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1 +Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1 +Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit) +Fixing pointer array-indexing *((dword*) ultoa::digit_values + (byte) ultoa::digit) +Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src) +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_lines::str) +Warning! Adding boolean cast to non-boolean condition (byte) print_str_lines::ch +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str::str) +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_at::str) +Warning! Adding boolean cast to non-boolean condition (word) main::count +Warning! Adding boolean cast to non-boolean sub-expression (byte) print_str_lines::ch +Identified constant variable (byte*) HEAP_TOP +Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx +Culled Empty Block (label) @1 +Culled Empty Block (label) @2 +Culled Empty Block (label) @3 +Culled Empty Block (label) @4 +Culled Empty Block (label) @5 +Culled Empty Block (label) @6 +Culled Empty Block (label) @7 +Culled Empty Block (label) @8 +Culled Empty Block (label) @9 +Culled Empty Block (label) @10 +Culled Empty Block (label) @11 +Culled Empty Block (label) @13 +Culled Empty Block (label) @14 +Culled Empty Block (label) @15 +Culled Empty Block (label) @16 +Culled Empty Block (label) @17 +Culled Empty Block (label) @18 +Culled Empty Block (label) @19 +Culled Empty Block (label) @20 +Culled Empty Block (label) @21 +Culled Empty Block (label) @22 +Culled Empty Block (label) @23 +Culled Empty Block (label) @24 +Culled Empty Block (label) @25 +Culled Empty Block (label) @26 +Culled Empty Block (label) @27 +Culled Empty Block (label) @28 +Culled Empty Block (label) @29 +Culled Empty Block (label) @30 +Culled Empty Block (label) @31 +Culled Empty Block (label) @32 +Culled Empty Block (label) @33 +Culled Empty Block (label) @34 +Culled Empty Block (label) @35 +Culled Empty Block (label) @36 +Culled Empty Block (label) @37 +Culled Empty Block (label) @38 +Culled Empty Block (label) @39 +Culled Empty Block (label) @40 +Culled Empty Block (label) @41 +Culled Empty Block (label) @43 +Culled Empty Block (label) rand::@1 +Culled Empty Block (label) @45 +Culled Empty Block (label) doplasma::@4 +Culled Empty Block (label) doplasma::@5 +Culled Empty Block (label) doplasma::@6 +Culled Empty Block (label) doplasma::@10 +Culled Empty Block (label) doplasma::@11 +Culled Empty Block (label) doplasma::@12 +Culled Empty Block (label) doplasma::@23 +Culled Empty Block (label) doplasma::@15 +Culled Empty Block (label) doplasma::@24 +Culled Empty Block (label) doplasma::@19 +Culled Empty Block (label) doplasma::@20 +Culled Empty Block (label) doplasma::@21 +Culled Empty Block (label) doplasma::@22 +Culled Empty Block (label) @46 +Culled Empty Block (label) makechar::@19 +Culled Empty Block (label) makechar::@3 +Culled Empty Block (label) makechar::@20 +Culled Empty Block (label) makechar::@16 +Culled Empty Block (label) makechar::@17 +Culled Empty Block (label) makechar::@11 +Culled Empty Block (label) makechar::@12 +Culled Empty Block (label) makechar::@14 +Culled Empty Block (label) makechar::@15 +Culled Empty Block (label) makechar::@18 +Culled Empty Block (label) @47 +Culled Empty Block (label) main::@4 +Culled Empty Block (label) main::@5 +Culled Empty Block (label) main::@6 +Culled Empty Block (label) main::@7 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@12 +@12: scope:[] from @begin + (byte*) print_screen#0 ← ((byte*)) (number) $400 + (byte*) print_line_cursor#0 ← (byte*) print_screen#0 + (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 + to:@42 + +(void()) print_ln() +print_ln: scope:[print_ln] from end::@2 + (byte*) print_char_cursor#33 ← phi( end::@2/(byte*) print_char_cursor#11 ) + (byte*) print_line_cursor#16 ← phi( end::@2/(byte*) print_line_cursor#17 ) + to:print_ln::@1 +print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 + (byte*) print_char_cursor#17 ← phi( print_ln/(byte*) print_char_cursor#33 print_ln::@1/(byte*) print_char_cursor#17 ) + (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) print_line_cursor#16 print_ln::@1/(byte*) print_line_cursor#1 ) + (byte*~) print_ln::$0 ← (byte*) print_line_cursor#8 + (number) $28 + (byte*) print_line_cursor#1 ← (byte*~) print_ln::$0 + (bool~) print_ln::$1 ← (byte*) print_line_cursor#1 < (byte*) print_char_cursor#17 + if((bool~) print_ln::$1) goto print_ln::@1 + to:print_ln::@2 +print_ln::@2: scope:[print_ln] from print_ln::@1 + (byte*) print_line_cursor#9 ← phi( print_ln::@1/(byte*) print_line_cursor#1 ) + (byte*) print_char_cursor#1 ← (byte*) print_line_cursor#9 + to:print_ln::@return +print_ln::@return: scope:[print_ln] from print_ln::@2 + (byte*) print_char_cursor#18 ← phi( print_ln::@2/(byte*) print_char_cursor#1 ) + (byte*) print_line_cursor#10 ← phi( print_ln::@2/(byte*) print_line_cursor#9 ) + (byte*) print_line_cursor#2 ← (byte*) print_line_cursor#10 + (byte*) print_char_cursor#2 ← (byte*) print_char_cursor#18 + return + to:@return + +(void()) print_word((word) print_word::w) +print_word: scope:[print_word] from end::@1 + (byte*) print_char_cursor#34 ← phi( end::@1/(byte*) print_char_cursor#36 ) + (word) print_word::w#1 ← phi( end::@1/(word) print_word::w#0 ) + (byte~) print_word::$0 ← > (word) print_word::w#1 + (byte) print_byte::b#0 ← (byte~) print_word::$0 + call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + (word) print_word::w#2 ← phi( print_word/(word) print_word::w#1 ) + (byte*) print_char_cursor#19 ← phi( print_word/(byte*) print_char_cursor#8 ) + (byte*) print_char_cursor#3 ← (byte*) print_char_cursor#19 + (byte~) print_word::$2 ← < (word) print_word::w#2 + (byte) print_byte::b#1 ← (byte~) print_word::$2 + call print_byte + to:print_word::@2 +print_word::@2: scope:[print_word] from print_word::@1 + (byte*) print_char_cursor#20 ← phi( print_word::@1/(byte*) print_char_cursor#8 ) + (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#20 + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@2 + (byte*) print_char_cursor#21 ← phi( print_word::@2/(byte*) print_char_cursor#4 ) + (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#21 + return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + (byte*) print_char_cursor#35 ← phi( print_word/(byte*) print_char_cursor#34 print_word::@1/(byte*) print_char_cursor#3 ) + (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4 + (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) + call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + (byte) print_byte::b#3 ← phi( print_byte/(byte) print_byte::b#2 ) + (byte*) print_char_cursor#22 ← phi( print_byte/(byte*) print_char_cursor#10 ) + (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#22 + (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f + (byte) print_char::ch#1 ← *((const byte*) print_hextab + (number~) print_byte::$2) + call print_char + to:print_byte::@2 +print_byte::@2: scope:[print_byte] from print_byte::@1 + (byte*) print_char_cursor#23 ← phi( print_byte::@1/(byte*) print_char_cursor#10 ) + (byte*) print_char_cursor#7 ← (byte*) print_char_cursor#23 + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@2 + (byte*) print_char_cursor#24 ← phi( print_byte::@2/(byte*) print_char_cursor#7 ) + (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#24 + return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + (byte*) print_char_cursor#25 ← phi( print_byte/(byte*) print_char_cursor#35 print_byte::@1/(byte*) print_char_cursor#6 ) + (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 + (byte*) print_char_cursor#9 ← ++ (byte*) print_char_cursor#25 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + (byte*) print_char_cursor#26 ← phi( print_char/(byte*) print_char_cursor#9 ) + (byte*) print_char_cursor#10 ← (byte*) print_char_cursor#26 + return + to:@return +@42: scope:[] from @12 + (byte*) print_line_cursor#24 ← phi( @12/(byte*) print_line_cursor#0 ) + (byte*) print_char_cursor#42 ← phi( @12/(byte*) print_char_cursor#0 ) + (word) last_time#0 ← (word) 0 + (word) Ticks#0 ← (word) 0 + to:@44 + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + (word) rand_seed#0 ← (number) $194a + to:start::@return +start::@return: scope:[start] from start + (word) rand_seed#9 ← phi( start/(word) rand_seed#0 ) + (word) rand_seed#1 ← (word) rand_seed#9 + return + to:@return + +(void()) end() +end: scope:[end] from main::@3 + (byte*) print_line_cursor#23 ← phi( main::@3/(byte*) print_line_cursor#18 ) + (byte*) print_char_cursor#39 ← phi( main::@3/(byte*) print_char_cursor#37 ) + (word) rand_seed#17 ← phi( main::@3/(word) rand_seed#21 ) + (word) last_time#6 ← phi( main::@3/(word) last_time#12 ) + (word) Ticks#1 ← (word) last_time#6 + call start + to:end::@1 +end::@1: scope:[end] from end + (byte*) print_line_cursor#20 ← phi( end/(byte*) print_line_cursor#23 ) + (byte*) print_char_cursor#36 ← phi( end/(byte*) print_char_cursor#39 ) + (word) Ticks#7 ← phi( end/(word) Ticks#1 ) + (word) last_time#7 ← phi( end/(word) last_time#6 ) + (word) rand_seed#10 ← phi( end/(word) rand_seed#1 ) + (word) rand_seed#2 ← (word) rand_seed#10 + (word) last_time#1 ← (word) last_time#7 - (word) Ticks#7 + (word) Ticks#2 ← (word) last_time#1 + (word) print_word::w#0 ← (word) Ticks#2 + call print_word + to:end::@2 +end::@2: scope:[end] from end::@1 + (word) last_time#15 ← phi( end::@1/(word) last_time#1 ) + (word) rand_seed#23 ← phi( end::@1/(word) rand_seed#2 ) + (word) Ticks#15 ← phi( end::@1/(word) Ticks#2 ) + (byte*) print_line_cursor#17 ← phi( end::@1/(byte*) print_line_cursor#20 ) + (byte*) print_char_cursor#27 ← phi( end::@1/(byte*) print_char_cursor#5 ) + (byte*) print_char_cursor#11 ← (byte*) print_char_cursor#27 + call print_ln + to:end::@3 +end::@3: scope:[end] from end::@2 + (word) last_time#13 ← phi( end::@2/(word) last_time#15 ) + (word) rand_seed#18 ← phi( end::@2/(word) rand_seed#23 ) + (word) Ticks#12 ← phi( end::@2/(word) Ticks#15 ) + (byte*) print_char_cursor#28 ← phi( end::@2/(byte*) print_char_cursor#2 ) + (byte*) print_line_cursor#11 ← phi( end::@2/(byte*) print_line_cursor#2 ) + (byte*) print_line_cursor#3 ← (byte*) print_line_cursor#11 + (byte*) print_char_cursor#12 ← (byte*) print_char_cursor#28 + to:end::@return +end::@return: scope:[end] from end::@3 + (byte*) print_line_cursor#12 ← phi( end::@3/(byte*) print_line_cursor#3 ) + (byte*) print_char_cursor#29 ← phi( end::@3/(byte*) print_char_cursor#12 ) + (word) last_time#8 ← phi( end::@3/(word) last_time#13 ) + (word) rand_seed#11 ← phi( end::@3/(word) rand_seed#18 ) + (word) Ticks#8 ← phi( end::@3/(word) Ticks#12 ) + (word) Ticks#3 ← (word) Ticks#8 + (word) rand_seed#3 ← (word) rand_seed#11 + (word) last_time#2 ← (word) last_time#8 + (byte*) print_char_cursor#13 ← (byte*) print_char_cursor#29 + (byte*) print_line_cursor#4 ← (byte*) print_line_cursor#12 + return + to:@return +@44: scope:[] from @42 + (byte*) print_line_cursor#22 ← phi( @42/(byte*) print_line_cursor#24 ) + (byte*) print_char_cursor#41 ← phi( @42/(byte*) print_char_cursor#42 ) + (word) last_time#17 ← phi( @42/(word) last_time#0 ) + (word) Ticks#17 ← phi( @42/(word) Ticks#0 ) + (word) rand_seed#4 ← (word) 0 + to:@48 + +(byte()) rand() +rand: scope:[rand] from makechar::@8 + (word) rand_seed#12 ← phi( makechar::@8/(word) rand_seed#19 ) + asm { ldx#8 ldaRAND_SEED+0 __rand_loop: asl rolRAND_SEED+1 bcc__no_eor eor#$2D __no_eor: dex bne__rand_loop staRAND_SEED+0 } + (byte~) rand::$0 ← ((byte)) (word) rand_seed#12 + (byte) rand::return#0 ← (byte~) rand::$0 + to:rand::@return +rand::@return: scope:[rand] from rand + (byte) rand::return#3 ← phi( rand/(byte) rand::return#0 ) + (byte) rand::return#1 ← (byte) rand::return#3 + return + to:@return + +(void()) doplasma((byte*) doplasma::scrn) +doplasma: scope:[doplasma] from main::@10 main::@2 + (byte*) doplasma::scrn#13 ← phi( main::@10/(byte*) doplasma::scrn#2 main::@2/(byte*) doplasma::scrn#1 ) + (byte) doplasma::c1a#0 ← (byte) 0 + (byte) doplasma::c1b#0 ← (byte) 0 + (byte) doplasma::c2a#0 ← (byte) 0 + (byte) doplasma::c2b#0 ← (byte) 0 + (byte) doplasma::c1A#0 ← (byte) 0 + (byte) doplasma::c1B#0 ← (byte) 0 + (byte) doplasma::c2A#0 ← (byte) 0 + (byte) doplasma::c2B#0 ← (byte) 0 + (byte) doplasma::i#0 ← (byte) 0 + (byte) doplasma::ii#0 ← (byte) 0 + (byte) doplasma::j#0 ← (byte) 0 + (byte) doplasma::jj#0 ← (byte) 0 + (byte) doplasma::c1a#1 ← (byte) doplasma::c1A#0 + (byte) doplasma::c1b#1 ← (byte) doplasma::c1B#0 + (byte) doplasma::ii#1 ← (number) 0 + to:doplasma::@1 +doplasma::@1: scope:[doplasma] from doplasma doplasma::@2 + (byte*) doplasma::scrn#12 ← phi( doplasma/(byte*) doplasma::scrn#13 doplasma::@2/(byte*) doplasma::scrn#14 ) + (byte) doplasma::c2B#4 ← phi( doplasma/(byte) doplasma::c2B#0 doplasma::@2/(byte) doplasma::c2B#6 ) + (byte) doplasma::c2A#4 ← phi( doplasma/(byte) doplasma::c2A#0 doplasma::@2/(byte) doplasma::c2A#6 ) + (byte) doplasma::c1B#3 ← phi( doplasma/(byte) doplasma::c1B#0 doplasma::@2/(byte) doplasma::c1B#4 ) + (byte) doplasma::c1A#3 ← phi( doplasma/(byte) doplasma::c1A#0 doplasma::@2/(byte) doplasma::c1A#4 ) + (byte) doplasma::c1b#4 ← phi( doplasma/(byte) doplasma::c1b#1 doplasma::@2/(byte) doplasma::c1b#2 ) + (byte) doplasma::c1a#4 ← phi( doplasma/(byte) doplasma::c1a#1 doplasma::@2/(byte) doplasma::c1a#2 ) + (byte) doplasma::ii#3 ← phi( doplasma/(byte) doplasma::ii#1 doplasma::@2/(byte) doplasma::ii#2 ) + (bool~) doplasma::$0 ← (byte) doplasma::ii#3 < (number) $19 + if((bool~) doplasma::$0) goto doplasma::@2 + to:doplasma::@3 +doplasma::@2: scope:[doplasma] from doplasma::@1 + (byte*) doplasma::scrn#14 ← phi( doplasma::@1/(byte*) doplasma::scrn#12 ) + (byte) doplasma::c2B#6 ← phi( doplasma::@1/(byte) doplasma::c2B#4 ) + (byte) doplasma::c2A#6 ← phi( doplasma::@1/(byte) doplasma::c2A#4 ) + (byte) doplasma::c1B#4 ← phi( doplasma::@1/(byte) doplasma::c1B#3 ) + (byte) doplasma::c1A#4 ← phi( doplasma::@1/(byte) doplasma::c1A#3 ) + (byte) doplasma::ii#4 ← phi( doplasma::@1/(byte) doplasma::ii#3 ) + (byte) doplasma::c1b#3 ← phi( doplasma::@1/(byte) doplasma::c1b#4 ) + (byte) doplasma::c1a#3 ← phi( doplasma::@1/(byte) doplasma::c1a#4 ) + (byte~) doplasma::$1 ← *((const byte*) sinustable + (byte) doplasma::c1a#3) + *((const byte*) sinustable + (byte) doplasma::c1b#3) + *((const byte*) ybuf + (byte) doplasma::ii#4) ← (byte~) doplasma::$1 + (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (number) 4 + (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (number) 9 + (byte) doplasma::ii#2 ← ++ (byte) doplasma::ii#4 + to:doplasma::@1 +doplasma::@3: scope:[doplasma] from doplasma::@1 + (byte*) doplasma::scrn#10 ← phi( doplasma::@1/(byte*) doplasma::scrn#12 ) + (byte) doplasma::c2B#2 ← phi( doplasma::@1/(byte) doplasma::c2B#4 ) + (byte) doplasma::c2A#2 ← phi( doplasma::@1/(byte) doplasma::c2A#4 ) + (byte) doplasma::c1B#2 ← phi( doplasma::@1/(byte) doplasma::c1B#3 ) + (byte) doplasma::c1A#2 ← phi( doplasma::@1/(byte) doplasma::c1A#3 ) + (byte) doplasma::c1A#1 ← (byte) doplasma::c1A#2 + (number) 3 + (byte) doplasma::c1B#1 ← (byte) doplasma::c1B#2 - (number) 5 + (byte) doplasma::c2a#1 ← (byte) doplasma::c2A#2 + (byte) doplasma::c2b#1 ← (byte) doplasma::c2B#2 + (byte) doplasma::i#1 ← (number) 0 + to:doplasma::@7 +doplasma::@7: scope:[doplasma] from doplasma::@3 doplasma::@8 + (byte*) doplasma::scrn#9 ← phi( doplasma::@3/(byte*) doplasma::scrn#10 doplasma::@8/(byte*) doplasma::scrn#11 ) + (byte) doplasma::c2B#5 ← phi( doplasma::@3/(byte) doplasma::c2B#2 doplasma::@8/(byte) doplasma::c2B#7 ) + (byte) doplasma::c2A#5 ← phi( doplasma::@3/(byte) doplasma::c2A#2 doplasma::@8/(byte) doplasma::c2A#7 ) + (byte) doplasma::c2b#4 ← phi( doplasma::@3/(byte) doplasma::c2b#1 doplasma::@8/(byte) doplasma::c2b#2 ) + (byte) doplasma::c2a#4 ← phi( doplasma::@3/(byte) doplasma::c2a#1 doplasma::@8/(byte) doplasma::c2a#2 ) + (byte) doplasma::i#3 ← phi( doplasma::@3/(byte) doplasma::i#1 doplasma::@8/(byte) doplasma::i#2 ) + (bool~) doplasma::$2 ← (byte) doplasma::i#3 < (number) $28 + if((bool~) doplasma::$2) goto doplasma::@8 + to:doplasma::@9 +doplasma::@8: scope:[doplasma] from doplasma::@7 + (byte*) doplasma::scrn#11 ← phi( doplasma::@7/(byte*) doplasma::scrn#9 ) + (byte) doplasma::c2B#7 ← phi( doplasma::@7/(byte) doplasma::c2B#5 ) + (byte) doplasma::c2A#7 ← phi( doplasma::@7/(byte) doplasma::c2A#5 ) + (byte) doplasma::i#4 ← phi( doplasma::@7/(byte) doplasma::i#3 ) + (byte) doplasma::c2b#3 ← phi( doplasma::@7/(byte) doplasma::c2b#4 ) + (byte) doplasma::c2a#3 ← phi( doplasma::@7/(byte) doplasma::c2a#4 ) + (byte~) doplasma::$3 ← *((const byte*) sinustable + (byte) doplasma::c2a#3) + *((const byte*) sinustable + (byte) doplasma::c2b#3) + *((const byte*) xbuf + (byte) doplasma::i#4) ← (byte~) doplasma::$3 + (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (number) 3 + (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (number) 7 + (byte) doplasma::i#2 ← ++ (byte) doplasma::i#4 + to:doplasma::@7 +doplasma::@9: scope:[doplasma] from doplasma::@7 + (byte*) doplasma::scrn#8 ← phi( doplasma::@7/(byte*) doplasma::scrn#9 ) + (byte) doplasma::c2B#3 ← phi( doplasma::@7/(byte) doplasma::c2B#5 ) + (byte) doplasma::c2A#3 ← phi( doplasma::@7/(byte) doplasma::c2A#5 ) + (byte) doplasma::c2A#1 ← (byte) doplasma::c2A#3 + (number) 2 + (byte) doplasma::c2B#1 ← (byte) doplasma::c2B#3 - (number) 3 + (byte) doplasma::jj#1 ← (number) 0 + to:doplasma::@13 +doplasma::@13: scope:[doplasma] from doplasma::@18 doplasma::@9 + (byte*) doplasma::scrn#7 ← phi( doplasma::@18/(byte*) doplasma::scrn#0 doplasma::@9/(byte*) doplasma::scrn#8 ) + (byte) doplasma::jj#3 ← phi( doplasma::@18/(byte) doplasma::jj#2 doplasma::@9/(byte) doplasma::jj#1 ) + (bool~) doplasma::$4 ← (byte) doplasma::jj#3 < (number) $19 + if((bool~) doplasma::$4) goto doplasma::@14 + to:doplasma::@return +doplasma::@14: scope:[doplasma] from doplasma::@13 + (byte*) doplasma::scrn#6 ← phi( doplasma::@13/(byte*) doplasma::scrn#7 ) + (byte) doplasma::jj#7 ← phi( doplasma::@13/(byte) doplasma::jj#3 ) + (byte) doplasma::j#1 ← (number) 0 + to:doplasma::@16 +doplasma::@16: scope:[doplasma] from doplasma::@14 doplasma::@17 + (byte*) doplasma::scrn#5 ← phi( doplasma::@14/(byte*) doplasma::scrn#6 doplasma::@17/(byte*) doplasma::scrn#3 ) + (byte) doplasma::jj#6 ← phi( doplasma::@14/(byte) doplasma::jj#7 doplasma::@17/(byte) doplasma::jj#4 ) + (byte) doplasma::j#3 ← phi( doplasma::@14/(byte) doplasma::j#1 doplasma::@17/(byte) doplasma::j#2 ) + (bool~) doplasma::$5 ← (byte) doplasma::j#3 < (number) $28 + if((bool~) doplasma::$5) goto doplasma::@17 + to:doplasma::@18 +doplasma::@17: scope:[doplasma] from doplasma::@16 + (byte*) doplasma::scrn#3 ← phi( doplasma::@16/(byte*) doplasma::scrn#5 ) + (byte) doplasma::jj#4 ← phi( doplasma::@16/(byte) doplasma::jj#6 ) + (byte) doplasma::j#4 ← phi( doplasma::@16/(byte) doplasma::j#3 ) + (byte~) doplasma::$6 ← *((const byte*) xbuf + (byte) doplasma::j#4) + *((const byte*) ybuf + (byte) doplasma::jj#4) + *((byte*) doplasma::scrn#3 + (byte) doplasma::j#4) ← (byte~) doplasma::$6 + (byte) doplasma::j#2 ← ++ (byte) doplasma::j#4 + to:doplasma::@16 +doplasma::@18: scope:[doplasma] from doplasma::@16 + (byte) doplasma::jj#5 ← phi( doplasma::@16/(byte) doplasma::jj#6 ) + (byte*) doplasma::scrn#4 ← phi( doplasma::@16/(byte*) doplasma::scrn#5 ) + (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#4 + (number) $28 + (byte) doplasma::jj#2 ← ++ (byte) doplasma::jj#5 + to:doplasma::@13 +doplasma::@return: scope:[doplasma] from doplasma::@13 + return + to:@return + +(void()) makechar() +makechar: scope:[makechar] from main::@8 + (word) rand_seed#38 ← phi( main::@8/(word) rand_seed#5 ) + (byte) makechar::i#0 ← (byte) 0 + (byte) makechar::ii#0 ← (byte) 0 + (byte) makechar::b#0 ← (byte) 0 + (byte) makechar::s#0 ← (byte) 0 + (word) makechar::c#0 ← (word) 0 + (word) makechar::c#1 ← (number) 0 + to:makechar::@1 +makechar::@1: scope:[makechar] from makechar makechar::@6 + (word) rand_seed#37 ← phi( makechar/(word) rand_seed#38 makechar::@6/(word) rand_seed#39 ) + (word) makechar::c#3 ← phi( makechar/(word) makechar::c#1 makechar::@6/(word) makechar::c#2 ) + (bool~) makechar::$0 ← (word) makechar::c#3 < (number) $100 + if((bool~) makechar::$0) goto makechar::@2 + to:makechar::@return +makechar::@2: scope:[makechar] from makechar::@1 + (word) rand_seed#34 ← phi( makechar::@1/(word) rand_seed#37 ) + (word) makechar::c#4 ← phi( makechar::@1/(word) makechar::c#3 ) + (byte~) makechar::$1 ← ((byte)) (word) makechar::c#4 + (byte) makechar::s#1 ← *((const byte*) sinustable + (byte~) makechar::$1) + (byte) makechar::i#1 ← (number) 0 + to:makechar::@4 +makechar::@4: scope:[makechar] from makechar::@2 makechar::@9 + (byte) makechar::s#7 ← phi( makechar::@2/(byte) makechar::s#1 makechar::@9/(byte) makechar::s#9 ) + (word) rand_seed#30 ← phi( makechar::@2/(word) rand_seed#34 makechar::@9/(word) rand_seed#35 ) + (word) makechar::c#7 ← phi( makechar::@2/(word) makechar::c#4 makechar::@9/(word) makechar::c#6 ) + (byte) makechar::i#3 ← phi( makechar::@2/(byte) makechar::i#1 makechar::@9/(byte) makechar::i#2 ) + (bool~) makechar::$2 ← (byte) makechar::i#3 < (number) 8 + if((bool~) makechar::$2) goto makechar::@5 + to:makechar::@6 +makechar::@5: scope:[makechar] from makechar::@4 + (byte) makechar::s#6 ← phi( makechar::@4/(byte) makechar::s#7 ) + (word) rand_seed#27 ← phi( makechar::@4/(word) rand_seed#30 ) + (byte) makechar::i#7 ← phi( makechar::@4/(byte) makechar::i#3 ) + (word) makechar::c#10 ← phi( makechar::@4/(word) makechar::c#7 ) + (byte) makechar::b#1 ← (number) 0 + (byte) makechar::ii#1 ← (number) 0 + to:makechar::@7 +makechar::@6: scope:[makechar] from makechar::@4 + (word) rand_seed#39 ← phi( makechar::@4/(word) rand_seed#30 ) + (word) makechar::c#5 ← phi( makechar::@4/(word) makechar::c#7 ) + (word) makechar::c#2 ← ++ (word) makechar::c#5 + to:makechar::@1 +makechar::@7: scope:[makechar] from makechar::@10 makechar::@5 + (byte) makechar::s#4 ← phi( makechar::@10/(byte) makechar::s#5 makechar::@5/(byte) makechar::s#6 ) + (word) rand_seed#24 ← phi( makechar::@10/(word) rand_seed#26 makechar::@5/(word) rand_seed#27 ) + (byte) makechar::b#5 ← phi( makechar::@10/(byte) makechar::b#7 makechar::@5/(byte) makechar::b#1 ) + (byte) makechar::i#5 ← phi( makechar::@10/(byte) makechar::i#6 makechar::@5/(byte) makechar::i#7 ) + (word) makechar::c#8 ← phi( makechar::@10/(word) makechar::c#9 makechar::@5/(word) makechar::c#10 ) + (byte) makechar::ii#3 ← phi( makechar::@10/(byte) makechar::ii#2 makechar::@5/(byte) makechar::ii#1 ) + (bool~) makechar::$3 ← (byte) makechar::ii#3 < (number) 8 + if((bool~) makechar::$3) goto makechar::@8 + to:makechar::@9 +makechar::@8: scope:[makechar] from makechar::@7 + (byte) makechar::i#10 ← phi( makechar::@7/(byte) makechar::i#5 ) + (word) makechar::c#13 ← phi( makechar::@7/(word) makechar::c#8 ) + (byte) makechar::b#8 ← phi( makechar::@7/(byte) makechar::b#5 ) + (byte) makechar::ii#7 ← phi( makechar::@7/(byte) makechar::ii#3 ) + (byte) makechar::s#3 ← phi( makechar::@7/(byte) makechar::s#4 ) + (word) rand_seed#19 ← phi( makechar::@7/(word) rand_seed#24 ) + call rand + (byte) rand::return#2 ← (byte) rand::return#1 + to:makechar::@21 +makechar::@21: scope:[makechar] from makechar::@8 + (word) rand_seed#32 ← phi( makechar::@8/(word) rand_seed#19 ) + (byte) makechar::i#9 ← phi( makechar::@8/(byte) makechar::i#10 ) + (word) makechar::c#12 ← phi( makechar::@8/(word) makechar::c#13 ) + (byte) makechar::b#6 ← phi( makechar::@8/(byte) makechar::b#8 ) + (byte) makechar::ii#6 ← phi( makechar::@8/(byte) makechar::ii#7 ) + (byte) makechar::s#2 ← phi( makechar::@8/(byte) makechar::s#3 ) + (byte) rand::return#4 ← phi( makechar::@8/(byte) rand::return#2 ) + (byte~) makechar::$4 ← (byte) rand::return#4 + (number~) makechar::$5 ← (byte~) makechar::$4 & (number) $ff + (bool~) makechar::$6 ← (number~) makechar::$5 > (byte) makechar::s#2 + (bool~) makechar::$7 ← ! (bool~) makechar::$6 + if((bool~) makechar::$7) goto makechar::@10 + to:makechar::@13 +makechar::@9: scope:[makechar] from makechar::@7 + (byte) makechar::s#9 ← phi( makechar::@7/(byte) makechar::s#4 ) + (word) rand_seed#35 ← phi( makechar::@7/(word) rand_seed#24 ) + (byte) makechar::b#3 ← phi( makechar::@7/(byte) makechar::b#5 ) + (byte) makechar::i#4 ← phi( makechar::@7/(byte) makechar::i#5 ) + (word) makechar::c#6 ← phi( makechar::@7/(word) makechar::c#8 ) + (word~) makechar::$8 ← (word) makechar::c#6 << (number) 3 + (word~) makechar::$9 ← (word~) makechar::$8 + (byte) makechar::i#4 + *((byte*)(const word) CHARSET + (word~) makechar::$9) ← (byte) makechar::b#3 + (byte) makechar::i#2 ← ++ (byte) makechar::i#4 + to:makechar::@4 +makechar::@10: scope:[makechar] from makechar::@13 makechar::@21 + (byte) makechar::s#5 ← phi( makechar::@13/(byte) makechar::s#8 makechar::@21/(byte) makechar::s#2 ) + (word) rand_seed#26 ← phi( makechar::@13/(word) rand_seed#31 makechar::@21/(word) rand_seed#32 ) + (byte) makechar::b#7 ← phi( makechar::@13/(byte) makechar::b#2 makechar::@21/(byte) makechar::b#6 ) + (byte) makechar::i#6 ← phi( makechar::@13/(byte) makechar::i#8 makechar::@21/(byte) makechar::i#9 ) + (word) makechar::c#9 ← phi( makechar::@13/(word) makechar::c#11 makechar::@21/(word) makechar::c#12 ) + (byte) makechar::ii#4 ← phi( makechar::@13/(byte) makechar::ii#5 makechar::@21/(byte) makechar::ii#6 ) + (byte) makechar::ii#2 ← ++ (byte) makechar::ii#4 + to:makechar::@7 +makechar::@13: scope:[makechar] from makechar::@21 + (byte) makechar::s#8 ← phi( makechar::@21/(byte) makechar::s#2 ) + (word) rand_seed#31 ← phi( makechar::@21/(word) rand_seed#32 ) + (byte) makechar::i#8 ← phi( makechar::@21/(byte) makechar::i#9 ) + (word) makechar::c#11 ← phi( makechar::@21/(word) makechar::c#12 ) + (byte) makechar::ii#5 ← phi( makechar::@21/(byte) makechar::ii#6 ) + (byte) makechar::b#4 ← phi( makechar::@21/(byte) makechar::b#6 ) + (byte) makechar::b#2 ← (byte) makechar::b#4 | *((const byte*) bittab + (byte) makechar::ii#5) + to:makechar::@10 +makechar::@return: scope:[makechar] from makechar::@1 + return + to:@return + +(signed word()) main() +main: scope:[main] from @48 + (byte*) print_line_cursor#29 ← phi( @48/(byte*) print_line_cursor#19 ) + (byte*) print_char_cursor#47 ← phi( @48/(byte*) print_char_cursor#38 ) + (word) Ticks#22 ← phi( @48/(word) Ticks#14 ) + (word) last_time#22 ← phi( @48/(word) last_time#14 ) + (word) rand_seed#20 ← phi( @48/(word) rand_seed#22 ) + (byte) main::v#0 ← (byte) 0 + (byte) main::block#0 ← (byte) 0 + (word) main::count#0 ← (number) $1f4 + call start + to:main::@8 +main::@8: scope:[main] from main + (byte*) print_line_cursor#27 ← phi( main/(byte*) print_line_cursor#29 ) + (byte*) print_char_cursor#45 ← phi( main/(byte*) print_char_cursor#47 ) + (word) Ticks#20 ← phi( main/(word) Ticks#22 ) + (word) last_time#20 ← phi( main/(word) last_time#22 ) + (word) main::count#6 ← phi( main/(word) main::count#0 ) + (word) rand_seed#13 ← phi( main/(word) rand_seed#1 ) + (word) rand_seed#5 ← (word) rand_seed#13 + call makechar + to:main::@9 +main::@9: scope:[main] from main::@8 + (byte*) print_line_cursor#26 ← phi( main::@8/(byte*) print_line_cursor#27 ) + (byte*) print_char_cursor#44 ← phi( main::@8/(byte*) print_char_cursor#45 ) + (word) rand_seed#29 ← phi( main::@8/(word) rand_seed#5 ) + (word) Ticks#19 ← phi( main::@8/(word) Ticks#20 ) + (word) last_time#19 ← phi( main::@8/(word) last_time#20 ) + (word) main::count#4 ← phi( main::@8/(word) main::count#6 ) + (byte) main::block#1 ← *((const byte*) CIA2_PORT_A) + (byte) main::tmp#0 ← (byte) 0 + (number~) main::$2 ← (byte) main::block#1 & (number) $fc + (byte) main::tmp#1 ← (number~) main::$2 + (byte) main::tmp#2 ← (byte) main::tmp#1 | (byte)(const word) SCREEN1>>(number) $e^(number) 3 + *((const byte*) CIA2_PORT_A) ← (byte) main::tmp#2 + (byte) main::v#1 ← *((const byte*) VIC_MEMORY) + to:main::@1 +main::@1: scope:[main] from main::@11 main::@9 + (byte*) print_line_cursor#21 ← phi( main::@11/(byte*) print_line_cursor#25 main::@9/(byte*) print_line_cursor#26 ) + (byte*) print_char_cursor#40 ← phi( main::@11/(byte*) print_char_cursor#43 main::@9/(byte*) print_char_cursor#44 ) + (word) rand_seed#25 ← phi( main::@11/(word) rand_seed#28 main::@9/(word) rand_seed#29 ) + (word) Ticks#16 ← phi( main::@11/(word) Ticks#18 main::@9/(word) Ticks#19 ) + (word) last_time#16 ← phi( main::@11/(word) last_time#18 main::@9/(word) last_time#19 ) + (byte) main::block#3 ← phi( main::@11/(byte) main::block#4 main::@9/(byte) main::block#1 ) + (byte) main::v#3 ← phi( main::@11/(byte) main::v#4 main::@9/(byte) main::v#1 ) + (word) main::count#2 ← phi( main::@11/(word) main::count#1 main::@9/(word) main::count#4 ) + (bool~) main::$6 ← (number) 0 != (word) main::count#2 + if((bool~) main::$6) goto main::@2 + to:main::@3 +main::@2: scope:[main] from main::@1 + (byte*) print_line_cursor#30 ← phi( main::@1/(byte*) print_line_cursor#21 ) + (byte*) print_char_cursor#48 ← phi( main::@1/(byte*) print_char_cursor#40 ) + (word) rand_seed#36 ← phi( main::@1/(word) rand_seed#25 ) + (word) Ticks#23 ← phi( main::@1/(word) Ticks#16 ) + (word) last_time#23 ← phi( main::@1/(word) last_time#16 ) + (byte) main::block#6 ← phi( main::@1/(byte) main::block#3 ) + (byte) main::v#6 ← phi( main::@1/(byte) main::v#3 ) + (word) main::count#7 ← phi( main::@1/(word) main::count#2 ) + (byte*) doplasma::scrn#1 ← (byte*)(const word) SCREEN1 + call doplasma + to:main::@10 +main::@10: scope:[main] from main::@2 + (byte*) print_line_cursor#28 ← phi( main::@2/(byte*) print_line_cursor#30 ) + (byte*) print_char_cursor#46 ← phi( main::@2/(byte*) print_char_cursor#48 ) + (word) rand_seed#33 ← phi( main::@2/(word) rand_seed#36 ) + (word) Ticks#21 ← phi( main::@2/(word) Ticks#23 ) + (word) last_time#21 ← phi( main::@2/(word) last_time#23 ) + (byte) main::block#5 ← phi( main::@2/(byte) main::block#6 ) + (byte) main::v#5 ← phi( main::@2/(byte) main::v#6 ) + (word) main::count#5 ← phi( main::@2/(word) main::count#7 ) + *((const byte*) VIC_MEMORY) ← (const byte) PAGE1 + (byte*) doplasma::scrn#2 ← (byte*)(const word) SCREEN2 + call doplasma + to:main::@11 +main::@11: scope:[main] from main::@10 + (byte*) print_line_cursor#25 ← phi( main::@10/(byte*) print_line_cursor#28 ) + (byte*) print_char_cursor#43 ← phi( main::@10/(byte*) print_char_cursor#46 ) + (word) rand_seed#28 ← phi( main::@10/(word) rand_seed#33 ) + (word) Ticks#18 ← phi( main::@10/(word) Ticks#21 ) + (word) last_time#18 ← phi( main::@10/(word) last_time#21 ) + (byte) main::block#4 ← phi( main::@10/(byte) main::block#5 ) + (byte) main::v#4 ← phi( main::@10/(byte) main::v#5 ) + (word) main::count#3 ← phi( main::@10/(word) main::count#5 ) + *((const byte*) VIC_MEMORY) ← (const byte) PAGE2 + (word) main::count#1 ← -- (word) main::count#3 + to:main::@1 +main::@3: scope:[main] from main::@1 + (byte*) print_line_cursor#18 ← phi( main::@1/(byte*) print_line_cursor#21 ) + (byte*) print_char_cursor#37 ← phi( main::@1/(byte*) print_char_cursor#40 ) + (word) rand_seed#21 ← phi( main::@1/(word) rand_seed#25 ) + (word) Ticks#13 ← phi( main::@1/(word) Ticks#16 ) + (word) last_time#12 ← phi( main::@1/(word) last_time#16 ) + (byte) main::block#2 ← phi( main::@1/(byte) main::block#3 ) + (byte) main::v#2 ← phi( main::@1/(byte) main::v#3 ) + *((const byte*) VIC_MEMORY) ← (byte) main::v#2 + *((const byte*) CIA2_PORT_A) ← (byte) main::block#2 + call end + to:main::@12 +main::@12: scope:[main] from main::@3 + (byte*) print_line_cursor#13 ← phi( main::@3/(byte*) print_line_cursor#4 ) + (byte*) print_char_cursor#30 ← phi( main::@3/(byte*) print_char_cursor#13 ) + (word) last_time#9 ← phi( main::@3/(word) last_time#2 ) + (word) rand_seed#14 ← phi( main::@3/(word) rand_seed#3 ) + (word) Ticks#9 ← phi( main::@3/(word) Ticks#3 ) + (word) Ticks#4 ← (word) Ticks#9 + (word) rand_seed#6 ← (word) rand_seed#14 + (word) last_time#3 ← (word) last_time#9 + (byte*) print_char_cursor#14 ← (byte*) print_char_cursor#30 + (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#13 + (signed word) main::return#0 ← (number) 0 + to:main::@return +main::@return: scope:[main] from main::@12 + (byte*) print_line_cursor#14 ← phi( main::@12/(byte*) print_line_cursor#5 ) + (byte*) print_char_cursor#31 ← phi( main::@12/(byte*) print_char_cursor#14 ) + (word) last_time#10 ← phi( main::@12/(word) last_time#3 ) + (word) Ticks#10 ← phi( main::@12/(word) Ticks#4 ) + (word) rand_seed#15 ← phi( main::@12/(word) rand_seed#6 ) + (signed word) main::return#3 ← phi( main::@12/(signed word) main::return#0 ) + (signed word) main::return#1 ← (signed word) main::return#3 + (word) rand_seed#7 ← (word) rand_seed#15 + (word) Ticks#5 ← (word) Ticks#10 + (word) last_time#4 ← (word) last_time#10 + (byte*) print_char_cursor#15 ← (byte*) print_char_cursor#31 + (byte*) print_line_cursor#6 ← (byte*) print_line_cursor#14 + return + to:@return +@48: scope:[] from @44 + (byte*) print_line_cursor#19 ← phi( @44/(byte*) print_line_cursor#22 ) + (byte*) print_char_cursor#38 ← phi( @44/(byte*) print_char_cursor#41 ) + (word) last_time#14 ← phi( @44/(word) last_time#17 ) + (word) Ticks#14 ← phi( @44/(word) Ticks#17 ) + (word) rand_seed#22 ← phi( @44/(word) rand_seed#4 ) + call main + (signed word) main::return#2 ← (signed word) main::return#1 + to:@49 +@49: scope:[] from @48 + (byte*) print_line_cursor#15 ← phi( @48/(byte*) print_line_cursor#6 ) + (byte*) print_char_cursor#32 ← phi( @48/(byte*) print_char_cursor#15 ) + (word) last_time#11 ← phi( @48/(word) last_time#4 ) + (word) Ticks#11 ← phi( @48/(word) Ticks#5 ) + (word) rand_seed#16 ← phi( @48/(word) rand_seed#7 ) + (word) rand_seed#8 ← (word) rand_seed#16 + (word) Ticks#6 ← (word) Ticks#11 + (word) last_time#5 ← (word) last_time#11 + (byte*) print_char_cursor#16 ← (byte*) print_char_cursor#32 + (byte*) print_line_cursor#7 ← (byte*) print_line_cursor#15 + to:@end +@end: scope:[] from @49 + +SYMBOL TABLE SSA +(label) @12 +(label) @42 +(label) @44 +(label) @48 +(label) @49 +(label) @begin +(label) @end +(const word) CHARSET = (number) $e800 +(const byte*) CIA2_PORT_A = (byte*)(number) $dd00 +(const byte) PAGE1 = (number) $8a +(const byte) PAGE2 = (number) $9a +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const word) SCREEN1 = (number) $e000 +(const word) SCREEN2 = (number) $e400 +(word) Ticks +(word) Ticks#0 +(word) Ticks#1 +(word) Ticks#10 +(word) Ticks#11 +(word) Ticks#12 +(word) Ticks#13 +(word) Ticks#14 +(word) Ticks#15 +(word) Ticks#16 +(word) Ticks#17 +(word) Ticks#18 +(word) Ticks#19 +(word) Ticks#2 +(word) Ticks#20 +(word) Ticks#21 +(word) Ticks#22 +(word) Ticks#23 +(word) Ticks#3 +(word) Ticks#4 +(word) Ticks#5 +(word) Ticks#6 +(word) Ticks#7 +(word) Ticks#8 +(word) Ticks#9 +(const byte*) VIC_MEMORY = (byte*)(number) $d018 +(const byte*) bittab = { (byte)(number) 1, (byte)(number) 2, (byte)(number) 4, (byte)(number) 8, (byte)(number) $10, (byte)(number) $20, (byte)(number) $40, (byte)(number) $80 } +(void()) doplasma((byte*) doplasma::scrn) +(bool~) doplasma::$0 +(byte~) doplasma::$1 +(bool~) doplasma::$2 +(byte~) doplasma::$3 +(bool~) doplasma::$4 +(bool~) doplasma::$5 +(byte~) doplasma::$6 +(label) doplasma::@1 +(label) doplasma::@13 +(label) doplasma::@14 +(label) doplasma::@16 +(label) doplasma::@17 +(label) doplasma::@18 +(label) doplasma::@2 +(label) doplasma::@3 +(label) doplasma::@7 +(label) doplasma::@8 +(label) doplasma::@9 +(label) doplasma::@return +(byte) doplasma::c1A +(byte) doplasma::c1A#0 +(byte) doplasma::c1A#1 +(byte) doplasma::c1A#2 +(byte) doplasma::c1A#3 +(byte) doplasma::c1A#4 +(byte) doplasma::c1B +(byte) doplasma::c1B#0 +(byte) doplasma::c1B#1 +(byte) doplasma::c1B#2 +(byte) doplasma::c1B#3 +(byte) doplasma::c1B#4 +(byte) doplasma::c1a +(byte) doplasma::c1a#0 +(byte) doplasma::c1a#1 +(byte) doplasma::c1a#2 +(byte) doplasma::c1a#3 +(byte) doplasma::c1a#4 +(byte) doplasma::c1b +(byte) doplasma::c1b#0 +(byte) doplasma::c1b#1 +(byte) doplasma::c1b#2 +(byte) doplasma::c1b#3 +(byte) doplasma::c1b#4 +(byte) doplasma::c2A +(byte) doplasma::c2A#0 +(byte) doplasma::c2A#1 +(byte) doplasma::c2A#2 +(byte) doplasma::c2A#3 +(byte) doplasma::c2A#4 +(byte) doplasma::c2A#5 +(byte) doplasma::c2A#6 +(byte) doplasma::c2A#7 +(byte) doplasma::c2B +(byte) doplasma::c2B#0 +(byte) doplasma::c2B#1 +(byte) doplasma::c2B#2 +(byte) doplasma::c2B#3 +(byte) doplasma::c2B#4 +(byte) doplasma::c2B#5 +(byte) doplasma::c2B#6 +(byte) doplasma::c2B#7 +(byte) doplasma::c2a +(byte) doplasma::c2a#0 +(byte) doplasma::c2a#1 +(byte) doplasma::c2a#2 +(byte) doplasma::c2a#3 +(byte) doplasma::c2a#4 +(byte) doplasma::c2b +(byte) doplasma::c2b#0 +(byte) doplasma::c2b#1 +(byte) doplasma::c2b#2 +(byte) doplasma::c2b#3 +(byte) doplasma::c2b#4 +(byte) doplasma::i +(byte) doplasma::i#0 +(byte) doplasma::i#1 +(byte) doplasma::i#2 +(byte) doplasma::i#3 +(byte) doplasma::i#4 +(byte) doplasma::ii +(byte) doplasma::ii#0 +(byte) doplasma::ii#1 +(byte) doplasma::ii#2 +(byte) doplasma::ii#3 +(byte) doplasma::ii#4 +(byte) doplasma::j +(byte) doplasma::j#0 +(byte) doplasma::j#1 +(byte) doplasma::j#2 +(byte) doplasma::j#3 +(byte) doplasma::j#4 +(byte) doplasma::jj +(byte) doplasma::jj#0 +(byte) doplasma::jj#1 +(byte) doplasma::jj#2 +(byte) doplasma::jj#3 +(byte) doplasma::jj#4 +(byte) doplasma::jj#5 +(byte) doplasma::jj#6 +(byte) doplasma::jj#7 +(byte*) doplasma::scrn +(byte*) doplasma::scrn#0 +(byte*) doplasma::scrn#1 +(byte*) doplasma::scrn#10 +(byte*) doplasma::scrn#11 +(byte*) doplasma::scrn#12 +(byte*) doplasma::scrn#13 +(byte*) doplasma::scrn#14 +(byte*) doplasma::scrn#2 +(byte*) doplasma::scrn#3 +(byte*) doplasma::scrn#4 +(byte*) doplasma::scrn#5 +(byte*) doplasma::scrn#6 +(byte*) doplasma::scrn#7 +(byte*) doplasma::scrn#8 +(byte*) doplasma::scrn#9 +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@3 +(label) end::@return +(word) last_time +(word) last_time#0 +(word) last_time#1 +(word) last_time#10 +(word) last_time#11 +(word) last_time#12 +(word) last_time#13 +(word) last_time#14 +(word) last_time#15 +(word) last_time#16 +(word) last_time#17 +(word) last_time#18 +(word) last_time#19 +(word) last_time#2 +(word) last_time#20 +(word) last_time#21 +(word) last_time#22 +(word) last_time#23 +(word) last_time#3 +(word) last_time#4 +(word) last_time#5 +(word) last_time#6 +(word) last_time#7 +(word) last_time#8 +(word) last_time#9 +(signed word()) main() +(number~) main::$2 +(bool~) main::$6 +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@12 +(label) main::@2 +(label) main::@3 +(label) main::@8 +(label) main::@9 +(label) main::@return +(byte) main::block +(byte) main::block#0 +(byte) main::block#1 +(byte) main::block#2 +(byte) main::block#3 +(byte) main::block#4 +(byte) main::block#5 +(byte) main::block#6 +(word) main::count +(word) main::count#0 +(word) main::count#1 +(word) main::count#2 +(word) main::count#3 +(word) main::count#4 +(word) main::count#5 +(word) main::count#6 +(word) main::count#7 +(signed word) main::return +(signed word) main::return#0 +(signed word) main::return#1 +(signed word) main::return#2 +(signed word) main::return#3 +(byte) main::tmp +(byte) main::tmp#0 +(byte) main::tmp#1 +(byte) main::tmp#2 +(byte) main::v +(byte) main::v#0 +(byte) main::v#1 +(byte) main::v#2 +(byte) main::v#3 +(byte) main::v#4 +(byte) main::v#5 +(byte) main::v#6 +(void()) makechar() +(bool~) makechar::$0 +(byte~) makechar::$1 +(bool~) makechar::$2 +(bool~) makechar::$3 +(byte~) makechar::$4 +(number~) makechar::$5 +(bool~) makechar::$6 +(bool~) makechar::$7 +(word~) makechar::$8 +(word~) makechar::$9 +(label) makechar::@1 +(label) makechar::@10 +(label) makechar::@13 +(label) makechar::@2 +(label) makechar::@21 +(label) makechar::@4 +(label) makechar::@5 +(label) makechar::@6 +(label) makechar::@7 +(label) makechar::@8 +(label) makechar::@9 +(label) makechar::@return +(byte) makechar::b +(byte) makechar::b#0 +(byte) makechar::b#1 +(byte) makechar::b#2 +(byte) makechar::b#3 +(byte) makechar::b#4 +(byte) makechar::b#5 +(byte) makechar::b#6 +(byte) makechar::b#7 +(byte) makechar::b#8 +(word) makechar::c +(word) makechar::c#0 +(word) makechar::c#1 +(word) makechar::c#10 +(word) makechar::c#11 +(word) makechar::c#12 +(word) makechar::c#13 +(word) makechar::c#2 +(word) makechar::c#3 +(word) makechar::c#4 +(word) makechar::c#5 +(word) makechar::c#6 +(word) makechar::c#7 +(word) makechar::c#8 +(word) makechar::c#9 +(byte) makechar::i +(byte) makechar::i#0 +(byte) makechar::i#1 +(byte) makechar::i#10 +(byte) makechar::i#2 +(byte) makechar::i#3 +(byte) makechar::i#4 +(byte) makechar::i#5 +(byte) makechar::i#6 +(byte) makechar::i#7 +(byte) makechar::i#8 +(byte) makechar::i#9 +(byte) makechar::ii +(byte) makechar::ii#0 +(byte) makechar::ii#1 +(byte) makechar::ii#2 +(byte) makechar::ii#3 +(byte) makechar::ii#4 +(byte) makechar::ii#5 +(byte) makechar::ii#6 +(byte) makechar::ii#7 +(byte) makechar::s +(byte) makechar::s#0 +(byte) makechar::s#1 +(byte) makechar::s#2 +(byte) makechar::s#3 +(byte) makechar::s#4 +(byte) makechar::s#5 +(byte) makechar::s#6 +(byte) makechar::s#7 +(byte) makechar::s#8 +(byte) makechar::s#9 +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 +(number~) print_byte::$2 +(label) print_byte::@1 +(label) print_byte::@2 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 +(byte) print_byte::b#1 +(byte) print_byte::b#2 +(byte) print_byte::b#3 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 +(byte) print_char::ch#1 +(byte) print_char::ch#2 +(byte*) print_char_cursor +(byte*) print_char_cursor#0 +(byte*) print_char_cursor#1 +(byte*) print_char_cursor#10 +(byte*) print_char_cursor#11 +(byte*) print_char_cursor#12 +(byte*) print_char_cursor#13 +(byte*) print_char_cursor#14 +(byte*) print_char_cursor#15 +(byte*) print_char_cursor#16 +(byte*) print_char_cursor#17 +(byte*) print_char_cursor#18 +(byte*) print_char_cursor#19 +(byte*) print_char_cursor#2 +(byte*) print_char_cursor#20 +(byte*) print_char_cursor#21 +(byte*) print_char_cursor#22 +(byte*) print_char_cursor#23 +(byte*) print_char_cursor#24 +(byte*) print_char_cursor#25 +(byte*) print_char_cursor#26 +(byte*) print_char_cursor#27 +(byte*) print_char_cursor#28 +(byte*) print_char_cursor#29 +(byte*) print_char_cursor#3 +(byte*) print_char_cursor#30 +(byte*) print_char_cursor#31 +(byte*) print_char_cursor#32 +(byte*) print_char_cursor#33 +(byte*) print_char_cursor#34 +(byte*) print_char_cursor#35 +(byte*) print_char_cursor#36 +(byte*) print_char_cursor#37 +(byte*) print_char_cursor#38 +(byte*) print_char_cursor#39 +(byte*) print_char_cursor#4 +(byte*) print_char_cursor#40 +(byte*) print_char_cursor#41 +(byte*) print_char_cursor#42 +(byte*) print_char_cursor#43 +(byte*) print_char_cursor#44 +(byte*) print_char_cursor#45 +(byte*) print_char_cursor#46 +(byte*) print_char_cursor#47 +(byte*) print_char_cursor#48 +(byte*) print_char_cursor#5 +(byte*) print_char_cursor#6 +(byte*) print_char_cursor#7 +(byte*) print_char_cursor#8 +(byte*) print_char_cursor#9 +(const byte*) print_hextab = (string) "0123456789abcdef"z +(byte*) print_line_cursor +(byte*) print_line_cursor#0 +(byte*) print_line_cursor#1 +(byte*) print_line_cursor#10 +(byte*) print_line_cursor#11 +(byte*) print_line_cursor#12 +(byte*) print_line_cursor#13 +(byte*) print_line_cursor#14 +(byte*) print_line_cursor#15 +(byte*) print_line_cursor#16 +(byte*) print_line_cursor#17 +(byte*) print_line_cursor#18 +(byte*) print_line_cursor#19 +(byte*) print_line_cursor#2 +(byte*) print_line_cursor#20 +(byte*) print_line_cursor#21 +(byte*) print_line_cursor#22 +(byte*) print_line_cursor#23 +(byte*) print_line_cursor#24 +(byte*) print_line_cursor#25 +(byte*) print_line_cursor#26 +(byte*) print_line_cursor#27 +(byte*) print_line_cursor#28 +(byte*) print_line_cursor#29 +(byte*) print_line_cursor#3 +(byte*) print_line_cursor#30 +(byte*) print_line_cursor#4 +(byte*) print_line_cursor#5 +(byte*) print_line_cursor#6 +(byte*) print_line_cursor#7 +(byte*) print_line_cursor#8 +(byte*) print_line_cursor#9 +(void()) print_ln() +(byte*~) print_ln::$0 +(bool~) print_ln::$1 +(label) print_ln::@1 +(label) print_ln::@2 +(label) print_ln::@return +(byte*) print_screen +(byte*) print_screen#0 +(void()) print_word((word) print_word::w) +(byte~) print_word::$0 +(byte~) print_word::$2 +(label) print_word::@1 +(label) print_word::@2 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 +(word) print_word::w#1 +(word) print_word::w#2 +(byte()) rand() +(byte~) rand::$0 +(label) rand::@return +(const word*) rand::RAND_SEED = &(word) rand_seed +(byte) rand::return +(byte) rand::return#0 +(byte) rand::return#1 +(byte) rand::return#2 +(byte) rand::return#3 +(byte) rand::return#4 +(word) rand_seed +(word) rand_seed#0 +(word) rand_seed#1 +(word) rand_seed#10 +(word) rand_seed#11 +(word) rand_seed#12 +(word) rand_seed#13 +(word) rand_seed#14 +(word) rand_seed#15 +(word) rand_seed#16 +(word) rand_seed#17 +(word) rand_seed#18 +(word) rand_seed#19 +(word) rand_seed#2 +(word) rand_seed#20 +(word) rand_seed#21 +(word) rand_seed#22 +(word) rand_seed#23 +(word) rand_seed#24 +(word) rand_seed#25 +(word) rand_seed#26 +(word) rand_seed#27 +(word) rand_seed#28 +(word) rand_seed#29 +(word) rand_seed#3 +(word) rand_seed#30 +(word) rand_seed#31 +(word) rand_seed#32 +(word) rand_seed#33 +(word) rand_seed#34 +(word) rand_seed#35 +(word) rand_seed#36 +(word) rand_seed#37 +(word) rand_seed#38 +(word) rand_seed#39 +(word) rand_seed#4 +(word) rand_seed#5 +(word) rand_seed#6 +(word) rand_seed#7 +(word) rand_seed#8 +(word) rand_seed#9 +(const byte*) sinustable = { (byte)(number) $80, (byte)(number) $7d, (byte)(number) $7a, (byte)(number) $77, (byte)(number) $74, (byte)(number) $70, (byte)(number) $6d, (byte)(number) $6a, (byte)(number) $67, (byte)(number) $64, (byte)(number) $61, (byte)(number) $5e, (byte)(number) $5b, (byte)(number) $58, (byte)(number) $55, (byte)(number) $52, (byte)(number) $4f, (byte)(number) $4d, (byte)(number) $4a, (byte)(number) $47, (byte)(number) $44, (byte)(number) $41, (byte)(number) $3f, (byte)(number) $3c, (byte)(number) $39, (byte)(number) $37, (byte)(number) $34, (byte)(number) $32, (byte)(number) $2f, (byte)(number) $2d, (byte)(number) $2b, (byte)(number) $28, (byte)(number) $26, (byte)(number) $24, (byte)(number) $22, (byte)(number) $20, (byte)(number) $1e, (byte)(number) $1c, (byte)(number) $1a, (byte)(number) $18, (byte)(number) $16, (byte)(number) $15, (byte)(number) $13, (byte)(number) $11, (byte)(number) $10, (byte)(number) $f, (byte)(number) $d, (byte)(number) $c, (byte)(number) $b, (byte)(number) $a, (byte)(number) 8, (byte)(number) 7, (byte)(number) 6, (byte)(number) 6, (byte)(number) 5, (byte)(number) 4, (byte)(number) 3, (byte)(number) 3, (byte)(number) 2, (byte)(number) 2, (byte)(number) 2, (byte)(number) 1, (byte)(number) 1, (byte)(number) 1, (byte)(number) 1, (byte)(number) 1, (byte)(number) 1, (byte)(number) 1, (byte)(number) 2, (byte)(number) 2, (byte)(number) 2, (byte)(number) 3, (byte)(number) 3, (byte)(number) 4, (byte)(number) 5, (byte)(number) 6, (byte)(number) 6, (byte)(number) 7, (byte)(number) 8, (byte)(number) $a, (byte)(number) $b, (byte)(number) $c, (byte)(number) $d, (byte)(number) $f, (byte)(number) $10, (byte)(number) $11, (byte)(number) $13, (byte)(number) $15, (byte)(number) $16, (byte)(number) $18, (byte)(number) $1a, (byte)(number) $1c, (byte)(number) $1e, (byte)(number) $20, (byte)(number) $22, (byte)(number) $24, (byte)(number) $26, (byte)(number) $28, (byte)(number) $2b, (byte)(number) $2d, (byte)(number) $2f, (byte)(number) $32, (byte)(number) $34, (byte)(number) $37, (byte)(number) $39, (byte)(number) $3c, (byte)(number) $3f, (byte)(number) $41, (byte)(number) $44, (byte)(number) $47, (byte)(number) $4a, (byte)(number) $4d, (byte)(number) $4f, (byte)(number) $52, (byte)(number) $55, (byte)(number) $58, (byte)(number) $5b, (byte)(number) $5e, (byte)(number) $61, (byte)(number) $64, (byte)(number) $67, (byte)(number) $6a, (byte)(number) $6d, (byte)(number) $70, (byte)(number) $74, (byte)(number) $77, (byte)(number) $7a, (byte)(number) $7d, (byte)(number) $80, (byte)(number) $83, (byte)(number) $86, (byte)(number) $89, (byte)(number) $8c, (byte)(number) $90, (byte)(number) $93, (byte)(number) $96, (byte)(number) $99, (byte)(number) $9c, (byte)(number) $9f, (byte)(number) $a2, (byte)(number) $a5, (byte)(number) $a8, (byte)(number) $ab, (byte)(number) $ae, (byte)(number) $b1, (byte)(number) $b3, (byte)(number) $b6, (byte)(number) $b9, (byte)(number) $bc, (byte)(number) $bf, (byte)(number) $c1, (byte)(number) $c4, (byte)(number) $c7, (byte)(number) $c9, (byte)(number) $cc, (byte)(number) $ce, (byte)(number) $d1, (byte)(number) $d3, (byte)(number) $d5, (byte)(number) $d8, (byte)(number) $da, (byte)(number) $dc, (byte)(number) $de, (byte)(number) $e0, (byte)(number) $e2, (byte)(number) $e4, (byte)(number) $e6, (byte)(number) $e8, (byte)(number) $ea, (byte)(number) $eb, (byte)(number) $ed, (byte)(number) $ef, (byte)(number) $f0, (byte)(number) $f1, (byte)(number) $f3, (byte)(number) $f4, (byte)(number) $f5, (byte)(number) $f6, (byte)(number) $f8, (byte)(number) $f9, (byte)(number) $fa, (byte)(number) $fa, (byte)(number) $fb, (byte)(number) $fc, (byte)(number) $fd, (byte)(number) $fd, (byte)(number) $fe, (byte)(number) $fe, (byte)(number) $fe, (byte)(number) $ff, (byte)(number) $ff, (byte)(number) $ff, (byte)(number) $ff, (byte)(number) $ff, (byte)(number) $ff, (byte)(number) $ff, (byte)(number) $fe, (byte)(number) $fe, (byte)(number) $fe, (byte)(number) $fd, (byte)(number) $fd, (byte)(number) $fc, (byte)(number) $fb, (byte)(number) $fa, (byte)(number) $fa, (byte)(number) $f9, (byte)(number) $f8, (byte)(number) $f6, (byte)(number) $f5, (byte)(number) $f4, (byte)(number) $f3, (byte)(number) $f1, (byte)(number) $f0, (byte)(number) $ef, (byte)(number) $ed, (byte)(number) $eb, (byte)(number) $ea, (byte)(number) $e8, (byte)(number) $e6, (byte)(number) $e4, (byte)(number) $e2, (byte)(number) $e0, (byte)(number) $de, (byte)(number) $dc, (byte)(number) $da, (byte)(number) $d8, (byte)(number) $d5, (byte)(number) $d3, (byte)(number) $d1, (byte)(number) $ce, (byte)(number) $cc, (byte)(number) $c9, (byte)(number) $c7, (byte)(number) $c4, (byte)(number) $c1, (byte)(number) $bf, (byte)(number) $bc, (byte)(number) $b9, (byte)(number) $b6, (byte)(number) $b3, (byte)(number) $b1, (byte)(number) $ae, (byte)(number) $ab, (byte)(number) $a8, (byte)(number) $a5, (byte)(number) $a2, (byte)(number) $9f, (byte)(number) $9c, (byte)(number) $99, (byte)(number) $96, (byte)(number) $93, (byte)(number) $90, (byte)(number) $8c, (byte)(number) $89, (byte)(number) $86, (byte)(number) $83 } +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time +(const byte*) xbuf = { fill( $28, 0) } +(const byte*) ybuf = { fill( $19, 0) } + +Adding number conversion cast (unumber) $28 in (byte*~) print_ln::$0 ← (byte*) print_line_cursor#8 + (number) $28 +Adding number conversion cast (unumber) 4 in (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4 +Adding number conversion cast (unumber) $f in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f +Adding number conversion cast (unumber) print_byte::$2 in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (unumber)(number) $f +Adding number conversion cast (unumber) $194a in (word) rand_seed#0 ← (number) $194a +Adding number conversion cast (unumber) 0 in (byte) doplasma::ii#1 ← (number) 0 +Adding number conversion cast (unumber) $19 in (bool~) doplasma::$0 ← (byte) doplasma::ii#3 < (number) $19 +Adding number conversion cast (unumber) 4 in (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (number) 4 +Adding number conversion cast (unumber) 9 in (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (number) 9 +Adding number conversion cast (unumber) 3 in (byte) doplasma::c1A#1 ← (byte) doplasma::c1A#2 + (number) 3 +Adding number conversion cast (unumber) 5 in (byte) doplasma::c1B#1 ← (byte) doplasma::c1B#2 - (number) 5 +Adding number conversion cast (unumber) 0 in (byte) doplasma::i#1 ← (number) 0 +Adding number conversion cast (unumber) $28 in (bool~) doplasma::$2 ← (byte) doplasma::i#3 < (number) $28 +Adding number conversion cast (unumber) 3 in (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (number) 3 +Adding number conversion cast (unumber) 7 in (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (number) 7 +Adding number conversion cast (unumber) 2 in (byte) doplasma::c2A#1 ← (byte) doplasma::c2A#3 + (number) 2 +Adding number conversion cast (unumber) 3 in (byte) doplasma::c2B#1 ← (byte) doplasma::c2B#3 - (number) 3 +Adding number conversion cast (unumber) 0 in (byte) doplasma::jj#1 ← (number) 0 +Adding number conversion cast (unumber) $19 in (bool~) doplasma::$4 ← (byte) doplasma::jj#3 < (number) $19 +Adding number conversion cast (unumber) 0 in (byte) doplasma::j#1 ← (number) 0 +Adding number conversion cast (unumber) $28 in (bool~) doplasma::$5 ← (byte) doplasma::j#3 < (number) $28 +Adding number conversion cast (unumber) $28 in (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#4 + (number) $28 +Adding number conversion cast (unumber) 0 in (word) makechar::c#1 ← (number) 0 +Adding number conversion cast (unumber) $100 in (bool~) makechar::$0 ← (word) makechar::c#3 < (number) $100 +Adding number conversion cast (unumber) 0 in (byte) makechar::i#1 ← (number) 0 +Adding number conversion cast (unumber) 8 in (bool~) makechar::$2 ← (byte) makechar::i#3 < (number) 8 +Adding number conversion cast (unumber) 0 in (byte) makechar::b#1 ← (number) 0 +Adding number conversion cast (unumber) 0 in (byte) makechar::ii#1 ← (number) 0 +Adding number conversion cast (unumber) 8 in (bool~) makechar::$3 ← (byte) makechar::ii#3 < (number) 8 +Adding number conversion cast (unumber) $ff in (number~) makechar::$5 ← (byte~) makechar::$4 & (number) $ff +Adding number conversion cast (unumber) makechar::$5 in (number~) makechar::$5 ← (byte~) makechar::$4 & (unumber)(number) $ff +Adding number conversion cast (unumber) 3 in (word~) makechar::$8 ← (word) makechar::c#6 << (number) 3 +Adding number conversion cast (unumber) $1f4 in (word) main::count#0 ← (number) $1f4 +Adding number conversion cast (unumber) $fc in (number~) main::$2 ← (byte) main::block#1 & (number) $fc +Adding number conversion cast (unumber) main::$2 in (number~) main::$2 ← (byte) main::block#1 & (unumber)(number) $fc +Adding number conversion cast (unumber) 3 in (byte) main::tmp#2 ← (byte) main::tmp#1 | (byte)(const word) SCREEN1>>(number) $e^(number) 3 +Adding number conversion cast (unumber) $e in (byte) main::tmp#2 ← (byte) main::tmp#1 | (byte)(const word) SCREEN1>>(number) $e^(unumber)(number) 3 +Adding number conversion cast (unumber) 0 in (bool~) main::$6 ← (number) 0 != (word) main::count#2 +Adding number conversion cast (snumber) 0 in (signed word) main::return#0 ← (number) 0 +Successful SSA optimization PassNAddNumberTypeConversions +Inlining cast (byte*) print_screen#0 ← (byte*)(number) $400 +Inlining cast (word) rand_seed#0 ← (unumber)(number) $194a +Inlining cast (byte~) rand::$0 ← (byte)(word) rand_seed#12 +Inlining cast (byte) doplasma::ii#1 ← (unumber)(number) 0 +Inlining cast (byte) doplasma::i#1 ← (unumber)(number) 0 +Inlining cast (byte) doplasma::jj#1 ← (unumber)(number) 0 +Inlining cast (byte) doplasma::j#1 ← (unumber)(number) 0 +Inlining cast (word) makechar::c#1 ← (unumber)(number) 0 +Inlining cast (byte~) makechar::$1 ← (byte)(word) makechar::c#4 +Inlining cast (byte) makechar::i#1 ← (unumber)(number) 0 +Inlining cast (byte) makechar::b#1 ← (unumber)(number) 0 +Inlining cast (byte) makechar::ii#1 ← (unumber)(number) 0 +Inlining cast (word) main::count#0 ← (unumber)(number) $1f4 +Inlining cast (signed word) main::return#0 ← (snumber)(number) 0 +Successful SSA optimization Pass2InlineCast +Simplifying constant pointer cast (byte*) 53272 +Simplifying constant pointer cast (byte*) 56576 +Simplifying constant integer cast $80 +Simplifying constant integer cast $7d +Simplifying constant integer cast $7a +Simplifying constant integer cast $77 +Simplifying constant integer cast $74 +Simplifying constant integer cast $70 +Simplifying constant integer cast $6d +Simplifying constant integer cast $6a +Simplifying constant integer cast $67 +Simplifying constant integer cast $64 +Simplifying constant integer cast $61 +Simplifying constant integer cast $5e +Simplifying constant integer cast $5b +Simplifying constant integer cast $58 +Simplifying constant integer cast $55 +Simplifying constant integer cast $52 +Simplifying constant integer cast $4f +Simplifying constant integer cast $4d +Simplifying constant integer cast $4a +Simplifying constant integer cast $47 +Simplifying constant integer cast $44 +Simplifying constant integer cast $41 +Simplifying constant integer cast $3f +Simplifying constant integer cast $3c +Simplifying constant integer cast $39 +Simplifying constant integer cast $37 +Simplifying constant integer cast $34 +Simplifying constant integer cast $32 +Simplifying constant integer cast $2f +Simplifying constant integer cast $2d +Simplifying constant integer cast $2b +Simplifying constant integer cast $28 +Simplifying constant integer cast $26 +Simplifying constant integer cast $24 +Simplifying constant integer cast $22 +Simplifying constant integer cast $20 +Simplifying constant integer cast $1e +Simplifying constant integer cast $1c +Simplifying constant integer cast $1a +Simplifying constant integer cast $18 +Simplifying constant integer cast $16 +Simplifying constant integer cast $15 +Simplifying constant integer cast $13 +Simplifying constant integer cast $11 +Simplifying constant integer cast $10 +Simplifying constant integer cast $f +Simplifying constant integer cast $d +Simplifying constant integer cast $c +Simplifying constant integer cast $b +Simplifying constant integer cast $a +Simplifying constant integer cast 8 +Simplifying constant integer cast 7 +Simplifying constant integer cast 6 +Simplifying constant integer cast 6 +Simplifying constant integer cast 5 +Simplifying constant integer cast 4 +Simplifying constant integer cast 3 +Simplifying constant integer cast 3 +Simplifying constant integer cast 2 +Simplifying constant integer cast 2 +Simplifying constant integer cast 2 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 2 +Simplifying constant integer cast 2 +Simplifying constant integer cast 2 +Simplifying constant integer cast 3 +Simplifying constant integer cast 3 +Simplifying constant integer cast 4 +Simplifying constant integer cast 5 +Simplifying constant integer cast 6 +Simplifying constant integer cast 6 +Simplifying constant integer cast 7 +Simplifying constant integer cast 8 +Simplifying constant integer cast $a +Simplifying constant integer cast $b +Simplifying constant integer cast $c +Simplifying constant integer cast $d +Simplifying constant integer cast $f +Simplifying constant integer cast $10 +Simplifying constant integer cast $11 +Simplifying constant integer cast $13 +Simplifying constant integer cast $15 +Simplifying constant integer cast $16 +Simplifying constant integer cast $18 +Simplifying constant integer cast $1a +Simplifying constant integer cast $1c +Simplifying constant integer cast $1e +Simplifying constant integer cast $20 +Simplifying constant integer cast $22 +Simplifying constant integer cast $24 +Simplifying constant integer cast $26 +Simplifying constant integer cast $28 +Simplifying constant integer cast $2b +Simplifying constant integer cast $2d +Simplifying constant integer cast $2f +Simplifying constant integer cast $32 +Simplifying constant integer cast $34 +Simplifying constant integer cast $37 +Simplifying constant integer cast $39 +Simplifying constant integer cast $3c +Simplifying constant integer cast $3f +Simplifying constant integer cast $41 +Simplifying constant integer cast $44 +Simplifying constant integer cast $47 +Simplifying constant integer cast $4a +Simplifying constant integer cast $4d +Simplifying constant integer cast $4f +Simplifying constant integer cast $52 +Simplifying constant integer cast $55 +Simplifying constant integer cast $58 +Simplifying constant integer cast $5b +Simplifying constant integer cast $5e +Simplifying constant integer cast $61 +Simplifying constant integer cast $64 +Simplifying constant integer cast $67 +Simplifying constant integer cast $6a +Simplifying constant integer cast $6d +Simplifying constant integer cast $70 +Simplifying constant integer cast $74 +Simplifying constant integer cast $77 +Simplifying constant integer cast $7a +Simplifying constant integer cast $7d +Simplifying constant integer cast $80 +Simplifying constant integer cast $83 +Simplifying constant integer cast $86 +Simplifying constant integer cast $89 +Simplifying constant integer cast $8c +Simplifying constant integer cast $90 +Simplifying constant integer cast $93 +Simplifying constant integer cast $96 +Simplifying constant integer cast $99 +Simplifying constant integer cast $9c +Simplifying constant integer cast $9f +Simplifying constant integer cast $a2 +Simplifying constant integer cast $a5 +Simplifying constant integer cast $a8 +Simplifying constant integer cast $ab +Simplifying constant integer cast $ae +Simplifying constant integer cast $b1 +Simplifying constant integer cast $b3 +Simplifying constant integer cast $b6 +Simplifying constant integer cast $b9 +Simplifying constant integer cast $bc +Simplifying constant integer cast $bf +Simplifying constant integer cast $c1 +Simplifying constant integer cast $c4 +Simplifying constant integer cast $c7 +Simplifying constant integer cast $c9 +Simplifying constant integer cast $cc +Simplifying constant integer cast $ce +Simplifying constant integer cast $d1 +Simplifying constant integer cast $d3 +Simplifying constant integer cast $d5 +Simplifying constant integer cast $d8 +Simplifying constant integer cast $da +Simplifying constant integer cast $dc +Simplifying constant integer cast $de +Simplifying constant integer cast $e0 +Simplifying constant integer cast $e2 +Simplifying constant integer cast $e4 +Simplifying constant integer cast $e6 +Simplifying constant integer cast $e8 +Simplifying constant integer cast $ea +Simplifying constant integer cast $eb +Simplifying constant integer cast $ed +Simplifying constant integer cast $ef +Simplifying constant integer cast $f0 +Simplifying constant integer cast $f1 +Simplifying constant integer cast $f3 +Simplifying constant integer cast $f4 +Simplifying constant integer cast $f5 +Simplifying constant integer cast $f6 +Simplifying constant integer cast $f8 +Simplifying constant integer cast $f9 +Simplifying constant integer cast $fa +Simplifying constant integer cast $fa +Simplifying constant integer cast $fb +Simplifying constant integer cast $fc +Simplifying constant integer cast $fd +Simplifying constant integer cast $fd +Simplifying constant integer cast $fe +Simplifying constant integer cast $fe +Simplifying constant integer cast $fe +Simplifying constant integer cast $ff +Simplifying constant integer cast $ff +Simplifying constant integer cast $ff +Simplifying constant integer cast $ff +Simplifying constant integer cast $ff +Simplifying constant integer cast $ff +Simplifying constant integer cast $ff +Simplifying constant integer cast $fe +Simplifying constant integer cast $fe +Simplifying constant integer cast $fe +Simplifying constant integer cast $fd +Simplifying constant integer cast $fd +Simplifying constant integer cast $fc +Simplifying constant integer cast $fb +Simplifying constant integer cast $fa +Simplifying constant integer cast $fa +Simplifying constant integer cast $f9 +Simplifying constant integer cast $f8 +Simplifying constant integer cast $f6 +Simplifying constant integer cast $f5 +Simplifying constant integer cast $f4 +Simplifying constant integer cast $f3 +Simplifying constant integer cast $f1 +Simplifying constant integer cast $f0 +Simplifying constant integer cast $ef +Simplifying constant integer cast $ed +Simplifying constant integer cast $eb +Simplifying constant integer cast $ea +Simplifying constant integer cast $e8 +Simplifying constant integer cast $e6 +Simplifying constant integer cast $e4 +Simplifying constant integer cast $e2 +Simplifying constant integer cast $e0 +Simplifying constant integer cast $de +Simplifying constant integer cast $dc +Simplifying constant integer cast $da +Simplifying constant integer cast $d8 +Simplifying constant integer cast $d5 +Simplifying constant integer cast $d3 +Simplifying constant integer cast $d1 +Simplifying constant integer cast $ce +Simplifying constant integer cast $cc +Simplifying constant integer cast $c9 +Simplifying constant integer cast $c7 +Simplifying constant integer cast $c4 +Simplifying constant integer cast $c1 +Simplifying constant integer cast $bf +Simplifying constant integer cast $bc +Simplifying constant integer cast $b9 +Simplifying constant integer cast $b6 +Simplifying constant integer cast $b3 +Simplifying constant integer cast $b1 +Simplifying constant integer cast $ae +Simplifying constant integer cast $ab +Simplifying constant integer cast $a8 +Simplifying constant integer cast $a5 +Simplifying constant integer cast $a2 +Simplifying constant integer cast $9f +Simplifying constant integer cast $9c +Simplifying constant integer cast $99 +Simplifying constant integer cast $96 +Simplifying constant integer cast $93 +Simplifying constant integer cast $90 +Simplifying constant integer cast $8c +Simplifying constant integer cast $89 +Simplifying constant integer cast $86 +Simplifying constant integer cast $83 +Simplifying constant integer cast 1 +Simplifying constant integer cast 2 +Simplifying constant integer cast 4 +Simplifying constant integer cast 8 +Simplifying constant integer cast $10 +Simplifying constant integer cast $20 +Simplifying constant integer cast $40 +Simplifying constant integer cast $80 +Simplifying constant pointer cast (byte*) 1024 +Simplifying constant integer cast $28 +Simplifying constant integer cast 4 +Simplifying constant integer cast $f +Simplifying constant integer cast $194a +Simplifying constant integer cast 0 +Simplifying constant integer cast $19 +Simplifying constant integer cast 4 +Simplifying constant integer cast 9 +Simplifying constant integer cast 3 +Simplifying constant integer cast 5 +Simplifying constant integer cast 0 +Simplifying constant integer cast $28 +Simplifying constant integer cast 3 +Simplifying constant integer cast 7 +Simplifying constant integer cast 2 +Simplifying constant integer cast 3 +Simplifying constant integer cast 0 +Simplifying constant integer cast $19 +Simplifying constant integer cast 0 +Simplifying constant integer cast $28 +Simplifying constant integer cast $28 +Simplifying constant integer cast 0 +Simplifying constant integer cast $100 +Simplifying constant integer cast 0 +Simplifying constant integer cast 8 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 8 +Simplifying constant integer cast $ff +Simplifying constant integer cast 3 +Simplifying constant integer cast $1f4 +Simplifying constant integer cast $fc +Simplifying constant integer cast $e +Simplifying constant integer cast 3 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) $28 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) $f +Finalized unsigned number type (word) $194a +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $19 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) 9 +Finalized unsigned number type (byte) 3 +Finalized unsigned number type (byte) 5 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $28 +Finalized unsigned number type (byte) 3 +Finalized unsigned number type (byte) 7 +Finalized unsigned number type (byte) 2 +Finalized unsigned number type (byte) 3 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $19 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $28 +Finalized unsigned number type (byte) $28 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (word) $100 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 8 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 8 +Finalized unsigned number type (byte) $ff +Finalized unsigned number type (byte) 3 +Finalized unsigned number type (word) $1f4 +Finalized unsigned number type (byte) $fc +Finalized unsigned number type (byte) $e +Finalized unsigned number type (byte) 3 +Finalized unsigned number type (byte) 0 +Finalized signed number type (signed byte) 0 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Inferred type updated to byte in (unumber~) print_byte::$2 ← (byte) print_byte::b#3 & (byte) $f +Inferred type updated to byte in (unumber~) makechar::$5 ← (byte~) makechar::$4 & (byte) $ff +Inferred type updated to byte in (unumber~) main::$2 ← (byte) main::block#1 & (byte) $fc +Inversing boolean not [180] (bool~) makechar::$7 ← (byte~) makechar::$5 <= (byte) makechar::s#2 from [179] (bool~) makechar::$6 ← (byte~) makechar::$5 > (byte) makechar::s#2 +Successful SSA optimization Pass2UnaryNotSimplification +Alias candidate removed (volatile)(word) last_time#6 = (word) Ticks#1 (word) last_time#7 (word) Ticks#7 +Alias candidate removed (volatile)(word) Ticks#12 = (word) Ticks#2 (word) last_time#1 (word) Ticks#15 (word) last_time#15 (word) last_time#13 (word) Ticks#8 (word) last_time#8 (word) Ticks#3 (word) last_time#2 +Alias (byte*) print_char_cursor#0 = (byte*) print_line_cursor#0 (byte*) print_screen#0 (byte*) print_char_cursor#42 (byte*) print_line_cursor#24 (byte*) print_char_cursor#41 (byte*) print_line_cursor#22 (byte*) print_char_cursor#38 (byte*) print_line_cursor#19 +Alias (byte*) print_line_cursor#1 = (byte*~) print_ln::$0 (byte*) print_line_cursor#9 (byte*) print_char_cursor#1 (byte*) print_line_cursor#10 (byte*) print_char_cursor#18 (byte*) print_line_cursor#2 (byte*) print_char_cursor#2 +Alias (byte) print_byte::b#0 = (byte~) print_word::$0 +Alias (word) print_word::w#1 = (word) print_word::w#2 +Alias (byte*) print_char_cursor#19 = (byte*) print_char_cursor#3 +Alias (byte) print_byte::b#1 = (byte~) print_word::$2 +Alias (byte*) print_char_cursor#20 = (byte*) print_char_cursor#4 (byte*) print_char_cursor#21 (byte*) print_char_cursor#5 +Alias (byte) print_byte::b#2 = (byte) print_byte::b#3 +Alias (byte*) print_char_cursor#22 = (byte*) print_char_cursor#6 +Alias (byte*) print_char_cursor#23 = (byte*) print_char_cursor#7 (byte*) print_char_cursor#24 (byte*) print_char_cursor#8 +Alias (byte*) print_char_cursor#10 = (byte*) print_char_cursor#26 (byte*) print_char_cursor#9 +Alias (word) rand_seed#0 = (word) rand_seed#9 (word) rand_seed#1 +Alias (byte*) print_char_cursor#36 = (byte*) print_char_cursor#39 +Alias (byte*) print_line_cursor#17 = (byte*) print_line_cursor#20 (byte*) print_line_cursor#23 +Alias (word) rand_seed#10 = (word) rand_seed#2 (word) rand_seed#23 (word) rand_seed#18 (word) rand_seed#11 (word) rand_seed#3 +Alias (byte*) print_char_cursor#11 = (byte*) print_char_cursor#27 +Alias (byte*) print_line_cursor#11 = (byte*) print_line_cursor#3 (byte*) print_line_cursor#12 (byte*) print_line_cursor#4 +Alias (byte*) print_char_cursor#12 = (byte*) print_char_cursor#28 (byte*) print_char_cursor#29 (byte*) print_char_cursor#13 +Alias (word) Ticks#0 = (word) Ticks#17 (word) Ticks#14 +Alias (word) last_time#0 = (word) last_time#17 (word) last_time#14 +Alias (byte) rand::return#0 = (byte~) rand::$0 (byte) rand::return#3 (byte) rand::return#1 +Alias (byte) doplasma::c1a#1 = (byte) doplasma::c1A#0 +Alias (byte) doplasma::c1b#1 = (byte) doplasma::c1B#0 +Alias (byte) doplasma::c1a#3 = (byte) doplasma::c1a#4 +Alias (byte) doplasma::c1b#3 = (byte) doplasma::c1b#4 +Alias (byte) doplasma::ii#3 = (byte) doplasma::ii#4 +Alias (byte) doplasma::c1A#2 = (byte) doplasma::c1A#4 (byte) doplasma::c1A#3 +Alias (byte) doplasma::c1B#2 = (byte) doplasma::c1B#4 (byte) doplasma::c1B#3 +Alias (byte) doplasma::c2A#2 = (byte) doplasma::c2A#6 (byte) doplasma::c2A#4 (byte) doplasma::c2a#1 +Alias (byte) doplasma::c2B#2 = (byte) doplasma::c2B#6 (byte) doplasma::c2B#4 (byte) doplasma::c2b#1 +Alias (byte*) doplasma::scrn#10 = (byte*) doplasma::scrn#14 (byte*) doplasma::scrn#12 +Alias (byte) doplasma::c2a#3 = (byte) doplasma::c2a#4 +Alias (byte) doplasma::c2b#3 = (byte) doplasma::c2b#4 +Alias (byte) doplasma::i#3 = (byte) doplasma::i#4 +Alias (byte) doplasma::c2A#3 = (byte) doplasma::c2A#7 (byte) doplasma::c2A#5 +Alias (byte) doplasma::c2B#3 = (byte) doplasma::c2B#7 (byte) doplasma::c2B#5 +Alias (byte*) doplasma::scrn#11 = (byte*) doplasma::scrn#9 (byte*) doplasma::scrn#8 +Alias (byte) doplasma::jj#3 = (byte) doplasma::jj#7 +Alias (byte*) doplasma::scrn#6 = (byte*) doplasma::scrn#7 +Alias (byte) doplasma::j#3 = (byte) doplasma::j#4 +Alias (byte) doplasma::jj#4 = (byte) doplasma::jj#6 (byte) doplasma::jj#5 +Alias (byte*) doplasma::scrn#3 = (byte*) doplasma::scrn#5 (byte*) doplasma::scrn#4 +Alias (word) makechar::c#3 = (word) makechar::c#4 +Alias (word) rand_seed#34 = (word) rand_seed#37 +Alias (word) makechar::c#10 = (word) makechar::c#7 (word) makechar::c#5 +Alias (byte) makechar::i#3 = (byte) makechar::i#7 +Alias (word) rand_seed#27 = (word) rand_seed#30 (word) rand_seed#39 +Alias (byte) makechar::s#6 = (byte) makechar::s#7 +Alias (word) rand_seed#19 = (word) rand_seed#24 (word) rand_seed#32 (word) rand_seed#35 (word) rand_seed#31 +Alias (byte) makechar::s#2 = (byte) makechar::s#3 (byte) makechar::s#4 (byte) makechar::s#9 (byte) makechar::s#8 +Alias (byte) makechar::ii#3 = (byte) makechar::ii#7 (byte) makechar::ii#6 (byte) makechar::ii#5 +Alias (byte) makechar::b#3 = (byte) makechar::b#8 (byte) makechar::b#5 (byte) makechar::b#6 (byte) makechar::b#4 +Alias (word) makechar::c#11 = (word) makechar::c#13 (word) makechar::c#8 (word) makechar::c#12 (word) makechar::c#6 +Alias (byte) makechar::i#10 = (byte) makechar::i#5 (byte) makechar::i#9 (byte) makechar::i#4 (byte) makechar::i#8 +Alias (byte) rand::return#2 = (byte) rand::return#4 +Alias (word) main::count#0 = (word) main::count#6 (word) main::count#4 +Alias (word) last_time#19 = (word) last_time#20 (word) last_time#22 +Alias (word) Ticks#19 = (word) Ticks#20 (word) Ticks#22 +Alias (byte*) print_char_cursor#44 = (byte*) print_char_cursor#45 (byte*) print_char_cursor#47 +Alias (byte*) print_line_cursor#26 = (byte*) print_line_cursor#27 (byte*) print_line_cursor#29 +Alias (word) rand_seed#13 = (word) rand_seed#5 (word) rand_seed#29 +Alias (byte) main::tmp#1 = (byte~) main::$2 +Alias (word) main::count#2 = (word) main::count#7 (word) main::count#5 (word) main::count#3 +Alias (byte) main::v#2 = (byte) main::v#6 (byte) main::v#3 (byte) main::v#5 (byte) main::v#4 +Alias (byte) main::block#2 = (byte) main::block#6 (byte) main::block#3 (byte) main::block#5 (byte) main::block#4 +Alias (word) last_time#12 = (word) last_time#23 (word) last_time#16 (word) last_time#21 (word) last_time#18 +Alias (word) Ticks#13 = (word) Ticks#23 (word) Ticks#16 (word) Ticks#21 (word) Ticks#18 +Alias (word) rand_seed#21 = (word) rand_seed#36 (word) rand_seed#25 (word) rand_seed#33 (word) rand_seed#28 +Alias (byte*) print_char_cursor#37 = (byte*) print_char_cursor#48 (byte*) print_char_cursor#40 (byte*) print_char_cursor#46 (byte*) print_char_cursor#43 +Alias (byte*) print_line_cursor#18 = (byte*) print_line_cursor#30 (byte*) print_line_cursor#21 (byte*) print_line_cursor#28 (byte*) print_line_cursor#25 +Alias (word) Ticks#10 = (word) Ticks#4 (word) Ticks#9 (word) Ticks#5 +Alias (word) rand_seed#14 = (word) rand_seed#6 (word) rand_seed#15 (word) rand_seed#7 +Alias (word) last_time#10 = (word) last_time#3 (word) last_time#9 (word) last_time#4 +Alias (byte*) print_char_cursor#14 = (byte*) print_char_cursor#30 (byte*) print_char_cursor#31 (byte*) print_char_cursor#15 +Alias (byte*) print_line_cursor#13 = (byte*) print_line_cursor#5 (byte*) print_line_cursor#14 (byte*) print_line_cursor#6 +Alias (signed word) main::return#0 = (signed word) main::return#3 (signed word) main::return#1 +Alias (word) rand_seed#22 = (word) rand_seed#4 +Alias (word) rand_seed#16 = (word) rand_seed#8 +Alias (word) Ticks#11 = (word) Ticks#6 +Alias (word) last_time#11 = (word) last_time#5 +Alias (byte*) print_char_cursor#16 = (byte*) print_char_cursor#32 +Alias (byte*) print_line_cursor#15 = (byte*) print_line_cursor#7 +Successful SSA optimization Pass2AliasElimination +Alias candidate removed (volatile)(word) last_time#6 = (word) Ticks#1 (word) last_time#7 (word) Ticks#7 +Alias candidate removed (volatile)(word) Ticks#12 = (word) Ticks#2 (word) last_time#1 (word) Ticks#15 (word) last_time#15 (word) last_time#13 (word) Ticks#8 (word) last_time#8 (word) Ticks#3 (word) last_time#2 +Alias (byte) makechar::ii#3 = (byte) makechar::ii#4 +Alias (word) makechar::c#11 = (word) makechar::c#9 +Alias (byte) makechar::i#10 = (byte) makechar::i#6 +Alias (word) rand_seed#19 = (word) rand_seed#26 +Alias (byte) makechar::s#2 = (byte) makechar::s#5 +Successful SSA optimization Pass2AliasElimination +Alias candidate removed (volatile)(word) last_time#6 = (word) Ticks#1 (word) last_time#7 (word) Ticks#7 +Alias candidate removed (volatile)(word) Ticks#12 = (word) Ticks#2 (word) last_time#1 (word) Ticks#15 (word) last_time#15 (word) last_time#13 (word) Ticks#8 (word) last_time#8 (word) Ticks#3 (word) last_time#2 +Identical Phi Values (byte*) print_line_cursor#16 (byte*) print_line_cursor#17 +Identical Phi Values (byte*) print_char_cursor#33 (byte*) print_char_cursor#11 +Identical Phi Values (byte*) print_char_cursor#17 (byte*) print_char_cursor#33 +Identical Phi Values (word) print_word::w#1 (word) print_word::w#0 +Identical Phi Values (byte*) print_char_cursor#34 (byte*) print_char_cursor#36 +Identical Phi Values (byte*) print_char_cursor#19 (byte*) print_char_cursor#23 +Identical Phi Values (byte*) print_char_cursor#20 (byte*) print_char_cursor#23 +Identical Phi Values (byte*) print_char_cursor#22 (byte*) print_char_cursor#10 +Identical Phi Values (byte*) print_char_cursor#23 (byte*) print_char_cursor#10 +Identical Phi Values (word) last_time#6 (word) last_time#12 +Identical Phi Values (word) rand_seed#17 (word) rand_seed#21 +Identical Phi Values (byte*) print_char_cursor#36 (byte*) print_char_cursor#37 +Identical Phi Values (byte*) print_line_cursor#17 (byte*) print_line_cursor#18 +Identical Phi Values (word) rand_seed#10 (word) rand_seed#0 +Identical Phi Values (word) last_time#7 (word) last_time#6 +Identical Phi Values (word) Ticks#7 (word) Ticks#1 +Identical Phi Values (byte*) print_char_cursor#11 (byte*) print_char_cursor#20 +Identical Phi Values (word) Ticks#15 (word) Ticks#2 +Identical Phi Values (word) last_time#15 (word) last_time#1 +Identical Phi Values (byte*) print_line_cursor#11 (byte*) print_line_cursor#1 +Identical Phi Values (byte*) print_char_cursor#12 (byte*) print_line_cursor#1 +Identical Phi Values (word) Ticks#12 (word) Ticks#15 +Identical Phi Values (word) last_time#13 (word) last_time#15 +Identical Phi Values (word) Ticks#8 (word) Ticks#12 +Identical Phi Values (word) last_time#8 (word) last_time#13 +Identical Phi Values (word) rand_seed#12 (word) rand_seed#19 +Identical Phi Values (byte) doplasma::c1A#2 (byte) doplasma::c1a#1 +Identical Phi Values (byte) doplasma::c1B#2 (byte) doplasma::c1b#1 +Identical Phi Values (byte) doplasma::c2A#2 (byte) doplasma::c2A#0 +Identical Phi Values (byte) doplasma::c2B#2 (byte) doplasma::c2B#0 +Identical Phi Values (byte*) doplasma::scrn#10 (byte*) doplasma::scrn#13 +Identical Phi Values (byte) doplasma::c2A#3 (byte) doplasma::c2A#2 +Identical Phi Values (byte) doplasma::c2B#3 (byte) doplasma::c2B#2 +Identical Phi Values (byte*) doplasma::scrn#11 (byte*) doplasma::scrn#10 +Identical Phi Values (byte) doplasma::jj#4 (byte) doplasma::jj#3 +Identical Phi Values (byte*) doplasma::scrn#3 (byte*) doplasma::scrn#6 +Identical Phi Values (word) rand_seed#38 (word) rand_seed#13 +Identical Phi Values (word) makechar::c#11 (word) makechar::c#10 +Identical Phi Values (byte) makechar::i#10 (byte) makechar::i#3 +Identical Phi Values (word) rand_seed#19 (word) rand_seed#27 +Identical Phi Values (byte) makechar::s#2 (byte) makechar::s#6 +Identical Phi Values (word) rand_seed#20 (word) rand_seed#22 +Identical Phi Values (word) last_time#19 (word) last_time#0 +Identical Phi Values (word) Ticks#19 (word) Ticks#0 +Identical Phi Values (byte*) print_char_cursor#44 (byte*) print_char_cursor#0 +Identical Phi Values (byte*) print_line_cursor#26 (byte*) print_char_cursor#0 +Identical Phi Values (word) rand_seed#13 (word) rand_seed#0 +Identical Phi Values (byte) main::v#2 (byte) main::v#1 +Identical Phi Values (byte) main::block#2 (byte) main::block#1 +Identical Phi Values (word) last_time#12 (word) last_time#19 +Identical Phi Values (word) Ticks#13 (word) Ticks#19 +Identical Phi Values (word) rand_seed#21 (word) rand_seed#13 +Identical Phi Values (byte*) print_char_cursor#37 (byte*) print_char_cursor#44 +Identical Phi Values (byte*) print_line_cursor#18 (byte*) print_line_cursor#26 +Identical Phi Values (word) Ticks#10 (word) Ticks#3 +Identical Phi Values (word) rand_seed#14 (word) rand_seed#10 +Identical Phi Values (word) last_time#10 (word) last_time#2 +Identical Phi Values (byte*) print_char_cursor#14 (byte*) print_char_cursor#12 +Identical Phi Values (byte*) print_line_cursor#13 (byte*) print_line_cursor#11 +Identical Phi Values (word) rand_seed#16 (word) rand_seed#14 +Identical Phi Values (word) Ticks#11 (word) Ticks#10 +Identical Phi Values (word) last_time#11 (word) last_time#10 +Identical Phi Values (byte*) print_char_cursor#16 (byte*) print_char_cursor#14 +Identical Phi Values (byte*) print_line_cursor#15 (byte*) print_line_cursor#13 +Successful SSA optimization Pass2IdenticalPhiElimination +Identical Phi Values (word) makechar::c#10 (word) makechar::c#3 +Identical Phi Values (word) rand_seed#27 (word) rand_seed#34 +Identical Phi Values (byte) makechar::s#6 (byte) makechar::s#1 +Successful SSA optimization Pass2IdenticalPhiElimination +Identical Phi Values (word) rand_seed#34 (word) rand_seed#0 +Successful SSA optimization Pass2IdenticalPhiElimination +Simple Condition (bool~) print_ln::$1 [8] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 +Simple Condition (bool~) doplasma::$0 [106] if((byte) doplasma::ii#3<(byte) $19) goto doplasma::@2 +Simple Condition (bool~) doplasma::$2 [121] if((byte) doplasma::i#3<(byte) $28) goto doplasma::@8 +Simple Condition (bool~) doplasma::$4 [134] if((byte) doplasma::jj#3<(byte) $19) goto doplasma::@14 +Simple Condition (bool~) doplasma::$5 [139] if((byte) doplasma::j#3<(byte) $28) goto doplasma::@17 +Simple Condition (bool~) makechar::$0 [157] if((word) makechar::c#3<(word) $100) goto makechar::@2 +Simple Condition (bool~) makechar::$2 [164] if((byte) makechar::i#3<(byte) 8) goto makechar::@5 +Simple Condition (bool~) makechar::$3 [172] if((byte) makechar::ii#3<(byte) 8) goto makechar::@8 +Simple Condition (bool~) makechar::$7 [181] if((byte~) makechar::$5<=(byte) makechar::s#1) goto makechar::@10 +Simple Condition (bool~) main::$6 [210] if((byte) 0!=(word) main::count#2) goto main::@2 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const byte*) print_char_cursor#0 = (byte*) 1024 +Constant (const word) Ticks#0 = 0 +Constant (const byte) doplasma::c1a#0 = 0 +Constant (const byte) doplasma::c1b#0 = 0 +Constant (const byte) doplasma::c2a#0 = 0 +Constant (const byte) doplasma::c2b#0 = 0 +Constant (const byte) doplasma::c1a#1 = 0 +Constant (const byte) doplasma::c1b#1 = 0 +Constant (const byte) doplasma::c2A#0 = 0 +Constant (const byte) doplasma::c2B#0 = 0 +Constant (const byte) doplasma::i#0 = 0 +Constant (const byte) doplasma::ii#0 = 0 +Constant (const byte) doplasma::j#0 = 0 +Constant (const byte) doplasma::jj#0 = 0 +Constant (const byte) doplasma::ii#1 = 0 +Constant (const byte) doplasma::i#1 = 0 +Constant (const byte) doplasma::jj#1 = 0 +Constant (const byte) doplasma::j#1 = 0 +Constant (const byte) makechar::i#0 = 0 +Constant (const byte) makechar::ii#0 = 0 +Constant (const byte) makechar::b#0 = 0 +Constant (const byte) makechar::s#0 = 0 +Constant (const word) makechar::c#0 = 0 +Constant (const word) makechar::c#1 = 0 +Constant (const byte) makechar::i#1 = 0 +Constant (const byte) makechar::b#1 = 0 +Constant (const byte) makechar::ii#1 = 0 +Constant (const byte) main::v#0 = 0 +Constant (const byte) main::block#0 = 0 +Constant (const word) main::count#0 = $1f4 +Constant (const byte) main::tmp#0 = 0 +Constant (const byte*) doplasma::scrn#1 = (byte*)SCREEN1 +Constant (const byte*) doplasma::scrn#2 = (byte*)SCREEN2 +Constant (const signed word) main::return#0 = 0 +Successful SSA optimization Pass2ConstantIdentification +Constant (const signed word) main::return#2 = main::return#0 +Successful SSA optimization Pass2ConstantIdentification +De-inlining pointer[w] to *(pointer+w) [185] *((byte*)(const word) CHARSET + (word~) makechar::$9) ← (byte) makechar::b#3 +Successful SSA optimization Pass2DeInlineWordDerefIdx +Simplifying constant evaluating to zero (byte)(const word) SCREEN1>>(byte) $e^(byte) 3 in [205] (byte) main::tmp#2 ← (byte) main::tmp#1 | (byte)(const word) SCREEN1>>(byte) $e^(byte) 3 +Successful SSA optimization PassNSimplifyConstantZero +Simplifying expression containing zero 3 in [114] (byte) doplasma::c1A#1 ← (const byte) doplasma::c1a#1 + (byte) 3 +Simplifying expression containing zero 5 in [115] (byte) doplasma::c1B#1 ← (const byte) doplasma::c1b#1 - (byte) 5 +Simplifying expression containing zero 2 in [129] (byte) doplasma::c2A#1 ← (const byte) doplasma::c2A#0 + (byte) 2 +Simplifying expression containing zero 3 in [130] (byte) doplasma::c2B#1 ← (const byte) doplasma::c2B#0 - (byte) 3 +Simplifying expression containing zero main::tmp#1 in [205] (byte) main::tmp#2 ← (byte) main::tmp#1 | (byte) 0 +Successful SSA optimization PassNSimplifyExpressionWithZero +Eliminating unused variable (word) Ticks#3 and assignment [32] (word) Ticks#3 ← (word) Ticks#2 +Eliminating unused variable (byte) doplasma::c1A#1 and assignment [47] (byte) doplasma::c1A#1 ← (byte) 3 +Eliminating unused variable (byte) doplasma::c1B#1 and assignment [48] (byte) doplasma::c1B#1 ← (byte) 5 +Eliminating unused variable (byte) doplasma::c2A#1 and assignment [56] (byte) doplasma::c2A#1 ← (byte) 2 +Eliminating unused variable (byte) doplasma::c2B#1 and assignment [57] (byte) doplasma::c2B#1 ← (byte) 3 +Eliminating unused constant (const byte) doplasma::c1a#0 +Eliminating unused constant (const byte) doplasma::c1b#0 +Eliminating unused constant (const byte) doplasma::c2a#0 +Eliminating unused constant (const byte) doplasma::c2b#0 +Eliminating unused constant (const byte) doplasma::i#0 +Eliminating unused constant (const byte) doplasma::ii#0 +Eliminating unused constant (const byte) doplasma::j#0 +Eliminating unused constant (const byte) doplasma::jj#0 +Eliminating unused constant (const byte) makechar::i#0 +Eliminating unused constant (const byte) makechar::ii#0 +Eliminating unused constant (const byte) makechar::b#0 +Eliminating unused constant (const byte) makechar::s#0 +Eliminating unused constant (const word) makechar::c#0 +Eliminating unused constant (const byte) main::v#0 +Eliminating unused constant (const byte) main::block#0 +Eliminating unused constant (const byte) main::tmp#0 +Eliminating unused constant (const signed word) main::return#2 +Eliminating unused constant (const word) Ticks#0 +Successful SSA optimization PassNEliminateUnusedVars +Eliminating unused constant (const signed word) main::return#0 +Successful SSA optimization PassNEliminateUnusedVars +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Alias (byte) main::tmp#1 = (byte) main::tmp#2 +Successful SSA optimization Pass2AliasElimination +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Inlining constant with var siblings (const byte) doplasma::c1a#1 +Inlining constant with var siblings (const byte) doplasma::c1b#1 +Inlining constant with var siblings (const byte) doplasma::ii#1 +Inlining constant with var siblings (const byte) doplasma::i#1 +Inlining constant with var siblings (const byte) doplasma::jj#1 +Inlining constant with var siblings (const byte) doplasma::j#1 +Inlining constant with var siblings (const byte*) doplasma::scrn#1 +Inlining constant with var siblings (const byte*) doplasma::scrn#2 +Inlining constant with var siblings (const word) makechar::c#1 +Inlining constant with var siblings (const byte) makechar::i#1 +Inlining constant with var siblings (const byte) makechar::b#1 +Inlining constant with var siblings (const byte) makechar::ii#1 +Inlining constant with var siblings (const word) main::count#0 +Inlining constant with var siblings (const byte*) print_char_cursor#0 +Constant inlined makechar::c#1 = (byte) 0 +Constant inlined makechar::b#1 = (byte) 0 +Constant inlined doplasma::i#1 = (byte) 0 +Constant inlined makechar::ii#1 = (byte) 0 +Constant inlined doplasma::j#1 = (byte) 0 +Constant inlined doplasma::ii#1 = (byte) 0 +Constant inlined doplasma::jj#1 = (byte) 0 +Constant inlined print_char_cursor#0 = (byte*) 1024 +Constant inlined main::count#0 = (word) $1f4 +Constant inlined doplasma::scrn#2 = (byte*)(const word) SCREEN2 +Constant inlined doplasma::c1a#1 = (byte) 0 +Constant inlined doplasma::scrn#1 = (byte*)(const word) SCREEN1 +Constant inlined doplasma::c1b#1 = (byte) 0 +Constant inlined makechar::i#1 = (byte) 0 +Successful SSA optimization Pass2ConstantInlining +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) +Added new block during phi lifting makechar::@22(between makechar::@21 and makechar::@10) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @12 +Adding NOP phi() at start of @48 +Adding NOP phi() at start of @49 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@8 +Adding NOP phi() at start of main::@12 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of doplasma::@3 +Adding NOP phi() at start of doplasma::@14 +Adding NOP phi() at start of end::@2 +Adding NOP phi() at start of end::@3 +Adding NOP phi() at start of print_ln +Adding NOP phi() at start of print_ln::@2 +Adding NOP phi() at start of print_word::@2 +Adding NOP phi() at start of print_byte::@2 +Adding NOP phi() at start of makechar +Adding NOP phi() at start of makechar::@5 +Adding NOP phi() at start of makechar::@8 +CALL GRAPH +Calls in [] to main:5 +Calls in [main] to start:9 makechar:11 end:20 doplasma:24 doplasma:26 +Calls in [end] to start:68 print_word:72 print_ln:74 +Calls in [print_word] to print_byte:87 print_byte:91 +Calls in [print_byte] to print_char:99 print_char:104 +Calls in [makechar] to rand:134 + +Created 21 initial phi equivalence classes +Coalesced [29] main::count#8 ← main::count#1 +Coalesced [36] doplasma::scrn#16 ← doplasma::scrn#13 +Coalesced [45] doplasma::jj#8 ← doplasma::jj#2 +Coalesced [46] doplasma::scrn#15 ← doplasma::scrn#0 +Coalesced [50] doplasma::j#5 ← doplasma::j#2 +Coalesced [56] doplasma::i#5 ← doplasma::i#2 +Coalesced [57] doplasma::c2a#5 ← doplasma::c2a#2 +Coalesced [58] doplasma::c2b#5 ← doplasma::c2b#2 +Coalesced [64] doplasma::ii#5 ← doplasma::ii#2 +Coalesced [65] doplasma::c1a#5 ← doplasma::c1a#2 +Coalesced [66] doplasma::c1b#5 ← doplasma::c1b#2 +Coalesced [84] print_line_cursor#31 ← print_line_cursor#1 +Coalesced [86] print_byte::b#4 ← print_byte::b#0 +Coalesced [89] print_byte::b#5 ← print_byte::b#1 +Coalesced [90] print_char_cursor#49 ← print_char_cursor#10 +Coalesced [97] print_char::ch#3 ← print_char::ch#0 +Coalesced [98] print_char_cursor#50 ← print_char_cursor#35 +Coalesced [102] print_char::ch#4 ← print_char::ch#1 +Coalesced (already) [103] print_char_cursor#51 ← print_char_cursor#10 +Coalesced [123] makechar::c#14 ← makechar::c#2 +Coalesced [132] makechar::i#11 ← makechar::i#2 +Coalesced [140] makechar::b#10 ← makechar::b#2 +Coalesced [143] makechar::ii#8 ← makechar::ii#2 +Coalesced [144] makechar::b#9 ← makechar::b#7 +Coalesced (already) [145] makechar::b#11 ← makechar::b#3 +Coalesced down to 18 phi equivalence classes +Culled Empty Block (label) @12 +Culled Empty Block (label) @49 +Culled Empty Block (label) main::@12 +Culled Empty Block (label) doplasma::@3 +Culled Empty Block (label) doplasma::@9 +Culled Empty Block (label) doplasma::@14 +Culled Empty Block (label) end::@3 +Culled Empty Block (label) print_ln::@2 +Culled Empty Block (label) print_ln::@3 +Culled Empty Block (label) print_word::@2 +Culled Empty Block (label) print_byte::@2 +Culled Empty Block (label) makechar::@5 +Culled Empty Block (label) makechar::@22 +Renumbering block @42 to @1 +Renumbering block @44 to @2 +Renumbering block @48 to @3 +Renumbering block doplasma::@7 to doplasma::@3 +Renumbering block doplasma::@8 to doplasma::@4 +Renumbering block doplasma::@13 to doplasma::@5 +Renumbering block doplasma::@16 to doplasma::@6 +Renumbering block doplasma::@17 to doplasma::@7 +Renumbering block doplasma::@18 to doplasma::@8 +Renumbering block makechar::@4 to makechar::@3 +Renumbering block makechar::@6 to makechar::@4 +Renumbering block makechar::@7 to makechar::@5 +Renumbering block makechar::@8 to makechar::@6 +Renumbering block makechar::@9 to makechar::@7 +Renumbering block makechar::@10 to makechar::@8 +Renumbering block makechar::@13 to makechar::@9 +Renumbering block makechar::@21 to makechar::@10 +Renumbering block main::@8 to main::@4 +Renumbering block main::@9 to main::@5 +Renumbering block main::@10 to main::@6 +Renumbering block main::@11 to main::@7 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @3 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@4 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of end::@2 +Adding NOP phi() at start of print_ln +Adding NOP phi() at start of makechar +Adding NOP phi() at start of makechar::@6 + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] (word) last_time#0 ← (word) 0 + to:@2 +@2: scope:[] from @1 + [2] (word) rand_seed#22 ← (word) 0 + to:@3 +@3: scope:[] from @2 + [3] phi() + [4] call main + to:@end +@end: scope:[] from @3 + [5] phi() + +(signed word()) main() +main: scope:[main] from @3 + [6] phi() + [7] call start + to:main::@4 +main::@4: scope:[main] from main + [8] phi() + [9] call makechar + to:main::@5 +main::@5: scope:[main] from main::@4 + [10] (byte) main::block#1 ← *((const byte*) CIA2_PORT_A) + [11] (byte) main::tmp#1 ← (byte) main::block#1 & (byte) $fc + [12] *((const byte*) CIA2_PORT_A) ← (byte) main::tmp#1 + [13] (byte) main::v#1 ← *((const byte*) VIC_MEMORY) + to:main::@1 +main::@1: scope:[main] from main::@5 main::@7 + [14] (word) main::count#2 ← phi( main::@7/(word) main::count#1 main::@5/(word) $1f4 ) + [15] if((byte) 0!=(word) main::count#2) goto main::@2 + to:main::@3 +main::@3: scope:[main] from main::@1 + [16] *((const byte*) VIC_MEMORY) ← (byte) main::v#1 + [17] *((const byte*) CIA2_PORT_A) ← (byte) main::block#1 + [18] call end + to:main::@return +main::@return: scope:[main] from main::@3 + [19] return + to:@return +main::@2: scope:[main] from main::@1 + [20] phi() + [21] call doplasma + to:main::@6 +main::@6: scope:[main] from main::@2 + [22] *((const byte*) VIC_MEMORY) ← (const byte) PAGE1 + [23] call doplasma + to:main::@7 +main::@7: scope:[main] from main::@6 + [24] *((const byte*) VIC_MEMORY) ← (const byte) PAGE2 + [25] (word) main::count#1 ← -- (word) main::count#2 + to:main::@1 + +(void()) doplasma((byte*) doplasma::scrn) +doplasma: scope:[doplasma] from main::@2 main::@6 + [26] (byte*) doplasma::scrn#13 ← phi( main::@6/(byte*)(const word) SCREEN2 main::@2/(byte*)(const word) SCREEN1 ) + to:doplasma::@1 +doplasma::@1: scope:[doplasma] from doplasma doplasma::@2 + [27] (byte) doplasma::c1b#3 ← phi( doplasma/(byte) 0 doplasma::@2/(byte) doplasma::c1b#2 ) + [27] (byte) doplasma::c1a#3 ← phi( doplasma/(byte) 0 doplasma::@2/(byte) doplasma::c1a#2 ) + [27] (byte) doplasma::ii#3 ← phi( doplasma/(byte) 0 doplasma::@2/(byte) doplasma::ii#2 ) + [28] if((byte) doplasma::ii#3<(byte) $19) goto doplasma::@2 + to:doplasma::@3 +doplasma::@3: scope:[doplasma] from doplasma::@1 doplasma::@4 + [29] (byte) doplasma::c2b#3 ← phi( doplasma::@1/(const byte) doplasma::c2B#0 doplasma::@4/(byte) doplasma::c2b#2 ) + [29] (byte) doplasma::c2a#3 ← phi( doplasma::@1/(const byte) doplasma::c2A#0 doplasma::@4/(byte) doplasma::c2a#2 ) + [29] (byte) doplasma::i#3 ← phi( doplasma::@1/(byte) 0 doplasma::@4/(byte) doplasma::i#2 ) + [30] if((byte) doplasma::i#3<(byte) $28) goto doplasma::@4 + to:doplasma::@5 +doplasma::@5: scope:[doplasma] from doplasma::@3 doplasma::@8 + [31] (byte*) doplasma::scrn#6 ← phi( doplasma::@8/(byte*) doplasma::scrn#0 doplasma::@3/(byte*) doplasma::scrn#13 ) + [31] (byte) doplasma::jj#3 ← phi( doplasma::@8/(byte) doplasma::jj#2 doplasma::@3/(byte) 0 ) + [32] if((byte) doplasma::jj#3<(byte) $19) goto doplasma::@6 + to:doplasma::@return +doplasma::@return: scope:[doplasma] from doplasma::@5 + [33] return + to:@return +doplasma::@6: scope:[doplasma] from doplasma::@5 doplasma::@7 + [34] (byte) doplasma::j#3 ← phi( doplasma::@5/(byte) 0 doplasma::@7/(byte) doplasma::j#2 ) + [35] if((byte) doplasma::j#3<(byte) $28) goto doplasma::@7 + to:doplasma::@8 +doplasma::@8: scope:[doplasma] from doplasma::@6 + [36] (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#6 + (byte) $28 + [37] (byte) doplasma::jj#2 ← ++ (byte) doplasma::jj#3 + to:doplasma::@5 +doplasma::@7: scope:[doplasma] from doplasma::@6 + [38] (byte~) doplasma::$6 ← *((const byte*) xbuf + (byte) doplasma::j#3) + *((const byte*) ybuf + (byte) doplasma::jj#3) + [39] *((byte*) doplasma::scrn#6 + (byte) doplasma::j#3) ← (byte~) doplasma::$6 + [40] (byte) doplasma::j#2 ← ++ (byte) doplasma::j#3 + to:doplasma::@6 +doplasma::@4: scope:[doplasma] from doplasma::@3 + [41] (byte~) doplasma::$3 ← *((const byte*) sinustable + (byte) doplasma::c2a#3) + *((const byte*) sinustable + (byte) doplasma::c2b#3) + [42] *((const byte*) xbuf + (byte) doplasma::i#3) ← (byte~) doplasma::$3 + [43] (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (byte) 3 + [44] (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (byte) 7 + [45] (byte) doplasma::i#2 ← ++ (byte) doplasma::i#3 + to:doplasma::@3 +doplasma::@2: scope:[doplasma] from doplasma::@1 + [46] (byte~) doplasma::$1 ← *((const byte*) sinustable + (byte) doplasma::c1a#3) + *((const byte*) sinustable + (byte) doplasma::c1b#3) + [47] *((const byte*) ybuf + (byte) doplasma::ii#3) ← (byte~) doplasma::$1 + [48] (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (byte) 4 + [49] (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (byte) 9 + [50] (byte) doplasma::ii#2 ← ++ (byte) doplasma::ii#3 + to:doplasma::@1 + +(void()) end() +end: scope:[end] from main::@3 + [51] (word) Ticks#1 ← (word) last_time#0 + [52] call start + to:end::@1 +end::@1: scope:[end] from end + [53] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 + [54] (word) Ticks#2 ← (word) last_time#1 + [55] (word) print_word::w#0 ← (word) Ticks#2 + [56] call print_word + to:end::@2 +end::@2: scope:[end] from end::@1 + [57] phi() + [58] call print_ln + to:end::@return +end::@return: scope:[end] from end::@2 + [59] (word) last_time#2 ← (word) last_time#1 + [60] return + to:@return + +(void()) print_ln() +print_ln: scope:[print_ln] from end::@2 + [61] phi() + to:print_ln::@1 +print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 + [62] (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) 1024 print_ln::@1/(byte*) print_line_cursor#1 ) + [63] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 + [64] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 + to:print_ln::@return +print_ln::@return: scope:[print_ln] from print_ln::@1 + [65] return + to:@return + +(void()) print_word((word) print_word::w) +print_word: scope:[print_word] from end::@1 + [66] (byte) print_byte::b#0 ← > (word) print_word::w#0 + [67] call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + [68] (byte) print_byte::b#1 ← < (word) print_word::w#0 + [69] call print_byte + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@1 + [70] return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + [71] (byte*) print_char_cursor#35 ← phi( print_word/(byte*) 1024 print_word::@1/(byte*) print_char_cursor#10 ) + [71] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + [72] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 + [73] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) + [74] call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + [75] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f + [76] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) + [77] call print_char + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@1 + [78] return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + [79] (byte*) print_char_cursor#25 ← phi( print_byte/(byte*) print_char_cursor#35 print_byte::@1/(byte*) print_char_cursor#10 ) + [79] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + [80] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 + [81] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + [82] return + to:@return + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + [84] (word) rand_seed#0 ← (word) $194a + to:start::@return +start::@return: scope:[start] from start + [85] return + to:@return + +(void()) makechar() +makechar: scope:[makechar] from main::@4 + [86] phi() + to:makechar::@1 +makechar::@1: scope:[makechar] from makechar makechar::@4 + [87] (word) makechar::c#3 ← phi( makechar/(byte) 0 makechar::@4/(word) makechar::c#2 ) + [88] if((word) makechar::c#3<(word) $100) goto makechar::@2 + to:makechar::@return +makechar::@return: scope:[makechar] from makechar::@1 + [89] return + to:@return +makechar::@2: scope:[makechar] from makechar::@1 + [90] (byte~) makechar::$1 ← (byte)(word) makechar::c#3 + [91] (byte) makechar::s#1 ← *((const byte*) sinustable + (byte~) makechar::$1) + to:makechar::@3 +makechar::@3: scope:[makechar] from makechar::@2 makechar::@7 + [92] (byte) makechar::i#3 ← phi( makechar::@2/(byte) 0 makechar::@7/(byte) makechar::i#2 ) + [93] if((byte) makechar::i#3<(byte) 8) goto makechar::@5 + to:makechar::@4 +makechar::@4: scope:[makechar] from makechar::@3 + [94] (word) makechar::c#2 ← ++ (word) makechar::c#3 + to:makechar::@1 +makechar::@5: scope:[makechar] from makechar::@3 makechar::@8 + [95] (byte) makechar::b#3 ← phi( makechar::@8/(byte) makechar::b#7 makechar::@3/(byte) 0 ) + [95] (byte) makechar::ii#3 ← phi( makechar::@8/(byte) makechar::ii#2 makechar::@3/(byte) 0 ) + [96] if((byte) makechar::ii#3<(byte) 8) goto makechar::@6 + to:makechar::@7 +makechar::@7: scope:[makechar] from makechar::@5 + [97] (word~) makechar::$8 ← (word) makechar::c#3 << (byte) 3 + [98] (word~) makechar::$9 ← (word~) makechar::$8 + (byte) makechar::i#3 + [99] (byte*~) makechar::$10 ← (byte*)(const word) CHARSET + (word~) makechar::$9 + [100] *((byte*~) makechar::$10) ← (byte) makechar::b#3 + [101] (byte) makechar::i#2 ← ++ (byte) makechar::i#3 + to:makechar::@3 +makechar::@6: scope:[makechar] from makechar::@5 + [102] phi() + [103] call rand + [104] (byte) rand::return#2 ← (byte) rand::return#0 + to:makechar::@10 +makechar::@10: scope:[makechar] from makechar::@6 + [105] (byte~) makechar::$4 ← (byte) rand::return#2 + [106] (byte~) makechar::$5 ← (byte~) makechar::$4 & (byte) $ff + [107] if((byte~) makechar::$5<=(byte) makechar::s#1) goto makechar::@8 + to:makechar::@9 +makechar::@9: scope:[makechar] from makechar::@10 + [108] (byte) makechar::b#2 ← (byte) makechar::b#3 | *((const byte*) bittab + (byte) makechar::ii#3) + to:makechar::@8 +makechar::@8: scope:[makechar] from makechar::@10 makechar::@9 + [109] (byte) makechar::b#7 ← phi( makechar::@9/(byte) makechar::b#2 makechar::@10/(byte) makechar::b#3 ) + [110] (byte) makechar::ii#2 ← ++ (byte) makechar::ii#3 + to:makechar::@5 + +(byte()) rand() +rand: scope:[rand] from makechar::@6 + asm { ldx#8 ldaRAND_SEED+0 __rand_loop: asl rolRAND_SEED+1 bcc__no_eor eor#$2D __no_eor: dex bne__rand_loop staRAND_SEED+0 } + [112] (byte) rand::return#0 ← (byte)(word) rand_seed#0 + to:rand::@return +rand::@return: scope:[rand] from rand + [113] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(word) Ticks +(word) Ticks#1 2.0 +(word) Ticks#2 4.0 +(void()) doplasma((byte*) doplasma::scrn) +(byte~) doplasma::$1 202.0 +(byte~) doplasma::$3 202.0 +(byte~) doplasma::$6 2002.0 +(byte) doplasma::c1A +(byte) doplasma::c1B +(byte) doplasma::c1a +(byte) doplasma::c1a#2 67.33333333333333 +(byte) doplasma::c1a#3 75.75 +(byte) doplasma::c1b +(byte) doplasma::c1b#2 101.0 +(byte) doplasma::c1b#3 60.599999999999994 +(byte) doplasma::c2A +(byte) doplasma::c2B +(byte) doplasma::c2a +(byte) doplasma::c2a#2 67.33333333333333 +(byte) doplasma::c2a#3 75.75 +(byte) doplasma::c2b +(byte) doplasma::c2b#2 101.0 +(byte) doplasma::c2b#3 60.599999999999994 +(byte) doplasma::i +(byte) doplasma::i#2 202.0 +(byte) doplasma::i#3 67.33333333333333 +(byte) doplasma::ii +(byte) doplasma::ii#2 202.0 +(byte) doplasma::ii#3 67.33333333333333 +(byte) doplasma::j +(byte) doplasma::j#2 2002.0 +(byte) doplasma::j#3 1251.25 +(byte) doplasma::jj +(byte) doplasma::jj#2 202.0 +(byte) doplasma::jj#3 163.0 +(byte*) doplasma::scrn +(byte*) doplasma::scrn#0 101.0 +(byte*) doplasma::scrn#13 6.733333333333333 +(byte*) doplasma::scrn#6 186.28571428571428 +(void()) end() +(word) last_time +(word) last_time#0 0.2608695652173913 +(word) last_time#1 1.0 +(word) last_time#2 20.0 +(signed word()) main() +(byte) main::block +(byte) main::block#1 0.46153846153846156 +(word) main::count +(word) main::count#1 22.0 +(word) main::count#2 4.714285714285714 +(signed word) main::return +(byte) main::tmp +(byte) main::tmp#1 4.0 +(byte) main::v +(byte) main::v#1 0.4444444444444444 +(void()) makechar() +(byte~) makechar::$1 22.0 +(byte*~) makechar::$10 202.0 +(byte~) makechar::$4 2002.0 +(byte~) makechar::$5 2002.0 +(word~) makechar::$8 202.0 +(word~) makechar::$9 202.0 +(byte) makechar::b +(byte) makechar::b#2 2002.0 +(byte) makechar::b#3 282.1818181818182 +(byte) makechar::b#7 1501.5 +(word) makechar::c +(word) makechar::c#2 22.0 +(word) makechar::c#3 6.090909090909091 +(byte) makechar::i +(byte) makechar::i#2 202.0 +(byte) makechar::i#3 23.764705882352942 +(byte) makechar::ii +(byte) makechar::ii#2 2002.0 +(byte) makechar::ii#3 400.4 +(byte) makechar::s +(byte) makechar::s#1 53.26315789473684 +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 4.0 +(byte~) print_byte::$2 4.0 +(byte) print_byte::b +(byte) print_byte::b#0 4.0 +(byte) print_byte::b#1 4.0 +(byte) print_byte::b#2 2.0 +(void()) print_char((byte) print_char::ch) +(byte) print_char::ch +(byte) print_char::ch#0 4.0 +(byte) print_char::ch#1 4.0 +(byte) print_char::ch#2 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#10 1.0 +(byte*) print_char_cursor#25 4.0 +(byte*) print_char_cursor#35 1.3333333333333333 +(byte*) print_line_cursor +(byte*) print_line_cursor#1 16.5 +(byte*) print_line_cursor#8 22.0 +(void()) print_ln() +(byte*) print_screen +(void()) print_word((word) print_word::w) +(word) print_word::w +(word) print_word::w#0 2.0 +(byte()) rand() +(byte) rand::return +(byte) rand::return#0 334.33333333333337 +(byte) rand::return#2 2002.0 +(word) rand_seed +(word) rand_seed#0 0.06451612903225806 +(word) rand_seed#22 20.0 +(void()) start() + +Initial phi equivalence classes +[ main::count#2 main::count#1 ] +[ doplasma::ii#3 doplasma::ii#2 ] +[ doplasma::c1a#3 doplasma::c1a#2 ] +[ doplasma::c1b#3 doplasma::c1b#2 ] +[ doplasma::i#3 doplasma::i#2 ] +[ doplasma::c2a#3 doplasma::c2a#2 ] +[ doplasma::c2b#3 doplasma::c2b#2 ] +[ doplasma::jj#3 doplasma::jj#2 ] +[ doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] +[ doplasma::j#3 doplasma::j#2 ] +[ print_line_cursor#8 print_line_cursor#1 ] +[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +[ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +[ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +[ makechar::c#3 makechar::c#2 ] +[ makechar::i#3 makechar::i#2 ] +[ makechar::ii#3 makechar::ii#2 ] +[ makechar::b#3 makechar::b#7 makechar::b#2 ] +Coalescing volatile variable equivalence classes [ last_time#0 ] and [ last_time#1 ] +Coalescing volatile variable equivalence classes [ last_time#0 last_time#1 ] and [ last_time#2 ] +Coalescing volatile variable equivalence classes [ rand_seed#0 ] and [ rand_seed#22 ] +Added variable main::block#1 to live range equivalence class [ main::block#1 ] +Added variable main::tmp#1 to live range equivalence class [ main::tmp#1 ] +Added variable main::v#1 to live range equivalence class [ main::v#1 ] +Added variable doplasma::$6 to live range equivalence class [ doplasma::$6 ] +Added variable doplasma::$3 to live range equivalence class [ doplasma::$3 ] +Added variable doplasma::$1 to live range equivalence class [ doplasma::$1 ] +Added variable Ticks#1 to live range equivalence class [ Ticks#1 ] +Added variable Ticks#2 to live range equivalence class [ Ticks#2 ] +Added variable print_word::w#0 to live range equivalence class [ print_word::w#0 ] +Added variable print_byte::$0 to live range equivalence class [ print_byte::$0 ] +Added variable print_byte::$2 to live range equivalence class [ print_byte::$2 ] +Added variable makechar::$1 to live range equivalence class [ makechar::$1 ] +Added variable makechar::s#1 to live range equivalence class [ makechar::s#1 ] +Added variable makechar::$8 to live range equivalence class [ makechar::$8 ] +Added variable makechar::$9 to live range equivalence class [ makechar::$9 ] +Added variable makechar::$10 to live range equivalence class [ makechar::$10 ] +Added variable rand::return#2 to live range equivalence class [ rand::return#2 ] +Added variable makechar::$4 to live range equivalence class [ makechar::$4 ] +Added variable makechar::$5 to live range equivalence class [ makechar::$5 ] +Added variable rand::return#0 to live range equivalence class [ rand::return#0 ] +Complete equivalence classes +[ main::count#2 main::count#1 ] +[ doplasma::ii#3 doplasma::ii#2 ] +[ doplasma::c1a#3 doplasma::c1a#2 ] +[ doplasma::c1b#3 doplasma::c1b#2 ] +[ doplasma::i#3 doplasma::i#2 ] +[ doplasma::c2a#3 doplasma::c2a#2 ] +[ doplasma::c2b#3 doplasma::c2b#2 ] +[ doplasma::jj#3 doplasma::jj#2 ] +[ doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] +[ doplasma::j#3 doplasma::j#2 ] +[ print_line_cursor#8 print_line_cursor#1 ] +[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +[ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +[ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +[ makechar::c#3 makechar::c#2 ] +[ makechar::i#3 makechar::i#2 ] +[ makechar::ii#3 makechar::ii#2 ] +[ makechar::b#3 makechar::b#7 makechar::b#2 ] +[ last_time#0 last_time#1 last_time#2 ] +[ rand_seed#0 rand_seed#22 ] +[ main::block#1 ] +[ main::tmp#1 ] +[ main::v#1 ] +[ doplasma::$6 ] +[ doplasma::$3 ] +[ doplasma::$1 ] +[ Ticks#1 ] +[ Ticks#2 ] +[ print_word::w#0 ] +[ print_byte::$0 ] +[ print_byte::$2 ] +[ makechar::$1 ] +[ makechar::s#1 ] +[ makechar::$8 ] +[ makechar::$9 ] +[ makechar::$10 ] +[ rand::return#2 ] +[ makechar::$4 ] +[ makechar::$5 ] +[ rand::return#0 ] +Allocated zp[2]:2 [ main::count#2 main::count#1 ] +Allocated zp[1]:4 [ doplasma::ii#3 doplasma::ii#2 ] +Allocated zp[1]:5 [ doplasma::c1a#3 doplasma::c1a#2 ] +Allocated zp[1]:6 [ doplasma::c1b#3 doplasma::c1b#2 ] +Allocated zp[1]:7 [ doplasma::i#3 doplasma::i#2 ] +Allocated zp[1]:8 [ doplasma::c2a#3 doplasma::c2a#2 ] +Allocated zp[1]:9 [ doplasma::c2b#3 doplasma::c2b#2 ] +Allocated zp[1]:10 [ doplasma::jj#3 doplasma::jj#2 ] +Allocated zp[2]:11 [ doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] +Allocated zp[1]:13 [ doplasma::j#3 doplasma::j#2 ] +Allocated zp[2]:14 [ print_line_cursor#8 print_line_cursor#1 ] +Allocated zp[1]:16 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Allocated zp[1]:17 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Allocated zp[2]:18 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +Allocated zp[2]:20 [ makechar::c#3 makechar::c#2 ] +Allocated zp[1]:22 [ makechar::i#3 makechar::i#2 ] +Allocated zp[1]:23 [ makechar::ii#3 makechar::ii#2 ] +Allocated zp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] +Allocated zp[2]:25 [ last_time#0 last_time#1 last_time#2 ] +Allocated zp[2]:27 [ rand_seed#0 rand_seed#22 ] +Allocated zp[1]:29 [ main::block#1 ] +Allocated zp[1]:30 [ main::tmp#1 ] +Allocated zp[1]:31 [ main::v#1 ] +Allocated zp[1]:32 [ doplasma::$6 ] +Allocated zp[1]:33 [ doplasma::$3 ] +Allocated zp[1]:34 [ doplasma::$1 ] +Allocated zp[2]:35 [ Ticks#1 ] +Allocated zp[2]:37 [ Ticks#2 ] +Allocated zp[2]:39 [ print_word::w#0 ] +Allocated zp[1]:41 [ print_byte::$0 ] +Allocated zp[1]:42 [ print_byte::$2 ] +Allocated zp[1]:43 [ makechar::$1 ] +Allocated zp[1]:44 [ makechar::s#1 ] +Allocated zp[2]:45 [ makechar::$8 ] +Allocated zp[2]:47 [ makechar::$9 ] +Allocated zp[2]:49 [ makechar::$10 ] +Allocated zp[1]:51 [ rand::return#2 ] +Allocated zp[1]:52 [ makechar::$4 ] +Allocated zp[1]:53 [ makechar::$5 ] +Allocated zp[1]:54 [ rand::return#0 ] + +INITIAL ASM +Target platform is c64basic / MOS6502X + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__bbegin) +.pc = $80d "Program" + // Global Constants & labels + .label VIC_MEMORY = $d018 + // CIA#2 Port A: Serial bus, RS-232, VIC memory bank + .label CIA2_PORT_A = $dd00 + .const SCREEN1 = $e000 + .const SCREEN2 = $e400 + .const CHARSET = $e800 + .const PAGE1 = $8a + // ((SCREEN1 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E); + .const PAGE2 = $9a + .label print_line_cursor = $e + .label print_char_cursor = $12 + .label last_time = $19 + .label rand_seed = $1b + .label Ticks = $23 + .label Ticks_1 = $25 + // @begin +__bbegin: + jmp __b1 + // @1 +__b1: + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + lda #>0 + sta.z last_time+1 + jmp __b2 + // @2 +__b2: + // [2] (word) rand_seed#22 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z rand_seed + lda #>0 + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] +__b3_from___b2: + jmp __b3 + // @3 +__b3: + // [4] call main + // [6] phi from @3 to main [phi:@3->main] +main_from___b3: + jsr main + // [5] phi from @3 to @end [phi:@3->@end] +__bend_from___b3: + jmp __bend + // @end +__bend: + // main +main: { + .label block = $1d + .label tmp = $1e + .label v = $1f + .label count = 2 + // [7] call start + jsr start + // [8] phi from main to main::@4 [phi:main->main::@4] + __b4_from_main: + jmp __b4 + // main::@4 + __b4: + // [9] call makechar + // [86] phi from main::@4 to makechar [phi:main::@4->makechar] + makechar_from___b4: + jsr makechar + jmp __b5 + // main::@5 + __b5: + // [10] (byte) main::block#1 ← *((const byte*) CIA2_PORT_A) -- vbuz1=_deref_pbuc1 + lda CIA2_PORT_A + sta.z block + // [11] (byte) main::tmp#1 ← (byte) main::block#1 & (byte) $fc -- vbuz1=vbuz2_band_vbuc1 + lda #$fc + and.z block + sta.z tmp + // [12] *((const byte*) CIA2_PORT_A) ← (byte) main::tmp#1 -- _deref_pbuc1=vbuz1 + lda.z tmp + sta CIA2_PORT_A + // [13] (byte) main::v#1 ← *((const byte*) VIC_MEMORY) -- vbuz1=_deref_pbuc1 + lda VIC_MEMORY + sta.z v + // [14] phi from main::@5 to main::@1 [phi:main::@5->main::@1] + __b1_from___b5: + // [14] phi (word) main::count#2 = (word) $1f4 [phi:main::@5->main::@1#0] -- vwuz1=vwuc1 + lda #<$1f4 + sta.z count + lda #>$1f4 + sta.z count+1 + jmp __b1 + /* Run the demo until a key was hit */ + // main::@1 + __b1: + // [15] if((byte) 0!=(word) main::count#2) goto main::@2 -- vwuc1_neq_vwuz1_then_la1 + lda.z count+1 + cmp #>0 + bne __b2_from___b1 + lda.z count + cmp #<0 + bne __b2_from___b1 + jmp __b3 + // main::@3 + __b3: + // [16] *((const byte*) VIC_MEMORY) ← (byte) main::v#1 -- _deref_pbuc1=vbuz1 + lda.z v + sta VIC_MEMORY + // [17] *((const byte*) CIA2_PORT_A) ← (byte) main::block#1 -- _deref_pbuc1=vbuz1 + lda.z block + sta CIA2_PORT_A + // [18] call end + jsr end + jmp __breturn + // main::@return + __breturn: + // [19] return + rts + // [20] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + __b2_from___b1: + jmp __b2 + // main::@2 + __b2: + // [21] call doplasma + // [26] phi from main::@2 to doplasma [phi:main::@2->doplasma] + doplasma_from___b2: + // [26] phi (byte*) doplasma::scrn#13 = (byte*)(const word) SCREEN1 [phi:main::@2->doplasma#0] -- pbuz1=pbuc1 + lda #SCREEN1 + sta.z doplasma.scrn+1 + jsr doplasma + jmp __b6 + // main::@6 + __b6: + // [22] *((const byte*) VIC_MEMORY) ← (const byte) PAGE1 -- _deref_pbuc1=vbuc2 + lda #PAGE1 + sta VIC_MEMORY + // [23] call doplasma + // [26] phi from main::@6 to doplasma [phi:main::@6->doplasma] + doplasma_from___b6: + // [26] phi (byte*) doplasma::scrn#13 = (byte*)(const word) SCREEN2 [phi:main::@6->doplasma#0] -- pbuz1=pbuc1 + lda #SCREEN2 + sta.z doplasma.scrn+1 + jsr doplasma + jmp __b7 + // main::@7 + __b7: + // [24] *((const byte*) VIC_MEMORY) ← (const byte) PAGE2 -- _deref_pbuc1=vbuc2 + lda #PAGE2 + sta VIC_MEMORY + // [25] (word) main::count#1 ← -- (word) main::count#2 -- vwuz1=_dec_vwuz1 + lda.z count + bne !+ + dec.z count+1 + !: + dec.z count + // [14] phi from main::@7 to main::@1 [phi:main::@7->main::@1] + __b1_from___b7: + // [14] phi (word) main::count#2 = (word) main::count#1 [phi:main::@7->main::@1#0] -- register_copy + jmp __b1 +} + // doplasma +// doplasma(byte* zeropage($b) scrn) +doplasma: { + .const c2A = 0 + .const c2B = 0 + .label __1 = $22 + .label __3 = $21 + .label __6 = $20 + .label c1a = 5 + .label c1b = 6 + .label ii = 4 + .label c2a = 8 + .label c2b = 9 + .label i = 7 + .label j = $d + .label scrn = $b + .label jj = $a + // [27] phi from doplasma to doplasma::@1 [phi:doplasma->doplasma::@1] + __b1_from_doplasma: + // [27] phi (byte) doplasma::c1b#3 = (byte) 0 [phi:doplasma->doplasma::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z c1b + // [27] phi (byte) doplasma::c1a#3 = (byte) 0 [phi:doplasma->doplasma::@1#1] -- vbuz1=vbuc1 + lda #0 + sta.z c1a + // [27] phi (byte) doplasma::ii#3 = (byte) 0 [phi:doplasma->doplasma::@1#2] -- vbuz1=vbuc1 + lda #0 + sta.z ii + jmp __b1 + // doplasma::@1 + __b1: + // [28] if((byte) doplasma::ii#3<(byte) $19) goto doplasma::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z ii + cmp #$19 + bcc __b2 + // [29] phi from doplasma::@1 to doplasma::@3 [phi:doplasma::@1->doplasma::@3] + __b3_from___b1: + // [29] phi (byte) doplasma::c2b#3 = (const byte) doplasma::c2B#0 [phi:doplasma::@1->doplasma::@3#0] -- vbuz1=vbuc1 + lda #c2B + sta.z c2b + // [29] phi (byte) doplasma::c2a#3 = (const byte) doplasma::c2A#0 [phi:doplasma::@1->doplasma::@3#1] -- vbuz1=vbuc1 + lda #c2A + sta.z c2a + // [29] phi (byte) doplasma::i#3 = (byte) 0 [phi:doplasma::@1->doplasma::@3#2] -- vbuz1=vbuc1 + lda #0 + sta.z i + jmp __b3 + // doplasma::@3 + __b3: + // [30] if((byte) doplasma::i#3<(byte) $28) goto doplasma::@4 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #$28 + bcc __b4 + // [31] phi from doplasma::@3 to doplasma::@5 [phi:doplasma::@3->doplasma::@5] + __b5_from___b3: + // [31] phi (byte*) doplasma::scrn#6 = (byte*) doplasma::scrn#13 [phi:doplasma::@3->doplasma::@5#0] -- register_copy + // [31] phi (byte) doplasma::jj#3 = (byte) 0 [phi:doplasma::@3->doplasma::@5#1] -- vbuz1=vbuc1 + lda #0 + sta.z jj + jmp __b5 + // doplasma::@5 + __b5: + // [32] if((byte) doplasma::jj#3<(byte) $19) goto doplasma::@6 -- vbuz1_lt_vbuc1_then_la1 + lda.z jj + cmp #$19 + bcc __b6_from___b5 + jmp __breturn + // doplasma::@return + __breturn: + // [33] return + rts + // [34] phi from doplasma::@5 to doplasma::@6 [phi:doplasma::@5->doplasma::@6] + __b6_from___b5: + // [34] phi (byte) doplasma::j#3 = (byte) 0 [phi:doplasma::@5->doplasma::@6#0] -- vbuz1=vbuc1 + lda #0 + sta.z j + jmp __b6 + // doplasma::@6 + __b6: + // [35] if((byte) doplasma::j#3<(byte) $28) goto doplasma::@7 -- vbuz1_lt_vbuc1_then_la1 + lda.z j + cmp #$28 + bcc __b7 + jmp __b8 + // doplasma::@8 + __b8: + // [36] (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#6 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z scrn + sta.z scrn + bcc !+ + inc.z scrn+1 + !: + // [37] (byte) doplasma::jj#2 ← ++ (byte) doplasma::jj#3 -- vbuz1=_inc_vbuz1 + inc.z jj + // [31] phi from doplasma::@8 to doplasma::@5 [phi:doplasma::@8->doplasma::@5] + __b5_from___b8: + // [31] phi (byte*) doplasma::scrn#6 = (byte*) doplasma::scrn#0 [phi:doplasma::@8->doplasma::@5#0] -- register_copy + // [31] phi (byte) doplasma::jj#3 = (byte) doplasma::jj#2 [phi:doplasma::@8->doplasma::@5#1] -- register_copy + jmp __b5 + // doplasma::@7 + __b7: + // [38] (byte~) doplasma::$6 ← *((const byte*) xbuf + (byte) doplasma::j#3) + *((const byte*) ybuf + (byte) doplasma::jj#3) -- vbuz1=pbuc1_derefidx_vbuz2_plus_pbuc2_derefidx_vbuz3 + ldy.z j + lda xbuf,y + ldy.z jj + clc + adc ybuf,y + sta.z __6 + // [39] *((byte*) doplasma::scrn#6 + (byte) doplasma::j#3) ← (byte~) doplasma::$6 -- pbuz1_derefidx_vbuz2=vbuz3 + lda.z __6 + ldy.z j + sta (scrn),y + // [40] (byte) doplasma::j#2 ← ++ (byte) doplasma::j#3 -- vbuz1=_inc_vbuz1 + inc.z j + // [34] phi from doplasma::@7 to doplasma::@6 [phi:doplasma::@7->doplasma::@6] + __b6_from___b7: + // [34] phi (byte) doplasma::j#3 = (byte) doplasma::j#2 [phi:doplasma::@7->doplasma::@6#0] -- register_copy + jmp __b6 + // doplasma::@4 + __b4: + // [41] (byte~) doplasma::$3 ← *((const byte*) sinustable + (byte) doplasma::c2a#3) + *((const byte*) sinustable + (byte) doplasma::c2b#3) -- vbuz1=pbuc1_derefidx_vbuz2_plus_pbuc1_derefidx_vbuz3 + ldy.z c2a + lda sinustable,y + ldy.z c2b + clc + adc sinustable,y + sta.z __3 + // [42] *((const byte*) xbuf + (byte) doplasma::i#3) ← (byte~) doplasma::$3 -- pbuc1_derefidx_vbuz1=vbuz2 + lda.z __3 + ldy.z i + sta xbuf,y + // [43] (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (byte) 3 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c2a + axs #-[3] + stx.z c2a + // [44] (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (byte) 7 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c2b + axs #-[7] + stx.z c2b + // [45] (byte) doplasma::i#2 ← ++ (byte) doplasma::i#3 -- vbuz1=_inc_vbuz1 + inc.z i + // [29] phi from doplasma::@4 to doplasma::@3 [phi:doplasma::@4->doplasma::@3] + __b3_from___b4: + // [29] phi (byte) doplasma::c2b#3 = (byte) doplasma::c2b#2 [phi:doplasma::@4->doplasma::@3#0] -- register_copy + // [29] phi (byte) doplasma::c2a#3 = (byte) doplasma::c2a#2 [phi:doplasma::@4->doplasma::@3#1] -- register_copy + // [29] phi (byte) doplasma::i#3 = (byte) doplasma::i#2 [phi:doplasma::@4->doplasma::@3#2] -- register_copy + jmp __b3 + // doplasma::@2 + __b2: + // [46] (byte~) doplasma::$1 ← *((const byte*) sinustable + (byte) doplasma::c1a#3) + *((const byte*) sinustable + (byte) doplasma::c1b#3) -- vbuz1=pbuc1_derefidx_vbuz2_plus_pbuc1_derefidx_vbuz3 + ldy.z c1a + lda sinustable,y + ldy.z c1b + clc + adc sinustable,y + sta.z __1 + // [47] *((const byte*) ybuf + (byte) doplasma::ii#3) ← (byte~) doplasma::$1 -- pbuc1_derefidx_vbuz1=vbuz2 + lda.z __1 + ldy.z ii + sta ybuf,y + // [48] (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (byte) 4 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c1a + axs #-[4] + stx.z c1a + // [49] (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (byte) 9 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c1b + axs #-[9] + stx.z c1b + // [50] (byte) doplasma::ii#2 ← ++ (byte) doplasma::ii#3 -- vbuz1=_inc_vbuz1 + inc.z ii + // [27] phi from doplasma::@2 to doplasma::@1 [phi:doplasma::@2->doplasma::@1] + __b1_from___b2: + // [27] phi (byte) doplasma::c1b#3 = (byte) doplasma::c1b#2 [phi:doplasma::@2->doplasma::@1#0] -- register_copy + // [27] phi (byte) doplasma::c1a#3 = (byte) doplasma::c1a#2 [phi:doplasma::@2->doplasma::@1#1] -- register_copy + // [27] phi (byte) doplasma::ii#3 = (byte) doplasma::ii#2 [phi:doplasma::@2->doplasma::@1#2] -- register_copy + jmp __b1 +} + // end +end: { + // [51] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // [52] call start + jsr start + jmp __b1 + // end::@1 + __b1: + // [53] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // [54] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // [55] (word) print_word::w#0 ← (word) Ticks#2 -- vwuz1=vwuz2 + lda.z Ticks_1 + sta.z print_word.w + lda.z Ticks_1+1 + sta.z print_word.w+1 + // [56] call print_word + jsr print_word + // [57] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + __b2_from___b1: + jmp __b2 + // end::@2 + __b2: + // [58] call print_ln + // [61] phi from end::@2 to print_ln [phi:end::@2->print_ln] + print_ln_from___b2: + jsr print_ln + jmp __breturn + // end::@return + __breturn: + // [59] (word) last_time#2 ← (word) last_time#1 + // [60] return + rts +} + // print_ln +// Print a newline +print_ln: { + // [62] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1] + __b1_from_print_ln: + // [62] phi (byte*) print_line_cursor#8 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + jmp __b1 + // [62] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1] + __b1_from___b1: + // [62] phi (byte*) print_line_cursor#8 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy + jmp __b1 + // print_ln::@1 + __b1: + // [63] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // [64] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1_from___b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1_from___b1 + !: + jmp __breturn + // print_ln::@return + __breturn: + // [65] return + rts +} + // print_word +// Print a word as HEX +// print_word(word zeropage($27) w) +print_word: { + .label w = $27 + // [66] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuz1=_hi_vwuz2 + lda.z w+1 + sta.z print_byte.b + // [67] call print_byte + // [71] phi from print_word to print_byte [phi:print_word->print_byte] + print_byte_from_print_word: + // [71] phi (byte*) print_char_cursor#35 = (byte*) 1024 [phi:print_word->print_byte#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [71] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + jmp __b1 + // print_word::@1 + __b1: + // [68] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuz1=_lo_vwuz2 + lda.z w + sta.z print_byte.b + // [69] call print_byte + // [71] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte] + print_byte_from___b1: + // [71] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#10 [phi:print_word::@1->print_byte#0] -- register_copy + // [71] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + jmp __breturn + // print_word::@return + __breturn: + // [70] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte zeropage($10) b) +print_byte: { + .label __0 = $29 + .label __2 = $2a + .label b = $10 + // [72] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4 + lda.z b + lsr + lsr + lsr + lsr + sta.z __0 + // [73] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy.z __0 + lda print_hextab,y + sta.z print_char.ch + // [74] call print_char + // [79] phi from print_byte to print_char [phi:print_byte->print_char] + print_char_from_print_byte: + // [79] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#35 [phi:print_byte->print_char#0] -- register_copy + // [79] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + jmp __b1 + // print_byte::@1 + __b1: + // [75] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + lda #$f + and.z b + sta.z __2 + // [76] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy.z __2 + lda print_hextab,y + sta.z print_char.ch + // [77] call print_char + // [79] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + print_char_from___b1: + // [79] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#10 [phi:print_byte::@1->print_char#0] -- register_copy + // [79] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + jmp __breturn + // print_byte::@return + __breturn: + // [78] return + rts +} + // print_char +// Print a single char +// print_char(byte zeropage($11) ch) +print_char: { + .label ch = $11 + // [80] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuz2 + lda.z ch + ldy #0 + sta (print_char_cursor),y + // [81] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + jmp __breturn + // print_char::@return + __breturn: + // [82] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // [84] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + jmp __breturn + // start::@return + __breturn: + // [85] return + rts +} + // makechar +makechar: { + .label __1 = $2b + .label __4 = $34 + .label __5 = $35 + .label __8 = $2d + .label __9 = $2f + .label s = $2c + .label c = $14 + .label i = $16 + .label ii = $17 + .label b = $18 + .label __10 = $31 + // [87] phi from makechar to makechar::@1 [phi:makechar->makechar::@1] + __b1_from_makechar: + // [87] phi (word) makechar::c#3 = (byte) 0 [phi:makechar->makechar::@1#0] -- vwuz1=vbuc1 + lda #<0 + sta.z c + lda #>0 + sta.z c+1 + jmp __b1 + // makechar::@1 + __b1: + // [88] if((word) makechar::c#3<(word) $100) goto makechar::@2 -- vwuz1_lt_vwuc1_then_la1 + lda.z c+1 + cmp #>$100 + bcc __b2 + bne !+ + lda.z c + cmp #<$100 + bcc __b2 + !: + jmp __breturn + // makechar::@return + __breturn: + // [89] return + rts + // makechar::@2 + __b2: + // [90] (byte~) makechar::$1 ← (byte)(word) makechar::c#3 -- vbuz1=_byte_vwuz2 + lda.z c + sta.z __1 + // [91] (byte) makechar::s#1 ← *((const byte*) sinustable + (byte~) makechar::$1) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy.z __1 + lda sinustable,y + sta.z s + // [92] phi from makechar::@2 to makechar::@3 [phi:makechar::@2->makechar::@3] + __b3_from___b2: + // [92] phi (byte) makechar::i#3 = (byte) 0 [phi:makechar::@2->makechar::@3#0] -- vbuz1=vbuc1 + lda #0 + sta.z i + jmp __b3 + // makechar::@3 + __b3: + // [93] if((byte) makechar::i#3<(byte) 8) goto makechar::@5 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #8 + bcc __b5_from___b3 + jmp __b4 + // makechar::@4 + __b4: + // [94] (word) makechar::c#2 ← ++ (word) makechar::c#3 -- vwuz1=_inc_vwuz1 + inc.z c + bne !+ + inc.z c+1 + !: + // [87] phi from makechar::@4 to makechar::@1 [phi:makechar::@4->makechar::@1] + __b1_from___b4: + // [87] phi (word) makechar::c#3 = (word) makechar::c#2 [phi:makechar::@4->makechar::@1#0] -- register_copy + jmp __b1 + // [95] phi from makechar::@3 to makechar::@5 [phi:makechar::@3->makechar::@5] + __b5_from___b3: + // [95] phi (byte) makechar::b#3 = (byte) 0 [phi:makechar::@3->makechar::@5#0] -- vbuz1=vbuc1 + lda #0 + sta.z b + // [95] phi (byte) makechar::ii#3 = (byte) 0 [phi:makechar::@3->makechar::@5#1] -- vbuz1=vbuc1 + lda #0 + sta.z ii + jmp __b5 + // makechar::@5 + __b5: + // [96] if((byte) makechar::ii#3<(byte) 8) goto makechar::@6 -- vbuz1_lt_vbuc1_then_la1 + lda.z ii + cmp #8 + bcc __b6_from___b5 + jmp __b7 + // makechar::@7 + __b7: + // [97] (word~) makechar::$8 ← (word) makechar::c#3 << (byte) 3 -- vwuz1=vwuz2_rol_3 + lda.z c + asl + sta.z __8 + lda.z c+1 + rol + sta.z __8+1 + asl.z __8 + rol.z __8+1 + asl.z __8 + rol.z __8+1 + // [98] (word~) makechar::$9 ← (word~) makechar::$8 + (byte) makechar::i#3 -- vwuz1=vwuz2_plus_vbuz3 + lda.z i + clc + adc.z __8 + sta.z __9 + lda #0 + adc.z __8+1 + sta.z __9+1 + // [99] (byte*~) makechar::$10 ← (byte*)(const word) CHARSET + (word~) makechar::$9 -- pbuz1=pbuc1_plus_vwuz2 + lda.z __9 + clc + adc #CHARSET + sta.z __10+1 + // [100] *((byte*~) makechar::$10) ← (byte) makechar::b#3 -- _deref_pbuz1=vbuz2 + lda.z b + ldy #0 + sta (__10),y + // [101] (byte) makechar::i#2 ← ++ (byte) makechar::i#3 -- vbuz1=_inc_vbuz1 + inc.z i + // [92] phi from makechar::@7 to makechar::@3 [phi:makechar::@7->makechar::@3] + __b3_from___b7: + // [92] phi (byte) makechar::i#3 = (byte) makechar::i#2 [phi:makechar::@7->makechar::@3#0] -- register_copy + jmp __b3 + // [102] phi from makechar::@5 to makechar::@6 [phi:makechar::@5->makechar::@6] + __b6_from___b5: + jmp __b6 + // makechar::@6 + __b6: + // [103] call rand + jsr rand + // [104] (byte) rand::return#2 ← (byte) rand::return#0 -- vbuz1=vbuz2 + lda.z rand.return + sta.z rand.return_1 + jmp __b10 + // makechar::@10 + __b10: + // [105] (byte~) makechar::$4 ← (byte) rand::return#2 -- vbuz1=vbuz2 + lda.z rand.return_1 + sta.z __4 + // [106] (byte~) makechar::$5 ← (byte~) makechar::$4 & (byte) $ff -- vbuz1=vbuz2_band_vbuc1 + lda #$ff + and.z __4 + sta.z __5 + // [107] if((byte~) makechar::$5<=(byte) makechar::s#1) goto makechar::@8 -- vbuz1_le_vbuz2_then_la1 + lda.z s + cmp.z __5 + bcs __b8_from___b10 + jmp __b9 + // makechar::@9 + __b9: + // [108] (byte) makechar::b#2 ← (byte) makechar::b#3 | *((const byte*) bittab + (byte) makechar::ii#3) -- vbuz1=vbuz1_bor_pbuc1_derefidx_vbuz2 + lda.z b + ldy.z ii + ora bittab,y + sta.z b + // [109] phi from makechar::@10 makechar::@9 to makechar::@8 [phi:makechar::@10/makechar::@9->makechar::@8] + __b8_from___b10: + __b8_from___b9: + // [109] phi (byte) makechar::b#7 = (byte) makechar::b#3 [phi:makechar::@10/makechar::@9->makechar::@8#0] -- register_copy + jmp __b8 + // makechar::@8 + __b8: + // [110] (byte) makechar::ii#2 ← ++ (byte) makechar::ii#3 -- vbuz1=_inc_vbuz1 + inc.z ii + // [95] phi from makechar::@8 to makechar::@5 [phi:makechar::@8->makechar::@5] + __b5_from___b8: + // [95] phi (byte) makechar::b#3 = (byte) makechar::b#7 [phi:makechar::@8->makechar::@5#0] -- register_copy + // [95] phi (byte) makechar::ii#3 = (byte) makechar::ii#2 [phi:makechar::@8->makechar::@5#1] -- register_copy + jmp __b5 +} + // rand +rand: { + .label RAND_SEED = rand_seed + .label return = $36 + .label return_1 = $33 + // asm { ldx#8 ldaRAND_SEED+0 __rand_loop: asl rolRAND_SEED+1 bcc__no_eor eor#$2D __no_eor: dex bne__rand_loop staRAND_SEED+0 } + ldx #8 + lda RAND_SEED+0 + __rand_loop: + asl + rol RAND_SEED+1 + bcc __no_eor + eor #$2d + __no_eor: + dex + bne __rand_loop + sta RAND_SEED+0 + // [112] (byte) rand::return#0 ← (byte)(word) rand_seed#0 -- vbuz1=_byte_vwuz2 + lda.z rand_seed + sta.z return + jmp __breturn + // rand::@return + __breturn: + // [113] return + rts +} + // File Data + print_hextab: .text "0123456789abcdef" + // ((SCREEN2 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E); + .align $100 + sinustable: .byte $80, $7d, $7a, $77, $74, $70, $6d, $6a, $67, $64, $61, $5e, $5b, $58, $55, $52, $4f, $4d, $4a, $47, $44, $41, $3f, $3c, $39, $37, $34, $32, $2f, $2d, $2b, $28, $26, $24, $22, $20, $1e, $1c, $1a, $18, $16, $15, $13, $11, $10, $f, $d, $c, $b, $a, 8, 7, 6, 6, 5, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 6, 7, 8, $a, $b, $c, $d, $f, $10, $11, $13, $15, $16, $18, $1a, $1c, $1e, $20, $22, $24, $26, $28, $2b, $2d, $2f, $32, $34, $37, $39, $3c, $3f, $41, $44, $47, $4a, $4d, $4f, $52, $55, $58, $5b, $5e, $61, $64, $67, $6a, $6d, $70, $74, $77, $7a, $7d, $80, $83, $86, $89, $8c, $90, $93, $96, $99, $9c, $9f, $a2, $a5, $a8, $ab, $ae, $b1, $b3, $b6, $b9, $bc, $bf, $c1, $c4, $c7, $c9, $cc, $ce, $d1, $d3, $d5, $d8, $da, $dc, $de, $e0, $e2, $e4, $e6, $e8, $ea, $eb, $ed, $ef, $f0, $f1, $f3, $f4, $f5, $f6, $f8, $f9, $fa, $fa, $fb, $fc, $fd, $fd, $fe, $fe, $fe, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $fe, $fe, $fe, $fd, $fd, $fc, $fb, $fa, $fa, $f9, $f8, $f6, $f5, $f4, $f3, $f1, $f0, $ef, $ed, $eb, $ea, $e8, $e6, $e4, $e2, $e0, $de, $dc, $da, $d8, $d5, $d3, $d1, $ce, $cc, $c9, $c7, $c4, $c1, $bf, $bc, $b9, $b6, $b3, $b1, $ae, $ab, $a8, $a5, $a2, $9f, $9c, $99, $96, $93, $90, $8c, $89, $86, $83 + xbuf: .fill $28, 0 + ybuf: .fill $19, 0 + bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [1] (word) last_time#0 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [2] (word) rand_seed#22 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [15] if((byte) 0!=(word) main::count#2) goto main::@2 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ( main:4 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:29 [ main::block#1 ] +Removing always clobbered register reg byte a as potential for zp[1]:31 [ main::v#1 ] +Statement [22] *((const byte*) VIC_MEMORY) ← (const byte) PAGE1 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ( main:4 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ) always clobbers reg byte a +Statement [24] *((const byte*) VIC_MEMORY) ← (const byte) PAGE2 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ( main:4 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ) always clobbers reg byte a +Statement [25] (word) main::count#1 ← -- (word) main::count#2 [ last_time#0 main::block#1 main::v#1 main::count#1 ] ( main:4 [ last_time#0 main::block#1 main::v#1 main::count#1 ] ) always clobbers reg byte a +Statement [36] (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#6 + (byte) $28 [ doplasma::jj#3 doplasma::scrn#0 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::jj#3 doplasma::scrn#0 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::jj#3 doplasma::scrn#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:10 [ doplasma::jj#3 doplasma::jj#2 ] +Statement [38] (byte~) doplasma::$6 ← *((const byte*) xbuf + (byte) doplasma::j#3) + *((const byte*) ybuf + (byte) doplasma::jj#3) [ doplasma::jj#3 doplasma::scrn#6 doplasma::j#3 doplasma::$6 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::jj#3 doplasma::scrn#6 doplasma::j#3 doplasma::$6 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::jj#3 doplasma::scrn#6 doplasma::j#3 doplasma::$6 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:13 [ doplasma::j#3 doplasma::j#2 ] +Statement [41] (byte~) doplasma::$3 ← *((const byte*) sinustable + (byte) doplasma::c2a#3) + *((const byte*) sinustable + (byte) doplasma::c2b#3) [ doplasma::scrn#13 doplasma::i#3 doplasma::c2a#3 doplasma::c2b#3 doplasma::$3 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2a#3 doplasma::c2b#3 doplasma::$3 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2a#3 doplasma::c2b#3 doplasma::$3 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:7 [ doplasma::i#3 doplasma::i#2 ] +Removing always clobbered register reg byte a as potential for zp[1]:8 [ doplasma::c2a#3 doplasma::c2a#2 ] +Removing always clobbered register reg byte a as potential for zp[1]:9 [ doplasma::c2b#3 doplasma::c2b#2 ] +Statement [43] (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (byte) 3 [ doplasma::scrn#13 doplasma::i#3 doplasma::c2b#3 doplasma::c2a#2 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2b#3 doplasma::c2a#2 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2b#3 doplasma::c2a#2 ] ) always clobbers reg byte a +Statement [44] (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (byte) 7 [ doplasma::scrn#13 doplasma::i#3 doplasma::c2a#2 doplasma::c2b#2 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2a#2 doplasma::c2b#2 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2a#2 doplasma::c2b#2 ] ) always clobbers reg byte a +Statement [46] (byte~) doplasma::$1 ← *((const byte*) sinustable + (byte) doplasma::c1a#3) + *((const byte*) sinustable + (byte) doplasma::c1b#3) [ doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#3 doplasma::c1b#3 doplasma::$1 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#3 doplasma::c1b#3 doplasma::$1 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#3 doplasma::c1b#3 doplasma::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:4 [ doplasma::ii#3 doplasma::ii#2 ] +Removing always clobbered register reg byte a as potential for zp[1]:5 [ doplasma::c1a#3 doplasma::c1a#2 ] +Removing always clobbered register reg byte a as potential for zp[1]:6 [ doplasma::c1b#3 doplasma::c1b#2 ] +Statement [48] (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (byte) 4 [ doplasma::scrn#13 doplasma::ii#3 doplasma::c1b#3 doplasma::c1a#2 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1b#3 doplasma::c1a#2 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1b#3 doplasma::c1a#2 ] ) always clobbers reg byte a +Statement [49] (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (byte) 9 [ doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#2 doplasma::c1b#2 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#2 doplasma::c1b#2 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#2 doplasma::c1b#2 ] ) always clobbers reg byte a +Statement [51] (word) Ticks#1 ← (word) last_time#0 [ last_time#0 Ticks#1 ] ( main:4::end:18 [ last_time#0 Ticks#1 ] ) always clobbers reg byte a +Statement [53] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 [ last_time#1 ] ( main:4::end:18 [ last_time#1 ] ) always clobbers reg byte a +Statement [54] (word) Ticks#2 ← (word) last_time#1 [ last_time#1 Ticks#2 ] ( main:4::end:18 [ last_time#1 Ticks#2 ] ) always clobbers reg byte a +Statement [55] (word) print_word::w#0 ← (word) Ticks#2 [ last_time#1 print_word::w#0 ] ( main:4::end:18 [ last_time#1 print_word::w#0 ] ) always clobbers reg byte a +Statement [63] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 [ print_line_cursor#1 print_char_cursor#10 ] ( main:4::end:18::print_ln:58 [ last_time#1 print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a +Statement [64] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#10 ] ( main:4::end:18::print_ln:58 [ last_time#1 print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a +Statement [66] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_word::w#0 print_byte::b#0 ] ( main:4::end:18::print_word:56 [ last_time#1 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a +Statement [68] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#10 print_byte::b#1 ] ( main:4::end:18::print_word:56 [ last_time#1 print_char_cursor#10 print_byte::b#1 ] ) always clobbers reg byte a +Statement [72] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_byte::b#2 print_char_cursor#35 print_byte::$0 ] ( main:4::end:18::print_word:56::print_byte:67 [ last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#35 print_byte::$0 ] main:4::end:18::print_word:56::print_byte:69 [ last_time#1 print_byte::b#2 print_char_cursor#35 print_byte::$0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:16 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Statement [75] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#10 print_byte::$2 ] ( main:4::end:18::print_word:56::print_byte:67 [ last_time#1 print_word::w#0 print_char_cursor#10 print_byte::$2 ] main:4::end:18::print_word:56::print_byte:69 [ last_time#1 print_char_cursor#10 print_byte::$2 ] ) always clobbers reg byte a +Statement [80] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 [ print_char_cursor#25 ] ( main:4::end:18::print_word:56::print_byte:67::print_char:74 [ last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#25 ] main:4::end:18::print_word:56::print_byte:69::print_char:74 [ last_time#1 print_byte::b#2 print_char_cursor#25 ] main:4::end:18::print_word:56::print_byte:67::print_char:77 [ last_time#1 print_word::w#0 print_char_cursor#25 ] main:4::end:18::print_word:56::print_byte:69::print_char:77 [ last_time#1 print_char_cursor#25 ] ) always clobbers reg byte y +Removing always clobbered register reg byte y as potential for zp[1]:16 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Statement asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } always clobbers reg byte a reg byte x reg byte y +Statement [84] (word) rand_seed#0 ← (word) $194a [ rand_seed#0 ] ( main:4::start:7 [ last_time#0 rand_seed#0 ] main:4::end:18::start:52 [ last_time#0 Ticks#1 rand_seed#0 ] ) always clobbers reg byte a +Statement [88] if((word) makechar::c#3<(word) $100) goto makechar::@2 [ rand_seed#0 makechar::c#3 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 ] ) always clobbers reg byte a +Statement [90] (byte~) makechar::$1 ← (byte)(word) makechar::c#3 [ rand_seed#0 makechar::c#3 makechar::$1 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::$1 ] ) always clobbers reg byte a +Statement [97] (word~) makechar::$8 ← (word) makechar::c#3 << (byte) 3 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$8 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$8 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:44 [ makechar::s#1 ] +Removing always clobbered register reg byte a as potential for zp[1]:22 [ makechar::i#3 makechar::i#2 ] +Removing always clobbered register reg byte a as potential for zp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] +Statement [98] (word~) makechar::$9 ← (word~) makechar::$8 + (byte) makechar::i#3 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$9 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$9 ] ) always clobbers reg byte a +Statement [99] (byte*~) makechar::$10 ← (byte*)(const word) CHARSET + (word~) makechar::$9 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$10 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$10 ] ) always clobbers reg byte a +Statement [100] *((byte*~) makechar::$10) ← (byte) makechar::b#3 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp[1]:44 [ makechar::s#1 ] +Removing always clobbered register reg byte y as potential for zp[1]:22 [ makechar::i#3 makechar::i#2 ] +Statement [108] (byte) makechar::b#2 ← (byte) makechar::b#3 | *((const byte*) bittab + (byte) makechar::ii#3) [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::ii#3 makechar::b#2 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::ii#3 makechar::b#2 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:23 [ makechar::ii#3 makechar::ii#2 ] +Statement asm { ldx#8 ldaRAND_SEED+0 __rand_loop: asl rolRAND_SEED+1 bcc__no_eor eor#$2D __no_eor: dex bne__rand_loop staRAND_SEED+0 } always clobbers reg byte a reg byte x +Removing always clobbered register reg byte x as potential for zp[1]:44 [ makechar::s#1 ] +Removing always clobbered register reg byte x as potential for zp[1]:22 [ makechar::i#3 makechar::i#2 ] +Removing always clobbered register reg byte x as potential for zp[1]:23 [ makechar::ii#3 makechar::ii#2 ] +Removing always clobbered register reg byte x as potential for zp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] +Statement [112] (byte) rand::return#0 ← (byte)(word) rand_seed#0 [ rand_seed#0 rand::return#0 ] ( main:4::makechar:9::rand:103 [ last_time#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::ii#3 makechar::b#3 rand_seed#0 rand::return#0 ] ) always clobbers reg byte a +Statement [1] (word) last_time#0 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [2] (word) rand_seed#22 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [11] (byte) main::tmp#1 ← (byte) main::block#1 & (byte) $fc [ last_time#0 main::block#1 main::tmp#1 ] ( main:4 [ last_time#0 main::block#1 main::tmp#1 ] ) always clobbers reg byte a +Statement [15] if((byte) 0!=(word) main::count#2) goto main::@2 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ( main:4 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ) always clobbers reg byte a +Statement [22] *((const byte*) VIC_MEMORY) ← (const byte) PAGE1 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ( main:4 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ) always clobbers reg byte a +Statement [24] *((const byte*) VIC_MEMORY) ← (const byte) PAGE2 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ( main:4 [ last_time#0 main::block#1 main::v#1 main::count#2 ] ) always clobbers reg byte a +Statement [25] (word) main::count#1 ← -- (word) main::count#2 [ last_time#0 main::block#1 main::v#1 main::count#1 ] ( main:4 [ last_time#0 main::block#1 main::v#1 main::count#1 ] ) always clobbers reg byte a +Statement [36] (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#6 + (byte) $28 [ doplasma::jj#3 doplasma::scrn#0 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::jj#3 doplasma::scrn#0 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::jj#3 doplasma::scrn#0 ] ) always clobbers reg byte a +Statement [38] (byte~) doplasma::$6 ← *((const byte*) xbuf + (byte) doplasma::j#3) + *((const byte*) ybuf + (byte) doplasma::jj#3) [ doplasma::jj#3 doplasma::scrn#6 doplasma::j#3 doplasma::$6 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::jj#3 doplasma::scrn#6 doplasma::j#3 doplasma::$6 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::jj#3 doplasma::scrn#6 doplasma::j#3 doplasma::$6 ] ) always clobbers reg byte a +Statement [41] (byte~) doplasma::$3 ← *((const byte*) sinustable + (byte) doplasma::c2a#3) + *((const byte*) sinustable + (byte) doplasma::c2b#3) [ doplasma::scrn#13 doplasma::i#3 doplasma::c2a#3 doplasma::c2b#3 doplasma::$3 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2a#3 doplasma::c2b#3 doplasma::$3 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2a#3 doplasma::c2b#3 doplasma::$3 ] ) always clobbers reg byte a +Statement [43] (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (byte) 3 [ doplasma::scrn#13 doplasma::i#3 doplasma::c2b#3 doplasma::c2a#2 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2b#3 doplasma::c2a#2 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2b#3 doplasma::c2a#2 ] ) always clobbers reg byte a +Statement [44] (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (byte) 7 [ doplasma::scrn#13 doplasma::i#3 doplasma::c2a#2 doplasma::c2b#2 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2a#2 doplasma::c2b#2 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::i#3 doplasma::c2a#2 doplasma::c2b#2 ] ) always clobbers reg byte a +Statement [46] (byte~) doplasma::$1 ← *((const byte*) sinustable + (byte) doplasma::c1a#3) + *((const byte*) sinustable + (byte) doplasma::c1b#3) [ doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#3 doplasma::c1b#3 doplasma::$1 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#3 doplasma::c1b#3 doplasma::$1 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#3 doplasma::c1b#3 doplasma::$1 ] ) always clobbers reg byte a +Statement [48] (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (byte) 4 [ doplasma::scrn#13 doplasma::ii#3 doplasma::c1b#3 doplasma::c1a#2 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1b#3 doplasma::c1a#2 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1b#3 doplasma::c1a#2 ] ) always clobbers reg byte a +Statement [49] (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (byte) 9 [ doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#2 doplasma::c1b#2 ] ( main:4::doplasma:21 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#2 doplasma::c1b#2 ] main:4::doplasma:23 [ last_time#0 main::block#1 main::v#1 main::count#2 doplasma::scrn#13 doplasma::ii#3 doplasma::c1a#2 doplasma::c1b#2 ] ) always clobbers reg byte a +Statement [51] (word) Ticks#1 ← (word) last_time#0 [ last_time#0 Ticks#1 ] ( main:4::end:18 [ last_time#0 Ticks#1 ] ) always clobbers reg byte a +Statement [53] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 [ last_time#1 ] ( main:4::end:18 [ last_time#1 ] ) always clobbers reg byte a +Statement [54] (word) Ticks#2 ← (word) last_time#1 [ last_time#1 Ticks#2 ] ( main:4::end:18 [ last_time#1 Ticks#2 ] ) always clobbers reg byte a +Statement [55] (word) print_word::w#0 ← (word) Ticks#2 [ last_time#1 print_word::w#0 ] ( main:4::end:18 [ last_time#1 print_word::w#0 ] ) always clobbers reg byte a +Statement [63] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 [ print_line_cursor#1 print_char_cursor#10 ] ( main:4::end:18::print_ln:58 [ last_time#1 print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a +Statement [64] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#10 ] ( main:4::end:18::print_ln:58 [ last_time#1 print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a +Statement [66] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_word::w#0 print_byte::b#0 ] ( main:4::end:18::print_word:56 [ last_time#1 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a +Statement [68] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#10 print_byte::b#1 ] ( main:4::end:18::print_word:56 [ last_time#1 print_char_cursor#10 print_byte::b#1 ] ) always clobbers reg byte a +Statement [72] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_byte::b#2 print_char_cursor#35 print_byte::$0 ] ( main:4::end:18::print_word:56::print_byte:67 [ last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#35 print_byte::$0 ] main:4::end:18::print_word:56::print_byte:69 [ last_time#1 print_byte::b#2 print_char_cursor#35 print_byte::$0 ] ) always clobbers reg byte a +Statement [75] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#10 print_byte::$2 ] ( main:4::end:18::print_word:56::print_byte:67 [ last_time#1 print_word::w#0 print_char_cursor#10 print_byte::$2 ] main:4::end:18::print_word:56::print_byte:69 [ last_time#1 print_char_cursor#10 print_byte::$2 ] ) always clobbers reg byte a +Statement [80] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 [ print_char_cursor#25 ] ( main:4::end:18::print_word:56::print_byte:67::print_char:74 [ last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#25 ] main:4::end:18::print_word:56::print_byte:69::print_char:74 [ last_time#1 print_byte::b#2 print_char_cursor#25 ] main:4::end:18::print_word:56::print_byte:67::print_char:77 [ last_time#1 print_word::w#0 print_char_cursor#25 ] main:4::end:18::print_word:56::print_byte:69::print_char:77 [ last_time#1 print_char_cursor#25 ] ) always clobbers reg byte y +Statement asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } always clobbers reg byte a reg byte x reg byte y +Statement [84] (word) rand_seed#0 ← (word) $194a [ rand_seed#0 ] ( main:4::start:7 [ last_time#0 rand_seed#0 ] main:4::end:18::start:52 [ last_time#0 Ticks#1 rand_seed#0 ] ) always clobbers reg byte a +Statement [88] if((word) makechar::c#3<(word) $100) goto makechar::@2 [ rand_seed#0 makechar::c#3 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 ] ) always clobbers reg byte a +Statement [90] (byte~) makechar::$1 ← (byte)(word) makechar::c#3 [ rand_seed#0 makechar::c#3 makechar::$1 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::$1 ] ) always clobbers reg byte a +Statement [91] (byte) makechar::s#1 ← *((const byte*) sinustable + (byte~) makechar::$1) [ rand_seed#0 makechar::c#3 makechar::s#1 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 ] ) always clobbers reg byte a +Statement [93] if((byte) makechar::i#3<(byte) 8) goto makechar::@5 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 ] ) always clobbers reg byte a +Statement [97] (word~) makechar::$8 ← (word) makechar::c#3 << (byte) 3 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$8 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$8 ] ) always clobbers reg byte a +Statement [98] (word~) makechar::$9 ← (word~) makechar::$8 + (byte) makechar::i#3 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$9 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$9 ] ) always clobbers reg byte a +Statement [99] (byte*~) makechar::$10 ← (byte*)(const word) CHARSET + (word~) makechar::$9 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$10 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::b#3 makechar::$10 ] ) always clobbers reg byte a +Statement [100] *((byte*~) makechar::$10) ← (byte) makechar::b#3 [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 ] ) always clobbers reg byte a reg byte y +Statement [108] (byte) makechar::b#2 ← (byte) makechar::b#3 | *((const byte*) bittab + (byte) makechar::ii#3) [ rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::ii#3 makechar::b#2 ] ( main:4::makechar:9 [ last_time#0 rand_seed#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::ii#3 makechar::b#2 ] ) always clobbers reg byte a +Statement asm { ldx#8 ldaRAND_SEED+0 __rand_loop: asl rolRAND_SEED+1 bcc__no_eor eor#$2D __no_eor: dex bne__rand_loop staRAND_SEED+0 } always clobbers reg byte a reg byte x +Statement [112] (byte) rand::return#0 ← (byte)(word) rand_seed#0 [ rand_seed#0 rand::return#0 ] ( main:4::makechar:9::rand:103 [ last_time#0 makechar::c#3 makechar::s#1 makechar::i#3 makechar::ii#3 makechar::b#3 rand_seed#0 rand::return#0 ] ) always clobbers reg byte a +Potential registers zp[2]:2 [ main::count#2 main::count#1 ] : zp[2]:2 , +Potential registers zp[1]:4 [ doplasma::ii#3 doplasma::ii#2 ] : zp[1]:4 , reg byte x , reg byte y , +Potential registers zp[1]:5 [ doplasma::c1a#3 doplasma::c1a#2 ] : zp[1]:5 , reg byte x , reg byte y , +Potential registers zp[1]:6 [ doplasma::c1b#3 doplasma::c1b#2 ] : zp[1]:6 , reg byte x , reg byte y , +Potential registers zp[1]:7 [ doplasma::i#3 doplasma::i#2 ] : zp[1]:7 , reg byte x , reg byte y , +Potential registers zp[1]:8 [ doplasma::c2a#3 doplasma::c2a#2 ] : zp[1]:8 , reg byte x , reg byte y , +Potential registers zp[1]:9 [ doplasma::c2b#3 doplasma::c2b#2 ] : zp[1]:9 , reg byte x , reg byte y , +Potential registers zp[1]:10 [ doplasma::jj#3 doplasma::jj#2 ] : zp[1]:10 , reg byte x , reg byte y , +Potential registers zp[2]:11 [ doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] : zp[2]:11 , +Potential registers zp[1]:13 [ doplasma::j#3 doplasma::j#2 ] : zp[1]:13 , reg byte x , reg byte y , +Potential registers zp[2]:14 [ print_line_cursor#8 print_line_cursor#1 ] : zp[2]:14 , +Potential registers zp[1]:16 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] : zp[1]:16 , reg byte x , +Potential registers zp[1]:17 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:18 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] : zp[2]:18 , +Potential registers zp[2]:20 [ makechar::c#3 makechar::c#2 ] : zp[2]:20 , +Potential registers zp[1]:22 [ makechar::i#3 makechar::i#2 ] : zp[1]:22 , +Potential registers zp[1]:23 [ makechar::ii#3 makechar::ii#2 ] : zp[1]:23 , reg byte y , +Potential registers zp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] : zp[1]:24 , reg byte y , +Potential registers zp[2]:25 [ last_time#0 last_time#1 last_time#2 ] : zp[2]:25 , +Potential registers zp[2]:27 [ rand_seed#0 rand_seed#22 ] : zp[2]:27 , +Potential registers zp[1]:29 [ main::block#1 ] : zp[1]:29 , reg byte x , reg byte y , +Potential registers zp[1]:30 [ main::tmp#1 ] : zp[1]:30 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:31 [ main::v#1 ] : zp[1]:31 , reg byte x , reg byte y , +Potential registers zp[1]:32 [ doplasma::$6 ] : zp[1]:32 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:33 [ doplasma::$3 ] : zp[1]:33 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:34 [ doplasma::$1 ] : zp[1]:34 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:35 [ Ticks#1 ] : zp[2]:35 , +Potential registers zp[2]:37 [ Ticks#2 ] : zp[2]:37 , +Potential registers zp[2]:39 [ print_word::w#0 ] : zp[2]:39 , +Potential registers zp[1]:41 [ print_byte::$0 ] : zp[1]:41 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:42 [ print_byte::$2 ] : zp[1]:42 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:43 [ makechar::$1 ] : zp[1]:43 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:44 [ makechar::s#1 ] : zp[1]:44 , +Potential registers zp[2]:45 [ makechar::$8 ] : zp[2]:45 , +Potential registers zp[2]:47 [ makechar::$9 ] : zp[2]:47 , +Potential registers zp[2]:49 [ makechar::$10 ] : zp[2]:49 , +Potential registers zp[1]:51 [ rand::return#2 ] : zp[1]:51 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:52 [ makechar::$4 ] : zp[1]:52 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:53 [ makechar::$5 ] : zp[1]:53 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:54 [ rand::return#0 ] : zp[1]:54 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [makechar] 3,785.68: zp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] 2,402.4: zp[1]:23 [ makechar::ii#3 makechar::ii#2 ] 2,002: zp[1]:52 [ makechar::$4 ] 2,002: zp[1]:53 [ makechar::$5 ] 225.76: zp[1]:22 [ makechar::i#3 makechar::i#2 ] 202: zp[2]:45 [ makechar::$8 ] 202: zp[2]:47 [ makechar::$9 ] 202: zp[2]:49 [ makechar::$10 ] 53.26: zp[1]:44 [ makechar::s#1 ] 28.09: zp[2]:20 [ makechar::c#3 makechar::c#2 ] 22: zp[1]:43 [ makechar::$1 ] +Uplift Scope [doplasma] 3,253.25: zp[1]:13 [ doplasma::j#3 doplasma::j#2 ] 2,002: zp[1]:32 [ doplasma::$6 ] 365: zp[1]:10 [ doplasma::jj#3 doplasma::jj#2 ] 294.02: zp[2]:11 [ doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] 269.33: zp[1]:4 [ doplasma::ii#3 doplasma::ii#2 ] 269.33: zp[1]:7 [ doplasma::i#3 doplasma::i#2 ] 202: zp[1]:33 [ doplasma::$3 ] 202: zp[1]:34 [ doplasma::$1 ] 161.6: zp[1]:6 [ doplasma::c1b#3 doplasma::c1b#2 ] 161.6: zp[1]:9 [ doplasma::c2b#3 doplasma::c2b#2 ] 143.08: zp[1]:5 [ doplasma::c1a#3 doplasma::c1a#2 ] 143.08: zp[1]:8 [ doplasma::c2a#3 doplasma::c2a#2 ] +Uplift Scope [rand] 2,002: zp[1]:51 [ rand::return#2 ] 334.33: zp[1]:54 [ rand::return#0 ] +Uplift Scope [] 38.5: zp[2]:14 [ print_line_cursor#8 print_line_cursor#1 ] 21.26: zp[2]:25 [ last_time#0 last_time#1 last_time#2 ] 20.06: zp[2]:27 [ rand_seed#0 rand_seed#22 ] 6.33: zp[2]:18 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] 4: zp[2]:37 [ Ticks#2 ] 2: zp[2]:35 [ Ticks#1 ] +Uplift Scope [main] 26.71: zp[2]:2 [ main::count#2 main::count#1 ] 4: zp[1]:30 [ main::tmp#1 ] 0.46: zp[1]:29 [ main::block#1 ] 0.44: zp[1]:31 [ main::v#1 ] +Uplift Scope [print_byte] 10: zp[1]:16 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] 4: zp[1]:41 [ print_byte::$0 ] 4: zp[1]:42 [ print_byte::$2 ] +Uplift Scope [print_char] 14: zp[1]:17 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Uplift Scope [print_word] 2: zp[2]:39 [ print_word::w#0 ] +Uplift Scope [RADIX] +Uplift Scope [print_ln] +Uplift Scope [start] +Uplift Scope [end] + +Uplifting [makechar] best 165875 combination zp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] reg byte y [ makechar::ii#3 makechar::ii#2 ] reg byte a [ makechar::$4 ] zp[1]:53 [ makechar::$5 ] zp[1]:22 [ makechar::i#3 makechar::i#2 ] zp[2]:45 [ makechar::$8 ] zp[2]:47 [ makechar::$9 ] zp[2]:49 [ makechar::$10 ] zp[1]:44 [ makechar::s#1 ] zp[2]:20 [ makechar::c#3 makechar::c#2 ] reg byte a [ makechar::$1 ] +Limited combination testing to 100 combinations of 256 possible. +Uplifting [doplasma] best 140975 combination reg byte y [ doplasma::j#3 doplasma::j#2 ] reg byte a [ doplasma::$6 ] reg byte x [ doplasma::jj#3 doplasma::jj#2 ] zp[2]:11 [ doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] zp[1]:4 [ doplasma::ii#3 doplasma::ii#2 ] zp[1]:7 [ doplasma::i#3 doplasma::i#2 ] zp[1]:33 [ doplasma::$3 ] zp[1]:34 [ doplasma::$1 ] zp[1]:6 [ doplasma::c1b#3 doplasma::c1b#2 ] zp[1]:9 [ doplasma::c2b#3 doplasma::c2b#2 ] zp[1]:5 [ doplasma::c1a#3 doplasma::c1a#2 ] zp[1]:8 [ doplasma::c2a#3 doplasma::c2a#2 ] +Limited combination testing to 100 combinations of 419904 possible. +Uplifting [rand] best 131972 combination reg byte a [ rand::return#2 ] reg byte a [ rand::return#0 ] +Uplifting [] best 131972 combination zp[2]:14 [ print_line_cursor#8 print_line_cursor#1 ] zp[2]:25 [ last_time#0 last_time#1 last_time#2 ] zp[2]:27 [ rand_seed#0 rand_seed#22 ] zp[2]:18 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] zp[2]:37 [ Ticks#2 ] zp[2]:35 [ Ticks#1 ] +Uplifting [main] best 131966 combination zp[2]:2 [ main::count#2 main::count#1 ] reg byte a [ main::tmp#1 ] zp[1]:29 [ main::block#1 ] zp[1]:31 [ main::v#1 ] +Uplifting [print_byte] best 131952 combination reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte x [ print_byte::$2 ] +Uplifting [print_char] best 131943 combination reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Uplifting [print_word] best 131943 combination zp[2]:39 [ print_word::w#0 ] +Uplifting [RADIX] best 131943 combination +Uplifting [print_ln] best 131943 combination +Uplifting [start] best 131943 combination +Uplifting [end] best 131943 combination +Attempting to uplift remaining variables inzp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] +Uplifting [makechar] best 131943 combination zp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] +Attempting to uplift remaining variables inzp[1]:53 [ makechar::$5 ] +Uplifting [makechar] best 131943 combination zp[1]:53 [ makechar::$5 ] +Attempting to uplift remaining variables inzp[1]:4 [ doplasma::ii#3 doplasma::ii#2 ] +Uplifting [doplasma] best 131943 combination zp[1]:4 [ doplasma::ii#3 doplasma::ii#2 ] +Attempting to uplift remaining variables inzp[1]:7 [ doplasma::i#3 doplasma::i#2 ] +Uplifting [doplasma] best 131943 combination zp[1]:7 [ doplasma::i#3 doplasma::i#2 ] +Attempting to uplift remaining variables inzp[1]:22 [ makechar::i#3 makechar::i#2 ] +Uplifting [makechar] best 131943 combination zp[1]:22 [ makechar::i#3 makechar::i#2 ] +Attempting to uplift remaining variables inzp[1]:33 [ doplasma::$3 ] +Uplifting [doplasma] best 131343 combination reg byte a [ doplasma::$3 ] +Attempting to uplift remaining variables inzp[1]:34 [ doplasma::$1 ] +Uplifting [doplasma] best 130743 combination reg byte a [ doplasma::$1 ] +Attempting to uplift remaining variables inzp[1]:6 [ doplasma::c1b#3 doplasma::c1b#2 ] +Uplifting [doplasma] best 130743 combination zp[1]:6 [ doplasma::c1b#3 doplasma::c1b#2 ] +Attempting to uplift remaining variables inzp[1]:9 [ doplasma::c2b#3 doplasma::c2b#2 ] +Uplifting [doplasma] best 130743 combination zp[1]:9 [ doplasma::c2b#3 doplasma::c2b#2 ] +Attempting to uplift remaining variables inzp[1]:5 [ doplasma::c1a#3 doplasma::c1a#2 ] +Uplifting [doplasma] best 130743 combination zp[1]:5 [ doplasma::c1a#3 doplasma::c1a#2 ] +Attempting to uplift remaining variables inzp[1]:8 [ doplasma::c2a#3 doplasma::c2a#2 ] +Uplifting [doplasma] best 130743 combination zp[1]:8 [ doplasma::c2a#3 doplasma::c2a#2 ] +Attempting to uplift remaining variables inzp[1]:44 [ makechar::s#1 ] +Uplifting [makechar] best 130743 combination zp[1]:44 [ makechar::s#1 ] +Attempting to uplift remaining variables inzp[1]:29 [ main::block#1 ] +Uplifting [main] best 130743 combination zp[1]:29 [ main::block#1 ] +Attempting to uplift remaining variables inzp[1]:31 [ main::v#1 ] +Uplifting [main] best 130743 combination zp[1]:31 [ main::v#1 ] +Coalescing zero page register [ zp[2]:37 [ Ticks#2 ] ] with [ zp[2]:39 [ print_word::w#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:45 [ makechar::$8 ] ] with [ zp[2]:47 [ makechar::$9 ] ] - score: 1 +Coalescing zero page register [ zp[2]:45 [ makechar::$8 makechar::$9 ] ] with [ zp[2]:49 [ makechar::$10 ] ] - score: 1 +Coalescing zero page register [ zp[2]:14 [ print_line_cursor#8 print_line_cursor#1 ] ] with [ zp[2]:2 [ main::count#2 main::count#1 ] ] +Coalescing zero page register [ zp[2]:18 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] ] with [ zp[2]:11 [ doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] ] +Coalescing zero page register [ zp[1]:22 [ makechar::i#3 makechar::i#2 ] ] with [ zp[1]:4 [ doplasma::ii#3 doplasma::ii#2 ] ] +Coalescing zero page register [ zp[1]:24 [ makechar::b#3 makechar::b#7 makechar::b#2 ] ] with [ zp[1]:5 [ doplasma::c1a#3 doplasma::c1a#2 ] ] +Coalescing zero page register [ zp[2]:35 [ Ticks#1 ] ] with [ zp[2]:20 [ makechar::c#3 makechar::c#2 ] ] +Coalescing zero page register [ zp[1]:44 [ makechar::s#1 ] ] with [ zp[1]:6 [ doplasma::c1b#3 doplasma::c1b#2 ] ] +Coalescing zero page register [ zp[2]:45 [ makechar::$8 makechar::$9 makechar::$10 ] ] with [ zp[2]:37 [ Ticks#2 print_word::w#0 ] ] +Coalescing zero page register [ zp[1]:53 [ makechar::$5 ] ] with [ zp[1]:7 [ doplasma::i#3 doplasma::i#2 ] ] +Allocated (was zp[1]:8) zp[1]:2 [ doplasma::c2a#3 doplasma::c2a#2 ] +Allocated (was zp[1]:9) zp[1]:3 [ doplasma::c2b#3 doplasma::c2b#2 ] +Allocated (was zp[2]:14) zp[2]:4 [ print_line_cursor#8 print_line_cursor#1 main::count#2 main::count#1 ] +Allocated (was zp[2]:18) zp[2]:6 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] +Allocated (was zp[1]:22) zp[1]:8 [ makechar::i#3 makechar::i#2 doplasma::ii#3 doplasma::ii#2 ] +Allocated (was zp[1]:24) zp[1]:9 [ makechar::b#3 makechar::b#7 makechar::b#2 doplasma::c1a#3 doplasma::c1a#2 ] +Allocated (was zp[2]:25) zp[2]:10 [ last_time#0 last_time#1 last_time#2 ] +Allocated (was zp[2]:27) zp[2]:12 [ rand_seed#0 rand_seed#22 ] +Allocated (was zp[1]:29) zp[1]:14 [ main::block#1 ] +Allocated (was zp[1]:31) zp[1]:15 [ main::v#1 ] +Allocated (was zp[2]:35) zp[2]:16 [ Ticks#1 makechar::c#3 makechar::c#2 ] +Allocated (was zp[1]:44) zp[1]:18 [ makechar::s#1 doplasma::c1b#3 doplasma::c1b#2 ] +Allocated (was zp[2]:45) zp[2]:19 [ makechar::$8 makechar::$9 makechar::$10 Ticks#2 print_word::w#0 ] +Allocated (was zp[1]:53) zp[1]:21 [ makechar::$5 doplasma::i#3 doplasma::i#2 ] + +ASSEMBLER BEFORE OPTIMIZATION + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__bbegin) +.pc = $80d "Program" + // Global Constants & labels + .label VIC_MEMORY = $d018 + // CIA#2 Port A: Serial bus, RS-232, VIC memory bank + .label CIA2_PORT_A = $dd00 + .const SCREEN1 = $e000 + .const SCREEN2 = $e400 + .const CHARSET = $e800 + .const PAGE1 = $8a + // ((SCREEN1 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E); + .const PAGE2 = $9a + .label print_line_cursor = 4 + .label print_char_cursor = 6 + .label last_time = $a + .label rand_seed = $c + .label Ticks = $10 + .label Ticks_1 = $13 + // @begin +__bbegin: + jmp __b1 + // @1 +__b1: + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + lda #>0 + sta.z last_time+1 + jmp __b2 + // @2 +__b2: + // [2] (word) rand_seed#22 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z rand_seed + lda #>0 + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] +__b3_from___b2: + jmp __b3 + // @3 +__b3: + // [4] call main + // [6] phi from @3 to main [phi:@3->main] +main_from___b3: + jsr main + // [5] phi from @3 to @end [phi:@3->@end] +__bend_from___b3: + jmp __bend + // @end +__bend: + // main +main: { + .label block = $e + .label v = $f + .label count = 4 + // [7] call start + jsr start + // [8] phi from main to main::@4 [phi:main->main::@4] + __b4_from_main: + jmp __b4 + // main::@4 + __b4: + // [9] call makechar + // [86] phi from main::@4 to makechar [phi:main::@4->makechar] + makechar_from___b4: + jsr makechar + jmp __b5 + // main::@5 + __b5: + // [10] (byte) main::block#1 ← *((const byte*) CIA2_PORT_A) -- vbuz1=_deref_pbuc1 + lda CIA2_PORT_A + sta.z block + // [11] (byte) main::tmp#1 ← (byte) main::block#1 & (byte) $fc -- vbuaa=vbuz1_band_vbuc1 + lda #$fc + and.z block + // [12] *((const byte*) CIA2_PORT_A) ← (byte) main::tmp#1 -- _deref_pbuc1=vbuaa + sta CIA2_PORT_A + // [13] (byte) main::v#1 ← *((const byte*) VIC_MEMORY) -- vbuz1=_deref_pbuc1 + lda VIC_MEMORY + sta.z v + // [14] phi from main::@5 to main::@1 [phi:main::@5->main::@1] + __b1_from___b5: + // [14] phi (word) main::count#2 = (word) $1f4 [phi:main::@5->main::@1#0] -- vwuz1=vwuc1 + lda #<$1f4 + sta.z count + lda #>$1f4 + sta.z count+1 + jmp __b1 + /* Run the demo until a key was hit */ + // main::@1 + __b1: + // [15] if((byte) 0!=(word) main::count#2) goto main::@2 -- vwuc1_neq_vwuz1_then_la1 + lda.z count+1 + cmp #>0 + bne __b2_from___b1 + lda.z count + cmp #<0 + bne __b2_from___b1 + jmp __b3 + // main::@3 + __b3: + // [16] *((const byte*) VIC_MEMORY) ← (byte) main::v#1 -- _deref_pbuc1=vbuz1 + lda.z v + sta VIC_MEMORY + // [17] *((const byte*) CIA2_PORT_A) ← (byte) main::block#1 -- _deref_pbuc1=vbuz1 + lda.z block + sta CIA2_PORT_A + // [18] call end + jsr end + jmp __breturn + // main::@return + __breturn: + // [19] return + rts + // [20] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + __b2_from___b1: + jmp __b2 + // main::@2 + __b2: + // [21] call doplasma + // [26] phi from main::@2 to doplasma [phi:main::@2->doplasma] + doplasma_from___b2: + // [26] phi (byte*) doplasma::scrn#13 = (byte*)(const word) SCREEN1 [phi:main::@2->doplasma#0] -- pbuz1=pbuc1 + lda #SCREEN1 + sta.z doplasma.scrn+1 + jsr doplasma + jmp __b6 + // main::@6 + __b6: + // [22] *((const byte*) VIC_MEMORY) ← (const byte) PAGE1 -- _deref_pbuc1=vbuc2 + lda #PAGE1 + sta VIC_MEMORY + // [23] call doplasma + // [26] phi from main::@6 to doplasma [phi:main::@6->doplasma] + doplasma_from___b6: + // [26] phi (byte*) doplasma::scrn#13 = (byte*)(const word) SCREEN2 [phi:main::@6->doplasma#0] -- pbuz1=pbuc1 + lda #SCREEN2 + sta.z doplasma.scrn+1 + jsr doplasma + jmp __b7 + // main::@7 + __b7: + // [24] *((const byte*) VIC_MEMORY) ← (const byte) PAGE2 -- _deref_pbuc1=vbuc2 + lda #PAGE2 + sta VIC_MEMORY + // [25] (word) main::count#1 ← -- (word) main::count#2 -- vwuz1=_dec_vwuz1 + lda.z count + bne !+ + dec.z count+1 + !: + dec.z count + // [14] phi from main::@7 to main::@1 [phi:main::@7->main::@1] + __b1_from___b7: + // [14] phi (word) main::count#2 = (word) main::count#1 [phi:main::@7->main::@1#0] -- register_copy + jmp __b1 +} + // doplasma +// doplasma(byte* zeropage(6) scrn) +doplasma: { + .const c2A = 0 + .const c2B = 0 + .label c1a = 9 + .label c1b = $12 + .label ii = 8 + .label c2a = 2 + .label c2b = 3 + .label i = $15 + .label scrn = 6 + // [27] phi from doplasma to doplasma::@1 [phi:doplasma->doplasma::@1] + __b1_from_doplasma: + // [27] phi (byte) doplasma::c1b#3 = (byte) 0 [phi:doplasma->doplasma::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z c1b + // [27] phi (byte) doplasma::c1a#3 = (byte) 0 [phi:doplasma->doplasma::@1#1] -- vbuz1=vbuc1 + lda #0 + sta.z c1a + // [27] phi (byte) doplasma::ii#3 = (byte) 0 [phi:doplasma->doplasma::@1#2] -- vbuz1=vbuc1 + lda #0 + sta.z ii + jmp __b1 + // doplasma::@1 + __b1: + // [28] if((byte) doplasma::ii#3<(byte) $19) goto doplasma::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z ii + cmp #$19 + bcc __b2 + // [29] phi from doplasma::@1 to doplasma::@3 [phi:doplasma::@1->doplasma::@3] + __b3_from___b1: + // [29] phi (byte) doplasma::c2b#3 = (const byte) doplasma::c2B#0 [phi:doplasma::@1->doplasma::@3#0] -- vbuz1=vbuc1 + lda #c2B + sta.z c2b + // [29] phi (byte) doplasma::c2a#3 = (const byte) doplasma::c2A#0 [phi:doplasma::@1->doplasma::@3#1] -- vbuz1=vbuc1 + lda #c2A + sta.z c2a + // [29] phi (byte) doplasma::i#3 = (byte) 0 [phi:doplasma::@1->doplasma::@3#2] -- vbuz1=vbuc1 + lda #0 + sta.z i + jmp __b3 + // doplasma::@3 + __b3: + // [30] if((byte) doplasma::i#3<(byte) $28) goto doplasma::@4 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #$28 + bcc __b4 + // [31] phi from doplasma::@3 to doplasma::@5 [phi:doplasma::@3->doplasma::@5] + __b5_from___b3: + // [31] phi (byte*) doplasma::scrn#6 = (byte*) doplasma::scrn#13 [phi:doplasma::@3->doplasma::@5#0] -- register_copy + // [31] phi (byte) doplasma::jj#3 = (byte) 0 [phi:doplasma::@3->doplasma::@5#1] -- vbuxx=vbuc1 + ldx #0 + jmp __b5 + // doplasma::@5 + __b5: + // [32] if((byte) doplasma::jj#3<(byte) $19) goto doplasma::@6 -- vbuxx_lt_vbuc1_then_la1 + cpx #$19 + bcc __b6_from___b5 + jmp __breturn + // doplasma::@return + __breturn: + // [33] return + rts + // [34] phi from doplasma::@5 to doplasma::@6 [phi:doplasma::@5->doplasma::@6] + __b6_from___b5: + // [34] phi (byte) doplasma::j#3 = (byte) 0 [phi:doplasma::@5->doplasma::@6#0] -- vbuyy=vbuc1 + ldy #0 + jmp __b6 + // doplasma::@6 + __b6: + // [35] if((byte) doplasma::j#3<(byte) $28) goto doplasma::@7 -- vbuyy_lt_vbuc1_then_la1 + cpy #$28 + bcc __b7 + jmp __b8 + // doplasma::@8 + __b8: + // [36] (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#6 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z scrn + sta.z scrn + bcc !+ + inc.z scrn+1 + !: + // [37] (byte) doplasma::jj#2 ← ++ (byte) doplasma::jj#3 -- vbuxx=_inc_vbuxx + inx + // [31] phi from doplasma::@8 to doplasma::@5 [phi:doplasma::@8->doplasma::@5] + __b5_from___b8: + // [31] phi (byte*) doplasma::scrn#6 = (byte*) doplasma::scrn#0 [phi:doplasma::@8->doplasma::@5#0] -- register_copy + // [31] phi (byte) doplasma::jj#3 = (byte) doplasma::jj#2 [phi:doplasma::@8->doplasma::@5#1] -- register_copy + jmp __b5 + // doplasma::@7 + __b7: + // [38] (byte~) doplasma::$6 ← *((const byte*) xbuf + (byte) doplasma::j#3) + *((const byte*) ybuf + (byte) doplasma::jj#3) -- vbuaa=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuxx + lda xbuf,y + clc + adc ybuf,x + // [39] *((byte*) doplasma::scrn#6 + (byte) doplasma::j#3) ← (byte~) doplasma::$6 -- pbuz1_derefidx_vbuyy=vbuaa + sta (scrn),y + // [40] (byte) doplasma::j#2 ← ++ (byte) doplasma::j#3 -- vbuyy=_inc_vbuyy + iny + // [34] phi from doplasma::@7 to doplasma::@6 [phi:doplasma::@7->doplasma::@6] + __b6_from___b7: + // [34] phi (byte) doplasma::j#3 = (byte) doplasma::j#2 [phi:doplasma::@7->doplasma::@6#0] -- register_copy + jmp __b6 + // doplasma::@4 + __b4: + // [41] (byte~) doplasma::$3 ← *((const byte*) sinustable + (byte) doplasma::c2a#3) + *((const byte*) sinustable + (byte) doplasma::c2b#3) -- vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc1_derefidx_vbuz2 + ldy.z c2a + lda sinustable,y + ldy.z c2b + clc + adc sinustable,y + // [42] *((const byte*) xbuf + (byte) doplasma::i#3) ← (byte~) doplasma::$3 -- pbuc1_derefidx_vbuz1=vbuaa + ldy.z i + sta xbuf,y + // [43] (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (byte) 3 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c2a + axs #-[3] + stx.z c2a + // [44] (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (byte) 7 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c2b + axs #-[7] + stx.z c2b + // [45] (byte) doplasma::i#2 ← ++ (byte) doplasma::i#3 -- vbuz1=_inc_vbuz1 + inc.z i + // [29] phi from doplasma::@4 to doplasma::@3 [phi:doplasma::@4->doplasma::@3] + __b3_from___b4: + // [29] phi (byte) doplasma::c2b#3 = (byte) doplasma::c2b#2 [phi:doplasma::@4->doplasma::@3#0] -- register_copy + // [29] phi (byte) doplasma::c2a#3 = (byte) doplasma::c2a#2 [phi:doplasma::@4->doplasma::@3#1] -- register_copy + // [29] phi (byte) doplasma::i#3 = (byte) doplasma::i#2 [phi:doplasma::@4->doplasma::@3#2] -- register_copy + jmp __b3 + // doplasma::@2 + __b2: + // [46] (byte~) doplasma::$1 ← *((const byte*) sinustable + (byte) doplasma::c1a#3) + *((const byte*) sinustable + (byte) doplasma::c1b#3) -- vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc1_derefidx_vbuz2 + ldy.z c1a + lda sinustable,y + ldy.z c1b + clc + adc sinustable,y + // [47] *((const byte*) ybuf + (byte) doplasma::ii#3) ← (byte~) doplasma::$1 -- pbuc1_derefidx_vbuz1=vbuaa + ldy.z ii + sta ybuf,y + // [48] (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (byte) 4 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c1a + axs #-[4] + stx.z c1a + // [49] (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (byte) 9 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c1b + axs #-[9] + stx.z c1b + // [50] (byte) doplasma::ii#2 ← ++ (byte) doplasma::ii#3 -- vbuz1=_inc_vbuz1 + inc.z ii + // [27] phi from doplasma::@2 to doplasma::@1 [phi:doplasma::@2->doplasma::@1] + __b1_from___b2: + // [27] phi (byte) doplasma::c1b#3 = (byte) doplasma::c1b#2 [phi:doplasma::@2->doplasma::@1#0] -- register_copy + // [27] phi (byte) doplasma::c1a#3 = (byte) doplasma::c1a#2 [phi:doplasma::@2->doplasma::@1#1] -- register_copy + // [27] phi (byte) doplasma::ii#3 = (byte) doplasma::ii#2 [phi:doplasma::@2->doplasma::@1#2] -- register_copy + jmp __b1 +} + // end +end: { + // [51] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // [52] call start + jsr start + jmp __b1 + // end::@1 + __b1: + // [53] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // [54] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // [55] (word) print_word::w#0 ← (word) Ticks#2 + // [56] call print_word + jsr print_word + // [57] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + __b2_from___b1: + jmp __b2 + // end::@2 + __b2: + // [58] call print_ln + // [61] phi from end::@2 to print_ln [phi:end::@2->print_ln] + print_ln_from___b2: + jsr print_ln + jmp __breturn + // end::@return + __breturn: + // [59] (word) last_time#2 ← (word) last_time#1 + // [60] return + rts +} + // print_ln +// Print a newline +print_ln: { + // [62] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1] + __b1_from_print_ln: + // [62] phi (byte*) print_line_cursor#8 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + jmp __b1 + // [62] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1] + __b1_from___b1: + // [62] phi (byte*) print_line_cursor#8 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy + jmp __b1 + // print_ln::@1 + __b1: + // [63] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // [64] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1_from___b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1_from___b1 + !: + jmp __breturn + // print_ln::@return + __breturn: + // [65] return + rts +} + // print_word +// Print a word as HEX +// print_word(word zeropage($13) w) +print_word: { + .label w = $13 + // [66] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1 + lda.z w+1 + tax + // [67] call print_byte + // [71] phi from print_word to print_byte [phi:print_word->print_byte] + print_byte_from_print_word: + // [71] phi (byte*) print_char_cursor#35 = (byte*) 1024 [phi:print_word->print_byte#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [71] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + jmp __b1 + // print_word::@1 + __b1: + // [68] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuxx=_lo_vwuz1 + lda.z w + tax + // [69] call print_byte + // [71] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte] + print_byte_from___b1: + // [71] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#10 [phi:print_word::@1->print_byte#0] -- register_copy + // [71] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + jmp __breturn + // print_word::@return + __breturn: + // [70] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + // [72] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuxx_ror_4 + txa + lsr + lsr + lsr + lsr + // [73] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa + tay + lda print_hextab,y + // [74] call print_char + // [79] phi from print_byte to print_char [phi:print_byte->print_char] + print_char_from_print_byte: + // [79] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#35 [phi:print_byte->print_char#0] -- register_copy + // [79] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + jmp __b1 + // print_byte::@1 + __b1: + // [75] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuxx=vbuxx_band_vbuc1 + lda #$f + axs #0 + // [76] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuxx + lda print_hextab,x + // [77] call print_char + // [79] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + print_char_from___b1: + // [79] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#10 [phi:print_byte::@1->print_char#0] -- register_copy + // [79] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + jmp __breturn + // print_byte::@return + __breturn: + // [78] return + rts +} + // print_char +// Print a single char +// print_char(byte register(A) ch) +print_char: { + // [80] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa + ldy #0 + sta (print_char_cursor),y + // [81] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + jmp __breturn + // print_char::@return + __breturn: + // [82] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // [84] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + jmp __breturn + // start::@return + __breturn: + // [85] return + rts +} + // makechar +makechar: { + .label __5 = $15 + .label __8 = $13 + .label __9 = $13 + .label s = $12 + .label c = $10 + .label i = 8 + .label b = 9 + .label __10 = $13 + // [87] phi from makechar to makechar::@1 [phi:makechar->makechar::@1] + __b1_from_makechar: + // [87] phi (word) makechar::c#3 = (byte) 0 [phi:makechar->makechar::@1#0] -- vwuz1=vbuc1 + lda #<0 + sta.z c + lda #>0 + sta.z c+1 + jmp __b1 + // makechar::@1 + __b1: + // [88] if((word) makechar::c#3<(word) $100) goto makechar::@2 -- vwuz1_lt_vwuc1_then_la1 + lda.z c+1 + cmp #>$100 + bcc __b2 + bne !+ + lda.z c + cmp #<$100 + bcc __b2 + !: + jmp __breturn + // makechar::@return + __breturn: + // [89] return + rts + // makechar::@2 + __b2: + // [90] (byte~) makechar::$1 ← (byte)(word) makechar::c#3 -- vbuaa=_byte_vwuz1 + lda.z c + // [91] (byte) makechar::s#1 ← *((const byte*) sinustable + (byte~) makechar::$1) -- vbuz1=pbuc1_derefidx_vbuaa + tay + lda sinustable,y + sta.z s + // [92] phi from makechar::@2 to makechar::@3 [phi:makechar::@2->makechar::@3] + __b3_from___b2: + // [92] phi (byte) makechar::i#3 = (byte) 0 [phi:makechar::@2->makechar::@3#0] -- vbuz1=vbuc1 + lda #0 + sta.z i + jmp __b3 + // makechar::@3 + __b3: + // [93] if((byte) makechar::i#3<(byte) 8) goto makechar::@5 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #8 + bcc __b5_from___b3 + jmp __b4 + // makechar::@4 + __b4: + // [94] (word) makechar::c#2 ← ++ (word) makechar::c#3 -- vwuz1=_inc_vwuz1 + inc.z c + bne !+ + inc.z c+1 + !: + // [87] phi from makechar::@4 to makechar::@1 [phi:makechar::@4->makechar::@1] + __b1_from___b4: + // [87] phi (word) makechar::c#3 = (word) makechar::c#2 [phi:makechar::@4->makechar::@1#0] -- register_copy + jmp __b1 + // [95] phi from makechar::@3 to makechar::@5 [phi:makechar::@3->makechar::@5] + __b5_from___b3: + // [95] phi (byte) makechar::b#3 = (byte) 0 [phi:makechar::@3->makechar::@5#0] -- vbuz1=vbuc1 + lda #0 + sta.z b + // [95] phi (byte) makechar::ii#3 = (byte) 0 [phi:makechar::@3->makechar::@5#1] -- vbuyy=vbuc1 + ldy #0 + jmp __b5 + // makechar::@5 + __b5: + // [96] if((byte) makechar::ii#3<(byte) 8) goto makechar::@6 -- vbuyy_lt_vbuc1_then_la1 + cpy #8 + bcc __b6_from___b5 + jmp __b7 + // makechar::@7 + __b7: + // [97] (word~) makechar::$8 ← (word) makechar::c#3 << (byte) 3 -- vwuz1=vwuz2_rol_3 + lda.z c + asl + sta.z __8 + lda.z c+1 + rol + sta.z __8+1 + asl.z __8 + rol.z __8+1 + asl.z __8 + rol.z __8+1 + // [98] (word~) makechar::$9 ← (word~) makechar::$8 + (byte) makechar::i#3 -- vwuz1=vwuz1_plus_vbuz2 + lda.z i + clc + adc.z __9 + sta.z __9 + bcc !+ + inc.z __9+1 + !: + // [99] (byte*~) makechar::$10 ← (byte*)(const word) CHARSET + (word~) makechar::$9 -- pbuz1=pbuc1_plus_vwuz1 + clc + lda.z __10 + adc #CHARSET + sta.z __10+1 + // [100] *((byte*~) makechar::$10) ← (byte) makechar::b#3 -- _deref_pbuz1=vbuz2 + lda.z b + ldy #0 + sta (__10),y + // [101] (byte) makechar::i#2 ← ++ (byte) makechar::i#3 -- vbuz1=_inc_vbuz1 + inc.z i + // [92] phi from makechar::@7 to makechar::@3 [phi:makechar::@7->makechar::@3] + __b3_from___b7: + // [92] phi (byte) makechar::i#3 = (byte) makechar::i#2 [phi:makechar::@7->makechar::@3#0] -- register_copy + jmp __b3 + // [102] phi from makechar::@5 to makechar::@6 [phi:makechar::@5->makechar::@6] + __b6_from___b5: + jmp __b6 + // makechar::@6 + __b6: + // [103] call rand + jsr rand + // [104] (byte) rand::return#2 ← (byte) rand::return#0 + jmp __b10 + // makechar::@10 + __b10: + // [105] (byte~) makechar::$4 ← (byte) rand::return#2 + // [106] (byte~) makechar::$5 ← (byte~) makechar::$4 & (byte) $ff -- vbuz1=vbuaa_band_vbuc1 + and #$ff + sta.z __5 + // [107] if((byte~) makechar::$5<=(byte) makechar::s#1) goto makechar::@8 -- vbuz1_le_vbuz2_then_la1 + lda.z s + cmp.z __5 + bcs __b8_from___b10 + jmp __b9 + // makechar::@9 + __b9: + // [108] (byte) makechar::b#2 ← (byte) makechar::b#3 | *((const byte*) bittab + (byte) makechar::ii#3) -- vbuz1=vbuz1_bor_pbuc1_derefidx_vbuyy + lda bittab,y + ora.z b + sta.z b + // [109] phi from makechar::@10 makechar::@9 to makechar::@8 [phi:makechar::@10/makechar::@9->makechar::@8] + __b8_from___b10: + __b8_from___b9: + // [109] phi (byte) makechar::b#7 = (byte) makechar::b#3 [phi:makechar::@10/makechar::@9->makechar::@8#0] -- register_copy + jmp __b8 + // makechar::@8 + __b8: + // [110] (byte) makechar::ii#2 ← ++ (byte) makechar::ii#3 -- vbuyy=_inc_vbuyy + iny + // [95] phi from makechar::@8 to makechar::@5 [phi:makechar::@8->makechar::@5] + __b5_from___b8: + // [95] phi (byte) makechar::b#3 = (byte) makechar::b#7 [phi:makechar::@8->makechar::@5#0] -- register_copy + // [95] phi (byte) makechar::ii#3 = (byte) makechar::ii#2 [phi:makechar::@8->makechar::@5#1] -- register_copy + jmp __b5 +} + // rand +rand: { + .label RAND_SEED = rand_seed + // asm { ldx#8 ldaRAND_SEED+0 __rand_loop: asl rolRAND_SEED+1 bcc__no_eor eor#$2D __no_eor: dex bne__rand_loop staRAND_SEED+0 } + ldx #8 + lda RAND_SEED+0 + __rand_loop: + asl + rol RAND_SEED+1 + bcc __no_eor + eor #$2d + __no_eor: + dex + bne __rand_loop + sta RAND_SEED+0 + // [112] (byte) rand::return#0 ← (byte)(word) rand_seed#0 -- vbuaa=_byte_vwuz1 + lda.z rand_seed + jmp __breturn + // rand::@return + __breturn: + // [113] return + rts +} + // File Data + print_hextab: .text "0123456789abcdef" + // ((SCREEN2 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E); + .align $100 + sinustable: .byte $80, $7d, $7a, $77, $74, $70, $6d, $6a, $67, $64, $61, $5e, $5b, $58, $55, $52, $4f, $4d, $4a, $47, $44, $41, $3f, $3c, $39, $37, $34, $32, $2f, $2d, $2b, $28, $26, $24, $22, $20, $1e, $1c, $1a, $18, $16, $15, $13, $11, $10, $f, $d, $c, $b, $a, 8, 7, 6, 6, 5, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 6, 7, 8, $a, $b, $c, $d, $f, $10, $11, $13, $15, $16, $18, $1a, $1c, $1e, $20, $22, $24, $26, $28, $2b, $2d, $2f, $32, $34, $37, $39, $3c, $3f, $41, $44, $47, $4a, $4d, $4f, $52, $55, $58, $5b, $5e, $61, $64, $67, $6a, $6d, $70, $74, $77, $7a, $7d, $80, $83, $86, $89, $8c, $90, $93, $96, $99, $9c, $9f, $a2, $a5, $a8, $ab, $ae, $b1, $b3, $b6, $b9, $bc, $bf, $c1, $c4, $c7, $c9, $cc, $ce, $d1, $d3, $d5, $d8, $da, $dc, $de, $e0, $e2, $e4, $e6, $e8, $ea, $eb, $ed, $ef, $f0, $f1, $f3, $f4, $f5, $f6, $f8, $f9, $fa, $fa, $fb, $fc, $fd, $fd, $fe, $fe, $fe, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $fe, $fe, $fe, $fd, $fd, $fc, $fb, $fa, $fa, $f9, $f8, $f6, $f5, $f4, $f3, $f1, $f0, $ef, $ed, $eb, $ea, $e8, $e6, $e4, $e2, $e0, $de, $dc, $da, $d8, $d5, $d3, $d1, $ce, $cc, $c9, $c7, $c4, $c1, $bf, $bc, $b9, $b6, $b3, $b1, $ae, $ab, $a8, $a5, $a2, $9f, $9c, $99, $96, $93, $90, $8c, $89, $86, $83 + xbuf: .fill $28, 0 + ybuf: .fill $19, 0 + bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp __b1 +Removing instruction jmp __b2 +Removing instruction jmp __b3 +Removing instruction jmp __bend +Removing instruction jmp __b4 +Removing instruction jmp __b5 +Removing instruction jmp __b1 +Removing instruction jmp __b3 +Removing instruction jmp __breturn +Removing instruction jmp __b2 +Removing instruction jmp __b6 +Removing instruction jmp __b7 +Removing instruction jmp __b1 +Removing instruction jmp __b3 +Removing instruction jmp __b5 +Removing instruction jmp __breturn +Removing instruction jmp __b6 +Removing instruction jmp __b8 +Removing instruction jmp __b1 +Removing instruction jmp __b2 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __breturn +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b3 +Removing instruction jmp __b4 +Removing instruction jmp __b5 +Removing instruction jmp __b7 +Removing instruction jmp __b6 +Removing instruction jmp __b10 +Removing instruction jmp __b9 +Removing instruction jmp __b8 +Removing instruction jmp __breturn +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda #>0 +Removing instruction lda #>0 +Removing instruction lda #0 +Removing instruction lda #0 +Removing instruction lda #>0 +Replacing instruction ldy #0 with TAY +Succesful ASM optimization Pass5UnnecesaryLoadElimination +Replacing label __bbegin with __b1 +Replacing label __b2_from___b1 with __b2 +Replacing label __b2_from___b1 with __b2 +Replacing label __b1_from___b1 with __b1 +Replacing label __b1_from___b1 with __b1 +Replacing label __b6_from___b5 with __b6 +Replacing label __b8_from___b10 with __b8 +Removing instruction __bbegin: +Removing instruction __b3_from___b2: +Removing instruction main_from___b3: +Removing instruction __bend_from___b3: +Removing instruction __b4_from_main: +Removing instruction makechar_from___b4: +Removing instruction __b2_from___b1: +Removing instruction doplasma_from___b2: +Removing instruction __b2_from___b1: +Removing instruction print_ln_from___b2: +Removing instruction __b1_from___b1: +Removing instruction __b6_from___b5: +Removing instruction __b8_from___b10: +Removing instruction __b8_from___b9: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction __b2: +Removing instruction __b3: +Removing instruction __bend: +Removing instruction __b4: +Removing instruction __b5: +Removing instruction __b1_from___b5: +Removing instruction __b3: +Removing instruction __breturn: +Removing instruction __b6: +Removing instruction doplasma_from___b6: +Removing instruction __b7: +Removing instruction __b1_from___b7: +Removing instruction __b1_from_doplasma: +Removing instruction __b3_from___b1: +Removing instruction __b5_from___b3: +Removing instruction __breturn: +Removing instruction __b8: +Removing instruction __b5_from___b8: +Removing instruction __b6_from___b7: +Removing instruction __b3_from___b4: +Removing instruction __b1_from___b2: +Removing instruction __b1: +Removing instruction __b2: +Removing instruction __breturn: +Removing instruction __b1_from_print_ln: +Removing instruction __breturn: +Removing instruction print_byte_from_print_word: +Removing instruction __b1: +Removing instruction print_byte_from___b1: +Removing instruction __breturn: +Removing instruction print_char_from_print_byte: +Removing instruction __b1: +Removing instruction print_char_from___b1: +Removing instruction __breturn: +Removing instruction __breturn: +Removing instruction __breturn: +Removing instruction __b1_from_makechar: +Removing instruction __breturn: +Removing instruction __b3_from___b2: +Removing instruction __b4: +Removing instruction __b1_from___b4: +Removing instruction __b7: +Removing instruction __b3_from___b7: +Removing instruction __b10: +Removing instruction __b9: +Removing instruction __b5_from___b8: +Removing instruction __breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Relabelling long label __b6_from___b5 to b1 +Relabelling long label __b5_from___b3 to b1 +Succesful ASM optimization Pass5RelabelLongLabels +Adding RTS to root block +Succesful ASM optimization Pass5AddMainRts +Removing instruction jmp __b1 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda #<0 +Succesful ASM optimization Pass5UnnecesaryLoadElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(const word) CHARSET = (number) $e800 +(const byte*) CIA2_PORT_A = (byte*) 56576 +(const byte) PAGE1 = (number) $8a +(const byte) PAGE2 = (number) $9a +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const word) SCREEN1 = (number) $e000 +(const word) SCREEN2 = (number) $e400 +(word) Ticks +(word) Ticks#1 Ticks zp[2]:16 2.0 +(word) Ticks#2 Ticks_1 zp[2]:19 4.0 +(const byte*) VIC_MEMORY = (byte*) 53272 +(const byte*) bittab = { (byte) 1, (byte) 2, (byte) 4, (byte) 8, (byte) $10, (byte) $20, (byte) $40, (byte) $80 } +(void()) doplasma((byte*) doplasma::scrn) +(byte~) doplasma::$1 reg byte a 202.0 +(byte~) doplasma::$3 reg byte a 202.0 +(byte~) doplasma::$6 reg byte a 2002.0 +(label) doplasma::@1 +(label) doplasma::@2 +(label) doplasma::@3 +(label) doplasma::@4 +(label) doplasma::@5 +(label) doplasma::@6 +(label) doplasma::@7 +(label) doplasma::@8 +(label) doplasma::@return +(byte) doplasma::c1A +(byte) doplasma::c1B +(byte) doplasma::c1a +(byte) doplasma::c1a#2 c1a zp[1]:9 67.33333333333333 +(byte) doplasma::c1a#3 c1a zp[1]:9 75.75 +(byte) doplasma::c1b +(byte) doplasma::c1b#2 c1b zp[1]:18 101.0 +(byte) doplasma::c1b#3 c1b zp[1]:18 60.599999999999994 +(byte) doplasma::c2A +(const byte) doplasma::c2A#0 c2A = (byte) 0 +(byte) doplasma::c2B +(const byte) doplasma::c2B#0 c2B = (byte) 0 +(byte) doplasma::c2a +(byte) doplasma::c2a#2 c2a zp[1]:2 67.33333333333333 +(byte) doplasma::c2a#3 c2a zp[1]:2 75.75 +(byte) doplasma::c2b +(byte) doplasma::c2b#2 c2b zp[1]:3 101.0 +(byte) doplasma::c2b#3 c2b zp[1]:3 60.599999999999994 +(byte) doplasma::i +(byte) doplasma::i#2 i zp[1]:21 202.0 +(byte) doplasma::i#3 i zp[1]:21 67.33333333333333 +(byte) doplasma::ii +(byte) doplasma::ii#2 ii zp[1]:8 202.0 +(byte) doplasma::ii#3 ii zp[1]:8 67.33333333333333 +(byte) doplasma::j +(byte) doplasma::j#2 reg byte y 2002.0 +(byte) doplasma::j#3 reg byte y 1251.25 +(byte) doplasma::jj +(byte) doplasma::jj#2 reg byte x 202.0 +(byte) doplasma::jj#3 reg byte x 163.0 +(byte*) doplasma::scrn +(byte*) doplasma::scrn#0 scrn zp[2]:6 101.0 +(byte*) doplasma::scrn#13 scrn zp[2]:6 6.733333333333333 +(byte*) doplasma::scrn#6 scrn zp[2]:6 186.28571428571428 +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@return +(word) last_time +(word) last_time#0 last_time zp[2]:10 0.2608695652173913 +(word) last_time#1 last_time zp[2]:10 1.0 +(word) last_time#2 last_time zp[2]:10 20.0 +(signed word()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@return +(byte) main::block +(byte) main::block#1 block zp[1]:14 0.46153846153846156 +(word) main::count +(word) main::count#1 count zp[2]:4 22.0 +(word) main::count#2 count zp[2]:4 4.714285714285714 +(signed word) main::return +(byte) main::tmp +(byte) main::tmp#1 reg byte a 4.0 +(byte) main::v +(byte) main::v#1 v zp[1]:15 0.4444444444444444 +(void()) makechar() +(byte~) makechar::$1 reg byte a 22.0 +(byte*~) makechar::$10 zp[2]:19 202.0 +(byte~) makechar::$4 reg byte a 2002.0 +(byte~) makechar::$5 zp[1]:21 2002.0 +(word~) makechar::$8 zp[2]:19 202.0 +(word~) makechar::$9 zp[2]:19 202.0 +(label) makechar::@1 +(label) makechar::@10 +(label) makechar::@2 +(label) makechar::@3 +(label) makechar::@4 +(label) makechar::@5 +(label) makechar::@6 +(label) makechar::@7 +(label) makechar::@8 +(label) makechar::@9 +(label) makechar::@return +(byte) makechar::b +(byte) makechar::b#2 b zp[1]:9 2002.0 +(byte) makechar::b#3 b zp[1]:9 282.1818181818182 +(byte) makechar::b#7 b zp[1]:9 1501.5 +(word) makechar::c +(word) makechar::c#2 c zp[2]:16 22.0 +(word) makechar::c#3 c zp[2]:16 6.090909090909091 +(byte) makechar::i +(byte) makechar::i#2 i zp[1]:8 202.0 +(byte) makechar::i#3 i zp[1]:8 23.764705882352942 +(byte) makechar::ii +(byte) makechar::ii#2 reg byte y 2002.0 +(byte) makechar::ii#3 reg byte y 400.4 +(byte) makechar::s +(byte) makechar::s#1 s zp[1]:18 53.26315789473684 +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 reg byte a 4.0 +(byte~) print_byte::$2 reg byte x 4.0 +(label) print_byte::@1 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 reg byte x 4.0 +(byte) print_byte::b#1 reg byte x 4.0 +(byte) print_byte::b#2 reg byte x 2.0 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 reg byte a 4.0 +(byte) print_char::ch#1 reg byte a 4.0 +(byte) print_char::ch#2 reg byte a 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#10 print_char_cursor zp[2]:6 1.0 +(byte*) print_char_cursor#25 print_char_cursor zp[2]:6 4.0 +(byte*) print_char_cursor#35 print_char_cursor zp[2]:6 1.3333333333333333 +(const byte*) print_hextab = (string) "0123456789abcdef"z +(byte*) print_line_cursor +(byte*) print_line_cursor#1 print_line_cursor zp[2]:4 16.5 +(byte*) print_line_cursor#8 print_line_cursor zp[2]:4 22.0 +(void()) print_ln() +(label) print_ln::@1 +(label) print_ln::@return +(byte*) print_screen +(void()) print_word((word) print_word::w) +(label) print_word::@1 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 w zp[2]:19 2.0 +(byte()) rand() +(label) rand::@return +(const word*) rand::RAND_SEED = &(word) rand_seed +(byte) rand::return +(byte) rand::return#0 reg byte a 334.33333333333337 +(byte) rand::return#2 reg byte a 2002.0 +(word) rand_seed +(word) rand_seed#0 rand_seed zp[2]:12 0.06451612903225806 +(word) rand_seed#22 rand_seed zp[2]:12 20.0 +(const byte*) sinustable = { (byte) $80, (byte) $7d, (byte) $7a, (byte) $77, (byte) $74, (byte) $70, (byte) $6d, (byte) $6a, (byte) $67, (byte) $64, (byte) $61, (byte) $5e, (byte) $5b, (byte) $58, (byte) $55, (byte) $52, (byte) $4f, (byte) $4d, (byte) $4a, (byte) $47, (byte) $44, (byte) $41, (byte) $3f, (byte) $3c, (byte) $39, (byte) $37, (byte) $34, (byte) $32, (byte) $2f, (byte) $2d, (byte) $2b, (byte) $28, (byte) $26, (byte) $24, (byte) $22, (byte) $20, (byte) $1e, (byte) $1c, (byte) $1a, (byte) $18, (byte) $16, (byte) $15, (byte) $13, (byte) $11, (byte) $10, (byte) $f, (byte) $d, (byte) $c, (byte) $b, (byte) $a, (byte) 8, (byte) 7, (byte) 6, (byte) 6, (byte) 5, (byte) 4, (byte) 3, (byte) 3, (byte) 2, (byte) 2, (byte) 2, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 2, (byte) 2, (byte) 2, (byte) 3, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 6, (byte) 7, (byte) 8, (byte) $a, (byte) $b, (byte) $c, (byte) $d, (byte) $f, (byte) $10, (byte) $11, (byte) $13, (byte) $15, (byte) $16, (byte) $18, (byte) $1a, (byte) $1c, (byte) $1e, (byte) $20, (byte) $22, (byte) $24, (byte) $26, (byte) $28, (byte) $2b, (byte) $2d, (byte) $2f, (byte) $32, (byte) $34, (byte) $37, (byte) $39, (byte) $3c, (byte) $3f, (byte) $41, (byte) $44, (byte) $47, (byte) $4a, (byte) $4d, (byte) $4f, (byte) $52, (byte) $55, (byte) $58, (byte) $5b, (byte) $5e, (byte) $61, (byte) $64, (byte) $67, (byte) $6a, (byte) $6d, (byte) $70, (byte) $74, (byte) $77, (byte) $7a, (byte) $7d, (byte) $80, (byte) $83, (byte) $86, (byte) $89, (byte) $8c, (byte) $90, (byte) $93, (byte) $96, (byte) $99, (byte) $9c, (byte) $9f, (byte) $a2, (byte) $a5, (byte) $a8, (byte) $ab, (byte) $ae, (byte) $b1, (byte) $b3, (byte) $b6, (byte) $b9, (byte) $bc, (byte) $bf, (byte) $c1, (byte) $c4, (byte) $c7, (byte) $c9, (byte) $cc, (byte) $ce, (byte) $d1, (byte) $d3, (byte) $d5, (byte) $d8, (byte) $da, (byte) $dc, (byte) $de, (byte) $e0, (byte) $e2, (byte) $e4, (byte) $e6, (byte) $e8, (byte) $ea, (byte) $eb, (byte) $ed, (byte) $ef, (byte) $f0, (byte) $f1, (byte) $f3, (byte) $f4, (byte) $f5, (byte) $f6, (byte) $f8, (byte) $f9, (byte) $fa, (byte) $fa, (byte) $fb, (byte) $fc, (byte) $fd, (byte) $fd, (byte) $fe, (byte) $fe, (byte) $fe, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $fe, (byte) $fe, (byte) $fe, (byte) $fd, (byte) $fd, (byte) $fc, (byte) $fb, (byte) $fa, (byte) $fa, (byte) $f9, (byte) $f8, (byte) $f6, (byte) $f5, (byte) $f4, (byte) $f3, (byte) $f1, (byte) $f0, (byte) $ef, (byte) $ed, (byte) $eb, (byte) $ea, (byte) $e8, (byte) $e6, (byte) $e4, (byte) $e2, (byte) $e0, (byte) $de, (byte) $dc, (byte) $da, (byte) $d8, (byte) $d5, (byte) $d3, (byte) $d1, (byte) $ce, (byte) $cc, (byte) $c9, (byte) $c7, (byte) $c4, (byte) $c1, (byte) $bf, (byte) $bc, (byte) $b9, (byte) $b6, (byte) $b3, (byte) $b1, (byte) $ae, (byte) $ab, (byte) $a8, (byte) $a5, (byte) $a2, (byte) $9f, (byte) $9c, (byte) $99, (byte) $96, (byte) $93, (byte) $90, (byte) $8c, (byte) $89, (byte) $86, (byte) $83 } +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time +(const byte*) xbuf = { fill( $28, 0) } +(const byte*) ybuf = { fill( $19, 0) } + +zp[1]:2 [ doplasma::c2a#3 doplasma::c2a#2 ] +zp[1]:3 [ doplasma::c2b#3 doplasma::c2b#2 ] +reg byte x [ doplasma::jj#3 doplasma::jj#2 ] +reg byte y [ doplasma::j#3 doplasma::j#2 ] +zp[2]:4 [ print_line_cursor#8 print_line_cursor#1 main::count#2 main::count#1 ] +reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +zp[2]:6 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] +zp[1]:8 [ makechar::i#3 makechar::i#2 doplasma::ii#3 doplasma::ii#2 ] +reg byte y [ makechar::ii#3 makechar::ii#2 ] +zp[1]:9 [ makechar::b#3 makechar::b#7 makechar::b#2 doplasma::c1a#3 doplasma::c1a#2 ] +zp[2]:10 [ last_time#0 last_time#1 last_time#2 ] +zp[2]:12 [ rand_seed#0 rand_seed#22 ] +zp[1]:14 [ main::block#1 ] +reg byte a [ main::tmp#1 ] +zp[1]:15 [ main::v#1 ] +reg byte a [ doplasma::$6 ] +reg byte a [ doplasma::$3 ] +reg byte a [ doplasma::$1 ] +zp[2]:16 [ Ticks#1 makechar::c#3 makechar::c#2 ] +reg byte a [ print_byte::$0 ] +reg byte x [ print_byte::$2 ] +reg byte a [ makechar::$1 ] +zp[1]:18 [ makechar::s#1 doplasma::c1b#3 doplasma::c1b#2 ] +zp[2]:19 [ makechar::$8 makechar::$9 makechar::$10 Ticks#2 print_word::w#0 ] +reg byte a [ rand::return#2 ] +reg byte a [ makechar::$4 ] +zp[1]:21 [ makechar::$5 doplasma::i#3 doplasma::i#2 ] +reg byte a [ rand::return#0 ] + + +FINAL ASSEMBLER +Score: 104137 + + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__b1) +.pc = $80d "Program" + // Global Constants & labels + .label VIC_MEMORY = $d018 + // CIA#2 Port A: Serial bus, RS-232, VIC memory bank + .label CIA2_PORT_A = $dd00 + .const SCREEN1 = $e000 + .const SCREEN2 = $e400 + .const CHARSET = $e800 + .const PAGE1 = $8a + // ((SCREEN1 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E); + .const PAGE2 = $9a + .label print_line_cursor = 4 + .label print_char_cursor = 6 + .label last_time = $a + .label rand_seed = $c + .label Ticks = $10 + .label Ticks_1 = $13 + // @begin + // @1 +__b1: + // last_time + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + sta.z last_time+1 + // @2 + // rand_seed + // [2] (word) rand_seed#22 ← (word) 0 -- vwuz1=vwuc1 + sta.z rand_seed + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] + // @3 + // [4] call main + // [6] phi from @3 to main [phi:@3->main] + jsr main + rts + // [5] phi from @3 to @end [phi:@3->@end] + // @end + // main +main: { + .label block = $e + .label v = $f + .label count = 4 + // start() + // [7] call start + jsr start + // [8] phi from main to main::@4 [phi:main->main::@4] + // main::@4 + // makechar() + // [9] call makechar + // [86] phi from main::@4 to makechar [phi:main::@4->makechar] + jsr makechar + // main::@5 + // block = *CIA2_PORT_A + // [10] (byte) main::block#1 ← *((const byte*) CIA2_PORT_A) -- vbuz1=_deref_pbuc1 + lda CIA2_PORT_A + sta.z block + // tmp = block & 0xFC + // [11] (byte) main::tmp#1 ← (byte) main::block#1 & (byte) $fc -- vbuaa=vbuz1_band_vbuc1 + lda #$fc + and.z block + // *CIA2_PORT_A = tmp + // [12] *((const byte*) CIA2_PORT_A) ← (byte) main::tmp#1 -- _deref_pbuc1=vbuaa + sta CIA2_PORT_A + // v = *VIC_MEMORY + // [13] (byte) main::v#1 ← *((const byte*) VIC_MEMORY) -- vbuz1=_deref_pbuc1 + lda VIC_MEMORY + sta.z v + // [14] phi from main::@5 to main::@1 [phi:main::@5->main::@1] + // [14] phi (word) main::count#2 = (word) $1f4 [phi:main::@5->main::@1#0] -- vwuz1=vwuc1 + lda #<$1f4 + sta.z count + lda #>$1f4 + sta.z count+1 + /* Run the demo until a key was hit */ + // main::@1 + __b1: + // while (count) + // [15] if((byte) 0!=(word) main::count#2) goto main::@2 -- vwuc1_neq_vwuz1_then_la1 + lda.z count+1 + cmp #>0 + bne __b2 + lda.z count + cmp #<0 + bne __b2 + // main::@3 + // *VIC_MEMORY = v + // [16] *((const byte*) VIC_MEMORY) ← (byte) main::v#1 -- _deref_pbuc1=vbuz1 + lda.z v + sta VIC_MEMORY + // *CIA2_PORT_A = block + // [17] *((const byte*) CIA2_PORT_A) ← (byte) main::block#1 -- _deref_pbuc1=vbuz1 + lda.z block + sta CIA2_PORT_A + // end() + // [18] call end + jsr end + // main::@return + // } + // [19] return + rts + // [20] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + // main::@2 + __b2: + // doplasma ((char*)SCREEN1) + // [21] call doplasma + // [26] phi from main::@2 to doplasma [phi:main::@2->doplasma] + // [26] phi (byte*) doplasma::scrn#13 = (byte*)(const word) SCREEN1 [phi:main::@2->doplasma#0] -- pbuz1=pbuc1 + lda #SCREEN1 + sta.z doplasma.scrn+1 + jsr doplasma + // main::@6 + // *VIC_MEMORY = PAGE1 + // [22] *((const byte*) VIC_MEMORY) ← (const byte) PAGE1 -- _deref_pbuc1=vbuc2 + lda #PAGE1 + sta VIC_MEMORY + // doplasma ((char*)SCREEN2) + // [23] call doplasma + // [26] phi from main::@6 to doplasma [phi:main::@6->doplasma] + // [26] phi (byte*) doplasma::scrn#13 = (byte*)(const word) SCREEN2 [phi:main::@6->doplasma#0] -- pbuz1=pbuc1 + lda #SCREEN2 + sta.z doplasma.scrn+1 + jsr doplasma + // main::@7 + // *VIC_MEMORY = PAGE2 + // [24] *((const byte*) VIC_MEMORY) ← (const byte) PAGE2 -- _deref_pbuc1=vbuc2 + lda #PAGE2 + sta VIC_MEMORY + // --count; + // [25] (word) main::count#1 ← -- (word) main::count#2 -- vwuz1=_dec_vwuz1 + lda.z count + bne !+ + dec.z count+1 + !: + dec.z count + // [14] phi from main::@7 to main::@1 [phi:main::@7->main::@1] + // [14] phi (word) main::count#2 = (word) main::count#1 [phi:main::@7->main::@1#0] -- register_copy + jmp __b1 +} + // doplasma +// doplasma(byte* zeropage(6) scrn) +doplasma: { + .const c2A = 0 + .const c2B = 0 + .label c1a = 9 + .label c1b = $12 + .label ii = 8 + .label c2a = 2 + .label c2b = 3 + .label i = $15 + .label scrn = 6 + // [27] phi from doplasma to doplasma::@1 [phi:doplasma->doplasma::@1] + // [27] phi (byte) doplasma::c1b#3 = (byte) 0 [phi:doplasma->doplasma::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z c1b + // [27] phi (byte) doplasma::c1a#3 = (byte) 0 [phi:doplasma->doplasma::@1#1] -- vbuz1=vbuc1 + sta.z c1a + // [27] phi (byte) doplasma::ii#3 = (byte) 0 [phi:doplasma->doplasma::@1#2] -- vbuz1=vbuc1 + sta.z ii + // doplasma::@1 + __b1: + // for (ii = 0; ii < 25; ++ii) + // [28] if((byte) doplasma::ii#3<(byte) $19) goto doplasma::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z ii + cmp #$19 + bcc __b2 + // [29] phi from doplasma::@1 to doplasma::@3 [phi:doplasma::@1->doplasma::@3] + // [29] phi (byte) doplasma::c2b#3 = (const byte) doplasma::c2B#0 [phi:doplasma::@1->doplasma::@3#0] -- vbuz1=vbuc1 + lda #c2B + sta.z c2b + // [29] phi (byte) doplasma::c2a#3 = (const byte) doplasma::c2A#0 [phi:doplasma::@1->doplasma::@3#1] -- vbuz1=vbuc1 + lda #c2A + sta.z c2a + // [29] phi (byte) doplasma::i#3 = (byte) 0 [phi:doplasma::@1->doplasma::@3#2] -- vbuz1=vbuc1 + lda #0 + sta.z i + // doplasma::@3 + __b3: + // for (i = 0; i < 40; ++i) + // [30] if((byte) doplasma::i#3<(byte) $28) goto doplasma::@4 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #$28 + bcc __b4 + // [31] phi from doplasma::@3 to doplasma::@5 [phi:doplasma::@3->doplasma::@5] + // [31] phi (byte*) doplasma::scrn#6 = (byte*) doplasma::scrn#13 [phi:doplasma::@3->doplasma::@5#0] -- register_copy + // [31] phi (byte) doplasma::jj#3 = (byte) 0 [phi:doplasma::@3->doplasma::@5#1] -- vbuxx=vbuc1 + ldx #0 + // doplasma::@5 + __b5: + // for (jj = 0; jj < 25; ++jj) + // [32] if((byte) doplasma::jj#3<(byte) $19) goto doplasma::@6 -- vbuxx_lt_vbuc1_then_la1 + cpx #$19 + bcc b1 + // doplasma::@return + // } + // [33] return + rts + // [34] phi from doplasma::@5 to doplasma::@6 [phi:doplasma::@5->doplasma::@6] + b1: + // [34] phi (byte) doplasma::j#3 = (byte) 0 [phi:doplasma::@5->doplasma::@6#0] -- vbuyy=vbuc1 + ldy #0 + // doplasma::@6 + __b6: + // for (j = 0; j < 40; ++j) + // [35] if((byte) doplasma::j#3<(byte) $28) goto doplasma::@7 -- vbuyy_lt_vbuc1_then_la1 + cpy #$28 + bcc __b7 + // doplasma::@8 + // scrn += 40 + // [36] (byte*) doplasma::scrn#0 ← (byte*) doplasma::scrn#6 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z scrn + sta.z scrn + bcc !+ + inc.z scrn+1 + !: + // for (jj = 0; jj < 25; ++jj) + // [37] (byte) doplasma::jj#2 ← ++ (byte) doplasma::jj#3 -- vbuxx=_inc_vbuxx + inx + // [31] phi from doplasma::@8 to doplasma::@5 [phi:doplasma::@8->doplasma::@5] + // [31] phi (byte*) doplasma::scrn#6 = (byte*) doplasma::scrn#0 [phi:doplasma::@8->doplasma::@5#0] -- register_copy + // [31] phi (byte) doplasma::jj#3 = (byte) doplasma::jj#2 [phi:doplasma::@8->doplasma::@5#1] -- register_copy + jmp __b5 + // doplasma::@7 + __b7: + // xbuf[j] + ybuf[jj] + // [38] (byte~) doplasma::$6 ← *((const byte*) xbuf + (byte) doplasma::j#3) + *((const byte*) ybuf + (byte) doplasma::jj#3) -- vbuaa=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuxx + lda xbuf,y + clc + adc ybuf,x + // scrn[j] = (xbuf[j] + ybuf[jj]) + // [39] *((byte*) doplasma::scrn#6 + (byte) doplasma::j#3) ← (byte~) doplasma::$6 -- pbuz1_derefidx_vbuyy=vbuaa + sta (scrn),y + // for (j = 0; j < 40; ++j) + // [40] (byte) doplasma::j#2 ← ++ (byte) doplasma::j#3 -- vbuyy=_inc_vbuyy + iny + // [34] phi from doplasma::@7 to doplasma::@6 [phi:doplasma::@7->doplasma::@6] + // [34] phi (byte) doplasma::j#3 = (byte) doplasma::j#2 [phi:doplasma::@7->doplasma::@6#0] -- register_copy + jmp __b6 + // doplasma::@4 + __b4: + // sinustable[c2a] + sinustable[c2b] + // [41] (byte~) doplasma::$3 ← *((const byte*) sinustable + (byte) doplasma::c2a#3) + *((const byte*) sinustable + (byte) doplasma::c2b#3) -- vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc1_derefidx_vbuz2 + ldy.z c2a + lda sinustable,y + ldy.z c2b + clc + adc sinustable,y + // xbuf[i] = (sinustable[c2a] + sinustable[c2b]) + // [42] *((const byte*) xbuf + (byte) doplasma::i#3) ← (byte~) doplasma::$3 -- pbuc1_derefidx_vbuz1=vbuaa + ldy.z i + sta xbuf,y + // c2a += 3 + // [43] (byte) doplasma::c2a#2 ← (byte) doplasma::c2a#3 + (byte) 3 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c2a + axs #-[3] + stx.z c2a + // c2b += 7 + // [44] (byte) doplasma::c2b#2 ← (byte) doplasma::c2b#3 + (byte) 7 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c2b + axs #-[7] + stx.z c2b + // for (i = 0; i < 40; ++i) + // [45] (byte) doplasma::i#2 ← ++ (byte) doplasma::i#3 -- vbuz1=_inc_vbuz1 + inc.z i + // [29] phi from doplasma::@4 to doplasma::@3 [phi:doplasma::@4->doplasma::@3] + // [29] phi (byte) doplasma::c2b#3 = (byte) doplasma::c2b#2 [phi:doplasma::@4->doplasma::@3#0] -- register_copy + // [29] phi (byte) doplasma::c2a#3 = (byte) doplasma::c2a#2 [phi:doplasma::@4->doplasma::@3#1] -- register_copy + // [29] phi (byte) doplasma::i#3 = (byte) doplasma::i#2 [phi:doplasma::@4->doplasma::@3#2] -- register_copy + jmp __b3 + // doplasma::@2 + __b2: + // sinustable[c1a] + sinustable[c1b] + // [46] (byte~) doplasma::$1 ← *((const byte*) sinustable + (byte) doplasma::c1a#3) + *((const byte*) sinustable + (byte) doplasma::c1b#3) -- vbuaa=pbuc1_derefidx_vbuz1_plus_pbuc1_derefidx_vbuz2 + ldy.z c1a + lda sinustable,y + ldy.z c1b + clc + adc sinustable,y + // ybuf[ii] = (sinustable[c1a] + sinustable[c1b]) + // [47] *((const byte*) ybuf + (byte) doplasma::ii#3) ← (byte~) doplasma::$1 -- pbuc1_derefidx_vbuz1=vbuaa + ldy.z ii + sta ybuf,y + // c1a += 4 + // [48] (byte) doplasma::c1a#2 ← (byte) doplasma::c1a#3 + (byte) 4 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c1a + axs #-[4] + stx.z c1a + // c1b += 9 + // [49] (byte) doplasma::c1b#2 ← (byte) doplasma::c1b#3 + (byte) 9 -- vbuz1=vbuz1_plus_vbuc1 + lax.z c1b + axs #-[9] + stx.z c1b + // for (ii = 0; ii < 25; ++ii) + // [50] (byte) doplasma::ii#2 ← ++ (byte) doplasma::ii#3 -- vbuz1=_inc_vbuz1 + inc.z ii + // [27] phi from doplasma::@2 to doplasma::@1 [phi:doplasma::@2->doplasma::@1] + // [27] phi (byte) doplasma::c1b#3 = (byte) doplasma::c1b#2 [phi:doplasma::@2->doplasma::@1#0] -- register_copy + // [27] phi (byte) doplasma::c1a#3 = (byte) doplasma::c1a#2 [phi:doplasma::@2->doplasma::@1#1] -- register_copy + // [27] phi (byte) doplasma::ii#3 = (byte) doplasma::ii#2 [phi:doplasma::@2->doplasma::@1#2] -- register_copy + jmp __b1 +} + // end +end: { + // Ticks = last_time + // [51] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // start() + // [52] call start + jsr start + // end::@1 + // last_time -= Ticks + // [53] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // Ticks = last_time + // [54] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // print_word(Ticks) + // [55] (word) print_word::w#0 ← (word) Ticks#2 + // [56] call print_word + jsr print_word + // [57] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + // end::@2 + // print_ln() + // [58] call print_ln + // [61] phi from end::@2 to print_ln [phi:end::@2->print_ln] + jsr print_ln + // end::@return + // } + // [59] (word) last_time#2 ← (word) last_time#1 + // [60] return + rts +} + // print_ln +// Print a newline +print_ln: { + // [62] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1] + // [62] phi (byte*) print_line_cursor#8 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + // [62] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1] + // [62] phi (byte*) print_line_cursor#8 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy + // print_ln::@1 + __b1: + // print_line_cursor + $28 + // [63] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // while (print_line_cursorw) + // [66] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1 + lda.z w+1 + tax + // [67] call print_byte + // [71] phi from print_word to print_byte [phi:print_word->print_byte] + // [71] phi (byte*) print_char_cursor#35 = (byte*) 1024 [phi:print_word->print_byte#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [71] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + // print_word::@1 + // print_byte(print_byte] + // [71] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#10 [phi:print_word::@1->print_byte#0] -- register_copy + // [71] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + // print_word::@return + // } + // [70] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + // b>>4 + // [72] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuxx_ror_4 + txa + lsr + lsr + lsr + lsr + // print_char(print_hextab[b>>4]) + // [73] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa + tay + lda print_hextab,y + // [74] call print_char + // [79] phi from print_byte to print_char [phi:print_byte->print_char] + // [79] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#35 [phi:print_byte->print_char#0] -- register_copy + // [79] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + // print_byte::@1 + // b&$f + // [75] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuxx=vbuxx_band_vbuc1 + lda #$f + axs #0 + // print_char(print_hextab[b&$f]) + // [76] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuxx + lda print_hextab,x + // [77] call print_char + // [79] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + // [79] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#10 [phi:print_byte::@1->print_char#0] -- register_copy + // [79] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + // print_byte::@return + // } + // [78] return + rts +} + // print_char +// Print a single char +// print_char(byte register(A) ch) +print_char: { + // *(print_char_cursor++) = ch + // [80] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa + ldy #0 + sta (print_char_cursor),y + // *(print_char_cursor++) = ch; + // [81] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + // print_char::@return + // } + // [82] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // rand_seed = 6474 + // [84] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + // start::@return + // } + // [85] return + rts +} + // makechar +makechar: { + .label __5 = $15 + .label __8 = $13 + .label __9 = $13 + .label s = $12 + .label c = $10 + .label i = 8 + .label b = 9 + .label __10 = $13 + // [87] phi from makechar to makechar::@1 [phi:makechar->makechar::@1] + // [87] phi (word) makechar::c#3 = (byte) 0 [phi:makechar->makechar::@1#0] -- vwuz1=vbuc1 + lda #<0 + sta.z c + sta.z c+1 + // makechar::@1 + __b1: + // for (c = 0; c < 0x100; ++c) + // [88] if((word) makechar::c#3<(word) $100) goto makechar::@2 -- vwuz1_lt_vwuc1_then_la1 + lda.z c+1 + cmp #>$100 + bcc __b2 + bne !+ + lda.z c + cmp #<$100 + bcc __b2 + !: + // makechar::@return + // } + // [89] return + rts + // makechar::@2 + __b2: + // (char)c + // [90] (byte~) makechar::$1 ← (byte)(word) makechar::c#3 -- vbuaa=_byte_vwuz1 + lda.z c + // s = sinustable[(char)c] + // [91] (byte) makechar::s#1 ← *((const byte*) sinustable + (byte~) makechar::$1) -- vbuz1=pbuc1_derefidx_vbuaa + tay + lda sinustable,y + sta.z s + // [92] phi from makechar::@2 to makechar::@3 [phi:makechar::@2->makechar::@3] + // [92] phi (byte) makechar::i#3 = (byte) 0 [phi:makechar::@2->makechar::@3#0] -- vbuz1=vbuc1 + lda #0 + sta.z i + // makechar::@3 + __b3: + // for (i = 0; i < 8; ++i) + // [93] if((byte) makechar::i#3<(byte) 8) goto makechar::@5 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #8 + bcc b1 + // makechar::@4 + // for (c = 0; c < 0x100; ++c) + // [94] (word) makechar::c#2 ← ++ (word) makechar::c#3 -- vwuz1=_inc_vwuz1 + inc.z c + bne !+ + inc.z c+1 + !: + // [87] phi from makechar::@4 to makechar::@1 [phi:makechar::@4->makechar::@1] + // [87] phi (word) makechar::c#3 = (word) makechar::c#2 [phi:makechar::@4->makechar::@1#0] -- register_copy + jmp __b1 + // [95] phi from makechar::@3 to makechar::@5 [phi:makechar::@3->makechar::@5] + b1: + // [95] phi (byte) makechar::b#3 = (byte) 0 [phi:makechar::@3->makechar::@5#0] -- vbuz1=vbuc1 + lda #0 + sta.z b + // [95] phi (byte) makechar::ii#3 = (byte) 0 [phi:makechar::@3->makechar::@5#1] -- vbuyy=vbuc1 + tay + // makechar::@5 + __b5: + // for (ii = 0; ii < 8; ++ii) + // [96] if((byte) makechar::ii#3<(byte) 8) goto makechar::@6 -- vbuyy_lt_vbuc1_then_la1 + cpy #8 + bcc __b6 + // makechar::@7 + // c<<3 + // [97] (word~) makechar::$8 ← (word) makechar::c#3 << (byte) 3 -- vwuz1=vwuz2_rol_3 + lda.z c + asl + sta.z __8 + lda.z c+1 + rol + sta.z __8+1 + asl.z __8 + rol.z __8+1 + asl.z __8 + rol.z __8+1 + // (c<<3) + i + // [98] (word~) makechar::$9 ← (word~) makechar::$8 + (byte) makechar::i#3 -- vwuz1=vwuz1_plus_vbuz2 + lda.z i + clc + adc.z __9 + sta.z __9 + bcc !+ + inc.z __9+1 + !: + // ((char*)CHARSET) [(c<<3) + i] = b + // [99] (byte*~) makechar::$10 ← (byte*)(const word) CHARSET + (word~) makechar::$9 -- pbuz1=pbuc1_plus_vwuz1 + clc + lda.z __10 + adc #CHARSET + sta.z __10+1 + // [100] *((byte*~) makechar::$10) ← (byte) makechar::b#3 -- _deref_pbuz1=vbuz2 + lda.z b + ldy #0 + sta (__10),y + // for (i = 0; i < 8; ++i) + // [101] (byte) makechar::i#2 ← ++ (byte) makechar::i#3 -- vbuz1=_inc_vbuz1 + inc.z i + // [92] phi from makechar::@7 to makechar::@3 [phi:makechar::@7->makechar::@3] + // [92] phi (byte) makechar::i#3 = (byte) makechar::i#2 [phi:makechar::@7->makechar::@3#0] -- register_copy + jmp __b3 + // [102] phi from makechar::@5 to makechar::@6 [phi:makechar::@5->makechar::@6] + // makechar::@6 + __b6: + // rand() + // [103] call rand + jsr rand + // [104] (byte) rand::return#2 ← (byte) rand::return#0 + // makechar::@10 + // [105] (byte~) makechar::$4 ← (byte) rand::return#2 + // rand() & 0xFF + // [106] (byte~) makechar::$5 ← (byte~) makechar::$4 & (byte) $ff -- vbuz1=vbuaa_band_vbuc1 + and #$ff + sta.z __5 + // if ((rand() & 0xFF) > s) + // [107] if((byte~) makechar::$5<=(byte) makechar::s#1) goto makechar::@8 -- vbuz1_le_vbuz2_then_la1 + lda.z s + cmp.z __5 + bcs __b8 + // makechar::@9 + // b |= bittab[ii] + // [108] (byte) makechar::b#2 ← (byte) makechar::b#3 | *((const byte*) bittab + (byte) makechar::ii#3) -- vbuz1=vbuz1_bor_pbuc1_derefidx_vbuyy + lda bittab,y + ora.z b + sta.z b + // [109] phi from makechar::@10 makechar::@9 to makechar::@8 [phi:makechar::@10/makechar::@9->makechar::@8] + // [109] phi (byte) makechar::b#7 = (byte) makechar::b#3 [phi:makechar::@10/makechar::@9->makechar::@8#0] -- register_copy + // makechar::@8 + __b8: + // for (ii = 0; ii < 8; ++ii) + // [110] (byte) makechar::ii#2 ← ++ (byte) makechar::ii#3 -- vbuyy=_inc_vbuyy + iny + // [95] phi from makechar::@8 to makechar::@5 [phi:makechar::@8->makechar::@5] + // [95] phi (byte) makechar::b#3 = (byte) makechar::b#7 [phi:makechar::@8->makechar::@5#0] -- register_copy + // [95] phi (byte) makechar::ii#3 = (byte) makechar::ii#2 [phi:makechar::@8->makechar::@5#1] -- register_copy + jmp __b5 +} + // rand +rand: { + .label RAND_SEED = rand_seed + // asm + // asm { ldx#8 ldaRAND_SEED+0 __rand_loop: asl rolRAND_SEED+1 bcc__no_eor eor#$2D __no_eor: dex bne__rand_loop staRAND_SEED+0 } + ldx #8 + lda RAND_SEED+0 + __rand_loop: + asl + rol RAND_SEED+1 + bcc __no_eor + eor #$2d + __no_eor: + dex + bne __rand_loop + sta RAND_SEED+0 + // (char)rand_seed + // [112] (byte) rand::return#0 ← (byte)(word) rand_seed#0 -- vbuaa=_byte_vwuz1 + lda.z rand_seed + // rand::@return + // } + // [113] return + rts +} + // File Data + print_hextab: .text "0123456789abcdef" + // ((SCREEN2 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E); + .align $100 + sinustable: .byte $80, $7d, $7a, $77, $74, $70, $6d, $6a, $67, $64, $61, $5e, $5b, $58, $55, $52, $4f, $4d, $4a, $47, $44, $41, $3f, $3c, $39, $37, $34, $32, $2f, $2d, $2b, $28, $26, $24, $22, $20, $1e, $1c, $1a, $18, $16, $15, $13, $11, $10, $f, $d, $c, $b, $a, 8, 7, 6, 6, 5, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 6, 7, 8, $a, $b, $c, $d, $f, $10, $11, $13, $15, $16, $18, $1a, $1c, $1e, $20, $22, $24, $26, $28, $2b, $2d, $2f, $32, $34, $37, $39, $3c, $3f, $41, $44, $47, $4a, $4d, $4f, $52, $55, $58, $5b, $5e, $61, $64, $67, $6a, $6d, $70, $74, $77, $7a, $7d, $80, $83, $86, $89, $8c, $90, $93, $96, $99, $9c, $9f, $a2, $a5, $a8, $ab, $ae, $b1, $b3, $b6, $b9, $bc, $bf, $c1, $c4, $c7, $c9, $cc, $ce, $d1, $d3, $d5, $d8, $da, $dc, $de, $e0, $e2, $e4, $e6, $e8, $ea, $eb, $ed, $ef, $f0, $f1, $f3, $f4, $f5, $f6, $f8, $f9, $fa, $fa, $fb, $fc, $fd, $fd, $fe, $fe, $fe, $ff, $ff, $ff, $ff, $ff, $ff, $ff, $fe, $fe, $fe, $fd, $fd, $fc, $fb, $fa, $fa, $f9, $f8, $f6, $f5, $f4, $f3, $f1, $f0, $ef, $ed, $eb, $ea, $e8, $e6, $e4, $e2, $e0, $de, $dc, $da, $d8, $d5, $d3, $d1, $ce, $cc, $c9, $c7, $c4, $c1, $bf, $bc, $b9, $b6, $b3, $b1, $ae, $ab, $a8, $a5, $a2, $9f, $9c, $99, $96, $93, $90, $8c, $89, $86, $83 + xbuf: .fill $28, 0 + ybuf: .fill $19, 0 + bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 + diff --git a/src/test/ref/millfork-benchmarks/plasma-kc.sym b/src/test/ref/millfork-benchmarks/plasma-kc.sym new file mode 100644 index 000000000..76eac6249 --- /dev/null +++ b/src/test/ref/millfork-benchmarks/plasma-kc.sym @@ -0,0 +1,204 @@ +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(const word) CHARSET = (number) $e800 +(const byte*) CIA2_PORT_A = (byte*) 56576 +(const byte) PAGE1 = (number) $8a +(const byte) PAGE2 = (number) $9a +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const word) SCREEN1 = (number) $e000 +(const word) SCREEN2 = (number) $e400 +(word) Ticks +(word) Ticks#1 Ticks zp[2]:16 2.0 +(word) Ticks#2 Ticks_1 zp[2]:19 4.0 +(const byte*) VIC_MEMORY = (byte*) 53272 +(const byte*) bittab = { (byte) 1, (byte) 2, (byte) 4, (byte) 8, (byte) $10, (byte) $20, (byte) $40, (byte) $80 } +(void()) doplasma((byte*) doplasma::scrn) +(byte~) doplasma::$1 reg byte a 202.0 +(byte~) doplasma::$3 reg byte a 202.0 +(byte~) doplasma::$6 reg byte a 2002.0 +(label) doplasma::@1 +(label) doplasma::@2 +(label) doplasma::@3 +(label) doplasma::@4 +(label) doplasma::@5 +(label) doplasma::@6 +(label) doplasma::@7 +(label) doplasma::@8 +(label) doplasma::@return +(byte) doplasma::c1A +(byte) doplasma::c1B +(byte) doplasma::c1a +(byte) doplasma::c1a#2 c1a zp[1]:9 67.33333333333333 +(byte) doplasma::c1a#3 c1a zp[1]:9 75.75 +(byte) doplasma::c1b +(byte) doplasma::c1b#2 c1b zp[1]:18 101.0 +(byte) doplasma::c1b#3 c1b zp[1]:18 60.599999999999994 +(byte) doplasma::c2A +(const byte) doplasma::c2A#0 c2A = (byte) 0 +(byte) doplasma::c2B +(const byte) doplasma::c2B#0 c2B = (byte) 0 +(byte) doplasma::c2a +(byte) doplasma::c2a#2 c2a zp[1]:2 67.33333333333333 +(byte) doplasma::c2a#3 c2a zp[1]:2 75.75 +(byte) doplasma::c2b +(byte) doplasma::c2b#2 c2b zp[1]:3 101.0 +(byte) doplasma::c2b#3 c2b zp[1]:3 60.599999999999994 +(byte) doplasma::i +(byte) doplasma::i#2 i zp[1]:21 202.0 +(byte) doplasma::i#3 i zp[1]:21 67.33333333333333 +(byte) doplasma::ii +(byte) doplasma::ii#2 ii zp[1]:8 202.0 +(byte) doplasma::ii#3 ii zp[1]:8 67.33333333333333 +(byte) doplasma::j +(byte) doplasma::j#2 reg byte y 2002.0 +(byte) doplasma::j#3 reg byte y 1251.25 +(byte) doplasma::jj +(byte) doplasma::jj#2 reg byte x 202.0 +(byte) doplasma::jj#3 reg byte x 163.0 +(byte*) doplasma::scrn +(byte*) doplasma::scrn#0 scrn zp[2]:6 101.0 +(byte*) doplasma::scrn#13 scrn zp[2]:6 6.733333333333333 +(byte*) doplasma::scrn#6 scrn zp[2]:6 186.28571428571428 +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@return +(word) last_time +(word) last_time#0 last_time zp[2]:10 0.2608695652173913 +(word) last_time#1 last_time zp[2]:10 1.0 +(word) last_time#2 last_time zp[2]:10 20.0 +(signed word()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@return +(byte) main::block +(byte) main::block#1 block zp[1]:14 0.46153846153846156 +(word) main::count +(word) main::count#1 count zp[2]:4 22.0 +(word) main::count#2 count zp[2]:4 4.714285714285714 +(signed word) main::return +(byte) main::tmp +(byte) main::tmp#1 reg byte a 4.0 +(byte) main::v +(byte) main::v#1 v zp[1]:15 0.4444444444444444 +(void()) makechar() +(byte~) makechar::$1 reg byte a 22.0 +(byte*~) makechar::$10 zp[2]:19 202.0 +(byte~) makechar::$4 reg byte a 2002.0 +(byte~) makechar::$5 zp[1]:21 2002.0 +(word~) makechar::$8 zp[2]:19 202.0 +(word~) makechar::$9 zp[2]:19 202.0 +(label) makechar::@1 +(label) makechar::@10 +(label) makechar::@2 +(label) makechar::@3 +(label) makechar::@4 +(label) makechar::@5 +(label) makechar::@6 +(label) makechar::@7 +(label) makechar::@8 +(label) makechar::@9 +(label) makechar::@return +(byte) makechar::b +(byte) makechar::b#2 b zp[1]:9 2002.0 +(byte) makechar::b#3 b zp[1]:9 282.1818181818182 +(byte) makechar::b#7 b zp[1]:9 1501.5 +(word) makechar::c +(word) makechar::c#2 c zp[2]:16 22.0 +(word) makechar::c#3 c zp[2]:16 6.090909090909091 +(byte) makechar::i +(byte) makechar::i#2 i zp[1]:8 202.0 +(byte) makechar::i#3 i zp[1]:8 23.764705882352942 +(byte) makechar::ii +(byte) makechar::ii#2 reg byte y 2002.0 +(byte) makechar::ii#3 reg byte y 400.4 +(byte) makechar::s +(byte) makechar::s#1 s zp[1]:18 53.26315789473684 +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 reg byte a 4.0 +(byte~) print_byte::$2 reg byte x 4.0 +(label) print_byte::@1 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 reg byte x 4.0 +(byte) print_byte::b#1 reg byte x 4.0 +(byte) print_byte::b#2 reg byte x 2.0 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 reg byte a 4.0 +(byte) print_char::ch#1 reg byte a 4.0 +(byte) print_char::ch#2 reg byte a 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#10 print_char_cursor zp[2]:6 1.0 +(byte*) print_char_cursor#25 print_char_cursor zp[2]:6 4.0 +(byte*) print_char_cursor#35 print_char_cursor zp[2]:6 1.3333333333333333 +(const byte*) print_hextab = (string) "0123456789abcdef"z +(byte*) print_line_cursor +(byte*) print_line_cursor#1 print_line_cursor zp[2]:4 16.5 +(byte*) print_line_cursor#8 print_line_cursor zp[2]:4 22.0 +(void()) print_ln() +(label) print_ln::@1 +(label) print_ln::@return +(byte*) print_screen +(void()) print_word((word) print_word::w) +(label) print_word::@1 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 w zp[2]:19 2.0 +(byte()) rand() +(label) rand::@return +(const word*) rand::RAND_SEED = &(word) rand_seed +(byte) rand::return +(byte) rand::return#0 reg byte a 334.33333333333337 +(byte) rand::return#2 reg byte a 2002.0 +(word) rand_seed +(word) rand_seed#0 rand_seed zp[2]:12 0.06451612903225806 +(word) rand_seed#22 rand_seed zp[2]:12 20.0 +(const byte*) sinustable = { (byte) $80, (byte) $7d, (byte) $7a, (byte) $77, (byte) $74, (byte) $70, (byte) $6d, (byte) $6a, (byte) $67, (byte) $64, (byte) $61, (byte) $5e, (byte) $5b, (byte) $58, (byte) $55, (byte) $52, (byte) $4f, (byte) $4d, (byte) $4a, (byte) $47, (byte) $44, (byte) $41, (byte) $3f, (byte) $3c, (byte) $39, (byte) $37, (byte) $34, (byte) $32, (byte) $2f, (byte) $2d, (byte) $2b, (byte) $28, (byte) $26, (byte) $24, (byte) $22, (byte) $20, (byte) $1e, (byte) $1c, (byte) $1a, (byte) $18, (byte) $16, (byte) $15, (byte) $13, (byte) $11, (byte) $10, (byte) $f, (byte) $d, (byte) $c, (byte) $b, (byte) $a, (byte) 8, (byte) 7, (byte) 6, (byte) 6, (byte) 5, (byte) 4, (byte) 3, (byte) 3, (byte) 2, (byte) 2, (byte) 2, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 2, (byte) 2, (byte) 2, (byte) 3, (byte) 3, (byte) 4, (byte) 5, (byte) 6, (byte) 6, (byte) 7, (byte) 8, (byte) $a, (byte) $b, (byte) $c, (byte) $d, (byte) $f, (byte) $10, (byte) $11, (byte) $13, (byte) $15, (byte) $16, (byte) $18, (byte) $1a, (byte) $1c, (byte) $1e, (byte) $20, (byte) $22, (byte) $24, (byte) $26, (byte) $28, (byte) $2b, (byte) $2d, (byte) $2f, (byte) $32, (byte) $34, (byte) $37, (byte) $39, (byte) $3c, (byte) $3f, (byte) $41, (byte) $44, (byte) $47, (byte) $4a, (byte) $4d, (byte) $4f, (byte) $52, (byte) $55, (byte) $58, (byte) $5b, (byte) $5e, (byte) $61, (byte) $64, (byte) $67, (byte) $6a, (byte) $6d, (byte) $70, (byte) $74, (byte) $77, (byte) $7a, (byte) $7d, (byte) $80, (byte) $83, (byte) $86, (byte) $89, (byte) $8c, (byte) $90, (byte) $93, (byte) $96, (byte) $99, (byte) $9c, (byte) $9f, (byte) $a2, (byte) $a5, (byte) $a8, (byte) $ab, (byte) $ae, (byte) $b1, (byte) $b3, (byte) $b6, (byte) $b9, (byte) $bc, (byte) $bf, (byte) $c1, (byte) $c4, (byte) $c7, (byte) $c9, (byte) $cc, (byte) $ce, (byte) $d1, (byte) $d3, (byte) $d5, (byte) $d8, (byte) $da, (byte) $dc, (byte) $de, (byte) $e0, (byte) $e2, (byte) $e4, (byte) $e6, (byte) $e8, (byte) $ea, (byte) $eb, (byte) $ed, (byte) $ef, (byte) $f0, (byte) $f1, (byte) $f3, (byte) $f4, (byte) $f5, (byte) $f6, (byte) $f8, (byte) $f9, (byte) $fa, (byte) $fa, (byte) $fb, (byte) $fc, (byte) $fd, (byte) $fd, (byte) $fe, (byte) $fe, (byte) $fe, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $ff, (byte) $fe, (byte) $fe, (byte) $fe, (byte) $fd, (byte) $fd, (byte) $fc, (byte) $fb, (byte) $fa, (byte) $fa, (byte) $f9, (byte) $f8, (byte) $f6, (byte) $f5, (byte) $f4, (byte) $f3, (byte) $f1, (byte) $f0, (byte) $ef, (byte) $ed, (byte) $eb, (byte) $ea, (byte) $e8, (byte) $e6, (byte) $e4, (byte) $e2, (byte) $e0, (byte) $de, (byte) $dc, (byte) $da, (byte) $d8, (byte) $d5, (byte) $d3, (byte) $d1, (byte) $ce, (byte) $cc, (byte) $c9, (byte) $c7, (byte) $c4, (byte) $c1, (byte) $bf, (byte) $bc, (byte) $b9, (byte) $b6, (byte) $b3, (byte) $b1, (byte) $ae, (byte) $ab, (byte) $a8, (byte) $a5, (byte) $a2, (byte) $9f, (byte) $9c, (byte) $99, (byte) $96, (byte) $93, (byte) $90, (byte) $8c, (byte) $89, (byte) $86, (byte) $83 } +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time +(const byte*) xbuf = { fill( $28, 0) } +(const byte*) ybuf = { fill( $19, 0) } + +zp[1]:2 [ doplasma::c2a#3 doplasma::c2a#2 ] +zp[1]:3 [ doplasma::c2b#3 doplasma::c2b#2 ] +reg byte x [ doplasma::jj#3 doplasma::jj#2 ] +reg byte y [ doplasma::j#3 doplasma::j#2 ] +zp[2]:4 [ print_line_cursor#8 print_line_cursor#1 main::count#2 main::count#1 ] +reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +zp[2]:6 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 doplasma::scrn#6 doplasma::scrn#0 doplasma::scrn#13 ] +zp[1]:8 [ makechar::i#3 makechar::i#2 doplasma::ii#3 doplasma::ii#2 ] +reg byte y [ makechar::ii#3 makechar::ii#2 ] +zp[1]:9 [ makechar::b#3 makechar::b#7 makechar::b#2 doplasma::c1a#3 doplasma::c1a#2 ] +zp[2]:10 [ last_time#0 last_time#1 last_time#2 ] +zp[2]:12 [ rand_seed#0 rand_seed#22 ] +zp[1]:14 [ main::block#1 ] +reg byte a [ main::tmp#1 ] +zp[1]:15 [ main::v#1 ] +reg byte a [ doplasma::$6 ] +reg byte a [ doplasma::$3 ] +reg byte a [ doplasma::$1 ] +zp[2]:16 [ Ticks#1 makechar::c#3 makechar::c#2 ] +reg byte a [ print_byte::$0 ] +reg byte x [ print_byte::$2 ] +reg byte a [ makechar::$1 ] +zp[1]:18 [ makechar::s#1 doplasma::c1b#3 doplasma::c1b#2 ] +zp[2]:19 [ makechar::$8 makechar::$9 makechar::$10 Ticks#2 print_word::w#0 ] +reg byte a [ rand::return#2 ] +reg byte a [ makechar::$4 ] +zp[1]:21 [ makechar::$5 doplasma::i#3 doplasma::i#2 ] +reg byte a [ rand::return#0 ] diff --git a/src/test/ref/millfork-benchmarks/romsum-kc.asm b/src/test/ref/millfork-benchmarks/romsum-kc.asm new file mode 100644 index 000000000..c11a5f584 --- /dev/null +++ b/src/test/ref/millfork-benchmarks/romsum-kc.asm @@ -0,0 +1,335 @@ +.pc = $801 "Basic" +:BasicUpstart(__b1) +.pc = $80d "Program" + .label rom = $e000 + .label print_char_cursor = 9 + .label print_line_cursor = 2 + .label last_time = $b + .label rand_seed = $d + .label Ticks = $f + .label Ticks_1 = $11 +__b1: + lda #<0 + sta.z last_time + sta.z last_time+1 + sta.z rand_seed + sta.z rand_seed+1 + jsr main + rts +main: { + .label i = $f + jsr start + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + lda #<0 + sta.z i + sta.z i+1 + __b1: + lda.z i+1 + cmp #>6 + bcc __b2 + bne !+ + lda.z i + cmp #<6 + bcc __b2 + !: + jsr end + rts + __b2: + jsr sum + jsr print_word_decimal + jsr print_ln + inc.z i + bne !+ + inc.z i+1 + !: + lda.z print_line_cursor + sta.z print_char_cursor + lda.z print_line_cursor+1 + sta.z print_char_cursor+1 + jmp __b1 +} +// Print a newline +print_ln: { + __b1: + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1 + !: + rts +} +// Print a word as DECIMAL +// print_word_decimal(word zeropage(5) w) +print_word_decimal: { + .label w = 5 + jsr utoa + jsr print_str + rts +} +// Print a zero-terminated string +// print_str(byte* zeropage(5) str) +print_str: { + .label str = 5 + lda #decimal_digits + sta.z str+1 + __b1: + ldy #0 + lda (str),y + cmp #0 + bne __b2 + rts + __b2: + ldy #0 + lda (str),y + sta (print_char_cursor),y + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + inc.z str + bne !+ + inc.z str+1 + !: + jmp __b1 +} +// Converts unsigned number value to a string representing it in RADIX format. +// If the leading digits are zero they are not included in the string. +// - value : The number to be converted to RADIX +// - buffer : receives the string representing the number and zero-termination. +// - radix : The radix to convert the number to (from the enum RADIX) +// utoa(word zeropage(5) value, byte* zeropage(7) buffer) +utoa: { + .const max_digits = 5 + .label digit_value = $11 + .label buffer = 7 + .label digit = 4 + .label value = 5 + lda #decimal_digits + sta.z buffer+1 + ldx #0 + txa + sta.z digit + __b1: + lda.z digit + cmp #max_digits-1 + bcc __b2 + lda.z value + tay + lda DIGITS,y + ldy #0 + sta (buffer),y + inc.z buffer + bne !+ + inc.z buffer+1 + !: + lda #0 + tay + sta (buffer),y + rts + __b2: + lda.z digit + asl + tay + lda RADIX_DECIMAL_VALUES,y + sta.z digit_value + lda RADIX_DECIMAL_VALUES+1,y + sta.z digit_value+1 + cpx #0 + bne __b5 + cmp.z value+1 + bne !+ + lda.z digit_value + cmp.z value + beq __b5 + !: + bcc __b5 + __b4: + inc.z digit + jmp __b1 + __b5: + jsr utoa_append + inc.z buffer + bne !+ + inc.z buffer+1 + !: + ldx #1 + jmp __b4 +} +// Used to convert a single digit of an unsigned number value to a string representation +// Counts a single digit up from '0' as long as the value is larger than sub. +// Each time the digit is increased sub is subtracted from value. +// - buffer : pointer to the char that receives the digit +// - value : The value where the digit will be derived from +// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. +// (For decimal the subs used are 10000, 1000, 100, 10, 1) +// returns : the value reduced by sub * digit so that it is less than sub. +// utoa_append(byte* zeropage(7) buffer, word zeropage(5) value, word zeropage($11) sub) +utoa_append: { + .label buffer = 7 + .label value = 5 + .label sub = $11 + .label return = 5 + ldx #0 + __b1: + lda.z sub+1 + cmp.z value+1 + bne !+ + lda.z sub + cmp.z value + beq __b2 + !: + bcc __b2 + lda DIGITS,x + ldy #0 + sta (buffer),y + rts + __b2: + inx + lda.z value + sec + sbc.z sub + sta.z value + lda.z value+1 + sbc.z sub+1 + sta.z value+1 + jmp __b1 +} +sum: { + .label s = 5 + .label p = 7 + .label return = 5 + lda #rom + sta.z p+1 + lda #<0 + sta.z s + sta.z s+1 + tax + /* doing it page-by-page is faster than doing just one huge loop */ + __b1: + cpx #$20 + bcc b1 + rts + b1: + ldy #0 + __b2: + lda (p),y + clc + adc.z s + sta.z s + bcc !+ + inc.z s+1 + !: + iny + cpy #0 + bne __b2 + clc + lda.z p + adc #<$100 + sta.z p + lda.z p+1 + adc #>$100 + sta.z p+1 + inx + jmp __b1 +} +end: { + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + jsr start + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + jsr print_word + jsr print_ln + rts +} +// Print a word as HEX +// print_word(word zeropage($11) w) +print_word: { + .label w = $11 + lda.z w+1 + tax + jsr print_byte + lda.z w + tax + jsr print_byte + rts +} +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + txa + lsr + lsr + lsr + lsr + tay + lda DIGITS,y + jsr print_char + lda #$f + axs #0 + lda DIGITS,x + jsr print_char + rts +} +// Print a single char +// print_char(byte register(A) ch) +print_char: { + ldy #0 + sta (print_char_cursor),y + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + rts +} +start: { + .label LAST_TIME = last_time + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + rts +} + // The digits used for numbers + DIGITS: .text "0123456789abcdef" + // Values of decimal digits + RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a + // Digits used for storing the decimal word + decimal_digits: .fill 6, 0 diff --git a/src/test/ref/millfork-benchmarks/romsum-kc.cfg b/src/test/ref/millfork-benchmarks/romsum-kc.cfg new file mode 100644 index 000000000..b5f3b17dc --- /dev/null +++ b/src/test/ref/millfork-benchmarks/romsum-kc.cfg @@ -0,0 +1,257 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] (word) last_time#0 ← (word) 0 + to:@2 +@2: scope:[] from @1 + [2] (word) rand_seed#20 ← (word) 0 + to:@3 +@3: scope:[] from @2 + [3] phi() + [4] call main + to:@end +@end: scope:[] from @3 + [5] phi() + +(signed word()) main() +main: scope:[main] from @3 + [6] phi() + [7] call start + to:main::@1 +main::@1: scope:[main] from main main::@6 + [8] (byte*) print_line_cursor#20 ← phi( main::@6/(byte*) print_line_cursor#1 main/(byte*) 1024 ) + [8] (byte*) print_char_cursor#51 ← phi( main::@6/(byte*) print_char_cursor#71 main/(byte*) 1024 ) + [8] (word) main::i#3 ← phi( main::@6/(word) main::i#2 main/(byte) 0 ) + [9] if((word) main::i#3<(byte) 6) goto main::@2 + to:main::@3 +main::@3: scope:[main] from main::@1 + [10] phi() + [11] call end + to:main::@return +main::@return: scope:[main] from main::@3 + [12] return + to:@return +main::@2: scope:[main] from main::@1 + [13] phi() + [14] call sum + [15] (word) sum::return#2 ← (word) sum::s#3 + to:main::@4 +main::@4: scope:[main] from main::@2 + [16] (word) print_word_decimal::w#0 ← (word) sum::return#2 + [17] call print_word_decimal + to:main::@5 +main::@5: scope:[main] from main::@4 + [18] phi() + [19] call print_ln + to:main::@6 +main::@6: scope:[main] from main::@5 + [20] (word) main::i#2 ← ++ (word) main::i#3 + [21] (byte*) print_char_cursor#71 ← (byte*) print_line_cursor#1 + to:main::@1 + +(void()) print_ln() +print_ln: scope:[print_ln] from end::@2 main::@5 + [22] (byte*) print_char_cursor#46 ← phi( end::@2/(byte*) print_char_cursor#13 main::@5/(byte*) print_char_cursor#2 ) + to:print_ln::@1 +print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 + [23] (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#20 print_ln::@1/(byte*) print_line_cursor#1 ) + [24] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 + [25] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1 + to:print_ln::@return +print_ln::@return: scope:[print_ln] from print_ln::@1 + [26] return + to:@return + +(void()) print_word_decimal((word) print_word_decimal::w) +print_word_decimal: scope:[print_word_decimal] from main::@4 + [27] (word) utoa::value#1 ← (word) print_word_decimal::w#0 + [28] call utoa + to:print_word_decimal::@1 +print_word_decimal::@1: scope:[print_word_decimal] from print_word_decimal + [29] phi() + [30] call print_str + to:print_word_decimal::@return +print_word_decimal::@return: scope:[print_word_decimal] from print_word_decimal::@1 + [31] return + to:@return + +(void()) print_str((byte*) print_str::str) +print_str: scope:[print_str] from print_word_decimal::@1 + [32] phi() + to:print_str::@1 +print_str::@1: scope:[print_str] from print_str print_str::@2 + [33] (byte*) print_char_cursor#2 ← phi( print_str/(byte*) print_char_cursor#51 print_str::@2/(byte*) print_char_cursor#1 ) + [33] (byte*) print_str::str#2 ← phi( print_str/(const byte*) decimal_digits print_str::@2/(byte*) print_str::str#0 ) + [34] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 + to:print_str::@return +print_str::@return: scope:[print_str] from print_str::@1 + [35] return + to:@return +print_str::@2: scope:[print_str] from print_str::@1 + [36] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2) + [37] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2 + [38] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 + to:print_str::@1 + +(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix) +utoa: scope:[utoa] from print_word_decimal + [39] phi() + to:utoa::@1 +utoa::@1: scope:[utoa] from utoa utoa::@4 + [40] (byte*) utoa::buffer#11 ← phi( utoa::@4/(byte*) utoa::buffer#14 utoa/(const byte*) decimal_digits ) + [40] (byte) utoa::started#2 ← phi( utoa::@4/(byte) utoa::started#4 utoa/(byte) 0 ) + [40] (word) utoa::value#2 ← phi( utoa::@4/(word) utoa::value#6 utoa/(word) utoa::value#1 ) + [40] (byte) utoa::digit#2 ← phi( utoa::@4/(byte) utoa::digit#1 utoa/(byte) 0 ) + [41] if((byte) utoa::digit#2<(const byte) utoa::max_digits#1-(byte) 1) goto utoa::@2 + to:utoa::@3 +utoa::@3: scope:[utoa] from utoa::@1 + [42] (byte~) utoa::$4 ← (byte)(word) utoa::value#2 + [43] *((byte*) utoa::buffer#11) ← *((const byte*) DIGITS + (byte~) utoa::$4) + [44] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11 + [45] *((byte*) utoa::buffer#3) ← (byte) 0 + to:utoa::@return +utoa::@return: scope:[utoa] from utoa::@3 + [46] return + to:@return +utoa::@2: scope:[utoa] from utoa::@1 + [47] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1 + [48] (word) utoa::digit_value#0 ← *((const word*) RADIX_DECIMAL_VALUES + (byte~) utoa::$11) + [49] if((byte) 0!=(byte) utoa::started#2) goto utoa::@5 + to:utoa::@7 +utoa::@7: scope:[utoa] from utoa::@2 + [50] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5 + to:utoa::@4 +utoa::@4: scope:[utoa] from utoa::@6 utoa::@7 + [51] (byte*) utoa::buffer#14 ← phi( utoa::@7/(byte*) utoa::buffer#11 utoa::@6/(byte*) utoa::buffer#4 ) + [51] (byte) utoa::started#4 ← phi( utoa::@7/(byte) utoa::started#2 utoa::@6/(byte) 1 ) + [51] (word) utoa::value#6 ← phi( utoa::@7/(word) utoa::value#2 utoa::@6/(word) utoa::value#0 ) + [52] (byte) utoa::digit#1 ← ++ (byte) utoa::digit#2 + to:utoa::@1 +utoa::@5: scope:[utoa] from utoa::@2 utoa::@7 + [53] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11 + [54] (word) utoa_append::value#0 ← (word) utoa::value#2 + [55] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0 + [56] call utoa_append + [57] (word) utoa_append::return#0 ← (word) utoa_append::value#2 + to:utoa::@6 +utoa::@6: scope:[utoa] from utoa::@5 + [58] (word) utoa::value#0 ← (word) utoa_append::return#0 + [59] (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#11 + to:utoa::@4 + +(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub) +utoa_append: scope:[utoa_append] from utoa::@5 + [60] phi() + to:utoa_append::@1 +utoa_append::@1: scope:[utoa_append] from utoa_append utoa_append::@2 + [61] (byte) utoa_append::digit#2 ← phi( utoa_append/(byte) 0 utoa_append::@2/(byte) utoa_append::digit#1 ) + [61] (word) utoa_append::value#2 ← phi( utoa_append/(word) utoa_append::value#0 utoa_append::@2/(word) utoa_append::value#1 ) + [62] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 + to:utoa_append::@3 +utoa_append::@3: scope:[utoa_append] from utoa_append::@1 + [63] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2) + to:utoa_append::@return +utoa_append::@return: scope:[utoa_append] from utoa_append::@3 + [64] return + to:@return +utoa_append::@2: scope:[utoa_append] from utoa_append::@1 + [65] (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2 + [66] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0 + to:utoa_append::@1 + +(word()) sum() +sum: scope:[sum] from main::@2 + [67] phi() + to:sum::@1 +sum::@1: scope:[sum] from sum sum::@3 + [68] (byte*) sum::p#5 ← phi( sum/(const byte*) rom sum::@3/(byte*) sum::p#2 ) + [68] (word) sum::s#3 ← phi( sum/(byte) 0 sum::@3/(word) sum::s#2 ) + [68] (byte) sum::page#3 ← phi( sum/(byte) 0 sum::@3/(byte) sum::page#2 ) + [69] if((byte) sum::page#3<(byte) $20) goto sum::@2 + to:sum::@return +sum::@return: scope:[sum] from sum::@1 + [70] return + to:@return +sum::@2: scope:[sum] from sum::@1 sum::@2 + [71] (word) sum::s#4 ← phi( sum::@1/(word) sum::s#3 sum::@2/(word) sum::s#2 ) + [71] (byte) sum::i#3 ← phi( sum::@1/(byte) 0 sum::@2/(byte) sum::i#2 ) + [72] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3) + [73] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 + [74] (byte) sum::i#2 ← ++ (byte) sum::i#3 + [75] if((byte) 0!=(byte) sum::i#2) goto sum::@2 + to:sum::@3 +sum::@3: scope:[sum] from sum::@2 + [76] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100 + [77] (byte) sum::page#2 ← ++ (byte) sum::page#3 + to:sum::@1 + +(void()) end() +end: scope:[end] from main::@3 + [78] (word) Ticks#1 ← (word) last_time#0 + [79] call start + to:end::@1 +end::@1: scope:[end] from end + [80] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 + [81] (word) Ticks#2 ← (word) last_time#1 + [82] (word) print_word::w#0 ← (word) Ticks#2 + [83] call print_word + to:end::@2 +end::@2: scope:[end] from end::@1 + [84] phi() + [85] call print_ln + to:end::@return +end::@return: scope:[end] from end::@2 + [86] (word) last_time#2 ← (word) last_time#1 + [87] return + to:@return + +(void()) print_word((word) print_word::w) +print_word: scope:[print_word] from end::@1 + [88] (byte) print_byte::b#0 ← > (word) print_word::w#0 + [89] call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + [90] (byte) print_byte::b#1 ← < (word) print_word::w#0 + [91] call print_byte + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@1 + [92] return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + [93] (byte*) print_char_cursor#49 ← phi( print_word/(byte*) print_char_cursor#51 print_word::@1/(byte*) print_char_cursor#13 ) + [93] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + [94] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 + [95] (byte) print_char::ch#0 ← *((const byte*) DIGITS + (byte~) print_byte::$0) + [96] call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + [97] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f + [98] (byte) print_char::ch#1 ← *((const byte*) DIGITS + (byte~) print_byte::$2) + [99] call print_char + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@1 + [100] return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + [101] (byte*) print_char_cursor#35 ← phi( print_byte/(byte*) print_char_cursor#49 print_byte::@1/(byte*) print_char_cursor#13 ) + [101] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + [102] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 + [103] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#35 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + [104] return + to:@return + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + [106] (word) rand_seed#0 ← (word) $194a + to:start::@return +start::@return: scope:[start] from start + [107] return + to:@return diff --git a/src/test/ref/millfork-benchmarks/romsum-kc.log b/src/test/ref/millfork-benchmarks/romsum-kc.log new file mode 100644 index 000000000..69b43c310 --- /dev/null +++ b/src/test/ref/millfork-benchmarks/romsum-kc.log @@ -0,0 +1,4736 @@ +Resolved forward reference rand_seed to (word) rand_seed +Setting inferred volatile on symbol affected by address-of (word) last_time +Setting inferred volatile on symbol affected by address-of (word) rand_seed +Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6 +Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1 +Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1 +Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit) +Fixing pointer array-indexing *((dword*) ultoa::digit_values + (byte) ultoa::digit) +Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src) +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_lines::str) +Warning! Adding boolean cast to non-boolean condition (byte) print_str_lines::ch +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str::str) +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_at::str) +Warning! Adding boolean cast to non-boolean condition (byte) sum::i +Warning! Adding boolean cast to non-boolean sub-expression (byte) print_str_lines::ch +Identified constant variable (byte*) HEAP_TOP +Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx +Culled Empty Block (label) @1 +Culled Empty Block (label) @2 +Culled Empty Block (label) @3 +Culled Empty Block (label) @4 +Culled Empty Block (label) @5 +Culled Empty Block (label) @6 +Culled Empty Block (label) @7 +Culled Empty Block (label) @8 +Culled Empty Block (label) utoa::@13 +Culled Empty Block (label) utoa::@5 +Culled Empty Block (label) utoa::@14 +Culled Empty Block (label) utoa::@6 +Culled Empty Block (label) utoa::@15 +Culled Empty Block (label) utoa::@7 +Culled Empty Block (label) utoa::@16 +Culled Empty Block (label) utoa::@17 +Culled Empty Block (label) utoa::@22 +Culled Empty Block (label) utoa::@23 +Culled Empty Block (label) utoa::@25 +Culled Empty Block (label) @9 +Culled Empty Block (label) utoa_append::@4 +Culled Empty Block (label) utoa_append::@5 +Culled Empty Block (label) utoa_append::@6 +Culled Empty Block (label) utoa_append::@7 +Culled Empty Block (label) @10 +Culled Empty Block (label) @11 +Culled Empty Block (label) @13 +Culled Empty Block (label) @14 +Culled Empty Block (label) print_str::@4 +Culled Empty Block (label) print_str::@3 +Culled Empty Block (label) print_str::@5 +Culled Empty Block (label) print_str::@6 +Culled Empty Block (label) @15 +Culled Empty Block (label) @16 +Culled Empty Block (label) @17 +Culled Empty Block (label) @18 +Culled Empty Block (label) @19 +Culled Empty Block (label) @20 +Culled Empty Block (label) @21 +Culled Empty Block (label) @22 +Culled Empty Block (label) @23 +Culled Empty Block (label) @24 +Culled Empty Block (label) @25 +Culled Empty Block (label) @26 +Culled Empty Block (label) @27 +Culled Empty Block (label) @28 +Culled Empty Block (label) @29 +Culled Empty Block (label) @30 +Culled Empty Block (label) @31 +Culled Empty Block (label) @32 +Culled Empty Block (label) @33 +Culled Empty Block (label) @34 +Culled Empty Block (label) @35 +Culled Empty Block (label) @36 +Culled Empty Block (label) @37 +Culled Empty Block (label) @38 +Culled Empty Block (label) @39 +Culled Empty Block (label) @40 +Culled Empty Block (label) @41 +Culled Empty Block (label) @43 +Culled Empty Block (label) @45 +Culled Empty Block (label) sum::@7 +Culled Empty Block (label) sum::@8 +Culled Empty Block (label) sum::@6 +Culled Empty Block (label) sum::@9 +Culled Empty Block (label) @46 +Culled Empty Block (label) main::@4 +Culled Empty Block (label) main::@5 +Culled Empty Block (label) main::@6 +Culled Empty Block (label) main::@7 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@12 + +(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix) +utoa: scope:[utoa] from print_word_decimal + (byte*) utoa::buffer#21 ← phi( print_word_decimal/(byte*) utoa::buffer#5 ) + (word) utoa::value#12 ← phi( print_word_decimal/(word) utoa::value#1 ) + (byte) utoa::radix#1 ← phi( print_word_decimal/(byte) utoa::radix#0 ) + (byte) utoa::max_digits#0 ← (byte) 0 + (word*) utoa::digit_values#0 ← (word*) 0 + (bool~) utoa::$0 ← (byte) utoa::radix#1 == (const byte) DECIMAL + if((bool~) utoa::$0) goto utoa::@1 + to:utoa::@9 +utoa::@1: scope:[utoa] from utoa + (byte*) utoa::buffer#17 ← phi( utoa/(byte*) utoa::buffer#21 ) + (word) utoa::value#8 ← phi( utoa/(word) utoa::value#12 ) + (byte) utoa::max_digits#1 ← (number) 5 + (word*) utoa::digit_values#1 ← (const word*) RADIX_DECIMAL_VALUES + to:utoa::@8 +utoa::@9: scope:[utoa] from utoa + (word) utoa::value#13 ← phi( utoa/(word) utoa::value#12 ) + (byte*) utoa::buffer#16 ← phi( utoa/(byte*) utoa::buffer#21 ) + (byte) utoa::radix#2 ← phi( utoa/(byte) utoa::radix#1 ) + (bool~) utoa::$1 ← (byte) utoa::radix#2 == (const byte) HEXADECIMAL + if((bool~) utoa::$1) goto utoa::@2 + to:utoa::@10 +utoa::@2: scope:[utoa] from utoa::@9 + (byte*) utoa::buffer#18 ← phi( utoa::@9/(byte*) utoa::buffer#16 ) + (word) utoa::value#9 ← phi( utoa::@9/(word) utoa::value#13 ) + (byte) utoa::max_digits#2 ← (number) 4 + (word*) utoa::digit_values#2 ← (const word*) RADIX_HEXADECIMAL_VALUES + to:utoa::@8 +utoa::@10: scope:[utoa] from utoa::@9 + (word) utoa::value#14 ← phi( utoa::@9/(word) utoa::value#13 ) + (byte*) utoa::buffer#13 ← phi( utoa::@9/(byte*) utoa::buffer#16 ) + (byte) utoa::radix#3 ← phi( utoa::@9/(byte) utoa::radix#2 ) + (bool~) utoa::$2 ← (byte) utoa::radix#3 == (const byte) OCTAL + if((bool~) utoa::$2) goto utoa::@3 + to:utoa::@11 +utoa::@3: scope:[utoa] from utoa::@10 + (byte*) utoa::buffer#19 ← phi( utoa::@10/(byte*) utoa::buffer#13 ) + (word) utoa::value#10 ← phi( utoa::@10/(word) utoa::value#14 ) + (byte) utoa::max_digits#3 ← (number) 6 + (word*) utoa::digit_values#3 ← (const word*) RADIX_OCTAL_VALUES + to:utoa::@8 +utoa::@11: scope:[utoa] from utoa::@10 + (word) utoa::value#15 ← phi( utoa::@10/(word) utoa::value#14 ) + (byte*) utoa::buffer#10 ← phi( utoa::@10/(byte*) utoa::buffer#13 ) + (byte) utoa::radix#4 ← phi( utoa::@10/(byte) utoa::radix#3 ) + (bool~) utoa::$3 ← (byte) utoa::radix#4 == (const byte) BINARY + if((bool~) utoa::$3) goto utoa::@4 + to:utoa::@12 +utoa::@4: scope:[utoa] from utoa::@11 + (byte*) utoa::buffer#20 ← phi( utoa::@11/(byte*) utoa::buffer#10 ) + (word) utoa::value#11 ← phi( utoa::@11/(word) utoa::value#15 ) + (byte) utoa::max_digits#4 ← (number) $10 + (word*) utoa::digit_values#4 ← (const word*) RADIX_BINARY_VALUES + to:utoa::@8 +utoa::@12: scope:[utoa] from utoa::@11 + (byte*) utoa::buffer#6 ← phi( utoa::@11/(byte*) utoa::buffer#10 ) + *((byte*) utoa::buffer#6) ← (byte) 'e' + (byte*) utoa::buffer#0 ← ++ (byte*) utoa::buffer#6 + *((byte*) utoa::buffer#0) ← (byte) 'r' + (byte*) utoa::buffer#1 ← ++ (byte*) utoa::buffer#0 + *((byte*) utoa::buffer#1) ← (byte) 'r' + (byte*) utoa::buffer#2 ← ++ (byte*) utoa::buffer#1 + *((byte*) utoa::buffer#2) ← (number) 0 + to:utoa::@return +utoa::@return: scope:[utoa] from utoa::@12 utoa::@20 + return + to:@return +utoa::@8: scope:[utoa] from utoa::@1 utoa::@2 utoa::@3 utoa::@4 + (byte*) utoa::buffer#15 ← phi( utoa::@1/(byte*) utoa::buffer#17 utoa::@2/(byte*) utoa::buffer#18 utoa::@3/(byte*) utoa::buffer#19 utoa::@4/(byte*) utoa::buffer#20 ) + (word) utoa::value#7 ← phi( utoa::@1/(word) utoa::value#8 utoa::@2/(word) utoa::value#9 utoa::@3/(word) utoa::value#10 utoa::@4/(word) utoa::value#11 ) + (word*) utoa::digit_values#8 ← phi( utoa::@1/(word*) utoa::digit_values#1 utoa::@2/(word*) utoa::digit_values#2 utoa::@3/(word*) utoa::digit_values#3 utoa::@4/(word*) utoa::digit_values#4 ) + (byte) utoa::max_digits#7 ← phi( utoa::@1/(byte) utoa::max_digits#1 utoa::@2/(byte) utoa::max_digits#2 utoa::@3/(byte) utoa::max_digits#3 utoa::@4/(byte) utoa::max_digits#4 ) + (byte) utoa::started#0 ← (number) 0 + (byte) utoa::digit#0 ← (number) 0 + to:utoa::@18 +utoa::@18: scope:[utoa] from utoa::@21 utoa::@8 + (byte*) utoa::buffer#11 ← phi( utoa::@21/(byte*) utoa::buffer#14 utoa::@8/(byte*) utoa::buffer#15 ) + (byte) utoa::started#3 ← phi( utoa::@21/(byte) utoa::started#4 utoa::@8/(byte) utoa::started#0 ) + (word) utoa::value#5 ← phi( utoa::@21/(word) utoa::value#6 utoa::@8/(word) utoa::value#7 ) + (word*) utoa::digit_values#6 ← phi( utoa::@21/(word*) utoa::digit_values#7 utoa::@8/(word*) utoa::digit_values#8 ) + (byte) utoa::digit#2 ← phi( utoa::@21/(byte) utoa::digit#1 utoa::@8/(byte) utoa::digit#0 ) + (byte) utoa::max_digits#5 ← phi( utoa::@21/(byte) utoa::max_digits#6 utoa::@8/(byte) utoa::max_digits#7 ) + (number~) utoa::$5 ← (byte) utoa::max_digits#5 - (number) 1 + (bool~) utoa::$6 ← (byte) utoa::digit#2 < (number~) utoa::$5 + if((bool~) utoa::$6) goto utoa::@19 + to:utoa::@20 +utoa::@19: scope:[utoa] from utoa::@18 + (byte) utoa::max_digits#8 ← phi( utoa::@18/(byte) utoa::max_digits#5 ) + (byte*) utoa::buffer#12 ← phi( utoa::@18/(byte*) utoa::buffer#11 ) + (byte) utoa::started#2 ← phi( utoa::@18/(byte) utoa::started#3 ) + (word) utoa::value#2 ← phi( utoa::@18/(word) utoa::value#5 ) + (word*) utoa::digit_values#5 ← phi( utoa::@18/(word*) utoa::digit_values#6 ) + (byte) utoa::digit#3 ← phi( utoa::@18/(byte) utoa::digit#2 ) + (byte~) utoa::$11 ← (byte) utoa::digit#3 * (const byte) SIZEOF_WORD + (word) utoa::digit_value#0 ← *((word*) utoa::digit_values#5 + (byte~) utoa::$11) + (bool~) utoa::$7 ← (word) utoa::value#2 >= (word) utoa::digit_value#0 + (bool~) utoa::$8 ← (byte) utoa::started#2 || (bool~) utoa::$7 + (bool~) utoa::$9 ← ! (bool~) utoa::$8 + if((bool~) utoa::$9) goto utoa::@21 + to:utoa::@24 +utoa::@20: scope:[utoa] from utoa::@18 + (byte*) utoa::buffer#7 ← phi( utoa::@18/(byte*) utoa::buffer#11 ) + (word) utoa::value#3 ← phi( utoa::@18/(word) utoa::value#5 ) + (byte~) utoa::$4 ← ((byte)) (word) utoa::value#3 + *((byte*) utoa::buffer#7) ← *((const byte*) DIGITS + (byte~) utoa::$4) + (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#7 + *((byte*) utoa::buffer#3) ← (number) 0 + to:utoa::@return +utoa::@21: scope:[utoa] from utoa::@19 utoa::@26 + (byte*) utoa::buffer#14 ← phi( utoa::@19/(byte*) utoa::buffer#12 utoa::@26/(byte*) utoa::buffer#4 ) + (byte) utoa::started#4 ← phi( utoa::@19/(byte) utoa::started#2 utoa::@26/(byte) utoa::started#1 ) + (word) utoa::value#6 ← phi( utoa::@19/(word) utoa::value#2 utoa::@26/(word) utoa::value#0 ) + (word*) utoa::digit_values#7 ← phi( utoa::@19/(word*) utoa::digit_values#5 utoa::@26/(word*) utoa::digit_values#9 ) + (byte) utoa::max_digits#6 ← phi( utoa::@19/(byte) utoa::max_digits#8 utoa::@26/(byte) utoa::max_digits#9 ) + (byte) utoa::digit#4 ← phi( utoa::@19/(byte) utoa::digit#3 utoa::@26/(byte) utoa::digit#5 ) + (byte) utoa::digit#1 ← ++ (byte) utoa::digit#4 + to:utoa::@18 +utoa::@24: scope:[utoa] from utoa::@19 + (word*) utoa::digit_values#10 ← phi( utoa::@19/(word*) utoa::digit_values#5 ) + (byte) utoa::max_digits#10 ← phi( utoa::@19/(byte) utoa::max_digits#8 ) + (byte) utoa::digit#6 ← phi( utoa::@19/(byte) utoa::digit#3 ) + (word) utoa::digit_value#1 ← phi( utoa::@19/(word) utoa::digit_value#0 ) + (word) utoa::value#4 ← phi( utoa::@19/(word) utoa::value#2 ) + (byte*) utoa::buffer#8 ← phi( utoa::@19/(byte*) utoa::buffer#12 ) + (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#8 + (word) utoa_append::value#0 ← (word) utoa::value#4 + (word) utoa_append::sub#0 ← (word) utoa::digit_value#1 + call utoa_append + (word) utoa_append::return#0 ← (word) utoa_append::return#2 + to:utoa::@26 +utoa::@26: scope:[utoa] from utoa::@24 + (word*) utoa::digit_values#9 ← phi( utoa::@24/(word*) utoa::digit_values#10 ) + (byte) utoa::max_digits#9 ← phi( utoa::@24/(byte) utoa::max_digits#10 ) + (byte) utoa::digit#5 ← phi( utoa::@24/(byte) utoa::digit#6 ) + (byte*) utoa::buffer#9 ← phi( utoa::@24/(byte*) utoa::buffer#8 ) + (word) utoa_append::return#3 ← phi( utoa::@24/(word) utoa_append::return#0 ) + (word~) utoa::$10 ← (word) utoa_append::return#3 + (word) utoa::value#0 ← (word~) utoa::$10 + (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#9 + (byte) utoa::started#1 ← (number) 1 + to:utoa::@21 + +(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub) +utoa_append: scope:[utoa_append] from utoa::@24 + (byte*) utoa_append::buffer#3 ← phi( utoa::@24/(byte*) utoa_append::buffer#0 ) + (word) utoa_append::sub#3 ← phi( utoa::@24/(word) utoa_append::sub#0 ) + (word) utoa_append::value#5 ← phi( utoa::@24/(word) utoa_append::value#0 ) + (byte) utoa_append::digit#0 ← (number) 0 + to:utoa_append::@1 +utoa_append::@1: scope:[utoa_append] from utoa_append utoa_append::@2 + (byte*) utoa_append::buffer#2 ← phi( utoa_append/(byte*) utoa_append::buffer#3 utoa_append::@2/(byte*) utoa_append::buffer#4 ) + (byte) utoa_append::digit#4 ← phi( utoa_append/(byte) utoa_append::digit#0 utoa_append::@2/(byte) utoa_append::digit#1 ) + (word) utoa_append::sub#1 ← phi( utoa_append/(word) utoa_append::sub#3 utoa_append::@2/(word) utoa_append::sub#2 ) + (word) utoa_append::value#2 ← phi( utoa_append/(word) utoa_append::value#5 utoa_append::@2/(word) utoa_append::value#1 ) + (bool~) utoa_append::$0 ← (word) utoa_append::value#2 >= (word) utoa_append::sub#1 + if((bool~) utoa_append::$0) goto utoa_append::@2 + to:utoa_append::@3 +utoa_append::@2: scope:[utoa_append] from utoa_append::@1 + (byte*) utoa_append::buffer#4 ← phi( utoa_append::@1/(byte*) utoa_append::buffer#2 ) + (word) utoa_append::sub#2 ← phi( utoa_append::@1/(word) utoa_append::sub#1 ) + (word) utoa_append::value#3 ← phi( utoa_append::@1/(word) utoa_append::value#2 ) + (byte) utoa_append::digit#2 ← phi( utoa_append::@1/(byte) utoa_append::digit#4 ) + (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2 + (word) utoa_append::value#1 ← (word) utoa_append::value#3 - (word) utoa_append::sub#2 + to:utoa_append::@1 +utoa_append::@3: scope:[utoa_append] from utoa_append::@1 + (word) utoa_append::value#4 ← phi( utoa_append::@1/(word) utoa_append::value#2 ) + (byte*) utoa_append::buffer#1 ← phi( utoa_append::@1/(byte*) utoa_append::buffer#2 ) + (byte) utoa_append::digit#3 ← phi( utoa_append::@1/(byte) utoa_append::digit#4 ) + *((byte*) utoa_append::buffer#1) ← *((const byte*) DIGITS + (byte) utoa_append::digit#3) + (word) utoa_append::return#1 ← (word) utoa_append::value#4 + to:utoa_append::@return +utoa_append::@return: scope:[utoa_append] from utoa_append::@3 + (word) utoa_append::return#4 ← phi( utoa_append::@3/(word) utoa_append::return#1 ) + (word) utoa_append::return#2 ← (word) utoa_append::return#4 + return + to:@return +@12: scope:[] from @begin + (byte*) print_screen#0 ← ((byte*)) (number) $400 + (byte*) print_line_cursor#0 ← (byte*) print_screen#0 + (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 + to:@42 + +(void()) print_str((byte*) print_str::str) +print_str: scope:[print_str] from print_word_decimal::@1 + (byte*) print_char_cursor#54 ← phi( print_word_decimal::@1/(byte*) print_char_cursor#48 ) + (byte*) print_str::str#4 ← phi( print_word_decimal::@1/(byte*) print_str::str#1 ) + to:print_str::@1 +print_str::@1: scope:[print_str] from print_str print_str::@2 + (byte*) print_char_cursor#45 ← phi( print_str/(byte*) print_char_cursor#54 print_str::@2/(byte*) print_char_cursor#1 ) + (byte*) print_str::str#2 ← phi( print_str/(byte*) print_str::str#4 print_str::@2/(byte*) print_str::str#0 ) + (bool~) print_str::$0 ← (number) 0 != *((byte*) print_str::str#2) + if((bool~) print_str::$0) goto print_str::@2 + to:print_str::@return +print_str::@2: scope:[print_str] from print_str::@1 + (byte*) print_char_cursor#23 ← phi( print_str::@1/(byte*) print_char_cursor#45 ) + (byte*) print_str::str#3 ← phi( print_str::@1/(byte*) print_str::str#2 ) + *((byte*) print_char_cursor#23) ← *((byte*) print_str::str#3) + (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#23 + (byte*) print_str::str#0 ← ++ (byte*) print_str::str#3 + to:print_str::@1 +print_str::@return: scope:[print_str] from print_str::@1 + (byte*) print_char_cursor#24 ← phi( print_str::@1/(byte*) print_char_cursor#45 ) + (byte*) print_char_cursor#2 ← (byte*) print_char_cursor#24 + return + to:@return + +(void()) print_ln() +print_ln: scope:[print_ln] from end::@2 main::@10 + (byte*) print_char_cursor#46 ← phi( end::@2/(byte*) print_char_cursor#15 main::@10/(byte*) print_char_cursor#18 ) + (byte*) print_line_cursor#18 ← phi( end::@2/(byte*) print_line_cursor#19 main::@10/(byte*) print_line_cursor#20 ) + to:print_ln::@1 +print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 + (byte*) print_char_cursor#25 ← phi( print_ln/(byte*) print_char_cursor#46 print_ln::@1/(byte*) print_char_cursor#25 ) + (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#18 print_ln::@1/(byte*) print_line_cursor#1 ) + (byte*~) print_ln::$0 ← (byte*) print_line_cursor#9 + (number) $28 + (byte*) print_line_cursor#1 ← (byte*~) print_ln::$0 + (bool~) print_ln::$1 ← (byte*) print_line_cursor#1 < (byte*) print_char_cursor#25 + if((bool~) print_ln::$1) goto print_ln::@1 + to:print_ln::@2 +print_ln::@2: scope:[print_ln] from print_ln::@1 + (byte*) print_line_cursor#10 ← phi( print_ln::@1/(byte*) print_line_cursor#1 ) + (byte*) print_char_cursor#3 ← (byte*) print_line_cursor#10 + to:print_ln::@return +print_ln::@return: scope:[print_ln] from print_ln::@2 + (byte*) print_char_cursor#26 ← phi( print_ln::@2/(byte*) print_char_cursor#3 ) + (byte*) print_line_cursor#11 ← phi( print_ln::@2/(byte*) print_line_cursor#10 ) + (byte*) print_line_cursor#2 ← (byte*) print_line_cursor#11 + (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#26 + return + to:@return + +(void()) print_word((word) print_word::w) +print_word: scope:[print_word] from end::@1 + (byte*) print_char_cursor#47 ← phi( end::@1/(byte*) print_char_cursor#50 ) + (word) print_word::w#1 ← phi( end::@1/(word) print_word::w#0 ) + (byte~) print_word::$0 ← > (word) print_word::w#1 + (byte) print_byte::b#0 ← (byte~) print_word::$0 + call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + (word) print_word::w#2 ← phi( print_word/(word) print_word::w#1 ) + (byte*) print_char_cursor#27 ← phi( print_word/(byte*) print_char_cursor#12 ) + (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#27 + (byte~) print_word::$2 ← < (word) print_word::w#2 + (byte) print_byte::b#1 ← (byte~) print_word::$2 + call print_byte + to:print_word::@2 +print_word::@2: scope:[print_word] from print_word::@1 + (byte*) print_char_cursor#28 ← phi( print_word::@1/(byte*) print_char_cursor#12 ) + (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#28 + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@2 + (byte*) print_char_cursor#29 ← phi( print_word::@2/(byte*) print_char_cursor#6 ) + (byte*) print_char_cursor#7 ← (byte*) print_char_cursor#29 + return + to:@return + +(void()) print_word_decimal((word) print_word_decimal::w) +print_word_decimal: scope:[print_word_decimal] from main::@9 + (byte*) print_char_cursor#55 ← phi( main::@9/(byte*) print_char_cursor#51 ) + (word) print_word_decimal::w#1 ← phi( main::@9/(word) print_word_decimal::w#0 ) + (word) utoa::value#1 ← (word) print_word_decimal::w#1 + (byte*) utoa::buffer#5 ← (const byte*) decimal_digits + (byte) utoa::radix#0 ← (const byte) DECIMAL + call utoa + to:print_word_decimal::@1 +print_word_decimal::@1: scope:[print_word_decimal] from print_word_decimal + (byte*) print_char_cursor#48 ← phi( print_word_decimal/(byte*) print_char_cursor#55 ) + (byte*) print_str::str#1 ← (const byte*) decimal_digits + call print_str + to:print_word_decimal::@2 +print_word_decimal::@2: scope:[print_word_decimal] from print_word_decimal::@1 + (byte*) print_char_cursor#30 ← phi( print_word_decimal::@1/(byte*) print_char_cursor#2 ) + (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#30 + to:print_word_decimal::@return +print_word_decimal::@return: scope:[print_word_decimal] from print_word_decimal::@2 + (byte*) print_char_cursor#31 ← phi( print_word_decimal::@2/(byte*) print_char_cursor#8 ) + (byte*) print_char_cursor#9 ← (byte*) print_char_cursor#31 + return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + (byte*) print_char_cursor#49 ← phi( print_word/(byte*) print_char_cursor#47 print_word::@1/(byte*) print_char_cursor#5 ) + (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4 + (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) + call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + (byte) print_byte::b#3 ← phi( print_byte/(byte) print_byte::b#2 ) + (byte*) print_char_cursor#32 ← phi( print_byte/(byte*) print_char_cursor#14 ) + (byte*) print_char_cursor#10 ← (byte*) print_char_cursor#32 + (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f + (byte) print_char::ch#1 ← *((const byte*) print_hextab + (number~) print_byte::$2) + call print_char + to:print_byte::@2 +print_byte::@2: scope:[print_byte] from print_byte::@1 + (byte*) print_char_cursor#33 ← phi( print_byte::@1/(byte*) print_char_cursor#14 ) + (byte*) print_char_cursor#11 ← (byte*) print_char_cursor#33 + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@2 + (byte*) print_char_cursor#34 ← phi( print_byte::@2/(byte*) print_char_cursor#11 ) + (byte*) print_char_cursor#12 ← (byte*) print_char_cursor#34 + return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + (byte*) print_char_cursor#35 ← phi( print_byte/(byte*) print_char_cursor#49 print_byte::@1/(byte*) print_char_cursor#10 ) + (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 + (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#35 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + (byte*) print_char_cursor#36 ← phi( print_char/(byte*) print_char_cursor#13 ) + (byte*) print_char_cursor#14 ← (byte*) print_char_cursor#36 + return + to:@return +@42: scope:[] from @12 + (byte*) print_line_cursor#28 ← phi( @12/(byte*) print_line_cursor#0 ) + (byte*) print_char_cursor#60 ← phi( @12/(byte*) print_char_cursor#0 ) + (word) last_time#0 ← (word) 0 + (word) Ticks#0 ← (word) 0 + to:@44 + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + (word) rand_seed#0 ← (number) $194a + to:start::@return +start::@return: scope:[start] from start + (word) rand_seed#9 ← phi( start/(word) rand_seed#0 ) + (word) rand_seed#1 ← (word) rand_seed#9 + return + to:@return + +(void()) end() +end: scope:[end] from main::@3 + (byte*) print_line_cursor#27 ← phi( main::@3/(byte*) print_line_cursor#21 ) + (byte*) print_char_cursor#56 ← phi( main::@3/(byte*) print_char_cursor#52 ) + (word) rand_seed#16 ← phi( main::@3/(word) rand_seed#19 ) + (word) last_time#6 ← phi( main::@3/(word) last_time#12 ) + (word) Ticks#1 ← (word) last_time#6 + call start + to:end::@1 +end::@1: scope:[end] from end + (byte*) print_line_cursor#23 ← phi( end/(byte*) print_line_cursor#27 ) + (byte*) print_char_cursor#50 ← phi( end/(byte*) print_char_cursor#56 ) + (word) Ticks#7 ← phi( end/(word) Ticks#1 ) + (word) last_time#7 ← phi( end/(word) last_time#6 ) + (word) rand_seed#10 ← phi( end/(word) rand_seed#1 ) + (word) rand_seed#2 ← (word) rand_seed#10 + (word) last_time#1 ← (word) last_time#7 - (word) Ticks#7 + (word) Ticks#2 ← (word) last_time#1 + (word) print_word::w#0 ← (word) Ticks#2 + call print_word + to:end::@2 +end::@2: scope:[end] from end::@1 + (word) last_time#15 ← phi( end::@1/(word) last_time#1 ) + (word) rand_seed#21 ← phi( end::@1/(word) rand_seed#2 ) + (word) Ticks#15 ← phi( end::@1/(word) Ticks#2 ) + (byte*) print_line_cursor#19 ← phi( end::@1/(byte*) print_line_cursor#23 ) + (byte*) print_char_cursor#37 ← phi( end::@1/(byte*) print_char_cursor#7 ) + (byte*) print_char_cursor#15 ← (byte*) print_char_cursor#37 + call print_ln + to:end::@3 +end::@3: scope:[end] from end::@2 + (word) last_time#13 ← phi( end::@2/(word) last_time#15 ) + (word) rand_seed#17 ← phi( end::@2/(word) rand_seed#21 ) + (word) Ticks#12 ← phi( end::@2/(word) Ticks#15 ) + (byte*) print_char_cursor#38 ← phi( end::@2/(byte*) print_char_cursor#4 ) + (byte*) print_line_cursor#12 ← phi( end::@2/(byte*) print_line_cursor#2 ) + (byte*) print_line_cursor#3 ← (byte*) print_line_cursor#12 + (byte*) print_char_cursor#16 ← (byte*) print_char_cursor#38 + to:end::@return +end::@return: scope:[end] from end::@3 + (byte*) print_line_cursor#13 ← phi( end::@3/(byte*) print_line_cursor#3 ) + (byte*) print_char_cursor#39 ← phi( end::@3/(byte*) print_char_cursor#16 ) + (word) last_time#8 ← phi( end::@3/(word) last_time#13 ) + (word) rand_seed#11 ← phi( end::@3/(word) rand_seed#17 ) + (word) Ticks#8 ← phi( end::@3/(word) Ticks#12 ) + (word) Ticks#3 ← (word) Ticks#8 + (word) rand_seed#3 ← (word) rand_seed#11 + (word) last_time#2 ← (word) last_time#8 + (byte*) print_char_cursor#17 ← (byte*) print_char_cursor#39 + (byte*) print_line_cursor#4 ← (byte*) print_line_cursor#13 + return + to:@return +@44: scope:[] from @42 + (word) last_time#17 ← phi( @42/(word) last_time#0 ) + (word) Ticks#17 ← phi( @42/(word) Ticks#0 ) + (byte*) print_line_cursor#26 ← phi( @42/(byte*) print_line_cursor#28 ) + (byte*) print_char_cursor#59 ← phi( @42/(byte*) print_char_cursor#60 ) + (word) rand_seed#4 ← (word) 0 + to:@47 + +(word()) sum() +sum: scope:[sum] from main::@2 + (word) sum::s#0 ← (word) 0 + (byte*) sum::p#0 ← (byte*) 0 + (byte) sum::page#0 ← (byte) 0 + (byte) sum::i#0 ← (byte) 0 + (byte) sum::tmp#0 ← (byte) 0 + (byte*) sum::p#1 ← (const byte*) rom + (word) sum::s#1 ← (number) 0 + (byte) sum::page#1 ← (number) 0 + to:sum::@1 +sum::@1: scope:[sum] from sum sum::@5 + (byte*) sum::p#6 ← phi( sum/(byte*) sum::p#1 sum::@5/(byte*) sum::p#2 ) + (word) sum::s#5 ← phi( sum/(word) sum::s#1 sum::@5/(word) sum::s#7 ) + (byte) sum::page#3 ← phi( sum/(byte) sum::page#1 sum::@5/(byte) sum::page#2 ) + (bool~) sum::$0 ← (byte) sum::page#3 < (number) $20 + if((bool~) sum::$0) goto sum::@2 + to:sum::@3 +sum::@2: scope:[sum] from sum::@1 + (byte) sum::page#6 ← phi( sum::@1/(byte) sum::page#3 ) + (word) sum::s#6 ← phi( sum::@1/(word) sum::s#5 ) + (byte*) sum::p#5 ← phi( sum::@1/(byte*) sum::p#6 ) + (byte) sum::i#1 ← (number) 0 + to:sum::@4 +sum::@3: scope:[sum] from sum::@1 + (word) sum::s#3 ← phi( sum::@1/(word) sum::s#5 ) + (word) sum::return#0 ← (word) sum::s#3 + to:sum::@return +sum::@4: scope:[sum] from sum::@2 sum::@4 + (byte) sum::page#5 ← phi( sum::@2/(byte) sum::page#6 sum::@4/(byte) sum::page#5 ) + (word) sum::s#4 ← phi( sum::@2/(word) sum::s#6 sum::@4/(word) sum::s#2 ) + (byte) sum::i#3 ← phi( sum::@2/(byte) sum::i#1 sum::@4/(byte) sum::i#2 ) + (byte*) sum::p#3 ← phi( sum::@2/(byte*) sum::p#5 sum::@4/(byte*) sum::p#3 ) + (byte) sum::tmp#1 ← *((byte*) sum::p#3 + (byte) sum::i#3) + (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 + (byte) sum::i#2 ← ++ (byte) sum::i#3 + (bool~) sum::$1 ← (number) 0 != (byte) sum::i#2 + if((bool~) sum::$1) goto sum::@4 + to:sum::@5 +sum::@5: scope:[sum] from sum::@4 + (word) sum::s#7 ← phi( sum::@4/(word) sum::s#2 ) + (byte) sum::page#4 ← phi( sum::@4/(byte) sum::page#5 ) + (byte*) sum::p#4 ← phi( sum::@4/(byte*) sum::p#3 ) + (byte*) sum::p#2 ← (byte*) sum::p#4 + (number) $100 + (byte) sum::page#2 ← ++ (byte) sum::page#4 + to:sum::@1 +sum::@return: scope:[sum] from sum::@3 + (word) sum::return#3 ← phi( sum::@3/(word) sum::return#0 ) + (word) sum::return#1 ← (word) sum::return#3 + return + to:@return + +(signed word()) main() +main: scope:[main] from @47 + (byte*) print_line_cursor#31 ← phi( @47/(byte*) print_line_cursor#22 ) + (byte*) print_char_cursor#62 ← phi( @47/(byte*) print_char_cursor#53 ) + (word) Ticks#20 ← phi( @47/(word) Ticks#14 ) + (word) last_time#20 ← phi( @47/(word) last_time#14 ) + (word) rand_seed#18 ← phi( @47/(word) rand_seed#20 ) + (word) main::i#0 ← (word) 0 + call start + to:main::@8 +main::@8: scope:[main] from main + (byte*) print_line_cursor#29 ← phi( main/(byte*) print_line_cursor#31 ) + (byte*) print_char_cursor#61 ← phi( main/(byte*) print_char_cursor#62 ) + (word) Ticks#19 ← phi( main/(word) Ticks#20 ) + (word) last_time#19 ← phi( main/(word) last_time#20 ) + (word) rand_seed#12 ← phi( main/(word) rand_seed#1 ) + (word) rand_seed#5 ← (word) rand_seed#12 + (word) main::i#1 ← (number) 0 + to:main::@1 +main::@1: scope:[main] from main::@11 main::@8 + (byte*) print_line_cursor#25 ← phi( main::@11/(byte*) print_line_cursor#5 main::@8/(byte*) print_line_cursor#29 ) + (byte*) print_char_cursor#58 ← phi( main::@11/(byte*) print_char_cursor#19 main::@8/(byte*) print_char_cursor#61 ) + (word) rand_seed#22 ← phi( main::@11/(word) rand_seed#23 main::@8/(word) rand_seed#5 ) + (word) Ticks#16 ← phi( main::@11/(word) Ticks#18 main::@8/(word) Ticks#19 ) + (word) last_time#16 ← phi( main::@11/(word) last_time#18 main::@8/(word) last_time#19 ) + (word) main::i#3 ← phi( main::@11/(word) main::i#2 main::@8/(word) main::i#1 ) + (bool~) main::$2 ← (word) main::i#3 < (number) 6 + if((bool~) main::$2) goto main::@2 + to:main::@3 +main::@2: scope:[main] from main::@1 + (word) rand_seed#26 ← phi( main::@1/(word) rand_seed#22 ) + (word) Ticks#23 ← phi( main::@1/(word) Ticks#16 ) + (word) last_time#23 ← phi( main::@1/(word) last_time#16 ) + (word) main::i#7 ← phi( main::@1/(word) main::i#3 ) + (byte*) print_line_cursor#30 ← phi( main::@1/(byte*) print_line_cursor#25 ) + (byte*) print_char_cursor#57 ← phi( main::@1/(byte*) print_char_cursor#58 ) + call sum + (word) sum::return#2 ← (word) sum::return#1 + to:main::@9 +main::@9: scope:[main] from main::@2 + (word) rand_seed#25 ← phi( main::@2/(word) rand_seed#26 ) + (word) Ticks#22 ← phi( main::@2/(word) Ticks#23 ) + (word) last_time#22 ← phi( main::@2/(word) last_time#23 ) + (word) main::i#6 ← phi( main::@2/(word) main::i#7 ) + (byte*) print_line_cursor#24 ← phi( main::@2/(byte*) print_line_cursor#30 ) + (byte*) print_char_cursor#51 ← phi( main::@2/(byte*) print_char_cursor#57 ) + (word) sum::return#4 ← phi( main::@2/(word) sum::return#2 ) + (word~) main::$3 ← (word) sum::return#4 + (word) print_word_decimal::w#0 ← (word~) main::$3 + call print_word_decimal + to:main::@10 +main::@10: scope:[main] from main::@9 + (word) rand_seed#24 ← phi( main::@9/(word) rand_seed#25 ) + (word) Ticks#21 ← phi( main::@9/(word) Ticks#22 ) + (word) last_time#21 ← phi( main::@9/(word) last_time#22 ) + (word) main::i#5 ← phi( main::@9/(word) main::i#6 ) + (byte*) print_line_cursor#20 ← phi( main::@9/(byte*) print_line_cursor#24 ) + (byte*) print_char_cursor#40 ← phi( main::@9/(byte*) print_char_cursor#9 ) + (byte*) print_char_cursor#18 ← (byte*) print_char_cursor#40 + call print_ln + to:main::@11 +main::@11: scope:[main] from main::@10 + (word) rand_seed#23 ← phi( main::@10/(word) rand_seed#24 ) + (word) Ticks#18 ← phi( main::@10/(word) Ticks#21 ) + (word) last_time#18 ← phi( main::@10/(word) last_time#21 ) + (word) main::i#4 ← phi( main::@10/(word) main::i#5 ) + (byte*) print_char_cursor#41 ← phi( main::@10/(byte*) print_char_cursor#4 ) + (byte*) print_line_cursor#14 ← phi( main::@10/(byte*) print_line_cursor#2 ) + (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#14 + (byte*) print_char_cursor#19 ← (byte*) print_char_cursor#41 + (word) main::i#2 ← ++ (word) main::i#4 + to:main::@1 +main::@3: scope:[main] from main::@1 + (byte*) print_line_cursor#21 ← phi( main::@1/(byte*) print_line_cursor#25 ) + (byte*) print_char_cursor#52 ← phi( main::@1/(byte*) print_char_cursor#58 ) + (word) rand_seed#19 ← phi( main::@1/(word) rand_seed#22 ) + (word) Ticks#13 ← phi( main::@1/(word) Ticks#16 ) + (word) last_time#12 ← phi( main::@1/(word) last_time#16 ) + call end + to:main::@12 +main::@12: scope:[main] from main::@3 + (byte*) print_line_cursor#15 ← phi( main::@3/(byte*) print_line_cursor#4 ) + (byte*) print_char_cursor#42 ← phi( main::@3/(byte*) print_char_cursor#17 ) + (word) last_time#9 ← phi( main::@3/(word) last_time#2 ) + (word) rand_seed#13 ← phi( main::@3/(word) rand_seed#3 ) + (word) Ticks#9 ← phi( main::@3/(word) Ticks#3 ) + (word) Ticks#4 ← (word) Ticks#9 + (word) rand_seed#6 ← (word) rand_seed#13 + (word) last_time#3 ← (word) last_time#9 + (byte*) print_char_cursor#20 ← (byte*) print_char_cursor#42 + (byte*) print_line_cursor#6 ← (byte*) print_line_cursor#15 + (signed word) main::return#0 ← (number) 0 + to:main::@return +main::@return: scope:[main] from main::@12 + (word) last_time#10 ← phi( main::@12/(word) last_time#3 ) + (word) Ticks#10 ← phi( main::@12/(word) Ticks#4 ) + (byte*) print_line_cursor#16 ← phi( main::@12/(byte*) print_line_cursor#6 ) + (byte*) print_char_cursor#43 ← phi( main::@12/(byte*) print_char_cursor#20 ) + (word) rand_seed#14 ← phi( main::@12/(word) rand_seed#6 ) + (signed word) main::return#3 ← phi( main::@12/(signed word) main::return#0 ) + (signed word) main::return#1 ← (signed word) main::return#3 + (word) rand_seed#7 ← (word) rand_seed#14 + (byte*) print_char_cursor#21 ← (byte*) print_char_cursor#43 + (byte*) print_line_cursor#7 ← (byte*) print_line_cursor#16 + (word) Ticks#5 ← (word) Ticks#10 + (word) last_time#4 ← (word) last_time#10 + return + to:@return +@47: scope:[] from @44 + (word) last_time#14 ← phi( @44/(word) last_time#17 ) + (word) Ticks#14 ← phi( @44/(word) Ticks#17 ) + (byte*) print_line_cursor#22 ← phi( @44/(byte*) print_line_cursor#26 ) + (byte*) print_char_cursor#53 ← phi( @44/(byte*) print_char_cursor#59 ) + (word) rand_seed#20 ← phi( @44/(word) rand_seed#4 ) + call main + (signed word) main::return#2 ← (signed word) main::return#1 + to:@48 +@48: scope:[] from @47 + (word) last_time#11 ← phi( @47/(word) last_time#4 ) + (word) Ticks#11 ← phi( @47/(word) Ticks#5 ) + (byte*) print_line_cursor#17 ← phi( @47/(byte*) print_line_cursor#7 ) + (byte*) print_char_cursor#44 ← phi( @47/(byte*) print_char_cursor#21 ) + (word) rand_seed#15 ← phi( @47/(word) rand_seed#7 ) + (word) rand_seed#8 ← (word) rand_seed#15 + (byte*) print_char_cursor#22 ← (byte*) print_char_cursor#44 + (byte*) print_line_cursor#8 ← (byte*) print_line_cursor#17 + (word) Ticks#6 ← (word) Ticks#11 + (word) last_time#5 ← (word) last_time#11 + to:@end +@end: scope:[] from @48 + +SYMBOL TABLE SSA +(label) @12 +(label) @42 +(label) @44 +(label) @47 +(label) @48 +(label) @begin +(label) @end +(const byte) BINARY = (number) 2 +(const byte) DECIMAL = (number) $a +(const byte*) DIGITS = (string) "0123456789abcdef"z +(const byte) HEXADECIMAL = (number) $10 +(const byte) OCTAL = (number) 8 +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const word*) RADIX_BINARY_VALUES = { (word)(number) $8000, (word)(number) $4000, (word)(number) $2000, (word)(number) $1000, (word)(number) $800, (word)(number) $400, (word)(number) $200, (word)(number) $100, (word)(number) $80, (word)(number) $40, (word)(number) $20, (word)(number) $10, (word)(number) 8, (word)(number) 4, (word)(number) 2 } +(const word*) RADIX_DECIMAL_VALUES = { (word)(number) $2710, (word)(number) $3e8, (word)(number) $64, (word)(number) $a } +(const word*) RADIX_HEXADECIMAL_VALUES = { (word)(number) $1000, (word)(number) $100, (word)(number) $10 } +(const word*) RADIX_OCTAL_VALUES = { (word)(number) $8000, (word)(number) $1000, (word)(number) $200, (word)(number) $40, (word)(number) 8 } +(const byte) SIZEOF_WORD = (byte) 2 +(word) Ticks +(word) Ticks#0 +(word) Ticks#1 +(word) Ticks#10 +(word) Ticks#11 +(word) Ticks#12 +(word) Ticks#13 +(word) Ticks#14 +(word) Ticks#15 +(word) Ticks#16 +(word) Ticks#17 +(word) Ticks#18 +(word) Ticks#19 +(word) Ticks#2 +(word) Ticks#20 +(word) Ticks#21 +(word) Ticks#22 +(word) Ticks#23 +(word) Ticks#3 +(word) Ticks#4 +(word) Ticks#5 +(word) Ticks#6 +(word) Ticks#7 +(word) Ticks#8 +(word) Ticks#9 +(const byte*) decimal_digits = { fill( 6, 0) } +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@3 +(label) end::@return +(word) last_time +(word) last_time#0 +(word) last_time#1 +(word) last_time#10 +(word) last_time#11 +(word) last_time#12 +(word) last_time#13 +(word) last_time#14 +(word) last_time#15 +(word) last_time#16 +(word) last_time#17 +(word) last_time#18 +(word) last_time#19 +(word) last_time#2 +(word) last_time#20 +(word) last_time#21 +(word) last_time#22 +(word) last_time#23 +(word) last_time#3 +(word) last_time#4 +(word) last_time#5 +(word) last_time#6 +(word) last_time#7 +(word) last_time#8 +(word) last_time#9 +(signed word()) main() +(bool~) main::$2 +(word~) main::$3 +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@12 +(label) main::@2 +(label) main::@3 +(label) main::@8 +(label) main::@9 +(label) main::@return +(word) main::i +(word) main::i#0 +(word) main::i#1 +(word) main::i#2 +(word) main::i#3 +(word) main::i#4 +(word) main::i#5 +(word) main::i#6 +(word) main::i#7 +(signed word) main::return +(signed word) main::return#0 +(signed word) main::return#1 +(signed word) main::return#2 +(signed word) main::return#3 +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 +(number~) print_byte::$2 +(label) print_byte::@1 +(label) print_byte::@2 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 +(byte) print_byte::b#1 +(byte) print_byte::b#2 +(byte) print_byte::b#3 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 +(byte) print_char::ch#1 +(byte) print_char::ch#2 +(byte*) print_char_cursor +(byte*) print_char_cursor#0 +(byte*) print_char_cursor#1 +(byte*) print_char_cursor#10 +(byte*) print_char_cursor#11 +(byte*) print_char_cursor#12 +(byte*) print_char_cursor#13 +(byte*) print_char_cursor#14 +(byte*) print_char_cursor#15 +(byte*) print_char_cursor#16 +(byte*) print_char_cursor#17 +(byte*) print_char_cursor#18 +(byte*) print_char_cursor#19 +(byte*) print_char_cursor#2 +(byte*) print_char_cursor#20 +(byte*) print_char_cursor#21 +(byte*) print_char_cursor#22 +(byte*) print_char_cursor#23 +(byte*) print_char_cursor#24 +(byte*) print_char_cursor#25 +(byte*) print_char_cursor#26 +(byte*) print_char_cursor#27 +(byte*) print_char_cursor#28 +(byte*) print_char_cursor#29 +(byte*) print_char_cursor#3 +(byte*) print_char_cursor#30 +(byte*) print_char_cursor#31 +(byte*) print_char_cursor#32 +(byte*) print_char_cursor#33 +(byte*) print_char_cursor#34 +(byte*) print_char_cursor#35 +(byte*) print_char_cursor#36 +(byte*) print_char_cursor#37 +(byte*) print_char_cursor#38 +(byte*) print_char_cursor#39 +(byte*) print_char_cursor#4 +(byte*) print_char_cursor#40 +(byte*) print_char_cursor#41 +(byte*) print_char_cursor#42 +(byte*) print_char_cursor#43 +(byte*) print_char_cursor#44 +(byte*) print_char_cursor#45 +(byte*) print_char_cursor#46 +(byte*) print_char_cursor#47 +(byte*) print_char_cursor#48 +(byte*) print_char_cursor#49 +(byte*) print_char_cursor#5 +(byte*) print_char_cursor#50 +(byte*) print_char_cursor#51 +(byte*) print_char_cursor#52 +(byte*) print_char_cursor#53 +(byte*) print_char_cursor#54 +(byte*) print_char_cursor#55 +(byte*) print_char_cursor#56 +(byte*) print_char_cursor#57 +(byte*) print_char_cursor#58 +(byte*) print_char_cursor#59 +(byte*) print_char_cursor#6 +(byte*) print_char_cursor#60 +(byte*) print_char_cursor#61 +(byte*) print_char_cursor#62 +(byte*) print_char_cursor#7 +(byte*) print_char_cursor#8 +(byte*) print_char_cursor#9 +(const byte*) print_hextab = (string) "0123456789abcdef"z +(byte*) print_line_cursor +(byte*) print_line_cursor#0 +(byte*) print_line_cursor#1 +(byte*) print_line_cursor#10 +(byte*) print_line_cursor#11 +(byte*) print_line_cursor#12 +(byte*) print_line_cursor#13 +(byte*) print_line_cursor#14 +(byte*) print_line_cursor#15 +(byte*) print_line_cursor#16 +(byte*) print_line_cursor#17 +(byte*) print_line_cursor#18 +(byte*) print_line_cursor#19 +(byte*) print_line_cursor#2 +(byte*) print_line_cursor#20 +(byte*) print_line_cursor#21 +(byte*) print_line_cursor#22 +(byte*) print_line_cursor#23 +(byte*) print_line_cursor#24 +(byte*) print_line_cursor#25 +(byte*) print_line_cursor#26 +(byte*) print_line_cursor#27 +(byte*) print_line_cursor#28 +(byte*) print_line_cursor#29 +(byte*) print_line_cursor#3 +(byte*) print_line_cursor#30 +(byte*) print_line_cursor#31 +(byte*) print_line_cursor#4 +(byte*) print_line_cursor#5 +(byte*) print_line_cursor#6 +(byte*) print_line_cursor#7 +(byte*) print_line_cursor#8 +(byte*) print_line_cursor#9 +(void()) print_ln() +(byte*~) print_ln::$0 +(bool~) print_ln::$1 +(label) print_ln::@1 +(label) print_ln::@2 +(label) print_ln::@return +(byte*) print_screen +(byte*) print_screen#0 +(void()) print_str((byte*) print_str::str) +(bool~) print_str::$0 +(label) print_str::@1 +(label) print_str::@2 +(label) print_str::@return +(byte*) print_str::str +(byte*) print_str::str#0 +(byte*) print_str::str#1 +(byte*) print_str::str#2 +(byte*) print_str::str#3 +(byte*) print_str::str#4 +(void()) print_word((word) print_word::w) +(byte~) print_word::$0 +(byte~) print_word::$2 +(label) print_word::@1 +(label) print_word::@2 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 +(word) print_word::w#1 +(word) print_word::w#2 +(void()) print_word_decimal((word) print_word_decimal::w) +(label) print_word_decimal::@1 +(label) print_word_decimal::@2 +(label) print_word_decimal::@return +(word) print_word_decimal::w +(word) print_word_decimal::w#0 +(word) print_word_decimal::w#1 +(word) rand_seed +(word) rand_seed#0 +(word) rand_seed#1 +(word) rand_seed#10 +(word) rand_seed#11 +(word) rand_seed#12 +(word) rand_seed#13 +(word) rand_seed#14 +(word) rand_seed#15 +(word) rand_seed#16 +(word) rand_seed#17 +(word) rand_seed#18 +(word) rand_seed#19 +(word) rand_seed#2 +(word) rand_seed#20 +(word) rand_seed#21 +(word) rand_seed#22 +(word) rand_seed#23 +(word) rand_seed#24 +(word) rand_seed#25 +(word) rand_seed#26 +(word) rand_seed#3 +(word) rand_seed#4 +(word) rand_seed#5 +(word) rand_seed#6 +(word) rand_seed#7 +(word) rand_seed#8 +(word) rand_seed#9 +(const byte*) rom = (byte*)(number) $e000 +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time +(word()) sum() +(bool~) sum::$0 +(bool~) sum::$1 +(label) sum::@1 +(label) sum::@2 +(label) sum::@3 +(label) sum::@4 +(label) sum::@5 +(label) sum::@return +(byte) sum::i +(byte) sum::i#0 +(byte) sum::i#1 +(byte) sum::i#2 +(byte) sum::i#3 +(byte*) sum::p +(byte*) sum::p#0 +(byte*) sum::p#1 +(byte*) sum::p#2 +(byte*) sum::p#3 +(byte*) sum::p#4 +(byte*) sum::p#5 +(byte*) sum::p#6 +(byte) sum::page +(byte) sum::page#0 +(byte) sum::page#1 +(byte) sum::page#2 +(byte) sum::page#3 +(byte) sum::page#4 +(byte) sum::page#5 +(byte) sum::page#6 +(word) sum::return +(word) sum::return#0 +(word) sum::return#1 +(word) sum::return#2 +(word) sum::return#3 +(word) sum::return#4 +(word) sum::s +(word) sum::s#0 +(word) sum::s#1 +(word) sum::s#2 +(word) sum::s#3 +(word) sum::s#4 +(word) sum::s#5 +(word) sum::s#6 +(word) sum::s#7 +(byte) sum::tmp +(byte) sum::tmp#0 +(byte) sum::tmp#1 +(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix) +(bool~) utoa::$0 +(bool~) utoa::$1 +(word~) utoa::$10 +(byte~) utoa::$11 +(bool~) utoa::$2 +(bool~) utoa::$3 +(byte~) utoa::$4 +(number~) utoa::$5 +(bool~) utoa::$6 +(bool~) utoa::$7 +(bool~) utoa::$8 +(bool~) utoa::$9 +(label) utoa::@1 +(label) utoa::@10 +(label) utoa::@11 +(label) utoa::@12 +(label) utoa::@18 +(label) utoa::@19 +(label) utoa::@2 +(label) utoa::@20 +(label) utoa::@21 +(label) utoa::@24 +(label) utoa::@26 +(label) utoa::@3 +(label) utoa::@4 +(label) utoa::@8 +(label) utoa::@9 +(label) utoa::@return +(byte*) utoa::buffer +(byte*) utoa::buffer#0 +(byte*) utoa::buffer#1 +(byte*) utoa::buffer#10 +(byte*) utoa::buffer#11 +(byte*) utoa::buffer#12 +(byte*) utoa::buffer#13 +(byte*) utoa::buffer#14 +(byte*) utoa::buffer#15 +(byte*) utoa::buffer#16 +(byte*) utoa::buffer#17 +(byte*) utoa::buffer#18 +(byte*) utoa::buffer#19 +(byte*) utoa::buffer#2 +(byte*) utoa::buffer#20 +(byte*) utoa::buffer#21 +(byte*) utoa::buffer#3 +(byte*) utoa::buffer#4 +(byte*) utoa::buffer#5 +(byte*) utoa::buffer#6 +(byte*) utoa::buffer#7 +(byte*) utoa::buffer#8 +(byte*) utoa::buffer#9 +(byte) utoa::digit +(byte) utoa::digit#0 +(byte) utoa::digit#1 +(byte) utoa::digit#2 +(byte) utoa::digit#3 +(byte) utoa::digit#4 +(byte) utoa::digit#5 +(byte) utoa::digit#6 +(word) utoa::digit_value +(word) utoa::digit_value#0 +(word) utoa::digit_value#1 +(word*) utoa::digit_values +(word*) utoa::digit_values#0 +(word*) utoa::digit_values#1 +(word*) utoa::digit_values#10 +(word*) utoa::digit_values#2 +(word*) utoa::digit_values#3 +(word*) utoa::digit_values#4 +(word*) utoa::digit_values#5 +(word*) utoa::digit_values#6 +(word*) utoa::digit_values#7 +(word*) utoa::digit_values#8 +(word*) utoa::digit_values#9 +(byte) utoa::max_digits +(byte) utoa::max_digits#0 +(byte) utoa::max_digits#1 +(byte) utoa::max_digits#10 +(byte) utoa::max_digits#2 +(byte) utoa::max_digits#3 +(byte) utoa::max_digits#4 +(byte) utoa::max_digits#5 +(byte) utoa::max_digits#6 +(byte) utoa::max_digits#7 +(byte) utoa::max_digits#8 +(byte) utoa::max_digits#9 +(byte) utoa::radix +(byte) utoa::radix#0 +(byte) utoa::radix#1 +(byte) utoa::radix#2 +(byte) utoa::radix#3 +(byte) utoa::radix#4 +(byte) utoa::started +(byte) utoa::started#0 +(byte) utoa::started#1 +(byte) utoa::started#2 +(byte) utoa::started#3 +(byte) utoa::started#4 +(word) utoa::value +(word) utoa::value#0 +(word) utoa::value#1 +(word) utoa::value#10 +(word) utoa::value#11 +(word) utoa::value#12 +(word) utoa::value#13 +(word) utoa::value#14 +(word) utoa::value#15 +(word) utoa::value#2 +(word) utoa::value#3 +(word) utoa::value#4 +(word) utoa::value#5 +(word) utoa::value#6 +(word) utoa::value#7 +(word) utoa::value#8 +(word) utoa::value#9 +(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub) +(bool~) utoa_append::$0 +(label) utoa_append::@1 +(label) utoa_append::@2 +(label) utoa_append::@3 +(label) utoa_append::@return +(byte*) utoa_append::buffer +(byte*) utoa_append::buffer#0 +(byte*) utoa_append::buffer#1 +(byte*) utoa_append::buffer#2 +(byte*) utoa_append::buffer#3 +(byte*) utoa_append::buffer#4 +(byte) utoa_append::digit +(byte) utoa_append::digit#0 +(byte) utoa_append::digit#1 +(byte) utoa_append::digit#2 +(byte) utoa_append::digit#3 +(byte) utoa_append::digit#4 +(word) utoa_append::return +(word) utoa_append::return#0 +(word) utoa_append::return#1 +(word) utoa_append::return#2 +(word) utoa_append::return#3 +(word) utoa_append::return#4 +(word) utoa_append::sub +(word) utoa_append::sub#0 +(word) utoa_append::sub#1 +(word) utoa_append::sub#2 +(word) utoa_append::sub#3 +(word) utoa_append::value +(word) utoa_append::value#0 +(word) utoa_append::value#1 +(word) utoa_append::value#2 +(word) utoa_append::value#3 +(word) utoa_append::value#4 +(word) utoa_append::value#5 + +Adding number conversion cast (unumber) 5 in (byte) utoa::max_digits#1 ← (number) 5 +Adding number conversion cast (unumber) 4 in (byte) utoa::max_digits#2 ← (number) 4 +Adding number conversion cast (unumber) 6 in (byte) utoa::max_digits#3 ← (number) 6 +Adding number conversion cast (unumber) $10 in (byte) utoa::max_digits#4 ← (number) $10 +Adding number conversion cast (unumber) 0 in *((byte*) utoa::buffer#2) ← (number) 0 +Adding number conversion cast (unumber) 0 in (byte) utoa::started#0 ← (number) 0 +Adding number conversion cast (unumber) 0 in (byte) utoa::digit#0 ← (number) 0 +Adding number conversion cast (unumber) 1 in (number~) utoa::$5 ← (byte) utoa::max_digits#5 - (number) 1 +Adding number conversion cast (unumber) utoa::$5 in (number~) utoa::$5 ← (byte) utoa::max_digits#5 - (unumber)(number) 1 +Adding number conversion cast (unumber) 0 in *((byte*) utoa::buffer#3) ← (number) 0 +Adding number conversion cast (unumber) 1 in (byte) utoa::started#1 ← (number) 1 +Adding number conversion cast (unumber) 0 in (byte) utoa_append::digit#0 ← (number) 0 +Adding number conversion cast (unumber) 0 in (bool~) print_str::$0 ← (number) 0 != *((byte*) print_str::str#2) +Adding number conversion cast (unumber) $28 in (byte*~) print_ln::$0 ← (byte*) print_line_cursor#9 + (number) $28 +Adding number conversion cast (unumber) 4 in (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4 +Adding number conversion cast (unumber) $f in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f +Adding number conversion cast (unumber) print_byte::$2 in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (unumber)(number) $f +Adding number conversion cast (unumber) $194a in (word) rand_seed#0 ← (number) $194a +Adding number conversion cast (unumber) 0 in (word) sum::s#1 ← (number) 0 +Adding number conversion cast (unumber) 0 in (byte) sum::page#1 ← (number) 0 +Adding number conversion cast (unumber) $20 in (bool~) sum::$0 ← (byte) sum::page#3 < (number) $20 +Adding number conversion cast (unumber) 0 in (byte) sum::i#1 ← (number) 0 +Adding number conversion cast (unumber) 0 in (bool~) sum::$1 ← (number) 0 != (byte) sum::i#2 +Adding number conversion cast (unumber) $100 in (byte*) sum::p#2 ← (byte*) sum::p#4 + (number) $100 +Adding number conversion cast (unumber) 0 in (word) main::i#1 ← (number) 0 +Adding number conversion cast (unumber) 6 in (bool~) main::$2 ← (word) main::i#3 < (number) 6 +Adding number conversion cast (snumber) 0 in (signed word) main::return#0 ← (number) 0 +Successful SSA optimization PassNAddNumberTypeConversions +Inlining cast (byte) utoa::max_digits#1 ← (unumber)(number) 5 +Inlining cast (byte) utoa::max_digits#2 ← (unumber)(number) 4 +Inlining cast (byte) utoa::max_digits#3 ← (unumber)(number) 6 +Inlining cast (byte) utoa::max_digits#4 ← (unumber)(number) $10 +Inlining cast *((byte*) utoa::buffer#2) ← (unumber)(number) 0 +Inlining cast (byte) utoa::started#0 ← (unumber)(number) 0 +Inlining cast (byte) utoa::digit#0 ← (unumber)(number) 0 +Inlining cast (byte~) utoa::$4 ← (byte)(word) utoa::value#3 +Inlining cast *((byte*) utoa::buffer#3) ← (unumber)(number) 0 +Inlining cast (byte) utoa::started#1 ← (unumber)(number) 1 +Inlining cast (byte) utoa_append::digit#0 ← (unumber)(number) 0 +Inlining cast (byte*) print_screen#0 ← (byte*)(number) $400 +Inlining cast (word) rand_seed#0 ← (unumber)(number) $194a +Inlining cast (word) sum::s#1 ← (unumber)(number) 0 +Inlining cast (byte) sum::page#1 ← (unumber)(number) 0 +Inlining cast (byte) sum::i#1 ← (unumber)(number) 0 +Inlining cast (word) main::i#1 ← (unumber)(number) 0 +Inlining cast (signed word) main::return#0 ← (snumber)(number) 0 +Successful SSA optimization Pass2InlineCast +Simplifying constant integer cast $8000 +Simplifying constant integer cast $4000 +Simplifying constant integer cast $2000 +Simplifying constant integer cast $1000 +Simplifying constant integer cast $800 +Simplifying constant integer cast $400 +Simplifying constant integer cast $200 +Simplifying constant integer cast $100 +Simplifying constant integer cast $80 +Simplifying constant integer cast $40 +Simplifying constant integer cast $20 +Simplifying constant integer cast $10 +Simplifying constant integer cast 8 +Simplifying constant integer cast 4 +Simplifying constant integer cast 2 +Simplifying constant integer cast $8000 +Simplifying constant integer cast $1000 +Simplifying constant integer cast $200 +Simplifying constant integer cast $40 +Simplifying constant integer cast 8 +Simplifying constant integer cast $2710 +Simplifying constant integer cast $3e8 +Simplifying constant integer cast $64 +Simplifying constant integer cast $a +Simplifying constant integer cast $1000 +Simplifying constant integer cast $100 +Simplifying constant integer cast $10 +Simplifying constant pointer cast (byte*) 57344 +Simplifying constant integer cast 5 +Simplifying constant integer cast 4 +Simplifying constant integer cast 6 +Simplifying constant integer cast $10 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast 0 +Simplifying constant pointer cast (byte*) 1024 +Simplifying constant integer cast 0 +Simplifying constant integer cast $28 +Simplifying constant integer cast 4 +Simplifying constant integer cast $f +Simplifying constant integer cast $194a +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast $20 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast $100 +Simplifying constant integer cast 0 +Simplifying constant integer cast 6 +Simplifying constant integer cast 0 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) 5 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) 6 +Finalized unsigned number type (byte) $10 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 1 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 1 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $28 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) $f +Finalized unsigned number type (word) $194a +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $20 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (word) $100 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 6 +Finalized signed number type (signed byte) 0 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Inferred type updated to byte in (unumber~) utoa::$5 ← (byte) utoa::max_digits#5 - (byte) 1 +Inferred type updated to byte in (unumber~) print_byte::$2 ← (byte) print_byte::b#3 & (byte) $f +Alias candidate removed (volatile)(word) last_time#6 = (word) Ticks#1 (word) last_time#7 (word) Ticks#7 +Alias candidate removed (volatile)(word) Ticks#12 = (word) Ticks#2 (word) last_time#1 (word) Ticks#15 (word) last_time#15 (word) last_time#13 (word) Ticks#8 (word) last_time#8 (word) Ticks#3 (word) last_time#2 +Alias (word) utoa::value#10 = (word) utoa::value#8 (word) utoa::value#12 (word) utoa::value#13 (word) utoa::value#9 (word) utoa::value#14 (word) utoa::value#15 (word) utoa::value#11 +Alias (byte*) utoa::buffer#10 = (byte*) utoa::buffer#17 (byte*) utoa::buffer#21 (byte*) utoa::buffer#16 (byte*) utoa::buffer#18 (byte*) utoa::buffer#13 (byte*) utoa::buffer#19 (byte*) utoa::buffer#20 (byte*) utoa::buffer#6 +Alias (byte) utoa::radix#1 = (byte) utoa::radix#2 (byte) utoa::radix#3 (byte) utoa::radix#4 +Alias (byte) utoa::digit#2 = (byte) utoa::digit#3 (byte) utoa::digit#6 (byte) utoa::digit#5 +Alias (word*) utoa::digit_values#10 = (word*) utoa::digit_values#5 (word*) utoa::digit_values#6 (word*) utoa::digit_values#9 +Alias (word) utoa::value#2 = (word) utoa::value#5 (word) utoa::value#3 (word) utoa::value#4 +Alias (byte) utoa::started#2 = (byte) utoa::started#3 +Alias (byte*) utoa::buffer#11 = (byte*) utoa::buffer#12 (byte*) utoa::buffer#7 (byte*) utoa::buffer#8 (byte*) utoa::buffer#9 +Alias (byte) utoa::max_digits#10 = (byte) utoa::max_digits#8 (byte) utoa::max_digits#5 (byte) utoa::max_digits#9 +Alias (word) utoa::digit_value#0 = (word) utoa::digit_value#1 +Alias (word) utoa_append::return#0 = (word) utoa_append::return#3 +Alias (word) utoa::value#0 = (word~) utoa::$10 +Alias (byte) utoa_append::digit#2 = (byte) utoa_append::digit#4 (byte) utoa_append::digit#3 +Alias (word) utoa_append::value#2 = (word) utoa_append::value#3 (word) utoa_append::value#4 (word) utoa_append::return#1 (word) utoa_append::return#4 (word) utoa_append::return#2 +Alias (word) utoa_append::sub#1 = (word) utoa_append::sub#2 +Alias (byte*) utoa_append::buffer#1 = (byte*) utoa_append::buffer#4 (byte*) utoa_append::buffer#2 +Alias (byte*) print_char_cursor#0 = (byte*) print_line_cursor#0 (byte*) print_screen#0 (byte*) print_char_cursor#60 (byte*) print_line_cursor#28 (byte*) print_char_cursor#59 (byte*) print_line_cursor#26 (byte*) print_char_cursor#53 (byte*) print_line_cursor#22 +Alias (byte*) print_str::str#2 = (byte*) print_str::str#3 +Alias (byte*) print_char_cursor#2 = (byte*) print_char_cursor#23 (byte*) print_char_cursor#45 (byte*) print_char_cursor#24 +Alias (byte*) print_line_cursor#1 = (byte*~) print_ln::$0 (byte*) print_line_cursor#10 (byte*) print_char_cursor#3 (byte*) print_line_cursor#11 (byte*) print_char_cursor#26 (byte*) print_line_cursor#2 (byte*) print_char_cursor#4 +Alias (byte) print_byte::b#0 = (byte~) print_word::$0 +Alias (word) print_word::w#1 = (word) print_word::w#2 +Alias (byte*) print_char_cursor#27 = (byte*) print_char_cursor#5 +Alias (byte) print_byte::b#1 = (byte~) print_word::$2 +Alias (byte*) print_char_cursor#28 = (byte*) print_char_cursor#6 (byte*) print_char_cursor#29 (byte*) print_char_cursor#7 +Alias (byte*) print_char_cursor#48 = (byte*) print_char_cursor#55 +Alias (byte*) print_char_cursor#30 = (byte*) print_char_cursor#8 (byte*) print_char_cursor#31 (byte*) print_char_cursor#9 +Alias (byte) print_byte::b#2 = (byte) print_byte::b#3 +Alias (byte*) print_char_cursor#10 = (byte*) print_char_cursor#32 +Alias (byte*) print_char_cursor#11 = (byte*) print_char_cursor#33 (byte*) print_char_cursor#34 (byte*) print_char_cursor#12 +Alias (byte*) print_char_cursor#13 = (byte*) print_char_cursor#36 (byte*) print_char_cursor#14 +Alias (word) rand_seed#0 = (word) rand_seed#9 (word) rand_seed#1 +Alias (byte*) print_char_cursor#50 = (byte*) print_char_cursor#56 +Alias (byte*) print_line_cursor#19 = (byte*) print_line_cursor#23 (byte*) print_line_cursor#27 +Alias (word) rand_seed#10 = (word) rand_seed#2 (word) rand_seed#21 (word) rand_seed#17 (word) rand_seed#11 (word) rand_seed#3 +Alias (byte*) print_char_cursor#15 = (byte*) print_char_cursor#37 +Alias (byte*) print_line_cursor#12 = (byte*) print_line_cursor#3 (byte*) print_line_cursor#13 (byte*) print_line_cursor#4 +Alias (byte*) print_char_cursor#16 = (byte*) print_char_cursor#38 (byte*) print_char_cursor#39 (byte*) print_char_cursor#17 +Alias (word) Ticks#0 = (word) Ticks#17 (word) Ticks#14 +Alias (word) last_time#0 = (word) last_time#17 (word) last_time#14 +Alias (byte*) sum::p#5 = (byte*) sum::p#6 +Alias (word) sum::s#3 = (word) sum::s#6 (word) sum::s#5 (word) sum::return#0 (word) sum::return#3 (word) sum::return#1 +Alias (byte) sum::page#3 = (byte) sum::page#6 +Alias (byte*) sum::p#3 = (byte*) sum::p#4 +Alias (byte) sum::page#4 = (byte) sum::page#5 +Alias (word) sum::s#2 = (word) sum::s#7 +Alias (word) last_time#19 = (word) last_time#20 +Alias (word) Ticks#19 = (word) Ticks#20 +Alias (byte*) print_char_cursor#61 = (byte*) print_char_cursor#62 +Alias (byte*) print_line_cursor#29 = (byte*) print_line_cursor#31 +Alias (word) rand_seed#12 = (word) rand_seed#5 +Alias (byte*) print_char_cursor#51 = (byte*) print_char_cursor#57 (byte*) print_char_cursor#58 (byte*) print_char_cursor#52 +Alias (byte*) print_line_cursor#20 = (byte*) print_line_cursor#30 (byte*) print_line_cursor#25 (byte*) print_line_cursor#24 (byte*) print_line_cursor#21 +Alias (word) main::i#3 = (word) main::i#7 (word) main::i#6 (word) main::i#5 (word) main::i#4 +Alias (word) last_time#12 = (word) last_time#23 (word) last_time#16 (word) last_time#22 (word) last_time#21 (word) last_time#18 +Alias (word) Ticks#13 = (word) Ticks#23 (word) Ticks#16 (word) Ticks#22 (word) Ticks#21 (word) Ticks#18 +Alias (word) rand_seed#19 = (word) rand_seed#26 (word) rand_seed#22 (word) rand_seed#25 (word) rand_seed#24 (word) rand_seed#23 +Alias (word) sum::return#2 = (word) sum::return#4 +Alias (word) print_word_decimal::w#0 = (word~) main::$3 +Alias (byte*) print_char_cursor#18 = (byte*) print_char_cursor#40 +Alias (byte*) print_line_cursor#14 = (byte*) print_line_cursor#5 +Alias (byte*) print_char_cursor#19 = (byte*) print_char_cursor#41 +Alias (word) Ticks#10 = (word) Ticks#4 (word) Ticks#9 (word) Ticks#5 +Alias (word) rand_seed#13 = (word) rand_seed#6 (word) rand_seed#14 (word) rand_seed#7 +Alias (word) last_time#10 = (word) last_time#3 (word) last_time#9 (word) last_time#4 +Alias (byte*) print_char_cursor#20 = (byte*) print_char_cursor#42 (byte*) print_char_cursor#43 (byte*) print_char_cursor#21 +Alias (byte*) print_line_cursor#15 = (byte*) print_line_cursor#6 (byte*) print_line_cursor#16 (byte*) print_line_cursor#7 +Alias (signed word) main::return#0 = (signed word) main::return#3 (signed word) main::return#1 +Alias (word) rand_seed#20 = (word) rand_seed#4 +Alias (word) rand_seed#15 = (word) rand_seed#8 +Alias (byte*) print_char_cursor#22 = (byte*) print_char_cursor#44 +Alias (byte*) print_line_cursor#17 = (byte*) print_line_cursor#8 +Alias (word) Ticks#11 = (word) Ticks#6 +Alias (word) last_time#11 = (word) last_time#5 +Successful SSA optimization Pass2AliasElimination +Alias candidate removed (volatile)(word) last_time#6 = (word) Ticks#1 (word) last_time#7 (word) Ticks#7 +Alias candidate removed (volatile)(word) Ticks#12 = (word) Ticks#2 (word) last_time#1 (word) Ticks#15 (word) last_time#15 (word) last_time#13 (word) Ticks#8 (word) last_time#8 (word) Ticks#3 (word) last_time#2 +Alias (word) utoa::value#10 = (word) utoa::value#7 +Alias (byte*) utoa::buffer#10 = (byte*) utoa::buffer#15 +Alias (byte) utoa::digit#2 = (byte) utoa::digit#4 +Alias (byte) utoa::max_digits#10 = (byte) utoa::max_digits#6 +Alias (word*) utoa::digit_values#10 = (word*) utoa::digit_values#7 +Successful SSA optimization Pass2AliasElimination +Alias candidate removed (volatile)(word) last_time#6 = (word) Ticks#1 (word) last_time#7 (word) Ticks#7 +Alias candidate removed (volatile)(word) Ticks#12 = (word) Ticks#2 (word) last_time#1 (word) Ticks#15 (word) last_time#15 (word) last_time#13 (word) Ticks#8 (word) last_time#8 (word) Ticks#3 (word) last_time#2 +Identical Phi Values (byte) utoa::radix#1 (byte) utoa::radix#0 +Identical Phi Values (word) utoa::value#10 (word) utoa::value#1 +Identical Phi Values (byte*) utoa::buffer#10 (byte*) utoa::buffer#5 +Identical Phi Values (byte) utoa::max_digits#10 (byte) utoa::max_digits#7 +Identical Phi Values (word*) utoa::digit_values#10 (word*) utoa::digit_values#8 +Identical Phi Values (word) utoa_append::value#5 (word) utoa_append::value#0 +Identical Phi Values (word) utoa_append::sub#3 (word) utoa_append::sub#0 +Identical Phi Values (byte*) utoa_append::buffer#3 (byte*) utoa_append::buffer#0 +Identical Phi Values (word) utoa_append::sub#1 (word) utoa_append::sub#3 +Identical Phi Values (byte*) utoa_append::buffer#1 (byte*) utoa_append::buffer#3 +Identical Phi Values (byte*) print_str::str#4 (byte*) print_str::str#1 +Identical Phi Values (byte*) print_char_cursor#54 (byte*) print_char_cursor#48 +Identical Phi Values (byte*) print_char_cursor#25 (byte*) print_char_cursor#46 +Identical Phi Values (word) print_word::w#1 (word) print_word::w#0 +Identical Phi Values (byte*) print_char_cursor#47 (byte*) print_char_cursor#50 +Identical Phi Values (byte*) print_char_cursor#27 (byte*) print_char_cursor#11 +Identical Phi Values (byte*) print_char_cursor#28 (byte*) print_char_cursor#11 +Identical Phi Values (word) print_word_decimal::w#1 (word) print_word_decimal::w#0 +Identical Phi Values (byte*) print_char_cursor#48 (byte*) print_char_cursor#51 +Identical Phi Values (byte*) print_char_cursor#30 (byte*) print_char_cursor#2 +Identical Phi Values (byte*) print_char_cursor#10 (byte*) print_char_cursor#13 +Identical Phi Values (byte*) print_char_cursor#11 (byte*) print_char_cursor#13 +Identical Phi Values (word) last_time#6 (word) last_time#12 +Identical Phi Values (word) rand_seed#16 (word) rand_seed#19 +Identical Phi Values (byte*) print_char_cursor#50 (byte*) print_char_cursor#51 +Identical Phi Values (byte*) print_line_cursor#19 (byte*) print_line_cursor#20 +Identical Phi Values (word) rand_seed#10 (word) rand_seed#0 +Identical Phi Values (word) last_time#7 (word) last_time#6 +Identical Phi Values (word) Ticks#7 (word) Ticks#1 +Identical Phi Values (byte*) print_char_cursor#15 (byte*) print_char_cursor#28 +Identical Phi Values (word) Ticks#15 (word) Ticks#2 +Identical Phi Values (word) last_time#15 (word) last_time#1 +Identical Phi Values (byte*) print_line_cursor#12 (byte*) print_line_cursor#1 +Identical Phi Values (byte*) print_char_cursor#16 (byte*) print_line_cursor#1 +Identical Phi Values (word) Ticks#12 (word) Ticks#15 +Identical Phi Values (word) last_time#13 (word) last_time#15 +Identical Phi Values (word) Ticks#8 (word) Ticks#12 +Identical Phi Values (word) last_time#8 (word) last_time#13 +Identical Phi Values (byte*) sum::p#3 (byte*) sum::p#5 +Identical Phi Values (byte) sum::page#4 (byte) sum::page#3 +Identical Phi Values (word) rand_seed#18 (word) rand_seed#20 +Identical Phi Values (word) last_time#19 (word) last_time#0 +Identical Phi Values (word) Ticks#19 (word) Ticks#0 +Identical Phi Values (byte*) print_char_cursor#61 (byte*) print_char_cursor#0 +Identical Phi Values (byte*) print_line_cursor#29 (byte*) print_char_cursor#0 +Identical Phi Values (word) rand_seed#12 (word) rand_seed#0 +Identical Phi Values (word) last_time#12 (word) last_time#19 +Identical Phi Values (word) Ticks#13 (word) Ticks#19 +Identical Phi Values (word) rand_seed#19 (word) rand_seed#12 +Identical Phi Values (byte*) print_char_cursor#18 (byte*) print_char_cursor#30 +Identical Phi Values (byte*) print_line_cursor#14 (byte*) print_line_cursor#1 +Identical Phi Values (byte*) print_char_cursor#19 (byte*) print_line_cursor#1 +Identical Phi Values (word) Ticks#10 (word) Ticks#3 +Identical Phi Values (word) rand_seed#13 (word) rand_seed#10 +Identical Phi Values (word) last_time#10 (word) last_time#2 +Identical Phi Values (byte*) print_char_cursor#20 (byte*) print_char_cursor#16 +Identical Phi Values (byte*) print_line_cursor#15 (byte*) print_line_cursor#12 +Identical Phi Values (word) rand_seed#15 (word) rand_seed#13 +Identical Phi Values (byte*) print_char_cursor#22 (byte*) print_char_cursor#20 +Identical Phi Values (byte*) print_line_cursor#17 (byte*) print_line_cursor#15 +Identical Phi Values (word) Ticks#11 (word) Ticks#10 +Identical Phi Values (word) last_time#11 (word) last_time#10 +Successful SSA optimization Pass2IdenticalPhiElimination +Identical Phi Values (byte*) print_line_cursor#18 (byte*) print_line_cursor#20 +Successful SSA optimization Pass2IdenticalPhiElimination +Simple Condition (bool~) utoa::$0 [4] if((byte) utoa::radix#0==(const byte) DECIMAL) goto utoa::@1 +Simple Condition (bool~) utoa::$1 [10] if((byte) utoa::radix#0==(const byte) HEXADECIMAL) goto utoa::@2 +Simple Condition (bool~) utoa::$2 [16] if((byte) utoa::radix#0==(const byte) OCTAL) goto utoa::@3 +Simple Condition (bool~) utoa::$3 [22] if((byte) utoa::radix#0==(const byte) BINARY) goto utoa::@4 +Simple Condition (bool~) utoa::$6 [41] if((byte) utoa::digit#2<(byte~) utoa::$5) goto utoa::@19 +Simple Condition (bool~) utoa_append::$0 [71] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 +Simple Condition (bool~) print_str::$0 [87] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 +Simple Condition (bool~) print_ln::$1 [100] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1 +Simple Condition (bool~) sum::$0 [196] if((byte) sum::page#3<(byte) $20) goto sum::@2 +Simple Condition (bool~) sum::$1 [206] if((byte) 0!=(byte) sum::i#2) goto sum::@4 +Simple Condition (bool~) main::$2 [221] if((word) main::i#3<(byte) 6) goto main::@2 +Successful SSA optimization Pass2ConditionalJumpSimplification +Rewriting ! if()-condition to reversed if() [47] (bool~) utoa::$9 ← ! (bool~) utoa::$8 +Rewriting || if()-condition to two if()s [46] (bool~) utoa::$8 ← (byte) utoa::started#2 || (bool~) utoa::$7 +Successful SSA optimization Pass2ConditionalAndOrRewriting +Warning! Adding boolean cast to non-boolean condition (byte) utoa::started#2 +Constant (const byte) utoa::max_digits#0 = 0 +Constant (const word*) utoa::digit_values#0 = (word*) 0 +Constant (const byte) utoa::max_digits#1 = 5 +Constant (const word*) utoa::digit_values#1 = RADIX_DECIMAL_VALUES +Constant (const byte) utoa::max_digits#2 = 4 +Constant (const word*) utoa::digit_values#2 = RADIX_HEXADECIMAL_VALUES +Constant (const byte) utoa::max_digits#3 = 6 +Constant (const word*) utoa::digit_values#3 = RADIX_OCTAL_VALUES +Constant (const byte) utoa::max_digits#4 = $10 +Constant (const word*) utoa::digit_values#4 = RADIX_BINARY_VALUES +Constant (const byte) utoa::started#0 = 0 +Constant (const byte) utoa::digit#0 = 0 +Constant (const byte) utoa::started#1 = 1 +Constant (const byte) utoa_append::digit#0 = 0 +Constant (const byte*) print_char_cursor#0 = (byte*) 1024 +Constant (const byte*) utoa::buffer#5 = decimal_digits +Constant (const byte) utoa::radix#0 = DECIMAL +Constant (const byte*) print_str::str#1 = decimal_digits +Constant (const word) Ticks#0 = 0 +Constant (const word) sum::s#0 = 0 +Constant (const byte*) sum::p#0 = (byte*) 0 +Constant (const byte) sum::page#0 = 0 +Constant (const byte) sum::i#0 = 0 +Constant (const byte) sum::tmp#0 = 0 +Constant (const byte*) sum::p#1 = rom +Constant (const word) sum::s#1 = 0 +Constant (const byte) sum::page#1 = 0 +Constant (const byte) sum::i#1 = 0 +Constant (const word) main::i#0 = 0 +Constant (const word) main::i#1 = 0 +Constant (const signed word) main::return#0 = 0 +Successful SSA optimization Pass2ConstantIdentification +Constant (const signed word) main::return#2 = main::return#0 +Successful SSA optimization Pass2ConstantIdentification +if() condition always true - replacing block destination [4] if((const byte) utoa::radix#0==(const byte) DECIMAL) goto utoa::@1 +if() condition always false - eliminating [10] if((const byte) utoa::radix#0==(const byte) HEXADECIMAL) goto utoa::@2 +if() condition always false - eliminating [16] if((const byte) utoa::radix#0==(const byte) OCTAL) goto utoa::@3 +if() condition always false - eliminating [22] if((const byte) utoa::radix#0==(const byte) BINARY) goto utoa::@4 +Successful SSA optimization Pass2ConstantIfs +Successful SSA optimization Pass2ConstantStringConsolidation +Eliminating unused variable (word) Ticks#3 and assignment [79] (word) Ticks#3 ← (word) Ticks#2 +Eliminating unused constant (const byte) BINARY +Eliminating unused constant (const byte) OCTAL +Eliminating unused constant (const byte) HEXADECIMAL +Eliminating unused constant (const byte) utoa::max_digits#0 +Eliminating unused constant (const word*) utoa::digit_values#0 +Eliminating unused constant (const byte) utoa::radix#0 +Eliminating unused constant (const word) sum::s#0 +Eliminating unused constant (const byte*) sum::p#0 +Eliminating unused constant (const byte) sum::page#0 +Eliminating unused constant (const byte) sum::i#0 +Eliminating unused constant (const byte) sum::tmp#0 +Eliminating unused constant (const word) main::i#0 +Eliminating unused constant (const signed word) main::return#2 +Eliminating unused constant (const word) Ticks#0 +Successful SSA optimization PassNEliminateUnusedVars +Eliminating unused constant (const byte) DECIMAL +Eliminating unused constant (const signed word) main::return#0 +Successful SSA optimization PassNEliminateUnusedVars +Eliminating variable (byte*) utoa::buffer#0 from unused block utoa::@12 +Eliminating variable (byte*) utoa::buffer#1 from unused block utoa::@12 +Eliminating variable (byte*) utoa::buffer#2 from unused block utoa::@12 +Removing unused block utoa::@9 +Removing PHI-reference to removed block (utoa::@2) in block utoa::@8 +Removing PHI-reference to removed block (utoa::@2) in block utoa::@8 +Removing unused block utoa::@2 +Removing unused block utoa::@10 +Removing PHI-reference to removed block (utoa::@3) in block utoa::@8 +Removing PHI-reference to removed block (utoa::@3) in block utoa::@8 +Removing unused block utoa::@3 +Removing unused block utoa::@11 +Removing PHI-reference to removed block (utoa::@4) in block utoa::@8 +Removing PHI-reference to removed block (utoa::@4) in block utoa::@8 +Removing unused block utoa::@4 +Removing unused block utoa::@12 +Successful SSA optimization Pass2EliminateUnusedBlocks +Adding number conversion cast (unumber) 0 in (bool~) utoa::$12 ← (number) 0 != (byte) utoa::started#2 +Successful SSA optimization PassNAddNumberTypeConversions +Simplifying constant integer cast 0 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) 0 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Identical Phi Values (byte) utoa::max_digits#7 (const byte) utoa::max_digits#1 +Identical Phi Values (word*) utoa::digit_values#8 (const word*) utoa::digit_values#1 +Successful SSA optimization Pass2IdenticalPhiElimination +Simple Condition (bool~) utoa::$12 [9] if((byte) 0!=(byte) utoa::started#2) goto utoa::@24 +Simple Condition (bool~) utoa::$7 [97] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@24 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant right-side identified [3] (byte~) utoa::$5 ← (const byte) utoa::max_digits#1 - (byte) 1 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) utoa::$5 = utoa::max_digits#1-1 +Successful SSA optimization Pass2ConstantIdentification +Eliminating unused constant (const byte) utoa::max_digits#2 +Eliminating unused constant (const word*) utoa::digit_values#2 +Eliminating unused constant (const byte) utoa::max_digits#3 +Eliminating unused constant (const word*) utoa::digit_values#3 +Eliminating unused constant (const byte) utoa::max_digits#4 +Eliminating unused constant (const word*) utoa::digit_values#4 +Successful SSA optimization PassNEliminateUnusedVars +Eliminating unused constant (const word*) RADIX_BINARY_VALUES +Eliminating unused constant (const word*) RADIX_OCTAL_VALUES +Eliminating unused constant (const word*) RADIX_HEXADECIMAL_VALUES +Successful SSA optimization PassNEliminateUnusedVars +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Rewriting multiplication to use shift [3] (byte~) utoa::$11 ← (byte) utoa::digit#2 * (const byte) SIZEOF_WORD +Successful SSA optimization Pass2MultiplyToShiftRewriting +Inlining constant with var siblings (const byte) utoa::started#0 +Inlining constant with var siblings (const byte) utoa::digit#0 +Inlining constant with var siblings (const byte) utoa::started#1 +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 byte*) print_str::str#1 +Inlining constant with var siblings (const byte*) sum::p#1 +Inlining constant with var siblings (const word) sum::s#1 +Inlining constant with var siblings (const byte) sum::page#1 +Inlining constant with var siblings (const byte) sum::i#1 +Inlining constant with var siblings (const word) main::i#1 +Inlining constant with var siblings (const byte*) print_char_cursor#0 +Constant inlined utoa_append::digit#0 = (byte) 0 +Constant inlined utoa::digit_values#1 = (const word*) RADIX_DECIMAL_VALUES +Constant inlined sum::i#1 = (byte) 0 +Constant inlined print_hextab = (const byte*) DIGITS +Constant inlined utoa::started#1 = (byte) 1 +Constant inlined utoa::started#0 = (byte) 0 +Constant inlined sum::page#1 = (byte) 0 +Constant inlined print_char_cursor#0 = (byte*) 1024 +Constant inlined utoa::buffer#5 = (const byte*) decimal_digits +Constant inlined utoa::digit#0 = (byte) 0 +Constant inlined utoa::$5 = (const byte) utoa::max_digits#1-(byte) 1 +Constant inlined print_str::str#1 = (const byte*) decimal_digits +Constant inlined sum::s#1 = (byte) 0 +Constant inlined main::i#1 = (byte) 0 +Constant inlined sum::p#1 = (const byte*) rom +Successful SSA optimization Pass2ConstantInlining +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Eliminating unused constant (const byte) SIZEOF_WORD +Successful SSA optimization PassNEliminateUnusedVars +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Added new block during phi lifting utoa::@28(between utoa::@27 and utoa::@21) +Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) +Added new block during phi lifting sum::@10(between sum::@4 and sum::@4) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @12 +Adding NOP phi() at start of @47 +Adding NOP phi() at start of @48 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@8 +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@12 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of print_ln::@2 +Adding NOP phi() at start of print_word_decimal::@1 +Adding NOP phi() at start of print_word_decimal::@2 +Adding NOP phi() at start of utoa +Adding NOP phi() at start of utoa::@1 +Adding NOP phi() at start of sum +Adding NOP phi() at start of sum::@3 +Adding NOP phi() at start of end::@3 +Adding NOP phi() at start of print_word::@2 +Adding NOP phi() at start of print_byte::@2 +CALL GRAPH +Calls in [] to main:5 +Calls in [main] to start:9 end:14 sum:18 print_word_decimal:21 print_ln:23 +Calls in [print_word_decimal] to utoa:37 print_str:39 +Calls in [utoa] to utoa_append:77 +Calls in [end] to start:111 print_word:115 print_ln:117 +Calls in [print_word] to print_byte:124 print_byte:128 +Calls in [print_byte] to print_char:136 print_char:141 + +Created 25 initial phi equivalence classes +Coalesced [22] print_char_cursor#66 ← print_char_cursor#2 +Coalesced [25] main::i#8 ← main::i#2 +Not coalescing [26] print_char_cursor#71 ← print_line_cursor#1 +Coalesced [27] print_line_cursor#34 ← print_line_cursor#1 +Coalesced [29] print_line_cursor#32 ← print_line_cursor#20 +Coalesced (already) [35] print_line_cursor#33 ← print_line_cursor#1 +Coalesced [42] print_char_cursor#63 ← print_char_cursor#51 +Coalesced [49] print_str::str#5 ← print_str::str#0 +Coalesced [50] print_char_cursor#64 ← print_char_cursor#1 +Coalesced [53] utoa::value#17 ← utoa::value#1 +Coalesced [65] utoa::value#18 ← utoa::value#2 +Coalesced [66] utoa::started#6 ← utoa::started#2 +Coalesced [67] utoa::buffer#23 ← utoa::buffer#11 +Coalesced [70] utoa::digit#7 ← utoa::digit#1 +Coalesced (already) [71] utoa::value#16 ← utoa::value#6 +Coalesced (already) [72] utoa::started#5 ← utoa::started#4 +Coalesced (already) [73] utoa::buffer#22 ← utoa::buffer#14 +Coalesced [81] utoa::value#19 ← utoa::value#0 +Coalesced [82] utoa::buffer#24 ← utoa::buffer#4 +Coalesced [83] utoa_append::value#6 ← utoa_append::value#0 +Coalesced [90] utoa_append::value#7 ← utoa_append::value#1 +Coalesced [91] utoa_append::digit#5 ← utoa_append::digit#1 +Coalesced [97] sum::s#9 ← sum::s#3 +Coalesced [105] sum::page#7 ← sum::page#2 +Coalesced [106] sum::s#8 ← sum::s#2 +Coalesced [107] sum::p#7 ← sum::p#2 +Coalesced [108] sum::i#4 ← sum::i#2 +Coalesced (already) [109] sum::s#10 ← sum::s#2 +Coalesced [116] print_char_cursor#65 ← print_char_cursor#13 +Coalesced [122] print_byte::b#4 ← print_byte::b#0 +Coalesced [123] print_char_cursor#67 ← print_char_cursor#51 +Coalesced [126] print_byte::b#5 ← print_byte::b#1 +Coalesced (already) [127] print_char_cursor#68 ← print_char_cursor#13 +Coalesced [134] print_char::ch#3 ← print_char::ch#0 +Coalesced [135] print_char_cursor#69 ← print_char_cursor#49 +Coalesced [139] print_char::ch#4 ← print_char::ch#1 +Coalesced (already) [140] print_char_cursor#70 ← print_char_cursor#13 +Coalesced down to 16 phi equivalence classes +Culled Empty Block (label) @12 +Culled Empty Block (label) @48 +Culled Empty Block (label) main::@8 +Culled Empty Block (label) main::@12 +Culled Empty Block (label) print_ln::@2 +Culled Empty Block (label) print_ln::@3 +Culled Empty Block (label) print_word_decimal::@2 +Culled Empty Block (label) utoa::@1 +Culled Empty Block (label) utoa::@8 +Culled Empty Block (label) utoa::@28 +Culled Empty Block (label) sum::@3 +Culled Empty Block (label) sum::@2 +Culled Empty Block (label) sum::@10 +Culled Empty Block (label) end::@3 +Culled Empty Block (label) print_word::@2 +Culled Empty Block (label) print_byte::@2 +Renumbering block @42 to @1 +Renumbering block @44 to @2 +Renumbering block @47 to @3 +Renumbering block utoa::@18 to utoa::@1 +Renumbering block utoa::@19 to utoa::@2 +Renumbering block utoa::@20 to utoa::@3 +Renumbering block utoa::@21 to utoa::@4 +Renumbering block utoa::@24 to utoa::@5 +Renumbering block utoa::@26 to utoa::@6 +Renumbering block utoa::@27 to utoa::@7 +Renumbering block sum::@4 to sum::@2 +Renumbering block sum::@5 to sum::@3 +Renumbering block main::@9 to main::@4 +Renumbering block main::@10 to main::@5 +Renumbering block main::@11 to main::@6 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @3 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@5 +Adding NOP phi() at start of print_word_decimal::@1 +Adding NOP phi() at start of print_str +Adding NOP phi() at start of utoa +Adding NOP phi() at start of utoa_append +Adding NOP phi() at start of sum +Adding NOP phi() at start of end::@2 + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] (word) last_time#0 ← (word) 0 + to:@2 +@2: scope:[] from @1 + [2] (word) rand_seed#20 ← (word) 0 + to:@3 +@3: scope:[] from @2 + [3] phi() + [4] call main + to:@end +@end: scope:[] from @3 + [5] phi() + +(signed word()) main() +main: scope:[main] from @3 + [6] phi() + [7] call start + to:main::@1 +main::@1: scope:[main] from main main::@6 + [8] (byte*) print_line_cursor#20 ← phi( main::@6/(byte*) print_line_cursor#1 main/(byte*) 1024 ) + [8] (byte*) print_char_cursor#51 ← phi( main::@6/(byte*) print_char_cursor#71 main/(byte*) 1024 ) + [8] (word) main::i#3 ← phi( main::@6/(word) main::i#2 main/(byte) 0 ) + [9] if((word) main::i#3<(byte) 6) goto main::@2 + to:main::@3 +main::@3: scope:[main] from main::@1 + [10] phi() + [11] call end + to:main::@return +main::@return: scope:[main] from main::@3 + [12] return + to:@return +main::@2: scope:[main] from main::@1 + [13] phi() + [14] call sum + [15] (word) sum::return#2 ← (word) sum::s#3 + to:main::@4 +main::@4: scope:[main] from main::@2 + [16] (word) print_word_decimal::w#0 ← (word) sum::return#2 + [17] call print_word_decimal + to:main::@5 +main::@5: scope:[main] from main::@4 + [18] phi() + [19] call print_ln + to:main::@6 +main::@6: scope:[main] from main::@5 + [20] (word) main::i#2 ← ++ (word) main::i#3 + [21] (byte*) print_char_cursor#71 ← (byte*) print_line_cursor#1 + to:main::@1 + +(void()) print_ln() +print_ln: scope:[print_ln] from end::@2 main::@5 + [22] (byte*) print_char_cursor#46 ← phi( end::@2/(byte*) print_char_cursor#13 main::@5/(byte*) print_char_cursor#2 ) + to:print_ln::@1 +print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 + [23] (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#20 print_ln::@1/(byte*) print_line_cursor#1 ) + [24] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 + [25] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1 + to:print_ln::@return +print_ln::@return: scope:[print_ln] from print_ln::@1 + [26] return + to:@return + +(void()) print_word_decimal((word) print_word_decimal::w) +print_word_decimal: scope:[print_word_decimal] from main::@4 + [27] (word) utoa::value#1 ← (word) print_word_decimal::w#0 + [28] call utoa + to:print_word_decimal::@1 +print_word_decimal::@1: scope:[print_word_decimal] from print_word_decimal + [29] phi() + [30] call print_str + to:print_word_decimal::@return +print_word_decimal::@return: scope:[print_word_decimal] from print_word_decimal::@1 + [31] return + to:@return + +(void()) print_str((byte*) print_str::str) +print_str: scope:[print_str] from print_word_decimal::@1 + [32] phi() + to:print_str::@1 +print_str::@1: scope:[print_str] from print_str print_str::@2 + [33] (byte*) print_char_cursor#2 ← phi( print_str/(byte*) print_char_cursor#51 print_str::@2/(byte*) print_char_cursor#1 ) + [33] (byte*) print_str::str#2 ← phi( print_str/(const byte*) decimal_digits print_str::@2/(byte*) print_str::str#0 ) + [34] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 + to:print_str::@return +print_str::@return: scope:[print_str] from print_str::@1 + [35] return + to:@return +print_str::@2: scope:[print_str] from print_str::@1 + [36] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2) + [37] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2 + [38] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 + to:print_str::@1 + +(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix) +utoa: scope:[utoa] from print_word_decimal + [39] phi() + to:utoa::@1 +utoa::@1: scope:[utoa] from utoa utoa::@4 + [40] (byte*) utoa::buffer#11 ← phi( utoa::@4/(byte*) utoa::buffer#14 utoa/(const byte*) decimal_digits ) + [40] (byte) utoa::started#2 ← phi( utoa::@4/(byte) utoa::started#4 utoa/(byte) 0 ) + [40] (word) utoa::value#2 ← phi( utoa::@4/(word) utoa::value#6 utoa/(word) utoa::value#1 ) + [40] (byte) utoa::digit#2 ← phi( utoa::@4/(byte) utoa::digit#1 utoa/(byte) 0 ) + [41] if((byte) utoa::digit#2<(const byte) utoa::max_digits#1-(byte) 1) goto utoa::@2 + to:utoa::@3 +utoa::@3: scope:[utoa] from utoa::@1 + [42] (byte~) utoa::$4 ← (byte)(word) utoa::value#2 + [43] *((byte*) utoa::buffer#11) ← *((const byte*) DIGITS + (byte~) utoa::$4) + [44] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11 + [45] *((byte*) utoa::buffer#3) ← (byte) 0 + to:utoa::@return +utoa::@return: scope:[utoa] from utoa::@3 + [46] return + to:@return +utoa::@2: scope:[utoa] from utoa::@1 + [47] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1 + [48] (word) utoa::digit_value#0 ← *((const word*) RADIX_DECIMAL_VALUES + (byte~) utoa::$11) + [49] if((byte) 0!=(byte) utoa::started#2) goto utoa::@5 + to:utoa::@7 +utoa::@7: scope:[utoa] from utoa::@2 + [50] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5 + to:utoa::@4 +utoa::@4: scope:[utoa] from utoa::@6 utoa::@7 + [51] (byte*) utoa::buffer#14 ← phi( utoa::@7/(byte*) utoa::buffer#11 utoa::@6/(byte*) utoa::buffer#4 ) + [51] (byte) utoa::started#4 ← phi( utoa::@7/(byte) utoa::started#2 utoa::@6/(byte) 1 ) + [51] (word) utoa::value#6 ← phi( utoa::@7/(word) utoa::value#2 utoa::@6/(word) utoa::value#0 ) + [52] (byte) utoa::digit#1 ← ++ (byte) utoa::digit#2 + to:utoa::@1 +utoa::@5: scope:[utoa] from utoa::@2 utoa::@7 + [53] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11 + [54] (word) utoa_append::value#0 ← (word) utoa::value#2 + [55] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0 + [56] call utoa_append + [57] (word) utoa_append::return#0 ← (word) utoa_append::value#2 + to:utoa::@6 +utoa::@6: scope:[utoa] from utoa::@5 + [58] (word) utoa::value#0 ← (word) utoa_append::return#0 + [59] (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#11 + to:utoa::@4 + +(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub) +utoa_append: scope:[utoa_append] from utoa::@5 + [60] phi() + to:utoa_append::@1 +utoa_append::@1: scope:[utoa_append] from utoa_append utoa_append::@2 + [61] (byte) utoa_append::digit#2 ← phi( utoa_append/(byte) 0 utoa_append::@2/(byte) utoa_append::digit#1 ) + [61] (word) utoa_append::value#2 ← phi( utoa_append/(word) utoa_append::value#0 utoa_append::@2/(word) utoa_append::value#1 ) + [62] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 + to:utoa_append::@3 +utoa_append::@3: scope:[utoa_append] from utoa_append::@1 + [63] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2) + to:utoa_append::@return +utoa_append::@return: scope:[utoa_append] from utoa_append::@3 + [64] return + to:@return +utoa_append::@2: scope:[utoa_append] from utoa_append::@1 + [65] (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2 + [66] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0 + to:utoa_append::@1 + +(word()) sum() +sum: scope:[sum] from main::@2 + [67] phi() + to:sum::@1 +sum::@1: scope:[sum] from sum sum::@3 + [68] (byte*) sum::p#5 ← phi( sum/(const byte*) rom sum::@3/(byte*) sum::p#2 ) + [68] (word) sum::s#3 ← phi( sum/(byte) 0 sum::@3/(word) sum::s#2 ) + [68] (byte) sum::page#3 ← phi( sum/(byte) 0 sum::@3/(byte) sum::page#2 ) + [69] if((byte) sum::page#3<(byte) $20) goto sum::@2 + to:sum::@return +sum::@return: scope:[sum] from sum::@1 + [70] return + to:@return +sum::@2: scope:[sum] from sum::@1 sum::@2 + [71] (word) sum::s#4 ← phi( sum::@1/(word) sum::s#3 sum::@2/(word) sum::s#2 ) + [71] (byte) sum::i#3 ← phi( sum::@1/(byte) 0 sum::@2/(byte) sum::i#2 ) + [72] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3) + [73] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 + [74] (byte) sum::i#2 ← ++ (byte) sum::i#3 + [75] if((byte) 0!=(byte) sum::i#2) goto sum::@2 + to:sum::@3 +sum::@3: scope:[sum] from sum::@2 + [76] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100 + [77] (byte) sum::page#2 ← ++ (byte) sum::page#3 + to:sum::@1 + +(void()) end() +end: scope:[end] from main::@3 + [78] (word) Ticks#1 ← (word) last_time#0 + [79] call start + to:end::@1 +end::@1: scope:[end] from end + [80] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 + [81] (word) Ticks#2 ← (word) last_time#1 + [82] (word) print_word::w#0 ← (word) Ticks#2 + [83] call print_word + to:end::@2 +end::@2: scope:[end] from end::@1 + [84] phi() + [85] call print_ln + to:end::@return +end::@return: scope:[end] from end::@2 + [86] (word) last_time#2 ← (word) last_time#1 + [87] return + to:@return + +(void()) print_word((word) print_word::w) +print_word: scope:[print_word] from end::@1 + [88] (byte) print_byte::b#0 ← > (word) print_word::w#0 + [89] call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + [90] (byte) print_byte::b#1 ← < (word) print_word::w#0 + [91] call print_byte + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@1 + [92] return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + [93] (byte*) print_char_cursor#49 ← phi( print_word/(byte*) print_char_cursor#51 print_word::@1/(byte*) print_char_cursor#13 ) + [93] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + [94] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 + [95] (byte) print_char::ch#0 ← *((const byte*) DIGITS + (byte~) print_byte::$0) + [96] call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + [97] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f + [98] (byte) print_char::ch#1 ← *((const byte*) DIGITS + (byte~) print_byte::$2) + [99] call print_char + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@1 + [100] return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + [101] (byte*) print_char_cursor#35 ← phi( print_byte/(byte*) print_char_cursor#49 print_byte::@1/(byte*) print_char_cursor#13 ) + [101] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + [102] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 + [103] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#35 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + [104] return + to:@return + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + [106] (word) rand_seed#0 ← (word) $194a + to:start::@return +start::@return: scope:[start] from start + [107] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(word) Ticks +(word) Ticks#1 2.0 +(word) Ticks#2 4.0 +(void()) end() +(word) last_time +(word) last_time#0 0.3157894736842105 +(word) last_time#1 1.0 +(word) last_time#2 20.0 +(signed word()) main() +(word) main::i +(word) main::i#2 11.0 +(word) main::i#3 3.666666666666667 +(signed word) main::return +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 4.0 +(byte~) print_byte::$2 4.0 +(byte) print_byte::b +(byte) print_byte::b#0 4.0 +(byte) print_byte::b#1 4.0 +(byte) print_byte::b#2 2.0 +(void()) print_char((byte) print_char::ch) +(byte) print_char::ch +(byte) print_char::ch#0 4.0 +(byte) print_char::ch#1 4.0 +(byte) print_char::ch#2 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#1 101.0 +(byte*) print_char_cursor#13 0.6153846153846154 +(byte*) print_char_cursor#2 39.5 +(byte*) print_char_cursor#35 4.0 +(byte*) print_char_cursor#46 28.5 +(byte*) print_char_cursor#49 2.0 +(byte*) print_char_cursor#51 0.8823529411764707 +(byte*) print_char_cursor#71 22.0 +(byte*) print_line_cursor +(byte*) print_line_cursor#1 54.16666666666666 +(byte*) print_line_cursor#20 0.7647058823529412 +(byte*) print_line_cursor#9 204.0 +(void()) print_ln() +(byte*) print_screen +(void()) print_str((byte*) print_str::str) +(byte*) print_str::str +(byte*) print_str::str#0 202.0 +(byte*) print_str::str#2 101.0 +(void()) print_word((word) print_word::w) +(word) print_word::w +(word) print_word::w#0 2.0 +(void()) print_word_decimal((word) print_word_decimal::w) +(word) print_word_decimal::w +(word) print_word_decimal::w#0 13.0 +(word) rand_seed +(word) rand_seed#0 20.0 +(word) rand_seed#20 20.0 +(void()) start() +(word()) sum() +(byte) sum::i +(byte) sum::i#2 1501.5 +(byte) sum::i#3 1001.0 +(byte*) sum::p +(byte*) sum::p#2 101.0 +(byte*) sum::p#5 171.85714285714283 +(byte) sum::page +(byte) sum::page#2 202.0 +(byte) sum::page#3 37.875 +(word) sum::return +(word) sum::return#2 22.0 +(word) sum::s +(word) sum::s#2 420.59999999999997 +(word) sum::s#3 53.25 +(word) sum::s#4 1051.5 +(byte) sum::tmp +(byte) sum::tmp#1 2002.0 +(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix) +(byte~) utoa::$11 202.0 +(byte~) utoa::$4 4.0 +(byte*) utoa::buffer +(byte*) utoa::buffer#11 29.142857142857146 +(byte*) utoa::buffer#14 151.5 +(byte*) utoa::buffer#3 4.0 +(byte*) utoa::buffer#4 202.0 +(byte) utoa::digit +(byte) utoa::digit#1 202.0 +(byte) utoa::digit#2 28.857142857142858 +(word) utoa::digit_value +(word) utoa::digit_value#0 60.599999999999994 +(word*) utoa::digit_values +(byte) utoa::max_digits +(byte) utoa::radix +(byte) utoa::started +(byte) utoa::started#2 50.5 +(byte) utoa::started#4 101.0 +(word) utoa::value +(word) utoa::value#0 101.0 +(word) utoa::value#1 2.0 +(word) utoa::value#2 58.00000000000001 +(word) utoa::value#6 151.5 +(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub) +(byte*) utoa_append::buffer +(byte*) utoa_append::buffer#0 12.875 +(byte) utoa_append::digit +(byte) utoa_append::digit#1 1001.0 +(byte) utoa_append::digit#2 1002.0 +(word) utoa_append::return +(word) utoa_append::return#0 202.0 +(word) utoa_append::sub +(word) utoa_append::sub#0 350.5 +(word) utoa_append::value +(word) utoa_append::value#0 34.33333333333333 +(word) utoa_append::value#1 2002.0 +(word) utoa_append::value#2 517.6666666666667 + +Initial phi equivalence classes +[ main::i#3 main::i#2 ] +[ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] +[ print_str::str#2 print_str::str#0 ] +[ utoa::digit#2 utoa::digit#1 ] +[ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] +[ utoa::started#2 utoa::started#4 ] +[ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] +[ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] +[ utoa_append::digit#2 utoa_append::digit#1 ] +[ sum::page#3 sum::page#2 ] +[ sum::p#5 sum::p#2 ] +[ sum::i#3 sum::i#2 ] +[ sum::s#4 sum::s#3 sum::s#2 ] +[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +[ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +[ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] +Coalescing volatile variable equivalence classes [ last_time#0 ] and [ last_time#1 ] +Coalescing volatile variable equivalence classes [ last_time#0 last_time#1 ] and [ last_time#2 ] +Coalescing volatile variable equivalence classes [ rand_seed#0 ] and [ rand_seed#20 ] +Added variable sum::return#2 to live range equivalence class [ sum::return#2 ] +Added variable print_word_decimal::w#0 to live range equivalence class [ print_word_decimal::w#0 ] +Added variable utoa::$4 to live range equivalence class [ utoa::$4 ] +Added variable utoa::buffer#3 to live range equivalence class [ utoa::buffer#3 ] +Added variable utoa::$11 to live range equivalence class [ utoa::$11 ] +Added variable utoa::digit_value#0 to live range equivalence class [ utoa::digit_value#0 ] +Added variable utoa_append::buffer#0 to live range equivalence class [ utoa_append::buffer#0 ] +Added variable utoa_append::sub#0 to live range equivalence class [ utoa_append::sub#0 ] +Added variable utoa_append::return#0 to live range equivalence class [ utoa_append::return#0 ] +Added variable sum::tmp#1 to live range equivalence class [ sum::tmp#1 ] +Added variable Ticks#1 to live range equivalence class [ Ticks#1 ] +Added variable Ticks#2 to live range equivalence class [ Ticks#2 ] +Added variable print_word::w#0 to live range equivalence class [ print_word::w#0 ] +Added variable print_byte::$0 to live range equivalence class [ print_byte::$0 ] +Added variable print_byte::$2 to live range equivalence class [ print_byte::$2 ] +Complete equivalence classes +[ main::i#3 main::i#2 ] +[ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] +[ print_str::str#2 print_str::str#0 ] +[ utoa::digit#2 utoa::digit#1 ] +[ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] +[ utoa::started#2 utoa::started#4 ] +[ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] +[ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] +[ utoa_append::digit#2 utoa_append::digit#1 ] +[ sum::page#3 sum::page#2 ] +[ sum::p#5 sum::p#2 ] +[ sum::i#3 sum::i#2 ] +[ sum::s#4 sum::s#3 sum::s#2 ] +[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +[ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +[ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] +[ last_time#0 last_time#1 last_time#2 ] +[ rand_seed#0 rand_seed#20 ] +[ sum::return#2 ] +[ print_word_decimal::w#0 ] +[ utoa::$4 ] +[ utoa::buffer#3 ] +[ utoa::$11 ] +[ utoa::digit_value#0 ] +[ utoa_append::buffer#0 ] +[ utoa_append::sub#0 ] +[ utoa_append::return#0 ] +[ sum::tmp#1 ] +[ Ticks#1 ] +[ Ticks#2 ] +[ print_word::w#0 ] +[ print_byte::$0 ] +[ print_byte::$2 ] +Allocated zp[2]:2 [ main::i#3 main::i#2 ] +Allocated zp[2]:4 [ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] +Allocated zp[2]:6 [ print_str::str#2 print_str::str#0 ] +Allocated zp[1]:8 [ utoa::digit#2 utoa::digit#1 ] +Allocated zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] +Allocated zp[1]:11 [ utoa::started#2 utoa::started#4 ] +Allocated zp[2]:12 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] +Allocated zp[2]:14 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] +Allocated zp[1]:16 [ utoa_append::digit#2 utoa_append::digit#1 ] +Allocated zp[1]:17 [ sum::page#3 sum::page#2 ] +Allocated zp[2]:18 [ sum::p#5 sum::p#2 ] +Allocated zp[1]:20 [ sum::i#3 sum::i#2 ] +Allocated zp[2]:21 [ sum::s#4 sum::s#3 sum::s#2 ] +Allocated zp[1]:23 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Allocated zp[1]:24 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Allocated zp[2]:25 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] +Allocated zp[2]:27 [ last_time#0 last_time#1 last_time#2 ] +Allocated zp[2]:29 [ rand_seed#0 rand_seed#20 ] +Allocated zp[2]:31 [ sum::return#2 ] +Allocated zp[2]:33 [ print_word_decimal::w#0 ] +Allocated zp[1]:35 [ utoa::$4 ] +Allocated zp[2]:36 [ utoa::buffer#3 ] +Allocated zp[1]:38 [ utoa::$11 ] +Allocated zp[2]:39 [ utoa::digit_value#0 ] +Allocated zp[2]:41 [ utoa_append::buffer#0 ] +Allocated zp[2]:43 [ utoa_append::sub#0 ] +Allocated zp[2]:45 [ utoa_append::return#0 ] +Allocated zp[1]:47 [ sum::tmp#1 ] +Allocated zp[2]:48 [ Ticks#1 ] +Allocated zp[2]:50 [ Ticks#2 ] +Allocated zp[2]:52 [ print_word::w#0 ] +Allocated zp[1]:54 [ print_byte::$0 ] +Allocated zp[1]:55 [ print_byte::$2 ] + +INITIAL ASM +Target platform is c64basic / MOS6502X + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__bbegin) +.pc = $80d "Program" + // Global Constants & labels + .label rom = $e000 + .label print_char_cursor = $19 + .label print_line_cursor = 4 + .label last_time = $1b + .label rand_seed = $1d + .label Ticks = $30 + .label Ticks_1 = $32 + // @begin +__bbegin: + jmp __b1 + // @1 +__b1: + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + lda #>0 + sta.z last_time+1 + jmp __b2 + // @2 +__b2: + // [2] (word) rand_seed#20 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z rand_seed + lda #>0 + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] +__b3_from___b2: + jmp __b3 + // @3 +__b3: + // [4] call main + // [6] phi from @3 to main [phi:@3->main] +main_from___b3: + jsr main + // [5] phi from @3 to @end [phi:@3->@end] +__bend_from___b3: + jmp __bend + // @end +__bend: + // main +main: { + .label i = 2 + // [7] call start + jsr start + // [8] phi from main to main::@1 [phi:main->main::@1] + __b1_from_main: + // [8] phi (byte*) print_line_cursor#20 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + // [8] phi (byte*) print_char_cursor#51 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [8] phi (word) main::i#3 = (byte) 0 [phi:main->main::@1#2] -- vwuz1=vbuc1 + lda #<0 + sta.z i + lda #>0 + sta.z i+1 + jmp __b1 + // main::@1 + __b1: + // [9] if((word) main::i#3<(byte) 6) goto main::@2 -- vwuz1_lt_vbuc1_then_la1 + lda.z i+1 + cmp #>6 + bcc __b2_from___b1 + bne !+ + lda.z i + cmp #<6 + bcc __b2_from___b1 + !: + // [10] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + __b3_from___b1: + jmp __b3 + // main::@3 + __b3: + // [11] call end + jsr end + jmp __breturn + // main::@return + __breturn: + // [12] return + rts + // [13] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + __b2_from___b1: + jmp __b2 + // main::@2 + __b2: + // [14] call sum + // [67] phi from main::@2 to sum [phi:main::@2->sum] + sum_from___b2: + jsr sum + // [15] (word) sum::return#2 ← (word) sum::s#3 -- vwuz1=vwuz2 + lda.z sum.s + sta.z sum.return + lda.z sum.s+1 + sta.z sum.return+1 + jmp __b4 + // main::@4 + __b4: + // [16] (word) print_word_decimal::w#0 ← (word) sum::return#2 -- vwuz1=vwuz2 + lda.z sum.return + sta.z print_word_decimal.w + lda.z sum.return+1 + sta.z print_word_decimal.w+1 + // [17] call print_word_decimal + jsr print_word_decimal + // [18] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + __b5_from___b4: + jmp __b5 + // main::@5 + __b5: + // [19] call print_ln + // [22] phi from main::@5 to print_ln [phi:main::@5->print_ln] + print_ln_from___b5: + // [22] phi (byte*) print_char_cursor#46 = (byte*) print_char_cursor#2 [phi:main::@5->print_ln#0] -- register_copy + jsr print_ln + jmp __b6 + // main::@6 + __b6: + // [20] (word) main::i#2 ← ++ (word) main::i#3 -- vwuz1=_inc_vwuz1 + inc.z i + bne !+ + inc.z i+1 + !: + // [21] (byte*) print_char_cursor#71 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 + lda.z print_line_cursor + sta.z print_char_cursor + lda.z print_line_cursor+1 + sta.z print_char_cursor+1 + // [8] phi from main::@6 to main::@1 [phi:main::@6->main::@1] + __b1_from___b6: + // [8] phi (byte*) print_line_cursor#20 = (byte*) print_line_cursor#1 [phi:main::@6->main::@1#0] -- register_copy + // [8] phi (byte*) print_char_cursor#51 = (byte*) print_char_cursor#71 [phi:main::@6->main::@1#1] -- register_copy + // [8] phi (word) main::i#3 = (word) main::i#2 [phi:main::@6->main::@1#2] -- register_copy + jmp __b1 +} + // print_ln +// Print a newline +print_ln: { + // [23] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1] + __b1_from_print_ln: + __b1_from___b1: + // [23] phi (byte*) print_line_cursor#9 = (byte*) print_line_cursor#20 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy + jmp __b1 + // print_ln::@1 + __b1: + // [24] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // [25] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1_from___b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1_from___b1 + !: + jmp __breturn + // print_ln::@return + __breturn: + // [26] return + rts +} + // print_word_decimal +// Print a word as DECIMAL +// print_word_decimal(word zeropage($21) w) +print_word_decimal: { + .label w = $21 + // [27] (word) utoa::value#1 ← (word) print_word_decimal::w#0 -- vwuz1=vwuz2 + lda.z w + sta.z utoa.value + lda.z w+1 + sta.z utoa.value+1 + // [28] call utoa + // [39] phi from print_word_decimal to utoa [phi:print_word_decimal->utoa] + utoa_from_print_word_decimal: + jsr utoa + // [29] phi from print_word_decimal to print_word_decimal::@1 [phi:print_word_decimal->print_word_decimal::@1] + __b1_from_print_word_decimal: + jmp __b1 + // print_word_decimal::@1 + __b1: + // [30] call print_str + // [32] phi from print_word_decimal::@1 to print_str [phi:print_word_decimal::@1->print_str] + print_str_from___b1: + jsr print_str + jmp __breturn + // print_word_decimal::@return + __breturn: + // [31] return + rts +} + // print_str +// Print a zero-terminated string +// print_str(byte* zeropage(6) str) +print_str: { + .label str = 6 + // [33] phi from print_str to print_str::@1 [phi:print_str->print_str::@1] + __b1_from_print_str: + // [33] phi (byte*) print_char_cursor#2 = (byte*) print_char_cursor#51 [phi:print_str->print_str::@1#0] -- register_copy + // [33] phi (byte*) print_str::str#2 = (const byte*) decimal_digits [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 + lda #decimal_digits + sta.z str+1 + jmp __b1 + // print_str::@1 + __b1: + // [34] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 + ldy #0 + lda (str),y + cmp #0 + bne __b2 + jmp __breturn + // print_str::@return + __breturn: + // [35] return + rts + // print_str::@2 + __b2: + // [36] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (str),y + ldy #0 + sta (print_char_cursor),y + // [37] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + // [38] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 + inc.z str + bne !+ + inc.z str+1 + !: + // [33] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1] + __b1_from___b2: + // [33] phi (byte*) print_char_cursor#2 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy + // [33] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy + jmp __b1 +} + // utoa +// Converts unsigned number value to a string representing it in RADIX format. +// If the leading digits are zero they are not included in the string. +// - value : The number to be converted to RADIX +// - buffer : receives the string representing the number and zero-termination. +// - radix : The radix to convert the number to (from the enum RADIX) +// utoa(word zeropage(9) value, byte* zeropage($24) buffer) +utoa: { + .const max_digits = 5 + .label __4 = $23 + .label __11 = $26 + .label digit_value = $27 + .label buffer = $24 + .label digit = 8 + .label value = 9 + .label buffer_1 = $c + .label started = $b + // [40] phi from utoa to utoa::@1 [phi:utoa->utoa::@1] + __b1_from_utoa: + // [40] phi (byte*) utoa::buffer#11 = (const byte*) decimal_digits [phi:utoa->utoa::@1#0] -- pbuz1=pbuc1 + lda #decimal_digits + sta.z buffer_1+1 + // [40] phi (byte) utoa::started#2 = (byte) 0 [phi:utoa->utoa::@1#1] -- vbuz1=vbuc1 + lda #0 + sta.z started + // [40] phi (word) utoa::value#2 = (word) utoa::value#1 [phi:utoa->utoa::@1#2] -- register_copy + // [40] phi (byte) utoa::digit#2 = (byte) 0 [phi:utoa->utoa::@1#3] -- vbuz1=vbuc1 + lda #0 + sta.z digit + jmp __b1 + // utoa::@1 + __b1: + // [41] if((byte) utoa::digit#2<(const byte) utoa::max_digits#1-(byte) 1) goto utoa::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z digit + cmp #max_digits-1 + bcc __b2 + jmp __b3 + // utoa::@3 + __b3: + // [42] (byte~) utoa::$4 ← (byte)(word) utoa::value#2 -- vbuz1=_byte_vwuz2 + lda.z value + sta.z __4 + // [43] *((byte*) utoa::buffer#11) ← *((const byte*) DIGITS + (byte~) utoa::$4) -- _deref_pbuz1=pbuc1_derefidx_vbuz2 + ldy.z __4 + lda DIGITS,y + ldy #0 + sta (buffer_1),y + // [44] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11 -- pbuz1=_inc_pbuz2 + lda.z buffer_1 + clc + adc #1 + sta.z buffer + lda.z buffer_1+1 + adc #0 + sta.z buffer+1 + // [45] *((byte*) utoa::buffer#3) ← (byte) 0 -- _deref_pbuz1=vbuc1 + lda #0 + ldy #0 + sta (buffer),y + jmp __breturn + // utoa::@return + __breturn: + // [46] return + rts + // utoa::@2 + __b2: + // [47] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 + lda.z digit + asl + sta.z __11 + // [48] (word) utoa::digit_value#0 ← *((const word*) RADIX_DECIMAL_VALUES + (byte~) utoa::$11) -- vwuz1=pwuc1_derefidx_vbuz2 + ldy.z __11 + lda RADIX_DECIMAL_VALUES,y + sta.z digit_value + lda RADIX_DECIMAL_VALUES+1,y + sta.z digit_value+1 + // [49] if((byte) 0!=(byte) utoa::started#2) goto utoa::@5 -- vbuc1_neq_vbuz1_then_la1 + lda #0 + cmp.z started + bne __b5 + jmp __b7 + // utoa::@7 + __b7: + // [50] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5 -- vwuz1_ge_vwuz2_then_la1 + lda.z digit_value+1 + cmp.z value+1 + bne !+ + lda.z digit_value + cmp.z value + beq __b5 + !: + bcc __b5 + // [51] phi from utoa::@7 to utoa::@4 [phi:utoa::@7->utoa::@4] + __b4_from___b7: + // [51] phi (byte*) utoa::buffer#14 = (byte*) utoa::buffer#11 [phi:utoa::@7->utoa::@4#0] -- register_copy + // [51] phi (byte) utoa::started#4 = (byte) utoa::started#2 [phi:utoa::@7->utoa::@4#1] -- register_copy + // [51] phi (word) utoa::value#6 = (word) utoa::value#2 [phi:utoa::@7->utoa::@4#2] -- register_copy + jmp __b4 + // utoa::@4 + __b4: + // [52] (byte) utoa::digit#1 ← ++ (byte) utoa::digit#2 -- vbuz1=_inc_vbuz1 + inc.z digit + // [40] phi from utoa::@4 to utoa::@1 [phi:utoa::@4->utoa::@1] + __b1_from___b4: + // [40] phi (byte*) utoa::buffer#11 = (byte*) utoa::buffer#14 [phi:utoa::@4->utoa::@1#0] -- register_copy + // [40] phi (byte) utoa::started#2 = (byte) utoa::started#4 [phi:utoa::@4->utoa::@1#1] -- register_copy + // [40] phi (word) utoa::value#2 = (word) utoa::value#6 [phi:utoa::@4->utoa::@1#2] -- register_copy + // [40] phi (byte) utoa::digit#2 = (byte) utoa::digit#1 [phi:utoa::@4->utoa::@1#3] -- register_copy + jmp __b1 + // utoa::@5 + __b5: + // [53] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11 -- pbuz1=pbuz2 + lda.z buffer_1 + sta.z utoa_append.buffer + lda.z buffer_1+1 + sta.z utoa_append.buffer+1 + // [54] (word) utoa_append::value#0 ← (word) utoa::value#2 -- vwuz1=vwuz2 + lda.z value + sta.z utoa_append.value + lda.z value+1 + sta.z utoa_append.value+1 + // [55] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0 -- vwuz1=vwuz2 + lda.z digit_value + sta.z utoa_append.sub + lda.z digit_value+1 + sta.z utoa_append.sub+1 + // [56] call utoa_append + // [60] phi from utoa::@5 to utoa_append [phi:utoa::@5->utoa_append] + utoa_append_from___b5: + jsr utoa_append + // [57] (word) utoa_append::return#0 ← (word) utoa_append::value#2 -- vwuz1=vwuz2 + lda.z utoa_append.value + sta.z utoa_append.return + lda.z utoa_append.value+1 + sta.z utoa_append.return+1 + jmp __b6 + // utoa::@6 + __b6: + // [58] (word) utoa::value#0 ← (word) utoa_append::return#0 -- vwuz1=vwuz2 + lda.z utoa_append.return + sta.z value + lda.z utoa_append.return+1 + sta.z value+1 + // [59] (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#11 -- pbuz1=_inc_pbuz1 + inc.z buffer_1 + bne !+ + inc.z buffer_1+1 + !: + // [51] phi from utoa::@6 to utoa::@4 [phi:utoa::@6->utoa::@4] + __b4_from___b6: + // [51] phi (byte*) utoa::buffer#14 = (byte*) utoa::buffer#4 [phi:utoa::@6->utoa::@4#0] -- register_copy + // [51] phi (byte) utoa::started#4 = (byte) 1 [phi:utoa::@6->utoa::@4#1] -- vbuz1=vbuc1 + lda #1 + sta.z started + // [51] phi (word) utoa::value#6 = (word) utoa::value#0 [phi:utoa::@6->utoa::@4#2] -- register_copy + jmp __b4 +} + // utoa_append +// Used to convert a single digit of an unsigned number value to a string representation +// Counts a single digit up from '0' as long as the value is larger than sub. +// Each time the digit is increased sub is subtracted from value. +// - buffer : pointer to the char that receives the digit +// - value : The value where the digit will be derived from +// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. +// (For decimal the subs used are 10000, 1000, 100, 10, 1) +// returns : the value reduced by sub * digit so that it is less than sub. +// utoa_append(byte* zeropage($29) buffer, word zeropage($e) value, word zeropage($2b) sub) +utoa_append: { + .label buffer = $29 + .label value = $e + .label sub = $2b + .label return = $2d + .label digit = $10 + // [61] phi from utoa_append to utoa_append::@1 [phi:utoa_append->utoa_append::@1] + __b1_from_utoa_append: + // [61] phi (byte) utoa_append::digit#2 = (byte) 0 [phi:utoa_append->utoa_append::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z digit + // [61] phi (word) utoa_append::value#2 = (word) utoa_append::value#0 [phi:utoa_append->utoa_append::@1#1] -- register_copy + jmp __b1 + // utoa_append::@1 + __b1: + // [62] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 -- vwuz1_ge_vwuz2_then_la1 + lda.z sub+1 + cmp.z value+1 + bne !+ + lda.z sub + cmp.z value + beq __b2 + !: + bcc __b2 + jmp __b3 + // utoa_append::@3 + __b3: + // [63] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2) -- _deref_pbuz1=pbuc1_derefidx_vbuz2 + ldy.z digit + lda DIGITS,y + ldy #0 + sta (buffer),y + jmp __breturn + // utoa_append::@return + __breturn: + // [64] return + rts + // utoa_append::@2 + __b2: + // [65] (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2 -- vbuz1=_inc_vbuz1 + inc.z digit + // [66] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0 -- vwuz1=vwuz1_minus_vwuz2 + lda.z value + sec + sbc.z sub + sta.z value + lda.z value+1 + sbc.z sub+1 + sta.z value+1 + // [61] phi from utoa_append::@2 to utoa_append::@1 [phi:utoa_append::@2->utoa_append::@1] + __b1_from___b2: + // [61] phi (byte) utoa_append::digit#2 = (byte) utoa_append::digit#1 [phi:utoa_append::@2->utoa_append::@1#0] -- register_copy + // [61] phi (word) utoa_append::value#2 = (word) utoa_append::value#1 [phi:utoa_append::@2->utoa_append::@1#1] -- register_copy + jmp __b1 +} + // sum +sum: { + .label tmp = $2f + .label s = $15 + .label i = $14 + .label p = $12 + .label page = $11 + .label return = $1f + // [68] phi from sum to sum::@1 [phi:sum->sum::@1] + __b1_from_sum: + // [68] phi (byte*) sum::p#5 = (const byte*) rom [phi:sum->sum::@1#0] -- pbuz1=pbuc1 + lda #rom + sta.z p+1 + // [68] phi (word) sum::s#3 = (byte) 0 [phi:sum->sum::@1#1] -- vwuz1=vbuc1 + lda #<0 + sta.z s + lda #>0 + sta.z s+1 + // [68] phi (byte) sum::page#3 = (byte) 0 [phi:sum->sum::@1#2] -- vbuz1=vbuc1 + lda #0 + sta.z page + jmp __b1 + /* doing it page-by-page is faster than doing just one huge loop */ + // sum::@1 + __b1: + // [69] if((byte) sum::page#3<(byte) $20) goto sum::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z page + cmp #$20 + bcc __b2_from___b1 + jmp __breturn + // sum::@return + __breturn: + // [70] return + rts + // [71] phi from sum::@1 to sum::@2 [phi:sum::@1->sum::@2] + __b2_from___b1: + // [71] phi (word) sum::s#4 = (word) sum::s#3 [phi:sum::@1->sum::@2#0] -- register_copy + // [71] phi (byte) sum::i#3 = (byte) 0 [phi:sum::@1->sum::@2#1] -- vbuz1=vbuc1 + lda #0 + sta.z i + jmp __b2 + // [71] phi from sum::@2 to sum::@2 [phi:sum::@2->sum::@2] + __b2_from___b2: + // [71] phi (word) sum::s#4 = (word) sum::s#2 [phi:sum::@2->sum::@2#0] -- register_copy + // [71] phi (byte) sum::i#3 = (byte) sum::i#2 [phi:sum::@2->sum::@2#1] -- register_copy + jmp __b2 + // sum::@2 + __b2: + // [72] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3) -- vbuz1=pbuz2_derefidx_vbuz3 + ldy.z i + lda (p),y + sta.z tmp + // [73] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 -- vwuz1=vwuz1_plus_vbuz2 + lda.z tmp + clc + adc.z s + sta.z s + bcc !+ + inc.z s+1 + !: + // [74] (byte) sum::i#2 ← ++ (byte) sum::i#3 -- vbuz1=_inc_vbuz1 + inc.z i + // [75] if((byte) 0!=(byte) sum::i#2) goto sum::@2 -- vbuc1_neq_vbuz1_then_la1 + lda #0 + cmp.z i + bne __b2_from___b2 + jmp __b3 + // sum::@3 + __b3: + // [76] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100 -- pbuz1=pbuz1_plus_vwuc1 + clc + lda.z p + adc #<$100 + sta.z p + lda.z p+1 + adc #>$100 + sta.z p+1 + // [77] (byte) sum::page#2 ← ++ (byte) sum::page#3 -- vbuz1=_inc_vbuz1 + inc.z page + // [68] phi from sum::@3 to sum::@1 [phi:sum::@3->sum::@1] + __b1_from___b3: + // [68] phi (byte*) sum::p#5 = (byte*) sum::p#2 [phi:sum::@3->sum::@1#0] -- register_copy + // [68] phi (word) sum::s#3 = (word) sum::s#2 [phi:sum::@3->sum::@1#1] -- register_copy + // [68] phi (byte) sum::page#3 = (byte) sum::page#2 [phi:sum::@3->sum::@1#2] -- register_copy + jmp __b1 +} + // end +end: { + // [78] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // [79] call start + jsr start + jmp __b1 + // end::@1 + __b1: + // [80] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // [81] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // [82] (word) print_word::w#0 ← (word) Ticks#2 -- vwuz1=vwuz2 + lda.z Ticks_1 + sta.z print_word.w + lda.z Ticks_1+1 + sta.z print_word.w+1 + // [83] call print_word + jsr print_word + // [84] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + __b2_from___b1: + jmp __b2 + // end::@2 + __b2: + // [85] call print_ln + // [22] phi from end::@2 to print_ln [phi:end::@2->print_ln] + print_ln_from___b2: + // [22] phi (byte*) print_char_cursor#46 = (byte*) print_char_cursor#13 [phi:end::@2->print_ln#0] -- register_copy + jsr print_ln + jmp __breturn + // end::@return + __breturn: + // [86] (word) last_time#2 ← (word) last_time#1 + // [87] return + rts +} + // print_word +// Print a word as HEX +// print_word(word zeropage($34) w) +print_word: { + .label w = $34 + // [88] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuz1=_hi_vwuz2 + lda.z w+1 + sta.z print_byte.b + // [89] call print_byte + // [93] phi from print_word to print_byte [phi:print_word->print_byte] + print_byte_from_print_word: + // [93] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#51 [phi:print_word->print_byte#0] -- register_copy + // [93] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + jmp __b1 + // print_word::@1 + __b1: + // [90] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuz1=_lo_vwuz2 + lda.z w + sta.z print_byte.b + // [91] call print_byte + // [93] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte] + print_byte_from___b1: + // [93] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#13 [phi:print_word::@1->print_byte#0] -- register_copy + // [93] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + jmp __breturn + // print_word::@return + __breturn: + // [92] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte zeropage($17) b) +print_byte: { + .label __0 = $36 + .label __2 = $37 + .label b = $17 + // [94] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4 + lda.z b + lsr + lsr + lsr + lsr + sta.z __0 + // [95] (byte) print_char::ch#0 ← *((const byte*) DIGITS + (byte~) print_byte::$0) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy.z __0 + lda DIGITS,y + sta.z print_char.ch + // [96] call print_char + // [101] phi from print_byte to print_char [phi:print_byte->print_char] + print_char_from_print_byte: + // [101] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#49 [phi:print_byte->print_char#0] -- register_copy + // [101] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + jmp __b1 + // print_byte::@1 + __b1: + // [97] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + lda #$f + and.z b + sta.z __2 + // [98] (byte) print_char::ch#1 ← *((const byte*) DIGITS + (byte~) print_byte::$2) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy.z __2 + lda DIGITS,y + sta.z print_char.ch + // [99] call print_char + // [101] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + print_char_from___b1: + // [101] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#13 [phi:print_byte::@1->print_char#0] -- register_copy + // [101] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + jmp __breturn + // print_byte::@return + __breturn: + // [100] return + rts +} + // print_char +// Print a single char +// print_char(byte zeropage($18) ch) +print_char: { + .label ch = $18 + // [102] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuz2 + lda.z ch + ldy #0 + sta (print_char_cursor),y + // [103] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#35 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + jmp __breturn + // print_char::@return + __breturn: + // [104] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // [106] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + jmp __breturn + // start::@return + __breturn: + // [107] return + rts +} + // File Data + // The digits used for numbers + DIGITS: .text "0123456789abcdef" + // Values of decimal digits + RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a + // Digits used for storing the decimal word + decimal_digits: .fill 6, 0 + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [1] (word) last_time#0 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [2] (word) rand_seed#20 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [9] if((word) main::i#3<(byte) 6) goto main::@2 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 ] ( main:4 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 ] ) always clobbers reg byte a +Statement [15] (word) sum::return#2 ← (word) sum::s#3 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::return#2 ] ( main:4 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::return#2 ] ) always clobbers reg byte a +Statement [16] (word) print_word_decimal::w#0 ← (word) sum::return#2 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 print_word_decimal::w#0 ] ( main:4 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 print_word_decimal::w#0 ] ) always clobbers reg byte a +Statement [21] (byte*) print_char_cursor#71 ← (byte*) print_line_cursor#1 [ last_time#0 main::i#2 print_char_cursor#71 print_line_cursor#1 ] ( main:4 [ last_time#0 main::i#2 print_char_cursor#71 print_line_cursor#1 ] ) always clobbers reg byte a +Statement [24] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 [ print_line_cursor#1 print_char_cursor#46 ] ( main:4::print_ln:19 [ last_time#0 main::i#3 print_line_cursor#1 print_char_cursor#46 ] main:4::end:11::print_ln:85 [ last_time#1 print_line_cursor#1 print_char_cursor#46 ] ) always clobbers reg byte a +Statement [25] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#46 ] ( main:4::print_ln:19 [ last_time#0 main::i#3 print_line_cursor#1 print_char_cursor#46 ] main:4::end:11::print_ln:85 [ last_time#1 print_line_cursor#1 print_char_cursor#46 ] ) always clobbers reg byte a +Statement [27] (word) utoa::value#1 ← (word) print_word_decimal::w#0 [ print_char_cursor#51 utoa::value#1 ] ( main:4::print_word_decimal:17 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::value#1 ] ) always clobbers reg byte a +Statement [34] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 [ print_char_cursor#2 print_str::str#2 ] ( main:4::print_word_decimal:17::print_str:30 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#2 print_str::str#2 ] ) always clobbers reg byte a reg byte y +Statement [36] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2) [ print_char_cursor#2 print_str::str#2 ] ( main:4::print_word_decimal:17::print_str:30 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#2 print_str::str#2 ] ) always clobbers reg byte a reg byte y +Statement [42] (byte~) utoa::$4 ← (byte)(word) utoa::value#2 [ utoa::buffer#11 utoa::$4 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::buffer#11 utoa::$4 ] ) always clobbers reg byte a +Statement [43] *((byte*) utoa::buffer#11) ← *((const byte*) DIGITS + (byte~) utoa::$4) [ utoa::buffer#11 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::buffer#11 ] ) always clobbers reg byte a reg byte y +Statement [44] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11 [ utoa::buffer#3 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::buffer#3 ] ) always clobbers reg byte a +Statement [45] *((byte*) utoa::buffer#3) ← (byte) 0 [ ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 ] ) always clobbers reg byte a reg byte y +Statement [47] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1 [ utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::$11 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::$11 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:8 [ utoa::digit#2 utoa::digit#1 ] +Removing always clobbered register reg byte a as potential for zp[1]:11 [ utoa::started#2 utoa::started#4 ] +Statement [48] (word) utoa::digit_value#0 ← *((const word*) RADIX_DECIMAL_VALUES + (byte~) utoa::$11) [ utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::digit_value#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::digit_value#0 ] ) always clobbers reg byte a +Statement [50] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5 [ utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::digit_value#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::digit_value#0 ] ) always clobbers reg byte a +Statement [53] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11 [ utoa::digit#2 utoa::value#2 utoa::buffer#11 utoa::digit_value#0 utoa_append::buffer#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::value#2 utoa::buffer#11 utoa::digit_value#0 utoa_append::buffer#0 ] ) always clobbers reg byte a +Statement [54] (word) utoa_append::value#0 ← (word) utoa::value#2 [ utoa::digit#2 utoa::buffer#11 utoa::digit_value#0 utoa_append::buffer#0 utoa_append::value#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa::digit_value#0 utoa_append::buffer#0 utoa_append::value#0 ] ) always clobbers reg byte a +Statement [55] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0 [ utoa::digit#2 utoa::buffer#11 utoa_append::buffer#0 utoa_append::value#0 utoa_append::sub#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::buffer#0 utoa_append::value#0 utoa_append::sub#0 ] ) always clobbers reg byte a +Statement [57] (word) utoa_append::return#0 ← (word) utoa_append::value#2 [ utoa::digit#2 utoa::buffer#11 utoa_append::return#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::return#0 ] ) always clobbers reg byte a +Statement [58] (word) utoa::value#0 ← (word) utoa_append::return#0 [ utoa::digit#2 utoa::buffer#11 utoa::value#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa::value#0 ] ) always clobbers reg byte a +Statement [62] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 [ utoa_append::buffer#0 utoa_append::sub#0 utoa_append::value#2 utoa_append::digit#2 ] ( main:4::print_word_decimal:17::utoa:28::utoa_append:56 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::buffer#0 utoa_append::sub#0 utoa_append::value#2 utoa_append::digit#2 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:16 [ utoa_append::digit#2 utoa_append::digit#1 ] +Statement [63] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2) [ utoa_append::value#2 ] ( main:4::print_word_decimal:17::utoa:28::utoa_append:56 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::value#2 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp[1]:8 [ utoa::digit#2 utoa::digit#1 ] +Statement [66] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0 [ utoa_append::buffer#0 utoa_append::sub#0 utoa_append::value#1 utoa_append::digit#1 ] ( main:4::print_word_decimal:17::utoa:28::utoa_append:56 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::buffer#0 utoa_append::sub#0 utoa_append::value#1 utoa_append::digit#1 ] ) always clobbers reg byte a +Statement [72] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3) [ sum::page#3 sum::p#5 sum::i#3 sum::s#4 sum::tmp#1 ] ( main:4::sum:14 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::page#3 sum::p#5 sum::i#3 sum::s#4 sum::tmp#1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:17 [ sum::page#3 sum::page#2 ] +Removing always clobbered register reg byte a as potential for zp[1]:20 [ sum::i#3 sum::i#2 ] +Statement [73] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 [ sum::page#3 sum::p#5 sum::s#2 sum::i#3 ] ( main:4::sum:14 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::page#3 sum::p#5 sum::s#2 sum::i#3 ] ) always clobbers reg byte a +Statement [76] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100 [ sum::page#3 sum::s#2 sum::p#2 ] ( main:4::sum:14 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::page#3 sum::s#2 sum::p#2 ] ) always clobbers reg byte a +Statement [78] (word) Ticks#1 ← (word) last_time#0 [ last_time#0 print_char_cursor#51 print_line_cursor#20 Ticks#1 ] ( main:4::end:11 [ last_time#0 print_char_cursor#51 print_line_cursor#20 Ticks#1 ] ) always clobbers reg byte a +Statement [80] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 [ print_char_cursor#51 print_line_cursor#20 last_time#1 ] ( main:4::end:11 [ print_char_cursor#51 print_line_cursor#20 last_time#1 ] ) always clobbers reg byte a +Statement [81] (word) Ticks#2 ← (word) last_time#1 [ print_char_cursor#51 print_line_cursor#20 last_time#1 Ticks#2 ] ( main:4::end:11 [ print_char_cursor#51 print_line_cursor#20 last_time#1 Ticks#2 ] ) always clobbers reg byte a +Statement [82] (word) print_word::w#0 ← (word) Ticks#2 [ print_char_cursor#51 print_line_cursor#20 last_time#1 print_word::w#0 ] ( main:4::end:11 [ print_char_cursor#51 print_line_cursor#20 last_time#1 print_word::w#0 ] ) always clobbers reg byte a +Statement [88] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_char_cursor#51 print_word::w#0 print_byte::b#0 ] ( main:4::end:11::print_word:83 [ print_line_cursor#20 last_time#1 print_char_cursor#51 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a +Statement [90] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#13 print_byte::b#1 ] ( main:4::end:11::print_word:83 [ print_line_cursor#20 last_time#1 print_char_cursor#13 print_byte::b#1 ] ) always clobbers reg byte a +Statement [94] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_byte::b#2 print_char_cursor#49 print_byte::$0 ] ( main:4::end:11::print_word:83::print_byte:89 [ print_line_cursor#20 last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#49 print_byte::$0 ] main:4::end:11::print_word:83::print_byte:91 [ print_line_cursor#20 last_time#1 print_byte::b#2 print_char_cursor#49 print_byte::$0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:23 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Statement [97] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#13 print_byte::$2 ] ( main:4::end:11::print_word:83::print_byte:89 [ print_line_cursor#20 last_time#1 print_word::w#0 print_char_cursor#13 print_byte::$2 ] main:4::end:11::print_word:83::print_byte:91 [ print_line_cursor#20 last_time#1 print_char_cursor#13 print_byte::$2 ] ) always clobbers reg byte a +Statement [102] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 [ print_char_cursor#35 ] ( main:4::end:11::print_word:83::print_byte:89::print_char:96 [ print_line_cursor#20 last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#35 ] main:4::end:11::print_word:83::print_byte:91::print_char:96 [ print_line_cursor#20 last_time#1 print_byte::b#2 print_char_cursor#35 ] main:4::end:11::print_word:83::print_byte:89::print_char:99 [ print_line_cursor#20 last_time#1 print_word::w#0 print_char_cursor#35 ] main:4::end:11::print_word:83::print_byte:91::print_char:99 [ print_line_cursor#20 last_time#1 print_char_cursor#35 ] ) always clobbers reg byte y +Removing always clobbered register reg byte y as potential for zp[1]:23 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Statement asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } always clobbers reg byte a reg byte x reg byte y +Statement [106] (word) rand_seed#0 ← (word) $194a [ ] ( main:4::start:7 [ last_time#0 ] main:4::end:11::start:79 [ last_time#0 print_char_cursor#51 print_line_cursor#20 Ticks#1 ] ) always clobbers reg byte a +Statement [1] (word) last_time#0 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [2] (word) rand_seed#20 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [9] if((word) main::i#3<(byte) 6) goto main::@2 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 ] ( main:4 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 ] ) always clobbers reg byte a +Statement [15] (word) sum::return#2 ← (word) sum::s#3 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::return#2 ] ( main:4 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::return#2 ] ) always clobbers reg byte a +Statement [16] (word) print_word_decimal::w#0 ← (word) sum::return#2 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 print_word_decimal::w#0 ] ( main:4 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 print_word_decimal::w#0 ] ) always clobbers reg byte a +Statement [21] (byte*) print_char_cursor#71 ← (byte*) print_line_cursor#1 [ last_time#0 main::i#2 print_char_cursor#71 print_line_cursor#1 ] ( main:4 [ last_time#0 main::i#2 print_char_cursor#71 print_line_cursor#1 ] ) always clobbers reg byte a +Statement [24] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 [ print_line_cursor#1 print_char_cursor#46 ] ( main:4::print_ln:19 [ last_time#0 main::i#3 print_line_cursor#1 print_char_cursor#46 ] main:4::end:11::print_ln:85 [ last_time#1 print_line_cursor#1 print_char_cursor#46 ] ) always clobbers reg byte a +Statement [25] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#46 ] ( main:4::print_ln:19 [ last_time#0 main::i#3 print_line_cursor#1 print_char_cursor#46 ] main:4::end:11::print_ln:85 [ last_time#1 print_line_cursor#1 print_char_cursor#46 ] ) always clobbers reg byte a +Statement [27] (word) utoa::value#1 ← (word) print_word_decimal::w#0 [ print_char_cursor#51 utoa::value#1 ] ( main:4::print_word_decimal:17 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::value#1 ] ) always clobbers reg byte a +Statement [34] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 [ print_char_cursor#2 print_str::str#2 ] ( main:4::print_word_decimal:17::print_str:30 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#2 print_str::str#2 ] ) always clobbers reg byte a reg byte y +Statement [36] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2) [ print_char_cursor#2 print_str::str#2 ] ( main:4::print_word_decimal:17::print_str:30 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#2 print_str::str#2 ] ) always clobbers reg byte a reg byte y +Statement [42] (byte~) utoa::$4 ← (byte)(word) utoa::value#2 [ utoa::buffer#11 utoa::$4 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::buffer#11 utoa::$4 ] ) always clobbers reg byte a +Statement [43] *((byte*) utoa::buffer#11) ← *((const byte*) DIGITS + (byte~) utoa::$4) [ utoa::buffer#11 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::buffer#11 ] ) always clobbers reg byte a reg byte y +Statement [44] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11 [ utoa::buffer#3 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::buffer#3 ] ) always clobbers reg byte a +Statement [45] *((byte*) utoa::buffer#3) ← (byte) 0 [ ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 ] ) always clobbers reg byte a reg byte y +Statement [47] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1 [ utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::$11 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::$11 ] ) always clobbers reg byte a +Statement [48] (word) utoa::digit_value#0 ← *((const word*) RADIX_DECIMAL_VALUES + (byte~) utoa::$11) [ utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::digit_value#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::digit_value#0 ] ) always clobbers reg byte a +Statement [50] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5 [ utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::digit_value#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::value#2 utoa::started#2 utoa::buffer#11 utoa::digit_value#0 ] ) always clobbers reg byte a +Statement [53] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11 [ utoa::digit#2 utoa::value#2 utoa::buffer#11 utoa::digit_value#0 utoa_append::buffer#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::value#2 utoa::buffer#11 utoa::digit_value#0 utoa_append::buffer#0 ] ) always clobbers reg byte a +Statement [54] (word) utoa_append::value#0 ← (word) utoa::value#2 [ utoa::digit#2 utoa::buffer#11 utoa::digit_value#0 utoa_append::buffer#0 utoa_append::value#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa::digit_value#0 utoa_append::buffer#0 utoa_append::value#0 ] ) always clobbers reg byte a +Statement [55] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0 [ utoa::digit#2 utoa::buffer#11 utoa_append::buffer#0 utoa_append::value#0 utoa_append::sub#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::buffer#0 utoa_append::value#0 utoa_append::sub#0 ] ) always clobbers reg byte a +Statement [57] (word) utoa_append::return#0 ← (word) utoa_append::value#2 [ utoa::digit#2 utoa::buffer#11 utoa_append::return#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::return#0 ] ) always clobbers reg byte a +Statement [58] (word) utoa::value#0 ← (word) utoa_append::return#0 [ utoa::digit#2 utoa::buffer#11 utoa::value#0 ] ( main:4::print_word_decimal:17::utoa:28 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa::value#0 ] ) always clobbers reg byte a +Statement [62] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 [ utoa_append::buffer#0 utoa_append::sub#0 utoa_append::value#2 utoa_append::digit#2 ] ( main:4::print_word_decimal:17::utoa:28::utoa_append:56 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::buffer#0 utoa_append::sub#0 utoa_append::value#2 utoa_append::digit#2 ] ) always clobbers reg byte a +Statement [63] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2) [ utoa_append::value#2 ] ( main:4::print_word_decimal:17::utoa:28::utoa_append:56 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::value#2 ] ) always clobbers reg byte a reg byte y +Statement [66] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0 [ utoa_append::buffer#0 utoa_append::sub#0 utoa_append::value#1 utoa_append::digit#1 ] ( main:4::print_word_decimal:17::utoa:28::utoa_append:56 [ last_time#0 main::i#3 print_line_cursor#20 print_char_cursor#51 utoa::digit#2 utoa::buffer#11 utoa_append::buffer#0 utoa_append::sub#0 utoa_append::value#1 utoa_append::digit#1 ] ) always clobbers reg byte a +Statement [72] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3) [ sum::page#3 sum::p#5 sum::i#3 sum::s#4 sum::tmp#1 ] ( main:4::sum:14 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::page#3 sum::p#5 sum::i#3 sum::s#4 sum::tmp#1 ] ) always clobbers reg byte a +Statement [73] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 [ sum::page#3 sum::p#5 sum::s#2 sum::i#3 ] ( main:4::sum:14 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::page#3 sum::p#5 sum::s#2 sum::i#3 ] ) always clobbers reg byte a +Statement [76] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100 [ sum::page#3 sum::s#2 sum::p#2 ] ( main:4::sum:14 [ last_time#0 main::i#3 print_char_cursor#51 print_line_cursor#20 sum::page#3 sum::s#2 sum::p#2 ] ) always clobbers reg byte a +Statement [78] (word) Ticks#1 ← (word) last_time#0 [ last_time#0 print_char_cursor#51 print_line_cursor#20 Ticks#1 ] ( main:4::end:11 [ last_time#0 print_char_cursor#51 print_line_cursor#20 Ticks#1 ] ) always clobbers reg byte a +Statement [80] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 [ print_char_cursor#51 print_line_cursor#20 last_time#1 ] ( main:4::end:11 [ print_char_cursor#51 print_line_cursor#20 last_time#1 ] ) always clobbers reg byte a +Statement [81] (word) Ticks#2 ← (word) last_time#1 [ print_char_cursor#51 print_line_cursor#20 last_time#1 Ticks#2 ] ( main:4::end:11 [ print_char_cursor#51 print_line_cursor#20 last_time#1 Ticks#2 ] ) always clobbers reg byte a +Statement [82] (word) print_word::w#0 ← (word) Ticks#2 [ print_char_cursor#51 print_line_cursor#20 last_time#1 print_word::w#0 ] ( main:4::end:11 [ print_char_cursor#51 print_line_cursor#20 last_time#1 print_word::w#0 ] ) always clobbers reg byte a +Statement [88] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_char_cursor#51 print_word::w#0 print_byte::b#0 ] ( main:4::end:11::print_word:83 [ print_line_cursor#20 last_time#1 print_char_cursor#51 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a +Statement [90] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#13 print_byte::b#1 ] ( main:4::end:11::print_word:83 [ print_line_cursor#20 last_time#1 print_char_cursor#13 print_byte::b#1 ] ) always clobbers reg byte a +Statement [94] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_byte::b#2 print_char_cursor#49 print_byte::$0 ] ( main:4::end:11::print_word:83::print_byte:89 [ print_line_cursor#20 last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#49 print_byte::$0 ] main:4::end:11::print_word:83::print_byte:91 [ print_line_cursor#20 last_time#1 print_byte::b#2 print_char_cursor#49 print_byte::$0 ] ) always clobbers reg byte a +Statement [97] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#13 print_byte::$2 ] ( main:4::end:11::print_word:83::print_byte:89 [ print_line_cursor#20 last_time#1 print_word::w#0 print_char_cursor#13 print_byte::$2 ] main:4::end:11::print_word:83::print_byte:91 [ print_line_cursor#20 last_time#1 print_char_cursor#13 print_byte::$2 ] ) always clobbers reg byte a +Statement [102] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 [ print_char_cursor#35 ] ( main:4::end:11::print_word:83::print_byte:89::print_char:96 [ print_line_cursor#20 last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#35 ] main:4::end:11::print_word:83::print_byte:91::print_char:96 [ print_line_cursor#20 last_time#1 print_byte::b#2 print_char_cursor#35 ] main:4::end:11::print_word:83::print_byte:89::print_char:99 [ print_line_cursor#20 last_time#1 print_word::w#0 print_char_cursor#35 ] main:4::end:11::print_word:83::print_byte:91::print_char:99 [ print_line_cursor#20 last_time#1 print_char_cursor#35 ] ) always clobbers reg byte y +Statement asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } always clobbers reg byte a reg byte x reg byte y +Statement [106] (word) rand_seed#0 ← (word) $194a [ ] ( main:4::start:7 [ last_time#0 ] main:4::end:11::start:79 [ last_time#0 print_char_cursor#51 print_line_cursor#20 Ticks#1 ] ) always clobbers reg byte a +Potential registers zp[2]:2 [ main::i#3 main::i#2 ] : zp[2]:2 , +Potential registers zp[2]:4 [ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] : zp[2]:4 , +Potential registers zp[2]:6 [ print_str::str#2 print_str::str#0 ] : zp[2]:6 , +Potential registers zp[1]:8 [ utoa::digit#2 utoa::digit#1 ] : zp[1]:8 , reg byte x , +Potential registers zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] : zp[2]:9 , +Potential registers zp[1]:11 [ utoa::started#2 utoa::started#4 ] : zp[1]:11 , reg byte x , reg byte y , +Potential registers zp[2]:12 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] : zp[2]:12 , +Potential registers zp[2]:14 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] : zp[2]:14 , +Potential registers zp[1]:16 [ utoa_append::digit#2 utoa_append::digit#1 ] : zp[1]:16 , reg byte x , reg byte y , +Potential registers zp[1]:17 [ sum::page#3 sum::page#2 ] : zp[1]:17 , reg byte x , reg byte y , +Potential registers zp[2]:18 [ sum::p#5 sum::p#2 ] : zp[2]:18 , +Potential registers zp[1]:20 [ sum::i#3 sum::i#2 ] : zp[1]:20 , reg byte x , reg byte y , +Potential registers zp[2]:21 [ sum::s#4 sum::s#3 sum::s#2 ] : zp[2]:21 , +Potential registers zp[1]:23 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] : zp[1]:23 , reg byte x , +Potential registers zp[1]:24 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:25 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] : zp[2]:25 , +Potential registers zp[2]:27 [ last_time#0 last_time#1 last_time#2 ] : zp[2]:27 , +Potential registers zp[2]:29 [ rand_seed#0 rand_seed#20 ] : zp[2]:29 , +Potential registers zp[2]:31 [ sum::return#2 ] : zp[2]:31 , +Potential registers zp[2]:33 [ print_word_decimal::w#0 ] : zp[2]:33 , +Potential registers zp[1]:35 [ utoa::$4 ] : zp[1]:35 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:36 [ utoa::buffer#3 ] : zp[2]:36 , +Potential registers zp[1]:38 [ utoa::$11 ] : zp[1]:38 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:39 [ utoa::digit_value#0 ] : zp[2]:39 , +Potential registers zp[2]:41 [ utoa_append::buffer#0 ] : zp[2]:41 , +Potential registers zp[2]:43 [ utoa_append::sub#0 ] : zp[2]:43 , +Potential registers zp[2]:45 [ utoa_append::return#0 ] : zp[2]:45 , +Potential registers zp[1]:47 [ sum::tmp#1 ] : zp[1]:47 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:48 [ Ticks#1 ] : zp[2]:48 , +Potential registers zp[2]:50 [ Ticks#2 ] : zp[2]:50 , +Potential registers zp[2]:52 [ print_word::w#0 ] : zp[2]:52 , +Potential registers zp[1]:54 [ print_byte::$0 ] : zp[1]:54 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:55 [ print_byte::$2 ] : zp[1]:55 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [sum] 2,502.5: zp[1]:20 [ sum::i#3 sum::i#2 ] 2,002: zp[1]:47 [ sum::tmp#1 ] 1,525.35: zp[2]:21 [ sum::s#4 sum::s#3 sum::s#2 ] 272.86: zp[2]:18 [ sum::p#5 sum::p#2 ] 239.88: zp[1]:17 [ sum::page#3 sum::page#2 ] 22: zp[2]:31 [ sum::return#2 ] +Uplift Scope [utoa_append] 2,554: zp[2]:14 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] 2,003: zp[1]:16 [ utoa_append::digit#2 utoa_append::digit#1 ] 350.5: zp[2]:43 [ utoa_append::sub#0 ] 202: zp[2]:45 [ utoa_append::return#0 ] 12.88: zp[2]:41 [ utoa_append::buffer#0 ] +Uplift Scope [utoa] 382.64: zp[2]:12 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] 312.5: zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] 230.86: zp[1]:8 [ utoa::digit#2 utoa::digit#1 ] 202: zp[1]:38 [ utoa::$11 ] 151.5: zp[1]:11 [ utoa::started#2 utoa::started#4 ] 60.6: zp[2]:39 [ utoa::digit_value#0 ] 4: zp[1]:35 [ utoa::$4 ] 4: zp[2]:36 [ utoa::buffer#3 ] +Uplift Scope [] 258.93: zp[2]:4 [ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] 198.5: zp[2]:25 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] 40: zp[2]:29 [ rand_seed#0 rand_seed#20 ] 21.32: zp[2]:27 [ last_time#0 last_time#1 last_time#2 ] 4: zp[2]:50 [ Ticks#2 ] 2: zp[2]:48 [ Ticks#1 ] +Uplift Scope [print_str] 303: zp[2]:6 [ print_str::str#2 print_str::str#0 ] +Uplift Scope [print_byte] 10: zp[1]:23 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] 4: zp[1]:54 [ print_byte::$0 ] 4: zp[1]:55 [ print_byte::$2 ] +Uplift Scope [main] 14.67: zp[2]:2 [ main::i#3 main::i#2 ] +Uplift Scope [print_char] 14: zp[1]:24 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Uplift Scope [print_word_decimal] 13: zp[2]:33 [ print_word_decimal::w#0 ] +Uplift Scope [print_word] 2: zp[2]:52 [ print_word::w#0 ] +Uplift Scope [RADIX] +Uplift Scope [print_ln] +Uplift Scope [start] +Uplift Scope [end] + +Uplifting [sum] best 134072 combination reg byte y [ sum::i#3 sum::i#2 ] reg byte a [ sum::tmp#1 ] zp[2]:21 [ sum::s#4 sum::s#3 sum::s#2 ] zp[2]:18 [ sum::p#5 sum::p#2 ] reg byte x [ sum::page#3 sum::page#2 ] zp[2]:31 [ sum::return#2 ] +Uplifting [utoa_append] best 128069 combination zp[2]:14 [ 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]:43 [ utoa_append::sub#0 ] zp[2]:45 [ utoa_append::return#0 ] zp[2]:41 [ utoa_append::buffer#0 ] +Uplifting [utoa] best 126765 combination zp[2]:12 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:8 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$11 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:39 [ utoa::digit_value#0 ] reg byte a [ utoa::$4 ] zp[2]:36 [ utoa::buffer#3 ] +Uplifting [] best 126765 combination zp[2]:4 [ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] zp[2]:25 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] zp[2]:29 [ rand_seed#0 rand_seed#20 ] zp[2]:27 [ last_time#0 last_time#1 last_time#2 ] zp[2]:50 [ Ticks#2 ] zp[2]:48 [ Ticks#1 ] +Uplifting [print_str] best 126765 combination zp[2]:6 [ print_str::str#2 print_str::str#0 ] +Uplifting [print_byte] best 126751 combination reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte x [ print_byte::$2 ] +Uplifting [main] best 126751 combination zp[2]:2 [ main::i#3 main::i#2 ] +Uplifting [print_char] best 126742 combination reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Uplifting [print_word_decimal] best 126742 combination zp[2]:33 [ print_word_decimal::w#0 ] +Uplifting [print_word] best 126742 combination zp[2]:52 [ print_word::w#0 ] +Uplifting [RADIX] best 126742 combination +Uplifting [print_ln] best 126742 combination +Uplifting [start] best 126742 combination +Uplifting [end] best 126742 combination +Attempting to uplift remaining variables inzp[1]:8 [ utoa::digit#2 utoa::digit#1 ] +Uplifting [utoa] best 126742 combination zp[1]:8 [ utoa::digit#2 utoa::digit#1 ] +Coalescing zero page register [ zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] ] with [ zp[2]:14 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] ] - score: 1 +Coalescing zero page register [ zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] ] with [ zp[2]:33 [ print_word_decimal::w#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 print_word_decimal::w#0 ] ] with [ zp[2]:45 [ utoa_append::return#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:12 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] ] with [ zp[2]:36 [ utoa::buffer#3 ] ] - score: 1 +Coalescing zero page register [ zp[2]:12 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa::buffer#3 ] ] with [ zp[2]:41 [ utoa_append::buffer#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:21 [ sum::s#4 sum::s#3 sum::s#2 ] ] with [ zp[2]:31 [ sum::return#2 ] ] - score: 1 +Coalescing zero page register [ zp[2]:39 [ utoa::digit_value#0 ] ] with [ zp[2]:43 [ utoa_append::sub#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:50 [ Ticks#2 ] ] with [ zp[2]:52 [ print_word::w#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 print_word_decimal::w#0 utoa_append::return#0 ] ] with [ zp[2]:21 [ sum::s#4 sum::s#3 sum::s#2 sum::return#2 ] ] - score: 1 +Coalescing zero page register [ zp[2]:9 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 print_word_decimal::w#0 utoa_append::return#0 sum::s#4 sum::s#3 sum::s#2 sum::return#2 ] ] with [ zp[2]:6 [ print_str::str#2 print_str::str#0 ] ] +Coalescing zero page register [ zp[2]:18 [ sum::p#5 sum::p#2 ] ] with [ zp[2]:12 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa::buffer#3 utoa_append::buffer#0 ] ] +Coalescing zero page register [ zp[2]:48 [ Ticks#1 ] ] with [ zp[2]:2 [ main::i#3 main::i#2 ] ] +Coalescing zero page register [ zp[2]:50 [ Ticks#2 print_word::w#0 ] ] with [ zp[2]:39 [ utoa::digit_value#0 utoa_append::sub#0 ] ] +Allocated (was zp[2]:4) zp[2]:2 [ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] +Allocated (was zp[1]:8) zp[1]:4 [ utoa::digit#2 utoa::digit#1 ] +Allocated (was zp[2]:9) zp[2]:5 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 print_word_decimal::w#0 utoa_append::return#0 sum::s#4 sum::s#3 sum::s#2 sum::return#2 print_str::str#2 print_str::str#0 ] +Allocated (was zp[2]:18) zp[2]:7 [ sum::p#5 sum::p#2 utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa::buffer#3 utoa_append::buffer#0 ] +Allocated (was zp[2]:25) zp[2]:9 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] +Allocated (was zp[2]:27) zp[2]:11 [ last_time#0 last_time#1 last_time#2 ] +Allocated (was zp[2]:29) zp[2]:13 [ rand_seed#0 rand_seed#20 ] +Allocated (was zp[2]:48) zp[2]:15 [ Ticks#1 main::i#3 main::i#2 ] +Allocated (was zp[2]:50) zp[2]:17 [ Ticks#2 print_word::w#0 utoa::digit_value#0 utoa_append::sub#0 ] + +ASSEMBLER BEFORE OPTIMIZATION + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__bbegin) +.pc = $80d "Program" + // Global Constants & labels + .label rom = $e000 + .label print_char_cursor = 9 + .label print_line_cursor = 2 + .label last_time = $b + .label rand_seed = $d + .label Ticks = $f + .label Ticks_1 = $11 + // @begin +__bbegin: + jmp __b1 + // @1 +__b1: + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + lda #>0 + sta.z last_time+1 + jmp __b2 + // @2 +__b2: + // [2] (word) rand_seed#20 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z rand_seed + lda #>0 + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] +__b3_from___b2: + jmp __b3 + // @3 +__b3: + // [4] call main + // [6] phi from @3 to main [phi:@3->main] +main_from___b3: + jsr main + // [5] phi from @3 to @end [phi:@3->@end] +__bend_from___b3: + jmp __bend + // @end +__bend: + // main +main: { + .label i = $f + // [7] call start + jsr start + // [8] phi from main to main::@1 [phi:main->main::@1] + __b1_from_main: + // [8] phi (byte*) print_line_cursor#20 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + // [8] phi (byte*) print_char_cursor#51 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [8] phi (word) main::i#3 = (byte) 0 [phi:main->main::@1#2] -- vwuz1=vbuc1 + lda #<0 + sta.z i + lda #>0 + sta.z i+1 + jmp __b1 + // main::@1 + __b1: + // [9] if((word) main::i#3<(byte) 6) goto main::@2 -- vwuz1_lt_vbuc1_then_la1 + lda.z i+1 + cmp #>6 + bcc __b2_from___b1 + bne !+ + lda.z i + cmp #<6 + bcc __b2_from___b1 + !: + // [10] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + __b3_from___b1: + jmp __b3 + // main::@3 + __b3: + // [11] call end + jsr end + jmp __breturn + // main::@return + __breturn: + // [12] return + rts + // [13] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + __b2_from___b1: + jmp __b2 + // main::@2 + __b2: + // [14] call sum + // [67] phi from main::@2 to sum [phi:main::@2->sum] + sum_from___b2: + jsr sum + // [15] (word) sum::return#2 ← (word) sum::s#3 + jmp __b4 + // main::@4 + __b4: + // [16] (word) print_word_decimal::w#0 ← (word) sum::return#2 + // [17] call print_word_decimal + jsr print_word_decimal + // [18] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + __b5_from___b4: + jmp __b5 + // main::@5 + __b5: + // [19] call print_ln + // [22] phi from main::@5 to print_ln [phi:main::@5->print_ln] + print_ln_from___b5: + // [22] phi (byte*) print_char_cursor#46 = (byte*) print_char_cursor#2 [phi:main::@5->print_ln#0] -- register_copy + jsr print_ln + jmp __b6 + // main::@6 + __b6: + // [20] (word) main::i#2 ← ++ (word) main::i#3 -- vwuz1=_inc_vwuz1 + inc.z i + bne !+ + inc.z i+1 + !: + // [21] (byte*) print_char_cursor#71 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 + lda.z print_line_cursor + sta.z print_char_cursor + lda.z print_line_cursor+1 + sta.z print_char_cursor+1 + // [8] phi from main::@6 to main::@1 [phi:main::@6->main::@1] + __b1_from___b6: + // [8] phi (byte*) print_line_cursor#20 = (byte*) print_line_cursor#1 [phi:main::@6->main::@1#0] -- register_copy + // [8] phi (byte*) print_char_cursor#51 = (byte*) print_char_cursor#71 [phi:main::@6->main::@1#1] -- register_copy + // [8] phi (word) main::i#3 = (word) main::i#2 [phi:main::@6->main::@1#2] -- register_copy + jmp __b1 +} + // print_ln +// Print a newline +print_ln: { + // [23] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1] + __b1_from_print_ln: + __b1_from___b1: + // [23] phi (byte*) print_line_cursor#9 = (byte*) print_line_cursor#20 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy + jmp __b1 + // print_ln::@1 + __b1: + // [24] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // [25] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#46) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1_from___b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1_from___b1 + !: + jmp __breturn + // print_ln::@return + __breturn: + // [26] return + rts +} + // print_word_decimal +// Print a word as DECIMAL +// print_word_decimal(word zeropage(5) w) +print_word_decimal: { + .label w = 5 + // [27] (word) utoa::value#1 ← (word) print_word_decimal::w#0 + // [28] call utoa + // [39] phi from print_word_decimal to utoa [phi:print_word_decimal->utoa] + utoa_from_print_word_decimal: + jsr utoa + // [29] phi from print_word_decimal to print_word_decimal::@1 [phi:print_word_decimal->print_word_decimal::@1] + __b1_from_print_word_decimal: + jmp __b1 + // print_word_decimal::@1 + __b1: + // [30] call print_str + // [32] phi from print_word_decimal::@1 to print_str [phi:print_word_decimal::@1->print_str] + print_str_from___b1: + jsr print_str + jmp __breturn + // print_word_decimal::@return + __breturn: + // [31] return + rts +} + // print_str +// Print a zero-terminated string +// print_str(byte* zeropage(5) str) +print_str: { + .label str = 5 + // [33] phi from print_str to print_str::@1 [phi:print_str->print_str::@1] + __b1_from_print_str: + // [33] phi (byte*) print_char_cursor#2 = (byte*) print_char_cursor#51 [phi:print_str->print_str::@1#0] -- register_copy + // [33] phi (byte*) print_str::str#2 = (const byte*) decimal_digits [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 + lda #decimal_digits + sta.z str+1 + jmp __b1 + // print_str::@1 + __b1: + // [34] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 + ldy #0 + lda (str),y + cmp #0 + bne __b2 + jmp __breturn + // print_str::@return + __breturn: + // [35] return + rts + // print_str::@2 + __b2: + // [36] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (str),y + ldy #0 + sta (print_char_cursor),y + // [37] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + // [38] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 + inc.z str + bne !+ + inc.z str+1 + !: + // [33] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1] + __b1_from___b2: + // [33] phi (byte*) print_char_cursor#2 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy + // [33] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy + jmp __b1 +} + // utoa +// Converts unsigned number value to a string representing it in RADIX format. +// If the leading digits are zero they are not included in the string. +// - value : The number to be converted to RADIX +// - buffer : receives the string representing the number and zero-termination. +// - radix : The radix to convert the number to (from the enum RADIX) +// utoa(word zeropage(5) value, byte* zeropage(7) buffer) +utoa: { + .const max_digits = 5 + .label digit_value = $11 + .label buffer = 7 + .label digit = 4 + .label value = 5 + // [40] phi from utoa to utoa::@1 [phi:utoa->utoa::@1] + __b1_from_utoa: + // [40] phi (byte*) utoa::buffer#11 = (const byte*) decimal_digits [phi:utoa->utoa::@1#0] -- pbuz1=pbuc1 + lda #decimal_digits + sta.z buffer+1 + // [40] phi (byte) utoa::started#2 = (byte) 0 [phi:utoa->utoa::@1#1] -- vbuxx=vbuc1 + ldx #0 + // [40] phi (word) utoa::value#2 = (word) utoa::value#1 [phi:utoa->utoa::@1#2] -- register_copy + // [40] phi (byte) utoa::digit#2 = (byte) 0 [phi:utoa->utoa::@1#3] -- vbuz1=vbuc1 + lda #0 + sta.z digit + jmp __b1 + // utoa::@1 + __b1: + // [41] if((byte) utoa::digit#2<(const byte) utoa::max_digits#1-(byte) 1) goto utoa::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z digit + cmp #max_digits-1 + bcc __b2 + jmp __b3 + // utoa::@3 + __b3: + // [42] (byte~) utoa::$4 ← (byte)(word) utoa::value#2 -- vbuaa=_byte_vwuz1 + lda.z value + // [43] *((byte*) utoa::buffer#11) ← *((const byte*) DIGITS + (byte~) utoa::$4) -- _deref_pbuz1=pbuc1_derefidx_vbuaa + tay + lda DIGITS,y + ldy #0 + sta (buffer),y + // [44] (byte*) utoa::buffer#3 ← ++ (byte*) utoa::buffer#11 -- pbuz1=_inc_pbuz1 + inc.z buffer + bne !+ + inc.z buffer+1 + !: + // [45] *((byte*) utoa::buffer#3) ← (byte) 0 -- _deref_pbuz1=vbuc1 + lda #0 + ldy #0 + sta (buffer),y + jmp __breturn + // utoa::@return + __breturn: + // [46] return + rts + // utoa::@2 + __b2: + // [47] (byte~) utoa::$11 ← (byte) utoa::digit#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + lda.z digit + asl + // [48] (word) utoa::digit_value#0 ← *((const word*) RADIX_DECIMAL_VALUES + (byte~) utoa::$11) -- vwuz1=pwuc1_derefidx_vbuaa + tay + lda RADIX_DECIMAL_VALUES,y + sta.z digit_value + lda RADIX_DECIMAL_VALUES+1,y + sta.z digit_value+1 + // [49] if((byte) 0!=(byte) utoa::started#2) goto utoa::@5 -- vbuc1_neq_vbuxx_then_la1 + cpx #0 + bne __b5 + jmp __b7 + // utoa::@7 + __b7: + // [50] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5 -- vwuz1_ge_vwuz2_then_la1 + lda.z digit_value+1 + cmp.z value+1 + bne !+ + lda.z digit_value + cmp.z value + beq __b5 + !: + bcc __b5 + // [51] phi from utoa::@7 to utoa::@4 [phi:utoa::@7->utoa::@4] + __b4_from___b7: + // [51] phi (byte*) utoa::buffer#14 = (byte*) utoa::buffer#11 [phi:utoa::@7->utoa::@4#0] -- register_copy + // [51] phi (byte) utoa::started#4 = (byte) utoa::started#2 [phi:utoa::@7->utoa::@4#1] -- register_copy + // [51] phi (word) utoa::value#6 = (word) utoa::value#2 [phi:utoa::@7->utoa::@4#2] -- register_copy + jmp __b4 + // utoa::@4 + __b4: + // [52] (byte) utoa::digit#1 ← ++ (byte) utoa::digit#2 -- vbuz1=_inc_vbuz1 + inc.z digit + // [40] phi from utoa::@4 to utoa::@1 [phi:utoa::@4->utoa::@1] + __b1_from___b4: + // [40] phi (byte*) utoa::buffer#11 = (byte*) utoa::buffer#14 [phi:utoa::@4->utoa::@1#0] -- register_copy + // [40] phi (byte) utoa::started#2 = (byte) utoa::started#4 [phi:utoa::@4->utoa::@1#1] -- register_copy + // [40] phi (word) utoa::value#2 = (word) utoa::value#6 [phi:utoa::@4->utoa::@1#2] -- register_copy + // [40] phi (byte) utoa::digit#2 = (byte) utoa::digit#1 [phi:utoa::@4->utoa::@1#3] -- register_copy + jmp __b1 + // utoa::@5 + __b5: + // [53] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11 + // [54] (word) utoa_append::value#0 ← (word) utoa::value#2 + // [55] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0 + // [56] call utoa_append + // [60] phi from utoa::@5 to utoa_append [phi:utoa::@5->utoa_append] + utoa_append_from___b5: + jsr utoa_append + // [57] (word) utoa_append::return#0 ← (word) utoa_append::value#2 + jmp __b6 + // utoa::@6 + __b6: + // [58] (word) utoa::value#0 ← (word) utoa_append::return#0 + // [59] (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#11 -- pbuz1=_inc_pbuz1 + inc.z buffer + bne !+ + inc.z buffer+1 + !: + // [51] phi from utoa::@6 to utoa::@4 [phi:utoa::@6->utoa::@4] + __b4_from___b6: + // [51] phi (byte*) utoa::buffer#14 = (byte*) utoa::buffer#4 [phi:utoa::@6->utoa::@4#0] -- register_copy + // [51] phi (byte) utoa::started#4 = (byte) 1 [phi:utoa::@6->utoa::@4#1] -- vbuxx=vbuc1 + ldx #1 + // [51] phi (word) utoa::value#6 = (word) utoa::value#0 [phi:utoa::@6->utoa::@4#2] -- register_copy + jmp __b4 +} + // utoa_append +// Used to convert a single digit of an unsigned number value to a string representation +// Counts a single digit up from '0' as long as the value is larger than sub. +// Each time the digit is increased sub is subtracted from value. +// - buffer : pointer to the char that receives the digit +// - value : The value where the digit will be derived from +// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. +// (For decimal the subs used are 10000, 1000, 100, 10, 1) +// returns : the value reduced by sub * digit so that it is less than sub. +// utoa_append(byte* zeropage(7) buffer, word zeropage(5) value, word zeropage($11) sub) +utoa_append: { + .label buffer = 7 + .label value = 5 + .label sub = $11 + .label return = 5 + // [61] phi from utoa_append to utoa_append::@1 [phi:utoa_append->utoa_append::@1] + __b1_from_utoa_append: + // [61] phi (byte) utoa_append::digit#2 = (byte) 0 [phi:utoa_append->utoa_append::@1#0] -- vbuxx=vbuc1 + ldx #0 + // [61] phi (word) utoa_append::value#2 = (word) utoa_append::value#0 [phi:utoa_append->utoa_append::@1#1] -- register_copy + jmp __b1 + // utoa_append::@1 + __b1: + // [62] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 -- vwuz1_ge_vwuz2_then_la1 + lda.z sub+1 + cmp.z value+1 + bne !+ + lda.z sub + cmp.z value + beq __b2 + !: + bcc __b2 + jmp __b3 + // utoa_append::@3 + __b3: + // [63] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2) -- _deref_pbuz1=pbuc1_derefidx_vbuxx + lda DIGITS,x + ldy #0 + sta (buffer),y + jmp __breturn + // utoa_append::@return + __breturn: + // [64] return + rts + // utoa_append::@2 + __b2: + // [65] (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2 -- vbuxx=_inc_vbuxx + inx + // [66] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0 -- vwuz1=vwuz1_minus_vwuz2 + lda.z value + sec + sbc.z sub + sta.z value + lda.z value+1 + sbc.z sub+1 + sta.z value+1 + // [61] phi from utoa_append::@2 to utoa_append::@1 [phi:utoa_append::@2->utoa_append::@1] + __b1_from___b2: + // [61] phi (byte) utoa_append::digit#2 = (byte) utoa_append::digit#1 [phi:utoa_append::@2->utoa_append::@1#0] -- register_copy + // [61] phi (word) utoa_append::value#2 = (word) utoa_append::value#1 [phi:utoa_append::@2->utoa_append::@1#1] -- register_copy + jmp __b1 +} + // sum +sum: { + .label s = 5 + .label p = 7 + .label return = 5 + // [68] phi from sum to sum::@1 [phi:sum->sum::@1] + __b1_from_sum: + // [68] phi (byte*) sum::p#5 = (const byte*) rom [phi:sum->sum::@1#0] -- pbuz1=pbuc1 + lda #rom + sta.z p+1 + // [68] phi (word) sum::s#3 = (byte) 0 [phi:sum->sum::@1#1] -- vwuz1=vbuc1 + lda #<0 + sta.z s + lda #>0 + sta.z s+1 + // [68] phi (byte) sum::page#3 = (byte) 0 [phi:sum->sum::@1#2] -- vbuxx=vbuc1 + ldx #0 + jmp __b1 + /* doing it page-by-page is faster than doing just one huge loop */ + // sum::@1 + __b1: + // [69] if((byte) sum::page#3<(byte) $20) goto sum::@2 -- vbuxx_lt_vbuc1_then_la1 + cpx #$20 + bcc __b2_from___b1 + jmp __breturn + // sum::@return + __breturn: + // [70] return + rts + // [71] phi from sum::@1 to sum::@2 [phi:sum::@1->sum::@2] + __b2_from___b1: + // [71] phi (word) sum::s#4 = (word) sum::s#3 [phi:sum::@1->sum::@2#0] -- register_copy + // [71] phi (byte) sum::i#3 = (byte) 0 [phi:sum::@1->sum::@2#1] -- vbuyy=vbuc1 + ldy #0 + jmp __b2 + // [71] phi from sum::@2 to sum::@2 [phi:sum::@2->sum::@2] + __b2_from___b2: + // [71] phi (word) sum::s#4 = (word) sum::s#2 [phi:sum::@2->sum::@2#0] -- register_copy + // [71] phi (byte) sum::i#3 = (byte) sum::i#2 [phi:sum::@2->sum::@2#1] -- register_copy + jmp __b2 + // sum::@2 + __b2: + // [72] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3) -- vbuaa=pbuz1_derefidx_vbuyy + lda (p),y + // [73] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 -- vwuz1=vwuz1_plus_vbuaa + clc + adc.z s + sta.z s + bcc !+ + inc.z s+1 + !: + // [74] (byte) sum::i#2 ← ++ (byte) sum::i#3 -- vbuyy=_inc_vbuyy + iny + // [75] if((byte) 0!=(byte) sum::i#2) goto sum::@2 -- vbuc1_neq_vbuyy_then_la1 + cpy #0 + bne __b2_from___b2 + jmp __b3 + // sum::@3 + __b3: + // [76] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100 -- pbuz1=pbuz1_plus_vwuc1 + clc + lda.z p + adc #<$100 + sta.z p + lda.z p+1 + adc #>$100 + sta.z p+1 + // [77] (byte) sum::page#2 ← ++ (byte) sum::page#3 -- vbuxx=_inc_vbuxx + inx + // [68] phi from sum::@3 to sum::@1 [phi:sum::@3->sum::@1] + __b1_from___b3: + // [68] phi (byte*) sum::p#5 = (byte*) sum::p#2 [phi:sum::@3->sum::@1#0] -- register_copy + // [68] phi (word) sum::s#3 = (word) sum::s#2 [phi:sum::@3->sum::@1#1] -- register_copy + // [68] phi (byte) sum::page#3 = (byte) sum::page#2 [phi:sum::@3->sum::@1#2] -- register_copy + jmp __b1 +} + // end +end: { + // [78] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // [79] call start + jsr start + jmp __b1 + // end::@1 + __b1: + // [80] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // [81] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // [82] (word) print_word::w#0 ← (word) Ticks#2 + // [83] call print_word + jsr print_word + // [84] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + __b2_from___b1: + jmp __b2 + // end::@2 + __b2: + // [85] call print_ln + // [22] phi from end::@2 to print_ln [phi:end::@2->print_ln] + print_ln_from___b2: + // [22] phi (byte*) print_char_cursor#46 = (byte*) print_char_cursor#13 [phi:end::@2->print_ln#0] -- register_copy + jsr print_ln + jmp __breturn + // end::@return + __breturn: + // [86] (word) last_time#2 ← (word) last_time#1 + // [87] return + rts +} + // print_word +// Print a word as HEX +// print_word(word zeropage($11) w) +print_word: { + .label w = $11 + // [88] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1 + lda.z w+1 + tax + // [89] call print_byte + // [93] phi from print_word to print_byte [phi:print_word->print_byte] + print_byte_from_print_word: + // [93] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#51 [phi:print_word->print_byte#0] -- register_copy + // [93] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + jmp __b1 + // print_word::@1 + __b1: + // [90] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuxx=_lo_vwuz1 + lda.z w + tax + // [91] call print_byte + // [93] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte] + print_byte_from___b1: + // [93] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#13 [phi:print_word::@1->print_byte#0] -- register_copy + // [93] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + jmp __breturn + // print_word::@return + __breturn: + // [92] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + // [94] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuxx_ror_4 + txa + lsr + lsr + lsr + lsr + // [95] (byte) print_char::ch#0 ← *((const byte*) DIGITS + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa + tay + lda DIGITS,y + // [96] call print_char + // [101] phi from print_byte to print_char [phi:print_byte->print_char] + print_char_from_print_byte: + // [101] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#49 [phi:print_byte->print_char#0] -- register_copy + // [101] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + jmp __b1 + // print_byte::@1 + __b1: + // [97] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuxx=vbuxx_band_vbuc1 + lda #$f + axs #0 + // [98] (byte) print_char::ch#1 ← *((const byte*) DIGITS + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuxx + lda DIGITS,x + // [99] call print_char + // [101] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + print_char_from___b1: + // [101] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#13 [phi:print_byte::@1->print_char#0] -- register_copy + // [101] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + jmp __breturn + // print_byte::@return + __breturn: + // [100] return + rts +} + // print_char +// Print a single char +// print_char(byte register(A) ch) +print_char: { + // [102] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa + ldy #0 + sta (print_char_cursor),y + // [103] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#35 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + jmp __breturn + // print_char::@return + __breturn: + // [104] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // [106] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + jmp __breturn + // start::@return + __breturn: + // [107] return + rts +} + // File Data + // The digits used for numbers + DIGITS: .text "0123456789abcdef" + // Values of decimal digits + RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a + // Digits used for storing the decimal word + decimal_digits: .fill 6, 0 + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp __b1 +Removing instruction jmp __b2 +Removing instruction jmp __b3 +Removing instruction jmp __bend +Removing instruction jmp __b1 +Removing instruction jmp __b3 +Removing instruction jmp __breturn +Removing instruction jmp __b2 +Removing instruction jmp __b4 +Removing instruction jmp __b5 +Removing instruction jmp __b6 +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __b3 +Removing instruction jmp __breturn +Removing instruction jmp __b7 +Removing instruction jmp __b4 +Removing instruction jmp __b6 +Removing instruction jmp __b1 +Removing instruction jmp __b3 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b2 +Removing instruction jmp __b3 +Removing instruction jmp __b1 +Removing instruction jmp __b2 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __breturn +Removing instruction jmp __breturn +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda #>0 +Removing instruction lda #>0 +Removing instruction lda #>0 +Removing instruction ldy #0 +Replacing instruction lda #0 with TXA +Replacing instruction ldy #0 with TAY +Removing instruction lda #>0 +Replacing instruction ldx #0 with TAX +Succesful ASM optimization Pass5UnnecesaryLoadElimination +Replacing label __bbegin with __b1 +Replacing label __b2_from___b1 with __b2 +Replacing label __b2_from___b1 with __b2 +Replacing label __b1_from___b1 with __b1 +Replacing label __b1_from___b1 with __b1 +Replacing label __b2_from___b2 with __b2 +Removing instruction __bbegin: +Removing instruction __b3_from___b2: +Removing instruction main_from___b3: +Removing instruction __bend_from___b3: +Removing instruction __b3_from___b1: +Removing instruction __b2_from___b1: +Removing instruction sum_from___b2: +Removing instruction __b5_from___b4: +Removing instruction print_ln_from___b5: +Removing instruction __b1_from_print_ln: +Removing instruction __b1_from___b1: +Removing instruction __b1_from_print_word_decimal: +Removing instruction print_str_from___b1: +Removing instruction __b4_from___b7: +Removing instruction utoa_append_from___b5: +Removing instruction __b2_from___b2: +Removing instruction __b2_from___b1: +Removing instruction print_ln_from___b2: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction __b2: +Removing instruction __b3: +Removing instruction __bend: +Removing instruction __b1_from_main: +Removing instruction __b3: +Removing instruction __breturn: +Removing instruction __b4: +Removing instruction __b5: +Removing instruction __b6: +Removing instruction __b1_from___b6: +Removing instruction __breturn: +Removing instruction utoa_from_print_word_decimal: +Removing instruction __b1: +Removing instruction __breturn: +Removing instruction __b1_from_print_str: +Removing instruction __breturn: +Removing instruction __b1_from___b2: +Removing instruction __b1_from_utoa: +Removing instruction __b3: +Removing instruction __breturn: +Removing instruction __b7: +Removing instruction __b1_from___b4: +Removing instruction __b6: +Removing instruction __b4_from___b6: +Removing instruction __b1_from_utoa_append: +Removing instruction __b3: +Removing instruction __breturn: +Removing instruction __b1_from___b2: +Removing instruction __b1_from_sum: +Removing instruction __breturn: +Removing instruction __b3: +Removing instruction __b1_from___b3: +Removing instruction __b1: +Removing instruction __b2: +Removing instruction __breturn: +Removing instruction print_byte_from_print_word: +Removing instruction __b1: +Removing instruction print_byte_from___b1: +Removing instruction __breturn: +Removing instruction print_char_from_print_byte: +Removing instruction __b1: +Removing instruction print_char_from___b1: +Removing instruction __breturn: +Removing instruction __breturn: +Removing instruction __breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Relabelling long label __b2_from___b1 to b1 +Succesful ASM optimization Pass5RelabelLongLabels +Adding RTS to root block +Succesful ASM optimization Pass5AddMainRts +Removing instruction jmp __b2 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda #<0 +Removing instruction lda.z digit_value+1 +Succesful ASM optimization Pass5UnnecesaryLoadElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(const byte*) DIGITS = (string) "0123456789abcdef"z +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const word*) RADIX_DECIMAL_VALUES = { (word) $2710, (word) $3e8, (word) $64, (word) $a } +(word) Ticks +(word) Ticks#1 Ticks zp[2]:15 2.0 +(word) Ticks#2 Ticks_1 zp[2]:17 4.0 +(const byte*) decimal_digits = { fill( 6, 0) } +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@return +(word) last_time +(word) last_time#0 last_time zp[2]:11 0.3157894736842105 +(word) last_time#1 last_time zp[2]:11 1.0 +(word) last_time#2 last_time zp[2]:11 20.0 +(signed word()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@return +(word) main::i +(word) main::i#2 i zp[2]:15 11.0 +(word) main::i#3 i zp[2]:15 3.666666666666667 +(signed word) main::return +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 reg byte a 4.0 +(byte~) print_byte::$2 reg byte x 4.0 +(label) print_byte::@1 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 reg byte x 4.0 +(byte) print_byte::b#1 reg byte x 4.0 +(byte) print_byte::b#2 reg byte x 2.0 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 reg byte a 4.0 +(byte) print_char::ch#1 reg byte a 4.0 +(byte) print_char::ch#2 reg byte a 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#1 print_char_cursor zp[2]:9 101.0 +(byte*) print_char_cursor#13 print_char_cursor zp[2]:9 0.6153846153846154 +(byte*) print_char_cursor#2 print_char_cursor zp[2]:9 39.5 +(byte*) print_char_cursor#35 print_char_cursor zp[2]:9 4.0 +(byte*) print_char_cursor#46 print_char_cursor zp[2]:9 28.5 +(byte*) print_char_cursor#49 print_char_cursor zp[2]:9 2.0 +(byte*) print_char_cursor#51 print_char_cursor zp[2]:9 0.8823529411764707 +(byte*) print_char_cursor#71 print_char_cursor zp[2]:9 22.0 +(byte*) print_line_cursor +(byte*) print_line_cursor#1 print_line_cursor zp[2]:2 54.16666666666666 +(byte*) print_line_cursor#20 print_line_cursor zp[2]:2 0.7647058823529412 +(byte*) print_line_cursor#9 print_line_cursor zp[2]:2 204.0 +(void()) print_ln() +(label) print_ln::@1 +(label) print_ln::@return +(byte*) print_screen +(void()) print_str((byte*) print_str::str) +(label) print_str::@1 +(label) print_str::@2 +(label) print_str::@return +(byte*) print_str::str +(byte*) print_str::str#0 str zp[2]:5 202.0 +(byte*) print_str::str#2 str zp[2]:5 101.0 +(void()) print_word((word) print_word::w) +(label) print_word::@1 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 w zp[2]:17 2.0 +(void()) print_word_decimal((word) print_word_decimal::w) +(label) print_word_decimal::@1 +(label) print_word_decimal::@return +(word) print_word_decimal::w +(word) print_word_decimal::w#0 w zp[2]:5 13.0 +(word) rand_seed +(word) rand_seed#0 rand_seed zp[2]:13 20.0 +(word) rand_seed#20 rand_seed zp[2]:13 20.0 +(const byte*) rom = (byte*) 57344 +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time +(word()) sum() +(label) sum::@1 +(label) sum::@2 +(label) sum::@3 +(label) sum::@return +(byte) sum::i +(byte) sum::i#2 reg byte y 1501.5 +(byte) sum::i#3 reg byte y 1001.0 +(byte*) sum::p +(byte*) sum::p#2 p zp[2]:7 101.0 +(byte*) sum::p#5 p zp[2]:7 171.85714285714283 +(byte) sum::page +(byte) sum::page#2 reg byte x 202.0 +(byte) sum::page#3 reg byte x 37.875 +(word) sum::return +(word) sum::return#2 return zp[2]:5 22.0 +(word) sum::s +(word) sum::s#2 s zp[2]:5 420.59999999999997 +(word) sum::s#3 s zp[2]:5 53.25 +(word) sum::s#4 s zp[2]:5 1051.5 +(byte) sum::tmp +(byte) sum::tmp#1 reg byte a 2002.0 +(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix) +(byte~) utoa::$11 reg byte a 202.0 +(byte~) utoa::$4 reg byte a 4.0 +(label) utoa::@1 +(label) utoa::@2 +(label) utoa::@3 +(label) utoa::@4 +(label) utoa::@5 +(label) utoa::@6 +(label) utoa::@7 +(label) utoa::@return +(byte*) utoa::buffer +(byte*) utoa::buffer#11 buffer zp[2]:7 29.142857142857146 +(byte*) utoa::buffer#14 buffer zp[2]:7 151.5 +(byte*) utoa::buffer#3 buffer zp[2]:7 4.0 +(byte*) utoa::buffer#4 buffer zp[2]:7 202.0 +(byte) utoa::digit +(byte) utoa::digit#1 digit zp[1]:4 202.0 +(byte) utoa::digit#2 digit zp[1]:4 28.857142857142858 +(word) utoa::digit_value +(word) utoa::digit_value#0 digit_value zp[2]:17 60.599999999999994 +(word*) utoa::digit_values +(byte) utoa::max_digits +(const byte) utoa::max_digits#1 max_digits = (byte) 5 +(byte) utoa::radix +(byte) utoa::started +(byte) utoa::started#2 reg byte x 50.5 +(byte) utoa::started#4 reg byte x 101.0 +(word) utoa::value +(word) utoa::value#0 value zp[2]:5 101.0 +(word) utoa::value#1 value zp[2]:5 2.0 +(word) utoa::value#2 value zp[2]:5 58.00000000000001 +(word) utoa::value#6 value zp[2]:5 151.5 +(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub) +(label) utoa_append::@1 +(label) utoa_append::@2 +(label) utoa_append::@3 +(label) utoa_append::@return +(byte*) utoa_append::buffer +(byte*) utoa_append::buffer#0 buffer zp[2]:7 12.875 +(byte) utoa_append::digit +(byte) utoa_append::digit#1 reg byte x 1001.0 +(byte) utoa_append::digit#2 reg byte x 1002.0 +(word) utoa_append::return +(word) utoa_append::return#0 return zp[2]:5 202.0 +(word) utoa_append::sub +(word) utoa_append::sub#0 sub zp[2]:17 350.5 +(word) utoa_append::value +(word) utoa_append::value#0 value zp[2]:5 34.33333333333333 +(word) utoa_append::value#1 value zp[2]:5 2002.0 +(word) utoa_append::value#2 value zp[2]:5 517.6666666666667 + +zp[2]:2 [ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] +zp[1]:4 [ utoa::digit#2 utoa::digit#1 ] +zp[2]:5 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 print_word_decimal::w#0 utoa_append::return#0 sum::s#4 sum::s#3 sum::s#2 sum::return#2 print_str::str#2 print_str::str#0 ] +reg byte x [ utoa::started#2 utoa::started#4 ] +reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] +reg byte x [ sum::page#3 sum::page#2 ] +zp[2]:7 [ sum::p#5 sum::p#2 utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa::buffer#3 utoa_append::buffer#0 ] +reg byte y [ sum::i#3 sum::i#2 ] +reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +zp[2]:9 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] +zp[2]:11 [ last_time#0 last_time#1 last_time#2 ] +zp[2]:13 [ rand_seed#0 rand_seed#20 ] +reg byte a [ utoa::$4 ] +reg byte a [ utoa::$11 ] +reg byte a [ sum::tmp#1 ] +zp[2]:15 [ Ticks#1 main::i#3 main::i#2 ] +zp[2]:17 [ Ticks#2 print_word::w#0 utoa::digit_value#0 utoa_append::sub#0 ] +reg byte a [ print_byte::$0 ] +reg byte x [ print_byte::$2 ] + + +FINAL ASSEMBLER +Score: 101245 + + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__b1) +.pc = $80d "Program" + // Global Constants & labels + .label rom = $e000 + .label print_char_cursor = 9 + .label print_line_cursor = 2 + .label last_time = $b + .label rand_seed = $d + .label Ticks = $f + .label Ticks_1 = $11 + // @begin + // @1 +__b1: + // last_time + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + sta.z last_time+1 + // @2 + // rand_seed + // [2] (word) rand_seed#20 ← (word) 0 -- vwuz1=vwuc1 + sta.z rand_seed + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] + // @3 + // [4] call main + // [6] phi from @3 to main [phi:@3->main] + jsr main + rts + // [5] phi from @3 to @end [phi:@3->@end] + // @end + // main +main: { + .label i = $f + // start() + // [7] call start + jsr start + // [8] phi from main to main::@1 [phi:main->main::@1] + // [8] phi (byte*) print_line_cursor#20 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + // [8] phi (byte*) print_char_cursor#51 = (byte*) 1024 [phi:main->main::@1#1] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [8] phi (word) main::i#3 = (byte) 0 [phi:main->main::@1#2] -- vwuz1=vbuc1 + lda #<0 + sta.z i + sta.z i+1 + // main::@1 + __b1: + // for(i=0;i<6;i++) + // [9] if((word) main::i#3<(byte) 6) goto main::@2 -- vwuz1_lt_vbuc1_then_la1 + lda.z i+1 + cmp #>6 + bcc __b2 + bne !+ + lda.z i + cmp #<6 + bcc __b2 + !: + // [10] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + // main::@3 + // end() + // [11] call end + jsr end + // main::@return + // } + // [12] return + rts + // [13] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + // main::@2 + __b2: + // sum() + // [14] call sum + // [67] phi from main::@2 to sum [phi:main::@2->sum] + jsr sum + // sum() + // [15] (word) sum::return#2 ← (word) sum::s#3 + // main::@4 + // print_word_decimal(sum()) + // [16] (word) print_word_decimal::w#0 ← (word) sum::return#2 + // [17] call print_word_decimal + jsr print_word_decimal + // [18] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + // main::@5 + // print_ln() + // [19] call print_ln + // [22] phi from main::@5 to print_ln [phi:main::@5->print_ln] + // [22] phi (byte*) print_char_cursor#46 = (byte*) print_char_cursor#2 [phi:main::@5->print_ln#0] -- register_copy + jsr print_ln + // main::@6 + // for(i=0;i<6;i++) + // [20] (word) main::i#2 ← ++ (word) main::i#3 -- vwuz1=_inc_vwuz1 + inc.z i + bne !+ + inc.z i+1 + !: + // [21] (byte*) print_char_cursor#71 ← (byte*) print_line_cursor#1 -- pbuz1=pbuz2 + lda.z print_line_cursor + sta.z print_char_cursor + lda.z print_line_cursor+1 + sta.z print_char_cursor+1 + // [8] phi from main::@6 to main::@1 [phi:main::@6->main::@1] + // [8] phi (byte*) print_line_cursor#20 = (byte*) print_line_cursor#1 [phi:main::@6->main::@1#0] -- register_copy + // [8] phi (byte*) print_char_cursor#51 = (byte*) print_char_cursor#71 [phi:main::@6->main::@1#1] -- register_copy + // [8] phi (word) main::i#3 = (word) main::i#2 [phi:main::@6->main::@1#2] -- register_copy + jmp __b1 +} + // print_ln +// Print a newline +print_ln: { + // [23] phi from print_ln print_ln::@1 to print_ln::@1 [phi:print_ln/print_ln::@1->print_ln::@1] + // [23] phi (byte*) print_line_cursor#9 = (byte*) print_line_cursor#20 [phi:print_ln/print_ln::@1->print_ln::@1#0] -- register_copy + // print_ln::@1 + __b1: + // print_line_cursor + $28 + // [24] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // while (print_line_cursorutoa] + jsr utoa + // [29] phi from print_word_decimal to print_word_decimal::@1 [phi:print_word_decimal->print_word_decimal::@1] + // print_word_decimal::@1 + // print_str(decimal_digits) + // [30] call print_str + // [32] phi from print_word_decimal::@1 to print_str [phi:print_word_decimal::@1->print_str] + jsr print_str + // print_word_decimal::@return + // } + // [31] return + rts +} + // print_str +// Print a zero-terminated string +// print_str(byte* zeropage(5) str) +print_str: { + .label str = 5 + // [33] phi from print_str to print_str::@1 [phi:print_str->print_str::@1] + // [33] phi (byte*) print_char_cursor#2 = (byte*) print_char_cursor#51 [phi:print_str->print_str::@1#0] -- register_copy + // [33] phi (byte*) print_str::str#2 = (const byte*) decimal_digits [phi:print_str->print_str::@1#1] -- pbuz1=pbuc1 + lda #decimal_digits + sta.z str+1 + // print_str::@1 + __b1: + // while(*str) + // [34] if((byte) 0!=*((byte*) print_str::str#2)) goto print_str::@2 -- vbuc1_neq__deref_pbuz1_then_la1 + ldy #0 + lda (str),y + cmp #0 + bne __b2 + // print_str::@return + // } + // [35] return + rts + // print_str::@2 + __b2: + // *(print_char_cursor++) = *(str++) + // [36] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#2) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (str),y + sta (print_char_cursor),y + // *(print_char_cursor++) = *(str++); + // [37] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + // [38] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#2 -- pbuz1=_inc_pbuz1 + inc.z str + bne !+ + inc.z str+1 + !: + // [33] phi from print_str::@2 to print_str::@1 [phi:print_str::@2->print_str::@1] + // [33] phi (byte*) print_char_cursor#2 = (byte*) print_char_cursor#1 [phi:print_str::@2->print_str::@1#0] -- register_copy + // [33] phi (byte*) print_str::str#2 = (byte*) print_str::str#0 [phi:print_str::@2->print_str::@1#1] -- register_copy + jmp __b1 +} + // utoa +// Converts unsigned number value to a string representing it in RADIX format. +// If the leading digits are zero they are not included in the string. +// - value : The number to be converted to RADIX +// - buffer : receives the string representing the number and zero-termination. +// - radix : The radix to convert the number to (from the enum RADIX) +// utoa(word zeropage(5) value, byte* zeropage(7) buffer) +utoa: { + .const max_digits = 5 + .label digit_value = $11 + .label buffer = 7 + .label digit = 4 + .label value = 5 + // [40] phi from utoa to utoa::@1 [phi:utoa->utoa::@1] + // [40] phi (byte*) utoa::buffer#11 = (const byte*) decimal_digits [phi:utoa->utoa::@1#0] -- pbuz1=pbuc1 + lda #decimal_digits + sta.z buffer+1 + // [40] phi (byte) utoa::started#2 = (byte) 0 [phi:utoa->utoa::@1#1] -- vbuxx=vbuc1 + ldx #0 + // [40] phi (word) utoa::value#2 = (word) utoa::value#1 [phi:utoa->utoa::@1#2] -- register_copy + // [40] phi (byte) utoa::digit#2 = (byte) 0 [phi:utoa->utoa::@1#3] -- vbuz1=vbuc1 + txa + sta.z digit + // utoa::@1 + __b1: + // for( char digit=0; digit= digit_value) + // [49] if((byte) 0!=(byte) utoa::started#2) goto utoa::@5 -- vbuc1_neq_vbuxx_then_la1 + cpx #0 + bne __b5 + // utoa::@7 + // [50] if((word) utoa::value#2>=(word) utoa::digit_value#0) goto utoa::@5 -- vwuz1_ge_vwuz2_then_la1 + cmp.z value+1 + bne !+ + lda.z digit_value + cmp.z value + beq __b5 + !: + bcc __b5 + // [51] phi from utoa::@7 to utoa::@4 [phi:utoa::@7->utoa::@4] + // [51] phi (byte*) utoa::buffer#14 = (byte*) utoa::buffer#11 [phi:utoa::@7->utoa::@4#0] -- register_copy + // [51] phi (byte) utoa::started#4 = (byte) utoa::started#2 [phi:utoa::@7->utoa::@4#1] -- register_copy + // [51] phi (word) utoa::value#6 = (word) utoa::value#2 [phi:utoa::@7->utoa::@4#2] -- register_copy + // utoa::@4 + __b4: + // for( char digit=0; digitutoa::@1] + // [40] phi (byte*) utoa::buffer#11 = (byte*) utoa::buffer#14 [phi:utoa::@4->utoa::@1#0] -- register_copy + // [40] phi (byte) utoa::started#2 = (byte) utoa::started#4 [phi:utoa::@4->utoa::@1#1] -- register_copy + // [40] phi (word) utoa::value#2 = (word) utoa::value#6 [phi:utoa::@4->utoa::@1#2] -- register_copy + // [40] phi (byte) utoa::digit#2 = (byte) utoa::digit#1 [phi:utoa::@4->utoa::@1#3] -- register_copy + jmp __b1 + // utoa::@5 + __b5: + // utoa_append(buffer++, value, digit_value) + // [53] (byte*) utoa_append::buffer#0 ← (byte*) utoa::buffer#11 + // [54] (word) utoa_append::value#0 ← (word) utoa::value#2 + // [55] (word) utoa_append::sub#0 ← (word) utoa::digit_value#0 + // [56] call utoa_append + // [60] phi from utoa::@5 to utoa_append [phi:utoa::@5->utoa_append] + jsr utoa_append + // utoa_append(buffer++, value, digit_value) + // [57] (word) utoa_append::return#0 ← (word) utoa_append::value#2 + // utoa::@6 + // value = utoa_append(buffer++, value, digit_value) + // [58] (word) utoa::value#0 ← (word) utoa_append::return#0 + // value = utoa_append(buffer++, value, digit_value); + // [59] (byte*) utoa::buffer#4 ← ++ (byte*) utoa::buffer#11 -- pbuz1=_inc_pbuz1 + inc.z buffer + bne !+ + inc.z buffer+1 + !: + // [51] phi from utoa::@6 to utoa::@4 [phi:utoa::@6->utoa::@4] + // [51] phi (byte*) utoa::buffer#14 = (byte*) utoa::buffer#4 [phi:utoa::@6->utoa::@4#0] -- register_copy + // [51] phi (byte) utoa::started#4 = (byte) 1 [phi:utoa::@6->utoa::@4#1] -- vbuxx=vbuc1 + ldx #1 + // [51] phi (word) utoa::value#6 = (word) utoa::value#0 [phi:utoa::@6->utoa::@4#2] -- register_copy + jmp __b4 +} + // utoa_append +// Used to convert a single digit of an unsigned number value to a string representation +// Counts a single digit up from '0' as long as the value is larger than sub. +// Each time the digit is increased sub is subtracted from value. +// - buffer : pointer to the char that receives the digit +// - value : The value where the digit will be derived from +// - sub : the value of a '1' in the digit. Subtracted continually while the digit is increased. +// (For decimal the subs used are 10000, 1000, 100, 10, 1) +// returns : the value reduced by sub * digit so that it is less than sub. +// utoa_append(byte* zeropage(7) buffer, word zeropage(5) value, word zeropage($11) sub) +utoa_append: { + .label buffer = 7 + .label value = 5 + .label sub = $11 + .label return = 5 + // [61] phi from utoa_append to utoa_append::@1 [phi:utoa_append->utoa_append::@1] + // [61] phi (byte) utoa_append::digit#2 = (byte) 0 [phi:utoa_append->utoa_append::@1#0] -- vbuxx=vbuc1 + ldx #0 + // [61] phi (word) utoa_append::value#2 = (word) utoa_append::value#0 [phi:utoa_append->utoa_append::@1#1] -- register_copy + // utoa_append::@1 + __b1: + // while (value >= sub) + // [62] if((word) utoa_append::value#2>=(word) utoa_append::sub#0) goto utoa_append::@2 -- vwuz1_ge_vwuz2_then_la1 + lda.z sub+1 + cmp.z value+1 + bne !+ + lda.z sub + cmp.z value + beq __b2 + !: + bcc __b2 + // utoa_append::@3 + // *buffer = DIGITS[digit] + // [63] *((byte*) utoa_append::buffer#0) ← *((const byte*) DIGITS + (byte) utoa_append::digit#2) -- _deref_pbuz1=pbuc1_derefidx_vbuxx + lda DIGITS,x + ldy #0 + sta (buffer),y + // utoa_append::@return + // } + // [64] return + rts + // utoa_append::@2 + __b2: + // digit++; + // [65] (byte) utoa_append::digit#1 ← ++ (byte) utoa_append::digit#2 -- vbuxx=_inc_vbuxx + inx + // value -= sub + // [66] (word) utoa_append::value#1 ← (word) utoa_append::value#2 - (word) utoa_append::sub#0 -- vwuz1=vwuz1_minus_vwuz2 + lda.z value + sec + sbc.z sub + sta.z value + lda.z value+1 + sbc.z sub+1 + sta.z value+1 + // [61] phi from utoa_append::@2 to utoa_append::@1 [phi:utoa_append::@2->utoa_append::@1] + // [61] phi (byte) utoa_append::digit#2 = (byte) utoa_append::digit#1 [phi:utoa_append::@2->utoa_append::@1#0] -- register_copy + // [61] phi (word) utoa_append::value#2 = (word) utoa_append::value#1 [phi:utoa_append::@2->utoa_append::@1#1] -- register_copy + jmp __b1 +} + // sum +sum: { + .label s = 5 + .label p = 7 + .label return = 5 + // [68] phi from sum to sum::@1 [phi:sum->sum::@1] + // [68] phi (byte*) sum::p#5 = (const byte*) rom [phi:sum->sum::@1#0] -- pbuz1=pbuc1 + lda #rom + sta.z p+1 + // [68] phi (word) sum::s#3 = (byte) 0 [phi:sum->sum::@1#1] -- vwuz1=vbuc1 + lda #<0 + sta.z s + sta.z s+1 + // [68] phi (byte) sum::page#3 = (byte) 0 [phi:sum->sum::@1#2] -- vbuxx=vbuc1 + tax + /* doing it page-by-page is faster than doing just one huge loop */ + // sum::@1 + __b1: + // for (page = 0; page < 0x20; page++) + // [69] if((byte) sum::page#3<(byte) $20) goto sum::@2 -- vbuxx_lt_vbuc1_then_la1 + cpx #$20 + bcc b1 + // sum::@return + // } + // [70] return + rts + // [71] phi from sum::@1 to sum::@2 [phi:sum::@1->sum::@2] + b1: + // [71] phi (word) sum::s#4 = (word) sum::s#3 [phi:sum::@1->sum::@2#0] -- register_copy + // [71] phi (byte) sum::i#3 = (byte) 0 [phi:sum::@1->sum::@2#1] -- vbuyy=vbuc1 + ldy #0 + // [71] phi from sum::@2 to sum::@2 [phi:sum::@2->sum::@2] + // [71] phi (word) sum::s#4 = (word) sum::s#2 [phi:sum::@2->sum::@2#0] -- register_copy + // [71] phi (byte) sum::i#3 = (byte) sum::i#2 [phi:sum::@2->sum::@2#1] -- register_copy + // sum::@2 + __b2: + // tmp = p[i] + // [72] (byte) sum::tmp#1 ← *((byte*) sum::p#5 + (byte) sum::i#3) -- vbuaa=pbuz1_derefidx_vbuyy + lda (p),y + // s += tmp + // [73] (word) sum::s#2 ← (word) sum::s#4 + (byte) sum::tmp#1 -- vwuz1=vwuz1_plus_vbuaa + clc + adc.z s + sta.z s + bcc !+ + inc.z s+1 + !: + // i++; + // [74] (byte) sum::i#2 ← ++ (byte) sum::i#3 -- vbuyy=_inc_vbuyy + iny + // while (i) + // [75] if((byte) 0!=(byte) sum::i#2) goto sum::@2 -- vbuc1_neq_vbuyy_then_la1 + cpy #0 + bne __b2 + // sum::@3 + // p += 0x100 + // [76] (byte*) sum::p#2 ← (byte*) sum::p#5 + (word) $100 -- pbuz1=pbuz1_plus_vwuc1 + clc + lda.z p + adc #<$100 + sta.z p + lda.z p+1 + adc #>$100 + sta.z p+1 + // for (page = 0; page < 0x20; page++) + // [77] (byte) sum::page#2 ← ++ (byte) sum::page#3 -- vbuxx=_inc_vbuxx + inx + // [68] phi from sum::@3 to sum::@1 [phi:sum::@3->sum::@1] + // [68] phi (byte*) sum::p#5 = (byte*) sum::p#2 [phi:sum::@3->sum::@1#0] -- register_copy + // [68] phi (word) sum::s#3 = (word) sum::s#2 [phi:sum::@3->sum::@1#1] -- register_copy + // [68] phi (byte) sum::page#3 = (byte) sum::page#2 [phi:sum::@3->sum::@1#2] -- register_copy + jmp __b1 +} + // end +end: { + // Ticks = last_time + // [78] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // start() + // [79] call start + jsr start + // end::@1 + // last_time -= Ticks + // [80] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // Ticks = last_time + // [81] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // print_word(Ticks) + // [82] (word) print_word::w#0 ← (word) Ticks#2 + // [83] call print_word + jsr print_word + // [84] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + // end::@2 + // print_ln() + // [85] call print_ln + // [22] phi from end::@2 to print_ln [phi:end::@2->print_ln] + // [22] phi (byte*) print_char_cursor#46 = (byte*) print_char_cursor#13 [phi:end::@2->print_ln#0] -- register_copy + jsr print_ln + // end::@return + // } + // [86] (word) last_time#2 ← (word) last_time#1 + // [87] return + rts +} + // print_word +// Print a word as HEX +// print_word(word zeropage($11) w) +print_word: { + .label w = $11 + // print_byte(>w) + // [88] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1 + lda.z w+1 + tax + // [89] call print_byte + // [93] phi from print_word to print_byte [phi:print_word->print_byte] + // [93] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#51 [phi:print_word->print_byte#0] -- register_copy + // [93] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + // print_word::@1 + // print_byte(print_byte] + // [93] phi (byte*) print_char_cursor#49 = (byte*) print_char_cursor#13 [phi:print_word::@1->print_byte#0] -- register_copy + // [93] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + // print_word::@return + // } + // [92] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + // b>>4 + // [94] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuxx_ror_4 + txa + lsr + lsr + lsr + lsr + // print_char(print_hextab[b>>4]) + // [95] (byte) print_char::ch#0 ← *((const byte*) DIGITS + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa + tay + lda DIGITS,y + // [96] call print_char + // [101] phi from print_byte to print_char [phi:print_byte->print_char] + // [101] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#49 [phi:print_byte->print_char#0] -- register_copy + // [101] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + // print_byte::@1 + // b&$f + // [97] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuxx=vbuxx_band_vbuc1 + lda #$f + axs #0 + // print_char(print_hextab[b&$f]) + // [98] (byte) print_char::ch#1 ← *((const byte*) DIGITS + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuxx + lda DIGITS,x + // [99] call print_char + // [101] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + // [101] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#13 [phi:print_byte::@1->print_char#0] -- register_copy + // [101] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + // print_byte::@return + // } + // [100] return + rts +} + // print_char +// Print a single char +// print_char(byte register(A) ch) +print_char: { + // *(print_char_cursor++) = ch + // [102] *((byte*) print_char_cursor#35) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa + ldy #0 + sta (print_char_cursor),y + // *(print_char_cursor++) = ch; + // [103] (byte*) print_char_cursor#13 ← ++ (byte*) print_char_cursor#35 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + // print_char::@return + // } + // [104] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // rand_seed = 6474 + // [106] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + // start::@return + // } + // [107] return + rts +} + // File Data + // The digits used for numbers + DIGITS: .text "0123456789abcdef" + // Values of decimal digits + RADIX_DECIMAL_VALUES: .word $2710, $3e8, $64, $a + // Digits used for storing the decimal word + decimal_digits: .fill 6, 0 + diff --git a/src/test/ref/millfork-benchmarks/romsum-kc.sym b/src/test/ref/millfork-benchmarks/romsum-kc.sym new file mode 100644 index 000000000..8946a5658 --- /dev/null +++ b/src/test/ref/millfork-benchmarks/romsum-kc.sym @@ -0,0 +1,185 @@ +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(const byte*) DIGITS = (string) "0123456789abcdef"z +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const word*) RADIX_DECIMAL_VALUES = { (word) $2710, (word) $3e8, (word) $64, (word) $a } +(word) Ticks +(word) Ticks#1 Ticks zp[2]:15 2.0 +(word) Ticks#2 Ticks_1 zp[2]:17 4.0 +(const byte*) decimal_digits = { fill( 6, 0) } +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@return +(word) last_time +(word) last_time#0 last_time zp[2]:11 0.3157894736842105 +(word) last_time#1 last_time zp[2]:11 1.0 +(word) last_time#2 last_time zp[2]:11 20.0 +(signed word()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@return +(word) main::i +(word) main::i#2 i zp[2]:15 11.0 +(word) main::i#3 i zp[2]:15 3.666666666666667 +(signed word) main::return +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 reg byte a 4.0 +(byte~) print_byte::$2 reg byte x 4.0 +(label) print_byte::@1 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 reg byte x 4.0 +(byte) print_byte::b#1 reg byte x 4.0 +(byte) print_byte::b#2 reg byte x 2.0 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 reg byte a 4.0 +(byte) print_char::ch#1 reg byte a 4.0 +(byte) print_char::ch#2 reg byte a 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#1 print_char_cursor zp[2]:9 101.0 +(byte*) print_char_cursor#13 print_char_cursor zp[2]:9 0.6153846153846154 +(byte*) print_char_cursor#2 print_char_cursor zp[2]:9 39.5 +(byte*) print_char_cursor#35 print_char_cursor zp[2]:9 4.0 +(byte*) print_char_cursor#46 print_char_cursor zp[2]:9 28.5 +(byte*) print_char_cursor#49 print_char_cursor zp[2]:9 2.0 +(byte*) print_char_cursor#51 print_char_cursor zp[2]:9 0.8823529411764707 +(byte*) print_char_cursor#71 print_char_cursor zp[2]:9 22.0 +(byte*) print_line_cursor +(byte*) print_line_cursor#1 print_line_cursor zp[2]:2 54.16666666666666 +(byte*) print_line_cursor#20 print_line_cursor zp[2]:2 0.7647058823529412 +(byte*) print_line_cursor#9 print_line_cursor zp[2]:2 204.0 +(void()) print_ln() +(label) print_ln::@1 +(label) print_ln::@return +(byte*) print_screen +(void()) print_str((byte*) print_str::str) +(label) print_str::@1 +(label) print_str::@2 +(label) print_str::@return +(byte*) print_str::str +(byte*) print_str::str#0 str zp[2]:5 202.0 +(byte*) print_str::str#2 str zp[2]:5 101.0 +(void()) print_word((word) print_word::w) +(label) print_word::@1 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 w zp[2]:17 2.0 +(void()) print_word_decimal((word) print_word_decimal::w) +(label) print_word_decimal::@1 +(label) print_word_decimal::@return +(word) print_word_decimal::w +(word) print_word_decimal::w#0 w zp[2]:5 13.0 +(word) rand_seed +(word) rand_seed#0 rand_seed zp[2]:13 20.0 +(word) rand_seed#20 rand_seed zp[2]:13 20.0 +(const byte*) rom = (byte*) 57344 +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time +(word()) sum() +(label) sum::@1 +(label) sum::@2 +(label) sum::@3 +(label) sum::@return +(byte) sum::i +(byte) sum::i#2 reg byte y 1501.5 +(byte) sum::i#3 reg byte y 1001.0 +(byte*) sum::p +(byte*) sum::p#2 p zp[2]:7 101.0 +(byte*) sum::p#5 p zp[2]:7 171.85714285714283 +(byte) sum::page +(byte) sum::page#2 reg byte x 202.0 +(byte) sum::page#3 reg byte x 37.875 +(word) sum::return +(word) sum::return#2 return zp[2]:5 22.0 +(word) sum::s +(word) sum::s#2 s zp[2]:5 420.59999999999997 +(word) sum::s#3 s zp[2]:5 53.25 +(word) sum::s#4 s zp[2]:5 1051.5 +(byte) sum::tmp +(byte) sum::tmp#1 reg byte a 2002.0 +(void()) utoa((word) utoa::value , (byte*) utoa::buffer , (byte) utoa::radix) +(byte~) utoa::$11 reg byte a 202.0 +(byte~) utoa::$4 reg byte a 4.0 +(label) utoa::@1 +(label) utoa::@2 +(label) utoa::@3 +(label) utoa::@4 +(label) utoa::@5 +(label) utoa::@6 +(label) utoa::@7 +(label) utoa::@return +(byte*) utoa::buffer +(byte*) utoa::buffer#11 buffer zp[2]:7 29.142857142857146 +(byte*) utoa::buffer#14 buffer zp[2]:7 151.5 +(byte*) utoa::buffer#3 buffer zp[2]:7 4.0 +(byte*) utoa::buffer#4 buffer zp[2]:7 202.0 +(byte) utoa::digit +(byte) utoa::digit#1 digit zp[1]:4 202.0 +(byte) utoa::digit#2 digit zp[1]:4 28.857142857142858 +(word) utoa::digit_value +(word) utoa::digit_value#0 digit_value zp[2]:17 60.599999999999994 +(word*) utoa::digit_values +(byte) utoa::max_digits +(const byte) utoa::max_digits#1 max_digits = (byte) 5 +(byte) utoa::radix +(byte) utoa::started +(byte) utoa::started#2 reg byte x 50.5 +(byte) utoa::started#4 reg byte x 101.0 +(word) utoa::value +(word) utoa::value#0 value zp[2]:5 101.0 +(word) utoa::value#1 value zp[2]:5 2.0 +(word) utoa::value#2 value zp[2]:5 58.00000000000001 +(word) utoa::value#6 value zp[2]:5 151.5 +(word()) utoa_append((byte*) utoa_append::buffer , (word) utoa_append::value , (word) utoa_append::sub) +(label) utoa_append::@1 +(label) utoa_append::@2 +(label) utoa_append::@3 +(label) utoa_append::@return +(byte*) utoa_append::buffer +(byte*) utoa_append::buffer#0 buffer zp[2]:7 12.875 +(byte) utoa_append::digit +(byte) utoa_append::digit#1 reg byte x 1001.0 +(byte) utoa_append::digit#2 reg byte x 1002.0 +(word) utoa_append::return +(word) utoa_append::return#0 return zp[2]:5 202.0 +(word) utoa_append::sub +(word) utoa_append::sub#0 sub zp[2]:17 350.5 +(word) utoa_append::value +(word) utoa_append::value#0 value zp[2]:5 34.33333333333333 +(word) utoa_append::value#1 value zp[2]:5 2002.0 +(word) utoa_append::value#2 value zp[2]:5 517.6666666666667 + +zp[2]:2 [ print_line_cursor#9 print_line_cursor#20 print_line_cursor#1 ] +zp[1]:4 [ utoa::digit#2 utoa::digit#1 ] +zp[2]:5 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 print_word_decimal::w#0 utoa_append::return#0 sum::s#4 sum::s#3 sum::s#2 sum::return#2 print_str::str#2 print_str::str#0 ] +reg byte x [ utoa::started#2 utoa::started#4 ] +reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] +reg byte x [ sum::page#3 sum::page#2 ] +zp[2]:7 [ sum::p#5 sum::p#2 utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 utoa::buffer#3 utoa_append::buffer#0 ] +reg byte y [ sum::i#3 sum::i#2 ] +reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +zp[2]:9 [ print_char_cursor#35 print_char_cursor#49 print_char_cursor#46 print_char_cursor#13 print_char_cursor#2 print_char_cursor#51 print_char_cursor#71 print_char_cursor#1 ] +zp[2]:11 [ last_time#0 last_time#1 last_time#2 ] +zp[2]:13 [ rand_seed#0 rand_seed#20 ] +reg byte a [ utoa::$4 ] +reg byte a [ utoa::$11 ] +reg byte a [ sum::tmp#1 ] +zp[2]:15 [ Ticks#1 main::i#3 main::i#2 ] +zp[2]:17 [ Ticks#2 print_word::w#0 utoa::digit_value#0 utoa_append::sub#0 ] +reg byte a [ print_byte::$0 ] +reg byte x [ print_byte::$2 ] diff --git a/src/test/ref/millfork-benchmarks/sieve-kc.asm b/src/test/ref/millfork-benchmarks/sieve-kc.asm new file mode 100644 index 000000000..1b9c3dcc7 --- /dev/null +++ b/src/test/ref/millfork-benchmarks/sieve-kc.asm @@ -0,0 +1,204 @@ +.pc = $801 "Basic" +:BasicUpstart(__b1) +.pc = $80d "Program" + .const COUNT = $4000 + .const SQRT_COUNT = $80 + .label print_line_cursor = 2 + .label print_char_cursor = 4 + .label last_time = 6 + .label rand_seed = 8 + .label Ticks = $a + .label Ticks_1 = $c +__b1: + lda #<0 + sta.z last_time + sta.z last_time+1 + sta.z rand_seed + sta.z rand_seed+1 + jsr main + rts +main: { + jsr start + jsr round + jsr round + jsr round + jsr round + jsr round + jsr round + jsr round + jsr round + jsr round + jsr round + jsr end + rts +} +end: { + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + jsr start + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + jsr print_word + jsr print_ln + rts +} +// Print a newline +print_ln: { + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + __b1: + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1 + !: + rts +} +// Print a word as HEX +// print_word(word zeropage($c) w) +print_word: { + .label w = $c + lda.z w+1 + tax + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + jsr print_byte + lda.z w + tax + jsr print_byte + rts +} +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + txa + lsr + lsr + lsr + lsr + tay + lda print_hextab,y + jsr print_char + lda #$f + axs #0 + lda print_hextab,x + jsr print_char + rts +} +// Print a single char +// print_char(byte register(A) ch) +print_char: { + ldy #0 + sta (print_char_cursor),y + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + rts +} +start: { + .label LAST_TIME = last_time + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + rts +} +round: { + .label p = 2 + .label S = 4 + lda #Sieve + sta.z p+1 + __b1: + lda.z p+1 + cmp #>Sieve+COUNT + bcc __b2 + bne !+ + lda.z p + cmp #Sieve + adc #0 + sta.z S+1 + __b6: + lda.z S+1 + cmp #>Sieve+COUNT + bcc __b7 + bne !+ + lda.z S + cmp # (word) print_word::w#0 + [47] call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + [48] (byte) print_byte::b#1 ← < (word) print_word::w#0 + [49] call print_byte + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@1 + [50] return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + [51] (byte*) print_char_cursor#35 ← phi( print_word/(byte*) 1024 print_word::@1/(byte*) print_char_cursor#10 ) + [51] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + [52] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 + [53] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) + [54] call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + [55] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f + [56] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) + [57] call print_char + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@1 + [58] return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + [59] (byte*) print_char_cursor#25 ← phi( print_byte/(byte*) print_char_cursor#35 print_byte::@1/(byte*) print_char_cursor#10 ) + [59] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + [60] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 + [61] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + [62] return + to:@return + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + [64] (word) rand_seed#0 ← (word) $194a + to:start::@return +start::@return: scope:[start] from start + [65] return + to:@return + +(void()) round() +round: scope:[round] from main::@1 main::@10 main::@2 main::@3 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9 + [66] phi() + to:round::@1 +round::@1: scope:[round] from round round::@2 + [67] (byte*) round::p#2 ← phi( round/(const byte*) Sieve round::@2/(byte*) round::p#1 ) + [68] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2 + to:round::@3 +round::@3: scope:[round] from round::@1 round::@5 + [69] (byte) round::I#3 ← phi( round::@5/(byte) round::I#2 round::@1/(byte) 2 ) + [70] if((byte) round::I#3<(const byte) SQRT_COUNT) goto round::@4 + to:round::@return +round::@return: scope:[round] from round::@3 + [71] return + to:@return +round::@4: scope:[round] from round::@3 + [72] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5 + to:round::@8 +round::@8: scope:[round] from round::@4 + [73] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1 + [74] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4 + to:round::@6 +round::@6: scope:[round] from round::@7 round::@8 + [75] (byte*) round::S#3 ← phi( round::@7/(byte*) round::S#2 round::@8/(byte*) round::S#1 ) + [76] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7 + to:round::@5 +round::@5: scope:[round] from round::@4 round::@6 + [77] (byte) round::I#2 ← ++ (byte) round::I#3 + to:round::@3 +round::@7: scope:[round] from round::@6 + [78] *((byte*) round::S#3) ← (byte) 1 + [79] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3 + to:round::@6 +round::@2: scope:[round] from round::@1 + [80] *((byte*) round::p#2) ← (byte) 0 + [81] (byte*) round::p#1 ← ++ (byte*) round::p#2 + to:round::@1 diff --git a/src/test/ref/millfork-benchmarks/sieve-kc.log b/src/test/ref/millfork-benchmarks/sieve-kc.log new file mode 100644 index 000000000..d7b8261d5 --- /dev/null +++ b/src/test/ref/millfork-benchmarks/sieve-kc.log @@ -0,0 +1,3014 @@ +Resolved forward reference rand_seed to (word) rand_seed +Setting inferred volatile on symbol affected by address-of (word) last_time +Setting inferred volatile on symbol affected by address-of (word) rand_seed +Fixing pointer addition (word*~) bsearch16u::$7 ← (word*) bsearch16u::items + (byte~) bsearch16u::$6 +Fixing pointer addition (word*~) bsearch16u::$15 ← (word*) bsearch16u::pivot + (number) 1 +Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - (number) 1 +Fixing pointer array-indexing *((word*) utoa::digit_values + (byte) utoa::digit) +Fixing pointer array-indexing *((dword*) ultoa::digit_values + (byte) ultoa::digit) +Warning! Adding boolean cast to non-boolean condition *((byte*) strcpy::src) +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_lines::str) +Warning! Adding boolean cast to non-boolean condition (byte) print_str_lines::ch +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str::str) +Warning! Adding boolean cast to non-boolean condition *((byte*) print_str_at::str) +Warning! Adding boolean cast to non-boolean sub-expression (byte) print_str_lines::ch +Identified constant variable (byte*) HEAP_TOP +Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx +Culled Empty Block (label) @1 +Culled Empty Block (label) @2 +Culled Empty Block (label) @3 +Culled Empty Block (label) @4 +Culled Empty Block (label) @5 +Culled Empty Block (label) @6 +Culled Empty Block (label) @7 +Culled Empty Block (label) @8 +Culled Empty Block (label) @9 +Culled Empty Block (label) @10 +Culled Empty Block (label) @11 +Culled Empty Block (label) @13 +Culled Empty Block (label) @14 +Culled Empty Block (label) @15 +Culled Empty Block (label) @16 +Culled Empty Block (label) @17 +Culled Empty Block (label) @18 +Culled Empty Block (label) @19 +Culled Empty Block (label) @20 +Culled Empty Block (label) @21 +Culled Empty Block (label) @22 +Culled Empty Block (label) @23 +Culled Empty Block (label) @24 +Culled Empty Block (label) @25 +Culled Empty Block (label) @26 +Culled Empty Block (label) @27 +Culled Empty Block (label) @28 +Culled Empty Block (label) @29 +Culled Empty Block (label) @30 +Culled Empty Block (label) @31 +Culled Empty Block (label) @32 +Culled Empty Block (label) @33 +Culled Empty Block (label) @34 +Culled Empty Block (label) @35 +Culled Empty Block (label) @36 +Culled Empty Block (label) @37 +Culled Empty Block (label) @38 +Culled Empty Block (label) @39 +Culled Empty Block (label) @40 +Culled Empty Block (label) @41 +Culled Empty Block (label) @43 +Culled Empty Block (label) @45 +Culled Empty Block (label) round::@4 +Culled Empty Block (label) round::@5 +Culled Empty Block (label) round::@6 +Culled Empty Block (label) round::@17 +Culled Empty Block (label) round::@9 +Culled Empty Block (label) round::@18 +Culled Empty Block (label) round::@14 +Culled Empty Block (label) round::@13 +Culled Empty Block (label) round::@15 +Culled Empty Block (label) round::@16 +Culled Empty Block (label) round::@20 +Culled Empty Block (label) @46 +Culled Empty Block (label) main::@1 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@12 +@12: scope:[] from @begin + (byte*) print_screen#0 ← ((byte*)) (number) $400 + (byte*) print_line_cursor#0 ← (byte*) print_screen#0 + (byte*) print_char_cursor#0 ← (byte*) print_line_cursor#0 + to:@42 + +(void()) print_ln() +print_ln: scope:[print_ln] from end::@2 + (byte*) print_char_cursor#33 ← phi( end::@2/(byte*) print_char_cursor#11 ) + (byte*) print_line_cursor#16 ← phi( end::@2/(byte*) print_line_cursor#17 ) + to:print_ln::@1 +print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 + (byte*) print_char_cursor#17 ← phi( print_ln/(byte*) print_char_cursor#33 print_ln::@1/(byte*) print_char_cursor#17 ) + (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) print_line_cursor#16 print_ln::@1/(byte*) print_line_cursor#1 ) + (byte*~) print_ln::$0 ← (byte*) print_line_cursor#8 + (number) $28 + (byte*) print_line_cursor#1 ← (byte*~) print_ln::$0 + (bool~) print_ln::$1 ← (byte*) print_line_cursor#1 < (byte*) print_char_cursor#17 + if((bool~) print_ln::$1) goto print_ln::@1 + to:print_ln::@2 +print_ln::@2: scope:[print_ln] from print_ln::@1 + (byte*) print_line_cursor#9 ← phi( print_ln::@1/(byte*) print_line_cursor#1 ) + (byte*) print_char_cursor#1 ← (byte*) print_line_cursor#9 + to:print_ln::@return +print_ln::@return: scope:[print_ln] from print_ln::@2 + (byte*) print_char_cursor#18 ← phi( print_ln::@2/(byte*) print_char_cursor#1 ) + (byte*) print_line_cursor#10 ← phi( print_ln::@2/(byte*) print_line_cursor#9 ) + (byte*) print_line_cursor#2 ← (byte*) print_line_cursor#10 + (byte*) print_char_cursor#2 ← (byte*) print_char_cursor#18 + return + to:@return + +(void()) print_word((word) print_word::w) +print_word: scope:[print_word] from end::@1 + (byte*) print_char_cursor#34 ← phi( end::@1/(byte*) print_char_cursor#36 ) + (word) print_word::w#1 ← phi( end::@1/(word) print_word::w#0 ) + (byte~) print_word::$0 ← > (word) print_word::w#1 + (byte) print_byte::b#0 ← (byte~) print_word::$0 + call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + (word) print_word::w#2 ← phi( print_word/(word) print_word::w#1 ) + (byte*) print_char_cursor#19 ← phi( print_word/(byte*) print_char_cursor#8 ) + (byte*) print_char_cursor#3 ← (byte*) print_char_cursor#19 + (byte~) print_word::$2 ← < (word) print_word::w#2 + (byte) print_byte::b#1 ← (byte~) print_word::$2 + call print_byte + to:print_word::@2 +print_word::@2: scope:[print_word] from print_word::@1 + (byte*) print_char_cursor#20 ← phi( print_word::@1/(byte*) print_char_cursor#8 ) + (byte*) print_char_cursor#4 ← (byte*) print_char_cursor#20 + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@2 + (byte*) print_char_cursor#21 ← phi( print_word::@2/(byte*) print_char_cursor#4 ) + (byte*) print_char_cursor#5 ← (byte*) print_char_cursor#21 + return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + (byte*) print_char_cursor#35 ← phi( print_word/(byte*) print_char_cursor#34 print_word::@1/(byte*) print_char_cursor#3 ) + (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4 + (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) + call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + (byte) print_byte::b#3 ← phi( print_byte/(byte) print_byte::b#2 ) + (byte*) print_char_cursor#22 ← phi( print_byte/(byte*) print_char_cursor#10 ) + (byte*) print_char_cursor#6 ← (byte*) print_char_cursor#22 + (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f + (byte) print_char::ch#1 ← *((const byte*) print_hextab + (number~) print_byte::$2) + call print_char + to:print_byte::@2 +print_byte::@2: scope:[print_byte] from print_byte::@1 + (byte*) print_char_cursor#23 ← phi( print_byte::@1/(byte*) print_char_cursor#10 ) + (byte*) print_char_cursor#7 ← (byte*) print_char_cursor#23 + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@2 + (byte*) print_char_cursor#24 ← phi( print_byte::@2/(byte*) print_char_cursor#7 ) + (byte*) print_char_cursor#8 ← (byte*) print_char_cursor#24 + return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + (byte*) print_char_cursor#25 ← phi( print_byte/(byte*) print_char_cursor#35 print_byte::@1/(byte*) print_char_cursor#6 ) + (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 + (byte*) print_char_cursor#9 ← ++ (byte*) print_char_cursor#25 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + (byte*) print_char_cursor#26 ← phi( print_char/(byte*) print_char_cursor#9 ) + (byte*) print_char_cursor#10 ← (byte*) print_char_cursor#26 + return + to:@return +@42: scope:[] from @12 + (byte*) print_line_cursor#24 ← phi( @12/(byte*) print_line_cursor#0 ) + (byte*) print_char_cursor#42 ← phi( @12/(byte*) print_char_cursor#0 ) + (word) last_time#0 ← (word) 0 + (word) Ticks#0 ← (word) 0 + to:@44 + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + (word) rand_seed#0 ← (number) $194a + to:start::@return +start::@return: scope:[start] from start + (word) rand_seed#9 ← phi( start/(word) rand_seed#0 ) + (word) rand_seed#1 ← (word) rand_seed#9 + return + to:@return + +(void()) end() +end: scope:[end] from main::@12 + (byte*) print_line_cursor#23 ← phi( main::@12/(byte*) print_line_cursor#18 ) + (byte*) print_char_cursor#39 ← phi( main::@12/(byte*) print_char_cursor#37 ) + (word) rand_seed#16 ← phi( main::@12/(word) rand_seed#19 ) + (word) last_time#6 ← phi( main::@12/(word) last_time#12 ) + (word) Ticks#1 ← (word) last_time#6 + call start + to:end::@1 +end::@1: scope:[end] from end + (byte*) print_line_cursor#20 ← phi( end/(byte*) print_line_cursor#23 ) + (byte*) print_char_cursor#36 ← phi( end/(byte*) print_char_cursor#39 ) + (word) Ticks#7 ← phi( end/(word) Ticks#1 ) + (word) last_time#7 ← phi( end/(word) last_time#6 ) + (word) rand_seed#10 ← phi( end/(word) rand_seed#1 ) + (word) rand_seed#2 ← (word) rand_seed#10 + (word) last_time#1 ← (word) last_time#7 - (word) Ticks#7 + (word) Ticks#2 ← (word) last_time#1 + (word) print_word::w#0 ← (word) Ticks#2 + call print_word + to:end::@2 +end::@2: scope:[end] from end::@1 + (word) last_time#15 ← phi( end::@1/(word) last_time#1 ) + (word) rand_seed#21 ← phi( end::@1/(word) rand_seed#2 ) + (word) Ticks#15 ← phi( end::@1/(word) Ticks#2 ) + (byte*) print_line_cursor#17 ← phi( end::@1/(byte*) print_line_cursor#20 ) + (byte*) print_char_cursor#27 ← phi( end::@1/(byte*) print_char_cursor#5 ) + (byte*) print_char_cursor#11 ← (byte*) print_char_cursor#27 + call print_ln + to:end::@3 +end::@3: scope:[end] from end::@2 + (word) last_time#13 ← phi( end::@2/(word) last_time#15 ) + (word) rand_seed#17 ← phi( end::@2/(word) rand_seed#21 ) + (word) Ticks#12 ← phi( end::@2/(word) Ticks#15 ) + (byte*) print_char_cursor#28 ← phi( end::@2/(byte*) print_char_cursor#2 ) + (byte*) print_line_cursor#11 ← phi( end::@2/(byte*) print_line_cursor#2 ) + (byte*) print_line_cursor#3 ← (byte*) print_line_cursor#11 + (byte*) print_char_cursor#12 ← (byte*) print_char_cursor#28 + to:end::@return +end::@return: scope:[end] from end::@3 + (byte*) print_line_cursor#12 ← phi( end::@3/(byte*) print_line_cursor#3 ) + (byte*) print_char_cursor#29 ← phi( end::@3/(byte*) print_char_cursor#12 ) + (word) last_time#8 ← phi( end::@3/(word) last_time#13 ) + (word) rand_seed#11 ← phi( end::@3/(word) rand_seed#17 ) + (word) Ticks#8 ← phi( end::@3/(word) Ticks#12 ) + (word) Ticks#3 ← (word) Ticks#8 + (word) rand_seed#3 ← (word) rand_seed#11 + (word) last_time#2 ← (word) last_time#8 + (byte*) print_char_cursor#13 ← (byte*) print_char_cursor#29 + (byte*) print_line_cursor#4 ← (byte*) print_line_cursor#12 + return + to:@return +@44: scope:[] from @42 + (byte*) print_line_cursor#22 ← phi( @42/(byte*) print_line_cursor#24 ) + (byte*) print_char_cursor#41 ← phi( @42/(byte*) print_char_cursor#42 ) + (word) last_time#17 ← phi( @42/(word) last_time#0 ) + (word) Ticks#17 ← phi( @42/(word) Ticks#0 ) + (word) rand_seed#4 ← (word) 0 + to:@47 + +(void()) round() +round: scope:[round] from main::@10 main::@11 main::@2 main::@3 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9 + (byte*) round::S#0 ← (byte*) 0 + (byte) round::I#0 ← (byte) 0 + (byte*) round::p#0 ← (const byte*) Sieve + to:round::@1 +round::@1: scope:[round] from round round::@2 + (byte*) round::p#2 ← phi( round/(byte*) round::p#0 round::@2/(byte*) round::p#1 ) + (bool~) round::$0 ← (byte*) round::p#2 < (const byte*) Sieve+(const word) COUNT + if((bool~) round::$0) goto round::@2 + to:round::@3 +round::@2: scope:[round] from round::@1 + (byte*) round::p#3 ← phi( round::@1/(byte*) round::p#2 ) + *((byte*) round::p#3) ← (number) 0 + (byte*) round::p#1 ← ++ (byte*) round::p#3 + to:round::@1 +round::@3: scope:[round] from round::@1 + (byte) round::I#1 ← (number) 2 + to:round::@7 +round::@7: scope:[round] from round::@10 round::@3 + (byte) round::I#3 ← phi( round::@10/(byte) round::I#2 round::@3/(byte) round::I#1 ) + (bool~) round::$1 ← (byte) round::I#3 < (const byte) SQRT_COUNT + if((bool~) round::$1) goto round::@8 + to:round::@return +round::@8: scope:[round] from round::@7 + (byte) round::I#4 ← phi( round::@7/(byte) round::I#3 ) + (bool~) round::$2 ← *((const byte*) Sieve + (byte) round::I#4) == (number) 0 + (bool~) round::$3 ← ! (bool~) round::$2 + if((bool~) round::$3) goto round::@10 + to:round::@19 +round::@10: scope:[round] from round::@11 round::@8 + (byte) round::I#5 ← phi( round::@11/(byte) round::I#8 round::@8/(byte) round::I#4 ) + (byte) round::I#2 ← ++ (byte) round::I#5 + to:round::@7 +round::@19: scope:[round] from round::@8 + (byte) round::I#6 ← phi( round::@8/(byte) round::I#4 ) + (byte~) round::$4 ← (byte) round::I#6 << (number) 1 + (byte*~) round::$5 ← (const byte*) Sieve + (byte~) round::$4 + (byte*) round::S#1 ← (byte*~) round::$5 + to:round::@11 +round::@11: scope:[round] from round::@12 round::@19 + (byte) round::I#8 ← phi( round::@12/(byte) round::I#7 round::@19/(byte) round::I#6 ) + (byte*) round::S#3 ← phi( round::@12/(byte*) round::S#2 round::@19/(byte*) round::S#1 ) + (bool~) round::$6 ← (byte*) round::S#3 < (const byte*) Sieve+(const word) COUNT + if((bool~) round::$6) goto round::@12 + to:round::@10 +round::@12: scope:[round] from round::@11 + (byte) round::I#7 ← phi( round::@11/(byte) round::I#8 ) + (byte*) round::S#4 ← phi( round::@11/(byte*) round::S#3 ) + *((byte*) round::S#4) ← (number) 1 + (byte*) round::S#2 ← (byte*) round::S#4 + (byte) round::I#7 + to:round::@11 +round::@return: scope:[round] from round::@7 + return + to:@return + +(signed word()) main() +main: scope:[main] from @47 + (byte*) print_line_cursor#34 ← phi( @47/(byte*) print_line_cursor#19 ) + (byte*) print_char_cursor#52 ← phi( @47/(byte*) print_char_cursor#38 ) + (word) Ticks#27 ← phi( @47/(word) Ticks#14 ) + (word) last_time#27 ← phi( @47/(word) last_time#14 ) + (word) rand_seed#18 ← phi( @47/(word) rand_seed#20 ) + call start + to:main::@2 +main::@2: scope:[main] from main + (byte*) print_line_cursor#33 ← phi( main/(byte*) print_line_cursor#34 ) + (byte*) print_char_cursor#51 ← phi( main/(byte*) print_char_cursor#52 ) + (word) Ticks#26 ← phi( main/(word) Ticks#27 ) + (word) last_time#26 ← phi( main/(word) last_time#27 ) + (word) rand_seed#12 ← phi( main/(word) rand_seed#1 ) + (word) rand_seed#5 ← (word) rand_seed#12 + call round + to:main::@3 +main::@3: scope:[main] from main::@2 + (byte*) print_line_cursor#32 ← phi( main::@2/(byte*) print_line_cursor#33 ) + (byte*) print_char_cursor#50 ← phi( main::@2/(byte*) print_char_cursor#51 ) + (word) rand_seed#30 ← phi( main::@2/(word) rand_seed#5 ) + (word) Ticks#25 ← phi( main::@2/(word) Ticks#26 ) + (word) last_time#25 ← phi( main::@2/(word) last_time#26 ) + call round + to:main::@4 +main::@4: scope:[main] from main::@3 + (byte*) print_line_cursor#31 ← phi( main::@3/(byte*) print_line_cursor#32 ) + (byte*) print_char_cursor#49 ← phi( main::@3/(byte*) print_char_cursor#50 ) + (word) rand_seed#29 ← phi( main::@3/(word) rand_seed#30 ) + (word) Ticks#24 ← phi( main::@3/(word) Ticks#25 ) + (word) last_time#24 ← phi( main::@3/(word) last_time#25 ) + call round + to:main::@5 +main::@5: scope:[main] from main::@4 + (byte*) print_line_cursor#30 ← phi( main::@4/(byte*) print_line_cursor#31 ) + (byte*) print_char_cursor#48 ← phi( main::@4/(byte*) print_char_cursor#49 ) + (word) rand_seed#28 ← phi( main::@4/(word) rand_seed#29 ) + (word) Ticks#23 ← phi( main::@4/(word) Ticks#24 ) + (word) last_time#23 ← phi( main::@4/(word) last_time#24 ) + call round + to:main::@6 +main::@6: scope:[main] from main::@5 + (byte*) print_line_cursor#29 ← phi( main::@5/(byte*) print_line_cursor#30 ) + (byte*) print_char_cursor#47 ← phi( main::@5/(byte*) print_char_cursor#48 ) + (word) rand_seed#27 ← phi( main::@5/(word) rand_seed#28 ) + (word) Ticks#22 ← phi( main::@5/(word) Ticks#23 ) + (word) last_time#22 ← phi( main::@5/(word) last_time#23 ) + call round + to:main::@7 +main::@7: scope:[main] from main::@6 + (byte*) print_line_cursor#28 ← phi( main::@6/(byte*) print_line_cursor#29 ) + (byte*) print_char_cursor#46 ← phi( main::@6/(byte*) print_char_cursor#47 ) + (word) rand_seed#26 ← phi( main::@6/(word) rand_seed#27 ) + (word) Ticks#21 ← phi( main::@6/(word) Ticks#22 ) + (word) last_time#21 ← phi( main::@6/(word) last_time#22 ) + call round + to:main::@8 +main::@8: scope:[main] from main::@7 + (byte*) print_line_cursor#27 ← phi( main::@7/(byte*) print_line_cursor#28 ) + (byte*) print_char_cursor#45 ← phi( main::@7/(byte*) print_char_cursor#46 ) + (word) rand_seed#25 ← phi( main::@7/(word) rand_seed#26 ) + (word) Ticks#20 ← phi( main::@7/(word) Ticks#21 ) + (word) last_time#20 ← phi( main::@7/(word) last_time#21 ) + call round + to:main::@9 +main::@9: scope:[main] from main::@8 + (byte*) print_line_cursor#26 ← phi( main::@8/(byte*) print_line_cursor#27 ) + (byte*) print_char_cursor#44 ← phi( main::@8/(byte*) print_char_cursor#45 ) + (word) rand_seed#24 ← phi( main::@8/(word) rand_seed#25 ) + (word) Ticks#19 ← phi( main::@8/(word) Ticks#20 ) + (word) last_time#19 ← phi( main::@8/(word) last_time#20 ) + call round + to:main::@10 +main::@10: scope:[main] from main::@9 + (byte*) print_line_cursor#25 ← phi( main::@9/(byte*) print_line_cursor#26 ) + (byte*) print_char_cursor#43 ← phi( main::@9/(byte*) print_char_cursor#44 ) + (word) rand_seed#23 ← phi( main::@9/(word) rand_seed#24 ) + (word) Ticks#18 ← phi( main::@9/(word) Ticks#19 ) + (word) last_time#18 ← phi( main::@9/(word) last_time#19 ) + call round + to:main::@11 +main::@11: scope:[main] from main::@10 + (byte*) print_line_cursor#21 ← phi( main::@10/(byte*) print_line_cursor#25 ) + (byte*) print_char_cursor#40 ← phi( main::@10/(byte*) print_char_cursor#43 ) + (word) rand_seed#22 ← phi( main::@10/(word) rand_seed#23 ) + (word) Ticks#16 ← phi( main::@10/(word) Ticks#18 ) + (word) last_time#16 ← phi( main::@10/(word) last_time#18 ) + call round + to:main::@12 +main::@12: scope:[main] from main::@11 + (byte*) print_line_cursor#18 ← phi( main::@11/(byte*) print_line_cursor#21 ) + (byte*) print_char_cursor#37 ← phi( main::@11/(byte*) print_char_cursor#40 ) + (word) rand_seed#19 ← phi( main::@11/(word) rand_seed#22 ) + (word) Ticks#13 ← phi( main::@11/(word) Ticks#16 ) + (word) last_time#12 ← phi( main::@11/(word) last_time#16 ) + call end + to:main::@13 +main::@13: scope:[main] from main::@12 + (byte*) print_line_cursor#13 ← phi( main::@12/(byte*) print_line_cursor#4 ) + (byte*) print_char_cursor#30 ← phi( main::@12/(byte*) print_char_cursor#13 ) + (word) last_time#9 ← phi( main::@12/(word) last_time#2 ) + (word) rand_seed#13 ← phi( main::@12/(word) rand_seed#3 ) + (word) Ticks#9 ← phi( main::@12/(word) Ticks#3 ) + (word) Ticks#4 ← (word) Ticks#9 + (word) rand_seed#6 ← (word) rand_seed#13 + (word) last_time#3 ← (word) last_time#9 + (byte*) print_char_cursor#14 ← (byte*) print_char_cursor#30 + (byte*) print_line_cursor#5 ← (byte*) print_line_cursor#13 + (signed word) main::return#0 ← (number) 0 + to:main::@return +main::@return: scope:[main] from main::@13 + (byte*) print_line_cursor#14 ← phi( main::@13/(byte*) print_line_cursor#5 ) + (byte*) print_char_cursor#31 ← phi( main::@13/(byte*) print_char_cursor#14 ) + (word) last_time#10 ← phi( main::@13/(word) last_time#3 ) + (word) Ticks#10 ← phi( main::@13/(word) Ticks#4 ) + (word) rand_seed#14 ← phi( main::@13/(word) rand_seed#6 ) + (signed word) main::return#3 ← phi( main::@13/(signed word) main::return#0 ) + (signed word) main::return#1 ← (signed word) main::return#3 + (word) rand_seed#7 ← (word) rand_seed#14 + (word) Ticks#5 ← (word) Ticks#10 + (word) last_time#4 ← (word) last_time#10 + (byte*) print_char_cursor#15 ← (byte*) print_char_cursor#31 + (byte*) print_line_cursor#6 ← (byte*) print_line_cursor#14 + return + to:@return +@47: scope:[] from @44 + (byte*) print_line_cursor#19 ← phi( @44/(byte*) print_line_cursor#22 ) + (byte*) print_char_cursor#38 ← phi( @44/(byte*) print_char_cursor#41 ) + (word) last_time#14 ← phi( @44/(word) last_time#17 ) + (word) Ticks#14 ← phi( @44/(word) Ticks#17 ) + (word) rand_seed#20 ← phi( @44/(word) rand_seed#4 ) + call main + (signed word) main::return#2 ← (signed word) main::return#1 + to:@48 +@48: scope:[] from @47 + (byte*) print_line_cursor#15 ← phi( @47/(byte*) print_line_cursor#6 ) + (byte*) print_char_cursor#32 ← phi( @47/(byte*) print_char_cursor#15 ) + (word) last_time#11 ← phi( @47/(word) last_time#4 ) + (word) Ticks#11 ← phi( @47/(word) Ticks#5 ) + (word) rand_seed#15 ← phi( @47/(word) rand_seed#7 ) + (word) rand_seed#8 ← (word) rand_seed#15 + (word) Ticks#6 ← (word) Ticks#11 + (word) last_time#5 ← (word) last_time#11 + (byte*) print_char_cursor#16 ← (byte*) print_char_cursor#32 + (byte*) print_line_cursor#7 ← (byte*) print_line_cursor#15 + to:@end +@end: scope:[] from @48 + +SYMBOL TABLE SSA +(label) @12 +(label) @42 +(label) @44 +(label) @47 +(label) @48 +(label) @begin +(label) @end +(const word) COUNT = (number) $4000 +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const byte) SQRT_COUNT = (number) $80 +(const byte*) Sieve = { fill( COUNT, 0) } +(word) Ticks +(word) Ticks#0 +(word) Ticks#1 +(word) Ticks#10 +(word) Ticks#11 +(word) Ticks#12 +(word) Ticks#13 +(word) Ticks#14 +(word) Ticks#15 +(word) Ticks#16 +(word) Ticks#17 +(word) Ticks#18 +(word) Ticks#19 +(word) Ticks#2 +(word) Ticks#20 +(word) Ticks#21 +(word) Ticks#22 +(word) Ticks#23 +(word) Ticks#24 +(word) Ticks#25 +(word) Ticks#26 +(word) Ticks#27 +(word) Ticks#3 +(word) Ticks#4 +(word) Ticks#5 +(word) Ticks#6 +(word) Ticks#7 +(word) Ticks#8 +(word) Ticks#9 +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@3 +(label) end::@return +(word) last_time +(word) last_time#0 +(word) last_time#1 +(word) last_time#10 +(word) last_time#11 +(word) last_time#12 +(word) last_time#13 +(word) last_time#14 +(word) last_time#15 +(word) last_time#16 +(word) last_time#17 +(word) last_time#18 +(word) last_time#19 +(word) last_time#2 +(word) last_time#20 +(word) last_time#21 +(word) last_time#22 +(word) last_time#23 +(word) last_time#24 +(word) last_time#25 +(word) last_time#26 +(word) last_time#27 +(word) last_time#3 +(word) last_time#4 +(word) last_time#5 +(word) last_time#6 +(word) last_time#7 +(word) last_time#8 +(word) last_time#9 +(signed word()) main() +(label) main::@10 +(label) main::@11 +(label) main::@12 +(label) main::@13 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 +(label) main::@return +(signed word) main::return +(signed word) main::return#0 +(signed word) main::return#1 +(signed word) main::return#2 +(signed word) main::return#3 +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 +(number~) print_byte::$2 +(label) print_byte::@1 +(label) print_byte::@2 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 +(byte) print_byte::b#1 +(byte) print_byte::b#2 +(byte) print_byte::b#3 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 +(byte) print_char::ch#1 +(byte) print_char::ch#2 +(byte*) print_char_cursor +(byte*) print_char_cursor#0 +(byte*) print_char_cursor#1 +(byte*) print_char_cursor#10 +(byte*) print_char_cursor#11 +(byte*) print_char_cursor#12 +(byte*) print_char_cursor#13 +(byte*) print_char_cursor#14 +(byte*) print_char_cursor#15 +(byte*) print_char_cursor#16 +(byte*) print_char_cursor#17 +(byte*) print_char_cursor#18 +(byte*) print_char_cursor#19 +(byte*) print_char_cursor#2 +(byte*) print_char_cursor#20 +(byte*) print_char_cursor#21 +(byte*) print_char_cursor#22 +(byte*) print_char_cursor#23 +(byte*) print_char_cursor#24 +(byte*) print_char_cursor#25 +(byte*) print_char_cursor#26 +(byte*) print_char_cursor#27 +(byte*) print_char_cursor#28 +(byte*) print_char_cursor#29 +(byte*) print_char_cursor#3 +(byte*) print_char_cursor#30 +(byte*) print_char_cursor#31 +(byte*) print_char_cursor#32 +(byte*) print_char_cursor#33 +(byte*) print_char_cursor#34 +(byte*) print_char_cursor#35 +(byte*) print_char_cursor#36 +(byte*) print_char_cursor#37 +(byte*) print_char_cursor#38 +(byte*) print_char_cursor#39 +(byte*) print_char_cursor#4 +(byte*) print_char_cursor#40 +(byte*) print_char_cursor#41 +(byte*) print_char_cursor#42 +(byte*) print_char_cursor#43 +(byte*) print_char_cursor#44 +(byte*) print_char_cursor#45 +(byte*) print_char_cursor#46 +(byte*) print_char_cursor#47 +(byte*) print_char_cursor#48 +(byte*) print_char_cursor#49 +(byte*) print_char_cursor#5 +(byte*) print_char_cursor#50 +(byte*) print_char_cursor#51 +(byte*) print_char_cursor#52 +(byte*) print_char_cursor#6 +(byte*) print_char_cursor#7 +(byte*) print_char_cursor#8 +(byte*) print_char_cursor#9 +(const byte*) print_hextab = (string) "0123456789abcdef"z +(byte*) print_line_cursor +(byte*) print_line_cursor#0 +(byte*) print_line_cursor#1 +(byte*) print_line_cursor#10 +(byte*) print_line_cursor#11 +(byte*) print_line_cursor#12 +(byte*) print_line_cursor#13 +(byte*) print_line_cursor#14 +(byte*) print_line_cursor#15 +(byte*) print_line_cursor#16 +(byte*) print_line_cursor#17 +(byte*) print_line_cursor#18 +(byte*) print_line_cursor#19 +(byte*) print_line_cursor#2 +(byte*) print_line_cursor#20 +(byte*) print_line_cursor#21 +(byte*) print_line_cursor#22 +(byte*) print_line_cursor#23 +(byte*) print_line_cursor#24 +(byte*) print_line_cursor#25 +(byte*) print_line_cursor#26 +(byte*) print_line_cursor#27 +(byte*) print_line_cursor#28 +(byte*) print_line_cursor#29 +(byte*) print_line_cursor#3 +(byte*) print_line_cursor#30 +(byte*) print_line_cursor#31 +(byte*) print_line_cursor#32 +(byte*) print_line_cursor#33 +(byte*) print_line_cursor#34 +(byte*) print_line_cursor#4 +(byte*) print_line_cursor#5 +(byte*) print_line_cursor#6 +(byte*) print_line_cursor#7 +(byte*) print_line_cursor#8 +(byte*) print_line_cursor#9 +(void()) print_ln() +(byte*~) print_ln::$0 +(bool~) print_ln::$1 +(label) print_ln::@1 +(label) print_ln::@2 +(label) print_ln::@return +(byte*) print_screen +(byte*) print_screen#0 +(void()) print_word((word) print_word::w) +(byte~) print_word::$0 +(byte~) print_word::$2 +(label) print_word::@1 +(label) print_word::@2 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 +(word) print_word::w#1 +(word) print_word::w#2 +(word) rand_seed +(word) rand_seed#0 +(word) rand_seed#1 +(word) rand_seed#10 +(word) rand_seed#11 +(word) rand_seed#12 +(word) rand_seed#13 +(word) rand_seed#14 +(word) rand_seed#15 +(word) rand_seed#16 +(word) rand_seed#17 +(word) rand_seed#18 +(word) rand_seed#19 +(word) rand_seed#2 +(word) rand_seed#20 +(word) rand_seed#21 +(word) rand_seed#22 +(word) rand_seed#23 +(word) rand_seed#24 +(word) rand_seed#25 +(word) rand_seed#26 +(word) rand_seed#27 +(word) rand_seed#28 +(word) rand_seed#29 +(word) rand_seed#3 +(word) rand_seed#30 +(word) rand_seed#4 +(word) rand_seed#5 +(word) rand_seed#6 +(word) rand_seed#7 +(word) rand_seed#8 +(word) rand_seed#9 +(void()) round() +(bool~) round::$0 +(bool~) round::$1 +(bool~) round::$2 +(bool~) round::$3 +(byte~) round::$4 +(byte*~) round::$5 +(bool~) round::$6 +(label) round::@1 +(label) round::@10 +(label) round::@11 +(label) round::@12 +(label) round::@19 +(label) round::@2 +(label) round::@3 +(label) round::@7 +(label) round::@8 +(label) round::@return +(byte) round::I +(byte) round::I#0 +(byte) round::I#1 +(byte) round::I#2 +(byte) round::I#3 +(byte) round::I#4 +(byte) round::I#5 +(byte) round::I#6 +(byte) round::I#7 +(byte) round::I#8 +(byte*) round::S +(byte*) round::S#0 +(byte*) round::S#1 +(byte*) round::S#2 +(byte*) round::S#3 +(byte*) round::S#4 +(byte*) round::p +(byte*) round::p#0 +(byte*) round::p#1 +(byte*) round::p#2 +(byte*) round::p#3 +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time + +Adding number conversion cast (unumber) $28 in (byte*~) print_ln::$0 ← (byte*) print_line_cursor#8 + (number) $28 +Adding number conversion cast (unumber) 4 in (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (number) 4 +Adding number conversion cast (unumber) $f in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (number) $f +Adding number conversion cast (unumber) print_byte::$2 in (number~) print_byte::$2 ← (byte) print_byte::b#3 & (unumber)(number) $f +Adding number conversion cast (unumber) $194a in (word) rand_seed#0 ← (number) $194a +Adding number conversion cast (unumber) 0 in *((byte*) round::p#3) ← (number) 0 +Adding number conversion cast (unumber) 2 in (byte) round::I#1 ← (number) 2 +Adding number conversion cast (unumber) 0 in (bool~) round::$2 ← *((const byte*) Sieve + (byte) round::I#4) == (number) 0 +Adding number conversion cast (unumber) 1 in (byte~) round::$4 ← (byte) round::I#6 << (number) 1 +Adding number conversion cast (unumber) 1 in *((byte*) round::S#4) ← (number) 1 +Adding number conversion cast (snumber) 0 in (signed word) main::return#0 ← (number) 0 +Successful SSA optimization PassNAddNumberTypeConversions +Inlining cast (byte*) print_screen#0 ← (byte*)(number) $400 +Inlining cast (word) rand_seed#0 ← (unumber)(number) $194a +Inlining cast *((byte*) round::p#3) ← (unumber)(number) 0 +Inlining cast (byte) round::I#1 ← (unumber)(number) 2 +Inlining cast *((byte*) round::S#4) ← (unumber)(number) 1 +Inlining cast (signed word) main::return#0 ← (snumber)(number) 0 +Successful SSA optimization Pass2InlineCast +Simplifying constant pointer cast (byte*) 1024 +Simplifying constant integer cast $28 +Simplifying constant integer cast 4 +Simplifying constant integer cast $f +Simplifying constant integer cast $194a +Simplifying constant integer cast 0 +Simplifying constant integer cast 2 +Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 0 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) $28 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) $f +Finalized unsigned number type (word) $194a +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 2 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 1 +Finalized unsigned number type (byte) 1 +Finalized signed number type (signed byte) 0 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Inferred type updated to byte in (unumber~) print_byte::$2 ← (byte) print_byte::b#3 & (byte) $f +Inversing boolean not [96] (bool~) round::$3 ← *((const byte*) Sieve + (byte) round::I#4) != (byte) 0 from [95] (bool~) round::$2 ← *((const byte*) Sieve + (byte) round::I#4) == (byte) 0 +Successful SSA optimization Pass2UnaryNotSimplification +Alias candidate removed (volatile)(word) last_time#6 = (word) Ticks#1 (word) last_time#7 (word) Ticks#7 +Alias candidate removed (volatile)(word) Ticks#12 = (word) Ticks#2 (word) last_time#1 (word) Ticks#15 (word) last_time#15 (word) last_time#13 (word) Ticks#8 (word) last_time#8 (word) Ticks#3 (word) last_time#2 +Alias (byte*) print_char_cursor#0 = (byte*) print_line_cursor#0 (byte*) print_screen#0 (byte*) print_char_cursor#42 (byte*) print_line_cursor#24 (byte*) print_char_cursor#41 (byte*) print_line_cursor#22 (byte*) print_char_cursor#38 (byte*) print_line_cursor#19 +Alias (byte*) print_line_cursor#1 = (byte*~) print_ln::$0 (byte*) print_line_cursor#9 (byte*) print_char_cursor#1 (byte*) print_line_cursor#10 (byte*) print_char_cursor#18 (byte*) print_line_cursor#2 (byte*) print_char_cursor#2 +Alias (byte) print_byte::b#0 = (byte~) print_word::$0 +Alias (word) print_word::w#1 = (word) print_word::w#2 +Alias (byte*) print_char_cursor#19 = (byte*) print_char_cursor#3 +Alias (byte) print_byte::b#1 = (byte~) print_word::$2 +Alias (byte*) print_char_cursor#20 = (byte*) print_char_cursor#4 (byte*) print_char_cursor#21 (byte*) print_char_cursor#5 +Alias (byte) print_byte::b#2 = (byte) print_byte::b#3 +Alias (byte*) print_char_cursor#22 = (byte*) print_char_cursor#6 +Alias (byte*) print_char_cursor#23 = (byte*) print_char_cursor#7 (byte*) print_char_cursor#24 (byte*) print_char_cursor#8 +Alias (byte*) print_char_cursor#10 = (byte*) print_char_cursor#26 (byte*) print_char_cursor#9 +Alias (word) rand_seed#0 = (word) rand_seed#9 (word) rand_seed#1 +Alias (byte*) print_char_cursor#36 = (byte*) print_char_cursor#39 +Alias (byte*) print_line_cursor#17 = (byte*) print_line_cursor#20 (byte*) print_line_cursor#23 +Alias (word) rand_seed#10 = (word) rand_seed#2 (word) rand_seed#21 (word) rand_seed#17 (word) rand_seed#11 (word) rand_seed#3 +Alias (byte*) print_char_cursor#11 = (byte*) print_char_cursor#27 +Alias (byte*) print_line_cursor#11 = (byte*) print_line_cursor#3 (byte*) print_line_cursor#12 (byte*) print_line_cursor#4 +Alias (byte*) print_char_cursor#12 = (byte*) print_char_cursor#28 (byte*) print_char_cursor#29 (byte*) print_char_cursor#13 +Alias (word) Ticks#0 = (word) Ticks#17 (word) Ticks#14 +Alias (word) last_time#0 = (word) last_time#17 (word) last_time#14 +Alias (byte*) round::p#2 = (byte*) round::p#3 +Alias (byte) round::I#3 = (byte) round::I#4 (byte) round::I#6 +Alias (byte*) round::S#1 = (byte*~) round::$5 +Alias (byte*) round::S#3 = (byte*) round::S#4 +Alias (byte) round::I#7 = (byte) round::I#8 +Alias (word) last_time#12 = (word) last_time#26 (word) last_time#27 (word) last_time#25 (word) last_time#24 (word) last_time#23 (word) last_time#22 (word) last_time#21 (word) last_time#20 (word) last_time#19 (word) last_time#18 (word) last_time#16 +Alias (word) Ticks#13 = (word) Ticks#26 (word) Ticks#27 (word) Ticks#25 (word) Ticks#24 (word) Ticks#23 (word) Ticks#22 (word) Ticks#21 (word) Ticks#20 (word) Ticks#19 (word) Ticks#18 (word) Ticks#16 +Alias (byte*) print_char_cursor#37 = (byte*) print_char_cursor#51 (byte*) print_char_cursor#52 (byte*) print_char_cursor#50 (byte*) print_char_cursor#49 (byte*) print_char_cursor#48 (byte*) print_char_cursor#47 (byte*) print_char_cursor#46 (byte*) print_char_cursor#45 (byte*) print_char_cursor#44 (byte*) print_char_cursor#43 (byte*) print_char_cursor#40 +Alias (byte*) print_line_cursor#18 = (byte*) print_line_cursor#33 (byte*) print_line_cursor#34 (byte*) print_line_cursor#32 (byte*) print_line_cursor#31 (byte*) print_line_cursor#30 (byte*) print_line_cursor#29 (byte*) print_line_cursor#28 (byte*) print_line_cursor#27 (byte*) print_line_cursor#26 (byte*) print_line_cursor#25 (byte*) print_line_cursor#21 +Alias (word) rand_seed#12 = (word) rand_seed#5 (word) rand_seed#30 (word) rand_seed#29 (word) rand_seed#28 (word) rand_seed#27 (word) rand_seed#26 (word) rand_seed#25 (word) rand_seed#24 (word) rand_seed#23 (word) rand_seed#22 (word) rand_seed#19 +Alias (word) Ticks#10 = (word) Ticks#4 (word) Ticks#9 (word) Ticks#5 +Alias (word) rand_seed#13 = (word) rand_seed#6 (word) rand_seed#14 (word) rand_seed#7 +Alias (word) last_time#10 = (word) last_time#3 (word) last_time#9 (word) last_time#4 +Alias (byte*) print_char_cursor#14 = (byte*) print_char_cursor#30 (byte*) print_char_cursor#31 (byte*) print_char_cursor#15 +Alias (byte*) print_line_cursor#13 = (byte*) print_line_cursor#5 (byte*) print_line_cursor#14 (byte*) print_line_cursor#6 +Alias (signed word) main::return#0 = (signed word) main::return#3 (signed word) main::return#1 +Alias (word) rand_seed#20 = (word) rand_seed#4 +Alias (word) rand_seed#15 = (word) rand_seed#8 +Alias (word) Ticks#11 = (word) Ticks#6 +Alias (word) last_time#11 = (word) last_time#5 +Alias (byte*) print_char_cursor#16 = (byte*) print_char_cursor#32 +Alias (byte*) print_line_cursor#15 = (byte*) print_line_cursor#7 +Successful SSA optimization Pass2AliasElimination +Alias candidate removed (volatile)(word) last_time#6 = (word) Ticks#1 (word) last_time#7 (word) Ticks#7 +Alias candidate removed (volatile)(word) Ticks#12 = (word) Ticks#2 (word) last_time#1 (word) Ticks#15 (word) last_time#15 (word) last_time#13 (word) Ticks#8 (word) last_time#8 (word) Ticks#3 (word) last_time#2 +Identical Phi Values (byte*) print_line_cursor#16 (byte*) print_line_cursor#17 +Identical Phi Values (byte*) print_char_cursor#33 (byte*) print_char_cursor#11 +Identical Phi Values (byte*) print_char_cursor#17 (byte*) print_char_cursor#33 +Identical Phi Values (word) print_word::w#1 (word) print_word::w#0 +Identical Phi Values (byte*) print_char_cursor#34 (byte*) print_char_cursor#36 +Identical Phi Values (byte*) print_char_cursor#19 (byte*) print_char_cursor#23 +Identical Phi Values (byte*) print_char_cursor#20 (byte*) print_char_cursor#23 +Identical Phi Values (byte*) print_char_cursor#22 (byte*) print_char_cursor#10 +Identical Phi Values (byte*) print_char_cursor#23 (byte*) print_char_cursor#10 +Identical Phi Values (word) last_time#6 (word) last_time#12 +Identical Phi Values (word) rand_seed#16 (word) rand_seed#12 +Identical Phi Values (byte*) print_char_cursor#36 (byte*) print_char_cursor#37 +Identical Phi Values (byte*) print_line_cursor#17 (byte*) print_line_cursor#18 +Identical Phi Values (word) rand_seed#10 (word) rand_seed#0 +Identical Phi Values (word) last_time#7 (word) last_time#6 +Identical Phi Values (word) Ticks#7 (word) Ticks#1 +Identical Phi Values (byte*) print_char_cursor#11 (byte*) print_char_cursor#20 +Identical Phi Values (word) Ticks#15 (word) Ticks#2 +Identical Phi Values (word) last_time#15 (word) last_time#1 +Identical Phi Values (byte*) print_line_cursor#11 (byte*) print_line_cursor#1 +Identical Phi Values (byte*) print_char_cursor#12 (byte*) print_line_cursor#1 +Identical Phi Values (word) Ticks#12 (word) Ticks#15 +Identical Phi Values (word) last_time#13 (word) last_time#15 +Identical Phi Values (word) Ticks#8 (word) Ticks#12 +Identical Phi Values (word) last_time#8 (word) last_time#13 +Identical Phi Values (byte) round::I#7 (byte) round::I#3 +Identical Phi Values (word) rand_seed#18 (word) rand_seed#20 +Identical Phi Values (word) last_time#12 (word) last_time#0 +Identical Phi Values (word) Ticks#13 (word) Ticks#0 +Identical Phi Values (byte*) print_char_cursor#37 (byte*) print_char_cursor#0 +Identical Phi Values (byte*) print_line_cursor#18 (byte*) print_char_cursor#0 +Identical Phi Values (word) rand_seed#12 (word) rand_seed#0 +Identical Phi Values (word) Ticks#10 (word) Ticks#3 +Identical Phi Values (word) rand_seed#13 (word) rand_seed#10 +Identical Phi Values (word) last_time#10 (word) last_time#2 +Identical Phi Values (byte*) print_char_cursor#14 (byte*) print_char_cursor#12 +Identical Phi Values (byte*) print_line_cursor#13 (byte*) print_line_cursor#11 +Identical Phi Values (word) rand_seed#15 (word) rand_seed#13 +Identical Phi Values (word) Ticks#11 (word) Ticks#10 +Identical Phi Values (word) last_time#11 (word) last_time#10 +Identical Phi Values (byte*) print_char_cursor#16 (byte*) print_char_cursor#14 +Identical Phi Values (byte*) print_line_cursor#15 (byte*) print_line_cursor#13 +Successful SSA optimization Pass2IdenticalPhiElimination +Identical Phi Values (byte) round::I#5 (byte) round::I#3 +Successful SSA optimization Pass2IdenticalPhiElimination +Simple Condition (bool~) print_ln::$1 [8] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 +Simple Condition (bool~) round::$0 [86] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2 +Simple Condition (bool~) round::$1 [93] if((byte) round::I#3<(const byte) SQRT_COUNT) goto round::@8 +Simple Condition (bool~) round::$3 [97] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@10 +Simple Condition (bool~) round::$6 [106] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@12 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const byte*) print_char_cursor#0 = (byte*) 1024 +Constant (const word) Ticks#0 = 0 +Constant (const byte*) round::S#0 = (byte*) 0 +Constant (const byte) round::I#0 = 0 +Constant (const byte*) round::p#0 = Sieve +Constant (const byte) round::I#1 = 2 +Constant (const signed word) main::return#0 = 0 +Successful SSA optimization Pass2ConstantIdentification +Constant (const signed word) main::return#2 = main::return#0 +Successful SSA optimization Pass2ConstantIdentification +Eliminating unused variable (word) Ticks#3 and assignment [32] (word) Ticks#3 ← (word) Ticks#2 +Eliminating unused constant (const byte*) round::S#0 +Eliminating unused constant (const byte) round::I#0 +Eliminating unused constant (const signed word) main::return#2 +Eliminating unused constant (const word) Ticks#0 +Successful SSA optimization PassNEliminateUnusedVars +Eliminating unused constant (const signed word) main::return#0 +Successful SSA optimization PassNEliminateUnusedVars +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Inlining constant with var siblings (const byte*) round::p#0 +Inlining constant with var siblings (const byte) round::I#1 +Inlining constant with var siblings (const byte*) print_char_cursor#0 +Constant inlined round::I#1 = (byte) 2 +Constant inlined print_char_cursor#0 = (byte*) 1024 +Constant inlined round::p#0 = (const byte*) Sieve +Successful SSA optimization Pass2ConstantInlining +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Alias candidate removed (volatile)(word) last_time#1 = (word) Ticks#2 (word) last_time#2 +Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @12 +Adding NOP phi() at start of @47 +Adding NOP phi() at start of @48 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@4 +Adding NOP phi() at start of main::@5 +Adding NOP phi() at start of main::@6 +Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of main::@8 +Adding NOP phi() at start of main::@9 +Adding NOP phi() at start of main::@10 +Adding NOP phi() at start of main::@11 +Adding NOP phi() at start of main::@12 +Adding NOP phi() at start of main::@13 +Adding NOP phi() at start of end::@2 +Adding NOP phi() at start of end::@3 +Adding NOP phi() at start of print_ln +Adding NOP phi() at start of print_ln::@2 +Adding NOP phi() at start of print_word::@2 +Adding NOP phi() at start of print_byte::@2 +Adding NOP phi() at start of round +Adding NOP phi() at start of round::@3 +CALL GRAPH +Calls in [] to main:5 +Calls in [main] to start:9 round:11 round:13 round:15 round:17 round:19 round:21 round:23 round:25 round:27 round:29 end:31 +Calls in [end] to start:35 print_word:39 print_ln:41 +Calls in [print_word] to print_byte:54 print_byte:58 +Calls in [print_byte] to print_char:66 print_char:71 + +Created 8 initial phi equivalence classes +Coalesced [51] print_line_cursor#35 ← print_line_cursor#1 +Coalesced [53] print_byte::b#4 ← print_byte::b#0 +Coalesced [56] print_byte::b#5 ← print_byte::b#1 +Coalesced [57] print_char_cursor#53 ← print_char_cursor#10 +Coalesced [64] print_char::ch#3 ← print_char::ch#0 +Coalesced [65] print_char_cursor#54 ← print_char_cursor#35 +Coalesced [69] print_char::ch#4 ← print_char::ch#1 +Coalesced (already) [70] print_char_cursor#55 ← print_char_cursor#10 +Coalesced [91] round::S#6 ← round::S#1 +Coalesced [95] round::I#9 ← round::I#2 +Coalesced [98] round::S#5 ← round::S#2 +Coalesced [101] round::p#4 ← round::p#1 +Coalesced down to 7 phi equivalence classes +Culled Empty Block (label) @12 +Culled Empty Block (label) @48 +Culled Empty Block (label) main::@13 +Culled Empty Block (label) end::@3 +Culled Empty Block (label) print_ln::@2 +Culled Empty Block (label) print_ln::@3 +Culled Empty Block (label) print_word::@2 +Culled Empty Block (label) print_byte::@2 +Culled Empty Block (label) round::@3 +Renumbering block @42 to @1 +Renumbering block @44 to @2 +Renumbering block @47 to @3 +Renumbering block round::@7 to round::@3 +Renumbering block round::@8 to round::@4 +Renumbering block round::@10 to round::@5 +Renumbering block round::@11 to round::@6 +Renumbering block round::@12 to round::@7 +Renumbering block round::@19 to round::@8 +Renumbering block main::@2 to main::@1 +Renumbering block main::@3 to main::@2 +Renumbering block main::@4 to main::@3 +Renumbering block main::@5 to main::@4 +Renumbering block main::@6 to main::@5 +Renumbering block main::@7 to main::@6 +Renumbering block main::@8 to main::@7 +Renumbering block main::@9 to main::@8 +Renumbering block main::@10 to main::@9 +Renumbering block main::@11 to main::@10 +Renumbering block main::@12 to main::@11 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @3 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@4 +Adding NOP phi() at start of main::@5 +Adding NOP phi() at start of main::@6 +Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of main::@8 +Adding NOP phi() at start of main::@9 +Adding NOP phi() at start of main::@10 +Adding NOP phi() at start of main::@11 +Adding NOP phi() at start of end::@2 +Adding NOP phi() at start of print_ln +Adding NOP phi() at start of round + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] (word) last_time#0 ← (word) 0 + to:@2 +@2: scope:[] from @1 + [2] (word) rand_seed#20 ← (word) 0 + to:@3 +@3: scope:[] from @2 + [3] phi() + [4] call main + to:@end +@end: scope:[] from @3 + [5] phi() + +(signed word()) main() +main: scope:[main] from @3 + [6] phi() + [7] call start + to:main::@1 +main::@1: scope:[main] from main + [8] phi() + [9] call round + to:main::@2 +main::@2: scope:[main] from main::@1 + [10] phi() + [11] call round + to:main::@3 +main::@3: scope:[main] from main::@2 + [12] phi() + [13] call round + to:main::@4 +main::@4: scope:[main] from main::@3 + [14] phi() + [15] call round + to:main::@5 +main::@5: scope:[main] from main::@4 + [16] phi() + [17] call round + to:main::@6 +main::@6: scope:[main] from main::@5 + [18] phi() + [19] call round + to:main::@7 +main::@7: scope:[main] from main::@6 + [20] phi() + [21] call round + to:main::@8 +main::@8: scope:[main] from main::@7 + [22] phi() + [23] call round + to:main::@9 +main::@9: scope:[main] from main::@8 + [24] phi() + [25] call round + to:main::@10 +main::@10: scope:[main] from main::@9 + [26] phi() + [27] call round + to:main::@11 +main::@11: scope:[main] from main::@10 + [28] phi() + [29] call end + to:main::@return +main::@return: scope:[main] from main::@11 + [30] return + to:@return + +(void()) end() +end: scope:[end] from main::@11 + [31] (word) Ticks#1 ← (word) last_time#0 + [32] call start + to:end::@1 +end::@1: scope:[end] from end + [33] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 + [34] (word) Ticks#2 ← (word) last_time#1 + [35] (word) print_word::w#0 ← (word) Ticks#2 + [36] call print_word + to:end::@2 +end::@2: scope:[end] from end::@1 + [37] phi() + [38] call print_ln + to:end::@return +end::@return: scope:[end] from end::@2 + [39] (word) last_time#2 ← (word) last_time#1 + [40] return + to:@return + +(void()) print_ln() +print_ln: scope:[print_ln] from end::@2 + [41] phi() + to:print_ln::@1 +print_ln::@1: scope:[print_ln] from print_ln print_ln::@1 + [42] (byte*) print_line_cursor#8 ← phi( print_ln/(byte*) 1024 print_ln::@1/(byte*) print_line_cursor#1 ) + [43] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 + [44] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 + to:print_ln::@return +print_ln::@return: scope:[print_ln] from print_ln::@1 + [45] return + to:@return + +(void()) print_word((word) print_word::w) +print_word: scope:[print_word] from end::@1 + [46] (byte) print_byte::b#0 ← > (word) print_word::w#0 + [47] call print_byte + to:print_word::@1 +print_word::@1: scope:[print_word] from print_word + [48] (byte) print_byte::b#1 ← < (word) print_word::w#0 + [49] call print_byte + to:print_word::@return +print_word::@return: scope:[print_word] from print_word::@1 + [50] return + to:@return + +(void()) print_byte((byte) print_byte::b) +print_byte: scope:[print_byte] from print_word print_word::@1 + [51] (byte*) print_char_cursor#35 ← phi( print_word/(byte*) 1024 print_word::@1/(byte*) print_char_cursor#10 ) + [51] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) + [52] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 + [53] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) + [54] call print_char + to:print_byte::@1 +print_byte::@1: scope:[print_byte] from print_byte + [55] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f + [56] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) + [57] call print_char + to:print_byte::@return +print_byte::@return: scope:[print_byte] from print_byte::@1 + [58] return + to:@return + +(void()) print_char((byte) print_char::ch) +print_char: scope:[print_char] from print_byte print_byte::@1 + [59] (byte*) print_char_cursor#25 ← phi( print_byte/(byte*) print_char_cursor#35 print_byte::@1/(byte*) print_char_cursor#10 ) + [59] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) + [60] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 + [61] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 + to:print_char::@return +print_char::@return: scope:[print_char] from print_char + [62] return + to:@return + +(void()) start() +start: scope:[start] from end main + asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + [64] (word) rand_seed#0 ← (word) $194a + to:start::@return +start::@return: scope:[start] from start + [65] return + to:@return + +(void()) round() +round: scope:[round] from main::@1 main::@10 main::@2 main::@3 main::@4 main::@5 main::@6 main::@7 main::@8 main::@9 + [66] phi() + to:round::@1 +round::@1: scope:[round] from round round::@2 + [67] (byte*) round::p#2 ← phi( round/(const byte*) Sieve round::@2/(byte*) round::p#1 ) + [68] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2 + to:round::@3 +round::@3: scope:[round] from round::@1 round::@5 + [69] (byte) round::I#3 ← phi( round::@5/(byte) round::I#2 round::@1/(byte) 2 ) + [70] if((byte) round::I#3<(const byte) SQRT_COUNT) goto round::@4 + to:round::@return +round::@return: scope:[round] from round::@3 + [71] return + to:@return +round::@4: scope:[round] from round::@3 + [72] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5 + to:round::@8 +round::@8: scope:[round] from round::@4 + [73] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1 + [74] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4 + to:round::@6 +round::@6: scope:[round] from round::@7 round::@8 + [75] (byte*) round::S#3 ← phi( round::@7/(byte*) round::S#2 round::@8/(byte*) round::S#1 ) + [76] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7 + to:round::@5 +round::@5: scope:[round] from round::@4 round::@6 + [77] (byte) round::I#2 ← ++ (byte) round::I#3 + to:round::@3 +round::@7: scope:[round] from round::@6 + [78] *((byte*) round::S#3) ← (byte) 1 + [79] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3 + to:round::@6 +round::@2: scope:[round] from round::@1 + [80] *((byte*) round::p#2) ← (byte) 0 + [81] (byte*) round::p#1 ← ++ (byte*) round::p#2 + to:round::@1 + + +VARIABLE REGISTER WEIGHTS +(word) Ticks +(word) Ticks#1 2.0 +(word) Ticks#2 4.0 +(void()) end() +(word) last_time +(word) last_time#0 0.21428571428571427 +(word) last_time#1 1.0 +(word) last_time#2 20.0 +(signed word()) main() +(signed word) main::return +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 4.0 +(byte~) print_byte::$2 4.0 +(byte) print_byte::b +(byte) print_byte::b#0 4.0 +(byte) print_byte::b#1 4.0 +(byte) print_byte::b#2 2.0 +(void()) print_char((byte) print_char::ch) +(byte) print_char::ch +(byte) print_char::ch#0 4.0 +(byte) print_char::ch#1 4.0 +(byte) print_char::ch#2 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#10 1.0 +(byte*) print_char_cursor#25 4.0 +(byte*) print_char_cursor#35 1.3333333333333333 +(byte*) print_line_cursor +(byte*) print_line_cursor#1 16.5 +(byte*) print_line_cursor#8 22.0 +(void()) print_ln() +(byte*) print_screen +(void()) print_word((word) print_word::w) +(word) print_word::w +(word) print_word::w#0 2.0 +(word) rand_seed +(word) rand_seed#0 20.0 +(word) rand_seed#20 20.0 +(void()) round() +(byte~) round::$4 22.0 +(byte) round::I +(byte) round::I#2 22.0 +(byte) round::I#3 17.333333333333332 +(byte*) round::S +(byte*) round::S#1 22.0 +(byte*) round::S#2 202.0 +(byte*) round::S#3 138.33333333333331 +(byte*) round::p +(byte*) round::p#1 22.0 +(byte*) round::p#2 14.666666666666666 +(void()) start() + +Initial phi equivalence classes +[ print_line_cursor#8 print_line_cursor#1 ] +[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +[ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +[ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +[ round::p#2 round::p#1 ] +[ round::I#3 round::I#2 ] +[ round::S#3 round::S#2 round::S#1 ] +Coalescing volatile variable equivalence classes [ last_time#0 ] and [ last_time#1 ] +Coalescing volatile variable equivalence classes [ last_time#0 last_time#1 ] and [ last_time#2 ] +Coalescing volatile variable equivalence classes [ rand_seed#0 ] and [ rand_seed#20 ] +Added variable Ticks#1 to live range equivalence class [ Ticks#1 ] +Added variable Ticks#2 to live range equivalence class [ Ticks#2 ] +Added variable print_word::w#0 to live range equivalence class [ print_word::w#0 ] +Added variable print_byte::$0 to live range equivalence class [ print_byte::$0 ] +Added variable print_byte::$2 to live range equivalence class [ print_byte::$2 ] +Added variable round::$4 to live range equivalence class [ round::$4 ] +Complete equivalence classes +[ print_line_cursor#8 print_line_cursor#1 ] +[ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +[ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +[ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +[ round::p#2 round::p#1 ] +[ round::I#3 round::I#2 ] +[ round::S#3 round::S#2 round::S#1 ] +[ last_time#0 last_time#1 last_time#2 ] +[ rand_seed#0 rand_seed#20 ] +[ Ticks#1 ] +[ Ticks#2 ] +[ print_word::w#0 ] +[ print_byte::$0 ] +[ print_byte::$2 ] +[ round::$4 ] +Allocated zp[2]:2 [ print_line_cursor#8 print_line_cursor#1 ] +Allocated zp[1]:4 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Allocated zp[1]:5 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Allocated zp[2]:6 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +Allocated zp[2]:8 [ round::p#2 round::p#1 ] +Allocated zp[1]:10 [ round::I#3 round::I#2 ] +Allocated zp[2]:11 [ round::S#3 round::S#2 round::S#1 ] +Allocated zp[2]:13 [ last_time#0 last_time#1 last_time#2 ] +Allocated zp[2]:15 [ rand_seed#0 rand_seed#20 ] +Allocated zp[2]:17 [ Ticks#1 ] +Allocated zp[2]:19 [ Ticks#2 ] +Allocated zp[2]:21 [ print_word::w#0 ] +Allocated zp[1]:23 [ print_byte::$0 ] +Allocated zp[1]:24 [ print_byte::$2 ] +Allocated zp[1]:25 [ round::$4 ] + +INITIAL ASM +Target platform is c64basic / MOS6502X + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__bbegin) +.pc = $80d "Program" + // Global Constants & labels + .const COUNT = $4000 + .const SQRT_COUNT = $80 + .label print_line_cursor = 2 + .label print_char_cursor = 6 + .label last_time = $d + .label rand_seed = $f + .label Ticks = $11 + .label Ticks_1 = $13 + // @begin +__bbegin: + jmp __b1 + // @1 +__b1: + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + lda #>0 + sta.z last_time+1 + jmp __b2 + // @2 +__b2: + // [2] (word) rand_seed#20 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z rand_seed + lda #>0 + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] +__b3_from___b2: + jmp __b3 + // @3 +__b3: + // [4] call main + // [6] phi from @3 to main [phi:@3->main] +main_from___b3: + jsr main + // [5] phi from @3 to @end [phi:@3->@end] +__bend_from___b3: + jmp __bend + // @end +__bend: + // main +main: { + // [7] call start + jsr start + // [8] phi from main to main::@1 [phi:main->main::@1] + __b1_from_main: + jmp __b1 + // main::@1 + __b1: + // [9] call round + // [66] phi from main::@1 to round [phi:main::@1->round] + round_from___b1: + jsr round + // [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + __b2_from___b1: + jmp __b2 + // main::@2 + __b2: + // [11] call round + // [66] phi from main::@2 to round [phi:main::@2->round] + round_from___b2: + jsr round + // [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + __b3_from___b2: + jmp __b3 + // main::@3 + __b3: + // [13] call round + // [66] phi from main::@3 to round [phi:main::@3->round] + round_from___b3: + jsr round + // [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + __b4_from___b3: + jmp __b4 + // main::@4 + __b4: + // [15] call round + // [66] phi from main::@4 to round [phi:main::@4->round] + round_from___b4: + jsr round + // [16] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + __b5_from___b4: + jmp __b5 + // main::@5 + __b5: + // [17] call round + // [66] phi from main::@5 to round [phi:main::@5->round] + round_from___b5: + jsr round + // [18] phi from main::@5 to main::@6 [phi:main::@5->main::@6] + __b6_from___b5: + jmp __b6 + // main::@6 + __b6: + // [19] call round + // [66] phi from main::@6 to round [phi:main::@6->round] + round_from___b6: + jsr round + // [20] phi from main::@6 to main::@7 [phi:main::@6->main::@7] + __b7_from___b6: + jmp __b7 + // main::@7 + __b7: + // [21] call round + // [66] phi from main::@7 to round [phi:main::@7->round] + round_from___b7: + jsr round + // [22] phi from main::@7 to main::@8 [phi:main::@7->main::@8] + __b8_from___b7: + jmp __b8 + // main::@8 + __b8: + // [23] call round + // [66] phi from main::@8 to round [phi:main::@8->round] + round_from___b8: + jsr round + // [24] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + __b9_from___b8: + jmp __b9 + // main::@9 + __b9: + // [25] call round + // [66] phi from main::@9 to round [phi:main::@9->round] + round_from___b9: + jsr round + // [26] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + __b10_from___b9: + jmp __b10 + // main::@10 + __b10: + // [27] call round + // [66] phi from main::@10 to round [phi:main::@10->round] + round_from___b10: + jsr round + // [28] phi from main::@10 to main::@11 [phi:main::@10->main::@11] + __b11_from___b10: + jmp __b11 + // main::@11 + __b11: + // [29] call end + jsr end + jmp __breturn + // main::@return + __breturn: + // [30] return + rts +} + // end +end: { + // [31] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // [32] call start + jsr start + jmp __b1 + // end::@1 + __b1: + // [33] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // [34] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // [35] (word) print_word::w#0 ← (word) Ticks#2 -- vwuz1=vwuz2 + lda.z Ticks_1 + sta.z print_word.w + lda.z Ticks_1+1 + sta.z print_word.w+1 + // [36] call print_word + jsr print_word + // [37] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + __b2_from___b1: + jmp __b2 + // end::@2 + __b2: + // [38] call print_ln + // [41] phi from end::@2 to print_ln [phi:end::@2->print_ln] + print_ln_from___b2: + jsr print_ln + jmp __breturn + // end::@return + __breturn: + // [39] (word) last_time#2 ← (word) last_time#1 + // [40] return + rts +} + // print_ln +// Print a newline +print_ln: { + // [42] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1] + __b1_from_print_ln: + // [42] phi (byte*) print_line_cursor#8 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + jmp __b1 + // [42] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1] + __b1_from___b1: + // [42] phi (byte*) print_line_cursor#8 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy + jmp __b1 + // print_ln::@1 + __b1: + // [43] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // [44] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1_from___b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1_from___b1 + !: + jmp __breturn + // print_ln::@return + __breturn: + // [45] return + rts +} + // print_word +// Print a word as HEX +// print_word(word zeropage($15) w) +print_word: { + .label w = $15 + // [46] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuz1=_hi_vwuz2 + lda.z w+1 + sta.z print_byte.b + // [47] call print_byte + // [51] phi from print_word to print_byte [phi:print_word->print_byte] + print_byte_from_print_word: + // [51] phi (byte*) print_char_cursor#35 = (byte*) 1024 [phi:print_word->print_byte#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [51] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + jmp __b1 + // print_word::@1 + __b1: + // [48] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuz1=_lo_vwuz2 + lda.z w + sta.z print_byte.b + // [49] call print_byte + // [51] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte] + print_byte_from___b1: + // [51] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#10 [phi:print_word::@1->print_byte#0] -- register_copy + // [51] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + jmp __breturn + // print_word::@return + __breturn: + // [50] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte zeropage(4) b) +print_byte: { + .label __0 = $17 + .label __2 = $18 + .label b = 4 + // [52] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4 + lda.z b + lsr + lsr + lsr + lsr + sta.z __0 + // [53] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy.z __0 + lda print_hextab,y + sta.z print_char.ch + // [54] call print_char + // [59] phi from print_byte to print_char [phi:print_byte->print_char] + print_char_from_print_byte: + // [59] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#35 [phi:print_byte->print_char#0] -- register_copy + // [59] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + jmp __b1 + // print_byte::@1 + __b1: + // [55] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + lda #$f + and.z b + sta.z __2 + // [56] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy.z __2 + lda print_hextab,y + sta.z print_char.ch + // [57] call print_char + // [59] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + print_char_from___b1: + // [59] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#10 [phi:print_byte::@1->print_char#0] -- register_copy + // [59] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + jmp __breturn + // print_byte::@return + __breturn: + // [58] return + rts +} + // print_char +// Print a single char +// print_char(byte zeropage(5) ch) +print_char: { + .label ch = 5 + // [60] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuz2 + lda.z ch + ldy #0 + sta (print_char_cursor),y + // [61] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + jmp __breturn + // print_char::@return + __breturn: + // [62] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // [64] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + jmp __breturn + // start::@return + __breturn: + // [65] return + rts +} + // round +round: { + .label __4 = $19 + .label p = 8 + .label I = $a + .label S = $b + // [67] phi from round to round::@1 [phi:round->round::@1] + __b1_from_round: + // [67] phi (byte*) round::p#2 = (const byte*) Sieve [phi:round->round::@1#0] -- pbuz1=pbuc1 + lda #Sieve + sta.z p+1 + jmp __b1 + // round::@1 + __b1: + // [68] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2 -- pbuz1_lt_pbuc1_then_la1 + lda.z p+1 + cmp #>Sieve+COUNT + bcc __b2 + bne !+ + lda.z p + cmp #round::@3] + __b3_from___b1: + // [69] phi (byte) round::I#3 = (byte) 2 [phi:round::@1->round::@3#0] -- vbuz1=vbuc1 + lda #2 + sta.z I + jmp __b3 + // round::@3 + __b3: + // [70] if((byte) round::I#3<(const byte) SQRT_COUNT) goto round::@4 -- vbuz1_lt_vbuc1_then_la1 + lda.z I + cmp #SQRT_COUNT + bcc __b4 + jmp __breturn + // round::@return + __breturn: + // [71] return + rts + // round::@4 + __b4: + // [72] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5 -- pbuc1_derefidx_vbuz1_neq_0_then_la1 + ldy.z I + lda Sieve,y + cmp #0 + bne __b5 + jmp __b8 + // round::@8 + __b8: + // [73] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1 -- vbuz1=vbuz2_rol_1 + lda.z I + asl + sta.z __4 + // [74] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4 -- pbuz1=pbuc1_plus_vbuz2 + lda.z __4 + clc + adc #Sieve + adc #0 + sta.z S+1 + // [75] phi from round::@7 round::@8 to round::@6 [phi:round::@7/round::@8->round::@6] + __b6_from___b7: + __b6_from___b8: + // [75] phi (byte*) round::S#3 = (byte*) round::S#2 [phi:round::@7/round::@8->round::@6#0] -- register_copy + jmp __b6 + // round::@6 + __b6: + // [76] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7 -- pbuz1_lt_pbuc1_then_la1 + lda.z S+1 + cmp #>Sieve+COUNT + bcc __b7 + bne !+ + lda.z S + cmp #round::@3] + __b3_from___b5: + // [69] phi (byte) round::I#3 = (byte) round::I#2 [phi:round::@5->round::@3#0] -- register_copy + jmp __b3 + // round::@7 + __b7: + // [78] *((byte*) round::S#3) ← (byte) 1 -- _deref_pbuz1=vbuc1 + lda #1 + ldy #0 + sta (S),y + // [79] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3 -- pbuz1=pbuz1_plus_vbuz2 + lda.z I + clc + adc.z S + sta.z S + bcc !+ + inc.z S+1 + !: + jmp __b6_from___b7 + // round::@2 + __b2: + // [80] *((byte*) round::p#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + lda #0 + ldy #0 + sta (p),y + // [81] (byte*) round::p#1 ← ++ (byte*) round::p#2 -- pbuz1=_inc_pbuz1 + inc.z p + bne !+ + inc.z p+1 + !: + // [67] phi from round::@2 to round::@1 [phi:round::@2->round::@1] + __b1_from___b2: + // [67] phi (byte*) round::p#2 = (byte*) round::p#1 [phi:round::@2->round::@1#0] -- register_copy + jmp __b1 +} + // File Data + print_hextab: .text "0123456789abcdef" + .align $100 + Sieve: .fill COUNT, 0 + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [1] (word) last_time#0 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [2] (word) rand_seed#20 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [31] (word) Ticks#1 ← (word) last_time#0 [ last_time#0 Ticks#1 ] ( main:4::end:29 [ last_time#0 Ticks#1 ] ) always clobbers reg byte a +Statement [33] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 [ last_time#1 ] ( main:4::end:29 [ last_time#1 ] ) always clobbers reg byte a +Statement [34] (word) Ticks#2 ← (word) last_time#1 [ last_time#1 Ticks#2 ] ( main:4::end:29 [ last_time#1 Ticks#2 ] ) always clobbers reg byte a +Statement [35] (word) print_word::w#0 ← (word) Ticks#2 [ last_time#1 print_word::w#0 ] ( main:4::end:29 [ last_time#1 print_word::w#0 ] ) always clobbers reg byte a +Statement [43] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 [ print_line_cursor#1 print_char_cursor#10 ] ( main:4::end:29::print_ln:38 [ last_time#1 print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a +Statement [44] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#10 ] ( main:4::end:29::print_ln:38 [ last_time#1 print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a +Statement [46] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_word::w#0 print_byte::b#0 ] ( main:4::end:29::print_word:36 [ last_time#1 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a +Statement [48] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#10 print_byte::b#1 ] ( main:4::end:29::print_word:36 [ last_time#1 print_char_cursor#10 print_byte::b#1 ] ) always clobbers reg byte a +Statement [52] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_byte::b#2 print_char_cursor#35 print_byte::$0 ] ( main:4::end:29::print_word:36::print_byte:47 [ last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#35 print_byte::$0 ] main:4::end:29::print_word:36::print_byte:49 [ last_time#1 print_byte::b#2 print_char_cursor#35 print_byte::$0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:4 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Statement [55] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#10 print_byte::$2 ] ( main:4::end:29::print_word:36::print_byte:47 [ last_time#1 print_word::w#0 print_char_cursor#10 print_byte::$2 ] main:4::end:29::print_word:36::print_byte:49 [ last_time#1 print_char_cursor#10 print_byte::$2 ] ) always clobbers reg byte a +Statement [60] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 [ print_char_cursor#25 ] ( main:4::end:29::print_word:36::print_byte:47::print_char:54 [ last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#25 ] main:4::end:29::print_word:36::print_byte:49::print_char:54 [ last_time#1 print_byte::b#2 print_char_cursor#25 ] main:4::end:29::print_word:36::print_byte:47::print_char:57 [ last_time#1 print_word::w#0 print_char_cursor#25 ] main:4::end:29::print_word:36::print_byte:49::print_char:57 [ last_time#1 print_char_cursor#25 ] ) always clobbers reg byte y +Removing always clobbered register reg byte y as potential for zp[1]:4 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +Statement asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } always clobbers reg byte a reg byte x reg byte y +Statement [64] (word) rand_seed#0 ← (word) $194a [ ] ( main:4::start:7 [ last_time#0 ] main:4::end:29::start:32 [ last_time#0 Ticks#1 ] ) always clobbers reg byte a +Statement [68] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2 [ round::p#2 ] ( main:4::round:9 [ last_time#0 round::p#2 ] main:4::round:11 [ last_time#0 round::p#2 ] main:4::round:13 [ last_time#0 round::p#2 ] main:4::round:15 [ last_time#0 round::p#2 ] main:4::round:17 [ last_time#0 round::p#2 ] main:4::round:19 [ last_time#0 round::p#2 ] main:4::round:21 [ last_time#0 round::p#2 ] main:4::round:23 [ last_time#0 round::p#2 ] main:4::round:25 [ last_time#0 round::p#2 ] main:4::round:27 [ last_time#0 round::p#2 ] ) always clobbers reg byte a +Statement [72] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5 [ round::I#3 ] ( main:4::round:9 [ last_time#0 round::I#3 ] main:4::round:11 [ last_time#0 round::I#3 ] main:4::round:13 [ last_time#0 round::I#3 ] main:4::round:15 [ last_time#0 round::I#3 ] main:4::round:17 [ last_time#0 round::I#3 ] main:4::round:19 [ last_time#0 round::I#3 ] main:4::round:21 [ last_time#0 round::I#3 ] main:4::round:23 [ last_time#0 round::I#3 ] main:4::round:25 [ last_time#0 round::I#3 ] main:4::round:27 [ last_time#0 round::I#3 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:10 [ round::I#3 round::I#2 ] +Statement [73] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1 [ round::I#3 round::$4 ] ( main:4::round:9 [ last_time#0 round::I#3 round::$4 ] main:4::round:11 [ last_time#0 round::I#3 round::$4 ] main:4::round:13 [ last_time#0 round::I#3 round::$4 ] main:4::round:15 [ last_time#0 round::I#3 round::$4 ] main:4::round:17 [ last_time#0 round::I#3 round::$4 ] main:4::round:19 [ last_time#0 round::I#3 round::$4 ] main:4::round:21 [ last_time#0 round::I#3 round::$4 ] main:4::round:23 [ last_time#0 round::I#3 round::$4 ] main:4::round:25 [ last_time#0 round::I#3 round::$4 ] main:4::round:27 [ last_time#0 round::I#3 round::$4 ] ) always clobbers reg byte a +Statement [74] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4 [ round::I#3 round::S#1 ] ( main:4::round:9 [ last_time#0 round::I#3 round::S#1 ] main:4::round:11 [ last_time#0 round::I#3 round::S#1 ] main:4::round:13 [ last_time#0 round::I#3 round::S#1 ] main:4::round:15 [ last_time#0 round::I#3 round::S#1 ] main:4::round:17 [ last_time#0 round::I#3 round::S#1 ] main:4::round:19 [ last_time#0 round::I#3 round::S#1 ] main:4::round:21 [ last_time#0 round::I#3 round::S#1 ] main:4::round:23 [ last_time#0 round::I#3 round::S#1 ] main:4::round:25 [ last_time#0 round::I#3 round::S#1 ] main:4::round:27 [ last_time#0 round::I#3 round::S#1 ] ) always clobbers reg byte a +Statement [76] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7 [ round::I#3 round::S#3 ] ( main:4::round:9 [ last_time#0 round::I#3 round::S#3 ] main:4::round:11 [ last_time#0 round::I#3 round::S#3 ] main:4::round:13 [ last_time#0 round::I#3 round::S#3 ] main:4::round:15 [ last_time#0 round::I#3 round::S#3 ] main:4::round:17 [ last_time#0 round::I#3 round::S#3 ] main:4::round:19 [ last_time#0 round::I#3 round::S#3 ] main:4::round:21 [ last_time#0 round::I#3 round::S#3 ] main:4::round:23 [ last_time#0 round::I#3 round::S#3 ] main:4::round:25 [ last_time#0 round::I#3 round::S#3 ] main:4::round:27 [ last_time#0 round::I#3 round::S#3 ] ) always clobbers reg byte a +Statement [78] *((byte*) round::S#3) ← (byte) 1 [ round::I#3 round::S#3 ] ( main:4::round:9 [ last_time#0 round::I#3 round::S#3 ] main:4::round:11 [ last_time#0 round::I#3 round::S#3 ] main:4::round:13 [ last_time#0 round::I#3 round::S#3 ] main:4::round:15 [ last_time#0 round::I#3 round::S#3 ] main:4::round:17 [ last_time#0 round::I#3 round::S#3 ] main:4::round:19 [ last_time#0 round::I#3 round::S#3 ] main:4::round:21 [ last_time#0 round::I#3 round::S#3 ] main:4::round:23 [ last_time#0 round::I#3 round::S#3 ] main:4::round:25 [ last_time#0 round::I#3 round::S#3 ] main:4::round:27 [ last_time#0 round::I#3 round::S#3 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp[1]:10 [ round::I#3 round::I#2 ] +Statement [79] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3 [ round::I#3 round::S#2 ] ( main:4::round:9 [ last_time#0 round::I#3 round::S#2 ] main:4::round:11 [ last_time#0 round::I#3 round::S#2 ] main:4::round:13 [ last_time#0 round::I#3 round::S#2 ] main:4::round:15 [ last_time#0 round::I#3 round::S#2 ] main:4::round:17 [ last_time#0 round::I#3 round::S#2 ] main:4::round:19 [ last_time#0 round::I#3 round::S#2 ] main:4::round:21 [ last_time#0 round::I#3 round::S#2 ] main:4::round:23 [ last_time#0 round::I#3 round::S#2 ] main:4::round:25 [ last_time#0 round::I#3 round::S#2 ] main:4::round:27 [ last_time#0 round::I#3 round::S#2 ] ) always clobbers reg byte a +Statement [80] *((byte*) round::p#2) ← (byte) 0 [ round::p#2 ] ( main:4::round:9 [ last_time#0 round::p#2 ] main:4::round:11 [ last_time#0 round::p#2 ] main:4::round:13 [ last_time#0 round::p#2 ] main:4::round:15 [ last_time#0 round::p#2 ] main:4::round:17 [ last_time#0 round::p#2 ] main:4::round:19 [ last_time#0 round::p#2 ] main:4::round:21 [ last_time#0 round::p#2 ] main:4::round:23 [ last_time#0 round::p#2 ] main:4::round:25 [ last_time#0 round::p#2 ] main:4::round:27 [ last_time#0 round::p#2 ] ) always clobbers reg byte a reg byte y +Statement [1] (word) last_time#0 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [2] (word) rand_seed#20 ← (word) 0 [ last_time#0 ] ( [ last_time#0 ] ) always clobbers reg byte a +Statement [31] (word) Ticks#1 ← (word) last_time#0 [ last_time#0 Ticks#1 ] ( main:4::end:29 [ last_time#0 Ticks#1 ] ) always clobbers reg byte a +Statement [33] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 [ last_time#1 ] ( main:4::end:29 [ last_time#1 ] ) always clobbers reg byte a +Statement [34] (word) Ticks#2 ← (word) last_time#1 [ last_time#1 Ticks#2 ] ( main:4::end:29 [ last_time#1 Ticks#2 ] ) always clobbers reg byte a +Statement [35] (word) print_word::w#0 ← (word) Ticks#2 [ last_time#1 print_word::w#0 ] ( main:4::end:29 [ last_time#1 print_word::w#0 ] ) always clobbers reg byte a +Statement [43] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 [ print_line_cursor#1 print_char_cursor#10 ] ( main:4::end:29::print_ln:38 [ last_time#1 print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a +Statement [44] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 [ print_line_cursor#1 print_char_cursor#10 ] ( main:4::end:29::print_ln:38 [ last_time#1 print_line_cursor#1 print_char_cursor#10 ] ) always clobbers reg byte a +Statement [46] (byte) print_byte::b#0 ← > (word) print_word::w#0 [ print_word::w#0 print_byte::b#0 ] ( main:4::end:29::print_word:36 [ last_time#1 print_word::w#0 print_byte::b#0 ] ) always clobbers reg byte a +Statement [48] (byte) print_byte::b#1 ← < (word) print_word::w#0 [ print_char_cursor#10 print_byte::b#1 ] ( main:4::end:29::print_word:36 [ last_time#1 print_char_cursor#10 print_byte::b#1 ] ) always clobbers reg byte a +Statement [52] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 [ print_byte::b#2 print_char_cursor#35 print_byte::$0 ] ( main:4::end:29::print_word:36::print_byte:47 [ last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#35 print_byte::$0 ] main:4::end:29::print_word:36::print_byte:49 [ last_time#1 print_byte::b#2 print_char_cursor#35 print_byte::$0 ] ) always clobbers reg byte a +Statement [55] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f [ print_char_cursor#10 print_byte::$2 ] ( main:4::end:29::print_word:36::print_byte:47 [ last_time#1 print_word::w#0 print_char_cursor#10 print_byte::$2 ] main:4::end:29::print_word:36::print_byte:49 [ last_time#1 print_char_cursor#10 print_byte::$2 ] ) always clobbers reg byte a +Statement [60] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 [ print_char_cursor#25 ] ( main:4::end:29::print_word:36::print_byte:47::print_char:54 [ last_time#1 print_word::w#0 print_byte::b#2 print_char_cursor#25 ] main:4::end:29::print_word:36::print_byte:49::print_char:54 [ last_time#1 print_byte::b#2 print_char_cursor#25 ] main:4::end:29::print_word:36::print_byte:47::print_char:57 [ last_time#1 print_word::w#0 print_char_cursor#25 ] main:4::end:29::print_word:36::print_byte:49::print_char:57 [ last_time#1 print_char_cursor#25 ] ) always clobbers reg byte y +Statement asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } always clobbers reg byte a reg byte x reg byte y +Statement [64] (word) rand_seed#0 ← (word) $194a [ ] ( main:4::start:7 [ last_time#0 ] main:4::end:29::start:32 [ last_time#0 Ticks#1 ] ) always clobbers reg byte a +Statement [68] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2 [ round::p#2 ] ( main:4::round:9 [ last_time#0 round::p#2 ] main:4::round:11 [ last_time#0 round::p#2 ] main:4::round:13 [ last_time#0 round::p#2 ] main:4::round:15 [ last_time#0 round::p#2 ] main:4::round:17 [ last_time#0 round::p#2 ] main:4::round:19 [ last_time#0 round::p#2 ] main:4::round:21 [ last_time#0 round::p#2 ] main:4::round:23 [ last_time#0 round::p#2 ] main:4::round:25 [ last_time#0 round::p#2 ] main:4::round:27 [ last_time#0 round::p#2 ] ) always clobbers reg byte a +Statement [72] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5 [ round::I#3 ] ( main:4::round:9 [ last_time#0 round::I#3 ] main:4::round:11 [ last_time#0 round::I#3 ] main:4::round:13 [ last_time#0 round::I#3 ] main:4::round:15 [ last_time#0 round::I#3 ] main:4::round:17 [ last_time#0 round::I#3 ] main:4::round:19 [ last_time#0 round::I#3 ] main:4::round:21 [ last_time#0 round::I#3 ] main:4::round:23 [ last_time#0 round::I#3 ] main:4::round:25 [ last_time#0 round::I#3 ] main:4::round:27 [ last_time#0 round::I#3 ] ) always clobbers reg byte a +Statement [73] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1 [ round::I#3 round::$4 ] ( main:4::round:9 [ last_time#0 round::I#3 round::$4 ] main:4::round:11 [ last_time#0 round::I#3 round::$4 ] main:4::round:13 [ last_time#0 round::I#3 round::$4 ] main:4::round:15 [ last_time#0 round::I#3 round::$4 ] main:4::round:17 [ last_time#0 round::I#3 round::$4 ] main:4::round:19 [ last_time#0 round::I#3 round::$4 ] main:4::round:21 [ last_time#0 round::I#3 round::$4 ] main:4::round:23 [ last_time#0 round::I#3 round::$4 ] main:4::round:25 [ last_time#0 round::I#3 round::$4 ] main:4::round:27 [ last_time#0 round::I#3 round::$4 ] ) always clobbers reg byte a +Statement [74] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4 [ round::I#3 round::S#1 ] ( main:4::round:9 [ last_time#0 round::I#3 round::S#1 ] main:4::round:11 [ last_time#0 round::I#3 round::S#1 ] main:4::round:13 [ last_time#0 round::I#3 round::S#1 ] main:4::round:15 [ last_time#0 round::I#3 round::S#1 ] main:4::round:17 [ last_time#0 round::I#3 round::S#1 ] main:4::round:19 [ last_time#0 round::I#3 round::S#1 ] main:4::round:21 [ last_time#0 round::I#3 round::S#1 ] main:4::round:23 [ last_time#0 round::I#3 round::S#1 ] main:4::round:25 [ last_time#0 round::I#3 round::S#1 ] main:4::round:27 [ last_time#0 round::I#3 round::S#1 ] ) always clobbers reg byte a +Statement [76] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7 [ round::I#3 round::S#3 ] ( main:4::round:9 [ last_time#0 round::I#3 round::S#3 ] main:4::round:11 [ last_time#0 round::I#3 round::S#3 ] main:4::round:13 [ last_time#0 round::I#3 round::S#3 ] main:4::round:15 [ last_time#0 round::I#3 round::S#3 ] main:4::round:17 [ last_time#0 round::I#3 round::S#3 ] main:4::round:19 [ last_time#0 round::I#3 round::S#3 ] main:4::round:21 [ last_time#0 round::I#3 round::S#3 ] main:4::round:23 [ last_time#0 round::I#3 round::S#3 ] main:4::round:25 [ last_time#0 round::I#3 round::S#3 ] main:4::round:27 [ last_time#0 round::I#3 round::S#3 ] ) always clobbers reg byte a +Statement [78] *((byte*) round::S#3) ← (byte) 1 [ round::I#3 round::S#3 ] ( main:4::round:9 [ last_time#0 round::I#3 round::S#3 ] main:4::round:11 [ last_time#0 round::I#3 round::S#3 ] main:4::round:13 [ last_time#0 round::I#3 round::S#3 ] main:4::round:15 [ last_time#0 round::I#3 round::S#3 ] main:4::round:17 [ last_time#0 round::I#3 round::S#3 ] main:4::round:19 [ last_time#0 round::I#3 round::S#3 ] main:4::round:21 [ last_time#0 round::I#3 round::S#3 ] main:4::round:23 [ last_time#0 round::I#3 round::S#3 ] main:4::round:25 [ last_time#0 round::I#3 round::S#3 ] main:4::round:27 [ last_time#0 round::I#3 round::S#3 ] ) always clobbers reg byte a reg byte y +Statement [79] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3 [ round::I#3 round::S#2 ] ( main:4::round:9 [ last_time#0 round::I#3 round::S#2 ] main:4::round:11 [ last_time#0 round::I#3 round::S#2 ] main:4::round:13 [ last_time#0 round::I#3 round::S#2 ] main:4::round:15 [ last_time#0 round::I#3 round::S#2 ] main:4::round:17 [ last_time#0 round::I#3 round::S#2 ] main:4::round:19 [ last_time#0 round::I#3 round::S#2 ] main:4::round:21 [ last_time#0 round::I#3 round::S#2 ] main:4::round:23 [ last_time#0 round::I#3 round::S#2 ] main:4::round:25 [ last_time#0 round::I#3 round::S#2 ] main:4::round:27 [ last_time#0 round::I#3 round::S#2 ] ) always clobbers reg byte a +Statement [80] *((byte*) round::p#2) ← (byte) 0 [ round::p#2 ] ( main:4::round:9 [ last_time#0 round::p#2 ] main:4::round:11 [ last_time#0 round::p#2 ] main:4::round:13 [ last_time#0 round::p#2 ] main:4::round:15 [ last_time#0 round::p#2 ] main:4::round:17 [ last_time#0 round::p#2 ] main:4::round:19 [ last_time#0 round::p#2 ] main:4::round:21 [ last_time#0 round::p#2 ] main:4::round:23 [ last_time#0 round::p#2 ] main:4::round:25 [ last_time#0 round::p#2 ] main:4::round:27 [ last_time#0 round::p#2 ] ) always clobbers reg byte a reg byte y +Potential registers zp[2]:2 [ print_line_cursor#8 print_line_cursor#1 ] : zp[2]:2 , +Potential registers zp[1]:4 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] : zp[1]:4 , reg byte x , +Potential registers zp[1]:5 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:6 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] : zp[2]:6 , +Potential registers zp[2]:8 [ round::p#2 round::p#1 ] : zp[2]:8 , +Potential registers zp[1]:10 [ round::I#3 round::I#2 ] : zp[1]:10 , reg byte x , +Potential registers zp[2]:11 [ round::S#3 round::S#2 round::S#1 ] : zp[2]:11 , +Potential registers zp[2]:13 [ last_time#0 last_time#1 last_time#2 ] : zp[2]:13 , +Potential registers zp[2]:15 [ rand_seed#0 rand_seed#20 ] : zp[2]:15 , +Potential registers zp[2]:17 [ Ticks#1 ] : zp[2]:17 , +Potential registers zp[2]:19 [ Ticks#2 ] : zp[2]:19 , +Potential registers zp[2]:21 [ print_word::w#0 ] : zp[2]:21 , +Potential registers zp[1]:23 [ print_byte::$0 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:24 [ print_byte::$2 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:25 [ round::$4 ] : zp[1]:25 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [round] 362.33: zp[2]:11 [ round::S#3 round::S#2 round::S#1 ] 39.33: zp[1]:10 [ round::I#3 round::I#2 ] 36.67: zp[2]:8 [ round::p#2 round::p#1 ] 22: zp[1]:25 [ round::$4 ] +Uplift Scope [] 40: zp[2]:15 [ rand_seed#0 rand_seed#20 ] 38.5: zp[2]:2 [ print_line_cursor#8 print_line_cursor#1 ] 21.21: zp[2]:13 [ last_time#0 last_time#1 last_time#2 ] 6.33: zp[2]:6 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] 4: zp[2]:19 [ Ticks#2 ] 2: zp[2]:17 [ Ticks#1 ] +Uplift Scope [print_byte] 10: zp[1]:4 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] 4: zp[1]:23 [ print_byte::$0 ] 4: zp[1]:24 [ print_byte::$2 ] +Uplift Scope [print_char] 14: zp[1]:5 [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Uplift Scope [print_word] 2: zp[2]:21 [ print_word::w#0 ] +Uplift Scope [RADIX] +Uplift Scope [print_ln] +Uplift Scope [start] +Uplift Scope [end] +Uplift Scope [main] + +Uplifting [round] best 7452 combination zp[2]:11 [ round::S#3 round::S#2 round::S#1 ] reg byte x [ round::I#3 round::I#2 ] zp[2]:8 [ round::p#2 round::p#1 ] reg byte a [ round::$4 ] +Uplifting [] best 7452 combination zp[2]:15 [ rand_seed#0 rand_seed#20 ] zp[2]:2 [ print_line_cursor#8 print_line_cursor#1 ] zp[2]:13 [ last_time#0 last_time#1 last_time#2 ] zp[2]:6 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] zp[2]:19 [ Ticks#2 ] zp[2]:17 [ Ticks#1 ] +Uplifting [print_byte] best 7438 combination reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte x [ print_byte::$2 ] +Uplifting [print_char] best 7429 combination reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Uplifting [print_word] best 7429 combination zp[2]:21 [ print_word::w#0 ] +Uplifting [RADIX] best 7429 combination +Uplifting [print_ln] best 7429 combination +Uplifting [start] best 7429 combination +Uplifting [end] best 7429 combination +Uplifting [main] best 7429 combination +Coalescing zero page register [ zp[2]:19 [ Ticks#2 ] ] with [ zp[2]:21 [ print_word::w#0 ] ] - score: 1 +Coalescing zero page register [ zp[2]:8 [ round::p#2 round::p#1 ] ] with [ zp[2]:2 [ print_line_cursor#8 print_line_cursor#1 ] ] +Coalescing zero page register [ zp[2]:11 [ round::S#3 round::S#2 round::S#1 ] ] with [ zp[2]:6 [ print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] ] +Allocated (was zp[2]:8) zp[2]:2 [ round::p#2 round::p#1 print_line_cursor#8 print_line_cursor#1 ] +Allocated (was zp[2]:11) zp[2]:4 [ round::S#3 round::S#2 round::S#1 print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +Allocated (was zp[2]:13) zp[2]:6 [ last_time#0 last_time#1 last_time#2 ] +Allocated (was zp[2]:15) zp[2]:8 [ rand_seed#0 rand_seed#20 ] +Allocated (was zp[2]:17) zp[2]:10 [ Ticks#1 ] +Allocated (was zp[2]:19) zp[2]:12 [ Ticks#2 print_word::w#0 ] + +ASSEMBLER BEFORE OPTIMIZATION + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__bbegin) +.pc = $80d "Program" + // Global Constants & labels + .const COUNT = $4000 + .const SQRT_COUNT = $80 + .label print_line_cursor = 2 + .label print_char_cursor = 4 + .label last_time = 6 + .label rand_seed = 8 + .label Ticks = $a + .label Ticks_1 = $c + // @begin +__bbegin: + jmp __b1 + // @1 +__b1: + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + lda #>0 + sta.z last_time+1 + jmp __b2 + // @2 +__b2: + // [2] (word) rand_seed#20 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z rand_seed + lda #>0 + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] +__b3_from___b2: + jmp __b3 + // @3 +__b3: + // [4] call main + // [6] phi from @3 to main [phi:@3->main] +main_from___b3: + jsr main + // [5] phi from @3 to @end [phi:@3->@end] +__bend_from___b3: + jmp __bend + // @end +__bend: + // main +main: { + // [7] call start + jsr start + // [8] phi from main to main::@1 [phi:main->main::@1] + __b1_from_main: + jmp __b1 + // main::@1 + __b1: + // [9] call round + // [66] phi from main::@1 to round [phi:main::@1->round] + round_from___b1: + jsr round + // [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + __b2_from___b1: + jmp __b2 + // main::@2 + __b2: + // [11] call round + // [66] phi from main::@2 to round [phi:main::@2->round] + round_from___b2: + jsr round + // [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + __b3_from___b2: + jmp __b3 + // main::@3 + __b3: + // [13] call round + // [66] phi from main::@3 to round [phi:main::@3->round] + round_from___b3: + jsr round + // [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + __b4_from___b3: + jmp __b4 + // main::@4 + __b4: + // [15] call round + // [66] phi from main::@4 to round [phi:main::@4->round] + round_from___b4: + jsr round + // [16] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + __b5_from___b4: + jmp __b5 + // main::@5 + __b5: + // [17] call round + // [66] phi from main::@5 to round [phi:main::@5->round] + round_from___b5: + jsr round + // [18] phi from main::@5 to main::@6 [phi:main::@5->main::@6] + __b6_from___b5: + jmp __b6 + // main::@6 + __b6: + // [19] call round + // [66] phi from main::@6 to round [phi:main::@6->round] + round_from___b6: + jsr round + // [20] phi from main::@6 to main::@7 [phi:main::@6->main::@7] + __b7_from___b6: + jmp __b7 + // main::@7 + __b7: + // [21] call round + // [66] phi from main::@7 to round [phi:main::@7->round] + round_from___b7: + jsr round + // [22] phi from main::@7 to main::@8 [phi:main::@7->main::@8] + __b8_from___b7: + jmp __b8 + // main::@8 + __b8: + // [23] call round + // [66] phi from main::@8 to round [phi:main::@8->round] + round_from___b8: + jsr round + // [24] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + __b9_from___b8: + jmp __b9 + // main::@9 + __b9: + // [25] call round + // [66] phi from main::@9 to round [phi:main::@9->round] + round_from___b9: + jsr round + // [26] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + __b10_from___b9: + jmp __b10 + // main::@10 + __b10: + // [27] call round + // [66] phi from main::@10 to round [phi:main::@10->round] + round_from___b10: + jsr round + // [28] phi from main::@10 to main::@11 [phi:main::@10->main::@11] + __b11_from___b10: + jmp __b11 + // main::@11 + __b11: + // [29] call end + jsr end + jmp __breturn + // main::@return + __breturn: + // [30] return + rts +} + // end +end: { + // [31] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // [32] call start + jsr start + jmp __b1 + // end::@1 + __b1: + // [33] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // [34] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // [35] (word) print_word::w#0 ← (word) Ticks#2 + // [36] call print_word + jsr print_word + // [37] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + __b2_from___b1: + jmp __b2 + // end::@2 + __b2: + // [38] call print_ln + // [41] phi from end::@2 to print_ln [phi:end::@2->print_ln] + print_ln_from___b2: + jsr print_ln + jmp __breturn + // end::@return + __breturn: + // [39] (word) last_time#2 ← (word) last_time#1 + // [40] return + rts +} + // print_ln +// Print a newline +print_ln: { + // [42] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1] + __b1_from_print_ln: + // [42] phi (byte*) print_line_cursor#8 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + jmp __b1 + // [42] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1] + __b1_from___b1: + // [42] phi (byte*) print_line_cursor#8 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy + jmp __b1 + // print_ln::@1 + __b1: + // [43] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // [44] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#10) goto print_ln::@1 -- pbuz1_lt_pbuz2_then_la1 + lda.z print_line_cursor+1 + cmp.z print_char_cursor+1 + bcc __b1_from___b1 + bne !+ + lda.z print_line_cursor + cmp.z print_char_cursor + bcc __b1_from___b1 + !: + jmp __breturn + // print_ln::@return + __breturn: + // [45] return + rts +} + // print_word +// Print a word as HEX +// print_word(word zeropage($c) w) +print_word: { + .label w = $c + // [46] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1 + lda.z w+1 + tax + // [47] call print_byte + // [51] phi from print_word to print_byte [phi:print_word->print_byte] + print_byte_from_print_word: + // [51] phi (byte*) print_char_cursor#35 = (byte*) 1024 [phi:print_word->print_byte#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [51] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + jmp __b1 + // print_word::@1 + __b1: + // [48] (byte) print_byte::b#1 ← < (word) print_word::w#0 -- vbuxx=_lo_vwuz1 + lda.z w + tax + // [49] call print_byte + // [51] phi from print_word::@1 to print_byte [phi:print_word::@1->print_byte] + print_byte_from___b1: + // [51] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#10 [phi:print_word::@1->print_byte#0] -- register_copy + // [51] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + jmp __breturn + // print_word::@return + __breturn: + // [50] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + // [52] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuxx_ror_4 + txa + lsr + lsr + lsr + lsr + // [53] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa + tay + lda print_hextab,y + // [54] call print_char + // [59] phi from print_byte to print_char [phi:print_byte->print_char] + print_char_from_print_byte: + // [59] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#35 [phi:print_byte->print_char#0] -- register_copy + // [59] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + jmp __b1 + // print_byte::@1 + __b1: + // [55] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuxx=vbuxx_band_vbuc1 + lda #$f + axs #0 + // [56] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuxx + lda print_hextab,x + // [57] call print_char + // [59] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + print_char_from___b1: + // [59] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#10 [phi:print_byte::@1->print_char#0] -- register_copy + // [59] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + jmp __breturn + // print_byte::@return + __breturn: + // [58] return + rts +} + // print_char +// Print a single char +// print_char(byte register(A) ch) +print_char: { + // [60] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa + ldy #0 + sta (print_char_cursor),y + // [61] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + jmp __breturn + // print_char::@return + __breturn: + // [62] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // [64] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + jmp __breturn + // start::@return + __breturn: + // [65] return + rts +} + // round +round: { + .label p = 2 + .label S = 4 + // [67] phi from round to round::@1 [phi:round->round::@1] + __b1_from_round: + // [67] phi (byte*) round::p#2 = (const byte*) Sieve [phi:round->round::@1#0] -- pbuz1=pbuc1 + lda #Sieve + sta.z p+1 + jmp __b1 + // round::@1 + __b1: + // [68] if((byte*) round::p#2<(const byte*) Sieve+(const word) COUNT) goto round::@2 -- pbuz1_lt_pbuc1_then_la1 + lda.z p+1 + cmp #>Sieve+COUNT + bcc __b2 + bne !+ + lda.z p + cmp #round::@3] + __b3_from___b1: + // [69] phi (byte) round::I#3 = (byte) 2 [phi:round::@1->round::@3#0] -- vbuxx=vbuc1 + ldx #2 + jmp __b3 + // round::@3 + __b3: + // [70] if((byte) round::I#3<(const byte) SQRT_COUNT) goto round::@4 -- vbuxx_lt_vbuc1_then_la1 + cpx #SQRT_COUNT + bcc __b4 + jmp __breturn + // round::@return + __breturn: + // [71] return + rts + // round::@4 + __b4: + // [72] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5 -- pbuc1_derefidx_vbuxx_neq_0_then_la1 + lda Sieve,x + cmp #0 + bne __b5 + jmp __b8 + // round::@8 + __b8: + // [73] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1 -- vbuaa=vbuxx_rol_1 + txa + asl + // [74] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4 -- pbuz1=pbuc1_plus_vbuaa + clc + adc #Sieve + adc #0 + sta.z S+1 + // [75] phi from round::@7 round::@8 to round::@6 [phi:round::@7/round::@8->round::@6] + __b6_from___b7: + __b6_from___b8: + // [75] phi (byte*) round::S#3 = (byte*) round::S#2 [phi:round::@7/round::@8->round::@6#0] -- register_copy + jmp __b6 + // round::@6 + __b6: + // [76] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7 -- pbuz1_lt_pbuc1_then_la1 + lda.z S+1 + cmp #>Sieve+COUNT + bcc __b7 + bne !+ + lda.z S + cmp #round::@3] + __b3_from___b5: + // [69] phi (byte) round::I#3 = (byte) round::I#2 [phi:round::@5->round::@3#0] -- register_copy + jmp __b3 + // round::@7 + __b7: + // [78] *((byte*) round::S#3) ← (byte) 1 -- _deref_pbuz1=vbuc1 + lda #1 + ldy #0 + sta (S),y + // [79] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3 -- pbuz1=pbuz1_plus_vbuxx + txa + clc + adc.z S + sta.z S + bcc !+ + inc.z S+1 + !: + jmp __b6_from___b7 + // round::@2 + __b2: + // [80] *((byte*) round::p#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + lda #0 + ldy #0 + sta (p),y + // [81] (byte*) round::p#1 ← ++ (byte*) round::p#2 -- pbuz1=_inc_pbuz1 + inc.z p + bne !+ + inc.z p+1 + !: + // [67] phi from round::@2 to round::@1 [phi:round::@2->round::@1] + __b1_from___b2: + // [67] phi (byte*) round::p#2 = (byte*) round::p#1 [phi:round::@2->round::@1#0] -- register_copy + jmp __b1 +} + // File Data + print_hextab: .text "0123456789abcdef" + .align $100 + Sieve: .fill COUNT, 0 + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp __b1 +Removing instruction jmp __b2 +Removing instruction jmp __b3 +Removing instruction jmp __bend +Removing instruction jmp __b1 +Removing instruction jmp __b2 +Removing instruction jmp __b3 +Removing instruction jmp __b4 +Removing instruction jmp __b5 +Removing instruction jmp __b6 +Removing instruction jmp __b7 +Removing instruction jmp __b8 +Removing instruction jmp __b9 +Removing instruction jmp __b10 +Removing instruction jmp __b11 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __b2 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __breturn +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __b3 +Removing instruction jmp __breturn +Removing instruction jmp __b8 +Removing instruction jmp __b6 +Removing instruction jmp __b5 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda #>0 +Removing instruction lda #>0 +Replacing instruction ldy #0 with TAY +Succesful ASM optimization Pass5UnnecesaryLoadElimination +Replacing label __bbegin with __b1 +Replacing label __b1_from___b1 with __b1 +Replacing label __b1_from___b1 with __b1 +Replacing label __b6_from___b7 with __b6 +Removing instruction __bbegin: +Removing instruction __b3_from___b2: +Removing instruction main_from___b3: +Removing instruction __bend_from___b3: +Removing instruction __b1_from_main: +Removing instruction round_from___b1: +Removing instruction __b2_from___b1: +Removing instruction round_from___b2: +Removing instruction __b3_from___b2: +Removing instruction round_from___b3: +Removing instruction __b4_from___b3: +Removing instruction round_from___b4: +Removing instruction __b5_from___b4: +Removing instruction round_from___b5: +Removing instruction __b6_from___b5: +Removing instruction round_from___b6: +Removing instruction __b7_from___b6: +Removing instruction round_from___b7: +Removing instruction __b8_from___b7: +Removing instruction round_from___b8: +Removing instruction __b9_from___b8: +Removing instruction round_from___b9: +Removing instruction __b10_from___b9: +Removing instruction round_from___b10: +Removing instruction __b11_from___b10: +Removing instruction __b2_from___b1: +Removing instruction print_ln_from___b2: +Removing instruction __b1_from___b1: +Removing instruction __b6_from___b7: +Removing instruction __b6_from___b8: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction __b2: +Removing instruction __b3: +Removing instruction __bend: +Removing instruction __b1: +Removing instruction __b2: +Removing instruction __b3: +Removing instruction __b4: +Removing instruction __b5: +Removing instruction __b6: +Removing instruction __b7: +Removing instruction __b8: +Removing instruction __b9: +Removing instruction __b10: +Removing instruction __b11: +Removing instruction __breturn: +Removing instruction __b1: +Removing instruction __b2: +Removing instruction __breturn: +Removing instruction __b1_from_print_ln: +Removing instruction __breturn: +Removing instruction print_byte_from_print_word: +Removing instruction __b1: +Removing instruction print_byte_from___b1: +Removing instruction __breturn: +Removing instruction print_char_from_print_byte: +Removing instruction __b1: +Removing instruction print_char_from___b1: +Removing instruction __breturn: +Removing instruction __breturn: +Removing instruction __breturn: +Removing instruction __b1_from_round: +Removing instruction __b3_from___b1: +Removing instruction __breturn: +Removing instruction __b8: +Removing instruction __b3_from___b5: +Removing instruction __b1_from___b2: +Succesful ASM optimization Pass5UnusedLabelElimination +Adding RTS to root block +Succesful ASM optimization Pass5AddMainRts +Removing instruction jmp __b1 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda #<0 +Succesful ASM optimization Pass5UnnecesaryLoadElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(const word) COUNT = (number) $4000 +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const byte) SQRT_COUNT = (number) $80 +(const byte*) Sieve = { fill( COUNT, 0) } +(word) Ticks +(word) Ticks#1 Ticks zp[2]:10 2.0 +(word) Ticks#2 Ticks_1 zp[2]:12 4.0 +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@return +(word) last_time +(word) last_time#0 last_time zp[2]:6 0.21428571428571427 +(word) last_time#1 last_time zp[2]:6 1.0 +(word) last_time#2 last_time zp[2]:6 20.0 +(signed word()) main() +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 +(label) main::@return +(signed word) main::return +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 reg byte a 4.0 +(byte~) print_byte::$2 reg byte x 4.0 +(label) print_byte::@1 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 reg byte x 4.0 +(byte) print_byte::b#1 reg byte x 4.0 +(byte) print_byte::b#2 reg byte x 2.0 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 reg byte a 4.0 +(byte) print_char::ch#1 reg byte a 4.0 +(byte) print_char::ch#2 reg byte a 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#10 print_char_cursor zp[2]:4 1.0 +(byte*) print_char_cursor#25 print_char_cursor zp[2]:4 4.0 +(byte*) print_char_cursor#35 print_char_cursor zp[2]:4 1.3333333333333333 +(const byte*) print_hextab = (string) "0123456789abcdef"z +(byte*) print_line_cursor +(byte*) print_line_cursor#1 print_line_cursor zp[2]:2 16.5 +(byte*) print_line_cursor#8 print_line_cursor zp[2]:2 22.0 +(void()) print_ln() +(label) print_ln::@1 +(label) print_ln::@return +(byte*) print_screen +(void()) print_word((word) print_word::w) +(label) print_word::@1 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 w zp[2]:12 2.0 +(word) rand_seed +(word) rand_seed#0 rand_seed zp[2]:8 20.0 +(word) rand_seed#20 rand_seed zp[2]:8 20.0 +(void()) round() +(byte~) round::$4 reg byte a 22.0 +(label) round::@1 +(label) round::@2 +(label) round::@3 +(label) round::@4 +(label) round::@5 +(label) round::@6 +(label) round::@7 +(label) round::@8 +(label) round::@return +(byte) round::I +(byte) round::I#2 reg byte x 22.0 +(byte) round::I#3 reg byte x 17.333333333333332 +(byte*) round::S +(byte*) round::S#1 S zp[2]:4 22.0 +(byte*) round::S#2 S zp[2]:4 202.0 +(byte*) round::S#3 S zp[2]:4 138.33333333333331 +(byte*) round::p +(byte*) round::p#1 p zp[2]:2 22.0 +(byte*) round::p#2 p zp[2]:2 14.666666666666666 +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time + +reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +zp[2]:2 [ round::p#2 round::p#1 print_line_cursor#8 print_line_cursor#1 ] +reg byte x [ round::I#3 round::I#2 ] +zp[2]:4 [ round::S#3 round::S#2 round::S#1 print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +zp[2]:6 [ last_time#0 last_time#1 last_time#2 ] +zp[2]:8 [ rand_seed#0 rand_seed#20 ] +zp[2]:10 [ Ticks#1 ] +zp[2]:12 [ Ticks#2 print_word::w#0 ] +reg byte a [ print_byte::$0 ] +reg byte x [ print_byte::$2 ] +reg byte a [ round::$4 ] + + +FINAL ASSEMBLER +Score: 6505 + + // File Comments + // Upstart +.pc = $801 "Basic" +:BasicUpstart(__b1) +.pc = $80d "Program" + // Global Constants & labels + .const COUNT = $4000 + .const SQRT_COUNT = $80 + .label print_line_cursor = 2 + .label print_char_cursor = 4 + .label last_time = 6 + .label rand_seed = 8 + .label Ticks = $a + .label Ticks_1 = $c + // @begin + // @1 +__b1: + // last_time + // [1] (word) last_time#0 ← (word) 0 -- vwuz1=vwuc1 + lda #<0 + sta.z last_time + sta.z last_time+1 + // @2 + // rand_seed + // [2] (word) rand_seed#20 ← (word) 0 -- vwuz1=vwuc1 + sta.z rand_seed + sta.z rand_seed+1 + // [3] phi from @2 to @3 [phi:@2->@3] + // @3 + // [4] call main + // [6] phi from @3 to main [phi:@3->main] + jsr main + rts + // [5] phi from @3 to @end [phi:@3->@end] + // @end + // main +main: { + // start() + // [7] call start + jsr start + // [8] phi from main to main::@1 [phi:main->main::@1] + // main::@1 + // round() + // [9] call round + // [66] phi from main::@1 to round [phi:main::@1->round] + jsr round + // [10] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + // main::@2 + // round() + // [11] call round + // [66] phi from main::@2 to round [phi:main::@2->round] + jsr round + // [12] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + // main::@3 + // round() + // [13] call round + // [66] phi from main::@3 to round [phi:main::@3->round] + jsr round + // [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + // main::@4 + // round() + // [15] call round + // [66] phi from main::@4 to round [phi:main::@4->round] + jsr round + // [16] phi from main::@4 to main::@5 [phi:main::@4->main::@5] + // main::@5 + // round() + // [17] call round + // [66] phi from main::@5 to round [phi:main::@5->round] + jsr round + // [18] phi from main::@5 to main::@6 [phi:main::@5->main::@6] + // main::@6 + // round() + // [19] call round + // [66] phi from main::@6 to round [phi:main::@6->round] + jsr round + // [20] phi from main::@6 to main::@7 [phi:main::@6->main::@7] + // main::@7 + // round() + // [21] call round + // [66] phi from main::@7 to round [phi:main::@7->round] + jsr round + // [22] phi from main::@7 to main::@8 [phi:main::@7->main::@8] + // main::@8 + // round() + // [23] call round + // [66] phi from main::@8 to round [phi:main::@8->round] + jsr round + // [24] phi from main::@8 to main::@9 [phi:main::@8->main::@9] + // main::@9 + // round() + // [25] call round + // [66] phi from main::@9 to round [phi:main::@9->round] + jsr round + // [26] phi from main::@9 to main::@10 [phi:main::@9->main::@10] + // main::@10 + // round() + // [27] call round + // [66] phi from main::@10 to round [phi:main::@10->round] + jsr round + // [28] phi from main::@10 to main::@11 [phi:main::@10->main::@11] + // main::@11 + // end() + // [29] call end + jsr end + // main::@return + // } + // [30] return + rts +} + // end +end: { + // Ticks = last_time + // [31] (word) Ticks#1 ← (word) last_time#0 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks + lda.z last_time+1 + sta.z Ticks+1 + // start() + // [32] call start + jsr start + // end::@1 + // last_time -= Ticks + // [33] (word) last_time#1 ← (word) last_time#0 - (word) Ticks#1 -- vwuz1=vwuz1_minus_vwuz2 + lda.z last_time + sec + sbc.z Ticks + sta.z last_time + lda.z last_time+1 + sbc.z Ticks+1 + sta.z last_time+1 + // Ticks = last_time + // [34] (word) Ticks#2 ← (word) last_time#1 -- vwuz1=vwuz2 + lda.z last_time + sta.z Ticks_1 + lda.z last_time+1 + sta.z Ticks_1+1 + // print_word(Ticks) + // [35] (word) print_word::w#0 ← (word) Ticks#2 + // [36] call print_word + jsr print_word + // [37] phi from end::@1 to end::@2 [phi:end::@1->end::@2] + // end::@2 + // print_ln() + // [38] call print_ln + // [41] phi from end::@2 to print_ln [phi:end::@2->print_ln] + jsr print_ln + // end::@return + // } + // [39] (word) last_time#2 ← (word) last_time#1 + // [40] return + rts +} + // print_ln +// Print a newline +print_ln: { + // [42] phi from print_ln to print_ln::@1 [phi:print_ln->print_ln::@1] + // [42] phi (byte*) print_line_cursor#8 = (byte*) 1024 [phi:print_ln->print_ln::@1#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_line_cursor + lda #>$400 + sta.z print_line_cursor+1 + // [42] phi from print_ln::@1 to print_ln::@1 [phi:print_ln::@1->print_ln::@1] + // [42] phi (byte*) print_line_cursor#8 = (byte*) print_line_cursor#1 [phi:print_ln::@1->print_ln::@1#0] -- register_copy + // print_ln::@1 + __b1: + // print_line_cursor + $28 + // [43] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#8 + (byte) $28 -- pbuz1=pbuz1_plus_vbuc1 + lda #$28 + clc + adc.z print_line_cursor + sta.z print_line_cursor + bcc !+ + inc.z print_line_cursor+1 + !: + // while (print_line_cursorw) + // [46] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1 + lda.z w+1 + tax + // [47] call print_byte + // [51] phi from print_word to print_byte [phi:print_word->print_byte] + // [51] phi (byte*) print_char_cursor#35 = (byte*) 1024 [phi:print_word->print_byte#0] -- pbuz1=pbuc1 + lda #<$400 + sta.z print_char_cursor + lda #>$400 + sta.z print_char_cursor+1 + // [51] phi (byte) print_byte::b#2 = (byte) print_byte::b#0 [phi:print_word->print_byte#1] -- register_copy + jsr print_byte + // print_word::@1 + // print_byte(print_byte] + // [51] phi (byte*) print_char_cursor#35 = (byte*) print_char_cursor#10 [phi:print_word::@1->print_byte#0] -- register_copy + // [51] phi (byte) print_byte::b#2 = (byte) print_byte::b#1 [phi:print_word::@1->print_byte#1] -- register_copy + jsr print_byte + // print_word::@return + // } + // [50] return + rts +} + // print_byte +// Print a byte as HEX +// print_byte(byte register(X) b) +print_byte: { + // b>>4 + // [52] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte) 4 -- vbuaa=vbuxx_ror_4 + txa + lsr + lsr + lsr + lsr + // print_char(print_hextab[b>>4]) + // [53] (byte) print_char::ch#0 ← *((const byte*) print_hextab + (byte~) print_byte::$0) -- vbuaa=pbuc1_derefidx_vbuaa + tay + lda print_hextab,y + // [54] call print_char + // [59] phi from print_byte to print_char [phi:print_byte->print_char] + // [59] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#35 [phi:print_byte->print_char#0] -- register_copy + // [59] phi (byte) print_char::ch#2 = (byte) print_char::ch#0 [phi:print_byte->print_char#1] -- register_copy + jsr print_char + // print_byte::@1 + // b&$f + // [55] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte) $f -- vbuxx=vbuxx_band_vbuc1 + lda #$f + axs #0 + // print_char(print_hextab[b&$f]) + // [56] (byte) print_char::ch#1 ← *((const byte*) print_hextab + (byte~) print_byte::$2) -- vbuaa=pbuc1_derefidx_vbuxx + lda print_hextab,x + // [57] call print_char + // [59] phi from print_byte::@1 to print_char [phi:print_byte::@1->print_char] + // [59] phi (byte*) print_char_cursor#25 = (byte*) print_char_cursor#10 [phi:print_byte::@1->print_char#0] -- register_copy + // [59] phi (byte) print_char::ch#2 = (byte) print_char::ch#1 [phi:print_byte::@1->print_char#1] -- register_copy + jsr print_char + // print_byte::@return + // } + // [58] return + rts +} + // print_char +// Print a single char +// print_char(byte register(A) ch) +print_char: { + // *(print_char_cursor++) = ch + // [60] *((byte*) print_char_cursor#25) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa + ldy #0 + sta (print_char_cursor),y + // *(print_char_cursor++) = ch; + // [61] (byte*) print_char_cursor#10 ← ++ (byte*) print_char_cursor#25 -- pbuz1=_inc_pbuz1 + inc.z print_char_cursor + bne !+ + inc.z print_char_cursor+1 + !: + // print_char::@return + // } + // [62] return + rts +} + // start +start: { + .label LAST_TIME = last_time + // asm + // asm { jsr$FFDE staLAST_TIME stxLAST_TIME+1 } + jsr $ffde + sta LAST_TIME + stx LAST_TIME+1 + // rand_seed = 6474 + // [64] (word) rand_seed#0 ← (word) $194a -- vwuz1=vwuc1 + lda #<$194a + sta.z rand_seed + lda #>$194a + sta.z rand_seed+1 + // start::@return + // } + // [65] return + rts +} + // round +round: { + .label p = 2 + .label S = 4 + // [67] phi from round to round::@1 [phi:round->round::@1] + // [67] phi (byte*) round::p#2 = (const byte*) Sieve [phi:round->round::@1#0] -- pbuz1=pbuc1 + lda #Sieve + sta.z p+1 + // round::@1 + __b1: + // for(char* p=Sieve;pSieve+COUNT + bcc __b2 + bne !+ + lda.z p + cmp #round::@3] + // [69] phi (byte) round::I#3 = (byte) 2 [phi:round::@1->round::@3#0] -- vbuxx=vbuc1 + ldx #2 + // round::@3 + __b3: + // while (I < SQRT_COUNT) + // [70] if((byte) round::I#3<(const byte) SQRT_COUNT) goto round::@4 -- vbuxx_lt_vbuc1_then_la1 + cpx #SQRT_COUNT + bcc __b4 + // round::@return + // } + // [71] return + rts + // round::@4 + __b4: + // if (Sieve[I] == 0) + // [72] if(*((const byte*) Sieve + (byte) round::I#3)!=(byte) 0) goto round::@5 -- pbuc1_derefidx_vbuxx_neq_0_then_la1 + lda Sieve,x + cmp #0 + bne __b5 + // round::@8 + // I<<1 + // [73] (byte~) round::$4 ← (byte) round::I#3 << (byte) 1 -- vbuaa=vbuxx_rol_1 + txa + asl + // S = Sieve + I<<1 + // [74] (byte*) round::S#1 ← (const byte*) Sieve + (byte~) round::$4 -- pbuz1=pbuc1_plus_vbuaa + clc + adc #Sieve + adc #0 + sta.z S+1 + // [75] phi from round::@7 round::@8 to round::@6 [phi:round::@7/round::@8->round::@6] + // [75] phi (byte*) round::S#3 = (byte*) round::S#2 [phi:round::@7/round::@8->round::@6#0] -- register_copy + // round::@6 + __b6: + // while (S < Sieve + COUNT) + // [76] if((byte*) round::S#3<(const byte*) Sieve+(const word) COUNT) goto round::@7 -- pbuz1_lt_pbuc1_then_la1 + lda.z S+1 + cmp #>Sieve+COUNT + bcc __b7 + bne !+ + lda.z S + cmp #round::@3] + // [69] phi (byte) round::I#3 = (byte) round::I#2 [phi:round::@5->round::@3#0] -- register_copy + jmp __b3 + // round::@7 + __b7: + // *S = 1 + // [78] *((byte*) round::S#3) ← (byte) 1 -- _deref_pbuz1=vbuc1 + lda #1 + ldy #0 + sta (S),y + // S += I + // [79] (byte*) round::S#2 ← (byte*) round::S#3 + (byte) round::I#3 -- pbuz1=pbuz1_plus_vbuxx + txa + clc + adc.z S + sta.z S + bcc !+ + inc.z S+1 + !: + jmp __b6 + // round::@2 + __b2: + // *p = 0 + // [80] *((byte*) round::p#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + lda #0 + tay + sta (p),y + // for(char* p=Sieve;pround::@1] + // [67] phi (byte*) round::p#2 = (byte*) round::p#1 [phi:round::@2->round::@1#0] -- register_copy + jmp __b1 +} + // File Data + print_hextab: .text "0123456789abcdef" + .align $100 + Sieve: .fill COUNT, 0 + diff --git a/src/test/ref/millfork-benchmarks/sieve-kc.sym b/src/test/ref/millfork-benchmarks/sieve-kc.sym new file mode 100644 index 000000000..1d26e6dda --- /dev/null +++ b/src/test/ref/millfork-benchmarks/sieve-kc.sym @@ -0,0 +1,109 @@ +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(const word) COUNT = (number) $4000 +(const byte) RADIX::BINARY = (number) 2 +(const byte) RADIX::DECIMAL = (number) $a +(const byte) RADIX::HEXADECIMAL = (number) $10 +(const byte) RADIX::OCTAL = (number) 8 +(const byte) SQRT_COUNT = (number) $80 +(const byte*) Sieve = { fill( COUNT, 0) } +(word) Ticks +(word) Ticks#1 Ticks zp[2]:10 2.0 +(word) Ticks#2 Ticks_1 zp[2]:12 4.0 +(void()) end() +(label) end::@1 +(label) end::@2 +(label) end::@return +(word) last_time +(word) last_time#0 last_time zp[2]:6 0.21428571428571427 +(word) last_time#1 last_time zp[2]:6 1.0 +(word) last_time#2 last_time zp[2]:6 20.0 +(signed word()) main() +(label) main::@1 +(label) main::@10 +(label) main::@11 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 +(label) main::@8 +(label) main::@9 +(label) main::@return +(signed word) main::return +(void()) print_byte((byte) print_byte::b) +(byte~) print_byte::$0 reg byte a 4.0 +(byte~) print_byte::$2 reg byte x 4.0 +(label) print_byte::@1 +(label) print_byte::@return +(byte) print_byte::b +(byte) print_byte::b#0 reg byte x 4.0 +(byte) print_byte::b#1 reg byte x 4.0 +(byte) print_byte::b#2 reg byte x 2.0 +(void()) print_char((byte) print_char::ch) +(label) print_char::@return +(byte) print_char::ch +(byte) print_char::ch#0 reg byte a 4.0 +(byte) print_char::ch#1 reg byte a 4.0 +(byte) print_char::ch#2 reg byte a 6.0 +(byte*) print_char_cursor +(byte*) print_char_cursor#10 print_char_cursor zp[2]:4 1.0 +(byte*) print_char_cursor#25 print_char_cursor zp[2]:4 4.0 +(byte*) print_char_cursor#35 print_char_cursor zp[2]:4 1.3333333333333333 +(const byte*) print_hextab = (string) "0123456789abcdef"z +(byte*) print_line_cursor +(byte*) print_line_cursor#1 print_line_cursor zp[2]:2 16.5 +(byte*) print_line_cursor#8 print_line_cursor zp[2]:2 22.0 +(void()) print_ln() +(label) print_ln::@1 +(label) print_ln::@return +(byte*) print_screen +(void()) print_word((word) print_word::w) +(label) print_word::@1 +(label) print_word::@return +(word) print_word::w +(word) print_word::w#0 w zp[2]:12 2.0 +(word) rand_seed +(word) rand_seed#0 rand_seed zp[2]:8 20.0 +(word) rand_seed#20 rand_seed zp[2]:8 20.0 +(void()) round() +(byte~) round::$4 reg byte a 22.0 +(label) round::@1 +(label) round::@2 +(label) round::@3 +(label) round::@4 +(label) round::@5 +(label) round::@6 +(label) round::@7 +(label) round::@8 +(label) round::@return +(byte) round::I +(byte) round::I#2 reg byte x 22.0 +(byte) round::I#3 reg byte x 17.333333333333332 +(byte*) round::S +(byte*) round::S#1 S zp[2]:4 22.0 +(byte*) round::S#2 S zp[2]:4 202.0 +(byte*) round::S#3 S zp[2]:4 138.33333333333331 +(byte*) round::p +(byte*) round::p#1 p zp[2]:2 22.0 +(byte*) round::p#2 p zp[2]:2 14.666666666666666 +(void()) start() +(label) start::@return +(const word*) start::LAST_TIME = &(word) last_time + +reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] +reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +zp[2]:2 [ round::p#2 round::p#1 print_line_cursor#8 print_line_cursor#1 ] +reg byte x [ round::I#3 round::I#2 ] +zp[2]:4 [ round::S#3 round::S#2 round::S#1 print_char_cursor#25 print_char_cursor#35 print_char_cursor#10 ] +zp[2]:6 [ last_time#0 last_time#1 last_time#2 ] +zp[2]:8 [ rand_seed#0 rand_seed#20 ] +zp[2]:10 [ Ticks#1 ] +zp[2]:12 [ Ticks#2 print_word::w#0 ] +reg byte a [ print_byte::$0 ] +reg byte x [ print_byte::$2 ] +reg byte a [ round::$4 ]