From e02f3bc2e0f0d89841bf3f64d7f9c5e0a7090fe1 Mon Sep 17 00:00:00 2001 From: Jesper Gravgaard Date: Sat, 29 Jun 2019 11:10:16 +0200 Subject: [PATCH] Added circular clear atan2 test --- src/main/kc/stdlib/atan2.kc | 2 +- .../dk/camelot64/kickc/test/TestPrograms.java | 5 + src/test/kc/cordic-atan2-clear.kc | 37 + src/test/ref/cordic-atan2-clear.asm | 392 ++ src/test/ref/cordic-atan2-clear.cfg | 191 + src/test/ref/cordic-atan2-clear.log | 4264 +++++++++++++++++ src/test/ref/cordic-atan2-clear.sym | 191 + 7 files changed, 5081 insertions(+), 1 deletion(-) create mode 100644 src/test/kc/cordic-atan2-clear.kc create mode 100644 src/test/ref/cordic-atan2-clear.asm create mode 100644 src/test/ref/cordic-atan2-clear.cfg create mode 100644 src/test/ref/cordic-atan2-clear.log create mode 100644 src/test/ref/cordic-atan2-clear.sym diff --git a/src/main/kc/stdlib/atan2.kc b/src/main/kc/stdlib/atan2.kc index 754a122e3..6f5f0c986 100644 --- a/src/main/kc/stdlib/atan2.kc +++ b/src/main/kc/stdlib/atan2.kc @@ -10,7 +10,7 @@ word* CORDIC_ATAN2_ANGLES_16 = 0x1000; // Populate cordic angles table kickasm(pc CORDIC_ATAN2_ANGLES_16, uses CORDIC_ITERATIONS_16) {{ .for (var i=0; i(angle_w+0x0080); + *screen++ = ang_w; + } + } +} diff --git a/src/test/ref/cordic-atan2-clear.asm b/src/test/ref/cordic-atan2-clear.asm new file mode 100644 index 000000000..e879e896f --- /dev/null +++ b/src/test/ref/cordic-atan2-clear.asm @@ -0,0 +1,392 @@ +// Find atan2(x, y) using the CORDIC method +// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + // The number of iterations performed during 16-bit CORDIC atan2 calculation + .const CORDIC_ITERATIONS_16 = $f + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + .label CORDIC_ATAN2_ANGLES_16 = $1000 + // The number of iterations performed during 8-bit CORDIC atan2 calculation + .const CORDIC_ITERATIONS_8 = 8 + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + .label CORDIC_ATAN2_ANGLES_8 = $1100 + .label RASTER = $d012 + .label D018 = $d018 + .label CHARSET = $2000 + .label SCREEN = $2800 +// Populate cordic angles table +// Populate cordic angles table +main: { + .const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f + .label clear_char = 2 + jsr init_font_hex + lda #toD0181_return + sta D018 + jsr init_screen + lda #CHARSET + sta clear_char+1 + b2: + lda #$ff + cmp RASTER + bne b2 + lda clear_char+1 + cmp #>CHARSET+$800 + bcc !+ + bne b2 + lda clear_char + cmp #SCREEN + sta screen+1 + lda #-$c + sta y + b1: + ldx #-$13 + b2: + ldy #0 + txa + sta xw+1 + sty xw + lda y + sta yw+1 + sty yw + jsr atan2_16 + lda #$80 + clc + adc _7 + sta _7 + bcc !+ + inc _7+1 + !: + lda _7+1 + ldy #0 + sta (screen),y + inc screen + bne !+ + inc screen+1 + !: + inx + cpx #$15 + bne b2 + inc y + lda #$d + cmp y + bne b1 + rts +} +// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y) +// Finding the angle requires a binary search using CORDIC_ITERATIONS_16 +// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI) +// atan2_16(signed word zeropage($17) x, signed word zeropage($19) y) +atan2_16: { + .label _2 = 7 + .label _7 = 9 + .label yi = 7 + .label xi = 9 + .label xd = $1b + .label yd = $1d + .label angle = $c + .label i = $b + .label return = $c + .label x = $17 + .label y = $19 + lda y+1 + bne !+ + lda y + beq !e+ + lsr + !: + bmi !b1+ + jmp b1 + !b1: + !e: + sec + lda #0 + sbc y + sta _2 + lda #0 + sbc y+1 + sta _2+1 + b3: + lda x+1 + bne !+ + lda x + beq !e+ + lsr + !: + bmi !b4+ + jmp b4 + !b4: + !e: + sec + lda #0 + sbc x + sta _7 + lda #0 + sbc x+1 + sta _7+1 + b6: + lda #0 + sta angle + sta angle+1 + sta i + b10: + lda yi+1 + bne b11 + lda yi + bne b11 + b12: + lsr angle+1 + ror angle + lda x+1 + bpl b7 + sec + lda #<$8000 + sbc angle + sta angle + lda #>$8000 + sbc angle+1 + sta angle+1 + b7: + lda y+1 + bpl b8 + sec + lda #0 + sbc angle + sta angle + lda #0 + sbc angle+1 + sta angle+1 + b8: + rts + b11: + ldy i + lda xi + sta xd + lda xi+1 + sta xd+1 + cpy #0 + beq !e+ + !: + lda xd+1 + cmp #$80 + ror xd+1 + ror xd + dey + bne !- + !e: + ldy i + lda yi + sta yd + lda yi+1 + sta yd+1 + cpy #0 + beq !e+ + !: + lda yd+1 + cmp #$80 + ror yd+1 + ror yd + dey + bne !- + !e: + lda yi+1 + bne !+ + lda yi + beq !e+ + lsr + !: + bpl b13 + !e: + lda xi + sec + sbc yd + sta xi + lda xi+1 + sbc yd+1 + sta xi+1 + lda yi + clc + adc xd + sta yi + lda yi+1 + adc xd+1 + sta yi+1 + lda i + asl + tay + sec + lda angle + sbc CORDIC_ATAN2_ANGLES_16,y + sta angle + lda angle+1 + sbc CORDIC_ATAN2_ANGLES_16+1,y + sta angle+1 + b14: + inc i + lda #CORDIC_ITERATIONS_16-1+1 + cmp i + bne !b12+ + jmp b12 + !b12: + jmp b10 + b13: + lda xi + clc + adc yd + sta xi + lda xi+1 + adc yd+1 + sta xi+1 + lda yi + sec + sbc xd + sta yi + lda yi+1 + sbc xd+1 + sta yi+1 + lda i + asl + tay + clc + lda angle + adc CORDIC_ATAN2_ANGLES_16,y + sta angle + lda angle+1 + adc CORDIC_ATAN2_ANGLES_16+1,y + sta angle+1 + jmp b14 + b4: + lda x + sta xi + lda x+1 + sta xi+1 + jmp b6 + b1: + lda y + sta yi + lda y+1 + sta yi+1 + jmp b3 +} +// Make charset from proto chars +// init_font_hex(byte* zeropage($11) charset) +init_font_hex: { + .label _0 = $1f + .label idx = $16 + .label proto_lo = $13 + .label charset = $11 + .label c1 = $15 + .label proto_hi = $e + .label c = $10 + lda #0 + sta c + lda #FONT_HEX_PROTO + sta proto_hi+1 + lda #CHARSET + sta charset+1 + b1: + lda #0 + sta c1 + lda #FONT_HEX_PROTO + sta proto_lo+1 + b2: + lda #0 + tay + sta (charset),y + lda #1 + sta idx + ldx #0 + b3: + txa + tay + lda (proto_hi),y + asl + asl + asl + asl + sta _0 + txa + tay + lda (proto_lo),y + asl + ora _0 + ldy idx + sta (charset),y + inc idx + inx + cpx #5 + bne b3 + lda #0 + ldy idx + sta (charset),y + iny + sta (charset),y + lda #5 + clc + adc proto_lo + sta proto_lo + bcc !+ + inc proto_lo+1 + !: + lda #8 + clc + adc charset + sta charset + bcc !+ + inc charset+1 + !: + inc c1 + lda #$10 + cmp c1 + bne b2 + lda #5 + clc + adc proto_hi + sta proto_hi + bcc !+ + inc proto_hi+1 + !: + inc c + lda #$10 + cmp c + bne b1 + rts +} + // Bit patterns for symbols 0-f (3x5 pixels) used in font hex + FONT_HEX_PROTO: .byte 2, 5, 5, 5, 2, 6, 2, 2, 2, 7, 6, 1, 2, 4, 7, 6, 1, 2, 1, 6, 5, 5, 7, 1, 1, 7, 4, 6, 1, 6, 3, 4, 6, 5, 2, 7, 1, 1, 1, 1, 2, 5, 2, 5, 2, 2, 5, 3, 1, 1, 2, 5, 7, 5, 5, 6, 5, 6, 5, 6, 2, 5, 4, 5, 2, 6, 5, 5, 5, 6, 7, 4, 6, 4, 7, 7, 4, 6, 4, 4 +.pc = CORDIC_ATAN2_ANGLES_16 "CORDIC_ATAN2_ANGLES_16" + .for (var i=0; i=(const byte*) CHARSET#0+(word) $800) goto main::@1 + to:main::@4 +main::@4: scope:[main] from main::@3 + [14] *((byte*) main::clear_char#5) ← (byte) 0 + [15] (byte*) main::clear_char#1 ← ++ (byte*) main::clear_char#5 + to:main::@1 +init_screen: scope:[init_screen] from main::@5 + [16] phi() + to:init_screen::@1 +init_screen::@1: scope:[init_screen] from init_screen init_screen::@3 + [17] (byte*) init_screen::screen#4 ← phi( init_screen/(const byte*) SCREEN#0 init_screen::@3/(byte*) init_screen::screen#1 ) + [17] (signed byte) init_screen::y#4 ← phi( init_screen/(signed byte) -$c init_screen::@3/(signed byte) init_screen::y#1 ) + to:init_screen::@2 +init_screen::@2: scope:[init_screen] from init_screen::@1 init_screen::@4 + [18] (byte*) init_screen::screen#2 ← phi( init_screen::@1/(byte*) init_screen::screen#4 init_screen::@4/(byte*) init_screen::screen#1 ) + [18] (signed byte) init_screen::x#2 ← phi( init_screen::@1/(signed byte) -$13 init_screen::@4/(signed byte) init_screen::x#1 ) + [19] (word) init_screen::xw#0 ← (byte)(signed byte) init_screen::x#2 w= (byte) 0 + [20] (word) init_screen::yw#0 ← (byte)(signed byte) init_screen::y#4 w= (byte) 0 + [21] (signed word) atan2_16::x#0 ← (signed word)(word) init_screen::xw#0 + [22] (signed word) atan2_16::y#0 ← (signed word)(word) init_screen::yw#0 + [23] call atan2_16 + [24] (word) atan2_16::return#2 ← (word) atan2_16::return#0 + to:init_screen::@4 +init_screen::@4: scope:[init_screen] from init_screen::@2 + [25] (word) init_screen::angle_w#0 ← (word) atan2_16::return#2 + [26] (word~) init_screen::$7 ← (word) init_screen::angle_w#0 + (byte) $80 + [27] (byte) init_screen::ang_w#0 ← > (word~) init_screen::$7 + [28] *((byte*) init_screen::screen#2) ← (byte) init_screen::ang_w#0 + [29] (byte*) init_screen::screen#1 ← ++ (byte*) init_screen::screen#2 + [30] (signed byte) init_screen::x#1 ← ++ (signed byte) init_screen::x#2 + [31] if((signed byte) init_screen::x#1!=(signed byte) $15) goto init_screen::@2 + to:init_screen::@3 +init_screen::@3: scope:[init_screen] from init_screen::@4 + [32] (signed byte) init_screen::y#1 ← ++ (signed byte) init_screen::y#4 + [33] if((signed byte) init_screen::y#1!=(signed byte) $d) goto init_screen::@1 + to:init_screen::@return +init_screen::@return: scope:[init_screen] from init_screen::@3 + [34] return + to:@return +atan2_16: scope:[atan2_16] from init_screen::@2 + [35] if((signed word) atan2_16::y#0>(signed byte) 0) goto atan2_16::@1 + to:atan2_16::@2 +atan2_16::@2: scope:[atan2_16] from atan2_16 + [36] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 + to:atan2_16::@3 +atan2_16::@3: scope:[atan2_16] from atan2_16::@1 atan2_16::@2 + [37] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word~) atan2_16::yi#11 atan2_16::@2/(signed word~) atan2_16::$2 ) + [38] if((signed word) atan2_16::x#0>(signed byte) 0) goto atan2_16::@4 + to:atan2_16::@5 +atan2_16::@5: scope:[atan2_16] from atan2_16::@3 + [39] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 + to:atan2_16::@6 +atan2_16::@6: scope:[atan2_16] from atan2_16::@4 atan2_16::@5 + [40] (signed word) atan2_16::xi#0 ← phi( atan2_16::@4/(signed word~) atan2_16::xi#8 atan2_16::@5/(signed word~) atan2_16::$7 ) + to:atan2_16::@10 +atan2_16::@10: scope:[atan2_16] from atan2_16::@14 atan2_16::@6 + [41] (word) atan2_16::angle#12 ← phi( atan2_16::@14/(word) atan2_16::angle#13 atan2_16::@6/(byte) 0 ) + [41] (byte) atan2_16::i#2 ← phi( atan2_16::@14/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 ) + [41] (signed word) atan2_16::xi#3 ← phi( atan2_16::@14/(signed word) atan2_16::xi#7 atan2_16::@6/(signed word) atan2_16::xi#0 ) + [41] (signed word) atan2_16::yi#3 ← phi( atan2_16::@14/(signed word) atan2_16::yi#7 atan2_16::@6/(signed word) atan2_16::yi#0 ) + [42] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 + to:atan2_16::@12 +atan2_16::@12: scope:[atan2_16] from atan2_16::@10 atan2_16::@14 + [43] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@14/(word) atan2_16::angle#13 ) + [44] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 + [45] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 + to:atan2_16::@16 +atan2_16::@16: scope:[atan2_16] from atan2_16::@12 + [46] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 + to:atan2_16::@7 +atan2_16::@7: scope:[atan2_16] from atan2_16::@12 atan2_16::@16 + [47] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@16/(word) atan2_16::angle#4 ) + [48] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 + to:atan2_16::@9 +atan2_16::@9: scope:[atan2_16] from atan2_16::@7 + [49] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 + to:atan2_16::@8 +atan2_16::@8: scope:[atan2_16] from atan2_16::@7 atan2_16::@9 + [50] (word) atan2_16::return#0 ← phi( atan2_16::@9/(word) atan2_16::angle#5 atan2_16::@7/(word) atan2_16::angle#11 ) + to:atan2_16::@return +atan2_16::@return: scope:[atan2_16] from atan2_16::@8 + [51] return + to:@return +atan2_16::@11: scope:[atan2_16] from atan2_16::@10 + [52] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 + [53] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 + [54] if((signed word) atan2_16::yi#3>(signed byte) 0) goto atan2_16::@13 + to:atan2_16::@15 +atan2_16::@15: scope:[atan2_16] from atan2_16::@11 + [55] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 + [56] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 + [57] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 + [58] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) + to:atan2_16::@14 +atan2_16::@14: scope:[atan2_16] from atan2_16::@13 atan2_16::@15 + [59] (signed word) atan2_16::xi#7 ← phi( atan2_16::@13/(signed word) atan2_16::xi#1 atan2_16::@15/(signed word) atan2_16::xi#2 ) + [59] (word) atan2_16::angle#13 ← phi( atan2_16::@13/(word) atan2_16::angle#2 atan2_16::@15/(word) atan2_16::angle#3 ) + [59] (signed word) atan2_16::yi#7 ← phi( atan2_16::@13/(signed word) atan2_16::yi#1 atan2_16::@15/(signed word) atan2_16::yi#2 ) + [60] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 + [61] if((byte) atan2_16::i#1==(const byte) CORDIC_ITERATIONS_16#0-(byte) 1+(byte) 1) goto atan2_16::@12 + to:atan2_16::@10 +atan2_16::@13: scope:[atan2_16] from atan2_16::@11 + [62] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 + [63] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 + [64] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 + [65] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) + to:atan2_16::@14 +atan2_16::@4: scope:[atan2_16] from atan2_16::@3 + [66] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 + to:atan2_16::@6 +atan2_16::@1: scope:[atan2_16] from atan2_16 + [67] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 + to:atan2_16::@3 +init_font_hex: scope:[init_font_hex] from main + [68] phi() + to:init_font_hex::@1 +init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5 + [69] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 ) + [69] (byte*) init_font_hex::proto_hi#6 ← phi( init_font_hex/(const byte[]) FONT_HEX_PROTO#0 init_font_hex::@5/(byte*) init_font_hex::proto_hi#1 ) + [69] (byte*) init_font_hex::charset#5 ← phi( init_font_hex/(const byte*) CHARSET#0 init_font_hex::@5/(byte*) init_font_hex::charset#0 ) + to:init_font_hex::@2 +init_font_hex::@2: scope:[init_font_hex] from init_font_hex::@1 init_font_hex::@4 + [70] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 ) + [70] (byte*) init_font_hex::proto_lo#4 ← phi( init_font_hex::@1/(const byte[]) FONT_HEX_PROTO#0 init_font_hex::@4/(byte*) init_font_hex::proto_lo#1 ) + [70] (byte*) init_font_hex::charset#2 ← phi( init_font_hex::@1/(byte*) init_font_hex::charset#5 init_font_hex::@4/(byte*) init_font_hex::charset#0 ) + [71] *((byte*) init_font_hex::charset#2) ← (byte) 0 + to:init_font_hex::@3 +init_font_hex::@3: scope:[init_font_hex] from init_font_hex::@2 init_font_hex::@3 + [72] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 ) + [72] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 ) + [73] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 + [74] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 + [75] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 + [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 + [77] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 + [78] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 + [79] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 + to:init_font_hex::@4 +init_font_hex::@4: scope:[init_font_hex] from init_font_hex::@3 + [80] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 + [81] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 + [82] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 + [83] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 + [84] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 + [85] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 + [86] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 + to:init_font_hex::@5 +init_font_hex::@5: scope:[init_font_hex] from init_font_hex::@4 + [87] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 + [88] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 + [89] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 + to:init_font_hex::@return +init_font_hex::@return: scope:[init_font_hex] from init_font_hex::@5 + [90] return + to:@return diff --git a/src/test/ref/cordic-atan2-clear.log b/src/test/ref/cordic-atan2-clear.log new file mode 100644 index 000000000..211c76ab4 --- /dev/null +++ b/src/test/ref/cordic-atan2-clear.log @@ -0,0 +1,4264 @@ +Resolved forward reference FONT_HEX_PROTO to (byte[]) FONT_HEX_PROTO +Resolved forward reference FONT_HEX_PROTO to (byte[]) FONT_HEX_PROTO +Adding pointer type conversion cast (word*) CORDIC_ATAN2_ANGLES_16 in (word*) CORDIC_ATAN2_ANGLES_16 ← (number) $1000 +Adding pointer type conversion cast (byte*) CORDIC_ATAN2_ANGLES_8 in (byte*) CORDIC_ATAN2_ANGLES_8 ← (number) $1100 +Adding pointer type conversion cast (byte*) PROCPORT_DDR in (byte*) PROCPORT_DDR ← (number) 0 +Adding pointer type conversion cast (byte*) PROCPORT in (byte*) PROCPORT ← (number) 1 +Adding pointer type conversion cast (byte*) CHARGEN in (byte*) CHARGEN ← (number) $d000 +Adding pointer type conversion cast (byte*) SPRITES_XPOS in (byte*) SPRITES_XPOS ← (number) $d000 +Adding pointer type conversion cast (byte*) SPRITES_YPOS in (byte*) SPRITES_YPOS ← (number) $d001 +Adding pointer type conversion cast (byte*) SPRITES_XMSB in (byte*) SPRITES_XMSB ← (number) $d010 +Adding pointer type conversion cast (byte*) RASTER in (byte*) RASTER ← (number) $d012 +Adding pointer type conversion cast (byte*) SPRITES_ENABLE in (byte*) SPRITES_ENABLE ← (number) $d015 +Adding pointer type conversion cast (byte*) SPRITES_EXPAND_Y in (byte*) SPRITES_EXPAND_Y ← (number) $d017 +Adding pointer type conversion cast (byte*) SPRITES_PRIORITY in (byte*) SPRITES_PRIORITY ← (number) $d01b +Adding pointer type conversion cast (byte*) SPRITES_MC in (byte*) SPRITES_MC ← (number) $d01c +Adding pointer type conversion cast (byte*) SPRITES_EXPAND_X in (byte*) SPRITES_EXPAND_X ← (number) $d01d +Adding pointer type conversion cast (byte*) BORDERCOL in (byte*) BORDERCOL ← (number) $d020 +Adding pointer type conversion cast (byte*) BGCOL in (byte*) BGCOL ← (number) $d021 +Adding pointer type conversion cast (byte*) BGCOL1 in (byte*) BGCOL1 ← (number) $d021 +Adding pointer type conversion cast (byte*) BGCOL2 in (byte*) BGCOL2 ← (number) $d022 +Adding pointer type conversion cast (byte*) BGCOL3 in (byte*) BGCOL3 ← (number) $d023 +Adding pointer type conversion cast (byte*) BGCOL4 in (byte*) BGCOL4 ← (number) $d024 +Adding pointer type conversion cast (byte*) SPRITES_MC1 in (byte*) SPRITES_MC1 ← (number) $d025 +Adding pointer type conversion cast (byte*) SPRITES_MC2 in (byte*) SPRITES_MC2 ← (number) $d026 +Adding pointer type conversion cast (byte*) SPRITES_COLS in (byte*) SPRITES_COLS ← (number) $d027 +Adding pointer type conversion cast (byte*) VIC_CONTROL in (byte*) VIC_CONTROL ← (number) $d011 +Adding pointer type conversion cast (byte*) D011 in (byte*) D011 ← (number) $d011 +Adding pointer type conversion cast (byte*) VIC_CONTROL2 in (byte*) VIC_CONTROL2 ← (number) $d016 +Adding pointer type conversion cast (byte*) D016 in (byte*) D016 ← (number) $d016 +Adding pointer type conversion cast (byte*) D018 in (byte*) D018 ← (number) $d018 +Adding pointer type conversion cast (byte*) VIC_MEMORY in (byte*) VIC_MEMORY ← (number) $d018 +Adding pointer type conversion cast (byte*) LIGHTPEN_X in (byte*) LIGHTPEN_X ← (number) $d013 +Adding pointer type conversion cast (byte*) LIGHTPEN_Y in (byte*) LIGHTPEN_Y ← (number) $d014 +Adding pointer type conversion cast (byte*) IRQ_STATUS in (byte*) IRQ_STATUS ← (number) $d019 +Adding pointer type conversion cast (byte*) IRQ_ENABLE in (byte*) IRQ_ENABLE ← (number) $d01a +Adding pointer type conversion cast (byte*) COLS in (byte*) COLS ← (number) $d800 +Adding pointer type conversion cast (byte*) CIA1_PORT_A in (byte*) CIA1_PORT_A ← (number) $dc00 +Adding pointer type conversion cast (byte*) CIA1_PORT_B in (byte*) CIA1_PORT_B ← (number) $dc01 +Adding pointer type conversion cast (byte*) CIA1_PORT_A_DDR in (byte*) CIA1_PORT_A_DDR ← (number) $dc02 +Adding pointer type conversion cast (byte*) CIA1_PORT_B_DDR in (byte*) CIA1_PORT_B_DDR ← (number) $dc03 +Adding pointer type conversion cast (byte*) CIA1_INTERRUPT in (byte*) CIA1_INTERRUPT ← (number) $dc0d +Adding pointer type conversion cast (byte*) CIA2_PORT_A in (byte*) CIA2_PORT_A ← (number) $dd00 +Adding pointer type conversion cast (byte*) CIA2_PORT_B in (byte*) CIA2_PORT_B ← (number) $dd01 +Adding pointer type conversion cast (byte*) CIA2_PORT_A_DDR in (byte*) CIA2_PORT_A_DDR ← (number) $dd02 +Adding pointer type conversion cast (byte*) CIA2_PORT_B_DDR in (byte*) CIA2_PORT_B_DDR ← (number) $dd03 +Adding pointer type conversion cast (byte*) CIA2_INTERRUPT in (byte*) CIA2_INTERRUPT ← (number) $dd0d +Adding pointer type conversion cast (void()**) KERNEL_IRQ in (void()**) KERNEL_IRQ ← (number) $314 +Adding pointer type conversion cast (void()**) HARDWARE_IRQ in (void()**) HARDWARE_IRQ ← (number) $fffe +Adding pointer type conversion cast (byte*) CHARSET in (byte*) CHARSET ← (number) $2000 +Adding pointer type conversion cast (byte*) SCREEN in (byte*) SCREEN ← (number) $2800 +Fixing pointer array-indexing *((word*) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i) +Fixing pointer array-indexing *((word*) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i) +Identified constant variable (word*) CORDIC_ATAN2_ANGLES_16 +Identified constant variable (byte*) CORDIC_ATAN2_ANGLES_8 +Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx +Inlined call (byte~) main::$1 ← call toD018 (byte*) SCREEN (byte*) CHARSET +Culled Empty Block (label) init_font_hex::@6 +Culled Empty Block (label) atan2_16::@9 +Culled Empty Block (label) atan2_16::@10 +Culled Empty Block (label) atan2_16::@11 +Culled Empty Block (label) atan2_16::@12 +Culled Empty Block (label) atan2_16::@20 +Culled Empty Block (label) atan2_16::@21 +Culled Empty Block (label) atan2_16::@23 +Culled Empty Block (label) atan2_16::@24 +Culled Empty Block (label) atan2_16::@14 +Culled Empty Block (label) @4 +Culled Empty Block (label) @5 +Culled Empty Block (label) @6 +Culled Empty Block (label) main::toD0181_@1 +Culled Empty Block (label) main::@2 +Culled Empty Block (label) main::@8 +Culled Empty Block (label) main::@3 +Culled Empty Block (label) main::@9 +Culled Empty Block (label) main::@7 +Culled Empty Block (label) main::@10 +Culled Empty Block (label) @8 +Culled Empty Block (label) init_screen::@4 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@1 +init_font_hex: scope:[init_font_hex] from main + (byte*) init_font_hex::charset#6 ← phi( main/(byte*) init_font_hex::charset#1 ) + (byte*) init_font_hex::proto_hi#0 ← (byte[]) FONT_HEX_PROTO#0 + (byte) init_font_hex::c#0 ← (byte) 0 + to:init_font_hex::@1 +init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5 + (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) init_font_hex::c#0 init_font_hex::@5/(byte) init_font_hex::c#1 ) + (byte*) init_font_hex::proto_hi#6 ← phi( init_font_hex/(byte*) init_font_hex::proto_hi#0 init_font_hex::@5/(byte*) init_font_hex::proto_hi#1 ) + (byte*) init_font_hex::charset#5 ← phi( init_font_hex/(byte*) init_font_hex::charset#6 init_font_hex::@5/(byte*) init_font_hex::charset#7 ) + (byte*) init_font_hex::proto_lo#0 ← (byte[]) FONT_HEX_PROTO#0 + (byte) init_font_hex::c1#0 ← (byte) 0 + to:init_font_hex::@2 +init_font_hex::@2: scope:[init_font_hex] from init_font_hex::@1 init_font_hex::@4 + (byte) init_font_hex::c#5 ← phi( init_font_hex::@1/(byte) init_font_hex::c#6 init_font_hex::@4/(byte) init_font_hex::c#3 ) + (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) init_font_hex::c1#0 init_font_hex::@4/(byte) init_font_hex::c1#1 ) + (byte*) init_font_hex::proto_lo#4 ← phi( init_font_hex::@1/(byte*) init_font_hex::proto_lo#0 init_font_hex::@4/(byte*) init_font_hex::proto_lo#1 ) + (byte*) init_font_hex::proto_hi#4 ← phi( init_font_hex::@1/(byte*) init_font_hex::proto_hi#6 init_font_hex::@4/(byte*) init_font_hex::proto_hi#5 ) + (byte*) init_font_hex::charset#2 ← phi( init_font_hex::@1/(byte*) init_font_hex::charset#5 init_font_hex::@4/(byte*) init_font_hex::charset#0 ) + (byte) init_font_hex::idx#0 ← (number) 0 + *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#0) ← (number) 0 + (byte) init_font_hex::idx#1 ← ++ (byte) init_font_hex::idx#0 + (byte) init_font_hex::i#0 ← (byte) 0 + to:init_font_hex::@3 +init_font_hex::@3: scope:[init_font_hex] from init_font_hex::@2 init_font_hex::@3 + (byte) init_font_hex::c#4 ← phi( init_font_hex::@2/(byte) init_font_hex::c#5 init_font_hex::@3/(byte) init_font_hex::c#4 ) + (byte) init_font_hex::c1#3 ← phi( init_font_hex::@2/(byte) init_font_hex::c1#4 init_font_hex::@3/(byte) init_font_hex::c1#3 ) + (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) init_font_hex::idx#1 init_font_hex::@3/(byte) init_font_hex::idx#2 ) + (byte*) init_font_hex::charset#3 ← phi( init_font_hex::@2/(byte*) init_font_hex::charset#2 init_font_hex::@3/(byte*) init_font_hex::charset#3 ) + (byte*) init_font_hex::proto_lo#2 ← phi( init_font_hex::@2/(byte*) init_font_hex::proto_lo#4 init_font_hex::@3/(byte*) init_font_hex::proto_lo#2 ) + (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) init_font_hex::i#0 init_font_hex::@3/(byte) init_font_hex::i#1 ) + (byte*) init_font_hex::proto_hi#2 ← phi( init_font_hex::@2/(byte*) init_font_hex::proto_hi#4 init_font_hex::@3/(byte*) init_font_hex::proto_hi#2 ) + (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#2 + (byte) init_font_hex::i#2) << (number) 4 + (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#2 + (byte) init_font_hex::i#2) << (number) 1 + (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 + *((byte*) init_font_hex::charset#3 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 + (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 + (byte) init_font_hex::i#1 ← (byte) init_font_hex::i#2 + rangenext(0,4) + (bool~) init_font_hex::$3 ← (byte) init_font_hex::i#1 != rangelast(0,4) + if((bool~) init_font_hex::$3) goto init_font_hex::@3 + to:init_font_hex::@4 +init_font_hex::@4: scope:[init_font_hex] from init_font_hex::@3 + (byte) init_font_hex::c#3 ← phi( init_font_hex::@3/(byte) init_font_hex::c#4 ) + (byte*) init_font_hex::proto_hi#5 ← phi( init_font_hex::@3/(byte*) init_font_hex::proto_hi#2 ) + (byte) init_font_hex::c1#2 ← phi( init_font_hex::@3/(byte) init_font_hex::c1#3 ) + (byte*) init_font_hex::proto_lo#3 ← phi( init_font_hex::@3/(byte*) init_font_hex::proto_lo#2 ) + (byte) init_font_hex::idx#6 ← phi( init_font_hex::@3/(byte) init_font_hex::idx#2 ) + (byte*) init_font_hex::charset#4 ← phi( init_font_hex::@3/(byte*) init_font_hex::charset#3 ) + *((byte*) init_font_hex::charset#4 + (byte) init_font_hex::idx#6) ← (number) 0 + (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#6 + *((byte*) init_font_hex::charset#4 + (byte) init_font_hex::idx#3) ← (number) 0 + (byte) init_font_hex::idx#4 ← ++ (byte) init_font_hex::idx#3 + (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#3 + (number) 5 + (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#4 + (number) 8 + (byte) init_font_hex::c1#1 ← (byte) init_font_hex::c1#2 + rangenext(0,$f) + (bool~) init_font_hex::$4 ← (byte) init_font_hex::c1#1 != rangelast(0,$f) + if((bool~) init_font_hex::$4) goto init_font_hex::@2 + to:init_font_hex::@5 +init_font_hex::@5: scope:[init_font_hex] from init_font_hex::@4 + (byte*) init_font_hex::charset#7 ← phi( init_font_hex::@4/(byte*) init_font_hex::charset#0 ) + (byte) init_font_hex::c#2 ← phi( init_font_hex::@4/(byte) init_font_hex::c#3 ) + (byte*) init_font_hex::proto_hi#3 ← phi( init_font_hex::@4/(byte*) init_font_hex::proto_hi#5 ) + (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#3 + (number) 5 + (byte) init_font_hex::c#1 ← (byte) init_font_hex::c#2 + rangenext(0,$f) + (bool~) init_font_hex::$5 ← (byte) init_font_hex::c#1 != rangelast(0,$f) + if((bool~) init_font_hex::$5) goto init_font_hex::@1 + to:init_font_hex::@return +init_font_hex::@return: scope:[init_font_hex] from init_font_hex::@5 + return + to:@return +@1: scope:[] from @begin + (byte[]) FONT_HEX_PROTO#0 ← { (number) 2, (number) 5, (number) 5, (number) 5, (number) 2, (number) 6, (number) 2, (number) 2, (number) 2, (number) 7, (number) 6, (number) 1, (number) 2, (number) 4, (number) 7, (number) 6, (number) 1, (number) 2, (number) 1, (number) 6, (number) 5, (number) 5, (number) 7, (number) 1, (number) 1, (number) 7, (number) 4, (number) 6, (number) 1, (number) 6, (number) 3, (number) 4, (number) 6, (number) 5, (number) 2, (number) 7, (number) 1, (number) 1, (number) 1, (number) 1, (number) 2, (number) 5, (number) 2, (number) 5, (number) 2, (number) 2, (number) 5, (number) 3, (number) 1, (number) 1, (number) 2, (number) 5, (number) 7, (number) 5, (number) 5, (number) 6, (number) 5, (number) 6, (number) 5, (number) 6, (number) 2, (number) 5, (number) 4, (number) 5, (number) 2, (number) 6, (number) 5, (number) 5, (number) 5, (number) 6, (number) 7, (number) 4, (number) 6, (number) 4, (number) 7, (number) 7, (number) 4, (number) 6, (number) 4, (number) 4 } + (byte) CORDIC_ITERATIONS_16#0 ← (number) $f + (word*) CORDIC_ATAN2_ANGLES_16#0 ← ((word*)) (number) $1000 + kickasm(location (word*) CORDIC_ATAN2_ANGLES_16#0 uses CORDIC_ITERATIONS_16#0) {{ .for (var i=0; i (number) 0 + if((bool~) atan2_16::$0) goto atan2_16::@1 + to:atan2_16::@2 +atan2_16::@1: scope:[atan2_16] from atan2_16 + (signed word) atan2_16::x#5 ← phi( atan2_16/(signed word) atan2_16::x#9 ) + (signed word) atan2_16::y#2 ← phi( atan2_16/(signed word) atan2_16::y#1 ) + (signed word~) atan2_16::$3 ← (signed word) atan2_16::y#2 + to:atan2_16::@3 +atan2_16::@2: scope:[atan2_16] from atan2_16 + (signed word) atan2_16::x#6 ← phi( atan2_16/(signed word) atan2_16::x#9 ) + (signed word) atan2_16::y#3 ← phi( atan2_16/(signed word) atan2_16::y#1 ) + (signed word~) atan2_16::$1 ← - (signed word) atan2_16::y#3 + (signed word~) atan2_16::$2 ← (signed word~) atan2_16::$1 + to:atan2_16::@3 +atan2_16::@3: scope:[atan2_16] from atan2_16::@1 atan2_16::@2 + (signed word) atan2_16::y#15 ← phi( atan2_16::@1/(signed word) atan2_16::y#2 atan2_16::@2/(signed word) atan2_16::y#3 ) + (signed word) atan2_16::x#1 ← phi( atan2_16::@1/(signed word) atan2_16::x#5 atan2_16::@2/(signed word) atan2_16::x#6 ) + (signed word~) atan2_16::$4 ← phi( atan2_16::@1/(signed word~) atan2_16::$3 atan2_16::@2/(signed word~) atan2_16::$2 ) + (signed word) atan2_16::yi#0 ← (signed word~) atan2_16::$4 + (bool~) atan2_16::$5 ← (signed word) atan2_16::x#1 > (number) 0 + if((bool~) atan2_16::$5) goto atan2_16::@4 + to:atan2_16::@5 +atan2_16::@4: scope:[atan2_16] from atan2_16::@3 + (signed word) atan2_16::y#12 ← phi( atan2_16::@3/(signed word) atan2_16::y#15 ) + (signed word) atan2_16::yi#9 ← phi( atan2_16::@3/(signed word) atan2_16::yi#0 ) + (signed word) atan2_16::x#2 ← phi( atan2_16::@3/(signed word) atan2_16::x#1 ) + (signed word~) atan2_16::$8 ← (signed word) atan2_16::x#2 + to:atan2_16::@6 +atan2_16::@5: scope:[atan2_16] from atan2_16::@3 + (signed word) atan2_16::y#13 ← phi( atan2_16::@3/(signed word) atan2_16::y#15 ) + (signed word) atan2_16::yi#10 ← phi( atan2_16::@3/(signed word) atan2_16::yi#0 ) + (signed word) atan2_16::x#3 ← phi( atan2_16::@3/(signed word) atan2_16::x#1 ) + (signed word~) atan2_16::$6 ← - (signed word) atan2_16::x#3 + (signed word~) atan2_16::$7 ← (signed word~) atan2_16::$6 + to:atan2_16::@6 +atan2_16::@6: scope:[atan2_16] from atan2_16::@4 atan2_16::@5 + (signed word) atan2_16::y#9 ← phi( atan2_16::@4/(signed word) atan2_16::y#12 atan2_16::@5/(signed word) atan2_16::y#13 ) + (signed word) atan2_16::x#10 ← phi( atan2_16::@4/(signed word) atan2_16::x#2 atan2_16::@5/(signed word) atan2_16::x#3 ) + (signed word) atan2_16::yi#8 ← phi( atan2_16::@4/(signed word) atan2_16::yi#9 atan2_16::@5/(signed word) atan2_16::yi#10 ) + (signed word~) atan2_16::$9 ← phi( atan2_16::@4/(signed word~) atan2_16::$8 atan2_16::@5/(signed word~) atan2_16::$7 ) + (signed word) atan2_16::xi#0 ← (signed word~) atan2_16::$9 + (word) atan2_16::angle#0 ← (number) 0 + (number~) atan2_16::$16 ← (byte) CORDIC_ITERATIONS_16#0 - (number) 1 + (byte) atan2_16::i#0 ← (byte) 0 + to:atan2_16::@15 +atan2_16::@15: scope:[atan2_16] from atan2_16::@19 atan2_16::@6 + (signed word) atan2_16::y#7 ← phi( atan2_16::@19/(signed word) atan2_16::y#8 atan2_16::@6/(signed word) atan2_16::y#9 ) + (signed word) atan2_16::x#7 ← phi( atan2_16::@19/(signed word) atan2_16::x#8 atan2_16::@6/(signed word) atan2_16::x#10 ) + (word) atan2_16::angle#12 ← phi( atan2_16::@19/(word) atan2_16::angle#13 atan2_16::@6/(word) atan2_16::angle#0 ) + (byte) atan2_16::i#6 ← phi( atan2_16::@19/(byte) atan2_16::i#1 atan2_16::@6/(byte) atan2_16::i#0 ) + (signed word) atan2_16::xi#6 ← phi( atan2_16::@19/(signed word) atan2_16::xi#7 atan2_16::@6/(signed word) atan2_16::xi#0 ) + (signed word) atan2_16::yi#3 ← phi( atan2_16::@19/(signed word) atan2_16::yi#7 atan2_16::@6/(signed word) atan2_16::yi#8 ) + (bool~) atan2_16::$17 ← (signed word) atan2_16::yi#3 == (number) 0 + (bool~) atan2_16::$18 ← ! (bool~) atan2_16::$17 + if((bool~) atan2_16::$18) goto atan2_16::@16 + to:atan2_16::@17 +atan2_16::@16: scope:[atan2_16] from atan2_16::@15 + (signed word) atan2_16::y#14 ← phi( atan2_16::@15/(signed word) atan2_16::y#7 ) + (signed word) atan2_16::x#13 ← phi( atan2_16::@15/(signed word) atan2_16::x#7 ) + (word) atan2_16::angle#14 ← phi( atan2_16::@15/(word) atan2_16::angle#12 ) + (signed word) atan2_16::yi#4 ← phi( atan2_16::@15/(signed word) atan2_16::yi#3 ) + (byte) atan2_16::i#2 ← phi( atan2_16::@15/(byte) atan2_16::i#6 ) + (signed word) atan2_16::xi#3 ← phi( atan2_16::@15/(signed word) atan2_16::xi#6 ) + (signed word~) atan2_16::$19 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 + (signed word) atan2_16::xd#0 ← (signed word~) atan2_16::$19 + (signed word~) atan2_16::$20 ← (signed word) atan2_16::yi#4 >> (byte) atan2_16::i#2 + (signed word) atan2_16::yd#0 ← (signed word~) atan2_16::$20 + (bool~) atan2_16::$21 ← (signed word) atan2_16::yi#4 > (number) 0 + if((bool~) atan2_16::$21) goto atan2_16::@18 + to:atan2_16::@22 +atan2_16::@17: scope:[atan2_16] from atan2_16::@15 atan2_16::@19 + (signed word) atan2_16::y#5 ← phi( atan2_16::@15/(signed word) atan2_16::y#7 atan2_16::@19/(signed word) atan2_16::y#8 ) + (signed word) atan2_16::x#4 ← phi( atan2_16::@15/(signed word) atan2_16::x#7 atan2_16::@19/(signed word) atan2_16::x#8 ) + (word) atan2_16::angle#6 ← phi( atan2_16::@15/(word) atan2_16::angle#12 atan2_16::@19/(word) atan2_16::angle#13 ) + (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 / (number) 2 + (bool~) atan2_16::$10 ← (signed word) atan2_16::x#4 < (number) 0 + (bool~) atan2_16::$11 ← ! (bool~) atan2_16::$10 + if((bool~) atan2_16::$11) goto atan2_16::@7 + to:atan2_16::@25 +atan2_16::@18: scope:[atan2_16] from atan2_16::@16 + (signed word) atan2_16::y#10 ← phi( atan2_16::@16/(signed word) atan2_16::y#14 ) + (signed word) atan2_16::x#11 ← phi( atan2_16::@16/(signed word) atan2_16::x#13 ) + (word) atan2_16::angle#7 ← phi( atan2_16::@16/(word) atan2_16::angle#14 ) + (byte) atan2_16::i#3 ← phi( atan2_16::@16/(byte) atan2_16::i#2 ) + (signed word) atan2_16::xd#1 ← phi( atan2_16::@16/(signed word) atan2_16::xd#0 ) + (signed word) atan2_16::yi#5 ← phi( atan2_16::@16/(signed word) atan2_16::yi#4 ) + (signed word) atan2_16::yd#1 ← phi( atan2_16::@16/(signed word) atan2_16::yd#0 ) + (signed word) atan2_16::xi#4 ← phi( atan2_16::@16/(signed word) atan2_16::xi#3 ) + (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#4 + (signed word) atan2_16::yd#1 + (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#5 - (signed word) atan2_16::xd#1 + (byte~) atan2_16::$23 ← (byte) atan2_16::i#3 * (const byte) SIZEOF_WORD + (word) atan2_16::angle#2 ← (word) atan2_16::angle#7 + *((word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) + to:atan2_16::@19 +atan2_16::@22: scope:[atan2_16] from atan2_16::@16 + (signed word) atan2_16::y#11 ← phi( atan2_16::@16/(signed word) atan2_16::y#14 ) + (signed word) atan2_16::x#12 ← phi( atan2_16::@16/(signed word) atan2_16::x#13 ) + (word) atan2_16::angle#8 ← phi( atan2_16::@16/(word) atan2_16::angle#14 ) + (byte) atan2_16::i#4 ← phi( atan2_16::@16/(byte) atan2_16::i#2 ) + (signed word) atan2_16::xd#2 ← phi( atan2_16::@16/(signed word) atan2_16::xd#0 ) + (signed word) atan2_16::yi#6 ← phi( atan2_16::@16/(signed word) atan2_16::yi#4 ) + (signed word) atan2_16::yd#2 ← phi( atan2_16::@16/(signed word) atan2_16::yd#0 ) + (signed word) atan2_16::xi#5 ← phi( atan2_16::@16/(signed word) atan2_16::xi#3 ) + (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#5 - (signed word) atan2_16::yd#2 + (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#6 + (signed word) atan2_16::xd#2 + (byte~) atan2_16::$24 ← (byte) atan2_16::i#4 * (const byte) SIZEOF_WORD + (word) atan2_16::angle#3 ← (word) atan2_16::angle#8 - *((word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) + to:atan2_16::@19 +atan2_16::@19: scope:[atan2_16] from atan2_16::@18 atan2_16::@22 + (signed word) atan2_16::y#8 ← phi( atan2_16::@18/(signed word) atan2_16::y#10 atan2_16::@22/(signed word) atan2_16::y#11 ) + (signed word) atan2_16::xi#7 ← phi( atan2_16::@18/(signed word) atan2_16::xi#1 atan2_16::@22/(signed word) atan2_16::xi#2 ) + (signed word) atan2_16::x#8 ← phi( atan2_16::@18/(signed word) atan2_16::x#11 atan2_16::@22/(signed word) atan2_16::x#12 ) + (word) atan2_16::angle#13 ← phi( atan2_16::@18/(word) atan2_16::angle#2 atan2_16::@22/(word) atan2_16::angle#3 ) + (signed word) atan2_16::yi#7 ← phi( atan2_16::@18/(signed word) atan2_16::yi#1 atan2_16::@22/(signed word) atan2_16::yi#2 ) + (byte) atan2_16::i#5 ← phi( atan2_16::@18/(byte) atan2_16::i#3 atan2_16::@22/(byte) atan2_16::i#4 ) + (byte) atan2_16::i#1 ← (byte) atan2_16::i#5 + rangenext(0,atan2_16::$16) + (bool~) atan2_16::$22 ← (byte) atan2_16::i#1 != rangelast(0,atan2_16::$16) + if((bool~) atan2_16::$22) goto atan2_16::@15 + to:atan2_16::@17 +atan2_16::@7: scope:[atan2_16] from atan2_16::@17 atan2_16::@25 + (word) atan2_16::angle#15 ← phi( atan2_16::@17/(word) atan2_16::angle#1 atan2_16::@25/(word) atan2_16::angle#4 ) + (signed word) atan2_16::y#4 ← phi( atan2_16::@17/(signed word) atan2_16::y#5 atan2_16::@25/(signed word) atan2_16::y#6 ) + (bool~) atan2_16::$13 ← (signed word) atan2_16::y#4 < (number) 0 + (bool~) atan2_16::$14 ← ! (bool~) atan2_16::$13 + if((bool~) atan2_16::$14) goto atan2_16::@8 + to:atan2_16::@13 +atan2_16::@25: scope:[atan2_16] from atan2_16::@17 + (signed word) atan2_16::y#6 ← phi( atan2_16::@17/(signed word) atan2_16::y#5 ) + (word) atan2_16::angle#9 ← phi( atan2_16::@17/(word) atan2_16::angle#1 ) + (number~) atan2_16::$12 ← (number) $8000 - (word) atan2_16::angle#9 + (word) atan2_16::angle#4 ← (number~) atan2_16::$12 + to:atan2_16::@7 +atan2_16::@8: scope:[atan2_16] from atan2_16::@13 atan2_16::@7 + (word) atan2_16::angle#10 ← phi( atan2_16::@13/(word) atan2_16::angle#5 atan2_16::@7/(word) atan2_16::angle#15 ) + (word) atan2_16::return#0 ← (word) atan2_16::angle#10 + to:atan2_16::@return +atan2_16::@13: scope:[atan2_16] from atan2_16::@7 + (word) atan2_16::angle#11 ← phi( atan2_16::@7/(word) atan2_16::angle#15 ) + (word~) atan2_16::$15 ← - (word) atan2_16::angle#11 + (word) atan2_16::angle#5 ← (word~) atan2_16::$15 + to:atan2_16::@8 +atan2_16::@return: scope:[atan2_16] from atan2_16::@8 + (word) atan2_16::return#3 ← phi( atan2_16::@8/(word) atan2_16::return#0 ) + (word) atan2_16::return#1 ← (word) atan2_16::return#3 + return + to:@return +@2: scope:[] from @1 + (byte) CORDIC_ITERATIONS_8#0 ← (number) 8 + (byte*) CORDIC_ATAN2_ANGLES_8#0 ← ((byte*)) (number) $1100 + kickasm(location (byte*) CORDIC_ATAN2_ANGLES_8#0 uses CORDIC_ITERATIONS_8#0) {{ .fill CORDIC_ITERATIONS_8, 2*256*atan(1/pow(2,i))/PI/2 + }} + to:@3 +@3: scope:[] from @2 + (byte*) RASTER#0 ← ((byte*)) (number) $d012 + (byte*) D018#0 ← ((byte*)) (number) $d018 + to:@7 +@7: scope:[] from @3 + (byte*) CHARSET#0 ← ((byte*)) (number) $2000 + (byte*) SCREEN#0 ← ((byte*)) (number) $2800 + to:@9 +main: scope:[main] from @9 + (byte*) init_font_hex::charset#1 ← (byte*) CHARSET#0 + call init_font_hex + to:main::@12 +main::@12: scope:[main] from main + (byte*) main::toD0181_screen#0 ← (byte*) SCREEN#0 + (byte*) main::toD0181_gfx#0 ← (byte*) CHARSET#0 + to:main::toD0181 +main::toD0181: scope:[main] from main::@12 + (byte*) main::toD0181_gfx#1 ← phi( main::@12/(byte*) main::toD0181_gfx#0 ) + (byte*) main::toD0181_screen#1 ← phi( main::@12/(byte*) main::toD0181_screen#0 ) + (word~) main::toD0181_$0#0 ← ((word)) (byte*) main::toD0181_screen#1 + (number~) main::toD0181_$1#0 ← (word~) main::toD0181_$0#0 & (number) $3fff + (number~) main::toD0181_$2#0 ← (number~) main::toD0181_$1#0 * (number) 4 + (number~) main::toD0181_$3#0 ← > (number~) main::toD0181_$2#0 + (word~) main::toD0181_$4#0 ← ((word)) (byte*) main::toD0181_gfx#1 + (byte~) main::toD0181_$5#0 ← > (word~) main::toD0181_$4#0 + (number~) main::toD0181_$6#0 ← (byte~) main::toD0181_$5#0 / (number) 4 + (number~) main::toD0181_$7#0 ← (number~) main::toD0181_$6#0 & (number) $f + (number~) main::toD0181_$8#0 ← (number~) main::toD0181_$3#0 | (number~) main::toD0181_$7#0 + (byte) main::toD0181_return#0 ← (number~) main::toD0181_$8#0 + to:main::toD0181_@return +main::toD0181_@return: scope:[main] from main::toD0181 + (byte) main::toD0181_return#2 ← phi( main::toD0181/(byte) main::toD0181_return#0 ) + (byte) main::toD0181_return#1 ← (byte) main::toD0181_return#2 + to:main::@11 +main::@11: scope:[main] from main::toD0181_@return + (byte) main::toD0181_return#3 ← phi( main::toD0181_@return/(byte) main::toD0181_return#1 ) + (byte~) main::$1 ← (byte) main::toD0181_return#3 + *((byte*) D018#0) ← (byte~) main::$1 + call init_screen + to:main::@13 +main::@13: scope:[main] from main::@11 + (byte*) main::clear_char#0 ← (byte*) CHARSET#0 + to:main::@1 +main::@1: scope:[main] from main::@13 main::@5 main::@6 + (byte*) main::clear_char#5 ← phi( main::@13/(byte*) main::clear_char#0 main::@5/(byte*) main::clear_char#2 main::@6/(byte*) main::clear_char#1 ) + if(true) goto main::@4 + to:main::@return +main::@4: scope:[main] from main::@1 main::@4 + (byte*) main::clear_char#4 ← phi( main::@1/(byte*) main::clear_char#5 main::@4/(byte*) main::clear_char#4 ) + (bool~) main::$3 ← *((byte*) RASTER#0) != (number) $ff + if((bool~) main::$3) goto main::@4 + to:main::@5 +main::@5: scope:[main] from main::@4 + (byte*) main::clear_char#2 ← phi( main::@4/(byte*) main::clear_char#4 ) + (byte*~) main::$4 ← (byte*) CHARSET#0 + (number) $800 + (bool~) main::$5 ← (byte*) main::clear_char#2 < (byte*~) main::$4 + (bool~) main::$6 ← ! (bool~) main::$5 + if((bool~) main::$6) goto main::@1 + to:main::@6 +main::@6: scope:[main] from main::@5 + (byte*) main::clear_char#3 ← phi( main::@5/(byte*) main::clear_char#2 ) + *((byte*) main::clear_char#3) ← (number) 0 + (byte*) main::clear_char#1 ← ++ (byte*) main::clear_char#3 + to:main::@1 +main::@return: scope:[main] from main::@1 + return + to:@return +init_screen: scope:[init_screen] from main::@11 + (byte*) init_screen::screen#0 ← (byte*) SCREEN#0 + (signed byte) init_screen::y#0 ← (signed byte) -$c + to:init_screen::@1 +init_screen::@1: scope:[init_screen] from init_screen init_screen::@3 + (byte*) init_screen::screen#4 ← phi( init_screen/(byte*) init_screen::screen#0 init_screen::@3/(byte*) init_screen::screen#5 ) + (signed byte) init_screen::y#4 ← phi( init_screen/(signed byte) init_screen::y#0 init_screen::@3/(signed byte) init_screen::y#1 ) + (signed byte) init_screen::x#0 ← (signed byte) -$13 + to:init_screen::@2 +init_screen::@2: scope:[init_screen] from init_screen::@1 init_screen::@5 + (byte*) init_screen::screen#3 ← phi( init_screen::@1/(byte*) init_screen::screen#4 init_screen::@5/(byte*) init_screen::screen#1 ) + (signed byte) init_screen::y#2 ← phi( init_screen::@1/(signed byte) init_screen::y#4 init_screen::@5/(signed byte) init_screen::y#5 ) + (signed byte) init_screen::x#2 ← phi( init_screen::@1/(signed byte) init_screen::x#0 init_screen::@5/(signed byte) init_screen::x#1 ) + (byte~) init_screen::$0 ← ((byte)) (signed byte) init_screen::x#2 + (word~) init_screen::$1 ← ((word)) { (byte~) init_screen::$0, (number) 0 } + (signed word~) init_screen::$2 ← ((signed word)) (word~) init_screen::$1 + (signed word) init_screen::xw#0 ← (signed word~) init_screen::$2 + (byte~) init_screen::$3 ← ((byte)) (signed byte) init_screen::y#2 + (word~) init_screen::$4 ← ((word)) { (byte~) init_screen::$3, (number) 0 } + (signed word~) init_screen::$5 ← ((signed word)) (word~) init_screen::$4 + (signed word) init_screen::yw#0 ← (signed word~) init_screen::$5 + (signed word) atan2_16::x#0 ← (signed word) init_screen::xw#0 + (signed word) atan2_16::y#0 ← (signed word) init_screen::yw#0 + call atan2_16 + (word) atan2_16::return#2 ← (word) atan2_16::return#1 + to:init_screen::@5 +init_screen::@5: scope:[init_screen] from init_screen::@2 + (signed byte) init_screen::y#5 ← phi( init_screen::@2/(signed byte) init_screen::y#2 ) + (signed byte) init_screen::x#3 ← phi( init_screen::@2/(signed byte) init_screen::x#2 ) + (byte*) init_screen::screen#2 ← phi( init_screen::@2/(byte*) init_screen::screen#3 ) + (word) atan2_16::return#4 ← phi( init_screen::@2/(word) atan2_16::return#2 ) + (word~) init_screen::$6 ← (word) atan2_16::return#4 + (word) init_screen::angle_w#0 ← (word~) init_screen::$6 + (number~) init_screen::$7 ← (word) init_screen::angle_w#0 + (number) $80 + (number~) init_screen::$8 ← > (number~) init_screen::$7 + (byte) init_screen::ang_w#0 ← (number~) init_screen::$8 + *((byte*) init_screen::screen#2) ← (byte) init_screen::ang_w#0 + (byte*) init_screen::screen#1 ← ++ (byte*) init_screen::screen#2 + (signed byte) init_screen::x#1 ← (signed byte) init_screen::x#3 + rangenext(-$13,$14) + (bool~) init_screen::$9 ← (signed byte) init_screen::x#1 != rangelast(-$13,$14) + if((bool~) init_screen::$9) goto init_screen::@2 + to:init_screen::@3 +init_screen::@3: scope:[init_screen] from init_screen::@5 + (byte*) init_screen::screen#5 ← phi( init_screen::@5/(byte*) init_screen::screen#1 ) + (signed byte) init_screen::y#3 ← phi( init_screen::@5/(signed byte) init_screen::y#5 ) + (signed byte) init_screen::y#1 ← (signed byte) init_screen::y#3 + rangenext(-$c,$c) + (bool~) init_screen::$10 ← (signed byte) init_screen::y#1 != rangelast(-$c,$c) + if((bool~) init_screen::$10) goto init_screen::@1 + to:init_screen::@return +init_screen::@return: scope:[init_screen] from init_screen::@3 + return + to:@return +@9: scope:[] from @7 + call main + to:@10 +@10: scope:[] from @9 + to:@end +@end: scope:[] from @10 + +SYMBOL TABLE SSA +(label) @1 +(label) @10 +(label) @2 +(label) @3 +(label) @7 +(label) @9 +(label) @begin +(label) @end +(byte*) CHARSET +(byte*) CHARSET#0 +(word*) CORDIC_ATAN2_ANGLES_16 +(word*) CORDIC_ATAN2_ANGLES_16#0 +(byte*) CORDIC_ATAN2_ANGLES_8 +(byte*) CORDIC_ATAN2_ANGLES_8#0 +(byte) CORDIC_ITERATIONS_16 +(byte) CORDIC_ITERATIONS_16#0 +(byte) CORDIC_ITERATIONS_8 +(byte) CORDIC_ITERATIONS_8#0 +(byte*) D018 +(byte*) D018#0 +(byte[]) FONT_HEX_PROTO +(byte[]) FONT_HEX_PROTO#0 +(byte*) RASTER +(byte*) RASTER#0 +(byte*) SCREEN +(byte*) SCREEN#0 +(const byte) SIZEOF_WORD = (byte) 2 +(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y) +(bool~) atan2_16::$0 +(signed word~) atan2_16::$1 +(bool~) atan2_16::$10 +(bool~) atan2_16::$11 +(number~) atan2_16::$12 +(bool~) atan2_16::$13 +(bool~) atan2_16::$14 +(word~) atan2_16::$15 +(number~) atan2_16::$16 +(bool~) atan2_16::$17 +(bool~) atan2_16::$18 +(signed word~) atan2_16::$19 +(signed word~) atan2_16::$2 +(signed word~) atan2_16::$20 +(bool~) atan2_16::$21 +(bool~) atan2_16::$22 +(byte~) atan2_16::$23 +(byte~) atan2_16::$24 +(signed word~) atan2_16::$3 +(signed word~) atan2_16::$4 +(bool~) atan2_16::$5 +(signed word~) atan2_16::$6 +(signed word~) atan2_16::$7 +(signed word~) atan2_16::$8 +(signed word~) atan2_16::$9 +(label) atan2_16::@1 +(label) atan2_16::@13 +(label) atan2_16::@15 +(label) atan2_16::@16 +(label) atan2_16::@17 +(label) atan2_16::@18 +(label) atan2_16::@19 +(label) atan2_16::@2 +(label) atan2_16::@22 +(label) atan2_16::@25 +(label) atan2_16::@3 +(label) atan2_16::@4 +(label) atan2_16::@5 +(label) atan2_16::@6 +(label) atan2_16::@7 +(label) atan2_16::@8 +(label) atan2_16::@return +(word) atan2_16::angle +(word) atan2_16::angle#0 +(word) atan2_16::angle#1 +(word) atan2_16::angle#10 +(word) atan2_16::angle#11 +(word) atan2_16::angle#12 +(word) atan2_16::angle#13 +(word) atan2_16::angle#14 +(word) atan2_16::angle#15 +(word) atan2_16::angle#2 +(word) atan2_16::angle#3 +(word) atan2_16::angle#4 +(word) atan2_16::angle#5 +(word) atan2_16::angle#6 +(word) atan2_16::angle#7 +(word) atan2_16::angle#8 +(word) atan2_16::angle#9 +(byte) atan2_16::i +(byte) atan2_16::i#0 +(byte) atan2_16::i#1 +(byte) atan2_16::i#2 +(byte) atan2_16::i#3 +(byte) atan2_16::i#4 +(byte) atan2_16::i#5 +(byte) atan2_16::i#6 +(word) atan2_16::return +(word) atan2_16::return#0 +(word) atan2_16::return#1 +(word) atan2_16::return#2 +(word) atan2_16::return#3 +(word) atan2_16::return#4 +(signed word) atan2_16::x +(signed word) atan2_16::x#0 +(signed word) atan2_16::x#1 +(signed word) atan2_16::x#10 +(signed word) atan2_16::x#11 +(signed word) atan2_16::x#12 +(signed word) atan2_16::x#13 +(signed word) atan2_16::x#2 +(signed word) atan2_16::x#3 +(signed word) atan2_16::x#4 +(signed word) atan2_16::x#5 +(signed word) atan2_16::x#6 +(signed word) atan2_16::x#7 +(signed word) atan2_16::x#8 +(signed word) atan2_16::x#9 +(signed word) atan2_16::xd +(signed word) atan2_16::xd#0 +(signed word) atan2_16::xd#1 +(signed word) atan2_16::xd#2 +(signed word) atan2_16::xi +(signed word) atan2_16::xi#0 +(signed word) atan2_16::xi#1 +(signed word) atan2_16::xi#2 +(signed word) atan2_16::xi#3 +(signed word) atan2_16::xi#4 +(signed word) atan2_16::xi#5 +(signed word) atan2_16::xi#6 +(signed word) atan2_16::xi#7 +(signed word) atan2_16::y +(signed word) atan2_16::y#0 +(signed word) atan2_16::y#1 +(signed word) atan2_16::y#10 +(signed word) atan2_16::y#11 +(signed word) atan2_16::y#12 +(signed word) atan2_16::y#13 +(signed word) atan2_16::y#14 +(signed word) atan2_16::y#15 +(signed word) atan2_16::y#2 +(signed word) atan2_16::y#3 +(signed word) atan2_16::y#4 +(signed word) atan2_16::y#5 +(signed word) atan2_16::y#6 +(signed word) atan2_16::y#7 +(signed word) atan2_16::y#8 +(signed word) atan2_16::y#9 +(signed word) atan2_16::yd +(signed word) atan2_16::yd#0 +(signed word) atan2_16::yd#1 +(signed word) atan2_16::yd#2 +(signed word) atan2_16::yi +(signed word) atan2_16::yi#0 +(signed word) atan2_16::yi#1 +(signed word) atan2_16::yi#10 +(signed word) atan2_16::yi#2 +(signed word) atan2_16::yi#3 +(signed word) atan2_16::yi#4 +(signed word) atan2_16::yi#5 +(signed word) atan2_16::yi#6 +(signed word) atan2_16::yi#7 +(signed word) atan2_16::yi#8 +(signed word) atan2_16::yi#9 +(void()) init_font_hex((byte*) init_font_hex::charset) +(byte~) init_font_hex::$0 +(byte~) init_font_hex::$1 +(byte~) init_font_hex::$2 +(bool~) init_font_hex::$3 +(bool~) init_font_hex::$4 +(bool~) init_font_hex::$5 +(label) init_font_hex::@1 +(label) init_font_hex::@2 +(label) init_font_hex::@3 +(label) init_font_hex::@4 +(label) init_font_hex::@5 +(label) init_font_hex::@return +(byte) init_font_hex::c +(byte) init_font_hex::c#0 +(byte) init_font_hex::c#1 +(byte) init_font_hex::c#2 +(byte) init_font_hex::c#3 +(byte) init_font_hex::c#4 +(byte) init_font_hex::c#5 +(byte) init_font_hex::c#6 +(byte) init_font_hex::c1 +(byte) init_font_hex::c1#0 +(byte) init_font_hex::c1#1 +(byte) init_font_hex::c1#2 +(byte) init_font_hex::c1#3 +(byte) init_font_hex::c1#4 +(byte*) init_font_hex::charset +(byte*) init_font_hex::charset#0 +(byte*) init_font_hex::charset#1 +(byte*) init_font_hex::charset#2 +(byte*) init_font_hex::charset#3 +(byte*) init_font_hex::charset#4 +(byte*) init_font_hex::charset#5 +(byte*) init_font_hex::charset#6 +(byte*) init_font_hex::charset#7 +(byte) init_font_hex::i +(byte) init_font_hex::i#0 +(byte) init_font_hex::i#1 +(byte) init_font_hex::i#2 +(byte) init_font_hex::idx +(byte) init_font_hex::idx#0 +(byte) init_font_hex::idx#1 +(byte) init_font_hex::idx#2 +(byte) init_font_hex::idx#3 +(byte) init_font_hex::idx#4 +(byte) init_font_hex::idx#5 +(byte) init_font_hex::idx#6 +(byte*) init_font_hex::proto_hi +(byte*) init_font_hex::proto_hi#0 +(byte*) init_font_hex::proto_hi#1 +(byte*) init_font_hex::proto_hi#2 +(byte*) init_font_hex::proto_hi#3 +(byte*) init_font_hex::proto_hi#4 +(byte*) init_font_hex::proto_hi#5 +(byte*) init_font_hex::proto_hi#6 +(byte*) init_font_hex::proto_lo +(byte*) init_font_hex::proto_lo#0 +(byte*) init_font_hex::proto_lo#1 +(byte*) init_font_hex::proto_lo#2 +(byte*) init_font_hex::proto_lo#3 +(byte*) init_font_hex::proto_lo#4 +(void()) init_screen() +(byte~) init_screen::$0 +(word~) init_screen::$1 +(bool~) init_screen::$10 +(signed word~) init_screen::$2 +(byte~) init_screen::$3 +(word~) init_screen::$4 +(signed word~) init_screen::$5 +(word~) init_screen::$6 +(number~) init_screen::$7 +(number~) init_screen::$8 +(bool~) init_screen::$9 +(label) init_screen::@1 +(label) init_screen::@2 +(label) init_screen::@3 +(label) init_screen::@5 +(label) init_screen::@return +(byte) init_screen::ang_w +(byte) init_screen::ang_w#0 +(word) init_screen::angle_w +(word) init_screen::angle_w#0 +(byte*) init_screen::screen +(byte*) init_screen::screen#0 +(byte*) init_screen::screen#1 +(byte*) init_screen::screen#2 +(byte*) init_screen::screen#3 +(byte*) init_screen::screen#4 +(byte*) init_screen::screen#5 +(signed byte) init_screen::x +(signed byte) init_screen::x#0 +(signed byte) init_screen::x#1 +(signed byte) init_screen::x#2 +(signed byte) init_screen::x#3 +(signed word) init_screen::xw +(signed word) init_screen::xw#0 +(signed byte) init_screen::y +(signed byte) init_screen::y#0 +(signed byte) init_screen::y#1 +(signed byte) init_screen::y#2 +(signed byte) init_screen::y#3 +(signed byte) init_screen::y#4 +(signed byte) init_screen::y#5 +(signed word) init_screen::yw +(signed word) init_screen::yw#0 +(void()) main() +(byte~) main::$1 +(bool~) main::$3 +(byte*~) main::$4 +(bool~) main::$5 +(bool~) main::$6 +(label) main::@1 +(label) main::@11 +(label) main::@12 +(label) main::@13 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@return +(byte*) main::clear_char +(byte*) main::clear_char#0 +(byte*) main::clear_char#1 +(byte*) main::clear_char#2 +(byte*) main::clear_char#3 +(byte*) main::clear_char#4 +(byte*) main::clear_char#5 +(label) main::toD0181 +(word~) main::toD0181_$0 +(word~) main::toD0181_$0#0 +(number~) main::toD0181_$1 +(number~) main::toD0181_$1#0 +(number~) main::toD0181_$2 +(number~) main::toD0181_$2#0 +(number~) main::toD0181_$3 +(number~) main::toD0181_$3#0 +(word~) main::toD0181_$4 +(word~) main::toD0181_$4#0 +(byte~) main::toD0181_$5 +(byte~) main::toD0181_$5#0 +(number~) main::toD0181_$6 +(number~) main::toD0181_$6#0 +(number~) main::toD0181_$7 +(number~) main::toD0181_$7#0 +(number~) main::toD0181_$8 +(number~) main::toD0181_$8#0 +(label) main::toD0181_@return +(byte*) main::toD0181_gfx +(byte*) main::toD0181_gfx#0 +(byte*) main::toD0181_gfx#1 +(byte) main::toD0181_return +(byte) main::toD0181_return#0 +(byte) main::toD0181_return#1 +(byte) main::toD0181_return#2 +(byte) main::toD0181_return#3 +(byte*) main::toD0181_screen +(byte*) main::toD0181_screen#0 +(byte*) main::toD0181_screen#1 + +Fixing inline constructor with init_screen::$11 ← (byte)init_screen::$0 w= (byte)0 +Fixing inline constructor with init_screen::$12 ← (byte)init_screen::$3 w= (byte)0 +Successful SSA optimization Pass2FixInlineConstructorsNew +Adding number conversion cast (unumber) 0 in (byte) init_font_hex::idx#0 ← (number) 0 +Adding number conversion cast (unumber) 0 in *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#0) ← (number) 0 +Adding number conversion cast (unumber) 4 in (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#2 + (byte) init_font_hex::i#2) << (number) 4 +Adding number conversion cast (unumber) 1 in (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#2 + (byte) init_font_hex::i#2) << (number) 1 +Adding number conversion cast (unumber) 0 in *((byte*) init_font_hex::charset#4 + (byte) init_font_hex::idx#6) ← (number) 0 +Adding number conversion cast (unumber) 0 in *((byte*) init_font_hex::charset#4 + (byte) init_font_hex::idx#3) ← (number) 0 +Adding number conversion cast (unumber) 5 in (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#3 + (number) 5 +Adding number conversion cast (unumber) 8 in (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#4 + (number) 8 +Adding number conversion cast (unumber) 5 in (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#3 + (number) 5 +Adding number conversion cast (unumber) $f in (byte) CORDIC_ITERATIONS_16#0 ← (number) $f +Adding number conversion cast (snumber) 0 in (bool~) atan2_16::$0 ← (signed word) atan2_16::y#1 > (number) 0 +Adding number conversion cast (snumber) 0 in (bool~) atan2_16::$5 ← (signed word) atan2_16::x#1 > (number) 0 +Adding number conversion cast (unumber) 0 in (word) atan2_16::angle#0 ← (number) 0 +Adding number conversion cast (unumber) 1 in (number~) atan2_16::$16 ← (byte) CORDIC_ITERATIONS_16#0 - (number) 1 +Adding number conversion cast (unumber) atan2_16::$16 in (number~) atan2_16::$16 ← (byte) CORDIC_ITERATIONS_16#0 - (unumber)(number) 1 +Adding number conversion cast (snumber) 0 in (bool~) atan2_16::$17 ← (signed word) atan2_16::yi#3 == (number) 0 +Adding number conversion cast (snumber) 0 in (bool~) atan2_16::$21 ← (signed word) atan2_16::yi#4 > (number) 0 +Adding number conversion cast (unumber) 2 in (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 / (number) 2 +Adding number conversion cast (snumber) 0 in (bool~) atan2_16::$10 ← (signed word) atan2_16::x#4 < (number) 0 +Adding number conversion cast (snumber) 0 in (bool~) atan2_16::$13 ← (signed word) atan2_16::y#4 < (number) 0 +Adding number conversion cast (unumber) $8000 in (number~) atan2_16::$12 ← (number) $8000 - (word) atan2_16::angle#9 +Adding number conversion cast (unumber) atan2_16::$12 in (number~) atan2_16::$12 ← (unumber)(number) $8000 - (word) atan2_16::angle#9 +Adding number conversion cast (unumber) 8 in (byte) CORDIC_ITERATIONS_8#0 ← (number) 8 +Adding number conversion cast (unumber) $3fff in (number~) main::toD0181_$1#0 ← (word~) main::toD0181_$0#0 & (number) $3fff +Adding number conversion cast (unumber) main::toD0181_$1#0 in (number~) main::toD0181_$1#0 ← (word~) main::toD0181_$0#0 & (unumber)(number) $3fff +Adding number conversion cast (unumber) 4 in (number~) main::toD0181_$2#0 ← (unumber~) main::toD0181_$1#0 * (number) 4 +Adding number conversion cast (unumber) main::toD0181_$2#0 in (number~) main::toD0181_$2#0 ← (unumber~) main::toD0181_$1#0 * (unumber)(number) 4 +Adding number conversion cast (unumber) main::toD0181_$3#0 in (number~) main::toD0181_$3#0 ← > (unumber~) main::toD0181_$2#0 +Adding number conversion cast (unumber) 4 in (number~) main::toD0181_$6#0 ← (byte~) main::toD0181_$5#0 / (number) 4 +Adding number conversion cast (unumber) main::toD0181_$6#0 in (number~) main::toD0181_$6#0 ← (byte~) main::toD0181_$5#0 / (unumber)(number) 4 +Adding number conversion cast (unumber) $f in (number~) main::toD0181_$7#0 ← (unumber~) main::toD0181_$6#0 & (number) $f +Adding number conversion cast (unumber) main::toD0181_$7#0 in (number~) main::toD0181_$7#0 ← (unumber~) main::toD0181_$6#0 & (unumber)(number) $f +Adding number conversion cast (unumber) main::toD0181_$8#0 in (number~) main::toD0181_$8#0 ← (unumber~) main::toD0181_$3#0 | (unumber~) main::toD0181_$7#0 +Adding number conversion cast (unumber) $ff in (bool~) main::$3 ← *((byte*) RASTER#0) != (number) $ff +Adding number conversion cast (unumber) $800 in (byte*~) main::$4 ← (byte*) CHARSET#0 + (number) $800 +Adding number conversion cast (unumber) 0 in *((byte*) main::clear_char#3) ← (number) 0 +Adding number conversion cast (unumber) $80 in (number~) init_screen::$7 ← (word) init_screen::angle_w#0 + (number) $80 +Adding number conversion cast (unumber) init_screen::$7 in (number~) init_screen::$7 ← (word) init_screen::angle_w#0 + (unumber)(number) $80 +Adding number conversion cast (unumber) init_screen::$8 in (number~) init_screen::$8 ← > (unumber~) init_screen::$7 +Successful SSA optimization PassNAddNumberTypeConversions +Adding number conversion cast (byte) to elements in (byte[]) FONT_HEX_PROTO#0 ← { (byte)(number) 2, (byte)(number) 5, (byte)(number) 5, (byte)(number) 5, (byte)(number) 2, (byte)(number) 6, (byte)(number) 2, (byte)(number) 2, (byte)(number) 2, (byte)(number) 7, (byte)(number) 6, (byte)(number) 1, (byte)(number) 2, (byte)(number) 4, (byte)(number) 7, (byte)(number) 6, (byte)(number) 1, (byte)(number) 2, (byte)(number) 1, (byte)(number) 6, (byte)(number) 5, (byte)(number) 5, (byte)(number) 7, (byte)(number) 1, (byte)(number) 1, (byte)(number) 7, (byte)(number) 4, (byte)(number) 6, (byte)(number) 1, (byte)(number) 6, (byte)(number) 3, (byte)(number) 4, (byte)(number) 6, (byte)(number) 5, (byte)(number) 2, (byte)(number) 7, (byte)(number) 1, (byte)(number) 1, (byte)(number) 1, (byte)(number) 1, (byte)(number) 2, (byte)(number) 5, (byte)(number) 2, (byte)(number) 5, (byte)(number) 2, (byte)(number) 2, (byte)(number) 5, (byte)(number) 3, (byte)(number) 1, (byte)(number) 1, (byte)(number) 2, (byte)(number) 5, (byte)(number) 7, (byte)(number) 5, (byte)(number) 5, (byte)(number) 6, (byte)(number) 5, (byte)(number) 6, (byte)(number) 5, (byte)(number) 6, (byte)(number) 2, (byte)(number) 5, (byte)(number) 4, (byte)(number) 5, (byte)(number) 2, (byte)(number) 6, (byte)(number) 5, (byte)(number) 5, (byte)(number) 5, (byte)(number) 6, (byte)(number) 7, (byte)(number) 4, (byte)(number) 6, (byte)(number) 4, (byte)(number) 7, (byte)(number) 7, (byte)(number) 4, (byte)(number) 6, (byte)(number) 4, (byte)(number) 4 } +Successful SSA optimization PassNAddArrayNumberTypeConversions +Inlining cast (byte) init_font_hex::idx#0 ← (unumber)(number) 0 +Inlining cast *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#0) ← (unumber)(number) 0 +Inlining cast *((byte*) init_font_hex::charset#4 + (byte) init_font_hex::idx#6) ← (unumber)(number) 0 +Inlining cast *((byte*) init_font_hex::charset#4 + (byte) init_font_hex::idx#3) ← (unumber)(number) 0 +Inlining cast (byte) CORDIC_ITERATIONS_16#0 ← (unumber)(number) $f +Inlining cast (word*) CORDIC_ATAN2_ANGLES_16#0 ← (word*)(number) $1000 +Inlining cast (word) atan2_16::angle#0 ← (unumber)(number) 0 +Inlining cast (byte) CORDIC_ITERATIONS_8#0 ← (unumber)(number) 8 +Inlining cast (byte*) CORDIC_ATAN2_ANGLES_8#0 ← (byte*)(number) $1100 +Inlining cast (byte*) RASTER#0 ← (byte*)(number) $d012 +Inlining cast (byte*) D018#0 ← (byte*)(number) $d018 +Inlining cast (byte*) CHARSET#0 ← (byte*)(number) $2000 +Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $2800 +Inlining cast (word~) main::toD0181_$0#0 ← (word)(byte*) main::toD0181_screen#1 +Inlining cast (word~) main::toD0181_$4#0 ← (word)(byte*) main::toD0181_gfx#1 +Inlining cast *((byte*) main::clear_char#3) ← (unumber)(number) 0 +Inlining cast (byte~) init_screen::$0 ← (byte)(signed byte) init_screen::x#2 +Inlining cast (signed word~) init_screen::$2 ← (signed word)(word~) init_screen::$1 +Inlining cast (byte~) init_screen::$3 ← (byte)(signed byte) init_screen::y#2 +Inlining cast (signed word~) init_screen::$5 ← (signed word)(word~) init_screen::$4 +Successful SSA optimization Pass2InlineCast +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 4 +Simplifying constant integer cast 1 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 5 +Simplifying constant integer cast 8 +Simplifying constant integer cast 5 +Simplifying constant integer cast 2 +Simplifying constant integer cast 5 +Simplifying constant integer cast 5 +Simplifying constant integer cast 5 +Simplifying constant integer cast 2 +Simplifying constant integer cast 6 +Simplifying constant integer cast 2 +Simplifying constant integer cast 2 +Simplifying constant integer cast 2 +Simplifying constant integer cast 7 +Simplifying constant integer cast 6 +Simplifying constant integer cast 1 +Simplifying constant integer cast 2 +Simplifying constant integer cast 4 +Simplifying constant integer cast 7 +Simplifying constant integer cast 6 +Simplifying constant integer cast 1 +Simplifying constant integer cast 2 +Simplifying constant integer cast 1 +Simplifying constant integer cast 6 +Simplifying constant integer cast 5 +Simplifying constant integer cast 5 +Simplifying constant integer cast 7 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 7 +Simplifying constant integer cast 4 +Simplifying constant integer cast 6 +Simplifying constant integer cast 1 +Simplifying constant integer cast 6 +Simplifying constant integer cast 3 +Simplifying constant integer cast 4 +Simplifying constant integer cast 6 +Simplifying constant integer cast 5 +Simplifying constant integer cast 2 +Simplifying constant integer cast 7 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 2 +Simplifying constant integer cast 5 +Simplifying constant integer cast 2 +Simplifying constant integer cast 5 +Simplifying constant integer cast 2 +Simplifying constant integer cast 2 +Simplifying constant integer cast 5 +Simplifying constant integer cast 3 +Simplifying constant integer cast 1 +Simplifying constant integer cast 1 +Simplifying constant integer cast 2 +Simplifying constant integer cast 5 +Simplifying constant integer cast 7 +Simplifying constant integer cast 5 +Simplifying constant integer cast 5 +Simplifying constant integer cast 6 +Simplifying constant integer cast 5 +Simplifying constant integer cast 6 +Simplifying constant integer cast 5 +Simplifying constant integer cast 6 +Simplifying constant integer cast 2 +Simplifying constant integer cast 5 +Simplifying constant integer cast 4 +Simplifying constant integer cast 5 +Simplifying constant integer cast 2 +Simplifying constant integer cast 6 +Simplifying constant integer cast 5 +Simplifying constant integer cast 5 +Simplifying constant integer cast 5 +Simplifying constant integer cast 6 +Simplifying constant integer cast 7 +Simplifying constant integer cast 4 +Simplifying constant integer cast 6 +Simplifying constant integer cast 4 +Simplifying constant integer cast 7 +Simplifying constant integer cast 7 +Simplifying constant integer cast 4 +Simplifying constant integer cast 6 +Simplifying constant integer cast 4 +Simplifying constant integer cast 4 +Simplifying constant integer cast $f +Simplifying constant pointer cast (word*) 4096 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast 2 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast $8000 +Simplifying constant integer cast 8 +Simplifying constant pointer cast (byte*) 4352 +Simplifying constant pointer cast (byte*) 53266 +Simplifying constant pointer cast (byte*) 53272 +Simplifying constant pointer cast (byte*) 8192 +Simplifying constant pointer cast (byte*) 10240 +Simplifying constant integer cast $3fff +Simplifying constant integer cast 4 +Simplifying constant integer cast 4 +Simplifying constant integer cast $f +Simplifying constant integer cast $ff +Simplifying constant integer cast $800 +Simplifying constant integer cast 0 +Simplifying constant integer cast (byte~) init_screen::$0 +Simplifying constant integer cast 0 +Simplifying constant integer cast (byte~) init_screen::$3 +Simplifying constant integer cast 0 +Simplifying constant integer cast $80 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) 1 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 5 +Finalized unsigned number type (byte) 8 +Finalized unsigned number type (byte) 5 +Finalized unsigned number type (byte) $f +Finalized signed number type (signed byte) 0 +Finalized signed number type (signed byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 1 +Finalized signed number type (signed byte) 0 +Finalized signed number type (signed byte) 0 +Finalized unsigned number type (byte) 2 +Finalized signed number type (signed byte) 0 +Finalized signed number type (signed byte) 0 +Finalized unsigned number type (word) $8000 +Finalized unsigned number type (byte) 8 +Finalized unsigned number type (word) $3fff +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) $f +Finalized unsigned number type (byte) $ff +Finalized unsigned number type (word) $800 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $80 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Inferred type updated to byte in (unumber~) atan2_16::$16 ← (byte) CORDIC_ITERATIONS_16#0 - (byte) 1 +Inferred type updated to word in (unumber~) atan2_16::$12 ← (word) $8000 - (word) atan2_16::angle#9 +Inferred type updated to word in (unumber~) main::toD0181_$1#0 ← (word~) main::toD0181_$0#0 & (word) $3fff +Inferred type updated to word in (unumber~) main::toD0181_$2#0 ← (word~) main::toD0181_$1#0 * (byte) 4 +Inferred type updated to byte in (unumber~) main::toD0181_$3#0 ← > (word~) main::toD0181_$2#0 +Inferred type updated to byte in (unumber~) main::toD0181_$6#0 ← (byte~) main::toD0181_$5#0 / (byte) 4 +Inferred type updated to byte in (unumber~) main::toD0181_$7#0 ← (byte~) main::toD0181_$6#0 & (byte) $f +Inferred type updated to byte in (unumber~) main::toD0181_$8#0 ← (byte~) main::toD0181_$3#0 | (byte~) main::toD0181_$7#0 +Inferred type updated to word in (unumber~) init_screen::$7 ← (word) init_screen::angle_w#0 + (byte) $80 +Inferred type updated to byte in (unumber~) init_screen::$8 ← > (word~) init_screen::$7 +Inversing boolean not [64] (bool~) atan2_16::$18 ← (signed word) atan2_16::yi#3 != (signed byte) 0 from [63] (bool~) atan2_16::$17 ← (signed word) atan2_16::yi#3 == (signed byte) 0 +Inversing boolean not [76] (bool~) atan2_16::$11 ← (signed word) atan2_16::x#4 >= (signed byte) 0 from [75] (bool~) atan2_16::$10 ← (signed word) atan2_16::x#4 < (signed byte) 0 +Inversing boolean not [94] (bool~) atan2_16::$14 ← (signed word) atan2_16::y#4 >= (signed byte) 0 from [93] (bool~) atan2_16::$13 ← (signed word) atan2_16::y#4 < (signed byte) 0 +Inversing boolean not [144] (bool~) main::$6 ← (byte*) main::clear_char#2 >= (byte*~) main::$4 from [143] (bool~) main::$5 ← (byte*) main::clear_char#2 < (byte*~) main::$4 +Successful SSA optimization Pass2UnaryNotSimplification +Alias (byte*) init_font_hex::charset#3 = (byte*) init_font_hex::charset#4 +Alias (byte) init_font_hex::idx#2 = (byte) init_font_hex::idx#6 +Alias (byte*) init_font_hex::proto_lo#2 = (byte*) init_font_hex::proto_lo#3 +Alias (byte) init_font_hex::c1#2 = (byte) init_font_hex::c1#3 +Alias (byte*) init_font_hex::proto_hi#2 = (byte*) init_font_hex::proto_hi#5 (byte*) init_font_hex::proto_hi#3 +Alias (byte) init_font_hex::c#2 = (byte) init_font_hex::c#3 (byte) init_font_hex::c#4 +Alias (byte*) init_font_hex::charset#0 = (byte*) init_font_hex::charset#7 +Alias (signed word) atan2_16::y#1 = (signed word) atan2_16::y#2 (signed word~) atan2_16::$3 (signed word) atan2_16::y#3 +Alias (signed word) atan2_16::x#5 = (signed word) atan2_16::x#9 (signed word) atan2_16::x#6 +Alias (signed word~) atan2_16::$2 = (signed word~) atan2_16::$1 +Alias (signed word) atan2_16::yi#0 = (signed word~) atan2_16::$4 (signed word) atan2_16::yi#9 (signed word) atan2_16::yi#10 +Alias (signed word) atan2_16::x#1 = (signed word) atan2_16::x#2 (signed word~) atan2_16::$8 (signed word) atan2_16::x#3 +Alias (signed word) atan2_16::y#12 = (signed word) atan2_16::y#15 (signed word) atan2_16::y#13 +Alias (signed word~) atan2_16::$7 = (signed word~) atan2_16::$6 +Alias (signed word) atan2_16::xi#0 = (signed word~) atan2_16::$9 +Alias (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#6 (signed word) atan2_16::xi#4 (signed word) atan2_16::xi#5 +Alias (byte) atan2_16::i#2 = (byte) atan2_16::i#6 (byte) atan2_16::i#3 (byte) atan2_16::i#4 +Alias (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#4 (signed word) atan2_16::yi#5 (signed word) atan2_16::yi#6 +Alias (word) atan2_16::angle#12 = (word) atan2_16::angle#14 (word) atan2_16::angle#7 (word) atan2_16::angle#8 +Alias (signed word) atan2_16::x#11 = (signed word) atan2_16::x#13 (signed word) atan2_16::x#7 (signed word) atan2_16::x#12 +Alias (signed word) atan2_16::y#10 = (signed word) atan2_16::y#14 (signed word) atan2_16::y#7 (signed word) atan2_16::y#11 +Alias (signed word) atan2_16::xd#0 = (signed word~) atan2_16::$19 (signed word) atan2_16::xd#1 (signed word) atan2_16::xd#2 +Alias (signed word) atan2_16::yd#0 = (signed word~) atan2_16::$20 (signed word) atan2_16::yd#1 (signed word) atan2_16::yd#2 +Alias (word) atan2_16::angle#1 = (word) atan2_16::angle#9 +Alias (signed word) atan2_16::y#5 = (signed word) atan2_16::y#6 +Alias (word) atan2_16::angle#4 = (word~) atan2_16::$12 +Alias (word) atan2_16::return#0 = (word) atan2_16::angle#10 (word) atan2_16::return#3 (word) atan2_16::return#1 +Alias (word) atan2_16::angle#11 = (word) atan2_16::angle#15 +Alias (word) atan2_16::angle#5 = (word~) atan2_16::$15 +Alias (byte*) main::toD0181_screen#0 = (byte*) main::toD0181_screen#1 +Alias (byte*) main::toD0181_gfx#0 = (byte*) main::toD0181_gfx#1 +Alias (byte) main::toD0181_return#0 = (byte~) main::toD0181_$8#0 (byte) main::toD0181_return#2 (byte) main::toD0181_return#1 (byte) main::toD0181_return#3 (byte~) main::$1 +Alias (byte*) main::clear_char#2 = (byte*) main::clear_char#4 (byte*) main::clear_char#3 +Alias (word~) init_screen::$1 = (word~) init_screen::$11 +Alias (signed word) init_screen::xw#0 = (signed word~) init_screen::$2 +Alias (word~) init_screen::$4 = (word~) init_screen::$12 +Alias (signed word) init_screen::yw#0 = (signed word~) init_screen::$5 +Alias (word) atan2_16::return#2 = (word) atan2_16::return#4 +Alias (byte*) init_screen::screen#2 = (byte*) init_screen::screen#3 +Alias (signed byte) init_screen::x#2 = (signed byte) init_screen::x#3 +Alias (signed byte) init_screen::y#2 = (signed byte) init_screen::y#5 (signed byte) init_screen::y#3 +Alias (word) init_screen::angle_w#0 = (word~) init_screen::$6 +Alias (byte) init_screen::ang_w#0 = (byte~) init_screen::$8 +Alias (byte*) init_screen::screen#1 = (byte*) init_screen::screen#5 +Successful SSA optimization Pass2AliasElimination +Alias (signed word) atan2_16::x#1 = (signed word) atan2_16::x#5 (signed word) atan2_16::x#10 +Alias (signed word) atan2_16::y#1 = (signed word) atan2_16::y#12 (signed word) atan2_16::y#9 +Alias (signed word) atan2_16::yi#0 = (signed word) atan2_16::yi#8 +Alias (byte) atan2_16::i#2 = (byte) atan2_16::i#5 +Alias (signed word) atan2_16::x#11 = (signed word) atan2_16::x#8 +Alias (signed word) atan2_16::y#10 = (signed word) atan2_16::y#8 +Alias (signed word) atan2_16::y#4 = (signed word) atan2_16::y#5 +Successful SSA optimization Pass2AliasElimination +Alias (signed word) atan2_16::x#11 = (signed word) atan2_16::x#4 +Alias (signed word) atan2_16::y#10 = (signed word) atan2_16::y#4 +Successful SSA optimization Pass2AliasElimination +Self Phi Eliminated (byte*) init_font_hex::proto_hi#2 +Self Phi Eliminated (byte*) init_font_hex::proto_lo#2 +Self Phi Eliminated (byte*) init_font_hex::charset#3 +Self Phi Eliminated (byte) init_font_hex::c1#2 +Self Phi Eliminated (byte) init_font_hex::c#2 +Self Phi Eliminated (signed word) atan2_16::x#11 +Self Phi Eliminated (signed word) atan2_16::y#10 +Self Phi Eliminated (byte*) main::clear_char#2 +Self Phi Eliminated (signed byte) init_screen::y#2 +Successful SSA optimization Pass2SelfPhiElimination +Identical Phi Values (byte*) init_font_hex::charset#6 (byte*) init_font_hex::charset#1 +Identical Phi Values (byte*) init_font_hex::proto_hi#2 (byte*) init_font_hex::proto_hi#4 +Identical Phi Values (byte*) init_font_hex::proto_lo#2 (byte*) init_font_hex::proto_lo#4 +Identical Phi Values (byte*) init_font_hex::charset#3 (byte*) init_font_hex::charset#2 +Identical Phi Values (byte) init_font_hex::c1#2 (byte) init_font_hex::c1#4 +Identical Phi Values (byte) init_font_hex::c#2 (byte) init_font_hex::c#5 +Identical Phi Values (signed word) atan2_16::y#1 (signed word) atan2_16::y#0 +Identical Phi Values (signed word) atan2_16::x#1 (signed word) atan2_16::x#0 +Identical Phi Values (signed word) atan2_16::x#11 (signed word) atan2_16::x#1 +Identical Phi Values (signed word) atan2_16::y#10 (signed word) atan2_16::y#1 +Identical Phi Values (byte*) main::clear_char#2 (byte*) main::clear_char#5 +Identical Phi Values (signed byte) init_screen::y#2 (signed byte) init_screen::y#4 +Successful SSA optimization Pass2IdenticalPhiElimination +Simple Condition (bool~) init_font_hex::$3 [19] if((byte) init_font_hex::i#1!=rangelast(0,4)) goto init_font_hex::@3 +Simple Condition (bool~) init_font_hex::$4 [29] if((byte) init_font_hex::c1#1!=rangelast(0,$f)) goto init_font_hex::@2 +Simple Condition (bool~) init_font_hex::$5 [34] if((byte) init_font_hex::c#1!=rangelast(0,$f)) goto init_font_hex::@1 +Simple Condition (bool~) atan2_16::$0 [42] if((signed word) atan2_16::y#0>(signed byte) 0) goto atan2_16::@1 +Simple Condition (bool~) atan2_16::$5 [51] if((signed word) atan2_16::x#0>(signed byte) 0) goto atan2_16::@4 +Simple Condition (bool~) atan2_16::$18 [65] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@16 +Simple Condition (bool~) atan2_16::$21 [72] if((signed word) atan2_16::yi#3>(signed byte) 0) goto atan2_16::@18 +Simple Condition (bool~) atan2_16::$11 [77] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 +Simple Condition (bool~) atan2_16::$22 [91] if((byte) atan2_16::i#1!=rangelast(0,atan2_16::$16)) goto atan2_16::@15 +Simple Condition (bool~) atan2_16::$14 [95] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 +Simple Condition (bool~) main::$3 [140] if(*((byte*) RASTER#0)!=(byte) $ff) goto main::@4 +Simple Condition (bool~) main::$6 [145] if((byte*) main::clear_char#5>=(byte*~) main::$4) goto main::@1 +Simple Condition (bool~) init_screen::$9 [179] if((signed byte) init_screen::x#1!=rangelast(-$13,$14)) goto init_screen::@2 +Simple Condition (bool~) init_screen::$10 [183] if((signed byte) init_screen::y#1!=rangelast(-$c,$c)) goto init_screen::@1 +Successful SSA optimization Pass2ConditionalJumpSimplification +Negating conditional jump and destination [91] if((byte) atan2_16::i#1==rangelast(0,atan2_16::$16)) goto atan2_16::@17 +Successful SSA optimization Pass2ConditionalJumpSequenceImprovement +Constant right-side identified [36] (byte[]) FONT_HEX_PROTO#0 ← { (byte) 2, (byte) 5, (byte) 5, (byte) 5, (byte) 2, (byte) 6, (byte) 2, (byte) 2, (byte) 2, (byte) 7, (byte) 6, (byte) 1, (byte) 2, (byte) 4, (byte) 7, (byte) 6, (byte) 1, (byte) 2, (byte) 1, (byte) 6, (byte) 5, (byte) 5, (byte) 7, (byte) 1, (byte) 1, (byte) 7, (byte) 4, (byte) 6, (byte) 1, (byte) 6, (byte) 3, (byte) 4, (byte) 6, (byte) 5, (byte) 2, (byte) 7, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 2, (byte) 5, (byte) 2, (byte) 5, (byte) 2, (byte) 2, (byte) 5, (byte) 3, (byte) 1, (byte) 1, (byte) 2, (byte) 5, (byte) 7, (byte) 5, (byte) 5, (byte) 6, (byte) 5, (byte) 6, (byte) 5, (byte) 6, (byte) 2, (byte) 5, (byte) 4, (byte) 5, (byte) 2, (byte) 6, (byte) 5, (byte) 5, (byte) 5, (byte) 6, (byte) 7, (byte) 4, (byte) 6, (byte) 4, (byte) 7, (byte) 7, (byte) 4, (byte) 6, (byte) 4, (byte) 4 } +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) init_font_hex::c#0 = 0 +Constant (const byte) init_font_hex::c1#0 = 0 +Constant (const byte) init_font_hex::idx#0 = 0 +Constant (const byte) init_font_hex::i#0 = 0 +Constant (const byte[]) FONT_HEX_PROTO#0 = { 2, 5, 5, 5, 2, 6, 2, 2, 2, 7, 6, 1, 2, 4, 7, 6, 1, 2, 1, 6, 5, 5, 7, 1, 1, 7, 4, 6, 1, 6, 3, 4, 6, 5, 2, 7, 1, 1, 1, 1, 2, 5, 2, 5, 2, 2, 5, 3, 1, 1, 2, 5, 7, 5, 5, 6, 5, 6, 5, 6, 2, 5, 4, 5, 2, 6, 5, 5, 5, 6, 7, 4, 6, 4, 7, 7, 4, 6, 4, 4 } +Constant (const byte) CORDIC_ITERATIONS_16#0 = $f +Constant (const word*) CORDIC_ATAN2_ANGLES_16#0 = (word*) 4096 +Constant (const word) atan2_16::angle#0 = 0 +Constant (const byte) atan2_16::i#0 = 0 +Constant (const byte) CORDIC_ITERATIONS_8#0 = 8 +Constant (const byte*) CORDIC_ATAN2_ANGLES_8#0 = (byte*) 4352 +Constant (const byte*) RASTER#0 = (byte*) 53266 +Constant (const byte*) D018#0 = (byte*) 53272 +Constant (const byte*) CHARSET#0 = (byte*) 8192 +Constant (const byte*) SCREEN#0 = (byte*) 10240 +Constant (const signed byte) init_screen::y#0 = -$c +Constant (const signed byte) init_screen::x#0 = -$13 +Successful SSA optimization Pass2ConstantIdentification +Constant (const byte*) init_font_hex::proto_hi#0 = FONT_HEX_PROTO#0 +Constant (const byte*) init_font_hex::proto_lo#0 = FONT_HEX_PROTO#0 +Constant (const byte*) init_font_hex::charset#1 = CHARSET#0 +Constant (const byte*) main::toD0181_screen#0 = SCREEN#0 +Constant (const byte*) main::toD0181_gfx#0 = CHARSET#0 +Constant (const byte*) main::clear_char#0 = CHARSET#0 +Constant (const byte*) init_screen::screen#0 = SCREEN#0 +Successful SSA optimization Pass2ConstantIdentification +Constant value identified (word)main::toD0181_screen#0 in [119] (word~) main::toD0181_$0#0 ← (word)(const byte*) main::toD0181_screen#0 +Constant value identified (word)main::toD0181_gfx#0 in [123] (word~) main::toD0181_$4#0 ← (word)(const byte*) main::toD0181_gfx#0 +Successful SSA optimization Pass2ConstantValues +if() condition always true - replacing block destination [137] if(true) goto main::@4 +Successful SSA optimization Pass2ConstantIfs +Resolved ranged next value [17] init_font_hex::i#1 ← ++ init_font_hex::i#2 to ++ +Resolved ranged comparison value [19] if(init_font_hex::i#1!=rangelast(0,4)) goto init_font_hex::@3 to (number) 5 +Resolved ranged next value [27] init_font_hex::c1#1 ← ++ init_font_hex::c1#4 to ++ +Resolved ranged comparison value [29] if(init_font_hex::c1#1!=rangelast(0,$f)) goto init_font_hex::@2 to (number) $10 +Resolved ranged next value [32] init_font_hex::c#1 ← ++ init_font_hex::c#5 to ++ +Resolved ranged comparison value [34] if(init_font_hex::c#1!=rangelast(0,$f)) goto init_font_hex::@1 to (number) $10 +Resolved ranged next value [177] init_screen::x#1 ← ++ init_screen::x#2 to ++ +Resolved ranged comparison value [179] if(init_screen::x#1!=rangelast(-$13,$14)) goto init_screen::@2 to (number) $15 +Resolved ranged next value [181] init_screen::y#1 ← ++ init_screen::y#4 to ++ +Resolved ranged comparison value [183] if(init_screen::y#1!=rangelast(-$c,$c)) goto init_screen::@1 to (number) $d +Simplifying expression containing zero init_font_hex::charset#2 in [8] *((byte*) init_font_hex::charset#2 + (const byte) init_font_hex::idx#0) ← (byte) 0 +Successful SSA optimization PassNSimplifyExpressionWithZero +Eliminating unused variable (byte) init_font_hex::idx#4 and assignment [15] (byte) init_font_hex::idx#4 ← ++ (byte) init_font_hex::idx#3 +Successful SSA optimization PassNEliminateUnusedVars +Removing unused block main::@return +Successful SSA optimization Pass2EliminateUnusedBlocks +Adding number conversion cast (unumber) 5 in if((byte) init_font_hex::i#1!=(number) 5) goto init_font_hex::@3 +Adding number conversion cast (unumber) $10 in if((byte) init_font_hex::c1#1!=(number) $10) goto init_font_hex::@2 +Adding number conversion cast (unumber) $10 in if((byte) init_font_hex::c#1!=(number) $10) goto init_font_hex::@1 +Adding number conversion cast (snumber) $15 in if((signed byte) init_screen::x#1!=(number) $15) goto init_screen::@2 +Adding number conversion cast (snumber) $d in if((signed byte) init_screen::y#1!=(number) $d) goto init_screen::@1 +Successful SSA optimization PassNAddNumberTypeConversions +Simplifying constant integer cast 5 +Simplifying constant integer cast $10 +Simplifying constant integer cast $10 +Simplifying constant integer cast $15 +Simplifying constant integer cast $d +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) 5 +Finalized unsigned number type (byte) $10 +Finalized unsigned number type (byte) $10 +Finalized signed number type (signed byte) $15 +Finalized signed number type (signed byte) $d +Successful SSA optimization PassNFinalizeNumberTypeConversions +Self Phi Eliminated (byte*) init_font_hex::proto_hi#4 +Self Phi Eliminated (byte) init_font_hex::c#5 +Self Phi Eliminated (byte*) main::clear_char#5 +Successful SSA optimization Pass2SelfPhiElimination +Identical Phi Values (byte*) init_font_hex::proto_hi#4 (byte*) init_font_hex::proto_hi#6 +Identical Phi Values (byte) init_font_hex::c#5 (byte) init_font_hex::c#6 +Successful SSA optimization Pass2IdenticalPhiElimination +Constant right-side identified [3] (byte) init_font_hex::idx#1 ← ++ (const byte) init_font_hex::idx#0 +Constant right-side identified [30] (byte~) atan2_16::$16 ← (const byte) CORDIC_ITERATIONS_16#0 - (byte) 1 +Constant right-side identified [71] (byte*~) main::$4 ← (const byte*) CHARSET#0 + (word) $800 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) init_font_hex::idx#1 = ++init_font_hex::idx#0 +Constant (const byte) atan2_16::$16 = CORDIC_ITERATIONS_16#0-1 +Constant (const word) main::toD0181_$0#0 = (word)main::toD0181_screen#0 +Constant (const word) main::toD0181_$4#0 = (word)main::toD0181_gfx#0 +Constant (const byte*) main::$4 = CHARSET#0+$800 +Successful SSA optimization Pass2ConstantIdentification +Resolved ranged next value [48] atan2_16::i#1 ← ++ atan2_16::i#2 to ++ +Resolved ranged comparison value [49] if(atan2_16::i#1==rangelast(0,atan2_16::$16)) goto atan2_16::@17 to (const byte) atan2_16::$16+(number) 1 +Adding number conversion cast (unumber) atan2_16::$16+1 in if((byte) atan2_16::i#1==(const byte) atan2_16::$16+(number) 1) goto atan2_16::@17 +Adding number conversion cast (unumber) 1 in if((byte) atan2_16::i#1==(unumber)(const byte) atan2_16::$16+(number) 1) goto atan2_16::@17 +Successful SSA optimization PassNAddNumberTypeConversions +Simplifying constant integer cast (const byte) atan2_16::$16+(unumber)(number) 1 +Simplifying constant integer cast 1 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) 1 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Constant right-side identified [56] (word~) main::toD0181_$1#0 ← (const word) main::toD0181_$0#0 & (word) $3fff +Constant right-side identified [59] (byte~) main::toD0181_$5#0 ← > (const word) main::toD0181_$4#0 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const word) main::toD0181_$1#0 = main::toD0181_$0#0&$3fff +Constant (const byte) main::toD0181_$5#0 = >main::toD0181_$4#0 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [56] (word~) main::toD0181_$2#0 ← (const word) main::toD0181_$1#0 * (byte) 4 +Constant right-side identified [58] (byte~) main::toD0181_$6#0 ← (const byte) main::toD0181_$5#0 / (byte) 4 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const word) main::toD0181_$2#0 = main::toD0181_$1#0*4 +Constant (const byte) main::toD0181_$6#0 = main::toD0181_$5#0/4 +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [56] (byte~) main::toD0181_$3#0 ← > (const word) main::toD0181_$2#0 +Constant right-side identified [57] (byte~) main::toD0181_$7#0 ← (const byte) main::toD0181_$6#0 & (byte) $f +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) main::toD0181_$3#0 = >main::toD0181_$2#0 +Constant (const byte) main::toD0181_$7#0 = main::toD0181_$6#0&$f +Successful SSA optimization Pass2ConstantIdentification +Constant right-side identified [56] (byte) main::toD0181_return#0 ← (const byte) main::toD0181_$3#0 | (const byte) main::toD0181_$7#0 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) main::toD0181_return#0 = main::toD0181_$3#0|main::toD0181_$7#0 +Successful SSA optimization Pass2ConstantIdentification +Inlining Noop Cast [65] (byte~) init_screen::$0 ← (byte)(signed byte) init_screen::x#2 keeping init_screen::x#2 +Inlining Noop Cast [68] (byte~) init_screen::$3 ← (byte)(signed byte) init_screen::y#4 keeping init_screen::y#4 +Successful SSA optimization Pass2NopCastInlining +Inlining Noop Cast [67] (signed word) init_screen::xw#0 ← (signed word)(word~) init_screen::$1 keeping init_screen::xw#0 +Inlining Noop Cast [70] (signed word) init_screen::yw#0 ← (signed word)(word~) init_screen::$4 keeping init_screen::yw#0 +Successful SSA optimization Pass2NopCastInlining +Rewriting division to use shift [35] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 / (byte) 2 +Rewriting multiplication to use shift [39] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 * (const byte) SIZEOF_WORD +Rewriting multiplication to use shift [43] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 * (const byte) SIZEOF_WORD +Successful SSA optimization Pass2MultiplyToShiftRewriting +Inlining constant with var siblings (const byte) init_font_hex::c#0 +Inlining constant with var siblings (const byte) init_font_hex::c1#0 +Inlining constant with var siblings (const byte) init_font_hex::idx#0 +Inlining constant with var siblings (const byte) init_font_hex::i#0 +Inlining constant with var siblings (const byte*) init_font_hex::proto_hi#0 +Inlining constant with var siblings (const byte*) init_font_hex::proto_lo#0 +Inlining constant with var siblings (const byte*) init_font_hex::charset#1 +Inlining constant with var siblings (const byte) init_font_hex::idx#1 +Inlining constant with var siblings (const word) atan2_16::angle#0 +Inlining constant with var siblings (const byte) atan2_16::i#0 +Inlining constant with var siblings (const byte*) main::clear_char#0 +Inlining constant with var siblings (const signed byte) init_screen::y#0 +Inlining constant with var siblings (const signed byte) init_screen::x#0 +Inlining constant with var siblings (const byte*) init_screen::screen#0 +Constant inlined main::toD0181_screen#0 = (const byte*) SCREEN#0 +Constant inlined main::toD0181_gfx#0 = (const byte*) CHARSET#0 +Constant inlined main::clear_char#0 = (const byte*) CHARSET#0 +Constant inlined init_font_hex::proto_hi#0 = (const byte[]) FONT_HEX_PROTO#0 +Constant inlined atan2_16::angle#0 = (byte) 0 +Constant inlined init_screen::screen#0 = (const byte*) SCREEN#0 +Constant inlined init_font_hex::charset#1 = (const byte*) CHARSET#0 +Constant inlined init_font_hex::c1#0 = (byte) 0 +Constant inlined atan2_16::$16 = (const byte) CORDIC_ITERATIONS_16#0-(byte) 1 +Constant inlined init_screen::y#0 = (signed byte) -$c +Constant inlined init_screen::x#0 = (signed byte) -$13 +Constant inlined atan2_16::i#0 = (byte) 0 +Constant inlined main::toD0181_$0#0 = (word)(const byte*) SCREEN#0 +Constant inlined main::toD0181_$1#0 = (word)(const byte*) SCREEN#0&(word) $3fff +Constant inlined init_font_hex::i#0 = (byte) 0 +Constant inlined main::toD0181_$6#0 = >(word)(const byte*) CHARSET#0/(byte) 4 +Constant inlined main::toD0181_$7#0 = >(word)(const byte*) CHARSET#0/(byte) 4&(byte) $f +Constant inlined init_font_hex::idx#1 = ++(byte) 0 +Constant inlined init_font_hex::idx#0 = (byte) 0 +Constant inlined main::toD0181_$2#0 = (word)(const byte*) SCREEN#0&(word) $3fff*(byte) 4 +Constant inlined main::toD0181_$3#0 = >(word)(const byte*) SCREEN#0&(word) $3fff*(byte) 4 +Constant inlined main::toD0181_$4#0 = (word)(const byte*) CHARSET#0 +Constant inlined main::toD0181_$5#0 = >(word)(const byte*) CHARSET#0 +Constant inlined init_font_hex::proto_lo#0 = (const byte[]) FONT_HEX_PROTO#0 +Constant inlined init_font_hex::c#0 = (byte) 0 +Constant inlined main::$4 = (const byte*) CHARSET#0+(word) $800 +Successful SSA optimization Pass2ConstantInlining +Simplifying constant integer increment ++0 +Successful SSA optimization Pass2ConstantSimplification +Eliminating unused constant (const byte) SIZEOF_WORD +Successful SSA optimization PassNEliminateUnusedVars +Added new block during phi lifting init_font_hex::@7(between init_font_hex::@5 and init_font_hex::@1) +Added new block during phi lifting init_font_hex::@8(between init_font_hex::@4 and init_font_hex::@2) +Added new block during phi lifting init_font_hex::@9(between init_font_hex::@3 and init_font_hex::@3) +Added new block during phi lifting atan2_16::@26(between atan2_16::@19 and atan2_16::@15) +Added new block during phi lifting atan2_16::@27(between atan2_16::@15 and atan2_16::@17) +Added new block during phi lifting atan2_16::@28(between atan2_16::@19 and atan2_16::@17) +Added new block during phi lifting atan2_16::@29(between atan2_16::@17 and atan2_16::@7) +Added new block during phi lifting atan2_16::@30(between atan2_16::@7 and atan2_16::@8) +Added new block during phi lifting init_screen::@6(between init_screen::@3 and init_screen::@1) +Added new block during phi lifting init_screen::@7(between init_screen::@5 and init_screen::@2) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @3 +Adding NOP phi() at start of @7 +Adding NOP phi() at start of @9 +Adding NOP phi() at start of @10 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@12 +Adding NOP phi() at start of main::toD0181 +Adding NOP phi() at start of main::toD0181_@return +Adding NOP phi() at start of main::@13 +Adding NOP phi() at start of init_screen +Adding NOP phi() at start of init_font_hex +CALL GRAPH +Calls in [] to main:6 +Calls in [main] to init_font_hex:10 init_screen:15 +Calls in [init_screen] to atan2_16:31 + +Created 25 initial phi equivalence classes +Coalesced [22] main::clear_char#6 ← main::clear_char#1 +Coalesced [25] init_screen::screen#7 ← init_screen::screen#4 +Coalesced [43] init_screen::y#6 ← init_screen::y#1 +Coalesced [44] init_screen::screen#6 ← init_screen::screen#1 +Coalesced [45] init_screen::x#4 ← init_screen::x#1 +Coalesced (already) [46] init_screen::screen#8 ← init_screen::screen#1 +Coalesced [49] atan2_16::yi#12 ← atan2_16::$2 +Coalesced [53] atan2_16::xi#9 ← atan2_16::$7 +Coalesced [55] atan2_16::yi#14 ← atan2_16::yi#0 +Coalesced [56] atan2_16::xi#11 ← atan2_16::xi#0 +Coalesced [59] atan2_16::angle#17 ← atan2_16::angle#12 +Coalesced [64] atan2_16::angle#22 ← atan2_16::angle#4 +Coalesced [68] atan2_16::return#5 ← atan2_16::angle#5 +Coalesced [71] atan2_16::return#6 ← atan2_16::angle#11 +Coalesced [72] atan2_16::angle#21 ← atan2_16::angle#1 +Coalesced [80] atan2_16::yi#16 ← atan2_16::yi#2 +Coalesced [81] atan2_16::angle#20 ← atan2_16::angle#3 +Coalesced [82] atan2_16::xi#13 ← atan2_16::xi#2 +Coalesced [86] atan2_16::yi#13 ← atan2_16::yi#7 +Coalesced [87] atan2_16::xi#10 ← atan2_16::xi#7 +Coalesced [88] atan2_16::i#7 ← atan2_16::i#1 +Coalesced [89] atan2_16::angle#16 ← atan2_16::angle#13 +Coalesced (already) [90] atan2_16::angle#18 ← atan2_16::angle#13 +Coalesced [95] atan2_16::yi#15 ← atan2_16::yi#1 +Coalesced [96] atan2_16::angle#19 ← atan2_16::angle#2 +Coalesced [97] atan2_16::xi#12 ← atan2_16::xi#1 +Not coalescing [98] atan2_16::xi#8 ← atan2_16::x#0 +Not coalescing [99] atan2_16::yi#11 ← atan2_16::y#0 +Coalesced [102] init_font_hex::charset#9 ← init_font_hex::charset#5 +Coalesced [124] init_font_hex::charset#8 ← init_font_hex::charset#0 +Coalesced [125] init_font_hex::proto_hi#7 ← init_font_hex::proto_hi#1 +Coalesced [126] init_font_hex::c#7 ← init_font_hex::c#1 +Coalesced (already) [127] init_font_hex::charset#10 ← init_font_hex::charset#0 +Coalesced [128] init_font_hex::proto_lo#5 ← init_font_hex::proto_lo#1 +Coalesced [129] init_font_hex::c1#5 ← init_font_hex::c1#1 +Coalesced [130] init_font_hex::i#3 ← init_font_hex::i#1 +Coalesced [131] init_font_hex::idx#7 ← init_font_hex::idx#2 +Coalesced down to 18 phi equivalence classes +Culled Empty Block (label) @3 +Culled Empty Block (label) @7 +Culled Empty Block (label) @10 +Culled Empty Block (label) main::@12 +Culled Empty Block (label) main::toD0181_@return +Culled Empty Block (label) main::@13 +Culled Empty Block (label) init_screen::@6 +Culled Empty Block (label) init_screen::@7 +Culled Empty Block (label) atan2_16::@27 +Culled Empty Block (label) atan2_16::@30 +Culled Empty Block (label) atan2_16::@29 +Culled Empty Block (label) atan2_16::@26 +Culled Empty Block (label) atan2_16::@28 +Culled Empty Block (label) init_font_hex::@7 +Culled Empty Block (label) init_font_hex::@8 +Culled Empty Block (label) init_font_hex::@9 +Renumbering block @9 to @3 +Renumbering block atan2_16::@13 to atan2_16::@9 +Renumbering block atan2_16::@15 to atan2_16::@10 +Renumbering block atan2_16::@16 to atan2_16::@11 +Renumbering block atan2_16::@17 to atan2_16::@12 +Renumbering block atan2_16::@18 to atan2_16::@13 +Renumbering block atan2_16::@19 to atan2_16::@14 +Renumbering block atan2_16::@22 to atan2_16::@15 +Renumbering block atan2_16::@25 to atan2_16::@16 +Renumbering block main::@4 to main::@2 +Renumbering block main::@5 to main::@3 +Renumbering block main::@6 to main::@4 +Renumbering block main::@11 to main::@5 +Renumbering block init_screen::@5 to init_screen::@4 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @3 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::toD0181 +Adding NOP phi() at start of init_screen +Adding NOP phi() at start of init_font_hex + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + kickasm(location (const word*) CORDIC_ATAN2_ANGLES_16#0 uses CORDIC_ITERATIONS_16#0) {{ .for (var i=0; i=(const byte*) CHARSET#0+(word) $800) goto main::@1 + to:main::@4 +main::@4: scope:[main] from main::@3 + [14] *((byte*) main::clear_char#5) ← (byte) 0 + [15] (byte*) main::clear_char#1 ← ++ (byte*) main::clear_char#5 + to:main::@1 +init_screen: scope:[init_screen] from main::@5 + [16] phi() + to:init_screen::@1 +init_screen::@1: scope:[init_screen] from init_screen init_screen::@3 + [17] (byte*) init_screen::screen#4 ← phi( init_screen/(const byte*) SCREEN#0 init_screen::@3/(byte*) init_screen::screen#1 ) + [17] (signed byte) init_screen::y#4 ← phi( init_screen/(signed byte) -$c init_screen::@3/(signed byte) init_screen::y#1 ) + to:init_screen::@2 +init_screen::@2: scope:[init_screen] from init_screen::@1 init_screen::@4 + [18] (byte*) init_screen::screen#2 ← phi( init_screen::@1/(byte*) init_screen::screen#4 init_screen::@4/(byte*) init_screen::screen#1 ) + [18] (signed byte) init_screen::x#2 ← phi( init_screen::@1/(signed byte) -$13 init_screen::@4/(signed byte) init_screen::x#1 ) + [19] (word) init_screen::xw#0 ← (byte)(signed byte) init_screen::x#2 w= (byte) 0 + [20] (word) init_screen::yw#0 ← (byte)(signed byte) init_screen::y#4 w= (byte) 0 + [21] (signed word) atan2_16::x#0 ← (signed word)(word) init_screen::xw#0 + [22] (signed word) atan2_16::y#0 ← (signed word)(word) init_screen::yw#0 + [23] call atan2_16 + [24] (word) atan2_16::return#2 ← (word) atan2_16::return#0 + to:init_screen::@4 +init_screen::@4: scope:[init_screen] from init_screen::@2 + [25] (word) init_screen::angle_w#0 ← (word) atan2_16::return#2 + [26] (word~) init_screen::$7 ← (word) init_screen::angle_w#0 + (byte) $80 + [27] (byte) init_screen::ang_w#0 ← > (word~) init_screen::$7 + [28] *((byte*) init_screen::screen#2) ← (byte) init_screen::ang_w#0 + [29] (byte*) init_screen::screen#1 ← ++ (byte*) init_screen::screen#2 + [30] (signed byte) init_screen::x#1 ← ++ (signed byte) init_screen::x#2 + [31] if((signed byte) init_screen::x#1!=(signed byte) $15) goto init_screen::@2 + to:init_screen::@3 +init_screen::@3: scope:[init_screen] from init_screen::@4 + [32] (signed byte) init_screen::y#1 ← ++ (signed byte) init_screen::y#4 + [33] if((signed byte) init_screen::y#1!=(signed byte) $d) goto init_screen::@1 + to:init_screen::@return +init_screen::@return: scope:[init_screen] from init_screen::@3 + [34] return + to:@return +atan2_16: scope:[atan2_16] from init_screen::@2 + [35] if((signed word) atan2_16::y#0>(signed byte) 0) goto atan2_16::@1 + to:atan2_16::@2 +atan2_16::@2: scope:[atan2_16] from atan2_16 + [36] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 + to:atan2_16::@3 +atan2_16::@3: scope:[atan2_16] from atan2_16::@1 atan2_16::@2 + [37] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word~) atan2_16::yi#11 atan2_16::@2/(signed word~) atan2_16::$2 ) + [38] if((signed word) atan2_16::x#0>(signed byte) 0) goto atan2_16::@4 + to:atan2_16::@5 +atan2_16::@5: scope:[atan2_16] from atan2_16::@3 + [39] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 + to:atan2_16::@6 +atan2_16::@6: scope:[atan2_16] from atan2_16::@4 atan2_16::@5 + [40] (signed word) atan2_16::xi#0 ← phi( atan2_16::@4/(signed word~) atan2_16::xi#8 atan2_16::@5/(signed word~) atan2_16::$7 ) + to:atan2_16::@10 +atan2_16::@10: scope:[atan2_16] from atan2_16::@14 atan2_16::@6 + [41] (word) atan2_16::angle#12 ← phi( atan2_16::@14/(word) atan2_16::angle#13 atan2_16::@6/(byte) 0 ) + [41] (byte) atan2_16::i#2 ← phi( atan2_16::@14/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 ) + [41] (signed word) atan2_16::xi#3 ← phi( atan2_16::@14/(signed word) atan2_16::xi#7 atan2_16::@6/(signed word) atan2_16::xi#0 ) + [41] (signed word) atan2_16::yi#3 ← phi( atan2_16::@14/(signed word) atan2_16::yi#7 atan2_16::@6/(signed word) atan2_16::yi#0 ) + [42] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 + to:atan2_16::@12 +atan2_16::@12: scope:[atan2_16] from atan2_16::@10 atan2_16::@14 + [43] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@14/(word) atan2_16::angle#13 ) + [44] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 + [45] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 + to:atan2_16::@16 +atan2_16::@16: scope:[atan2_16] from atan2_16::@12 + [46] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 + to:atan2_16::@7 +atan2_16::@7: scope:[atan2_16] from atan2_16::@12 atan2_16::@16 + [47] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@16/(word) atan2_16::angle#4 ) + [48] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 + to:atan2_16::@9 +atan2_16::@9: scope:[atan2_16] from atan2_16::@7 + [49] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 + to:atan2_16::@8 +atan2_16::@8: scope:[atan2_16] from atan2_16::@7 atan2_16::@9 + [50] (word) atan2_16::return#0 ← phi( atan2_16::@9/(word) atan2_16::angle#5 atan2_16::@7/(word) atan2_16::angle#11 ) + to:atan2_16::@return +atan2_16::@return: scope:[atan2_16] from atan2_16::@8 + [51] return + to:@return +atan2_16::@11: scope:[atan2_16] from atan2_16::@10 + [52] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 + [53] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 + [54] if((signed word) atan2_16::yi#3>(signed byte) 0) goto atan2_16::@13 + to:atan2_16::@15 +atan2_16::@15: scope:[atan2_16] from atan2_16::@11 + [55] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 + [56] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 + [57] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 + [58] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) + to:atan2_16::@14 +atan2_16::@14: scope:[atan2_16] from atan2_16::@13 atan2_16::@15 + [59] (signed word) atan2_16::xi#7 ← phi( atan2_16::@13/(signed word) atan2_16::xi#1 atan2_16::@15/(signed word) atan2_16::xi#2 ) + [59] (word) atan2_16::angle#13 ← phi( atan2_16::@13/(word) atan2_16::angle#2 atan2_16::@15/(word) atan2_16::angle#3 ) + [59] (signed word) atan2_16::yi#7 ← phi( atan2_16::@13/(signed word) atan2_16::yi#1 atan2_16::@15/(signed word) atan2_16::yi#2 ) + [60] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 + [61] if((byte) atan2_16::i#1==(const byte) CORDIC_ITERATIONS_16#0-(byte) 1+(byte) 1) goto atan2_16::@12 + to:atan2_16::@10 +atan2_16::@13: scope:[atan2_16] from atan2_16::@11 + [62] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 + [63] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 + [64] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 + [65] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) + to:atan2_16::@14 +atan2_16::@4: scope:[atan2_16] from atan2_16::@3 + [66] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 + to:atan2_16::@6 +atan2_16::@1: scope:[atan2_16] from atan2_16 + [67] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 + to:atan2_16::@3 +init_font_hex: scope:[init_font_hex] from main + [68] phi() + to:init_font_hex::@1 +init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5 + [69] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 ) + [69] (byte*) init_font_hex::proto_hi#6 ← phi( init_font_hex/(const byte[]) FONT_HEX_PROTO#0 init_font_hex::@5/(byte*) init_font_hex::proto_hi#1 ) + [69] (byte*) init_font_hex::charset#5 ← phi( init_font_hex/(const byte*) CHARSET#0 init_font_hex::@5/(byte*) init_font_hex::charset#0 ) + to:init_font_hex::@2 +init_font_hex::@2: scope:[init_font_hex] from init_font_hex::@1 init_font_hex::@4 + [70] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 ) + [70] (byte*) init_font_hex::proto_lo#4 ← phi( init_font_hex::@1/(const byte[]) FONT_HEX_PROTO#0 init_font_hex::@4/(byte*) init_font_hex::proto_lo#1 ) + [70] (byte*) init_font_hex::charset#2 ← phi( init_font_hex::@1/(byte*) init_font_hex::charset#5 init_font_hex::@4/(byte*) init_font_hex::charset#0 ) + [71] *((byte*) init_font_hex::charset#2) ← (byte) 0 + to:init_font_hex::@3 +init_font_hex::@3: scope:[init_font_hex] from init_font_hex::@2 init_font_hex::@3 + [72] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 ) + [72] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 ) + [73] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 + [74] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 + [75] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 + [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 + [77] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 + [78] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 + [79] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 + to:init_font_hex::@4 +init_font_hex::@4: scope:[init_font_hex] from init_font_hex::@3 + [80] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 + [81] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 + [82] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 + [83] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 + [84] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 + [85] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 + [86] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 + to:init_font_hex::@5 +init_font_hex::@5: scope:[init_font_hex] from init_font_hex::@4 + [87] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 + [88] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 + [89] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 + to:init_font_hex::@return +init_font_hex::@return: scope:[init_font_hex] from init_font_hex::@5 + [90] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(byte*) CHARSET +(word*) CORDIC_ATAN2_ANGLES_16 +(byte*) CORDIC_ATAN2_ANGLES_8 +(byte) CORDIC_ITERATIONS_16 +(byte) CORDIC_ITERATIONS_8 +(byte*) D018 +(byte[]) FONT_HEX_PROTO +(byte*) RASTER +(byte*) SCREEN +(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y) +(signed word~) atan2_16::$2 4.0 +(byte~) atan2_16::$23 2002.0 +(byte~) atan2_16::$24 2002.0 +(signed word~) atan2_16::$7 4.0 +(word) atan2_16::angle +(word) atan2_16::angle#1 3.0 +(word) atan2_16::angle#11 4.0 +(word) atan2_16::angle#12 364.0 +(word) atan2_16::angle#13 1334.6666666666667 +(word) atan2_16::angle#2 2002.0 +(word) atan2_16::angle#3 2002.0 +(word) atan2_16::angle#4 4.0 +(word) atan2_16::angle#5 4.0 +(word) atan2_16::angle#6 2004.0 +(byte) atan2_16::i +(byte) atan2_16::i#1 1501.5 +(byte) atan2_16::i#2 429.0 +(word) atan2_16::return +(word) atan2_16::return#0 34.99999999999999 +(word) atan2_16::return#2 202.0 +(signed word) atan2_16::x +(signed word) atan2_16::x#0 3.8928571428571437 +(signed word) atan2_16::xd +(signed word) atan2_16::xd#0 600.5999999999999 +(signed word) atan2_16::xi +(signed word) atan2_16::xi#0 6.0 +(signed word) atan2_16::xi#1 500.5 +(signed word) atan2_16::xi#2 500.5 +(signed word) atan2_16::xi#3 801.2 +(signed word) atan2_16::xi#7 1001.0 +(signed word~) atan2_16::xi#8 4.0 +(signed word) atan2_16::y +(signed word) atan2_16::y#0 3.633333333333334 +(signed word) atan2_16::yd +(signed word) atan2_16::yd#0 1501.5 +(signed word) atan2_16::yi +(signed word) atan2_16::yi#0 1.2000000000000002 +(signed word) atan2_16::yi#1 667.3333333333334 +(signed word~) atan2_16::yi#11 4.0 +(signed word) atan2_16::yi#2 667.3333333333334 +(signed word) atan2_16::yi#3 858.2857142857142 +(signed word) atan2_16::yi#7 1001.0 +(void()) init_font_hex((byte*) init_font_hex::charset) +(byte~) init_font_hex::$0 1001.0 +(byte~) init_font_hex::$1 2002.0 +(byte~) init_font_hex::$2 2002.0 +(byte) init_font_hex::c +(byte) init_font_hex::c#1 16.5 +(byte) init_font_hex::c#6 1.1578947368421053 +(byte) init_font_hex::c1 +(byte) init_font_hex::c1#1 151.5 +(byte) init_font_hex::c1#4 13.466666666666667 +(byte*) init_font_hex::charset +(byte*) init_font_hex::charset#0 35.5 +(byte*) init_font_hex::charset#2 108.35714285714285 +(byte*) init_font_hex::charset#5 22.0 +(byte) init_font_hex::i +(byte) init_font_hex::i#1 1501.5 +(byte) init_font_hex::i#2 667.3333333333334 +(byte) init_font_hex::idx +(byte) init_font_hex::idx#2 551.0 +(byte) init_font_hex::idx#3 202.0 +(byte) init_font_hex::idx#5 600.5999999999999 +(byte*) init_font_hex::proto_hi +(byte*) init_font_hex::proto_hi#1 7.333333333333333 +(byte*) init_font_hex::proto_hi#6 56.83333333333334 +(byte*) init_font_hex::proto_lo +(byte*) init_font_hex::proto_lo#1 50.5 +(byte*) init_font_hex::proto_lo#4 92.53846153846155 +(void()) init_screen() +(word~) init_screen::$7 202.0 +(byte) init_screen::ang_w +(byte) init_screen::ang_w#0 202.0 +(word) init_screen::angle_w +(word) init_screen::angle_w#0 202.0 +(byte*) init_screen::screen +(byte*) init_screen::screen#1 42.599999999999994 +(byte*) init_screen::screen#2 28.545454545454547 +(byte*) init_screen::screen#4 22.0 +(signed byte) init_screen::x +(signed byte) init_screen::x#1 151.5 +(signed byte) init_screen::x#2 16.833333333333332 +(signed word) init_screen::xw +(word) init_screen::xw#0 50.5 +(signed byte) init_screen::y +(signed byte) init_screen::y#1 16.5 +(signed byte) init_screen::y#4 1.4666666666666666 +(signed word) init_screen::yw +(word) init_screen::yw#0 50.5 +(void()) main() +(byte*) main::clear_char +(byte*) main::clear_char#1 22.0 +(byte*) main::clear_char#5 33.5 +(word~) main::toD0181_$0 +(number~) main::toD0181_$1 +(number~) main::toD0181_$2 +(number~) main::toD0181_$3 +(word~) main::toD0181_$4 +(byte~) main::toD0181_$5 +(number~) main::toD0181_$6 +(number~) main::toD0181_$7 +(number~) main::toD0181_$8 +(byte*) main::toD0181_gfx +(byte) main::toD0181_return +(byte*) main::toD0181_screen + +Initial phi equivalence classes +[ main::clear_char#5 main::clear_char#1 ] +[ init_screen::y#4 init_screen::y#1 ] +[ init_screen::x#2 init_screen::x#1 ] +[ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] +[ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] +[ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] +[ atan2_16::i#2 atan2_16::i#1 ] +[ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] +[ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] +[ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +[ init_font_hex::c#6 init_font_hex::c#1 ] +[ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +[ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +[ init_font_hex::c1#4 init_font_hex::c1#1 ] +[ init_font_hex::i#2 init_font_hex::i#1 ] +[ init_font_hex::idx#5 init_font_hex::idx#2 ] +Added variable init_screen::xw#0 to zero page equivalence class [ init_screen::xw#0 ] +Added variable init_screen::yw#0 to zero page equivalence class [ init_screen::yw#0 ] +Added variable atan2_16::x#0 to zero page equivalence class [ atan2_16::x#0 ] +Added variable atan2_16::y#0 to zero page equivalence class [ atan2_16::y#0 ] +Added variable atan2_16::return#2 to zero page equivalence class [ atan2_16::return#2 ] +Added variable init_screen::angle_w#0 to zero page equivalence class [ init_screen::angle_w#0 ] +Added variable init_screen::$7 to zero page equivalence class [ init_screen::$7 ] +Added variable init_screen::ang_w#0 to zero page equivalence class [ init_screen::ang_w#0 ] +Added variable atan2_16::xd#0 to zero page equivalence class [ atan2_16::xd#0 ] +Added variable atan2_16::yd#0 to zero page equivalence class [ atan2_16::yd#0 ] +Added variable atan2_16::$24 to zero page equivalence class [ atan2_16::$24 ] +Added variable atan2_16::$23 to zero page equivalence class [ atan2_16::$23 ] +Added variable init_font_hex::$0 to zero page equivalence class [ init_font_hex::$0 ] +Added variable init_font_hex::$1 to zero page equivalence class [ init_font_hex::$1 ] +Added variable init_font_hex::$2 to zero page equivalence class [ init_font_hex::$2 ] +Added variable init_font_hex::idx#3 to zero page equivalence class [ init_font_hex::idx#3 ] +Complete equivalence classes +[ main::clear_char#5 main::clear_char#1 ] +[ init_screen::y#4 init_screen::y#1 ] +[ init_screen::x#2 init_screen::x#1 ] +[ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] +[ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] +[ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] +[ atan2_16::i#2 atan2_16::i#1 ] +[ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] +[ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] +[ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +[ init_font_hex::c#6 init_font_hex::c#1 ] +[ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +[ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +[ init_font_hex::c1#4 init_font_hex::c1#1 ] +[ init_font_hex::i#2 init_font_hex::i#1 ] +[ init_font_hex::idx#5 init_font_hex::idx#2 ] +[ init_screen::xw#0 ] +[ init_screen::yw#0 ] +[ atan2_16::x#0 ] +[ atan2_16::y#0 ] +[ atan2_16::return#2 ] +[ init_screen::angle_w#0 ] +[ init_screen::$7 ] +[ init_screen::ang_w#0 ] +[ atan2_16::xd#0 ] +[ atan2_16::yd#0 ] +[ atan2_16::$24 ] +[ atan2_16::$23 ] +[ init_font_hex::$0 ] +[ init_font_hex::$1 ] +[ init_font_hex::$2 ] +[ init_font_hex::idx#3 ] +Allocated zp ZP_WORD:2 [ main::clear_char#5 main::clear_char#1 ] +Allocated zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +Allocated zp ZP_BYTE:5 [ init_screen::x#2 init_screen::x#1 ] +Allocated zp ZP_WORD:6 [ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] +Allocated zp ZP_WORD:8 [ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] +Allocated zp ZP_WORD:10 [ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] +Allocated zp ZP_BYTE:12 [ atan2_16::i#2 atan2_16::i#1 ] +Allocated zp ZP_WORD:13 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] +Allocated zp ZP_WORD:15 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] +Allocated zp ZP_WORD:17 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +Allocated zp ZP_BYTE:19 [ init_font_hex::c#6 init_font_hex::c#1 ] +Allocated zp ZP_WORD:20 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +Allocated zp ZP_WORD:22 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +Allocated zp ZP_BYTE:24 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Allocated zp ZP_BYTE:25 [ init_font_hex::i#2 init_font_hex::i#1 ] +Allocated zp ZP_BYTE:26 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Allocated zp ZP_WORD:27 [ init_screen::xw#0 ] +Allocated zp ZP_WORD:29 [ init_screen::yw#0 ] +Allocated zp ZP_WORD:31 [ atan2_16::x#0 ] +Allocated zp ZP_WORD:33 [ atan2_16::y#0 ] +Allocated zp ZP_WORD:35 [ atan2_16::return#2 ] +Allocated zp ZP_WORD:37 [ init_screen::angle_w#0 ] +Allocated zp ZP_WORD:39 [ init_screen::$7 ] +Allocated zp ZP_BYTE:41 [ init_screen::ang_w#0 ] +Allocated zp ZP_WORD:42 [ atan2_16::xd#0 ] +Allocated zp ZP_WORD:44 [ atan2_16::yd#0 ] +Allocated zp ZP_BYTE:46 [ atan2_16::$24 ] +Allocated zp ZP_BYTE:47 [ atan2_16::$23 ] +Allocated zp ZP_BYTE:48 [ init_font_hex::$0 ] +Allocated zp ZP_BYTE:49 [ init_font_hex::$1 ] +Allocated zp ZP_BYTE:50 [ init_font_hex::$2 ] +Allocated zp ZP_BYTE:51 [ init_font_hex::idx#3 ] + +INITIAL ASM +//SEG0 File Comments +// Find atan2(x, y) using the CORDIC method +// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + // The number of iterations performed during 16-bit CORDIC atan2 calculation + .const CORDIC_ITERATIONS_16 = $f + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + .label CORDIC_ATAN2_ANGLES_16 = $1000 + // The number of iterations performed during 8-bit CORDIC atan2 calculation + .const CORDIC_ITERATIONS_8 = 8 + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + .label CORDIC_ATAN2_ANGLES_8 = $1100 + .label RASTER = $d012 + .label D018 = $d018 + .label CHARSET = $2000 + .label SCREEN = $2800 +//SEG3 @begin +bbegin: + jmp b1 +//SEG4 @1 +b1: +//SEG5 kickasm(location (const word*) CORDIC_ATAN2_ANGLES_16#0 uses CORDIC_ITERATIONS_16#0) {{ .for (var i=0; i@3] +b3_from_b2: + jmp b3 +//SEG9 @3 +b3: +//SEG10 [4] call main +//SEG11 [6] phi from @3 to main [phi:@3->main] +main_from_b3: + jsr main +//SEG12 [5] phi from @3 to @end [phi:@3->@end] +bend_from_b3: + jmp bend +//SEG13 @end +bend: +//SEG14 main +main: { + .const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f + .label clear_char = 2 + //SEG15 [7] call init_font_hex + //SEG16 [68] phi from main to init_font_hex [phi:main->init_font_hex] + init_font_hex_from_main: + jsr init_font_hex + //SEG17 [8] phi from main to main::toD0181 [phi:main->main::toD0181] + toD0181_from_main: + jmp toD0181 + //SEG18 main::toD0181 + toD0181: + jmp b5 + //SEG19 main::@5 + b5: + //SEG20 [9] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0181_return + sta D018 + //SEG21 [10] call init_screen + //SEG22 [16] phi from main::@5 to init_screen [phi:main::@5->init_screen] + init_screen_from_b5: + jsr init_screen + //SEG23 [11] phi from main::@5 to main::@1 [phi:main::@5->main::@1] + b1_from_b5: + //SEG24 [11] phi (byte*) main::clear_char#5 = (const byte*) CHARSET#0 [phi:main::@5->main::@1#0] -- pbuz1=pbuc1 + lda #CHARSET + sta clear_char+1 + jmp b1 + //SEG25 [11] phi from main::@3 to main::@1 [phi:main::@3->main::@1] + b1_from_b3: + jmp b1 + //SEG26 main::@1 + b1: + jmp b2 + //SEG27 main::@2 + b2: + //SEG28 [12] if(*((const byte*) RASTER#0)!=(byte) $ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 + lda #$ff + cmp RASTER + bne b2 + jmp b3 + //SEG29 main::@3 + b3: + //SEG30 [13] if((byte*) main::clear_char#5>=(const byte*) CHARSET#0+(word) $800) goto main::@1 -- pbuz1_ge_pbuc1_then_la1 + lda clear_char+1 + cmp #>CHARSET+$800 + bcc !+ + bne b1_from_b3 + lda clear_char + cmp #main::@1] + b1_from_b4: + //SEG35 [11] phi (byte*) main::clear_char#5 = (byte*) main::clear_char#1 [phi:main::@4->main::@1#0] -- register_copy + jmp b1 +} +//SEG36 init_screen +init_screen: { + .label _7 = $27 + .label xw = $1b + .label yw = $1d + .label angle_w = $25 + .label ang_w = $29 + .label screen = 6 + .label x = 5 + .label y = 4 + //SEG37 [17] phi from init_screen to init_screen::@1 [phi:init_screen->init_screen::@1] + b1_from_init_screen: + //SEG38 [17] phi (byte*) init_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_screen->init_screen::@1#0] -- pbuz1=pbuc1 + lda #SCREEN + sta screen+1 + //SEG39 [17] phi (signed byte) init_screen::y#4 = (signed byte) -$c [phi:init_screen->init_screen::@1#1] -- vbsz1=vbsc1 + lda #-$c + sta y + jmp b1 + //SEG40 [17] phi from init_screen::@3 to init_screen::@1 [phi:init_screen::@3->init_screen::@1] + b1_from_b3: + //SEG41 [17] phi (byte*) init_screen::screen#4 = (byte*) init_screen::screen#1 [phi:init_screen::@3->init_screen::@1#0] -- register_copy + //SEG42 [17] phi (signed byte) init_screen::y#4 = (signed byte) init_screen::y#1 [phi:init_screen::@3->init_screen::@1#1] -- register_copy + jmp b1 + //SEG43 init_screen::@1 + b1: + //SEG44 [18] phi from init_screen::@1 to init_screen::@2 [phi:init_screen::@1->init_screen::@2] + b2_from_b1: + //SEG45 [18] phi (byte*) init_screen::screen#2 = (byte*) init_screen::screen#4 [phi:init_screen::@1->init_screen::@2#0] -- register_copy + //SEG46 [18] phi (signed byte) init_screen::x#2 = (signed byte) -$13 [phi:init_screen::@1->init_screen::@2#1] -- vbsz1=vbsc1 + lda #-$13 + sta x + jmp b2 + //SEG47 [18] phi from init_screen::@4 to init_screen::@2 [phi:init_screen::@4->init_screen::@2] + b2_from_b4: + //SEG48 [18] phi (byte*) init_screen::screen#2 = (byte*) init_screen::screen#1 [phi:init_screen::@4->init_screen::@2#0] -- register_copy + //SEG49 [18] phi (signed byte) init_screen::x#2 = (signed byte) init_screen::x#1 [phi:init_screen::@4->init_screen::@2#1] -- register_copy + jmp b2 + //SEG50 init_screen::@2 + b2: + //SEG51 [19] (word) init_screen::xw#0 ← (byte)(signed byte) init_screen::x#2 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 + lda x + ldy #0 + sta xw+1 + sty xw + //SEG52 [20] (word) init_screen::yw#0 ← (byte)(signed byte) init_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 + lda y + ldy #0 + sta yw+1 + sty yw + //SEG53 [21] (signed word) atan2_16::x#0 ← (signed word)(word) init_screen::xw#0 -- vwsz1=vwsz2 + lda xw + sta atan2_16.x + lda xw+1 + sta atan2_16.x+1 + //SEG54 [22] (signed word) atan2_16::y#0 ← (signed word)(word) init_screen::yw#0 -- vwsz1=vwsz2 + lda yw + sta atan2_16.y + lda yw+1 + sta atan2_16.y+1 + //SEG55 [23] call atan2_16 + jsr atan2_16 + //SEG56 [24] (word) atan2_16::return#2 ← (word) atan2_16::return#0 -- vwuz1=vwuz2 + lda atan2_16.return + sta atan2_16.return_2 + lda atan2_16.return+1 + sta atan2_16.return_2+1 + jmp b4 + //SEG57 init_screen::@4 + b4: + //SEG58 [25] (word) init_screen::angle_w#0 ← (word) atan2_16::return#2 -- vwuz1=vwuz2 + lda atan2_16.return_2 + sta angle_w + lda atan2_16.return_2+1 + sta angle_w+1 + //SEG59 [26] (word~) init_screen::$7 ← (word) init_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz2_plus_vbuc1 + lda #$80 + clc + adc angle_w + sta _7 + lda #0 + adc angle_w+1 + sta _7+1 + //SEG60 [27] (byte) init_screen::ang_w#0 ← > (word~) init_screen::$7 -- vbuz1=_hi_vwuz2 + lda _7+1 + sta ang_w + //SEG61 [28] *((byte*) init_screen::screen#2) ← (byte) init_screen::ang_w#0 -- _deref_pbuz1=vbuz2 + lda ang_w + ldy #0 + sta (screen),y + //SEG62 [29] (byte*) init_screen::screen#1 ← ++ (byte*) init_screen::screen#2 -- pbuz1=_inc_pbuz1 + inc screen + bne !+ + inc screen+1 + !: + //SEG63 [30] (signed byte) init_screen::x#1 ← ++ (signed byte) init_screen::x#2 -- vbsz1=_inc_vbsz1 + inc x + //SEG64 [31] if((signed byte) init_screen::x#1!=(signed byte) $15) goto init_screen::@2 -- vbsz1_neq_vbsc1_then_la1 + lda #$15 + cmp x + bne b2_from_b4 + jmp b3 + //SEG65 init_screen::@3 + b3: + //SEG66 [32] (signed byte) init_screen::y#1 ← ++ (signed byte) init_screen::y#4 -- vbsz1=_inc_vbsz1 + inc y + //SEG67 [33] if((signed byte) init_screen::y#1!=(signed byte) $d) goto init_screen::@1 -- vbsz1_neq_vbsc1_then_la1 + lda #$d + cmp y + bne b1_from_b3 + jmp breturn + //SEG68 init_screen::@return + breturn: + //SEG69 [34] return + rts +} +//SEG70 atan2_16 +// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y) +// Finding the angle requires a binary search using CORDIC_ITERATIONS_16 +// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI) +// atan2_16(signed word zeropage($1f) x, signed word zeropage($21) y) +atan2_16: { + .label _2 = 8 + .label _7 = $a + .label _23 = $2f + .label _24 = $2e + .label yi = 8 + .label xi = $a + .label xd = $2a + .label yd = $2c + .label angle = $f + .label angle_2 = $d + .label angle_3 = $d + .label i = $c + .label return = $f + .label x = $1f + .label y = $21 + .label return_2 = $23 + .label angle_6 = $d + .label angle_12 = $d + .label angle_13 = $d + //SEG71 [35] if((signed word) atan2_16::y#0>(signed byte) 0) goto atan2_16::@1 -- vwsz1_gt_0_then_la1 + lda y+1 + bne !+ + lda y + beq !e+ + lsr + !: + bpl b1 + !e: + jmp b2 + //SEG72 atan2_16::@2 + b2: + //SEG73 [36] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 + sec + lda #0 + sbc y + sta _2 + lda #0 + sbc y+1 + sta _2+1 + //SEG74 [37] phi from atan2_16::@1 atan2_16::@2 to atan2_16::@3 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3] + b3_from_b1: + b3_from_b2: + //SEG75 [37] phi (signed word) atan2_16::yi#0 = (signed word~) atan2_16::yi#11 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3#0] -- register_copy + jmp b3 + //SEG76 atan2_16::@3 + b3: + //SEG77 [38] if((signed word) atan2_16::x#0>(signed byte) 0) goto atan2_16::@4 -- vwsz1_gt_0_then_la1 + lda x+1 + bne !+ + lda x + beq !e+ + lsr + !: + bpl b4 + !e: + jmp b5 + //SEG78 atan2_16::@5 + b5: + //SEG79 [39] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 + sec + lda #0 + sbc x + sta _7 + lda #0 + sbc x+1 + sta _7+1 + //SEG80 [40] phi from atan2_16::@4 atan2_16::@5 to atan2_16::@6 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6] + b6_from_b4: + b6_from_b5: + //SEG81 [40] phi (signed word) atan2_16::xi#0 = (signed word~) atan2_16::xi#8 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6#0] -- register_copy + jmp b6 + //SEG82 atan2_16::@6 + b6: + //SEG83 [41] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] + b10_from_b6: + //SEG84 [41] phi (word) atan2_16::angle#12 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#0] -- vwuz1=vbuc1 + lda #0 + sta angle_12 + lda #0 + sta angle_12+1 + //SEG85 [41] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 + lda #0 + sta i + //SEG86 [41] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy + //SEG87 [41] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#0 [phi:atan2_16::@6->atan2_16::@10#3] -- register_copy + jmp b10 + //SEG88 atan2_16::@10 + b10: + //SEG89 [42] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 + lda yi+1 + bne b11 + lda yi + bne b11 + //SEG90 [43] phi from atan2_16::@10 atan2_16::@14 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12] + b12_from_b10: + b12_from_b14: + //SEG91 [43] phi (word) atan2_16::angle#6 = (word) atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12#0] -- register_copy + jmp b12 + //SEG92 atan2_16::@12 + b12: + //SEG93 [44] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 -- vwuz1=vwuz2_ror_1 + lda angle_6+1 + lsr + sta angle+1 + lda angle_6 + ror + sta angle + //SEG94 [45] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 -- vwsz1_ge_0_then_la1 + lda x+1 + bpl b7_from_b12 + jmp b16 + //SEG95 atan2_16::@16 + b16: + //SEG96 [46] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 + sec + lda #<$8000 + sbc angle + sta angle + lda #>$8000 + sbc angle+1 + sta angle+1 + //SEG97 [47] phi from atan2_16::@12 atan2_16::@16 to atan2_16::@7 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7] + b7_from_b12: + b7_from_b16: + //SEG98 [47] phi (word) atan2_16::angle#11 = (word) atan2_16::angle#1 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7#0] -- register_copy + jmp b7 + //SEG99 atan2_16::@7 + b7: + //SEG100 [48] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 -- vwsz1_ge_0_then_la1 + lda y+1 + bpl b8_from_b7 + jmp b9 + //SEG101 atan2_16::@9 + b9: + //SEG102 [49] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 + sec + lda #0 + sbc angle + sta angle + lda #0 + sbc angle+1 + sta angle+1 + //SEG103 [50] phi from atan2_16::@7 atan2_16::@9 to atan2_16::@8 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8] + b8_from_b7: + b8_from_b9: + //SEG104 [50] phi (word) atan2_16::return#0 = (word) atan2_16::angle#11 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8#0] -- register_copy + jmp b8 + //SEG105 atan2_16::@8 + b8: + jmp breturn + //SEG106 atan2_16::@return + breturn: + //SEG107 [51] return + rts + //SEG108 atan2_16::@11 + b11: + //SEG109 [52] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + ldy i + lda xi + sta xd + lda xi+1 + sta xd+1 + cpy #0 + beq !e+ + !: + lda xd+1 + cmp #$80 + ror xd+1 + ror xd + dey + bne !- + !e: + //SEG110 [53] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + ldy i + lda yi + sta yd + lda yi+1 + sta yd+1 + cpy #0 + beq !e+ + !: + lda yd+1 + cmp #$80 + ror yd+1 + ror yd + dey + bne !- + !e: + //SEG111 [54] if((signed word) atan2_16::yi#3>(signed byte) 0) goto atan2_16::@13 -- vwsz1_gt_0_then_la1 + lda yi+1 + bne !+ + lda yi + beq !e+ + lsr + !: + bpl b13 + !e: + jmp b15 + //SEG112 atan2_16::@15 + b15: + //SEG113 [55] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_minus_vwsz2 + lda xi + sec + sbc yd + sta xi + lda xi+1 + sbc yd+1 + sta xi+1 + //SEG114 [56] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_plus_vwsz2 + lda yi + clc + adc xd + sta yi + lda yi+1 + adc xd+1 + sta yi+1 + //SEG115 [57] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 + lda i + asl + sta _24 + //SEG116 [58] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuz2 + ldy _24 + sec + lda angle_3 + sbc CORDIC_ATAN2_ANGLES_16,y + sta angle_3 + lda angle_3+1 + sbc CORDIC_ATAN2_ANGLES_16+1,y + sta angle_3+1 + //SEG117 [59] phi from atan2_16::@13 atan2_16::@15 to atan2_16::@14 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14] + b14_from_b13: + b14_from_b15: + //SEG118 [59] phi (signed word) atan2_16::xi#7 = (signed word) atan2_16::xi#1 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#0] -- register_copy + //SEG119 [59] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy + //SEG120 [59] phi (signed word) atan2_16::yi#7 = (signed word) atan2_16::yi#1 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#2] -- register_copy + jmp b14 + //SEG121 atan2_16::@14 + b14: + //SEG122 [60] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 + inc i + //SEG123 [61] if((byte) atan2_16::i#1==(const byte) CORDIC_ITERATIONS_16#0-(byte) 1+(byte) 1) goto atan2_16::@12 -- vbuz1_eq_vbuc1_then_la1 + lda #CORDIC_ITERATIONS_16-1+1 + cmp i + beq b12_from_b14 + //SEG124 [41] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] + b10_from_b14: + //SEG125 [41] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy + //SEG126 [41] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy + //SEG127 [41] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy + //SEG128 [41] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#7 [phi:atan2_16::@14->atan2_16::@10#3] -- register_copy + jmp b10 + //SEG129 atan2_16::@13 + b13: + //SEG130 [62] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_plus_vwsz2 + lda xi + clc + adc yd + sta xi + lda xi+1 + adc yd+1 + sta xi+1 + //SEG131 [63] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_minus_vwsz2 + lda yi + sec + sbc xd + sta yi + lda yi+1 + sbc xd+1 + sta yi+1 + //SEG132 [64] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 + lda i + asl + sta _23 + //SEG133 [65] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuz2 + ldy _23 + clc + lda angle_2 + adc CORDIC_ATAN2_ANGLES_16,y + sta angle_2 + lda angle_2+1 + adc CORDIC_ATAN2_ANGLES_16+1,y + sta angle_2+1 + jmp b14_from_b13 + //SEG134 atan2_16::@4 + b4: + //SEG135 [66] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 -- vwsz1=vwsz2 + lda x + sta xi + lda x+1 + sta xi+1 + jmp b6_from_b4 + //SEG136 atan2_16::@1 + b1: + //SEG137 [67] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 -- vwsz1=vwsz2 + lda y + sta yi + lda y+1 + sta yi+1 + jmp b3_from_b1 +} +//SEG138 init_font_hex +// Make charset from proto chars +// init_font_hex(byte* zeropage($14) charset) +init_font_hex: { + .label _0 = $30 + .label _1 = $31 + .label _2 = $32 + .label idx = $1a + .label i = $19 + .label idx_3 = $33 + .label proto_lo = $16 + .label charset = $14 + .label c1 = $18 + .label proto_hi = $11 + .label c = $13 + //SEG139 [69] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] + b1_from_init_font_hex: + //SEG140 [69] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 + lda #0 + sta c + //SEG141 [69] phi (byte*) init_font_hex::proto_hi#6 = (const byte[]) FONT_HEX_PROTO#0 [phi:init_font_hex->init_font_hex::@1#1] -- pbuz1=pbuc1 + lda #FONT_HEX_PROTO + sta proto_hi+1 + //SEG142 [69] phi (byte*) init_font_hex::charset#5 = (const byte*) CHARSET#0 [phi:init_font_hex->init_font_hex::@1#2] -- pbuz1=pbuc1 + lda #CHARSET + sta charset+1 + jmp b1 + //SEG143 [69] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] + b1_from_b5: + //SEG144 [69] phi (byte) init_font_hex::c#6 = (byte) init_font_hex::c#1 [phi:init_font_hex::@5->init_font_hex::@1#0] -- register_copy + //SEG145 [69] phi (byte*) init_font_hex::proto_hi#6 = (byte*) init_font_hex::proto_hi#1 [phi:init_font_hex::@5->init_font_hex::@1#1] -- register_copy + //SEG146 [69] phi (byte*) init_font_hex::charset#5 = (byte*) init_font_hex::charset#0 [phi:init_font_hex::@5->init_font_hex::@1#2] -- register_copy + jmp b1 + //SEG147 init_font_hex::@1 + b1: + //SEG148 [70] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] + b2_from_b1: + //SEG149 [70] phi (byte) init_font_hex::c1#4 = (byte) 0 [phi:init_font_hex::@1->init_font_hex::@2#0] -- vbuz1=vbuc1 + lda #0 + sta c1 + //SEG150 [70] phi (byte*) init_font_hex::proto_lo#4 = (const byte[]) FONT_HEX_PROTO#0 [phi:init_font_hex::@1->init_font_hex::@2#1] -- pbuz1=pbuc1 + lda #FONT_HEX_PROTO + sta proto_lo+1 + //SEG151 [70] phi (byte*) init_font_hex::charset#2 = (byte*) init_font_hex::charset#5 [phi:init_font_hex::@1->init_font_hex::@2#2] -- register_copy + jmp b2 + //SEG152 [70] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] + b2_from_b4: + //SEG153 [70] phi (byte) init_font_hex::c1#4 = (byte) init_font_hex::c1#1 [phi:init_font_hex::@4->init_font_hex::@2#0] -- register_copy + //SEG154 [70] phi (byte*) init_font_hex::proto_lo#4 = (byte*) init_font_hex::proto_lo#1 [phi:init_font_hex::@4->init_font_hex::@2#1] -- register_copy + //SEG155 [70] phi (byte*) init_font_hex::charset#2 = (byte*) init_font_hex::charset#0 [phi:init_font_hex::@4->init_font_hex::@2#2] -- register_copy + jmp b2 + //SEG156 init_font_hex::@2 + b2: + //SEG157 [71] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + lda #0 + ldy #0 + sta (charset),y + //SEG158 [72] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] + b3_from_b2: + //SEG159 [72] phi (byte) init_font_hex::idx#5 = (byte) 1 [phi:init_font_hex::@2->init_font_hex::@3#0] -- vbuz1=vbuc1 + lda #1 + sta idx + //SEG160 [72] phi (byte) init_font_hex::i#2 = (byte) 0 [phi:init_font_hex::@2->init_font_hex::@3#1] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b3 + //SEG161 [72] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] + b3_from_b3: + //SEG162 [72] phi (byte) init_font_hex::idx#5 = (byte) init_font_hex::idx#2 [phi:init_font_hex::@3->init_font_hex::@3#0] -- register_copy + //SEG163 [72] phi (byte) init_font_hex::i#2 = (byte) init_font_hex::i#1 [phi:init_font_hex::@3->init_font_hex::@3#1] -- register_copy + jmp b3 + //SEG164 init_font_hex::@3 + b3: + //SEG165 [73] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 -- vbuz1=pbuz2_derefidx_vbuz3_rol_4 + ldy i + lda (proto_hi),y + asl + asl + asl + asl + sta _0 + //SEG166 [74] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 -- vbuz1=pbuz2_derefidx_vbuz3_rol_1 + ldy i + lda (proto_lo),y + asl + sta _1 + //SEG167 [75] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 -- vbuz1=vbuz2_bor_vbuz3 + lda _0 + ora _1 + sta _2 + //SEG168 [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 -- pbuz1_derefidx_vbuz2=vbuz3 + lda _2 + ldy idx + sta (charset),y + //SEG169 [77] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 + inc idx + //SEG170 [78] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuz1=_inc_vbuz1 + inc i + //SEG171 [79] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 -- vbuz1_neq_vbuc1_then_la1 + lda #5 + cmp i + bne b3_from_b3 + jmp b4 + //SEG172 init_font_hex::@4 + b4: + //SEG173 [80] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 -- pbuz1_derefidx_vbuz2=vbuc1 + lda #0 + ldy idx + sta (charset),y + //SEG174 [81] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuz1=_inc_vbuz2 + ldy idx + iny + sty idx_3 + //SEG175 [82] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 -- pbuz1_derefidx_vbuz2=vbuc1 + lda #0 + ldy idx_3 + sta (charset),y + //SEG176 [83] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + lda #5 + clc + adc proto_lo + sta proto_lo + bcc !+ + inc proto_lo+1 + !: + //SEG177 [84] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 + lda #8 + clc + adc charset + sta charset + bcc !+ + inc charset+1 + !: + //SEG178 [85] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 + inc c1 + //SEG179 [86] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 -- vbuz1_neq_vbuc1_then_la1 + lda #$10 + cmp c1 + bne b2_from_b4 + jmp b5 + //SEG180 init_font_hex::@5 + b5: + //SEG181 [87] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + lda #5 + clc + adc proto_hi + sta proto_hi + bcc !+ + inc proto_hi+1 + !: + //SEG182 [88] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 + inc c + //SEG183 [89] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 -- vbuz1_neq_vbuc1_then_la1 + lda #$10 + cmp c + bne b1_from_b5 + jmp breturn + //SEG184 init_font_hex::@return + breturn: + //SEG185 [90] return + rts +} +//SEG186 File Data + // Bit patterns for symbols 0-f (3x5 pixels) used in font hex + FONT_HEX_PROTO: .byte 2, 5, 5, 5, 2, 6, 2, 2, 2, 7, 6, 1, 2, 4, 7, 6, 1, 2, 1, 6, 5, 5, 7, 1, 1, 7, 4, 6, 1, 6, 3, 4, 6, 5, 2, 7, 1, 1, 1, 1, 2, 5, 2, 5, 2, 2, 5, 3, 1, 1, 2, 5, 7, 5, 5, 6, 5, 6, 5, 6, 2, 5, 4, 5, 2, 6, 5, 5, 5, 6, 7, 4, 6, 4, 7, 7, 4, 6, 4, 4 +.pc = CORDIC_ATAN2_ANGLES_16 "CORDIC_ATAN2_ANGLES_16" + .for (var i=0; i=(const byte*) CHARSET#0+(word) $800) goto main::@1 [ main::clear_char#5 ] ( main:4 [ main::clear_char#5 ] ) always clobbers reg byte a +Statement [14] *((byte*) main::clear_char#5) ← (byte) 0 [ main::clear_char#5 ] ( main:4 [ main::clear_char#5 ] ) always clobbers reg byte a reg byte y +Statement [19] (word) init_screen::xw#0 ← (byte)(signed byte) init_screen::x#2 w= (byte) 0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::xw#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::xw#0 ] ) always clobbers reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ init_screen::x#2 init_screen::x#1 ] +Statement [20] (word) init_screen::yw#0 ← (byte)(signed byte) init_screen::y#4 w= (byte) 0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::xw#0 init_screen::yw#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::xw#0 init_screen::yw#0 ] ) always clobbers reg byte y +Statement [21] (signed word) atan2_16::x#0 ← (signed word)(word) init_screen::xw#0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::yw#0 atan2_16::x#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::yw#0 atan2_16::x#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ init_screen::x#2 init_screen::x#1 ] +Statement [22] (signed word) atan2_16::y#0 ← (signed word)(word) init_screen::yw#0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a +Statement [24] (word) atan2_16::return#2 ← (word) atan2_16::return#0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::return#2 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::return#2 ] ) always clobbers reg byte a +Statement [25] (word) init_screen::angle_w#0 ← (word) atan2_16::return#2 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::angle_w#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::angle_w#0 ] ) always clobbers reg byte a +Statement [26] (word~) init_screen::$7 ← (word) init_screen::angle_w#0 + (byte) $80 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::$7 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::$7 ] ) always clobbers reg byte a +Statement [27] (byte) init_screen::ang_w#0 ← > (word~) init_screen::$7 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::ang_w#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::ang_w#0 ] ) always clobbers reg byte a +Statement [28] *((byte*) init_screen::screen#2) ← (byte) init_screen::ang_w#0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 ] ) always clobbers reg byte y +Statement [35] if((signed word) atan2_16::y#0>(signed byte) 0) goto atan2_16::@1 [ atan2_16::x#0 atan2_16::y#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a +Statement [36] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ) always clobbers reg byte a +Statement [38] if((signed word) atan2_16::x#0>(signed byte) 0) goto atan2_16::@4 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 ] ) always clobbers reg byte a +Statement [39] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::$7 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::$7 ] ) always clobbers reg byte a +Statement [42] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:12 [ atan2_16::i#2 atan2_16::i#1 ] +Statement [44] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 [ atan2_16::x#0 atan2_16::y#0 atan2_16::angle#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a +Statement [45] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 [ atan2_16::y#0 atan2_16::angle#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a +Statement [46] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 [ atan2_16::y#0 atan2_16::angle#4 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::y#0 atan2_16::angle#4 ] ) always clobbers reg byte a +Statement [48] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 [ atan2_16::angle#11 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::angle#11 ] ) always clobbers reg byte a +Statement [49] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 [ atan2_16::angle#5 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::angle#5 ] ) always clobbers reg byte a +Statement [52] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 ] ) always clobbers reg byte a +Statement [53] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::yd#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::yd#0 ] ) always clobbers reg byte a +Statement [54] if((signed word) atan2_16::yi#3>(signed byte) 0) goto atan2_16::@13 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::yd#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::yd#0 ] ) always clobbers reg byte a +Statement [55] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::xi#2 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::xi#2 ] ) always clobbers reg byte a +Statement [56] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::xi#2 atan2_16::yi#2 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::xi#2 atan2_16::yi#2 ] ) always clobbers reg byte a +Statement [57] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::xi#2 atan2_16::yi#2 atan2_16::$24 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::xi#2 atan2_16::yi#2 atan2_16::$24 ] ) always clobbers reg byte a +Statement [58] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::xi#2 atan2_16::yi#2 atan2_16::angle#3 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::xi#2 atan2_16::yi#2 atan2_16::angle#3 ] ) always clobbers reg byte a +Statement [62] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::xi#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::xi#1 ] ) always clobbers reg byte a +Statement [63] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::yi#1 atan2_16::xi#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::yi#1 atan2_16::xi#1 ] ) always clobbers reg byte a +Statement [64] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::yi#1 atan2_16::xi#1 atan2_16::$23 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::yi#1 atan2_16::xi#1 atan2_16::$23 ] ) always clobbers reg byte a +Statement [65] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::yi#1 atan2_16::angle#2 atan2_16::xi#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::yi#1 atan2_16::angle#2 atan2_16::xi#1 ] ) always clobbers reg byte a +Statement [66] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::xi#8 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::xi#8 ] ) always clobbers reg byte a +Statement [67] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#11 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#11 ] ) always clobbers reg byte a +Statement [71] *((byte*) init_font_hex::charset#2) ← (byte) 0 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:19 [ init_font_hex::c#6 init_font_hex::c#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:19 [ init_font_hex::c#6 init_font_hex::c#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:24 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:24 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Statement [73] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::i#2 init_font_hex::idx#5 init_font_hex::$0 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::i#2 init_font_hex::idx#5 init_font_hex::$0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:25 [ init_font_hex::i#2 init_font_hex::i#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:26 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Statement [74] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::i#2 init_font_hex::idx#5 init_font_hex::$0 init_font_hex::$1 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::i#2 init_font_hex::idx#5 init_font_hex::$0 init_font_hex::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:48 [ init_font_hex::$0 ] +Statement [80] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::idx#2 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::idx#2 ] ) always clobbers reg byte a +Statement [82] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 ] ) always clobbers reg byte a +Statement [83] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::c1#4 init_font_hex::proto_lo#1 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::c1#4 init_font_hex::proto_lo#1 ] ) always clobbers reg byte a +Statement [84] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::c1#4 init_font_hex::proto_lo#1 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::c1#4 init_font_hex::proto_lo#1 ] ) always clobbers reg byte a +Statement [87] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 [ init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::proto_hi#1 ] ( main:4::init_font_hex:7 [ init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::proto_hi#1 ] ) always clobbers reg byte a +Statement [9] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 [ ] ( main:4 [ ] ) always clobbers reg byte a +Statement [12] if(*((const byte*) RASTER#0)!=(byte) $ff) goto main::@2 [ main::clear_char#5 ] ( main:4 [ main::clear_char#5 ] ) always clobbers reg byte a +Statement [13] if((byte*) main::clear_char#5>=(const byte*) CHARSET#0+(word) $800) goto main::@1 [ main::clear_char#5 ] ( main:4 [ main::clear_char#5 ] ) always clobbers reg byte a +Statement [14] *((byte*) main::clear_char#5) ← (byte) 0 [ main::clear_char#5 ] ( main:4 [ main::clear_char#5 ] ) always clobbers reg byte a reg byte y +Statement [19] (word) init_screen::xw#0 ← (byte)(signed byte) init_screen::x#2 w= (byte) 0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::xw#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::xw#0 ] ) always clobbers reg byte a reg byte y +Statement [20] (word) init_screen::yw#0 ← (byte)(signed byte) init_screen::y#4 w= (byte) 0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::xw#0 init_screen::yw#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::xw#0 init_screen::yw#0 ] ) always clobbers reg byte a reg byte y +Statement [21] (signed word) atan2_16::x#0 ← (signed word)(word) init_screen::xw#0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::yw#0 atan2_16::x#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::yw#0 atan2_16::x#0 ] ) always clobbers reg byte a +Statement [22] (signed word) atan2_16::y#0 ← (signed word)(word) init_screen::yw#0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a +Statement [24] (word) atan2_16::return#2 ← (word) atan2_16::return#0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::return#2 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::return#2 ] ) always clobbers reg byte a +Statement [25] (word) init_screen::angle_w#0 ← (word) atan2_16::return#2 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::angle_w#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::angle_w#0 ] ) always clobbers reg byte a +Statement [26] (word~) init_screen::$7 ← (word) init_screen::angle_w#0 + (byte) $80 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::$7 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::$7 ] ) always clobbers reg byte a +Statement [27] (byte) init_screen::ang_w#0 ← > (word~) init_screen::$7 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::ang_w#0 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 init_screen::ang_w#0 ] ) always clobbers reg byte a +Statement [28] *((byte*) init_screen::screen#2) ← (byte) init_screen::ang_w#0 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 ] ( main:4::init_screen:10 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 ] ) always clobbers reg byte y +Statement [35] if((signed word) atan2_16::y#0>(signed byte) 0) goto atan2_16::@1 [ atan2_16::x#0 atan2_16::y#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a +Statement [36] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ) always clobbers reg byte a +Statement [38] if((signed word) atan2_16::x#0>(signed byte) 0) goto atan2_16::@4 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 ] ) always clobbers reg byte a +Statement [39] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::$7 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::$7 ] ) always clobbers reg byte a +Statement [42] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 ] ) always clobbers reg byte a +Statement [44] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 [ atan2_16::x#0 atan2_16::y#0 atan2_16::angle#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a +Statement [45] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 [ atan2_16::y#0 atan2_16::angle#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a +Statement [46] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 [ atan2_16::y#0 atan2_16::angle#4 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::y#0 atan2_16::angle#4 ] ) always clobbers reg byte a +Statement [48] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 [ atan2_16::angle#11 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::angle#11 ] ) always clobbers reg byte a +Statement [49] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 [ atan2_16::angle#5 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::angle#5 ] ) always clobbers reg byte a +Statement [52] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 ] ) always clobbers reg byte a +Statement [53] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::yd#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::yd#0 ] ) always clobbers reg byte a +Statement [54] if((signed word) atan2_16::yi#3>(signed byte) 0) goto atan2_16::@13 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::yd#0 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::xi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::yd#0 ] ) always clobbers reg byte a +Statement [55] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::xi#2 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::xi#2 ] ) always clobbers reg byte a +Statement [56] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::xi#2 atan2_16::yi#2 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::xi#2 atan2_16::yi#2 ] ) always clobbers reg byte a +Statement [57] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::xi#2 atan2_16::yi#2 atan2_16::$24 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::xi#2 atan2_16::yi#2 atan2_16::$24 ] ) always clobbers reg byte a +Statement [58] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::xi#2 atan2_16::yi#2 atan2_16::angle#3 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::xi#2 atan2_16::yi#2 atan2_16::angle#3 ] ) always clobbers reg byte a +Statement [62] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::xi#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#3 atan2_16::i#2 atan2_16::angle#12 atan2_16::xd#0 atan2_16::xi#1 ] ) always clobbers reg byte a +Statement [63] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::yi#1 atan2_16::xi#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::yi#1 atan2_16::xi#1 ] ) always clobbers reg byte a +Statement [64] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::yi#1 atan2_16::xi#1 atan2_16::$23 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::angle#12 atan2_16::yi#1 atan2_16::xi#1 atan2_16::$23 ] ) always clobbers reg byte a +Statement [65] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) [ atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::yi#1 atan2_16::angle#2 atan2_16::xi#1 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::i#2 atan2_16::yi#1 atan2_16::angle#2 atan2_16::xi#1 ] ) always clobbers reg byte a +Statement [66] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::xi#8 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::xi#8 ] ) always clobbers reg byte a +Statement [67] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::yi#11 ] ( main:4::init_screen:10::atan2_16:23 [ init_screen::y#4 init_screen::x#2 init_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#11 ] ) always clobbers reg byte a +Statement [71] *((byte*) init_font_hex::charset#2) ← (byte) 0 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 ] ) always clobbers reg byte a reg byte y +Statement [73] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::i#2 init_font_hex::idx#5 init_font_hex::$0 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::i#2 init_font_hex::idx#5 init_font_hex::$0 ] ) always clobbers reg byte a +Statement [74] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::i#2 init_font_hex::idx#5 init_font_hex::$0 init_font_hex::$1 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::i#2 init_font_hex::idx#5 init_font_hex::$0 init_font_hex::$1 ] ) always clobbers reg byte a +Statement [80] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::idx#2 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 init_font_hex::idx#2 ] ) always clobbers reg byte a +Statement [82] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::proto_lo#4 init_font_hex::c1#4 ] ) always clobbers reg byte a +Statement [83] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::c1#4 init_font_hex::proto_lo#1 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#2 init_font_hex::c1#4 init_font_hex::proto_lo#1 ] ) always clobbers reg byte a +Statement [84] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::c1#4 init_font_hex::proto_lo#1 ] ( main:4::init_font_hex:7 [ init_font_hex::proto_hi#6 init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::c1#4 init_font_hex::proto_lo#1 ] ) always clobbers reg byte a +Statement [87] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 [ init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::proto_hi#1 ] ( main:4::init_font_hex:7 [ init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::proto_hi#1 ] ) always clobbers reg byte a +Potential registers zp ZP_WORD:2 [ main::clear_char#5 main::clear_char#1 ] : zp ZP_WORD:2 , +Potential registers zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] : zp ZP_BYTE:4 , reg byte x , +Potential registers zp ZP_BYTE:5 [ init_screen::x#2 init_screen::x#1 ] : zp ZP_BYTE:5 , reg byte x , +Potential registers zp ZP_WORD:6 [ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] : zp ZP_WORD:6 , +Potential registers zp ZP_WORD:8 [ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] : zp ZP_WORD:8 , +Potential registers zp ZP_WORD:10 [ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] : zp ZP_WORD:10 , +Potential registers zp ZP_BYTE:12 [ atan2_16::i#2 atan2_16::i#1 ] : zp ZP_BYTE:12 , reg byte x , reg byte y , +Potential registers zp ZP_WORD:13 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] : zp ZP_WORD:13 , +Potential registers zp ZP_WORD:15 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] : zp ZP_WORD:15 , +Potential registers zp ZP_WORD:17 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] : zp ZP_WORD:17 , +Potential registers zp ZP_BYTE:19 [ init_font_hex::c#6 init_font_hex::c#1 ] : zp ZP_BYTE:19 , reg byte x , +Potential registers zp ZP_WORD:20 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] : zp ZP_WORD:20 , +Potential registers zp ZP_WORD:22 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] : zp ZP_WORD:22 , +Potential registers zp ZP_BYTE:24 [ init_font_hex::c1#4 init_font_hex::c1#1 ] : zp ZP_BYTE:24 , reg byte x , +Potential registers zp ZP_BYTE:25 [ init_font_hex::i#2 init_font_hex::i#1 ] : zp ZP_BYTE:25 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:26 [ init_font_hex::idx#5 init_font_hex::idx#2 ] : zp ZP_BYTE:26 , reg byte x , reg byte y , +Potential registers zp ZP_WORD:27 [ init_screen::xw#0 ] : zp ZP_WORD:27 , +Potential registers zp ZP_WORD:29 [ init_screen::yw#0 ] : zp ZP_WORD:29 , +Potential registers zp ZP_WORD:31 [ atan2_16::x#0 ] : zp ZP_WORD:31 , +Potential registers zp ZP_WORD:33 [ atan2_16::y#0 ] : zp ZP_WORD:33 , +Potential registers zp ZP_WORD:35 [ atan2_16::return#2 ] : zp ZP_WORD:35 , +Potential registers zp ZP_WORD:37 [ init_screen::angle_w#0 ] : zp ZP_WORD:37 , +Potential registers zp ZP_WORD:39 [ init_screen::$7 ] : zp ZP_WORD:39 , +Potential registers zp ZP_BYTE:41 [ init_screen::ang_w#0 ] : zp ZP_BYTE:41 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:42 [ atan2_16::xd#0 ] : zp ZP_WORD:42 , +Potential registers zp ZP_WORD:44 [ atan2_16::yd#0 ] : zp ZP_WORD:44 , +Potential registers zp ZP_BYTE:46 [ atan2_16::$24 ] : zp ZP_BYTE:46 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:47 [ atan2_16::$23 ] : zp ZP_BYTE:47 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:48 [ init_font_hex::$0 ] : zp ZP_BYTE:48 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:49 [ init_font_hex::$1 ] : zp ZP_BYTE:49 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:50 [ init_font_hex::$2 ] : zp ZP_BYTE:50 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:51 [ init_font_hex::idx#3 ] : zp ZP_BYTE:51 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [atan2_16] 7,706.67: zp ZP_WORD:13 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] 3,203.15: zp ZP_WORD:8 [ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] 2,817.2: zp ZP_WORD:10 [ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] 2,002: zp ZP_BYTE:46 [ atan2_16::$24 ] 2,002: zp ZP_BYTE:47 [ atan2_16::$23 ] 1,930.5: zp ZP_BYTE:12 [ atan2_16::i#2 atan2_16::i#1 ] 1,501.5: zp ZP_WORD:44 [ atan2_16::yd#0 ] 600.6: zp ZP_WORD:42 [ atan2_16::xd#0 ] 202: zp ZP_WORD:35 [ atan2_16::return#2 ] 50: zp ZP_WORD:15 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] 3.89: zp ZP_WORD:31 [ atan2_16::x#0 ] 3.63: zp ZP_WORD:33 [ atan2_16::y#0 ] +Uplift Scope [init_font_hex] 2,168.83: zp ZP_BYTE:25 [ init_font_hex::i#2 init_font_hex::i#1 ] 2,002: zp ZP_BYTE:49 [ init_font_hex::$1 ] 2,002: zp ZP_BYTE:50 [ init_font_hex::$2 ] 1,151.6: zp ZP_BYTE:26 [ init_font_hex::idx#5 init_font_hex::idx#2 ] 1,001: zp ZP_BYTE:48 [ init_font_hex::$0 ] 202: zp ZP_BYTE:51 [ init_font_hex::idx#3 ] 165.86: zp ZP_WORD:20 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] 164.97: zp ZP_BYTE:24 [ init_font_hex::c1#4 init_font_hex::c1#1 ] 143.04: zp ZP_WORD:22 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] 64.17: zp ZP_WORD:17 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] 17.66: zp ZP_BYTE:19 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplift Scope [init_screen] 202: zp ZP_WORD:37 [ init_screen::angle_w#0 ] 202: zp ZP_WORD:39 [ init_screen::$7 ] 202: zp ZP_BYTE:41 [ init_screen::ang_w#0 ] 168.33: zp ZP_BYTE:5 [ init_screen::x#2 init_screen::x#1 ] 93.15: zp ZP_WORD:6 [ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] 50.5: zp ZP_WORD:27 [ init_screen::xw#0 ] 50.5: zp ZP_WORD:29 [ init_screen::yw#0 ] 17.97: zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +Uplift Scope [main] 55.5: zp ZP_WORD:2 [ main::clear_char#5 main::clear_char#1 ] +Uplift Scope [] + +Uplifting [atan2_16] best 426109 combination zp ZP_WORD:13 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp ZP_WORD:8 [ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp ZP_WORD:10 [ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$24 ] reg byte a [ atan2_16::$23 ] zp ZP_BYTE:12 [ atan2_16::i#2 atan2_16::i#1 ] zp ZP_WORD:44 [ atan2_16::yd#0 ] zp ZP_WORD:42 [ atan2_16::xd#0 ] zp ZP_WORD:35 [ atan2_16::return#2 ] zp ZP_WORD:15 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] zp ZP_WORD:31 [ atan2_16::x#0 ] zp ZP_WORD:33 [ atan2_16::y#0 ] +Uplifting [init_font_hex] best 407109 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp ZP_BYTE:26 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp ZP_BYTE:48 [ init_font_hex::$0 ] zp ZP_BYTE:51 [ init_font_hex::idx#3 ] zp ZP_WORD:20 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp ZP_BYTE:24 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp ZP_WORD:22 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp ZP_WORD:17 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp ZP_BYTE:19 [ init_font_hex::c#6 init_font_hex::c#1 ] +Limited combination testing to 100 combinations of 6912 possible. +Uplifting [init_screen] best 405509 combination zp ZP_WORD:37 [ init_screen::angle_w#0 ] zp ZP_WORD:39 [ init_screen::$7 ] reg byte a [ init_screen::ang_w#0 ] reg byte x [ init_screen::x#2 init_screen::x#1 ] zp ZP_WORD:6 [ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] zp ZP_WORD:27 [ init_screen::xw#0 ] zp ZP_WORD:29 [ init_screen::yw#0 ] zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +Uplifting [main] best 405509 combination zp ZP_WORD:2 [ main::clear_char#5 main::clear_char#1 ] +Uplifting [] best 405509 combination +Attempting to uplift remaining variables inzp ZP_BYTE:12 [ atan2_16::i#2 atan2_16::i#1 ] +Uplifting [atan2_16] best 405509 combination zp ZP_BYTE:12 [ atan2_16::i#2 atan2_16::i#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:26 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Uplifting [init_font_hex] best 405509 combination zp ZP_BYTE:26 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:48 [ init_font_hex::$0 ] +Uplifting [init_font_hex] best 405509 combination zp ZP_BYTE:48 [ init_font_hex::$0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:51 [ init_font_hex::idx#3 ] +Uplifting [init_font_hex] best 404909 combination reg byte y [ init_font_hex::idx#3 ] +Attempting to uplift remaining variables inzp ZP_BYTE:24 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Uplifting [init_font_hex] best 404909 combination zp ZP_BYTE:24 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +Uplifting [init_screen] best 404909 combination zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:19 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 404909 combination zp ZP_BYTE:19 [ init_font_hex::c#6 init_font_hex::c#1 ] +Coalescing zero page register with common assignment [ zp ZP_WORD:13 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] ] with [ zp ZP_WORD:15 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:27 [ init_screen::xw#0 ] ] with [ zp ZP_WORD:31 [ atan2_16::x#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:29 [ init_screen::yw#0 ] ] with [ zp ZP_WORD:33 [ atan2_16::y#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:35 [ atan2_16::return#2 ] ] with [ zp ZP_WORD:37 [ init_screen::angle_w#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:13 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] ] with [ zp ZP_WORD:35 [ atan2_16::return#2 init_screen::angle_w#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:13 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_screen::angle_w#0 ] ] with [ zp ZP_WORD:39 [ init_screen::$7 ] ] - score: 1 +Allocated (was zp ZP_WORD:6) zp ZP_WORD:5 [ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] +Allocated (was zp ZP_WORD:8) zp ZP_WORD:7 [ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] +Allocated (was zp ZP_WORD:10) zp ZP_WORD:9 [ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] +Allocated (was zp ZP_BYTE:12) zp ZP_BYTE:11 [ atan2_16::i#2 atan2_16::i#1 ] +Allocated (was zp ZP_WORD:13) zp ZP_WORD:12 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_screen::angle_w#0 init_screen::$7 ] +Allocated (was zp ZP_WORD:17) zp ZP_WORD:14 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +Allocated (was zp ZP_BYTE:19) zp ZP_BYTE:16 [ init_font_hex::c#6 init_font_hex::c#1 ] +Allocated (was zp ZP_WORD:20) zp ZP_WORD:17 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +Allocated (was zp ZP_WORD:22) zp ZP_WORD:19 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +Allocated (was zp ZP_BYTE:24) zp ZP_BYTE:21 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Allocated (was zp ZP_BYTE:26) zp ZP_BYTE:22 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Allocated (was zp ZP_WORD:27) zp ZP_WORD:23 [ init_screen::xw#0 atan2_16::x#0 ] +Allocated (was zp ZP_WORD:29) zp ZP_WORD:25 [ init_screen::yw#0 atan2_16::y#0 ] +Allocated (was zp ZP_WORD:42) zp ZP_WORD:27 [ atan2_16::xd#0 ] +Allocated (was zp ZP_WORD:44) zp ZP_WORD:29 [ atan2_16::yd#0 ] +Allocated (was zp ZP_BYTE:48) zp ZP_BYTE:31 [ init_font_hex::$0 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 File Comments +// Find atan2(x, y) using the CORDIC method +// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + // The number of iterations performed during 16-bit CORDIC atan2 calculation + .const CORDIC_ITERATIONS_16 = $f + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + .label CORDIC_ATAN2_ANGLES_16 = $1000 + // The number of iterations performed during 8-bit CORDIC atan2 calculation + .const CORDIC_ITERATIONS_8 = 8 + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + .label CORDIC_ATAN2_ANGLES_8 = $1100 + .label RASTER = $d012 + .label D018 = $d018 + .label CHARSET = $2000 + .label SCREEN = $2800 +//SEG3 @begin +bbegin: + jmp b1 +//SEG4 @1 +b1: +//SEG5 kickasm(location (const word*) CORDIC_ATAN2_ANGLES_16#0 uses CORDIC_ITERATIONS_16#0) {{ .for (var i=0; i@3] +b3_from_b2: + jmp b3 +//SEG9 @3 +b3: +//SEG10 [4] call main +//SEG11 [6] phi from @3 to main [phi:@3->main] +main_from_b3: + jsr main +//SEG12 [5] phi from @3 to @end [phi:@3->@end] +bend_from_b3: + jmp bend +//SEG13 @end +bend: +//SEG14 main +main: { + .const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f + .label clear_char = 2 + //SEG15 [7] call init_font_hex + //SEG16 [68] phi from main to init_font_hex [phi:main->init_font_hex] + init_font_hex_from_main: + jsr init_font_hex + //SEG17 [8] phi from main to main::toD0181 [phi:main->main::toD0181] + toD0181_from_main: + jmp toD0181 + //SEG18 main::toD0181 + toD0181: + jmp b5 + //SEG19 main::@5 + b5: + //SEG20 [9] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0181_return + sta D018 + //SEG21 [10] call init_screen + //SEG22 [16] phi from main::@5 to init_screen [phi:main::@5->init_screen] + init_screen_from_b5: + jsr init_screen + //SEG23 [11] phi from main::@5 to main::@1 [phi:main::@5->main::@1] + b1_from_b5: + //SEG24 [11] phi (byte*) main::clear_char#5 = (const byte*) CHARSET#0 [phi:main::@5->main::@1#0] -- pbuz1=pbuc1 + lda #CHARSET + sta clear_char+1 + jmp b1 + //SEG25 [11] phi from main::@3 to main::@1 [phi:main::@3->main::@1] + b1_from_b3: + jmp b1 + //SEG26 main::@1 + b1: + jmp b2 + //SEG27 main::@2 + b2: + //SEG28 [12] if(*((const byte*) RASTER#0)!=(byte) $ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 + lda #$ff + cmp RASTER + bne b2 + jmp b3 + //SEG29 main::@3 + b3: + //SEG30 [13] if((byte*) main::clear_char#5>=(const byte*) CHARSET#0+(word) $800) goto main::@1 -- pbuz1_ge_pbuc1_then_la1 + lda clear_char+1 + cmp #>CHARSET+$800 + bcc !+ + bne b1_from_b3 + lda clear_char + cmp #main::@1] + b1_from_b4: + //SEG35 [11] phi (byte*) main::clear_char#5 = (byte*) main::clear_char#1 [phi:main::@4->main::@1#0] -- register_copy + jmp b1 +} +//SEG36 init_screen +init_screen: { + .label _7 = $c + .label xw = $17 + .label yw = $19 + .label angle_w = $c + .label screen = 5 + .label y = 4 + //SEG37 [17] phi from init_screen to init_screen::@1 [phi:init_screen->init_screen::@1] + b1_from_init_screen: + //SEG38 [17] phi (byte*) init_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_screen->init_screen::@1#0] -- pbuz1=pbuc1 + lda #SCREEN + sta screen+1 + //SEG39 [17] phi (signed byte) init_screen::y#4 = (signed byte) -$c [phi:init_screen->init_screen::@1#1] -- vbsz1=vbsc1 + lda #-$c + sta y + jmp b1 + //SEG40 [17] phi from init_screen::@3 to init_screen::@1 [phi:init_screen::@3->init_screen::@1] + b1_from_b3: + //SEG41 [17] phi (byte*) init_screen::screen#4 = (byte*) init_screen::screen#1 [phi:init_screen::@3->init_screen::@1#0] -- register_copy + //SEG42 [17] phi (signed byte) init_screen::y#4 = (signed byte) init_screen::y#1 [phi:init_screen::@3->init_screen::@1#1] -- register_copy + jmp b1 + //SEG43 init_screen::@1 + b1: + //SEG44 [18] phi from init_screen::@1 to init_screen::@2 [phi:init_screen::@1->init_screen::@2] + b2_from_b1: + //SEG45 [18] phi (byte*) init_screen::screen#2 = (byte*) init_screen::screen#4 [phi:init_screen::@1->init_screen::@2#0] -- register_copy + //SEG46 [18] phi (signed byte) init_screen::x#2 = (signed byte) -$13 [phi:init_screen::@1->init_screen::@2#1] -- vbsxx=vbsc1 + ldx #-$13 + jmp b2 + //SEG47 [18] phi from init_screen::@4 to init_screen::@2 [phi:init_screen::@4->init_screen::@2] + b2_from_b4: + //SEG48 [18] phi (byte*) init_screen::screen#2 = (byte*) init_screen::screen#1 [phi:init_screen::@4->init_screen::@2#0] -- register_copy + //SEG49 [18] phi (signed byte) init_screen::x#2 = (signed byte) init_screen::x#1 [phi:init_screen::@4->init_screen::@2#1] -- register_copy + jmp b2 + //SEG50 init_screen::@2 + b2: + //SEG51 [19] (word) init_screen::xw#0 ← (byte)(signed byte) init_screen::x#2 w= (byte) 0 -- vwuz1=vbuxx_word_vbuc1 + ldy #0 + txa + sta xw+1 + sty xw + //SEG52 [20] (word) init_screen::yw#0 ← (byte)(signed byte) init_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 + lda y + ldy #0 + sta yw+1 + sty yw + //SEG53 [21] (signed word) atan2_16::x#0 ← (signed word)(word) init_screen::xw#0 + //SEG54 [22] (signed word) atan2_16::y#0 ← (signed word)(word) init_screen::yw#0 + //SEG55 [23] call atan2_16 + jsr atan2_16 + //SEG56 [24] (word) atan2_16::return#2 ← (word) atan2_16::return#0 + jmp b4 + //SEG57 init_screen::@4 + b4: + //SEG58 [25] (word) init_screen::angle_w#0 ← (word) atan2_16::return#2 + //SEG59 [26] (word~) init_screen::$7 ← (word) init_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz1_plus_vbuc1 + lda #$80 + clc + adc _7 + sta _7 + bcc !+ + inc _7+1 + !: + //SEG60 [27] (byte) init_screen::ang_w#0 ← > (word~) init_screen::$7 -- vbuaa=_hi_vwuz1 + lda _7+1 + //SEG61 [28] *((byte*) init_screen::screen#2) ← (byte) init_screen::ang_w#0 -- _deref_pbuz1=vbuaa + ldy #0 + sta (screen),y + //SEG62 [29] (byte*) init_screen::screen#1 ← ++ (byte*) init_screen::screen#2 -- pbuz1=_inc_pbuz1 + inc screen + bne !+ + inc screen+1 + !: + //SEG63 [30] (signed byte) init_screen::x#1 ← ++ (signed byte) init_screen::x#2 -- vbsxx=_inc_vbsxx + inx + //SEG64 [31] if((signed byte) init_screen::x#1!=(signed byte) $15) goto init_screen::@2 -- vbsxx_neq_vbsc1_then_la1 + cpx #$15 + bne b2_from_b4 + jmp b3 + //SEG65 init_screen::@3 + b3: + //SEG66 [32] (signed byte) init_screen::y#1 ← ++ (signed byte) init_screen::y#4 -- vbsz1=_inc_vbsz1 + inc y + //SEG67 [33] if((signed byte) init_screen::y#1!=(signed byte) $d) goto init_screen::@1 -- vbsz1_neq_vbsc1_then_la1 + lda #$d + cmp y + bne b1_from_b3 + jmp breturn + //SEG68 init_screen::@return + breturn: + //SEG69 [34] return + rts +} +//SEG70 atan2_16 +// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y) +// Finding the angle requires a binary search using CORDIC_ITERATIONS_16 +// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI) +// atan2_16(signed word zeropage($17) x, signed word zeropage($19) y) +atan2_16: { + .label _2 = 7 + .label _7 = 9 + .label yi = 7 + .label xi = 9 + .label xd = $1b + .label yd = $1d + .label angle = $c + .label i = $b + .label return = $c + .label x = $17 + .label y = $19 + //SEG71 [35] if((signed word) atan2_16::y#0>(signed byte) 0) goto atan2_16::@1 -- vwsz1_gt_0_then_la1 + lda y+1 + bne !+ + lda y + beq !e+ + lsr + !: + bpl b1 + !e: + jmp b2 + //SEG72 atan2_16::@2 + b2: + //SEG73 [36] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 + sec + lda #0 + sbc y + sta _2 + lda #0 + sbc y+1 + sta _2+1 + //SEG74 [37] phi from atan2_16::@1 atan2_16::@2 to atan2_16::@3 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3] + b3_from_b1: + b3_from_b2: + //SEG75 [37] phi (signed word) atan2_16::yi#0 = (signed word~) atan2_16::yi#11 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3#0] -- register_copy + jmp b3 + //SEG76 atan2_16::@3 + b3: + //SEG77 [38] if((signed word) atan2_16::x#0>(signed byte) 0) goto atan2_16::@4 -- vwsz1_gt_0_then_la1 + lda x+1 + bne !+ + lda x + beq !e+ + lsr + !: + bpl b4 + !e: + jmp b5 + //SEG78 atan2_16::@5 + b5: + //SEG79 [39] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 + sec + lda #0 + sbc x + sta _7 + lda #0 + sbc x+1 + sta _7+1 + //SEG80 [40] phi from atan2_16::@4 atan2_16::@5 to atan2_16::@6 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6] + b6_from_b4: + b6_from_b5: + //SEG81 [40] phi (signed word) atan2_16::xi#0 = (signed word~) atan2_16::xi#8 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6#0] -- register_copy + jmp b6 + //SEG82 atan2_16::@6 + b6: + //SEG83 [41] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] + b10_from_b6: + //SEG84 [41] phi (word) atan2_16::angle#12 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#0] -- vwuz1=vbuc1 + lda #0 + sta angle + lda #0 + sta angle+1 + //SEG85 [41] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 + lda #0 + sta i + //SEG86 [41] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy + //SEG87 [41] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#0 [phi:atan2_16::@6->atan2_16::@10#3] -- register_copy + jmp b10 + //SEG88 atan2_16::@10 + b10: + //SEG89 [42] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 + lda yi+1 + bne b11 + lda yi + bne b11 + //SEG90 [43] phi from atan2_16::@10 atan2_16::@14 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12] + b12_from_b10: + b12_from_b14: + //SEG91 [43] phi (word) atan2_16::angle#6 = (word) atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12#0] -- register_copy + jmp b12 + //SEG92 atan2_16::@12 + b12: + //SEG93 [44] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 -- vwuz1=vwuz1_ror_1 + lsr angle+1 + ror angle + //SEG94 [45] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 -- vwsz1_ge_0_then_la1 + lda x+1 + bpl b7_from_b12 + jmp b16 + //SEG95 atan2_16::@16 + b16: + //SEG96 [46] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 + sec + lda #<$8000 + sbc angle + sta angle + lda #>$8000 + sbc angle+1 + sta angle+1 + //SEG97 [47] phi from atan2_16::@12 atan2_16::@16 to atan2_16::@7 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7] + b7_from_b12: + b7_from_b16: + //SEG98 [47] phi (word) atan2_16::angle#11 = (word) atan2_16::angle#1 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7#0] -- register_copy + jmp b7 + //SEG99 atan2_16::@7 + b7: + //SEG100 [48] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 -- vwsz1_ge_0_then_la1 + lda y+1 + bpl b8_from_b7 + jmp b9 + //SEG101 atan2_16::@9 + b9: + //SEG102 [49] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 + sec + lda #0 + sbc angle + sta angle + lda #0 + sbc angle+1 + sta angle+1 + //SEG103 [50] phi from atan2_16::@7 atan2_16::@9 to atan2_16::@8 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8] + b8_from_b7: + b8_from_b9: + //SEG104 [50] phi (word) atan2_16::return#0 = (word) atan2_16::angle#11 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8#0] -- register_copy + jmp b8 + //SEG105 atan2_16::@8 + b8: + jmp breturn + //SEG106 atan2_16::@return + breturn: + //SEG107 [51] return + rts + //SEG108 atan2_16::@11 + b11: + //SEG109 [52] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + ldy i + lda xi + sta xd + lda xi+1 + sta xd+1 + cpy #0 + beq !e+ + !: + lda xd+1 + cmp #$80 + ror xd+1 + ror xd + dey + bne !- + !e: + //SEG110 [53] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + ldy i + lda yi + sta yd + lda yi+1 + sta yd+1 + cpy #0 + beq !e+ + !: + lda yd+1 + cmp #$80 + ror yd+1 + ror yd + dey + bne !- + !e: + //SEG111 [54] if((signed word) atan2_16::yi#3>(signed byte) 0) goto atan2_16::@13 -- vwsz1_gt_0_then_la1 + lda yi+1 + bne !+ + lda yi + beq !e+ + lsr + !: + bpl b13 + !e: + jmp b15 + //SEG112 atan2_16::@15 + b15: + //SEG113 [55] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_minus_vwsz2 + lda xi + sec + sbc yd + sta xi + lda xi+1 + sbc yd+1 + sta xi+1 + //SEG114 [56] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_plus_vwsz2 + lda yi + clc + adc xd + sta yi + lda yi+1 + adc xd+1 + sta yi+1 + //SEG115 [57] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + lda i + asl + //SEG116 [58] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuaa + tay + sec + lda angle + sbc CORDIC_ATAN2_ANGLES_16,y + sta angle + lda angle+1 + sbc CORDIC_ATAN2_ANGLES_16+1,y + sta angle+1 + //SEG117 [59] phi from atan2_16::@13 atan2_16::@15 to atan2_16::@14 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14] + b14_from_b13: + b14_from_b15: + //SEG118 [59] phi (signed word) atan2_16::xi#7 = (signed word) atan2_16::xi#1 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#0] -- register_copy + //SEG119 [59] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy + //SEG120 [59] phi (signed word) atan2_16::yi#7 = (signed word) atan2_16::yi#1 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#2] -- register_copy + jmp b14 + //SEG121 atan2_16::@14 + b14: + //SEG122 [60] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 + inc i + //SEG123 [61] if((byte) atan2_16::i#1==(const byte) CORDIC_ITERATIONS_16#0-(byte) 1+(byte) 1) goto atan2_16::@12 -- vbuz1_eq_vbuc1_then_la1 + lda #CORDIC_ITERATIONS_16-1+1 + cmp i + beq b12_from_b14 + //SEG124 [41] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] + b10_from_b14: + //SEG125 [41] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy + //SEG126 [41] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy + //SEG127 [41] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy + //SEG128 [41] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#7 [phi:atan2_16::@14->atan2_16::@10#3] -- register_copy + jmp b10 + //SEG129 atan2_16::@13 + b13: + //SEG130 [62] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_plus_vwsz2 + lda xi + clc + adc yd + sta xi + lda xi+1 + adc yd+1 + sta xi+1 + //SEG131 [63] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_minus_vwsz2 + lda yi + sec + sbc xd + sta yi + lda yi+1 + sbc xd+1 + sta yi+1 + //SEG132 [64] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + lda i + asl + //SEG133 [65] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuaa + tay + clc + lda angle + adc CORDIC_ATAN2_ANGLES_16,y + sta angle + lda angle+1 + adc CORDIC_ATAN2_ANGLES_16+1,y + sta angle+1 + jmp b14_from_b13 + //SEG134 atan2_16::@4 + b4: + //SEG135 [66] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 -- vwsz1=vwsz2 + lda x + sta xi + lda x+1 + sta xi+1 + jmp b6_from_b4 + //SEG136 atan2_16::@1 + b1: + //SEG137 [67] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 -- vwsz1=vwsz2 + lda y + sta yi + lda y+1 + sta yi+1 + jmp b3_from_b1 +} +//SEG138 init_font_hex +// Make charset from proto chars +// init_font_hex(byte* zeropage($11) charset) +init_font_hex: { + .label _0 = $1f + .label idx = $16 + .label proto_lo = $13 + .label charset = $11 + .label c1 = $15 + .label proto_hi = $e + .label c = $10 + //SEG139 [69] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] + b1_from_init_font_hex: + //SEG140 [69] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 + lda #0 + sta c + //SEG141 [69] phi (byte*) init_font_hex::proto_hi#6 = (const byte[]) FONT_HEX_PROTO#0 [phi:init_font_hex->init_font_hex::@1#1] -- pbuz1=pbuc1 + lda #FONT_HEX_PROTO + sta proto_hi+1 + //SEG142 [69] phi (byte*) init_font_hex::charset#5 = (const byte*) CHARSET#0 [phi:init_font_hex->init_font_hex::@1#2] -- pbuz1=pbuc1 + lda #CHARSET + sta charset+1 + jmp b1 + //SEG143 [69] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] + b1_from_b5: + //SEG144 [69] phi (byte) init_font_hex::c#6 = (byte) init_font_hex::c#1 [phi:init_font_hex::@5->init_font_hex::@1#0] -- register_copy + //SEG145 [69] phi (byte*) init_font_hex::proto_hi#6 = (byte*) init_font_hex::proto_hi#1 [phi:init_font_hex::@5->init_font_hex::@1#1] -- register_copy + //SEG146 [69] phi (byte*) init_font_hex::charset#5 = (byte*) init_font_hex::charset#0 [phi:init_font_hex::@5->init_font_hex::@1#2] -- register_copy + jmp b1 + //SEG147 init_font_hex::@1 + b1: + //SEG148 [70] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] + b2_from_b1: + //SEG149 [70] phi (byte) init_font_hex::c1#4 = (byte) 0 [phi:init_font_hex::@1->init_font_hex::@2#0] -- vbuz1=vbuc1 + lda #0 + sta c1 + //SEG150 [70] phi (byte*) init_font_hex::proto_lo#4 = (const byte[]) FONT_HEX_PROTO#0 [phi:init_font_hex::@1->init_font_hex::@2#1] -- pbuz1=pbuc1 + lda #FONT_HEX_PROTO + sta proto_lo+1 + //SEG151 [70] phi (byte*) init_font_hex::charset#2 = (byte*) init_font_hex::charset#5 [phi:init_font_hex::@1->init_font_hex::@2#2] -- register_copy + jmp b2 + //SEG152 [70] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] + b2_from_b4: + //SEG153 [70] phi (byte) init_font_hex::c1#4 = (byte) init_font_hex::c1#1 [phi:init_font_hex::@4->init_font_hex::@2#0] -- register_copy + //SEG154 [70] phi (byte*) init_font_hex::proto_lo#4 = (byte*) init_font_hex::proto_lo#1 [phi:init_font_hex::@4->init_font_hex::@2#1] -- register_copy + //SEG155 [70] phi (byte*) init_font_hex::charset#2 = (byte*) init_font_hex::charset#0 [phi:init_font_hex::@4->init_font_hex::@2#2] -- register_copy + jmp b2 + //SEG156 init_font_hex::@2 + b2: + //SEG157 [71] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + lda #0 + ldy #0 + sta (charset),y + //SEG158 [72] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] + b3_from_b2: + //SEG159 [72] phi (byte) init_font_hex::idx#5 = (byte) 1 [phi:init_font_hex::@2->init_font_hex::@3#0] -- vbuz1=vbuc1 + lda #1 + sta idx + //SEG160 [72] phi (byte) init_font_hex::i#2 = (byte) 0 [phi:init_font_hex::@2->init_font_hex::@3#1] -- vbuxx=vbuc1 + ldx #0 + jmp b3 + //SEG161 [72] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] + b3_from_b3: + //SEG162 [72] phi (byte) init_font_hex::idx#5 = (byte) init_font_hex::idx#2 [phi:init_font_hex::@3->init_font_hex::@3#0] -- register_copy + //SEG163 [72] phi (byte) init_font_hex::i#2 = (byte) init_font_hex::i#1 [phi:init_font_hex::@3->init_font_hex::@3#1] -- register_copy + jmp b3 + //SEG164 init_font_hex::@3 + b3: + //SEG165 [73] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 -- vbuz1=pbuz2_derefidx_vbuxx_rol_4 + txa + tay + lda (proto_hi),y + asl + asl + asl + asl + sta _0 + //SEG166 [74] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 -- vbuaa=pbuz1_derefidx_vbuxx_rol_1 + txa + tay + lda (proto_lo),y + asl + //SEG167 [75] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 -- vbuaa=vbuz1_bor_vbuaa + ora _0 + //SEG168 [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 -- pbuz1_derefidx_vbuz2=vbuaa + ldy idx + sta (charset),y + //SEG169 [77] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 + inc idx + //SEG170 [78] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuxx=_inc_vbuxx + inx + //SEG171 [79] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 -- vbuxx_neq_vbuc1_then_la1 + cpx #5 + bne b3_from_b3 + jmp b4 + //SEG172 init_font_hex::@4 + b4: + //SEG173 [80] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 -- pbuz1_derefidx_vbuz2=vbuc1 + lda #0 + ldy idx + sta (charset),y + //SEG174 [81] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuyy=_inc_vbuz1 + ldy idx + iny + //SEG175 [82] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 -- pbuz1_derefidx_vbuyy=vbuc1 + lda #0 + sta (charset),y + //SEG176 [83] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + lda #5 + clc + adc proto_lo + sta proto_lo + bcc !+ + inc proto_lo+1 + !: + //SEG177 [84] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 + lda #8 + clc + adc charset + sta charset + bcc !+ + inc charset+1 + !: + //SEG178 [85] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 + inc c1 + //SEG179 [86] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 -- vbuz1_neq_vbuc1_then_la1 + lda #$10 + cmp c1 + bne b2_from_b4 + jmp b5 + //SEG180 init_font_hex::@5 + b5: + //SEG181 [87] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + lda #5 + clc + adc proto_hi + sta proto_hi + bcc !+ + inc proto_hi+1 + !: + //SEG182 [88] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 + inc c + //SEG183 [89] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 -- vbuz1_neq_vbuc1_then_la1 + lda #$10 + cmp c + bne b1_from_b5 + jmp breturn + //SEG184 init_font_hex::@return + breturn: + //SEG185 [90] return + rts +} +//SEG186 File Data + // Bit patterns for symbols 0-f (3x5 pixels) used in font hex + FONT_HEX_PROTO: .byte 2, 5, 5, 5, 2, 6, 2, 2, 2, 7, 6, 1, 2, 4, 7, 6, 1, 2, 1, 6, 5, 5, 7, 1, 1, 7, 4, 6, 1, 6, 3, 4, 6, 5, 2, 7, 1, 1, 1, 1, 2, 5, 2, 5, 2, 2, 5, 3, 1, 1, 2, 5, 7, 5, 5, 6, 5, 6, 5, 6, 2, 5, 4, 5, 2, 6, 5, 5, 5, 6, 7, 4, 6, 4, 7, 7, 4, 6, 4, 4 +.pc = CORDIC_ATAN2_ANGLES_16 "CORDIC_ATAN2_ANGLES_16" + .for (var i=0; i(word)(const byte*) SCREEN#0&(word) $3fff*(byte) 4|>(word)(const byte*) CHARSET#0/(byte) 4&(byte) $f +(byte*) main::toD0181_screen + +zp ZP_WORD:2 [ main::clear_char#5 main::clear_char#1 ] +zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +reg byte x [ init_screen::x#2 init_screen::x#1 ] +zp ZP_WORD:5 [ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] +zp ZP_WORD:7 [ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] +zp ZP_WORD:9 [ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] +zp ZP_BYTE:11 [ atan2_16::i#2 atan2_16::i#1 ] +zp ZP_WORD:12 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_screen::angle_w#0 init_screen::$7 ] +zp ZP_WORD:14 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +zp ZP_BYTE:16 [ init_font_hex::c#6 init_font_hex::c#1 ] +zp ZP_WORD:17 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +zp ZP_WORD:19 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +zp ZP_BYTE:21 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] +zp ZP_BYTE:22 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +zp ZP_WORD:23 [ init_screen::xw#0 atan2_16::x#0 ] +zp ZP_WORD:25 [ init_screen::yw#0 atan2_16::y#0 ] +reg byte a [ init_screen::ang_w#0 ] +zp ZP_WORD:27 [ atan2_16::xd#0 ] +zp ZP_WORD:29 [ atan2_16::yd#0 ] +reg byte a [ atan2_16::$24 ] +reg byte a [ atan2_16::$23 ] +zp ZP_BYTE:31 [ init_font_hex::$0 ] +reg byte a [ init_font_hex::$1 ] +reg byte a [ init_font_hex::$2 ] +reg byte y [ init_font_hex::idx#3 ] + + +FINAL ASSEMBLER +Score: 374014 + +//SEG0 File Comments +// Find atan2(x, y) using the CORDIC method +// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG2 Global Constants & labels + // The number of iterations performed during 16-bit CORDIC atan2 calculation + .const CORDIC_ITERATIONS_16 = $f + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + .label CORDIC_ATAN2_ANGLES_16 = $1000 + // The number of iterations performed during 8-bit CORDIC atan2 calculation + .const CORDIC_ITERATIONS_8 = 8 + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + .label CORDIC_ATAN2_ANGLES_8 = $1100 + .label RASTER = $d012 + .label D018 = $d018 + .label CHARSET = $2000 + .label SCREEN = $2800 +//SEG3 @begin +//SEG4 @1 +//SEG5 kickasm(location (const word*) CORDIC_ATAN2_ANGLES_16#0 uses CORDIC_ITERATIONS_16#0) {{ .for (var i=0; i@3] +//SEG9 @3 +//SEG10 [4] call main +//SEG11 [6] phi from @3 to main [phi:@3->main] +//SEG12 [5] phi from @3 to @end [phi:@3->@end] +//SEG13 @end +//SEG14 main +main: { + .const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f + .label clear_char = 2 + //SEG15 [7] call init_font_hex + //SEG16 [68] phi from main to init_font_hex [phi:main->init_font_hex] + jsr init_font_hex + //SEG17 [8] phi from main to main::toD0181 [phi:main->main::toD0181] + //SEG18 main::toD0181 + //SEG19 main::@5 + //SEG20 [9] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0181_return + sta D018 + //SEG21 [10] call init_screen + //SEG22 [16] phi from main::@5 to init_screen [phi:main::@5->init_screen] + jsr init_screen + //SEG23 [11] phi from main::@5 to main::@1 [phi:main::@5->main::@1] + //SEG24 [11] phi (byte*) main::clear_char#5 = (const byte*) CHARSET#0 [phi:main::@5->main::@1#0] -- pbuz1=pbuc1 + lda #CHARSET + sta clear_char+1 + //SEG25 [11] phi from main::@3 to main::@1 [phi:main::@3->main::@1] + //SEG26 main::@1 + //SEG27 main::@2 + b2: + //SEG28 [12] if(*((const byte*) RASTER#0)!=(byte) $ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 + lda #$ff + cmp RASTER + bne b2 + //SEG29 main::@3 + //SEG30 [13] if((byte*) main::clear_char#5>=(const byte*) CHARSET#0+(word) $800) goto main::@1 -- pbuz1_ge_pbuc1_then_la1 + lda clear_char+1 + cmp #>CHARSET+$800 + bcc !+ + bne b2 + lda clear_char + cmp #main::@1] + //SEG35 [11] phi (byte*) main::clear_char#5 = (byte*) main::clear_char#1 [phi:main::@4->main::@1#0] -- register_copy + jmp b2 +} +//SEG36 init_screen +init_screen: { + .label _7 = $c + .label xw = $17 + .label yw = $19 + .label angle_w = $c + .label screen = 5 + .label y = 4 + //SEG37 [17] phi from init_screen to init_screen::@1 [phi:init_screen->init_screen::@1] + //SEG38 [17] phi (byte*) init_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_screen->init_screen::@1#0] -- pbuz1=pbuc1 + lda #SCREEN + sta screen+1 + //SEG39 [17] phi (signed byte) init_screen::y#4 = (signed byte) -$c [phi:init_screen->init_screen::@1#1] -- vbsz1=vbsc1 + lda #-$c + sta y + //SEG40 [17] phi from init_screen::@3 to init_screen::@1 [phi:init_screen::@3->init_screen::@1] + //SEG41 [17] phi (byte*) init_screen::screen#4 = (byte*) init_screen::screen#1 [phi:init_screen::@3->init_screen::@1#0] -- register_copy + //SEG42 [17] phi (signed byte) init_screen::y#4 = (signed byte) init_screen::y#1 [phi:init_screen::@3->init_screen::@1#1] -- register_copy + //SEG43 init_screen::@1 + b1: + //SEG44 [18] phi from init_screen::@1 to init_screen::@2 [phi:init_screen::@1->init_screen::@2] + //SEG45 [18] phi (byte*) init_screen::screen#2 = (byte*) init_screen::screen#4 [phi:init_screen::@1->init_screen::@2#0] -- register_copy + //SEG46 [18] phi (signed byte) init_screen::x#2 = (signed byte) -$13 [phi:init_screen::@1->init_screen::@2#1] -- vbsxx=vbsc1 + ldx #-$13 + //SEG47 [18] phi from init_screen::@4 to init_screen::@2 [phi:init_screen::@4->init_screen::@2] + //SEG48 [18] phi (byte*) init_screen::screen#2 = (byte*) init_screen::screen#1 [phi:init_screen::@4->init_screen::@2#0] -- register_copy + //SEG49 [18] phi (signed byte) init_screen::x#2 = (signed byte) init_screen::x#1 [phi:init_screen::@4->init_screen::@2#1] -- register_copy + //SEG50 init_screen::@2 + b2: + //SEG51 [19] (word) init_screen::xw#0 ← (byte)(signed byte) init_screen::x#2 w= (byte) 0 -- vwuz1=vbuxx_word_vbuc1 + ldy #0 + txa + sta xw+1 + sty xw + //SEG52 [20] (word) init_screen::yw#0 ← (byte)(signed byte) init_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 + lda y + sta yw+1 + sty yw + //SEG53 [21] (signed word) atan2_16::x#0 ← (signed word)(word) init_screen::xw#0 + //SEG54 [22] (signed word) atan2_16::y#0 ← (signed word)(word) init_screen::yw#0 + //SEG55 [23] call atan2_16 + jsr atan2_16 + //SEG56 [24] (word) atan2_16::return#2 ← (word) atan2_16::return#0 + //SEG57 init_screen::@4 + //SEG58 [25] (word) init_screen::angle_w#0 ← (word) atan2_16::return#2 + //SEG59 [26] (word~) init_screen::$7 ← (word) init_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz1_plus_vbuc1 + lda #$80 + clc + adc _7 + sta _7 + bcc !+ + inc _7+1 + !: + //SEG60 [27] (byte) init_screen::ang_w#0 ← > (word~) init_screen::$7 -- vbuaa=_hi_vwuz1 + lda _7+1 + //SEG61 [28] *((byte*) init_screen::screen#2) ← (byte) init_screen::ang_w#0 -- _deref_pbuz1=vbuaa + ldy #0 + sta (screen),y + //SEG62 [29] (byte*) init_screen::screen#1 ← ++ (byte*) init_screen::screen#2 -- pbuz1=_inc_pbuz1 + inc screen + bne !+ + inc screen+1 + !: + //SEG63 [30] (signed byte) init_screen::x#1 ← ++ (signed byte) init_screen::x#2 -- vbsxx=_inc_vbsxx + inx + //SEG64 [31] if((signed byte) init_screen::x#1!=(signed byte) $15) goto init_screen::@2 -- vbsxx_neq_vbsc1_then_la1 + cpx #$15 + bne b2 + //SEG65 init_screen::@3 + //SEG66 [32] (signed byte) init_screen::y#1 ← ++ (signed byte) init_screen::y#4 -- vbsz1=_inc_vbsz1 + inc y + //SEG67 [33] if((signed byte) init_screen::y#1!=(signed byte) $d) goto init_screen::@1 -- vbsz1_neq_vbsc1_then_la1 + lda #$d + cmp y + bne b1 + //SEG68 init_screen::@return + //SEG69 [34] return + rts +} +//SEG70 atan2_16 +// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y) +// Finding the angle requires a binary search using CORDIC_ITERATIONS_16 +// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI) +// atan2_16(signed word zeropage($17) x, signed word zeropage($19) y) +atan2_16: { + .label _2 = 7 + .label _7 = 9 + .label yi = 7 + .label xi = 9 + .label xd = $1b + .label yd = $1d + .label angle = $c + .label i = $b + .label return = $c + .label x = $17 + .label y = $19 + //SEG71 [35] if((signed word) atan2_16::y#0>(signed byte) 0) goto atan2_16::@1 -- vwsz1_gt_0_then_la1 + lda y+1 + bne !+ + lda y + beq !e+ + lsr + !: + bmi !b1+ + jmp b1 + !b1: + !e: + //SEG72 atan2_16::@2 + //SEG73 [36] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 + sec + lda #0 + sbc y + sta _2 + lda #0 + sbc y+1 + sta _2+1 + //SEG74 [37] phi from atan2_16::@1 atan2_16::@2 to atan2_16::@3 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3] + //SEG75 [37] phi (signed word) atan2_16::yi#0 = (signed word~) atan2_16::yi#11 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3#0] -- register_copy + //SEG76 atan2_16::@3 + b3: + //SEG77 [38] if((signed word) atan2_16::x#0>(signed byte) 0) goto atan2_16::@4 -- vwsz1_gt_0_then_la1 + lda x+1 + bne !+ + lda x + beq !e+ + lsr + !: + bmi !b4+ + jmp b4 + !b4: + !e: + //SEG78 atan2_16::@5 + //SEG79 [39] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 + sec + lda #0 + sbc x + sta _7 + lda #0 + sbc x+1 + sta _7+1 + //SEG80 [40] phi from atan2_16::@4 atan2_16::@5 to atan2_16::@6 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6] + //SEG81 [40] phi (signed word) atan2_16::xi#0 = (signed word~) atan2_16::xi#8 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6#0] -- register_copy + //SEG82 atan2_16::@6 + b6: + //SEG83 [41] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] + //SEG84 [41] phi (word) atan2_16::angle#12 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#0] -- vwuz1=vbuc1 + lda #0 + sta angle + sta angle+1 + //SEG85 [41] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 + sta i + //SEG86 [41] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy + //SEG87 [41] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#0 [phi:atan2_16::@6->atan2_16::@10#3] -- register_copy + //SEG88 atan2_16::@10 + b10: + //SEG89 [42] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 + lda yi+1 + bne b11 + lda yi + bne b11 + //SEG90 [43] phi from atan2_16::@10 atan2_16::@14 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12] + //SEG91 [43] phi (word) atan2_16::angle#6 = (word) atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12#0] -- register_copy + //SEG92 atan2_16::@12 + b12: + //SEG93 [44] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 -- vwuz1=vwuz1_ror_1 + lsr angle+1 + ror angle + //SEG94 [45] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 -- vwsz1_ge_0_then_la1 + lda x+1 + bpl b7 + //SEG95 atan2_16::@16 + //SEG96 [46] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 + sec + lda #<$8000 + sbc angle + sta angle + lda #>$8000 + sbc angle+1 + sta angle+1 + //SEG97 [47] phi from atan2_16::@12 atan2_16::@16 to atan2_16::@7 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7] + //SEG98 [47] phi (word) atan2_16::angle#11 = (word) atan2_16::angle#1 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7#0] -- register_copy + //SEG99 atan2_16::@7 + b7: + //SEG100 [48] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 -- vwsz1_ge_0_then_la1 + lda y+1 + bpl b8 + //SEG101 atan2_16::@9 + //SEG102 [49] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 + sec + lda #0 + sbc angle + sta angle + lda #0 + sbc angle+1 + sta angle+1 + //SEG103 [50] phi from atan2_16::@7 atan2_16::@9 to atan2_16::@8 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8] + //SEG104 [50] phi (word) atan2_16::return#0 = (word) atan2_16::angle#11 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8#0] -- register_copy + //SEG105 atan2_16::@8 + b8: + //SEG106 atan2_16::@return + //SEG107 [51] return + rts + //SEG108 atan2_16::@11 + b11: + //SEG109 [52] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + ldy i + lda xi + sta xd + lda xi+1 + sta xd+1 + cpy #0 + beq !e+ + !: + lda xd+1 + cmp #$80 + ror xd+1 + ror xd + dey + bne !- + !e: + //SEG110 [53] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + ldy i + lda yi + sta yd + lda yi+1 + sta yd+1 + cpy #0 + beq !e+ + !: + lda yd+1 + cmp #$80 + ror yd+1 + ror yd + dey + bne !- + !e: + //SEG111 [54] if((signed word) atan2_16::yi#3>(signed byte) 0) goto atan2_16::@13 -- vwsz1_gt_0_then_la1 + lda yi+1 + bne !+ + lda yi + beq !e+ + lsr + !: + bpl b13 + !e: + //SEG112 atan2_16::@15 + //SEG113 [55] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_minus_vwsz2 + lda xi + sec + sbc yd + sta xi + lda xi+1 + sbc yd+1 + sta xi+1 + //SEG114 [56] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_plus_vwsz2 + lda yi + clc + adc xd + sta yi + lda yi+1 + adc xd+1 + sta yi+1 + //SEG115 [57] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + lda i + asl + //SEG116 [58] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuaa + tay + sec + lda angle + sbc CORDIC_ATAN2_ANGLES_16,y + sta angle + lda angle+1 + sbc CORDIC_ATAN2_ANGLES_16+1,y + sta angle+1 + //SEG117 [59] phi from atan2_16::@13 atan2_16::@15 to atan2_16::@14 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14] + //SEG118 [59] phi (signed word) atan2_16::xi#7 = (signed word) atan2_16::xi#1 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#0] -- register_copy + //SEG119 [59] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy + //SEG120 [59] phi (signed word) atan2_16::yi#7 = (signed word) atan2_16::yi#1 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#2] -- register_copy + //SEG121 atan2_16::@14 + b14: + //SEG122 [60] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 + inc i + //SEG123 [61] if((byte) atan2_16::i#1==(const byte) CORDIC_ITERATIONS_16#0-(byte) 1+(byte) 1) goto atan2_16::@12 -- vbuz1_eq_vbuc1_then_la1 + lda #CORDIC_ITERATIONS_16-1+1 + cmp i + bne !b12+ + jmp b12 + !b12: + //SEG124 [41] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] + //SEG125 [41] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy + //SEG126 [41] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy + //SEG127 [41] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy + //SEG128 [41] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#7 [phi:atan2_16::@14->atan2_16::@10#3] -- register_copy + jmp b10 + //SEG129 atan2_16::@13 + b13: + //SEG130 [62] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_plus_vwsz2 + lda xi + clc + adc yd + sta xi + lda xi+1 + adc yd+1 + sta xi+1 + //SEG131 [63] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_minus_vwsz2 + lda yi + sec + sbc xd + sta yi + lda yi+1 + sbc xd+1 + sta yi+1 + //SEG132 [64] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + lda i + asl + //SEG133 [65] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuaa + tay + clc + lda angle + adc CORDIC_ATAN2_ANGLES_16,y + sta angle + lda angle+1 + adc CORDIC_ATAN2_ANGLES_16+1,y + sta angle+1 + jmp b14 + //SEG134 atan2_16::@4 + b4: + //SEG135 [66] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 -- vwsz1=vwsz2 + lda x + sta xi + lda x+1 + sta xi+1 + jmp b6 + //SEG136 atan2_16::@1 + b1: + //SEG137 [67] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 -- vwsz1=vwsz2 + lda y + sta yi + lda y+1 + sta yi+1 + jmp b3 +} +//SEG138 init_font_hex +// Make charset from proto chars +// init_font_hex(byte* zeropage($11) charset) +init_font_hex: { + .label _0 = $1f + .label idx = $16 + .label proto_lo = $13 + .label charset = $11 + .label c1 = $15 + .label proto_hi = $e + .label c = $10 + //SEG139 [69] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] + //SEG140 [69] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 + lda #0 + sta c + //SEG141 [69] phi (byte*) init_font_hex::proto_hi#6 = (const byte[]) FONT_HEX_PROTO#0 [phi:init_font_hex->init_font_hex::@1#1] -- pbuz1=pbuc1 + lda #FONT_HEX_PROTO + sta proto_hi+1 + //SEG142 [69] phi (byte*) init_font_hex::charset#5 = (const byte*) CHARSET#0 [phi:init_font_hex->init_font_hex::@1#2] -- pbuz1=pbuc1 + lda #CHARSET + sta charset+1 + //SEG143 [69] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] + //SEG144 [69] phi (byte) init_font_hex::c#6 = (byte) init_font_hex::c#1 [phi:init_font_hex::@5->init_font_hex::@1#0] -- register_copy + //SEG145 [69] phi (byte*) init_font_hex::proto_hi#6 = (byte*) init_font_hex::proto_hi#1 [phi:init_font_hex::@5->init_font_hex::@1#1] -- register_copy + //SEG146 [69] phi (byte*) init_font_hex::charset#5 = (byte*) init_font_hex::charset#0 [phi:init_font_hex::@5->init_font_hex::@1#2] -- register_copy + //SEG147 init_font_hex::@1 + b1: + //SEG148 [70] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] + //SEG149 [70] phi (byte) init_font_hex::c1#4 = (byte) 0 [phi:init_font_hex::@1->init_font_hex::@2#0] -- vbuz1=vbuc1 + lda #0 + sta c1 + //SEG150 [70] phi (byte*) init_font_hex::proto_lo#4 = (const byte[]) FONT_HEX_PROTO#0 [phi:init_font_hex::@1->init_font_hex::@2#1] -- pbuz1=pbuc1 + lda #FONT_HEX_PROTO + sta proto_lo+1 + //SEG151 [70] phi (byte*) init_font_hex::charset#2 = (byte*) init_font_hex::charset#5 [phi:init_font_hex::@1->init_font_hex::@2#2] -- register_copy + //SEG152 [70] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] + //SEG153 [70] phi (byte) init_font_hex::c1#4 = (byte) init_font_hex::c1#1 [phi:init_font_hex::@4->init_font_hex::@2#0] -- register_copy + //SEG154 [70] phi (byte*) init_font_hex::proto_lo#4 = (byte*) init_font_hex::proto_lo#1 [phi:init_font_hex::@4->init_font_hex::@2#1] -- register_copy + //SEG155 [70] phi (byte*) init_font_hex::charset#2 = (byte*) init_font_hex::charset#0 [phi:init_font_hex::@4->init_font_hex::@2#2] -- register_copy + //SEG156 init_font_hex::@2 + b2: + //SEG157 [71] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + lda #0 + tay + sta (charset),y + //SEG158 [72] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] + //SEG159 [72] phi (byte) init_font_hex::idx#5 = (byte) 1 [phi:init_font_hex::@2->init_font_hex::@3#0] -- vbuz1=vbuc1 + lda #1 + sta idx + //SEG160 [72] phi (byte) init_font_hex::i#2 = (byte) 0 [phi:init_font_hex::@2->init_font_hex::@3#1] -- vbuxx=vbuc1 + ldx #0 + //SEG161 [72] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] + //SEG162 [72] phi (byte) init_font_hex::idx#5 = (byte) init_font_hex::idx#2 [phi:init_font_hex::@3->init_font_hex::@3#0] -- register_copy + //SEG163 [72] phi (byte) init_font_hex::i#2 = (byte) init_font_hex::i#1 [phi:init_font_hex::@3->init_font_hex::@3#1] -- register_copy + //SEG164 init_font_hex::@3 + b3: + //SEG165 [73] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 -- vbuz1=pbuz2_derefidx_vbuxx_rol_4 + txa + tay + lda (proto_hi),y + asl + asl + asl + asl + sta _0 + //SEG166 [74] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 -- vbuaa=pbuz1_derefidx_vbuxx_rol_1 + txa + tay + lda (proto_lo),y + asl + //SEG167 [75] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 -- vbuaa=vbuz1_bor_vbuaa + ora _0 + //SEG168 [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 -- pbuz1_derefidx_vbuz2=vbuaa + ldy idx + sta (charset),y + //SEG169 [77] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 + inc idx + //SEG170 [78] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuxx=_inc_vbuxx + inx + //SEG171 [79] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 -- vbuxx_neq_vbuc1_then_la1 + cpx #5 + bne b3 + //SEG172 init_font_hex::@4 + //SEG173 [80] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 -- pbuz1_derefidx_vbuz2=vbuc1 + lda #0 + ldy idx + sta (charset),y + //SEG174 [81] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuyy=_inc_vbuz1 + iny + //SEG175 [82] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 -- pbuz1_derefidx_vbuyy=vbuc1 + sta (charset),y + //SEG176 [83] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + lda #5 + clc + adc proto_lo + sta proto_lo + bcc !+ + inc proto_lo+1 + !: + //SEG177 [84] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 + lda #8 + clc + adc charset + sta charset + bcc !+ + inc charset+1 + !: + //SEG178 [85] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 + inc c1 + //SEG179 [86] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 -- vbuz1_neq_vbuc1_then_la1 + lda #$10 + cmp c1 + bne b2 + //SEG180 init_font_hex::@5 + //SEG181 [87] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + lda #5 + clc + adc proto_hi + sta proto_hi + bcc !+ + inc proto_hi+1 + !: + //SEG182 [88] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 + inc c + //SEG183 [89] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 -- vbuz1_neq_vbuc1_then_la1 + lda #$10 + cmp c + bne b1 + //SEG184 init_font_hex::@return + //SEG185 [90] return + rts +} +//SEG186 File Data + // Bit patterns for symbols 0-f (3x5 pixels) used in font hex + FONT_HEX_PROTO: .byte 2, 5, 5, 5, 2, 6, 2, 2, 2, 7, 6, 1, 2, 4, 7, 6, 1, 2, 1, 6, 5, 5, 7, 1, 1, 7, 4, 6, 1, 6, 3, 4, 6, 5, 2, 7, 1, 1, 1, 1, 2, 5, 2, 5, 2, 2, 5, 3, 1, 1, 2, 5, 7, 5, 5, 6, 5, 6, 5, 6, 2, 5, 4, 5, 2, 6, 5, 5, 5, 6, 7, 4, 6, 4, 7, 7, 4, 6, 4, 4 +.pc = CORDIC_ATAN2_ANGLES_16 "CORDIC_ATAN2_ANGLES_16" + .for (var i=0; i(word)(const byte*) SCREEN#0&(word) $3fff*(byte) 4|>(word)(const byte*) CHARSET#0/(byte) 4&(byte) $f +(byte*) main::toD0181_screen + +zp ZP_WORD:2 [ main::clear_char#5 main::clear_char#1 ] +zp ZP_BYTE:4 [ init_screen::y#4 init_screen::y#1 ] +reg byte x [ init_screen::x#2 init_screen::x#1 ] +zp ZP_WORD:5 [ init_screen::screen#2 init_screen::screen#4 init_screen::screen#1 ] +zp ZP_WORD:7 [ atan2_16::yi#3 atan2_16::yi#7 atan2_16::yi#0 atan2_16::yi#11 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] +zp ZP_WORD:9 [ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] +zp ZP_BYTE:11 [ atan2_16::i#2 atan2_16::i#1 ] +zp ZP_WORD:12 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_screen::angle_w#0 init_screen::$7 ] +zp ZP_WORD:14 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +zp ZP_BYTE:16 [ init_font_hex::c#6 init_font_hex::c#1 ] +zp ZP_WORD:17 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +zp ZP_WORD:19 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +zp ZP_BYTE:21 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] +zp ZP_BYTE:22 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +zp ZP_WORD:23 [ init_screen::xw#0 atan2_16::x#0 ] +zp ZP_WORD:25 [ init_screen::yw#0 atan2_16::y#0 ] +reg byte a [ init_screen::ang_w#0 ] +zp ZP_WORD:27 [ atan2_16::xd#0 ] +zp ZP_WORD:29 [ atan2_16::yd#0 ] +reg byte a [ atan2_16::$24 ] +reg byte a [ atan2_16::$23 ] +zp ZP_BYTE:31 [ init_font_hex::$0 ] +reg byte a [ init_font_hex::$1 ] +reg byte a [ init_font_hex::$2 ] +reg byte y [ init_font_hex::idx#3 ]