1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-27 19:50:10 +00:00

Added missing word fragments. Added test of unsigned word comparisons.

This commit is contained in:
jespergravgaard 2019-03-09 14:24:51 +01:00
parent c59f18eb82
commit cb8018b92a
15 changed files with 6265 additions and 0 deletions

View File

@ -0,0 +1,5 @@
lda {c1},x
bne !+
dec {c1}+1,x
!:
dec {c1},x

View File

@ -0,0 +1,7 @@
sec
lda {c1},y
sbc #$01
sta {c1},y
lda {c1}+1,y
sbc #$00
sta {c1}+1,y

View File

@ -0,0 +1,7 @@
sec
lda {c1},x
sbc #<{c2}
sta {z1}
lda {c1}+1,x
sbc #>{c2}
sta {z1}+1

View File

@ -0,0 +1,7 @@
sec
lda {c1},y
sbc #<{c2}
sta {z1}
lda {c1}+1,y
sbc #>{c2}
sta {z1}+1

View File

@ -0,0 +1,8 @@
lda {z1}+1
bne !+
lda {z1}
beq !e+
lsr
!:
bpl {la1}
!e:

View File

@ -0,0 +1,9 @@
lda {z1}+1
bmi {la1}
cmp #>{c1}
bcc {la1}
bne !+
lda {z1}
cmp #<{c1}
bcc {la1}
!:

View File

@ -0,0 +1,6 @@
lda #{c1}
bmi {la1}
cmp {z1}
bcc {la1}
lda {z1}+1
bne {la1}

View File

@ -0,0 +1,8 @@
lda {z1}+1
cmp {z2}+1
bne !+
lda {z1}
cmp {z2}
!:
bcc {la1}
beq {la1}

View File

@ -233,6 +233,14 @@ class AsmFragmentTemplateSynthesisRule {
mapSToU.put("pwsc1", "pwuc1");
mapSToU.put("pwsc2", "pwuc2");
mapSToU.put("pwsc3", "pwuc3");
Map<String, String> mapZ2Swap = new LinkedHashMap<>();
mapZ2Swap.put("z2", "zn");
mapZ2Swap.put("z1", "z2");
mapZ2Swap.put("zn", "z1");
Map<String, String> mapZ3Swap = new LinkedHashMap<>();
mapZ3Swap.put("z3", "zn");
mapZ3Swap.put("z2", "z3");
mapZ3Swap.put("zn", "z2");
// AA/XX/YY/Z1 is an RValue
String rvalAa = ".*=.*aa.*|.*_.*aa.*|...aa_(lt|gt|le|ge|eq|neq)_.*";
@ -379,6 +387,11 @@ class AsmFragmentTemplateSynthesisRule {
// Replace Z3 with XX (only one)
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z3(.*)", lvalZ3+"|"+twoZ3+"|"+rvalXx, "ldx {z3}", "$1xx$2", null, mapZ4));
// Correct wrong ordered Z2/Z1
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z2(.*)z1(.*)", null, null, "$1z1$2z2$3", null, mapZ2Swap, false));
// Correct wrong ordered Z3/Z2
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z3(.*)z2(.*)", null, null, "$1z2$2z3$3", null, mapZ3Swap, false));
// Rewrite comparisons < to >
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_gt_(.*)_then_(.*)", null, null, "$2_lt_$1_then_$3", null, null));
// Rewrite comparisons > to <

View File

@ -44,6 +44,12 @@ public class TestPrograms {
AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false);
}
@Test
public void testComparisonsWord() throws IOException, URISyntaxException {
compileAndCompare("test-comparisons-word");
}
@Test
public void testDuplicateLoopProblem() throws IOException, URISyntaxException {
compileAndCompare("duplicate-loop-problem");

View File

@ -0,0 +1,64 @@
import "c64"
import "print"
word[] words = { $0012, $3f34, $cfed };
void main() {
print_cls();
byte ln = 0;
for( byte i: 0..2) {
word w1 = words[i<<1];
for( byte j: 0..2) {
word w2 = words[j<<1];
for( byte op: 0..5 ) {
if(ln<50) {
compare(w1,w2,op);
if((++ln & 1) == 0) print_ln();
}
}
}
}
// loop forever
while(true) {}
}
// Compare two words using an operator
void compare(word w1, word w2, byte op) {
byte r = '-';
byte* ops;
if(op==0) {
// LESS THAN
if(w1<w2) r = '+';
ops = "< @";
} else if(op==1) {
// LESS THAN EQUAL
if(w1<=w2) r = '+';
ops = "<=@";
} else if(op==2) {
// GREATER THAN
if(w1>w2) r = '+';
ops = "> @";
} else if(op==3) {
// GREATER THAN EQUAL
if(w1>=w2) r = '+';
ops = ">=@";
} else if(op==4) {
// EQUAL
if(w1==w2) r = '+';
ops = "==@";
} else if(op==5) {
// NOT EQUAL
if(w1!=w2) r = '+';
ops = "!=@";
}
print_word(w1);
print_str(" @");
print_str(ops);
print_str(" @");
print_word(w2);
print_str(" @");
print_char(r);
print_str(" @");
}

View File

@ -0,0 +1,387 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label print_char_cursor = $c
.label print_line_cursor = 5
main: {
.label w1 = $f
.label w2 = $11
.label ln = 4
.label j = 3
.label i = 2
jsr print_cls
lda #<$400
sta print_line_cursor
lda #>$400
sta print_line_cursor+1
lda #<$400
sta print_char_cursor
lda #>$400
sta print_char_cursor+1
lda #0
sta ln
sta i
b1:
lda i
asl
tay
lda words,y
sta w1
lda words+1,y
sta w1+1
lda #0
sta j
b2:
lda j
asl
tay
lda words,y
sta w2
lda words+1,y
sta w2+1
ldx #0
b3:
lda ln
cmp #$32
bcs b4
lda w1
sta compare.w1
lda w1+1
sta compare.w1+1
jsr compare
inc ln
lda #1
and ln
cmp #0
bne b4
jsr print_ln
lda print_line_cursor
sta print_char_cursor
lda print_line_cursor+1
sta print_char_cursor+1
b4:
inx
cpx #6
bne b3
inc j
lda j
cmp #3
bne b2
inc i
lda i
cmp #3
bne b1
b7:
jmp b7
}
// Print a newline
print_ln: {
b1:
lda print_line_cursor
clc
adc #$28
sta print_line_cursor
bcc !+
inc print_line_cursor+1
!:
lda print_line_cursor+1
cmp print_char_cursor+1
bcc b1
bne !+
lda print_line_cursor
cmp print_char_cursor
bcc b1
!:
rts
}
// Compare two words using an operator
// compare(word zeropage($a) w1, word zeropage($11) w2, byte register(X) op)
compare: {
.label w1 = $a
.label w2 = $11
.label ops = 7
.label r = 9
cpx #0
bne !b1+
jmp b1
!b1:
cpx #1
bne !b2+
jmp b2
!b2:
cpx #2
bne !b3+
jmp b3
!b3:
cpx #3
bne !b4+
jmp b4
!b4:
cpx #4
bne !b5+
jmp b5
!b5:
cpx #5
bne b8
lda w1
cmp w2
bne !+
lda w1+1
cmp w2+1
beq b6
!:
lda #'+'
sta r
jmp b7
b6:
lda #'-'
sta r
b7:
lda #<ops_1
sta ops
lda #>ops_1
sta ops+1
jmp b16
b8:
lda #'-'
sta r
lda #<0
sta ops
sta ops+1
b16:
jsr print_word
lda #<str
sta print_str.str
lda #>str
sta print_str.str+1
jsr print_str
lda ops
sta print_str.str
lda ops+1
sta print_str.str+1
jsr print_str
lda #<str
sta print_str.str
lda #>str
sta print_str.str+1
jsr print_str
lda w2
sta print_word.w
lda w2+1
sta print_word.w+1
jsr print_word
lda #<str
sta print_str.str
lda #>str
sta print_str.str+1
jsr print_str
lda r
jsr print_char
lda #<str
sta print_str.str
lda #>str
sta print_str.str+1
jsr print_str
rts
b5:
lda w1+1
cmp w2+1
bne b10
lda w1
cmp w2
bne b10
lda #'+'
sta r
jmp b9
b10:
lda #'-'
sta r
b9:
lda #<ops_2
sta ops
lda #>ops_2
sta ops+1
jmp b16
b4:
lda w1+1
cmp w2+1
bcc b12
bne !+
lda w1
cmp w2
bcc b12
!:
lda #'+'
sta r
jmp b11
b12:
lda #'-'
sta r
b11:
lda #<ops_3
sta ops
lda #>ops_3
sta ops+1
jmp b16
b3:
lda w1+1
cmp w2+1
bne !+
lda w1
cmp w2
!:
bcc b14
beq b14
lda #'+'
sta r
jmp b13
b14:
lda #'-'
sta r
b13:
lda #<ops_4
sta ops
lda #>ops_4
sta ops+1
jmp b16
b2:
lda w2+1
cmp w1+1
bcc b18
bne !+
lda w2
cmp w1
bcc b18
!:
lda #'+'
sta r
jmp b15
b18:
lda #'-'
sta r
b15:
lda #<ops_5
sta ops
lda #>ops_5
sta ops+1
jmp b16
b1:
lda w2+1
cmp w1+1
bne !+
lda w2
cmp w1
!:
bcc b19
beq b19
lda #'+'
sta r
jmp b17
b19:
lda #'-'
sta r
b17:
lda #<ops_6
sta ops
lda #>ops_6
sta ops+1
jmp b16
str: .text " @"
ops_1: .text "!=@"
ops_2: .text "==@"
ops_3: .text ">=@"
ops_4: .text "> @"
ops_5: .text "<=@"
ops_6: .text "< @"
}
// Print a zero-terminated string
// print_str(byte* zeropage($a) str)
print_str: {
.label str = $a
b1:
ldy #0
lda (str),y
cmp #'@'
bne b2
rts
b2:
ldy #0
lda (str),y
sta (print_char_cursor),y
inc print_char_cursor
bne !+
inc print_char_cursor+1
!:
inc str
bne !+
inc str+1
!:
jmp b1
}
// Print a single char
// print_char(byte register(A) ch)
print_char: {
ldy #0
sta (print_char_cursor),y
inc print_char_cursor
bne !+
inc print_char_cursor+1
!:
rts
}
// Print a word as HEX
// print_word(word zeropage($a) w)
print_word: {
.label w = $a
lda w+1
sta print_byte.b
jsr print_byte
lda w
sta print_byte.b
jsr print_byte
rts
}
// Print a byte as HEX
// print_byte(byte zeropage($e) b)
print_byte: {
.label b = $e
lda b
lsr
lsr
lsr
lsr
tay
lda print_hextab,y
jsr print_char
lda #$f
and b
tay
lda print_hextab,y
jsr print_char
rts
}
// Clear the screen. Also resets current line/char cursor.
print_cls: {
.label sc = 5
lda #<$400
sta sc
lda #>$400
sta sc+1
b1:
lda #' '
ldy #0
sta (sc),y
inc sc
bne !+
inc sc+1
!:
lda sc+1
cmp #>$400+$3e8
bne b1
lda sc
cmp #<$400+$3e8
bne b1
rts
}
print_hextab: .text "0123456789abcdef"
words: .word $12, $3f34, $cfed

View File

@ -0,0 +1,256 @@
@begin: scope:[] from
[0] phi()
to:@25
@25: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @25
[3] phi()
main: scope:[main] from @25
[4] phi()
[5] call print_cls
to:main::@1
main::@1: scope:[main] from main main::@12
[6] (byte*) print_line_cursor#33 ← phi( main::@12/(byte*) print_line_cursor#23 main/((byte*))(word/signed word/dword/signed dword) $400 )
[6] (byte*) print_char_cursor#95 ← phi( main::@12/(byte*) print_char_cursor#68 main/((byte*))(word/signed word/dword/signed dword) $400 )
[6] (byte) main::ln#7 ← phi( main::@12/(byte) main::ln#11 main/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[6] (byte) main::i#2 ← phi( main::@12/(byte) main::i#1 main/(byte/signed byte/word/signed word/dword/signed dword) 0 )
[7] (byte~) main::$1 ← (byte) main::i#2 << (byte/signed byte/word/signed word/dword/signed dword) 1
[8] (word) main::w1#0 ← *((const word[]) words#0 + (byte~) main::$1)
to:main::@2
main::@2: scope:[main] from main::@1 main::@11
[9] (byte*) print_line_cursor#31 ← phi( main::@1/(byte*) print_line_cursor#33 main::@11/(byte*) print_line_cursor#23 )
[9] (byte*) print_char_cursor#79 ← phi( main::@1/(byte*) print_char_cursor#95 main::@11/(byte*) print_char_cursor#68 )
[9] (byte) main::ln#4 ← phi( main::@1/(byte) main::ln#7 main::@11/(byte) main::ln#11 )
[9] (byte) main::j#2 ← phi( main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@11/(byte) main::j#1 )
[10] (byte~) main::$2 ← (byte) main::j#2 << (byte/signed byte/word/signed word/dword/signed dword) 1
[11] (word) main::w2#0 ← *((const word[]) words#0 + (byte~) main::$2)
to:main::@3
main::@3: scope:[main] from main::@2 main::@4
[12] (byte*) print_line_cursor#19 ← phi( main::@2/(byte*) print_line_cursor#31 main::@4/(byte*) print_line_cursor#23 )
[12] (byte*) print_char_cursor#61 ← phi( main::@2/(byte*) print_char_cursor#79 main::@4/(byte*) print_char_cursor#68 )
[12] (byte) main::op#2 ← phi( main::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@4/(byte) main::op#1 )
[12] (byte) main::ln#2 ← phi( main::@2/(byte) main::ln#4 main::@4/(byte) main::ln#11 )
[13] if((byte) main::ln#2>=(byte/signed byte/word/signed word/dword/signed dword) $32) goto main::@4
to:main::@9
main::@9: scope:[main] from main::@3
[14] (word) compare::w1#0 ← (word) main::w1#0
[15] (word) compare::w2#0 ← (word) main::w2#0
[16] (byte) compare::op#0 ← (byte) main::op#2
[17] call compare
to:main::@18
main::@18: scope:[main] from main::@9
[18] (byte) main::ln#1 ← ++ (byte) main::ln#2
[19] (byte~) main::$6 ← (byte) main::ln#1 & (byte/signed byte/word/signed word/dword/signed dword) 1
[20] if((byte~) main::$6!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@4
to:main::@10
main::@10: scope:[main] from main::@18
[21] phi()
[22] call print_ln
[23] (byte*~) print_char_cursor#107 ← (byte*) print_line_cursor#1
to:main::@4
main::@4: scope:[main] from main::@10 main::@18 main::@3
[24] (byte*) print_line_cursor#23 ← phi( main::@10/(byte*) print_line_cursor#1 main::@3/(byte*) print_line_cursor#19 main::@18/(byte*) print_line_cursor#19 )
[24] (byte*) print_char_cursor#68 ← phi( main::@10/(byte*~) print_char_cursor#107 main::@3/(byte*) print_char_cursor#61 main::@18/(byte*) print_char_cursor#2 )
[24] (byte) main::ln#11 ← phi( main::@10/(byte) main::ln#1 main::@3/(byte) main::ln#2 main::@18/(byte) main::ln#1 )
[25] (byte) main::op#1 ← ++ (byte) main::op#2
[26] if((byte) main::op#1!=(byte/signed byte/word/signed word/dword/signed dword) 6) goto main::@3
to:main::@11
main::@11: scope:[main] from main::@4
[27] (byte) main::j#1 ← ++ (byte) main::j#2
[28] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@2
to:main::@12
main::@12: scope:[main] from main::@11
[29] (byte) main::i#1 ← ++ (byte) main::i#2
[30] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@1
to:main::@7
main::@7: scope:[main] from main::@12 main::@7
[31] phi()
to:main::@7
print_ln: scope:[print_ln] from main::@10
[32] phi()
to:print_ln::@1
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
[33] (byte*) print_line_cursor#9 ← phi( print_ln/(byte*) print_line_cursor#19 print_ln::@1/(byte*) print_line_cursor#1 )
[34] (byte*) print_line_cursor#1 ← (byte*) print_line_cursor#9 + (byte/signed byte/word/signed word/dword/signed dword) $28
[35] if((byte*) print_line_cursor#1<(byte*) print_char_cursor#2) goto print_ln::@1
to:print_ln::@return
print_ln::@return: scope:[print_ln] from print_ln::@1
[36] return
to:@return
compare: scope:[compare] from main::@9
[37] if((byte) compare::op#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto compare::@1
to:compare::@18
compare::@18: scope:[compare] from compare
[38] if((byte) compare::op#0==(byte/signed byte/word/signed word/dword/signed dword) 1) goto compare::@2
to:compare::@19
compare::@19: scope:[compare] from compare::@18
[39] if((byte) compare::op#0==(byte/signed byte/word/signed word/dword/signed dword) 2) goto compare::@3
to:compare::@20
compare::@20: scope:[compare] from compare::@19
[40] if((byte) compare::op#0==(byte/signed byte/word/signed word/dword/signed dword) 3) goto compare::@4
to:compare::@21
compare::@21: scope:[compare] from compare::@20
[41] if((byte) compare::op#0==(byte/signed byte/word/signed word/dword/signed dword) 4) goto compare::@5
to:compare::@22
compare::@22: scope:[compare] from compare::@21
[42] if((byte) compare::op#0!=(byte/signed byte/word/signed word/dword/signed dword) 5) goto compare::@16
to:compare::@23
compare::@23: scope:[compare] from compare::@22
[43] if((word) compare::w1#0==(word) compare::w2#0) goto compare::@7
to:compare::@24
compare::@24: scope:[compare] from compare::@23
[44] phi()
to:compare::@7
compare::@7: scope:[compare] from compare::@23 compare::@24
[45] (byte) compare::r#19 ← phi( compare::@23/(byte) '-' compare::@24/(byte) '+' )
to:compare::@16
compare::@16: scope:[compare] from compare::@11 compare::@13 compare::@15 compare::@17 compare::@22 compare::@7 compare::@9
[46] (byte) compare::r#10 ← phi( compare::@11/(byte) compare::r#14 compare::@13/(byte) compare::r#15 compare::@15/(byte) compare::r#16 compare::@17/(byte) compare::r#17 compare::@22/(byte) '-' compare::@7/(byte) compare::r#19 compare::@9/(byte) compare::r#20 )
[46] (byte*) compare::ops#7 ← phi( compare::@11/(const byte*) compare::ops#3 compare::@13/(const byte*) compare::ops#4 compare::@15/(const byte*) compare::ops#5 compare::@17/(const byte*) compare::ops#6 compare::@22/(byte*) 0 compare::@7/(const byte*) compare::ops#1 compare::@9/(const byte*) compare::ops#2 )
[47] (word) print_word::w#0 ← (word) compare::w1#0
[48] call print_word
to:compare::@35
compare::@35: scope:[compare] from compare::@16
[49] phi()
[50] call print_str
to:compare::@36
compare::@36: scope:[compare] from compare::@35
[51] (byte*) print_str::str#2 ← (byte*) compare::ops#7
[52] call print_str
to:compare::@37
compare::@37: scope:[compare] from compare::@36
[53] phi()
[54] call print_str
to:compare::@38
compare::@38: scope:[compare] from compare::@37
[55] (word) print_word::w#1 ← (word) compare::w2#0
[56] call print_word
to:compare::@39
compare::@39: scope:[compare] from compare::@38
[57] phi()
[58] call print_str
to:compare::@40
compare::@40: scope:[compare] from compare::@39
[59] (byte) print_char::ch#2 ← (byte) compare::r#10
[60] call print_char
to:compare::@41
compare::@41: scope:[compare] from compare::@40
[61] phi()
[62] call print_str
to:compare::@return
compare::@return: scope:[compare] from compare::@41
[63] return
to:@return
compare::@5: scope:[compare] from compare::@21
[64] if((word) compare::w1#0!=(word) compare::w2#0) goto compare::@9
to:compare::@26
compare::@26: scope:[compare] from compare::@5
[65] phi()
to:compare::@9
compare::@9: scope:[compare] from compare::@26 compare::@5
[66] (byte) compare::r#20 ← phi( compare::@26/(byte) '+' compare::@5/(byte) '-' )
to:compare::@16
compare::@4: scope:[compare] from compare::@20
[67] if((word) compare::w1#0<(word) compare::w2#0) goto compare::@11
to:compare::@28
compare::@28: scope:[compare] from compare::@4
[68] phi()
to:compare::@11
compare::@11: scope:[compare] from compare::@28 compare::@4
[69] (byte) compare::r#14 ← phi( compare::@28/(byte) '+' compare::@4/(byte) '-' )
to:compare::@16
compare::@3: scope:[compare] from compare::@19
[70] if((word) compare::w1#0<=(word) compare::w2#0) goto compare::@13
to:compare::@30
compare::@30: scope:[compare] from compare::@3
[71] phi()
to:compare::@13
compare::@13: scope:[compare] from compare::@3 compare::@30
[72] (byte) compare::r#15 ← phi( compare::@3/(byte) '-' compare::@30/(byte) '+' )
to:compare::@16
compare::@2: scope:[compare] from compare::@18
[73] if((word) compare::w1#0>(word) compare::w2#0) goto compare::@15
to:compare::@32
compare::@32: scope:[compare] from compare::@2
[74] phi()
to:compare::@15
compare::@15: scope:[compare] from compare::@2 compare::@32
[75] (byte) compare::r#16 ← phi( compare::@2/(byte) '-' compare::@32/(byte) '+' )
to:compare::@16
compare::@1: scope:[compare] from compare
[76] if((word) compare::w1#0>=(word) compare::w2#0) goto compare::@17
to:compare::@34
compare::@34: scope:[compare] from compare::@1
[77] phi()
to:compare::@17
compare::@17: scope:[compare] from compare::@1 compare::@34
[78] (byte) compare::r#17 ← phi( compare::@1/(byte) '-' compare::@34/(byte) '+' )
to:compare::@16
print_str: scope:[print_str] from compare::@35 compare::@36 compare::@37 compare::@39 compare::@41
[79] (byte*) print_char_cursor#66 ← phi( compare::@35/(byte*) print_char_cursor#11 compare::@36/(byte*) print_char_cursor#2 compare::@37/(byte*) print_char_cursor#2 compare::@39/(byte*) print_char_cursor#11 compare::@41/(byte*) print_char_cursor#11 )
[79] (byte*) print_str::str#8 ← phi( compare::@35/(const string) compare::str compare::@36/(byte*) print_str::str#2 compare::@37/(const string) compare::str compare::@39/(const string) compare::str compare::@41/(const string) compare::str )
to:print_str::@1
print_str::@1: scope:[print_str] from print_str print_str::@2
[80] (byte*) print_char_cursor#2 ← phi( print_str/(byte*) print_char_cursor#66 print_str::@2/(byte*) print_char_cursor#1 )
[80] (byte*) print_str::str#6 ← phi( print_str/(byte*) print_str::str#8 print_str::@2/(byte*) print_str::str#0 )
[81] if(*((byte*) print_str::str#6)!=(byte) '@') goto print_str::@2
to:print_str::@return
print_str::@return: scope:[print_str] from print_str::@1
[82] return
to:@return
print_str::@2: scope:[print_str] from print_str::@1
[83] *((byte*) print_char_cursor#2) ← *((byte*) print_str::str#6)
[84] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#2
[85] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#6
to:print_str::@1
print_char: scope:[print_char] from compare::@40 print_byte print_byte::@1
[86] (byte*) print_char_cursor#39 ← phi( compare::@40/(byte*) print_char_cursor#2 print_byte/(byte*) print_char_cursor#59 print_byte::@1/(byte*) print_char_cursor#11 )
[86] (byte) print_char::ch#3 ← phi( compare::@40/(byte) print_char::ch#2 print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 )
[87] *((byte*) print_char_cursor#39) ← (byte) print_char::ch#3
[88] (byte*) print_char_cursor#11 ← ++ (byte*) print_char_cursor#39
to:print_char::@return
print_char::@return: scope:[print_char] from print_char
[89] return
to:@return
print_word: scope:[print_word] from compare::@16 compare::@38
[90] (byte*) print_char_cursor#58 ← phi( compare::@16/(byte*) print_char_cursor#61 compare::@38/(byte*) print_char_cursor#2 )
[90] (word) print_word::w#2 ← phi( compare::@16/(word) print_word::w#0 compare::@38/(word) print_word::w#1 )
[91] (byte) print_byte::b#0 ← > (word) print_word::w#2
[92] call print_byte
to:print_word::@1
print_word::@1: scope:[print_word] from print_word
[93] (byte) print_byte::b#1 ← < (word) print_word::w#2
[94] call print_byte
to:print_word::@return
print_word::@return: scope:[print_word] from print_word::@1
[95] return
to:@return
print_byte: scope:[print_byte] from print_word print_word::@1
[96] (byte*) print_char_cursor#59 ← phi( print_word/(byte*) print_char_cursor#58 print_word::@1/(byte*) print_char_cursor#11 )
[96] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 )
[97] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4
[98] (byte) print_char::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$0)
[99] call print_char
to:print_byte::@1
print_byte::@1: scope:[print_byte] from print_byte
[100] (byte~) print_byte::$2 ← (byte) print_byte::b#2 & (byte/signed byte/word/signed word/dword/signed dword) $f
[101] (byte) print_char::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte::$2)
[102] call print_char
to:print_byte::@return
print_byte::@return: scope:[print_byte] from print_byte::@1
[103] return
to:@return
print_cls: scope:[print_cls] from main
[104] phi()
to:print_cls::@1
print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
[105] (byte*) print_cls::sc#2 ← phi( print_cls/((byte*))(word/signed word/dword/signed dword) $400 print_cls::@1/(byte*) print_cls::sc#1 )
[106] *((byte*) print_cls::sc#2) ← (byte) ' '
[107] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2
[108] if((byte*) print_cls::sc#1!=((byte*))(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1
to:print_cls::@return
print_cls::@return: scope:[print_cls] from print_cls::@1
[109] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,257 @@
(label) @25
(label) @begin
(label) @end
(byte*) BGCOL
(byte*) BGCOL1
(byte*) BGCOL2
(byte*) BGCOL3
(byte*) BGCOL4
(byte) BLACK
(byte) BLUE
(byte*) BORDERCOL
(byte) BROWN
(byte*) CHARGEN
(byte*) CIA1_INTERRUPT
(byte*) CIA1_PORT_A
(byte*) CIA1_PORT_A_DDR
(byte*) CIA1_PORT_B
(byte*) CIA1_PORT_B_DDR
(byte*) CIA2_INTERRUPT
(byte*) CIA2_PORT_A
(byte*) CIA2_PORT_A_DDR
(byte*) CIA2_PORT_B
(byte*) CIA2_PORT_B_DDR
(byte) CIA_INTERRUPT_CLEAR
(byte*) COLS
(byte) CYAN
(byte*) D011
(byte*) D016
(byte*) D018
(byte) DARK_GREY
(byte) GREEN
(byte) GREY
(void()**) HARDWARE_IRQ
(byte) IRQ_COLLISION_BG
(byte) IRQ_COLLISION_SPRITE
(byte*) IRQ_ENABLE
(byte) IRQ_LIGHTPEN
(byte) IRQ_RASTER
(byte*) IRQ_STATUS
(void()**) KERNEL_IRQ
(byte*) LIGHTPEN_X
(byte*) LIGHTPEN_Y
(byte) LIGHT_BLUE
(byte) LIGHT_GREEN
(byte) LIGHT_GREY
(byte) ORANGE
(byte) PINK
(byte*) PROCPORT
(byte) PROCPORT_BASIC_KERNEL_IO
(byte*) PROCPORT_DDR
(byte) PROCPORT_DDR_MEMORY_MASK
(byte) PROCPORT_KERNEL_IO
(byte) PROCPORT_RAM_ALL
(byte) PROCPORT_RAM_CHARROM
(byte) PROCPORT_RAM_IO
(byte) PURPLE
(byte*) RASTER
(byte) RED
(byte*) SPRITES_COLS
(byte*) SPRITES_ENABLE
(byte*) SPRITES_EXPAND_X
(byte*) SPRITES_EXPAND_Y
(byte*) SPRITES_MC
(byte*) SPRITES_MC1
(byte*) SPRITES_MC2
(byte*) SPRITES_PRIORITY
(byte*) SPRITES_XMSB
(byte*) SPRITES_XPOS
(byte*) SPRITES_YPOS
(word) SPRITE_PTRS
(byte) VIC_BMM
(byte*) VIC_CONTROL
(byte*) VIC_CONTROL2
(byte) VIC_CSEL
(byte) VIC_DEN
(byte) VIC_ECM
(byte) VIC_MCM
(byte*) VIC_MEMORY
(byte) VIC_RSEL
(byte) VIC_RST8
(byte) WHITE
(byte) YELLOW
(void()) compare((word) compare::w1 , (word) compare::w2 , (byte) compare::op)
(label) compare::@1
(label) compare::@11
(label) compare::@13
(label) compare::@15
(label) compare::@16
(label) compare::@17
(label) compare::@18
(label) compare::@19
(label) compare::@2
(label) compare::@20
(label) compare::@21
(label) compare::@22
(label) compare::@23
(label) compare::@24
(label) compare::@26
(label) compare::@28
(label) compare::@3
(label) compare::@30
(label) compare::@32
(label) compare::@34
(label) compare::@35
(label) compare::@36
(label) compare::@37
(label) compare::@38
(label) compare::@39
(label) compare::@4
(label) compare::@40
(label) compare::@41
(label) compare::@5
(label) compare::@7
(label) compare::@9
(label) compare::@return
(byte) compare::op
(byte) compare::op#0 reg byte x 168.8333333333334
(byte*) compare::ops
(const byte*) compare::ops#1 ops#1 = (string) "!=@"
(const byte*) compare::ops#2 ops#2 = (string) "==@"
(const byte*) compare::ops#3 ops#3 = (string) ">=@"
(const byte*) compare::ops#4 ops#4 = (string) "> @"
(const byte*) compare::ops#5 ops#5 = (string) "<=@"
(const byte*) compare::ops#6 ops#6 = (string) "< @"
(byte*) compare::ops#7 ops zp ZP_WORD:7 0.4
(byte) compare::r
(byte) compare::r#10 r zp ZP_BYTE:9 1.076923076923077
(byte) compare::r#14 r zp ZP_BYTE:9 2.0
(byte) compare::r#15 r zp ZP_BYTE:9 2.0
(byte) compare::r#16 r zp ZP_BYTE:9 2.0
(byte) compare::r#17 r zp ZP_BYTE:9 2.0
(byte) compare::r#19 r zp ZP_BYTE:9 2.0
(byte) compare::r#20 r zp ZP_BYTE:9 2.0
(const string) compare::str str = (string) " @"
(word) compare::w1
(word) compare::w1#0 w1 zp ZP_WORD:10 36.249999999999986
(word) compare::w2
(word) compare::w2#0 w2 zp ZP_WORD:17 29.0
(void()) main()
(byte~) main::$1 reg byte a 22.0
(byte~) main::$2 reg byte a 202.0
(byte~) main::$6 reg byte a 2002.0
(label) main::@1
(label) main::@10
(label) main::@11
(label) main::@12
(label) main::@18
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@7
(label) main::@9
(byte) main::i
(byte) main::i#1 i zp ZP_BYTE:2 16.5
(byte) main::i#2 i zp ZP_BYTE:2 1.4347826086956523
(byte) main::j
(byte) main::j#1 j zp ZP_BYTE:3 151.5
(byte) main::j#2 j zp ZP_BYTE:3 16.833333333333332
(byte) main::ln
(byte) main::ln#1 ln zp ZP_BYTE:4 667.3333333333334
(byte) main::ln#11 ln zp ZP_BYTE:4 588.0
(byte) main::ln#2 ln zp ZP_BYTE:4 684.1666666666667
(byte) main::ln#4 ln zp ZP_BYTE:4 71.0
(byte) main::ln#7 ln zp ZP_BYTE:4 7.333333333333333
(byte) main::op
(byte) main::op#1 reg byte x 1501.5
(byte) main::op#2 reg byte x 231.0
(word) main::w1
(word) main::w1#0 w1 zp ZP_WORD:15 48.19047619047619
(word) main::w2
(word) main::w2#0 w2 zp ZP_WORD:17 68.875
(void()) print_byte((byte) print_byte::b)
(byte~) print_byte::$0 reg byte a 4.0
(byte~) print_byte::$2 reg byte a 4.0
(label) print_byte::@1
(label) print_byte::@return
(byte) print_byte::b
(byte) print_byte::b#0 b zp ZP_BYTE:14 4.0
(byte) print_byte::b#1 b zp ZP_BYTE:14 4.0
(byte) print_byte::b#2 b zp ZP_BYTE:14 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 4.0
(byte) print_char::ch#3 reg byte a 8.0
(byte*) print_char_cursor
(byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:12 10001.0
(byte*~) print_char_cursor#107 print_char_cursor zp ZP_WORD:12 2002.0
(byte*) print_char_cursor#11 print_char_cursor zp ZP_WORD:12 0.7058823529411765
(byte*) print_char_cursor#2 print_char_cursor zp ZP_WORD:12 1783.2608695652177
(byte*) print_char_cursor#39 print_char_cursor zp ZP_WORD:12 5.0
(byte*) print_char_cursor#58 print_char_cursor zp ZP_WORD:12 3.0
(byte*) print_char_cursor#59 print_char_cursor zp ZP_WORD:12 2.0
(byte*) print_char_cursor#61 print_char_cursor zp ZP_WORD:12 67.90322580645162
(byte*) print_char_cursor#66 print_char_cursor zp ZP_WORD:12 12.0
(byte*) print_char_cursor#68 print_char_cursor zp ZP_WORD:12 588.0
(byte*) print_char_cursor#79 print_char_cursor zp ZP_WORD:12 71.0
(byte*) print_char_cursor#95 print_char_cursor zp ZP_WORD:12 7.333333333333333
(void()) print_cls()
(label) print_cls::@1
(label) print_cls::@return
(byte*) print_cls::sc
(byte*) print_cls::sc#1 sc zp ZP_WORD:5 16.5
(byte*) print_cls::sc#2 sc zp ZP_WORD:5 16.5
(byte[]) print_hextab
(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef"
(byte*) print_line_cursor
(byte*) print_line_cursor#1 print_line_cursor zp ZP_WORD:5 6401.0
(byte*) print_line_cursor#19 print_line_cursor zp ZP_WORD:5 282.3636363636364
(byte*) print_line_cursor#23 print_line_cursor zp ZP_WORD:5 588.0
(byte*) print_line_cursor#31 print_line_cursor zp ZP_WORD:5 71.0
(byte*) print_line_cursor#33 print_line_cursor zp ZP_WORD:5 7.333333333333333
(byte*) print_line_cursor#9 print_line_cursor zp ZP_WORD:5 20004.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 ZP_WORD:10 20002.0
(byte*) print_str::str#2 str zp ZP_WORD:10 4.0
(byte*) print_str::str#6 str zp ZP_WORD:10 10001.5
(byte*) print_str::str#8 str zp ZP_WORD:10 4.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 ZP_WORD:10 4.0
(word) print_word::w#1 w zp ZP_WORD:10 4.0
(word) print_word::w#2 w zp ZP_WORD:10 2.6666666666666665
(word[]) words
(const word[]) words#0 words = { (byte/signed byte/word/signed word/dword/signed dword) $12, (word/signed word/dword/signed dword) $3f34, (word/dword/signed dword) $cfed }
zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
zp ZP_BYTE:4 [ main::ln#2 main::ln#4 main::ln#7 main::ln#11 main::ln#1 ]
reg byte x [ main::op#2 main::op#1 ]
zp ZP_WORD:5 [ print_line_cursor#9 print_line_cursor#19 print_line_cursor#31 print_line_cursor#33 print_line_cursor#23 print_line_cursor#1 print_cls::sc#2 print_cls::sc#1 ]
zp ZP_WORD:7 [ compare::ops#7 ]
zp ZP_BYTE:9 [ compare::r#10 compare::r#14 compare::r#15 compare::r#16 compare::r#17 compare::r#19 compare::r#20 ]
zp ZP_WORD:10 [ print_str::str#6 print_str::str#8 print_str::str#2 print_str::str#0 print_word::w#2 print_word::w#0 print_word::w#1 compare::w1#0 ]
reg byte a [ print_char::ch#3 print_char::ch#2 print_char::ch#0 print_char::ch#1 ]
zp ZP_WORD:12 [ print_char_cursor#58 print_char_cursor#39 print_char_cursor#66 print_char_cursor#11 print_char_cursor#61 print_char_cursor#79 print_char_cursor#95 print_char_cursor#68 print_char_cursor#107 print_char_cursor#2 print_char_cursor#1 print_char_cursor#59 ]
zp ZP_BYTE:14 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
reg byte a [ main::$1 ]
zp ZP_WORD:15 [ main::w1#0 ]
reg byte a [ main::$2 ]
zp ZP_WORD:17 [ main::w2#0 compare::w2#0 ]
reg byte x [ compare::op#0 ]
reg byte a [ main::$6 ]
reg byte a [ print_byte::$0 ]
reg byte a [ print_byte::$2 ]