mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-06 13:31:05 +00:00
Adding Millfork Benchmarks to test suite.
This commit is contained in:
parent
4479efb22d
commit
7707e64ad8
@ -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");
|
||||
|
@ -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;
|
||||
}
|
149
src/test/kc/millfork-benchmarks/plasma-kc.kc
Normal file
149
src/test/kc/millfork-benchmarks/plasma-kc.kc
Normal file
@ -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;
|
||||
}
|
40
src/test/kc/millfork-benchmarks/romsum-kc.kc
Normal file
40
src/test/kc/millfork-benchmarks/romsum-kc.kc
Normal file
@ -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;
|
||||
}
|
48
src/test/kc/millfork-benchmarks/sieve-kc.kc
Normal file
48
src/test/kc/millfork-benchmarks/sieve-kc.kc
Normal file
@ -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<Sieve+COUNT;++p)
|
||||
*p = 0;
|
||||
I = 2;
|
||||
while (I < SQRT_COUNT) {
|
||||
if (Sieve[I] == 0) {
|
||||
/* Prime number - mark multiples */
|
||||
S = Sieve + I<<1;
|
||||
while (S < Sieve + COUNT) {
|
||||
*S = 1;
|
||||
S += I;
|
||||
}
|
||||
}
|
||||
++I;
|
||||
}
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
start();
|
||||
|
||||
round();
|
||||
round();
|
||||
round();
|
||||
round();
|
||||
round();
|
||||
|
||||
round();
|
||||
round();
|
||||
round();
|
||||
round();
|
||||
round();
|
||||
|
||||
end();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
378
src/test/ref/millfork-benchmarks/plasma-kc.asm
Normal file
378
src/test/ref/millfork-benchmarks/plasma-kc.asm
Normal file
@ -0,0 +1,378 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(__b1)
|
||||
.pc = $80d "Program"
|
||||
.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
|
||||
__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
|
||||
lda #>SCREEN1
|
||||
sta.z doplasma.scrn+1
|
||||
jsr doplasma
|
||||
lda #PAGE1
|
||||
sta VIC_MEMORY
|
||||
lda #<SCREEN2
|
||||
sta.z doplasma.scrn
|
||||
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
|
||||
lda.z __10+1
|
||||
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
|
251
src/test/ref/millfork-benchmarks/plasma-kc.cfg
Normal file
251
src/test/ref/millfork-benchmarks/plasma-kc.cfg
Normal file
@ -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
|
5156
src/test/ref/millfork-benchmarks/plasma-kc.log
Normal file
5156
src/test/ref/millfork-benchmarks/plasma-kc.log
Normal file
File diff suppressed because one or more lines are too long
204
src/test/ref/millfork-benchmarks/plasma-kc.sym
Normal file
204
src/test/ref/millfork-benchmarks/plasma-kc.sym
Normal file
@ -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 ]
|
335
src/test/ref/millfork-benchmarks/romsum-kc.asm
Normal file
335
src/test/ref/millfork-benchmarks/romsum-kc.asm
Normal file
@ -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
|
||||
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
|
||||
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
|
||||
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
|
257
src/test/ref/millfork-benchmarks/romsum-kc.cfg
Normal file
257
src/test/ref/millfork-benchmarks/romsum-kc.cfg
Normal file
@ -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
|
4736
src/test/ref/millfork-benchmarks/romsum-kc.log
Normal file
4736
src/test/ref/millfork-benchmarks/romsum-kc.log
Normal file
File diff suppressed because it is too large
Load Diff
185
src/test/ref/millfork-benchmarks/romsum-kc.sym
Normal file
185
src/test/ref/millfork-benchmarks/romsum-kc.sym
Normal file
@ -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 ]
|
204
src/test/ref/millfork-benchmarks/sieve-kc.asm
Normal file
204
src/test/ref/millfork-benchmarks/sieve-kc.asm
Normal file
@ -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
|
||||
lda #>Sieve
|
||||
sta.z p+1
|
||||
__b1:
|
||||
lda.z p+1
|
||||
cmp #>Sieve+COUNT
|
||||
bcc __b2
|
||||
bne !+
|
||||
lda.z p
|
||||
cmp #<Sieve+COUNT
|
||||
bcc __b2
|
||||
!:
|
||||
ldx #2
|
||||
__b3:
|
||||
cpx #SQRT_COUNT
|
||||
bcc __b4
|
||||
rts
|
||||
__b4:
|
||||
lda Sieve,x
|
||||
cmp #0
|
||||
bne __b5
|
||||
txa
|
||||
asl
|
||||
clc
|
||||
adc #<Sieve
|
||||
sta.z S
|
||||
lda #>Sieve
|
||||
adc #0
|
||||
sta.z S+1
|
||||
__b6:
|
||||
lda.z S+1
|
||||
cmp #>Sieve+COUNT
|
||||
bcc __b7
|
||||
bne !+
|
||||
lda.z S
|
||||
cmp #<Sieve+COUNT
|
||||
bcc __b7
|
||||
!:
|
||||
__b5:
|
||||
inx
|
||||
jmp __b3
|
||||
__b7:
|
||||
lda #1
|
||||
ldy #0
|
||||
sta (S),y
|
||||
txa
|
||||
clc
|
||||
adc.z S
|
||||
sta.z S
|
||||
bcc !+
|
||||
inc.z S+1
|
||||
!:
|
||||
jmp __b6
|
||||
__b2:
|
||||
lda #0
|
||||
tay
|
||||
sta (p),y
|
||||
inc.z p
|
||||
bne !+
|
||||
inc.z p+1
|
||||
!:
|
||||
jmp __b1
|
||||
}
|
||||
print_hextab: .text "0123456789abcdef"
|
||||
.align $100
|
||||
Sieve: .fill COUNT, 0
|
189
src/test/ref/millfork-benchmarks/sieve-kc.cfg
Normal file
189
src/test/ref/millfork-benchmarks/sieve-kc.cfg
Normal file
@ -0,0 +1,189 @@
|
||||
@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
|
3014
src/test/ref/millfork-benchmarks/sieve-kc.log
Normal file
3014
src/test/ref/millfork-benchmarks/sieve-kc.log
Normal file
File diff suppressed because it is too large
Load Diff
109
src/test/ref/millfork-benchmarks/sieve-kc.sym
Normal file
109
src/test/ref/millfork-benchmarks/sieve-kc.sym
Normal file
@ -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 ]
|
Loading…
x
Reference in New Issue
Block a user