From 647775223c929696c3f91f591f609cb905e1ffb7 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Wed, 3 Jul 2019 22:22:25 +0200 Subject: [PATCH] Added time.kc C standard library compatible. Added cycle counting to a few tests. --- src/main/kc/stdlib/time.kc | 31 + .../dk/camelot64/kickc/test/TestPrograms.java | 5 + src/test/kc/cia-timer-cyclecount.kc | 20 + src/test/kc/cia-timer-simple.kc | 16 +- src/test/kc/screen-center-angle.kc | 9 + src/test/ref/cia-timer-cyclecount.asm | 169 + src/test/ref/cia-timer-cyclecount.cfg | 94 + src/test/ref/cia-timer-cyclecount.log | 1811 ++++++++ src/test/ref/cia-timer-cyclecount.sym | 84 + src/test/ref/cia-timer-simple.asm | 76 +- src/test/ref/cia-timer-simple.cfg | 95 +- src/test/ref/cia-timer-simple.log | 1086 +++-- src/test/ref/cia-timer-simple.sym | 12 +- src/test/ref/screen-center-angle.asm | 220 +- src/test/ref/screen-center-angle.cfg | 320 +- src/test/ref/screen-center-angle.log | 3890 ++++++++++++----- src/test/ref/screen-center-angle.sym | 238 +- 17 files changed, 6382 insertions(+), 1794 deletions(-) create mode 100644 src/main/kc/stdlib/time.kc create mode 100644 src/test/kc/cia-timer-cyclecount.kc create mode 100644 src/test/ref/cia-timer-cyclecount.asm create mode 100644 src/test/ref/cia-timer-cyclecount.cfg create mode 100644 src/test/ref/cia-timer-cyclecount.log create mode 100644 src/test/ref/cia-timer-cyclecount.sym diff --git a/src/main/kc/stdlib/time.kc b/src/main/kc/stdlib/time.kc new file mode 100644 index 000000000..ffa49366c --- /dev/null +++ b/src/main/kc/stdlib/time.kc @@ -0,0 +1,31 @@ +// Implementation of library functions found in C standard library time.h + +import "c64" + +// Type suitable for storing the processor time. +typedef unsigned long clock_t ; + +// Clock cycles per second (on a C64 PAL) +const unsigned long CLOCKS_PER_SEC = 19656*60; + +// Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. +// To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. +const unsigned long CLOCKS_PER_INIT = 0x12; + +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock_t clock(void) { + return 0xffffffff - *CIA2_TIMER_AB; +} + +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +void clock_start(void) { + // Setup CIA#2 timer A to count (down) CPU cycles + *CIA2_TIMER_A_CONTROL = CIA_TIMER_CONTROL_STOP | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_A_COUNT_CYCLES; + *CIA2_TIMER_B_CONTROL = CIA_TIMER_CONTROL_STOP | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A; + *CIA2_TIMER_AB = 0xffffffff; + *CIA2_TIMER_B_CONTROL = CIA_TIMER_CONTROL_START | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A; + *CIA2_TIMER_A_CONTROL = CIA_TIMER_CONTROL_START | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_A_COUNT_CYCLES; +} + diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 573545c68..8010ab0fb 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -35,6 +35,11 @@ public class TestPrograms { public TestPrograms() { } + @Test + public void testCiaTimerCyclecount() throws IOException, URISyntaxException { + compileAndCompare("cia-timer-cyclecount"); + } + @Test public void testCiaTimerSimple() throws IOException, URISyntaxException { compileAndCompare("cia-timer-simple"); diff --git a/src/test/kc/cia-timer-cyclecount.kc b/src/test/kc/cia-timer-cyclecount.kc new file mode 100644 index 000000000..8e485abdb --- /dev/null +++ b/src/test/kc/cia-timer-cyclecount.kc @@ -0,0 +1,20 @@ +// Counting cycles using a CIA timer + +import "c64" +import "time" +import "print" + +const byte* SCREEN = 0x0400; + +void main() { + + while(true) { + // Reset & start the CIA#2 timer A+B + clock_start(); + asm { nop } + // Calculate the cycle count - 0x12 is the base usage of start/read + dword cyclecount = clock()-CLOCKS_PER_INIT; + // Print cycle count + print_dword_at(cyclecount, SCREEN); + } +} diff --git a/src/test/kc/cia-timer-simple.kc b/src/test/kc/cia-timer-simple.kc index dc4813267..d4b0bc952 100644 --- a/src/test/kc/cia-timer-simple.kc +++ b/src/test/kc/cia-timer-simple.kc @@ -1,25 +1,17 @@ // Setup and run a simple CIA-timer import "c64" +import "time" import "print" const byte* SCREEN = 0x0400; void main() { - asm { sei } - - // Timer AB initial value - dword TIMER_INIT = 0xffffffff; - // Setup CIA#2 timer A to count (down) CPU cycles - *CIA2_TIMER_A_CONTROL = CIA_TIMER_CONTROL_STOP | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_A_COUNT_CYCLES; - *CIA2_TIMER_B_CONTROL = CIA_TIMER_CONTROL_STOP | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A; - *CIA2_TIMER_AB = TIMER_INIT; - *CIA2_TIMER_B_CONTROL = CIA_TIMER_CONTROL_START | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A; - *CIA2_TIMER_A_CONTROL = CIA_TIMER_CONTROL_START | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_A_COUNT_CYCLES; - + // Reset & start the CIA#2 timer A+B + clock_start(); // Continously print cycle count since timer start while(true) { - print_dword_at(TIMER_INIT-*CIA2_TIMER_AB, SCREEN); + print_dword_at(clock(), SCREEN); } } diff --git a/src/test/kc/screen-center-angle.kc b/src/test/kc/screen-center-angle.kc index 741000315..f0c7632a5 100644 --- a/src/test/kc/screen-center-angle.kc +++ b/src/test/kc/screen-center-angle.kc @@ -4,6 +4,8 @@ import "stdlib" import "c64" import "font-hex" import "atan2" +import "time" +import "print" const byte* CHARSET = 0x2000; const byte* SCREEN = 0x2800; @@ -11,7 +13,14 @@ const byte* SCREEN = 0x2800; void main() { init_font_hex(CHARSET); *D018 = toD018(SCREEN, CHARSET); + + clock_start(); init_angle_screen(SCREEN); + clock_t cyclecount = clock()-CLOCKS_PER_INIT; + byte* BASE_SCREEN = 0x0400; + byte* BASE_CHARSET = 0x1000; + print_dword_at(cyclecount, BASE_SCREEN); + *D018 = toD018(BASE_SCREEN, BASE_CHARSET); } // Populates 1000 bytes (a screen) with values representing the angle to the center. diff --git a/src/test/ref/cia-timer-cyclecount.asm b/src/test/ref/cia-timer-cyclecount.asm new file mode 100644 index 000000000..9b7ecfba0 --- /dev/null +++ b/src/test/ref/cia-timer-cyclecount.asm @@ -0,0 +1,169 @@ +// Counting cycles using a CIA timer +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + // CIA #2 Timer A+B Value (32-bit) + .label CIA2_TIMER_AB = $dd04 + // CIA #2 Timer A Control Register + .label CIA2_TIMER_A_CONTROL = $dd0e + // CIA #2 Timer B Control Register + .label CIA2_TIMER_B_CONTROL = $dd0f + // Timer Control - Start/stop timer (0:stop, 1: start) + .const CIA_TIMER_CONTROL_START = 1 + // Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT) + .const CIA_TIMER_CONTROL_CONTINUOUS = 0 + // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) + .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 + // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. + // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. + .const CLOCKS_PER_INIT = $12 + .label SCREEN = $400 +main: { + .label _1 = 9 + .label cyclecount = 9 + b1: + jsr clock_start + nop + jsr clock + lda cyclecount + sec + sbc #CLOCKS_PER_INIT + sta cyclecount+1 + lda cyclecount+2 + sbc #>$10 + sta cyclecount+2 + lda cyclecount+3 + sbc #>CLOCKS_PER_INIT>>$10 + sta cyclecount+3 + jsr print_dword_at + jmp b1 +} +// Print a dword as HEX at a specific position +// print_dword_at(dword zeropage(9) dw) +print_dword_at: { + .label dw = 9 + lda dw+2 + sta print_word_at.w + lda dw+3 + sta print_word_at.w+1 + lda #SCREEN + sta print_word_at.at+1 + jsr print_word_at + lda dw + sta print_word_at.w + lda dw+1 + sta print_word_at.w+1 + lda #SCREEN+4 + sta print_word_at.at+1 + jsr print_word_at + rts +} +// Print a word as HEX at a specific position +// print_word_at(word zeropage(2) w, byte* zeropage(4) at) +print_word_at: { + .label w = 2 + .label at = 4 + lda w+1 + sta print_byte_at.b + jsr print_byte_at + lda w + sta print_byte_at.b + lda print_byte_at.at + clc + adc #2 + sta print_byte_at.at + bcc !+ + inc print_byte_at.at+1 + !: + jsr print_byte_at + rts +} +// Print a byte as HEX at a specific position +// print_byte_at(byte zeropage(6) b, byte* zeropage(4) at) +print_byte_at: { + .label b = 6 + .label at = 4 + lda b + lsr + lsr + lsr + lsr + tay + ldx print_hextab,y + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + jsr print_char_at + lda #$f + and b + tay + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + ldx print_hextab,y + jsr print_char_at + rts +} +// Print a single char +// print_char_at(byte register(X) ch, byte* zeropage(7) at) +print_char_at: { + .label at = 7 + txa + ldy #0 + sta (at),y + rts +} +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = 9 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + rts +} +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + rts +} + print_hextab: .text "0123456789abcdef" diff --git a/src/test/ref/cia-timer-cyclecount.cfg b/src/test/ref/cia-timer-cyclecount.cfg new file mode 100644 index 000000000..509745bf5 --- /dev/null +++ b/src/test/ref/cia-timer-cyclecount.cfg @@ -0,0 +1,94 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@3 + [5] phi() + [6] call clock_start + to:main::@2 +main::@2: scope:[main] from main::@1 + asm { nop } + [8] call clock + [9] (dword) clock::return#2 ← (dword) clock::return#0 + to:main::@3 +main::@3: scope:[main] from main::@2 + [10] (dword~) main::$1 ← (dword) clock::return#2 + [11] (dword) main::cyclecount#0 ← (dword~) main::$1 - (const dword) CLOCKS_PER_INIT#0 + [12] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + [13] call print_dword_at + to:main::@1 +print_dword_at: scope:[print_dword_at] from main::@3 + [14] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 + [15] call print_word_at + to:print_dword_at::@1 +print_dword_at::@1: scope:[print_dword_at] from print_dword_at + [16] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 + [17] call print_word_at + to:print_dword_at::@return +print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@1 + [18] return + to:@return +print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 + [19] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const byte*) SCREEN#0 print_dword_at::@1/(const byte*) SCREEN#0+(byte) 4 ) + [19] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) + [20] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 + [21] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + [22] call print_byte_at + to:print_word_at::@1 +print_word_at::@1: scope:[print_word_at] from print_word_at + [23] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 + [24] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 + [25] call print_byte_at + to:print_word_at::@return +print_word_at::@return: scope:[print_word_at] from print_word_at::@1 + [26] return + to:@return +print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 + [27] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) + [27] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) + [28] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 + [29] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + [30] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 + [31] call print_char_at + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + [32] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f + [33] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 + [34] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) + [35] call print_char_at + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1 + [36] return + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 + [37] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) + [37] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) + [38] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + [39] return + to:@return +clock: scope:[clock] from main::@2 + [40] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) + to:clock::@return +clock::@return: scope:[clock] from clock + [41] return + to:@return +clock_start: scope:[clock_start] from main::@1 + [42] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + [43] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [44] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff + [45] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [46] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + [47] return + to:@return diff --git a/src/test/ref/cia-timer-cyclecount.log b/src/test/ref/cia-timer-cyclecount.log new file mode 100644 index 000000000..6c7d82db1 --- /dev/null +++ b/src/test/ref/cia-timer-cyclecount.log @@ -0,0 +1,1811 @@ +Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx +Culled Empty Block (label) @1 +Culled Empty Block (label) @2 +Culled Empty Block (label) @3 +Culled Empty Block (label) clock::@1 +Culled Empty Block (label) @5 +Culled Empty Block (label) @6 +Culled Empty Block (label) @7 +Culled Empty Block (label) @8 +Culled Empty Block (label) @9 +Culled Empty Block (label) @10 +Culled Empty Block (label) @11 +Culled Empty Block (label) @12 +Culled Empty Block (label) @13 +Culled Empty Block (label) @14 +Culled Empty Block (label) @15 +Culled Empty Block (label) @16 +Culled Empty Block (label) @17 +Culled Empty Block (label) @18 +Culled Empty Block (label) @19 +Culled Empty Block (label) @21 +Culled Empty Block (label) @22 +Culled Empty Block (label) @23 +Culled Empty Block (label) @24 +Culled Empty Block (label) @25 +Culled Empty Block (label) @26 +Culled Empty Block (label) main::@4 +Culled Empty Block (label) main::@3 +Culled Empty Block (label) main::@5 +Culled Empty Block (label) main::@6 + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (dword*) CIA2_TIMER_AB#0 ← ((dword*)) (number) $dd04 + (byte*) CIA2_TIMER_A_CONTROL#0 ← ((byte*)) (number) $dd0e + (byte*) CIA2_TIMER_B_CONTROL#0 ← ((byte*)) (number) $dd0f + (byte) CIA_TIMER_CONTROL_STOP#0 ← (number) 0 + (byte) CIA_TIMER_CONTROL_START#0 ← (number) 1 + (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (number) 0 + (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (number) 0 + (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (number) $40 + to:@4 +@4: scope:[] from @begin + (dword) CLOCKS_PER_INIT#0 ← (number) $12 + to:@20 +clock: scope:[clock] from main::@7 + (number~) clock::$0 ← (number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) + (dword) clock::return#0 ← (number~) clock::$0 + to:clock::@return +clock::@return: scope:[clock] from clock + (dword) clock::return#3 ← phi( clock/(dword) clock::return#0 ) + (dword) clock::return#1 ← (dword) clock::return#3 + return + to:@return +clock_start: scope:[clock_start] from main::@2 + (byte~) clock_start::$0 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$1 ← (byte~) clock_start::$0 | (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 + *((byte*) CIA2_TIMER_A_CONTROL#0) ← (byte~) clock_start::$1 + (byte~) clock_start::$2 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$3 ← (byte~) clock_start::$2 | (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + *((byte*) CIA2_TIMER_B_CONTROL#0) ← (byte~) clock_start::$3 + *((dword*) CIA2_TIMER_AB#0) ← (number) $ffffffff + (byte~) clock_start::$4 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$5 ← (byte~) clock_start::$4 | (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + *((byte*) CIA2_TIMER_B_CONTROL#0) ← (byte~) clock_start::$5 + (byte~) clock_start::$6 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$7 ← (byte~) clock_start::$6 | (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 + *((byte*) CIA2_TIMER_A_CONTROL#0) ← (byte~) clock_start::$7 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + return + to:@return +print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 + (byte*) print_word_at::at#2 ← phi( print_dword_at/(byte*) print_word_at::at#0 print_dword_at::@1/(byte*) print_word_at::at#1 ) + (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) + (byte~) print_word_at::$0 ← > (word) print_word_at::w#2 + (byte) print_byte_at::b#0 ← (byte~) print_word_at::$0 + (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + call print_byte_at + to:print_word_at::@1 +print_word_at::@1: scope:[print_word_at] from print_word_at + (byte*) print_word_at::at#3 ← phi( print_word_at/(byte*) print_word_at::at#2 ) + (word) print_word_at::w#3 ← phi( print_word_at/(word) print_word_at::w#2 ) + (byte~) print_word_at::$2 ← < (word) print_word_at::w#3 + (byte*~) print_word_at::$3 ← (byte*) print_word_at::at#3 + (number) 2 + (byte) print_byte_at::b#1 ← (byte~) print_word_at::$2 + (byte*) print_byte_at::at#1 ← (byte*~) print_word_at::$3 + call print_byte_at + to:print_word_at::@2 +print_word_at::@2: scope:[print_word_at] from print_word_at::@1 + to:print_word_at::@return +print_word_at::@return: scope:[print_word_at] from print_word_at::@2 + return + to:@return +print_dword_at: scope:[print_dword_at] from main::@8 + (byte*) print_dword_at::at#1 ← phi( main::@8/(byte*) print_dword_at::at#0 ) + (dword) print_dword_at::dw#1 ← phi( main::@8/(dword) print_dword_at::dw#0 ) + (word~) print_dword_at::$0 ← > (dword) print_dword_at::dw#1 + (word) print_word_at::w#0 ← (word~) print_dword_at::$0 + (byte*) print_word_at::at#0 ← (byte*) print_dword_at::at#1 + call print_word_at + to:print_dword_at::@1 +print_dword_at::@1: scope:[print_dword_at] from print_dword_at + (byte*) print_dword_at::at#2 ← phi( print_dword_at/(byte*) print_dword_at::at#1 ) + (dword) print_dword_at::dw#2 ← phi( print_dword_at/(dword) print_dword_at::dw#1 ) + (word~) print_dword_at::$2 ← < (dword) print_dword_at::dw#2 + (byte*~) print_dword_at::$3 ← (byte*) print_dword_at::at#2 + (number) 4 + (word) print_word_at::w#1 ← (word~) print_dword_at::$2 + (byte*) print_word_at::at#1 ← (byte*~) print_dword_at::$3 + call print_word_at + to:print_dword_at::@2 +print_dword_at::@2: scope:[print_dword_at] from print_dword_at::@1 + to:print_dword_at::@return +print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@2 + return + to:@return +@20: scope:[] from @4 + (byte[]) print_hextab#0 ← (const string) $0 + to:@27 +print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 + (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) + (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) + (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (number) 4 + (byte) print_char_at::ch#0 ← *((byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 + call print_char_at + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + (byte*) print_byte_at::at#3 ← phi( print_byte_at/(byte*) print_byte_at::at#2 ) + (byte) print_byte_at::b#3 ← phi( print_byte_at/(byte) print_byte_at::b#2 ) + (number~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (number) $f + (byte*~) print_byte_at::$3 ← (byte*) print_byte_at::at#3 + (number) 1 + (byte) print_char_at::ch#1 ← *((byte[]) print_hextab#0 + (number~) print_byte_at::$2) + (byte*) print_char_at::at#1 ← (byte*~) print_byte_at::$3 + call print_char_at + to:print_byte_at::@2 +print_byte_at::@2: scope:[print_byte_at] from print_byte_at::@1 + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@2 + return + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 + (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) + (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) + *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + return + to:@return +@27: scope:[] from @20 + (byte*) SCREEN#0 ← ((byte*)) (number) $400 + to:@28 +main: scope:[main] from @28 + to:main::@1 +main::@1: scope:[main] from main main::@9 + if(true) goto main::@2 + to:main::@return +main::@2: scope:[main] from main::@1 + call clock_start + to:main::@7 +main::@7: scope:[main] from main::@2 + asm { nop } + call clock + (dword) clock::return#2 ← (dword) clock::return#1 + to:main::@8 +main::@8: scope:[main] from main::@7 + (dword) clock::return#4 ← phi( main::@7/(dword) clock::return#2 ) + (dword~) main::$1 ← (dword) clock::return#4 + (dword~) main::$2 ← (dword~) main::$1 - (dword) CLOCKS_PER_INIT#0 + (dword) main::cyclecount#0 ← (dword~) main::$2 + (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + (byte*) print_dword_at::at#0 ← (byte*) SCREEN#0 + call print_dword_at + to:main::@9 +main::@9: scope:[main] from main::@8 + to:main::@1 +main::@return: scope:[main] from main::@1 + return + to:@return +@28: scope:[] from @27 + call main + to:@29 +@29: scope:[] from @28 + to:@end +@end: scope:[] from @29 + +SYMBOL TABLE SSA +(const string) $0 = (string) "0123456789abcdef" +(label) @20 +(label) @27 +(label) @28 +(label) @29 +(label) @4 +(label) @begin +(label) @end +(dword*) CIA2_TIMER_AB +(dword*) CIA2_TIMER_AB#0 +(byte*) CIA2_TIMER_A_CONTROL +(byte*) CIA2_TIMER_A_CONTROL#0 +(byte*) CIA2_TIMER_B_CONTROL +(byte*) CIA2_TIMER_B_CONTROL#0 +(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES +(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 +(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A +(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +(byte) CIA_TIMER_CONTROL_CONTINUOUS +(byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +(byte) CIA_TIMER_CONTROL_START +(byte) CIA_TIMER_CONTROL_START#0 +(byte) CIA_TIMER_CONTROL_STOP +(byte) CIA_TIMER_CONTROL_STOP#0 +(dword) CLOCKS_PER_INIT +(dword) CLOCKS_PER_INIT#0 +(byte*) SCREEN +(byte*) SCREEN#0 +(dword()) clock() +(number~) clock::$0 +(label) clock::@return +(dword) clock::return +(dword) clock::return#0 +(dword) clock::return#1 +(dword) clock::return#2 +(dword) clock::return#3 +(dword) clock::return#4 +(void()) clock_start() +(byte~) clock_start::$0 +(byte~) clock_start::$1 +(byte~) clock_start::$2 +(byte~) clock_start::$3 +(byte~) clock_start::$4 +(byte~) clock_start::$5 +(byte~) clock_start::$6 +(byte~) clock_start::$7 +(label) clock_start::@return +(void()) main() +(dword~) main::$1 +(dword~) main::$2 +(label) main::@1 +(label) main::@2 +(label) main::@7 +(label) main::@8 +(label) main::@9 +(label) main::@return +(dword) main::cyclecount +(dword) main::cyclecount#0 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 +(number~) print_byte_at::$2 +(byte*~) print_byte_at::$3 +(label) print_byte_at::@1 +(label) print_byte_at::@2 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 +(byte*) print_byte_at::at#1 +(byte*) print_byte_at::at#2 +(byte*) print_byte_at::at#3 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 +(byte) print_byte_at::b#1 +(byte) print_byte_at::b#2 +(byte) print_byte_at::b#3 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 +(byte*) print_char_at::at#1 +(byte*) print_char_at::at#2 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 +(byte) print_char_at::ch#1 +(byte) print_char_at::ch#2 +(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at) +(word~) print_dword_at::$0 +(word~) print_dword_at::$2 +(byte*~) print_dword_at::$3 +(label) print_dword_at::@1 +(label) print_dword_at::@2 +(label) print_dword_at::@return +(byte*) print_dword_at::at +(byte*) print_dword_at::at#0 +(byte*) print_dword_at::at#1 +(byte*) print_dword_at::at#2 +(dword) print_dword_at::dw +(dword) print_dword_at::dw#0 +(dword) print_dword_at::dw#1 +(dword) print_dword_at::dw#2 +(byte[]) print_hextab +(byte[]) print_hextab#0 +(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at) +(byte~) print_word_at::$0 +(byte~) print_word_at::$2 +(byte*~) print_word_at::$3 +(label) print_word_at::@1 +(label) print_word_at::@2 +(label) print_word_at::@return +(byte*) print_word_at::at +(byte*) print_word_at::at#0 +(byte*) print_word_at::at#1 +(byte*) print_word_at::at#2 +(byte*) print_word_at::at#3 +(word) print_word_at::w +(word) print_word_at::w#0 +(word) print_word_at::w#1 +(word) print_word_at::w#2 +(word) print_word_at::w#3 + +Adding number conversion cast (unumber) 0 in (byte) CIA_TIMER_CONTROL_STOP#0 ← (number) 0 +Adding number conversion cast (unumber) 1 in (byte) CIA_TIMER_CONTROL_START#0 ← (number) 1 +Adding number conversion cast (unumber) 0 in (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (number) 0 +Adding number conversion cast (unumber) 0 in (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (number) 0 +Adding number conversion cast (unumber) $40 in (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (number) $40 +Adding number conversion cast (unumber) $12 in (dword) CLOCKS_PER_INIT#0 ← (number) $12 +Adding number conversion cast (unumber) $ffffffff in (number~) clock::$0 ← (number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) +Adding number conversion cast (unumber) clock::$0 in (number~) clock::$0 ← (unumber)(number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) +Adding number conversion cast (unumber) $ffffffff in *((dword*) CIA2_TIMER_AB#0) ← (number) $ffffffff +Adding number conversion cast (unumber) 2 in (byte*~) print_word_at::$3 ← (byte*) print_word_at::at#3 + (number) 2 +Adding number conversion cast (unumber) 4 in (byte*~) print_dword_at::$3 ← (byte*) print_dword_at::at#2 + (number) 4 +Adding number conversion cast (unumber) 4 in (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (number) 4 +Adding number conversion cast (unumber) $f in (number~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (number) $f +Adding number conversion cast (unumber) print_byte_at::$2 in (number~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (unumber)(number) $f +Adding number conversion cast (unumber) 1 in (byte*~) print_byte_at::$3 ← (byte*) print_byte_at::at#3 + (number) 1 +Successful SSA optimization PassNAddNumberTypeConversions +Inlining cast (dword*) CIA2_TIMER_AB#0 ← (dword*)(number) $dd04 +Inlining cast (byte*) CIA2_TIMER_A_CONTROL#0 ← (byte*)(number) $dd0e +Inlining cast (byte*) CIA2_TIMER_B_CONTROL#0 ← (byte*)(number) $dd0f +Inlining cast (byte) CIA_TIMER_CONTROL_STOP#0 ← (unumber)(number) 0 +Inlining cast (byte) CIA_TIMER_CONTROL_START#0 ← (unumber)(number) 1 +Inlining cast (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (unumber)(number) 0 +Inlining cast (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (unumber)(number) 0 +Inlining cast (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (unumber)(number) $40 +Inlining cast (dword) CLOCKS_PER_INIT#0 ← (unumber)(number) $12 +Inlining cast *((dword*) CIA2_TIMER_AB#0) ← (unumber)(number) $ffffffff +Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400 +Successful SSA optimization Pass2InlineCast +Simplifying constant pointer cast (dword*) 56580 +Simplifying constant pointer cast (byte*) 56590 +Simplifying constant pointer cast (byte*) 56591 +Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast $40 +Simplifying constant integer cast $12 +Simplifying constant integer cast $ffffffff +Simplifying constant integer cast $ffffffff +Simplifying constant integer cast 2 +Simplifying constant integer cast 4 +Simplifying constant integer cast 4 +Simplifying constant integer cast $f +Simplifying constant integer cast 1 +Simplifying constant pointer cast (byte*) 1024 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 1 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $40 +Finalized unsigned number type (byte) $12 +Finalized unsigned number type (dword) $ffffffff +Finalized unsigned number type (dword) $ffffffff +Finalized unsigned number type (byte) 2 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) $f +Finalized unsigned number type (byte) 1 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Inferred type updated to dword in (unumber~) clock::$0 ← (dword) $ffffffff - *((dword*) CIA2_TIMER_AB#0) +Inferred type updated to byte in (unumber~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (byte) $f +Alias (dword) clock::return#0 = (dword~) clock::$0 (dword) clock::return#3 (dword) clock::return#1 +Alias (byte) print_byte_at::b#0 = (byte~) print_word_at::$0 +Alias (word) print_word_at::w#2 = (word) print_word_at::w#3 +Alias (byte*) print_word_at::at#2 = (byte*) print_word_at::at#3 +Alias (byte) print_byte_at::b#1 = (byte~) print_word_at::$2 +Alias (byte*) print_byte_at::at#1 = (byte*~) print_word_at::$3 +Alias (word) print_word_at::w#0 = (word~) print_dword_at::$0 +Alias (dword) print_dword_at::dw#1 = (dword) print_dword_at::dw#2 +Alias (byte*) print_dword_at::at#1 = (byte*) print_dword_at::at#2 +Alias (word) print_word_at::w#1 = (word~) print_dword_at::$2 +Alias (byte*) print_word_at::at#1 = (byte*~) print_dword_at::$3 +Alias (byte) print_byte_at::b#2 = (byte) print_byte_at::b#3 +Alias (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#3 +Alias (byte*) print_char_at::at#1 = (byte*~) print_byte_at::$3 +Alias (dword) clock::return#2 = (dword) clock::return#4 +Alias (dword) main::cyclecount#0 = (dword~) main::$2 +Successful SSA optimization Pass2AliasElimination +Identical Phi Values (dword) print_dword_at::dw#1 (dword) print_dword_at::dw#0 +Identical Phi Values (byte*) print_dword_at::at#1 (byte*) print_dword_at::at#0 +Successful SSA optimization Pass2IdenticalPhiElimination +Identified duplicate assignment right side [17] (byte~) clock_start::$2 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Identified duplicate assignment right side [24] (byte~) clock_start::$6 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Successful SSA optimization Pass2DuplicateRValueIdentification +Constant (const dword*) CIA2_TIMER_AB#0 = (dword*) 56580 +Constant (const byte*) CIA2_TIMER_A_CONTROL#0 = (byte*) 56590 +Constant (const byte*) CIA2_TIMER_B_CONTROL#0 = (byte*) 56591 +Constant (const byte) CIA_TIMER_CONTROL_STOP#0 = 0 +Constant (const byte) CIA_TIMER_CONTROL_START#0 = 1 +Constant (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 = 0 +Constant (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 = 0 +Constant (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 = $40 +Constant (const dword) CLOCKS_PER_INIT#0 = $12 +Constant (const byte[]) print_hextab#0 = $0 +Constant (const byte*) SCREEN#0 = (byte*) 1024 +Successful SSA optimization Pass2ConstantIdentification +Constant (const byte*) print_dword_at::at#0 = SCREEN#0 +Successful SSA optimization Pass2ConstantIdentification +Constant (const byte*) print_word_at::at#0 = print_dword_at::at#0 +Successful SSA optimization Pass2ConstantIdentification +if() condition always true - replacing block destination [69] if(true) goto main::@2 +Successful SSA optimization Pass2ConstantIfs +Simplifying expression containing zero CIA_TIMER_CONTROL_CONTINUOUS#0 in [14] (byte~) clock_start::$0 ← (const byte) CIA_TIMER_CONTROL_STOP#0 | (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Simplifying expression containing zero clock_start::$0 in [15] (byte~) clock_start::$1 ← (byte~) clock_start::$0 | (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 +Simplifying expression containing zero CIA_TIMER_CONTROL_START#0 in [21] (byte~) clock_start::$4 ← (const byte) CIA_TIMER_CONTROL_START#0 | (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Simplifying expression containing zero clock_start::$6 in [25] (byte~) clock_start::$7 ← (byte~) clock_start::$6 | (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 +Successful SSA optimization PassNSimplifyExpressionWithZero +Eliminating unused constant (const byte) CIA_TIMER_CONTROL_STOP#0 +Eliminating unused constant (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 +Successful SSA optimization PassNEliminateUnusedVars +Removing unused block main::@return +Successful SSA optimization Pass2EliminateUnusedBlocks +Alias (byte~) clock_start::$1 = (byte~) clock_start::$0 (byte~) clock_start::$2 +Alias (byte~) clock_start::$6 = (byte~) clock_start::$4 (byte~) clock_start::$7 +Successful SSA optimization Pass2AliasElimination +Constant right-side identified [27] (byte*) print_word_at::at#1 ← (const byte*) print_dword_at::at#0 + (byte) 4 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) clock_start::$1 = CIA_TIMER_CONTROL_CONTINUOUS#0 +Constant (const byte) clock_start::$6 = CIA_TIMER_CONTROL_START#0 +Constant (const byte*) print_word_at::at#1 = print_dword_at::at#0+4 +Successful SSA optimization Pass2ConstantIdentification +Simplifying expression containing zero CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 in [6] (byte~) clock_start::$3 ← (const byte) clock_start::$1 | (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Successful SSA optimization PassNSimplifyExpressionWithZero +Constant right-side identified [6] (byte~) clock_start::$5 ← (const byte) clock_start::$6 | (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) clock_start::$3 = CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Constant (const byte) clock_start::$5 = clock_start::$6|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Successful SSA optimization Pass2ConstantIdentification +Inlining constant with var siblings (const byte*) print_word_at::at#0 +Inlining constant with var siblings (const byte*) print_word_at::at#1 +Constant inlined clock_start::$1 = (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Constant inlined print_dword_at::at#0 = (const byte*) SCREEN#0 +Constant inlined print_word_at::at#1 = (const byte*) SCREEN#0+(byte) 4 +Constant inlined print_word_at::at#0 = (const byte*) SCREEN#0 +Constant inlined $0 = (const byte[]) print_hextab#0 +Constant inlined clock_start::$5 = (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Constant inlined clock_start::$6 = (const byte) CIA_TIMER_CONTROL_START#0 +Constant inlined clock_start::$3 = (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Successful SSA optimization Pass2ConstantInlining +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @4 +Adding NOP phi() at start of @20 +Adding NOP phi() at start of @27 +Adding NOP phi() at start of @28 +Adding NOP phi() at start of @29 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@9 +Adding NOP phi() at start of print_dword_at::@2 +Adding NOP phi() at start of print_word_at::@2 +Adding NOP phi() at start of print_byte_at::@2 +CALL GRAPH +Calls in [] to main:5 +Calls in [main] to clock_start:11 clock:13 print_dword_at:18 +Calls in [print_dword_at] to print_word_at:22 print_word_at:25 +Calls in [print_word_at] to print_byte_at:33 print_byte_at:38 +Calls in [print_byte_at] to print_char_at:47 print_char_at:53 + +Created 6 initial phi equivalence classes +Coalesced [21] print_word_at::w#4 ← print_word_at::w#0 +Coalesced [24] print_word_at::w#5 ← print_word_at::w#1 +Coalesced [31] print_byte_at::b#4 ← print_byte_at::b#0 +Coalesced [32] print_byte_at::at#4 ← print_byte_at::at#0 +Coalesced [36] print_byte_at::b#5 ← print_byte_at::b#1 +Coalesced [37] print_byte_at::at#5 ← print_byte_at::at#1 +Coalesced [45] print_char_at::ch#3 ← print_char_at::ch#0 +Coalesced [46] print_char_at::at#3 ← print_char_at::at#0 +Coalesced [51] print_char_at::ch#4 ← print_char_at::ch#1 +Coalesced [52] print_char_at::at#4 ← print_char_at::at#1 +Coalesced down to 6 phi equivalence classes +Culled Empty Block (label) @4 +Culled Empty Block (label) @20 +Culled Empty Block (label) @27 +Culled Empty Block (label) @29 +Culled Empty Block (label) main::@1 +Culled Empty Block (label) main::@9 +Culled Empty Block (label) print_dword_at::@2 +Culled Empty Block (label) print_word_at::@2 +Culled Empty Block (label) print_byte_at::@2 +Renumbering block @28 to @1 +Renumbering block main::@2 to main::@1 +Renumbering block main::@7 to main::@2 +Renumbering block main::@8 to main::@3 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@3 + [5] phi() + [6] call clock_start + to:main::@2 +main::@2: scope:[main] from main::@1 + asm { nop } + [8] call clock + [9] (dword) clock::return#2 ← (dword) clock::return#0 + to:main::@3 +main::@3: scope:[main] from main::@2 + [10] (dword~) main::$1 ← (dword) clock::return#2 + [11] (dword) main::cyclecount#0 ← (dword~) main::$1 - (const dword) CLOCKS_PER_INIT#0 + [12] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + [13] call print_dword_at + to:main::@1 +print_dword_at: scope:[print_dword_at] from main::@3 + [14] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 + [15] call print_word_at + to:print_dword_at::@1 +print_dword_at::@1: scope:[print_dword_at] from print_dword_at + [16] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 + [17] call print_word_at + to:print_dword_at::@return +print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@1 + [18] return + to:@return +print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 + [19] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const byte*) SCREEN#0 print_dword_at::@1/(const byte*) SCREEN#0+(byte) 4 ) + [19] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) + [20] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 + [21] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + [22] call print_byte_at + to:print_word_at::@1 +print_word_at::@1: scope:[print_word_at] from print_word_at + [23] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 + [24] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 + [25] call print_byte_at + to:print_word_at::@return +print_word_at::@return: scope:[print_word_at] from print_word_at::@1 + [26] return + to:@return +print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 + [27] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) + [27] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) + [28] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 + [29] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + [30] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 + [31] call print_char_at + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + [32] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f + [33] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 + [34] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) + [35] call print_char_at + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1 + [36] return + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 + [37] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) + [37] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) + [38] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + [39] return + to:@return +clock: scope:[clock] from main::@2 + [40] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) + to:clock::@return +clock::@return: scope:[clock] from clock + [41] return + to:@return +clock_start: scope:[clock_start] from main::@1 + [42] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + [43] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [44] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff + [45] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [46] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + [47] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(dword*) CIA2_TIMER_AB +(byte*) CIA2_TIMER_A_CONTROL +(byte*) CIA2_TIMER_B_CONTROL +(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES +(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A +(byte) CIA_TIMER_CONTROL_CONTINUOUS +(byte) CIA_TIMER_CONTROL_START +(byte) CIA_TIMER_CONTROL_STOP +(dword) CLOCKS_PER_INIT +(byte*) SCREEN +(dword()) clock() +(dword) clock::return +(dword) clock::return#0 4.333333333333333 +(dword) clock::return#2 22.0 +(void()) clock_start() +(void()) main() +(dword~) main::$1 22.0 +(dword) main::cyclecount +(dword) main::cyclecount#0 22.0 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 4.0 +(byte~) print_byte_at::$2 2.0 +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 4.0 +(byte*) print_byte_at::at#1 4.0 +(byte*) print_byte_at::at#2 1.3333333333333333 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 2.0 +(byte) print_byte_at::b#1 2.0 +(byte) print_byte_at::b#2 1.6 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(byte*) print_char_at::at +(byte*) print_char_at::at#0 4.0 +(byte*) print_char_at::at#1 2.0 +(byte*) print_char_at::at#2 6.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 2.0 +(byte) print_char_at::ch#1 4.0 +(byte) print_char_at::ch#2 6.0 +(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at) +(byte*) print_dword_at::at +(dword) print_dword_at::dw +(dword) print_dword_at::dw#0 5.0 +(byte[]) print_hextab +(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at) +(byte*) print_word_at::at +(byte*) print_word_at::at#2 0.8 +(word) print_word_at::w +(word) print_word_at::w#0 4.0 +(word) print_word_at::w#1 4.0 +(word) print_word_at::w#2 2.0 + +Initial phi equivalence classes +[ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +[ print_word_at::at#2 ] +[ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +[ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +[ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +[ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Added variable clock::return#2 to zero page equivalence class [ clock::return#2 ] +Added variable main::$1 to zero page equivalence class [ main::$1 ] +Added variable main::cyclecount#0 to zero page equivalence class [ main::cyclecount#0 ] +Added variable print_dword_at::dw#0 to zero page equivalence class [ print_dword_at::dw#0 ] +Added variable print_byte_at::$0 to zero page equivalence class [ print_byte_at::$0 ] +Added variable print_byte_at::$2 to zero page equivalence class [ print_byte_at::$2 ] +Added variable clock::return#0 to zero page equivalence class [ clock::return#0 ] +Complete equivalence classes +[ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +[ print_word_at::at#2 ] +[ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +[ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +[ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +[ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +[ clock::return#2 ] +[ main::$1 ] +[ main::cyclecount#0 ] +[ print_dword_at::dw#0 ] +[ print_byte_at::$0 ] +[ print_byte_at::$2 ] +[ clock::return#0 ] +Allocated zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +Allocated zp ZP_WORD:4 [ print_word_at::at#2 ] +Allocated zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Allocated zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +Allocated zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +Allocated zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Allocated zp ZP_DWORD:12 [ clock::return#2 ] +Allocated zp ZP_DWORD:16 [ main::$1 ] +Allocated zp ZP_DWORD:20 [ main::cyclecount#0 ] +Allocated zp ZP_DWORD:24 [ print_dword_at::dw#0 ] +Allocated zp ZP_BYTE:28 [ print_byte_at::$0 ] +Allocated zp ZP_BYTE:29 [ print_byte_at::$2 ] +Allocated zp ZP_DWORD:30 [ clock::return#0 ] + +INITIAL ASM +//SEG0 File Comments +// Counting cycles using a CIA timer +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + // CIA #2 Timer A+B Value (32-bit) + .label CIA2_TIMER_AB = $dd04 + // CIA #2 Timer A Control Register + .label CIA2_TIMER_A_CONTROL = $dd0e + // CIA #2 Timer B Control Register + .label CIA2_TIMER_B_CONTROL = $dd0f + // Timer Control - Start/stop timer (0:stop, 1: start) + .const CIA_TIMER_CONTROL_START = 1 + // Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT) + .const CIA_TIMER_CONTROL_CONTINUOUS = 0 + // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) + .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 + // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. + // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. + .const CLOCKS_PER_INIT = $12 + .label SCREEN = $400 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label _1 = $10 + .label cyclecount = $14 + //SEG11 [5] phi from main main::@3 to main::@1 [phi:main/main::@3->main::@1] + b1_from_main: + b1_from_b3: + jmp b1 + //SEG12 main::@1 + b1: + //SEG13 [6] call clock_start + jsr clock_start + jmp b2 + //SEG14 main::@2 + b2: + //SEG15 asm { nop } + nop + //SEG16 [8] call clock + jsr clock + //SEG17 [9] (dword) clock::return#2 ← (dword) clock::return#0 -- vduz1=vduz2 + lda clock.return + sta clock.return_2 + lda clock.return+1 + sta clock.return_2+1 + lda clock.return+2 + sta clock.return_2+2 + lda clock.return+3 + sta clock.return_2+3 + jmp b3 + //SEG18 main::@3 + b3: + //SEG19 [10] (dword~) main::$1 ← (dword) clock::return#2 -- vduz1=vduz2 + lda clock.return_2 + sta _1 + lda clock.return_2+1 + sta _1+1 + lda clock.return_2+2 + sta _1+2 + lda clock.return_2+3 + sta _1+3 + //SEG20 [11] (dword) main::cyclecount#0 ← (dword~) main::$1 - (const dword) CLOCKS_PER_INIT#0 -- vduz1=vduz2_minus_vduc1 + lda _1 + sec + sbc #CLOCKS_PER_INIT + sta cyclecount+1 + lda _1+2 + sbc #>$10 + sta cyclecount+2 + lda _1+3 + sbc #>CLOCKS_PER_INIT>>$10 + sta cyclecount+3 + //SEG21 [12] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 -- vduz1=vduz2 + lda cyclecount + sta print_dword_at.dw + lda cyclecount+1 + sta print_dword_at.dw+1 + lda cyclecount+2 + sta print_dword_at.dw+2 + lda cyclecount+3 + sta print_dword_at.dw+3 + //SEG22 [13] call print_dword_at + jsr print_dword_at + jmp b1_from_b3 +} +//SEG23 print_dword_at +// Print a dword as HEX at a specific position +// print_dword_at(dword zeropage($18) dw) +print_dword_at: { + .label dw = $18 + //SEG24 [14] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + lda dw+2 + sta print_word_at.w + lda dw+3 + sta print_word_at.w+1 + //SEG25 [15] call print_word_at + //SEG26 [19] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + print_word_at_from_print_dword_at: + //SEG27 [19] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + lda #SCREEN + sta print_word_at.at+1 + //SEG28 [19] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + jsr print_word_at + jmp b1 + //SEG29 print_dword_at::@1 + b1: + //SEG30 [16] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + lda dw + sta print_word_at.w + lda dw+1 + sta print_word_at.w+1 + //SEG31 [17] call print_word_at + //SEG32 [19] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + print_word_at_from_b1: + //SEG33 [19] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + lda #SCREEN+4 + sta print_word_at.at+1 + //SEG34 [19] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + jsr print_word_at + jmp breturn + //SEG35 print_dword_at::@return + breturn: + //SEG36 [18] return + rts +} +//SEG37 print_word_at +// Print a word as HEX at a specific position +// print_word_at(word zeropage(2) w, byte* zeropage(4) at) +print_word_at: { + .label w = 2 + .label at = 4 + //SEG38 [20] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + lda w+1 + sta print_byte_at.b + //SEG39 [21] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 -- pbuz1=pbuz2 + lda at + sta print_byte_at.at + lda at+1 + sta print_byte_at.at+1 + //SEG40 [22] call print_byte_at + //SEG41 [27] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + print_byte_at_from_print_word_at: + //SEG42 [27] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG43 [27] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + jsr print_byte_at + jmp b1 + //SEG44 print_word_at::@1 + b1: + //SEG45 [23] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + lda w + sta print_byte_at.b + //SEG46 [24] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz2_plus_2 + lda at + clc + adc #2 + sta print_byte_at.at + lda at+1 + adc #0 + sta print_byte_at.at+1 + //SEG47 [25] call print_byte_at + //SEG48 [27] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + print_byte_at_from_b1: + //SEG49 [27] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG50 [27] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + jsr print_byte_at + jmp breturn + //SEG51 print_word_at::@return + breturn: + //SEG52 [26] return + rts +} +//SEG53 print_byte_at +// Print a byte as HEX at a specific position +// print_byte_at(byte zeropage(6) b, byte* zeropage(7) at) +print_byte_at: { + .label _0 = $1c + .label _2 = $1d + .label b = 6 + .label at = 7 + //SEG54 [28] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4 + lda b + lsr + lsr + lsr + lsr + sta _0 + //SEG55 [29] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy _0 + lda print_hextab,y + sta print_char_at.ch + //SEG56 [30] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG57 [31] call print_char_at + //SEG58 [37] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + print_char_at_from_print_byte_at: + //SEG59 [37] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG60 [37] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + jmp b1 + //SEG61 print_byte_at::@1 + b1: + //SEG62 [32] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + lda #$f + and b + sta _2 + //SEG63 [33] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + //SEG64 [34] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy _2 + lda print_hextab,y + sta print_char_at.ch + //SEG65 [35] call print_char_at + //SEG66 [37] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + print_char_at_from_b1: + //SEG67 [37] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG68 [37] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + jmp breturn + //SEG69 print_byte_at::@return + breturn: + //SEG70 [36] return + rts +} +//SEG71 print_char_at +// Print a single char +// print_char_at(byte zeropage(9) ch, byte* zeropage($a) at) +print_char_at: { + .label ch = 9 + .label at = $a + //SEG72 [38] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuz2 + lda ch + ldy #0 + sta (at),y + jmp breturn + //SEG73 print_char_at::@return + breturn: + //SEG74 [39] return + rts +} +//SEG75 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = $1e + .label return_2 = $c + //SEG76 [40] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + jmp breturn + //SEG77 clock::@return + breturn: + //SEG78 [41] return + rts +} +//SEG79 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG80 [42] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG81 [43] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG82 [44] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG83 [45] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG84 [46] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + jmp breturn + //SEG85 clock_start::@return + breturn: + //SEG86 [47] return + rts +} +//SEG87 File Data + print_hextab: .text "0123456789abcdef" + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [9] (dword) clock::return#2 ← (dword) clock::return#0 [ clock::return#2 ] ( main:2 [ clock::return#2 ] ) always clobbers reg byte a +Statement [10] (dword~) main::$1 ← (dword) clock::return#2 [ main::$1 ] ( main:2 [ main::$1 ] ) always clobbers reg byte a +Statement [11] (dword) main::cyclecount#0 ← (dword~) main::$1 - (const dword) CLOCKS_PER_INIT#0 [ main::cyclecount#0 ] ( main:2 [ main::cyclecount#0 ] ) always clobbers reg byte a +Statement [12] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 [ print_dword_at::dw#0 ] ( main:2 [ print_dword_at::dw#0 ] ) always clobbers reg byte a +Statement [14] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 [ print_dword_at::dw#0 print_word_at::w#0 ] ( main:2::print_dword_at:13 [ print_dword_at::dw#0 print_word_at::w#0 ] ) always clobbers reg byte a +Statement [16] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 [ print_word_at::w#1 ] ( main:2::print_dword_at:13 [ print_word_at::w#1 ] ) always clobbers reg byte a +Statement [20] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ( main:2::print_dword_at:13::print_word_at:15 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] main:2::print_dword_at:13::print_word_at:17 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ) always clobbers reg byte a +Statement [21] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ( main:2::print_dword_at:13::print_word_at:15 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] main:2::print_dword_at:13::print_word_at:17 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Statement [23] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 [ print_word_at::at#2 print_byte_at::b#1 ] ( main:2::print_dword_at:13::print_word_at:15 [ print_dword_at::dw#0 print_word_at::at#2 print_byte_at::b#1 ] main:2::print_dword_at:13::print_word_at:17 [ print_word_at::at#2 print_byte_at::b#1 ] ) always clobbers reg byte a +Statement [24] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 [ print_byte_at::b#1 print_byte_at::at#1 ] ( main:2::print_dword_at:13::print_word_at:15 [ print_dword_at::dw#0 print_byte_at::b#1 print_byte_at::at#1 ] main:2::print_dword_at:13::print_word_at:17 [ print_byte_at::b#1 print_byte_at::at#1 ] ) always clobbers reg byte a +Statement [28] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ) always clobbers reg byte a +Statement [30] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +Statement [32] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f [ print_byte_at::at#2 print_byte_at::$2 ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25 [ print_dword_at::dw#0 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25 [ print_byte_at::at#2 print_byte_at::$2 ] ) always clobbers reg byte a +Statement [33] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 [ print_byte_at::$2 print_char_at::at#1 ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25 [ print_dword_at::dw#0 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25 [ print_byte_at::$2 print_char_at::at#1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:29 [ print_byte_at::$2 ] +Statement [38] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 [ ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22::print_char_at:31 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22::print_char_at:31 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25::print_char_at:31 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25::print_char_at:31 [ print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:22::print_char_at:35 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22::print_char_at:35 [ print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25::print_char_at:35 [ print_dword_at::dw#0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25::print_char_at:35 [ ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Statement [40] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) [ clock::return#0 ] ( main:2::clock:8 [ clock::return#0 ] ) always clobbers reg byte a +Statement [42] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [43] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [44] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [45] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [46] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [9] (dword) clock::return#2 ← (dword) clock::return#0 [ clock::return#2 ] ( main:2 [ clock::return#2 ] ) always clobbers reg byte a +Statement [10] (dword~) main::$1 ← (dword) clock::return#2 [ main::$1 ] ( main:2 [ main::$1 ] ) always clobbers reg byte a +Statement [11] (dword) main::cyclecount#0 ← (dword~) main::$1 - (const dword) CLOCKS_PER_INIT#0 [ main::cyclecount#0 ] ( main:2 [ main::cyclecount#0 ] ) always clobbers reg byte a +Statement [12] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 [ print_dword_at::dw#0 ] ( main:2 [ print_dword_at::dw#0 ] ) always clobbers reg byte a +Statement [14] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 [ print_dword_at::dw#0 print_word_at::w#0 ] ( main:2::print_dword_at:13 [ print_dword_at::dw#0 print_word_at::w#0 ] ) always clobbers reg byte a +Statement [16] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 [ print_word_at::w#1 ] ( main:2::print_dword_at:13 [ print_word_at::w#1 ] ) always clobbers reg byte a +Statement [20] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ( main:2::print_dword_at:13::print_word_at:15 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] main:2::print_dword_at:13::print_word_at:17 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ) always clobbers reg byte a +Statement [21] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ( main:2::print_dword_at:13::print_word_at:15 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] main:2::print_dword_at:13::print_word_at:17 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ) always clobbers reg byte a +Statement [23] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 [ print_word_at::at#2 print_byte_at::b#1 ] ( main:2::print_dword_at:13::print_word_at:15 [ print_dword_at::dw#0 print_word_at::at#2 print_byte_at::b#1 ] main:2::print_dword_at:13::print_word_at:17 [ print_word_at::at#2 print_byte_at::b#1 ] ) always clobbers reg byte a +Statement [24] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 [ print_byte_at::b#1 print_byte_at::at#1 ] ( main:2::print_dword_at:13::print_word_at:15 [ print_dword_at::dw#0 print_byte_at::b#1 print_byte_at::at#1 ] main:2::print_dword_at:13::print_word_at:17 [ print_byte_at::b#1 print_byte_at::at#1 ] ) always clobbers reg byte a +Statement [28] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ) always clobbers reg byte a +Statement [30] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ) always clobbers reg byte a +Statement [32] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f [ print_byte_at::at#2 print_byte_at::$2 ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25 [ print_dword_at::dw#0 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25 [ print_byte_at::at#2 print_byte_at::$2 ] ) always clobbers reg byte a +Statement [33] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 [ print_byte_at::$2 print_char_at::at#1 ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25 [ print_dword_at::dw#0 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25 [ print_byte_at::$2 print_char_at::at#1 ] ) always clobbers reg byte a +Statement [38] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 [ ] ( main:2::print_dword_at:13::print_word_at:15::print_byte_at:22::print_char_at:31 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22::print_char_at:31 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25::print_char_at:31 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25::print_char_at:31 [ print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:22::print_char_at:35 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:22::print_char_at:35 [ print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:13::print_word_at:15::print_byte_at:25::print_char_at:35 [ print_dword_at::dw#0 ] main:2::print_dword_at:13::print_word_at:17::print_byte_at:25::print_char_at:35 [ ] ) always clobbers reg byte a reg byte y +Statement [40] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) [ clock::return#0 ] ( main:2::clock:8 [ clock::return#0 ] ) always clobbers reg byte a +Statement [42] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [43] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [44] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [45] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Statement [46] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 [ ] ( main:2::clock_start:6 [ ] ) always clobbers reg byte a +Potential registers zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] : zp ZP_WORD:2 , +Potential registers zp ZP_WORD:4 [ print_word_at::at#2 ] : zp ZP_WORD:4 , +Potential registers zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] : zp ZP_BYTE:6 , reg byte x , +Potential registers zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] : zp ZP_WORD:7 , +Potential registers zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , +Potential registers zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] : zp ZP_WORD:10 , +Potential registers zp ZP_DWORD:12 [ clock::return#2 ] : zp ZP_DWORD:12 , +Potential registers zp ZP_DWORD:16 [ main::$1 ] : zp ZP_DWORD:16 , +Potential registers zp ZP_DWORD:20 [ main::cyclecount#0 ] : zp ZP_DWORD:20 , +Potential registers zp ZP_DWORD:24 [ print_dword_at::dw#0 ] : zp ZP_DWORD:24 , +Potential registers zp ZP_BYTE:28 [ print_byte_at::$0 ] : zp ZP_BYTE:28 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:29 [ print_byte_at::$2 ] : zp ZP_BYTE:29 , reg byte x , reg byte y , +Potential registers zp ZP_DWORD:30 [ clock::return#0 ] : zp ZP_DWORD:30 , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 22: zp ZP_DWORD:16 [ main::$1 ] 22: zp ZP_DWORD:20 [ main::cyclecount#0 ] +Uplift Scope [clock] 22: zp ZP_DWORD:12 [ clock::return#2 ] 4.33: zp ZP_DWORD:30 [ clock::return#0 ] +Uplift Scope [print_char_at] 12: zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] 12: zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Uplift Scope [print_byte_at] 9.33: zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] 5.6: zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] 4: zp ZP_BYTE:28 [ print_byte_at::$0 ] 2: zp ZP_BYTE:29 [ print_byte_at::$2 ] +Uplift Scope [print_word_at] 10: zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] 0.8: zp ZP_WORD:4 [ print_word_at::at#2 ] +Uplift Scope [print_dword_at] 5: zp ZP_DWORD:24 [ print_dword_at::dw#0 ] +Uplift Scope [clock_start] +Uplift Scope [] + +Uplifting [main] best 1746 combination zp ZP_DWORD:16 [ main::$1 ] zp ZP_DWORD:20 [ main::cyclecount#0 ] +Uplifting [clock] best 1746 combination zp ZP_DWORD:12 [ clock::return#2 ] zp ZP_DWORD:30 [ clock::return#0 ] +Uplifting [print_char_at] best 1739 combination reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Uplifting [print_byte_at] best 1731 combination zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] reg byte a [ print_byte_at::$0 ] reg byte y [ print_byte_at::$2 ] +Uplifting [print_word_at] best 1731 combination zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] zp ZP_WORD:4 [ print_word_at::at#2 ] +Uplifting [print_dword_at] best 1731 combination zp ZP_DWORD:24 [ print_dword_at::dw#0 ] +Uplifting [clock_start] best 1731 combination +Uplifting [] best 1731 combination +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Uplifting [print_byte_at] best 1731 combination zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Coalescing zero page register with common assignment [ zp ZP_WORD:4 [ print_word_at::at#2 ] ] with [ zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] ] - score: 2 +Coalescing zero page register with common assignment [ zp ZP_DWORD:12 [ clock::return#2 ] ] with [ zp ZP_DWORD:16 [ main::$1 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_DWORD:12 [ clock::return#2 main::$1 ] ] with [ zp ZP_DWORD:30 [ clock::return#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_DWORD:20 [ main::cyclecount#0 ] ] with [ zp ZP_DWORD:24 [ print_dword_at::dw#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_DWORD:12 [ clock::return#2 main::$1 clock::return#0 ] ] with [ zp ZP_DWORD:20 [ main::cyclecount#0 print_dword_at::dw#0 ] ] - score: 1 +Allocated (was zp ZP_WORD:10) zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Allocated (was zp ZP_DWORD:12) zp ZP_DWORD:9 [ clock::return#2 main::$1 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 File Comments +// Counting cycles using a CIA timer +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + // CIA #2 Timer A+B Value (32-bit) + .label CIA2_TIMER_AB = $dd04 + // CIA #2 Timer A Control Register + .label CIA2_TIMER_A_CONTROL = $dd0e + // CIA #2 Timer B Control Register + .label CIA2_TIMER_B_CONTROL = $dd0f + // Timer Control - Start/stop timer (0:stop, 1: start) + .const CIA_TIMER_CONTROL_START = 1 + // Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT) + .const CIA_TIMER_CONTROL_CONTINUOUS = 0 + // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) + .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 + // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. + // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. + .const CLOCKS_PER_INIT = $12 + .label SCREEN = $400 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label _1 = 9 + .label cyclecount = 9 + //SEG11 [5] phi from main main::@3 to main::@1 [phi:main/main::@3->main::@1] + b1_from_main: + b1_from_b3: + jmp b1 + //SEG12 main::@1 + b1: + //SEG13 [6] call clock_start + jsr clock_start + jmp b2 + //SEG14 main::@2 + b2: + //SEG15 asm { nop } + nop + //SEG16 [8] call clock + jsr clock + //SEG17 [9] (dword) clock::return#2 ← (dword) clock::return#0 + jmp b3 + //SEG18 main::@3 + b3: + //SEG19 [10] (dword~) main::$1 ← (dword) clock::return#2 + //SEG20 [11] (dword) main::cyclecount#0 ← (dword~) main::$1 - (const dword) CLOCKS_PER_INIT#0 -- vduz1=vduz1_minus_vduc1 + lda cyclecount + sec + sbc #CLOCKS_PER_INIT + sta cyclecount+1 + lda cyclecount+2 + sbc #>$10 + sta cyclecount+2 + lda cyclecount+3 + sbc #>CLOCKS_PER_INIT>>$10 + sta cyclecount+3 + //SEG21 [12] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + //SEG22 [13] call print_dword_at + jsr print_dword_at + jmp b1_from_b3 +} +//SEG23 print_dword_at +// Print a dword as HEX at a specific position +// print_dword_at(dword zeropage(9) dw) +print_dword_at: { + .label dw = 9 + //SEG24 [14] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + lda dw+2 + sta print_word_at.w + lda dw+3 + sta print_word_at.w+1 + //SEG25 [15] call print_word_at + //SEG26 [19] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + print_word_at_from_print_dword_at: + //SEG27 [19] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + lda #SCREEN + sta print_word_at.at+1 + //SEG28 [19] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + jsr print_word_at + jmp b1 + //SEG29 print_dword_at::@1 + b1: + //SEG30 [16] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + lda dw + sta print_word_at.w + lda dw+1 + sta print_word_at.w+1 + //SEG31 [17] call print_word_at + //SEG32 [19] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + print_word_at_from_b1: + //SEG33 [19] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + lda #SCREEN+4 + sta print_word_at.at+1 + //SEG34 [19] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + jsr print_word_at + jmp breturn + //SEG35 print_dword_at::@return + breturn: + //SEG36 [18] return + rts +} +//SEG37 print_word_at +// Print a word as HEX at a specific position +// print_word_at(word zeropage(2) w, byte* zeropage(4) at) +print_word_at: { + .label w = 2 + .label at = 4 + //SEG38 [20] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + lda w+1 + sta print_byte_at.b + //SEG39 [21] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + //SEG40 [22] call print_byte_at + //SEG41 [27] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + print_byte_at_from_print_word_at: + //SEG42 [27] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG43 [27] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + jsr print_byte_at + jmp b1 + //SEG44 print_word_at::@1 + b1: + //SEG45 [23] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + lda w + sta print_byte_at.b + //SEG46 [24] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz1_plus_2 + lda print_byte_at.at + clc + adc #2 + sta print_byte_at.at + bcc !+ + inc print_byte_at.at+1 + !: + //SEG47 [25] call print_byte_at + //SEG48 [27] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + print_byte_at_from_b1: + //SEG49 [27] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG50 [27] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + jsr print_byte_at + jmp breturn + //SEG51 print_word_at::@return + breturn: + //SEG52 [26] return + rts +} +//SEG53 print_byte_at +// Print a byte as HEX at a specific position +// print_byte_at(byte zeropage(6) b, byte* zeropage(4) at) +print_byte_at: { + .label b = 6 + .label at = 4 + //SEG54 [28] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 + lda b + lsr + lsr + lsr + lsr + //SEG55 [29] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuxx=pbuc1_derefidx_vbuaa + tay + ldx print_hextab,y + //SEG56 [30] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG57 [31] call print_char_at + //SEG58 [37] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + print_char_at_from_print_byte_at: + //SEG59 [37] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG60 [37] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + jmp b1 + //SEG61 print_byte_at::@1 + b1: + //SEG62 [32] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuyy=vbuz1_band_vbuc1 + lda #$f + and b + tay + //SEG63 [33] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + //SEG64 [34] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuxx=pbuc1_derefidx_vbuyy + ldx print_hextab,y + //SEG65 [35] call print_char_at + //SEG66 [37] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + print_char_at_from_b1: + //SEG67 [37] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG68 [37] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + jmp breturn + //SEG69 print_byte_at::@return + breturn: + //SEG70 [36] return + rts +} +//SEG71 print_char_at +// Print a single char +// print_char_at(byte register(X) ch, byte* zeropage(7) at) +print_char_at: { + .label at = 7 + //SEG72 [38] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuxx + txa + ldy #0 + sta (at),y + jmp breturn + //SEG73 print_char_at::@return + breturn: + //SEG74 [39] return + rts +} +//SEG75 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = 9 + //SEG76 [40] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + jmp breturn + //SEG77 clock::@return + breturn: + //SEG78 [41] return + rts +} +//SEG79 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG80 [42] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG81 [43] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG82 [44] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG83 [45] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG84 [46] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + jmp breturn + //SEG85 clock_start::@return + breturn: + //SEG86 [47] return + rts +} +//SEG87 File Data + print_hextab: .text "0123456789abcdef" + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b1 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp breturn +Removing instruction jmp breturn +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing label b1_from_b3 with b1 +Removing instruction b1_from_bbegin: +Removing instruction b1: +Removing instruction main_from_b1: +Removing instruction bend_from_b1: +Removing instruction b1_from_main: +Removing instruction b1_from_b3: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bend: +Removing instruction b2: +Removing instruction b3: +Removing instruction print_word_at_from_print_dword_at: +Removing instruction b1: +Removing instruction print_word_at_from_b1: +Removing instruction breturn: +Removing instruction print_byte_at_from_print_word_at: +Removing instruction b1: +Removing instruction print_byte_at_from_b1: +Removing instruction breturn: +Removing instruction print_char_at_from_print_byte_at: +Removing instruction b1: +Removing instruction print_char_at_from_b1: +Removing instruction breturn: +Removing instruction breturn: +Removing instruction breturn: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @begin +(label) @end +(dword*) CIA2_TIMER_AB +(const dword*) CIA2_TIMER_AB#0 CIA2_TIMER_AB = (dword*) 56580 +(byte*) CIA2_TIMER_A_CONTROL +(const byte*) CIA2_TIMER_A_CONTROL#0 CIA2_TIMER_A_CONTROL = (byte*) 56590 +(byte*) CIA2_TIMER_B_CONTROL +(const byte*) CIA2_TIMER_B_CONTROL#0 CIA2_TIMER_B_CONTROL = (byte*) 56591 +(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES +(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A +(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = (byte) $40 +(byte) CIA_TIMER_CONTROL_CONTINUOUS +(const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 CIA_TIMER_CONTROL_CONTINUOUS = (byte) 0 +(byte) CIA_TIMER_CONTROL_START +(const byte) CIA_TIMER_CONTROL_START#0 CIA_TIMER_CONTROL_START = (byte) 1 +(byte) CIA_TIMER_CONTROL_STOP +(dword) CLOCKS_PER_INIT +(const dword) CLOCKS_PER_INIT#0 CLOCKS_PER_INIT = (byte) $12 +(byte*) SCREEN +(const byte*) SCREEN#0 SCREEN = (byte*) 1024 +(dword()) clock() +(label) clock::@return +(dword) clock::return +(dword) clock::return#0 return zp ZP_DWORD:9 4.333333333333333 +(dword) clock::return#2 return zp ZP_DWORD:9 22.0 +(void()) clock_start() +(label) clock_start::@return +(void()) main() +(dword~) main::$1 $1 zp ZP_DWORD:9 22.0 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(dword) main::cyclecount +(dword) main::cyclecount#0 cyclecount zp ZP_DWORD:9 22.0 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 reg byte a 4.0 +(byte~) print_byte_at::$2 reg byte y 2.0 +(label) print_byte_at::@1 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 at zp ZP_WORD:4 4.0 +(byte*) print_byte_at::at#1 at zp ZP_WORD:4 4.0 +(byte*) print_byte_at::at#2 at zp ZP_WORD:4 1.3333333333333333 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 b zp ZP_BYTE:6 2.0 +(byte) print_byte_at::b#1 b zp ZP_BYTE:6 2.0 +(byte) print_byte_at::b#2 b zp ZP_BYTE:6 1.6 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 at zp ZP_WORD:7 4.0 +(byte*) print_char_at::at#1 at zp ZP_WORD:7 2.0 +(byte*) print_char_at::at#2 at zp ZP_WORD:7 6.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 reg byte x 2.0 +(byte) print_char_at::ch#1 reg byte x 4.0 +(byte) print_char_at::ch#2 reg byte x 6.0 +(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at) +(label) print_dword_at::@1 +(label) print_dword_at::@return +(byte*) print_dword_at::at +(dword) print_dword_at::dw +(dword) print_dword_at::dw#0 dw zp ZP_DWORD:9 5.0 +(byte[]) print_hextab +(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef" +(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at) +(label) print_word_at::@1 +(label) print_word_at::@return +(byte*) print_word_at::at +(byte*) print_word_at::at#2 at zp ZP_WORD:4 0.8 +(word) print_word_at::w +(word) print_word_at::w#0 w zp ZP_WORD:2 4.0 +(word) print_word_at::w#1 w zp ZP_WORD:2 4.0 +(word) print_word_at::w#2 w zp ZP_WORD:2 2.0 + +zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +zp ZP_WORD:4 [ print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +zp ZP_DWORD:9 [ clock::return#2 main::$1 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ] +reg byte a [ print_byte_at::$0 ] +reg byte y [ print_byte_at::$2 ] + + +FINAL ASSEMBLER +Score: 869 + +//SEG0 File Comments +// Counting cycles using a CIA timer +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG2 Global Constants & labels + // CIA #2 Timer A+B Value (32-bit) + .label CIA2_TIMER_AB = $dd04 + // CIA #2 Timer A Control Register + .label CIA2_TIMER_A_CONTROL = $dd0e + // CIA #2 Timer B Control Register + .label CIA2_TIMER_B_CONTROL = $dd0f + // Timer Control - Start/stop timer (0:stop, 1: start) + .const CIA_TIMER_CONTROL_START = 1 + // Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT) + .const CIA_TIMER_CONTROL_CONTINUOUS = 0 + // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) + .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 + // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. + // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. + .const CLOCKS_PER_INIT = $12 + .label SCREEN = $400 +//SEG3 @begin +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +//SEG5 @1 +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +//SEG9 @end +//SEG10 main +main: { + .label _1 = 9 + .label cyclecount = 9 + //SEG11 [5] phi from main main::@3 to main::@1 [phi:main/main::@3->main::@1] + //SEG12 main::@1 + b1: + //SEG13 [6] call clock_start + jsr clock_start + //SEG14 main::@2 + //SEG15 asm { nop } + nop + //SEG16 [8] call clock + jsr clock + //SEG17 [9] (dword) clock::return#2 ← (dword) clock::return#0 + //SEG18 main::@3 + //SEG19 [10] (dword~) main::$1 ← (dword) clock::return#2 + //SEG20 [11] (dword) main::cyclecount#0 ← (dword~) main::$1 - (const dword) CLOCKS_PER_INIT#0 -- vduz1=vduz1_minus_vduc1 + lda cyclecount + sec + sbc #CLOCKS_PER_INIT + sta cyclecount+1 + lda cyclecount+2 + sbc #>$10 + sta cyclecount+2 + lda cyclecount+3 + sbc #>CLOCKS_PER_INIT>>$10 + sta cyclecount+3 + //SEG21 [12] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + //SEG22 [13] call print_dword_at + jsr print_dword_at + jmp b1 +} +//SEG23 print_dword_at +// Print a dword as HEX at a specific position +// print_dword_at(dword zeropage(9) dw) +print_dword_at: { + .label dw = 9 + //SEG24 [14] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + lda dw+2 + sta print_word_at.w + lda dw+3 + sta print_word_at.w+1 + //SEG25 [15] call print_word_at + //SEG26 [19] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + //SEG27 [19] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + lda #SCREEN + sta print_word_at.at+1 + //SEG28 [19] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + jsr print_word_at + //SEG29 print_dword_at::@1 + //SEG30 [16] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + lda dw + sta print_word_at.w + lda dw+1 + sta print_word_at.w+1 + //SEG31 [17] call print_word_at + //SEG32 [19] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + //SEG33 [19] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + lda #SCREEN+4 + sta print_word_at.at+1 + //SEG34 [19] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + jsr print_word_at + //SEG35 print_dword_at::@return + //SEG36 [18] return + rts +} +//SEG37 print_word_at +// Print a word as HEX at a specific position +// print_word_at(word zeropage(2) w, byte* zeropage(4) at) +print_word_at: { + .label w = 2 + .label at = 4 + //SEG38 [20] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + lda w+1 + sta print_byte_at.b + //SEG39 [21] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + //SEG40 [22] call print_byte_at + //SEG41 [27] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + //SEG42 [27] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG43 [27] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + jsr print_byte_at + //SEG44 print_word_at::@1 + //SEG45 [23] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + lda w + sta print_byte_at.b + //SEG46 [24] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz1_plus_2 + lda print_byte_at.at + clc + adc #2 + sta print_byte_at.at + bcc !+ + inc print_byte_at.at+1 + !: + //SEG47 [25] call print_byte_at + //SEG48 [27] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + //SEG49 [27] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG50 [27] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + jsr print_byte_at + //SEG51 print_word_at::@return + //SEG52 [26] return + rts +} +//SEG53 print_byte_at +// Print a byte as HEX at a specific position +// print_byte_at(byte zeropage(6) b, byte* zeropage(4) at) +print_byte_at: { + .label b = 6 + .label at = 4 + //SEG54 [28] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 + lda b + lsr + lsr + lsr + lsr + //SEG55 [29] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuxx=pbuc1_derefidx_vbuaa + tay + ldx print_hextab,y + //SEG56 [30] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG57 [31] call print_char_at + //SEG58 [37] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + //SEG59 [37] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG60 [37] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + //SEG61 print_byte_at::@1 + //SEG62 [32] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuyy=vbuz1_band_vbuc1 + lda #$f + and b + tay + //SEG63 [33] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + //SEG64 [34] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuxx=pbuc1_derefidx_vbuyy + ldx print_hextab,y + //SEG65 [35] call print_char_at + //SEG66 [37] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + //SEG67 [37] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG68 [37] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + //SEG69 print_byte_at::@return + //SEG70 [36] return + rts +} +//SEG71 print_char_at +// Print a single char +// print_char_at(byte register(X) ch, byte* zeropage(7) at) +print_char_at: { + .label at = 7 + //SEG72 [38] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuxx + txa + ldy #0 + sta (at),y + //SEG73 print_char_at::@return + //SEG74 [39] return + rts +} +//SEG75 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = 9 + //SEG76 [40] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + //SEG77 clock::@return + //SEG78 [41] return + rts +} +//SEG79 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG80 [42] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG81 [43] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG82 [44] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG83 [45] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG84 [46] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + //SEG85 clock_start::@return + //SEG86 [47] return + rts +} +//SEG87 File Data + print_hextab: .text "0123456789abcdef" + diff --git a/src/test/ref/cia-timer-cyclecount.sym b/src/test/ref/cia-timer-cyclecount.sym new file mode 100644 index 000000000..7f20a93de --- /dev/null +++ b/src/test/ref/cia-timer-cyclecount.sym @@ -0,0 +1,84 @@ +(label) @1 +(label) @begin +(label) @end +(dword*) CIA2_TIMER_AB +(const dword*) CIA2_TIMER_AB#0 CIA2_TIMER_AB = (dword*) 56580 +(byte*) CIA2_TIMER_A_CONTROL +(const byte*) CIA2_TIMER_A_CONTROL#0 CIA2_TIMER_A_CONTROL = (byte*) 56590 +(byte*) CIA2_TIMER_B_CONTROL +(const byte*) CIA2_TIMER_B_CONTROL#0 CIA2_TIMER_B_CONTROL = (byte*) 56591 +(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES +(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A +(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = (byte) $40 +(byte) CIA_TIMER_CONTROL_CONTINUOUS +(const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 CIA_TIMER_CONTROL_CONTINUOUS = (byte) 0 +(byte) CIA_TIMER_CONTROL_START +(const byte) CIA_TIMER_CONTROL_START#0 CIA_TIMER_CONTROL_START = (byte) 1 +(byte) CIA_TIMER_CONTROL_STOP +(dword) CLOCKS_PER_INIT +(const dword) CLOCKS_PER_INIT#0 CLOCKS_PER_INIT = (byte) $12 +(byte*) SCREEN +(const byte*) SCREEN#0 SCREEN = (byte*) 1024 +(dword()) clock() +(label) clock::@return +(dword) clock::return +(dword) clock::return#0 return zp ZP_DWORD:9 4.333333333333333 +(dword) clock::return#2 return zp ZP_DWORD:9 22.0 +(void()) clock_start() +(label) clock_start::@return +(void()) main() +(dword~) main::$1 $1 zp ZP_DWORD:9 22.0 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(dword) main::cyclecount +(dword) main::cyclecount#0 cyclecount zp ZP_DWORD:9 22.0 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 reg byte a 4.0 +(byte~) print_byte_at::$2 reg byte y 2.0 +(label) print_byte_at::@1 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 at zp ZP_WORD:4 4.0 +(byte*) print_byte_at::at#1 at zp ZP_WORD:4 4.0 +(byte*) print_byte_at::at#2 at zp ZP_WORD:4 1.3333333333333333 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 b zp ZP_BYTE:6 2.0 +(byte) print_byte_at::b#1 b zp ZP_BYTE:6 2.0 +(byte) print_byte_at::b#2 b zp ZP_BYTE:6 1.6 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 at zp ZP_WORD:7 4.0 +(byte*) print_char_at::at#1 at zp ZP_WORD:7 2.0 +(byte*) print_char_at::at#2 at zp ZP_WORD:7 6.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 reg byte x 2.0 +(byte) print_char_at::ch#1 reg byte x 4.0 +(byte) print_char_at::ch#2 reg byte x 6.0 +(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at) +(label) print_dword_at::@1 +(label) print_dword_at::@return +(byte*) print_dword_at::at +(dword) print_dword_at::dw +(dword) print_dword_at::dw#0 dw zp ZP_DWORD:9 5.0 +(byte[]) print_hextab +(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef" +(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at) +(label) print_word_at::@1 +(label) print_word_at::@return +(byte*) print_word_at::at +(byte*) print_word_at::at#2 at zp ZP_WORD:4 0.8 +(word) print_word_at::w +(word) print_word_at::w#0 w zp ZP_WORD:2 4.0 +(word) print_word_at::w#1 w zp ZP_WORD:2 4.0 +(word) print_word_at::w#2 w zp ZP_WORD:2 2.0 + +zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +zp ZP_WORD:4 [ print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +zp ZP_DWORD:9 [ clock::return#2 main::$1 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ] +reg byte a [ print_byte_at::$0 ] +reg byte y [ print_byte_at::$2 ] diff --git a/src/test/ref/cia-timer-simple.asm b/src/test/ref/cia-timer-simple.asm index 43c0a4d87..2b3b98d4d 100644 --- a/src/test/ref/cia-timer-simple.asm +++ b/src/test/ref/cia-timer-simple.asm @@ -16,40 +16,9 @@ .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 .label SCREEN = $400 main: { - // Timer AB initial value - .const TIMER_INIT = $ffffffff - sei - // Setup CIA#2 timer A to count (down) CPU cycles - lda #CIA_TIMER_CONTROL_CONTINUOUS - sta CIA2_TIMER_A_CONTROL - lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A - sta CIA2_TIMER_B_CONTROL - lda #TIMER_INIT - sta CIA2_TIMER_AB+1 - lda #>$10 - sta CIA2_TIMER_AB+2 - lda #>TIMER_INIT>>$10 - sta CIA2_TIMER_AB+3 - lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A - sta CIA2_TIMER_B_CONTROL - lda #CIA_TIMER_CONTROL_START - sta CIA2_TIMER_A_CONTROL + jsr clock_start b1: - lda #TIMER_INIT - sbc CIA2_TIMER_AB+1 - sta print_dword_at.dw+1 - lda #>$10 - sbc CIA2_TIMER_AB+2 - sta print_dword_at.dw+2 - lda #>TIMER_INIT>>$10 - sbc CIA2_TIMER_AB+3 - sta print_dword_at.dw+3 + jsr clock jsr print_dword_at jmp b1 } @@ -136,5 +105,46 @@ print_char_at: { ldy #0 sta (at),y rts +} +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = 9 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + rts +} +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + rts } print_hextab: .text "0123456789abcdef" diff --git a/src/test/ref/cia-timer-simple.cfg b/src/test/ref/cia-timer-simple.cfg index 12b8ea68e..885a5fffd 100644 --- a/src/test/ref/cia-timer-simple.cfg +++ b/src/test/ref/cia-timer-simple.cfg @@ -8,65 +8,82 @@ @end: scope:[] from @1 [3] phi() main: scope:[main] from @1 - asm { sei } - [5] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 - [6] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 - [7] *((const dword*) CIA2_TIMER_AB#0) ← (const dword) main::TIMER_INIT#0 - [8] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 - [9] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 + [4] phi() + [5] call clock_start to:main::@1 -main::@1: scope:[main] from main main::@1 - [10] (dword) print_dword_at::dw#0 ← (const dword) main::TIMER_INIT#0 - *((const dword*) CIA2_TIMER_AB#0) - [11] call print_dword_at +main::@1: scope:[main] from main main::@2 + [6] phi() + [7] call clock + [8] (dword) clock::return#2 ← (dword) clock::return#0 + to:main::@2 +main::@2: scope:[main] from main::@1 + [9] (dword) print_dword_at::dw#0 ← (dword) clock::return#2 + [10] call print_dword_at to:main::@1 -print_dword_at: scope:[print_dword_at] from main::@1 - [12] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 - [13] call print_word_at +print_dword_at: scope:[print_dword_at] from main::@2 + [11] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 + [12] call print_word_at to:print_dword_at::@1 print_dword_at::@1: scope:[print_dword_at] from print_dword_at - [14] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 - [15] call print_word_at + [13] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 + [14] call print_word_at to:print_dword_at::@return print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@1 - [16] return + [15] return to:@return print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 - [17] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const byte*) SCREEN#0 print_dword_at::@1/(const byte*) SCREEN#0+(byte) 4 ) - [17] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) - [18] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 - [19] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 - [20] call print_byte_at + [16] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const byte*) SCREEN#0 print_dword_at::@1/(const byte*) SCREEN#0+(byte) 4 ) + [16] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) + [17] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 + [18] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + [19] call print_byte_at to:print_word_at::@1 print_word_at::@1: scope:[print_word_at] from print_word_at - [21] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 - [22] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 - [23] call print_byte_at + [20] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 + [21] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 + [22] call print_byte_at to:print_word_at::@return print_word_at::@return: scope:[print_word_at] from print_word_at::@1 - [24] return + [23] return to:@return print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 - [25] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) - [25] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) - [26] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 - [27] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) - [28] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 - [29] call print_char_at + [24] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) + [24] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) + [25] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 + [26] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + [27] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 + [28] call print_char_at to:print_byte_at::@1 print_byte_at::@1: scope:[print_byte_at] from print_byte_at - [30] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f - [31] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 - [32] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) - [33] call print_char_at + [29] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f + [30] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 + [31] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) + [32] call print_char_at to:print_byte_at::@return print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1 - [34] return + [33] return to:@return print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 - [35] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) - [35] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) - [36] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 + [34] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) + [34] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) + [35] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 to:print_char_at::@return print_char_at::@return: scope:[print_char_at] from print_char_at - [37] return + [36] return + to:@return +clock: scope:[clock] from main::@1 + [37] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) + to:clock::@return +clock::@return: scope:[clock] from clock + [38] return + to:@return +clock_start: scope:[clock_start] from main + [39] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + [40] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [41] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff + [42] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [43] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + [44] return to:@return diff --git a/src/test/ref/cia-timer-simple.log b/src/test/ref/cia-timer-simple.log index 9cafacd78..59f4168b3 100644 --- a/src/test/ref/cia-timer-simple.log +++ b/src/test/ref/cia-timer-simple.log @@ -1,9 +1,9 @@ -Identified constant variable (dword) main::TIMER_INIT Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx Culled Empty Block (label) @1 Culled Empty Block (label) @2 Culled Empty Block (label) @3 Culled Empty Block (label) @4 +Culled Empty Block (label) clock::@1 Culled Empty Block (label) @5 Culled Empty Block (label) @6 Culled Empty Block (label) @7 @@ -17,12 +17,14 @@ Culled Empty Block (label) @14 Culled Empty Block (label) @15 Culled Empty Block (label) @16 Culled Empty Block (label) @17 +Culled Empty Block (label) @18 Culled Empty Block (label) @19 -Culled Empty Block (label) @20 Culled Empty Block (label) @21 Culled Empty Block (label) @22 Culled Empty Block (label) @23 Culled Empty Block (label) @24 +Culled Empty Block (label) @25 +Culled Empty Block (label) @26 Culled Empty Block (label) main::@4 Culled Empty Block (label) main::@3 Culled Empty Block (label) main::@5 @@ -38,7 +40,34 @@ CONTROL FLOW GRAPH SSA (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (number) 0 (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (number) 0 (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (number) $40 - to:@18 + to:@20 +clock: scope:[clock] from main::@2 + (number~) clock::$0 ← (number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) + (dword) clock::return#0 ← (number~) clock::$0 + to:clock::@return +clock::@return: scope:[clock] from clock + (dword) clock::return#3 ← phi( clock/(dword) clock::return#0 ) + (dword) clock::return#1 ← (dword) clock::return#3 + return + to:@return +clock_start: scope:[clock_start] from main + (byte~) clock_start::$0 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$1 ← (byte~) clock_start::$0 | (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 + *((byte*) CIA2_TIMER_A_CONTROL#0) ← (byte~) clock_start::$1 + (byte~) clock_start::$2 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$3 ← (byte~) clock_start::$2 | (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + *((byte*) CIA2_TIMER_B_CONTROL#0) ← (byte~) clock_start::$3 + *((dword*) CIA2_TIMER_AB#0) ← (number) $ffffffff + (byte~) clock_start::$4 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$5 ← (byte~) clock_start::$4 | (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + *((byte*) CIA2_TIMER_B_CONTROL#0) ← (byte~) clock_start::$5 + (byte~) clock_start::$6 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$7 ← (byte~) clock_start::$6 | (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 + *((byte*) CIA2_TIMER_A_CONTROL#0) ← (byte~) clock_start::$7 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + return + to:@return print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 (byte*) print_word_at::at#2 ← phi( print_dword_at/(byte*) print_word_at::at#0 print_dword_at::@1/(byte*) print_word_at::at#1 ) (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) @@ -61,9 +90,9 @@ print_word_at::@2: scope:[print_word_at] from print_word_at::@1 print_word_at::@return: scope:[print_word_at] from print_word_at::@2 return to:@return -print_dword_at: scope:[print_dword_at] from main::@2 - (byte*) print_dword_at::at#1 ← phi( main::@2/(byte*) print_dword_at::at#0 ) - (dword) print_dword_at::dw#1 ← phi( main::@2/(dword) print_dword_at::dw#0 ) +print_dword_at: scope:[print_dword_at] from main::@8 + (byte*) print_dword_at::at#1 ← phi( main::@8/(byte*) print_dword_at::at#0 ) + (dword) print_dword_at::dw#1 ← phi( main::@8/(dword) print_dword_at::dw#0 ) (word~) print_dword_at::$0 ← > (dword) print_dword_at::dw#1 (word) print_word_at::w#0 ← (word~) print_dword_at::$0 (byte*) print_word_at::at#0 ← (byte*) print_dword_at::at#1 @@ -83,9 +112,9 @@ print_dword_at::@2: scope:[print_dword_at] from print_dword_at::@1 print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@2 return to:@return -@18: scope:[] from @begin +@20: scope:[] from @begin (byte[]) print_hextab#0 ← (const string) $0 - to:@25 + to:@27 print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) @@ -116,53 +145,46 @@ print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 print_char_at::@return: scope:[print_char_at] from print_char_at return to:@return -@25: scope:[] from @18 +@27: scope:[] from @20 (byte*) SCREEN#0 ← ((byte*)) (number) $400 - to:@26 -main: scope:[main] from @26 - asm { sei } - (dword) main::TIMER_INIT#0 ← (number) $ffffffff - (byte~) main::$0 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 - (byte~) main::$1 ← (byte~) main::$0 | (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 - *((byte*) CIA2_TIMER_A_CONTROL#0) ← (byte~) main::$1 - (byte~) main::$2 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 - (byte~) main::$3 ← (byte~) main::$2 | (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 - *((byte*) CIA2_TIMER_B_CONTROL#0) ← (byte~) main::$3 - *((dword*) CIA2_TIMER_AB#0) ← (dword) main::TIMER_INIT#0 - (byte~) main::$4 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 - (byte~) main::$5 ← (byte~) main::$4 | (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 - *((byte*) CIA2_TIMER_B_CONTROL#0) ← (byte~) main::$5 - (byte~) main::$6 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 - (byte~) main::$7 ← (byte~) main::$6 | (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 - *((byte*) CIA2_TIMER_A_CONTROL#0) ← (byte~) main::$7 + to:@28 +main: scope:[main] from @28 + call clock_start + to:main::@7 +main::@7: scope:[main] from main to:main::@1 -main::@1: scope:[main] from main main::@7 +main::@1: scope:[main] from main::@7 main::@9 if(true) goto main::@2 to:main::@return main::@2: scope:[main] from main::@1 - (dword~) main::$8 ← (dword) main::TIMER_INIT#0 - *((dword*) CIA2_TIMER_AB#0) - (dword) print_dword_at::dw#0 ← (dword~) main::$8 + call clock + (dword) clock::return#2 ← (dword) clock::return#1 + to:main::@8 +main::@8: scope:[main] from main::@2 + (dword) clock::return#4 ← phi( main::@2/(dword) clock::return#2 ) + (dword~) main::$1 ← (dword) clock::return#4 + (dword) print_dword_at::dw#0 ← (dword~) main::$1 (byte*) print_dword_at::at#0 ← (byte*) SCREEN#0 call print_dword_at - to:main::@7 -main::@7: scope:[main] from main::@2 + to:main::@9 +main::@9: scope:[main] from main::@8 to:main::@1 main::@return: scope:[main] from main::@1 return to:@return -@26: scope:[] from @25 +@28: scope:[] from @27 call main - to:@27 -@27: scope:[] from @26 + to:@29 +@29: scope:[] from @28 to:@end -@end: scope:[] from @27 +@end: scope:[] from @29 SYMBOL TABLE SSA (const string) $0 = (string) "0123456789abcdef" -(label) @18 -(label) @25 -(label) @26 +(label) @20 (label) @27 +(label) @28 +(label) @29 (label) @begin (label) @end (dword*) CIA2_TIMER_AB @@ -183,22 +205,33 @@ SYMBOL TABLE SSA (byte) CIA_TIMER_CONTROL_STOP#0 (byte*) SCREEN (byte*) SCREEN#0 +(dword()) clock() +(number~) clock::$0 +(label) clock::@return +(dword) clock::return +(dword) clock::return#0 +(dword) clock::return#1 +(dword) clock::return#2 +(dword) clock::return#3 +(dword) clock::return#4 +(void()) clock_start() +(byte~) clock_start::$0 +(byte~) clock_start::$1 +(byte~) clock_start::$2 +(byte~) clock_start::$3 +(byte~) clock_start::$4 +(byte~) clock_start::$5 +(byte~) clock_start::$6 +(byte~) clock_start::$7 +(label) clock_start::@return (void()) main() -(byte~) main::$0 -(byte~) main::$1 -(byte~) main::$2 -(byte~) main::$3 -(byte~) main::$4 -(byte~) main::$5 -(byte~) main::$6 -(byte~) main::$7 -(dword~) main::$8 +(dword~) main::$1 (label) main::@1 (label) main::@2 (label) main::@7 +(label) main::@8 +(label) main::@9 (label) main::@return -(dword) main::TIMER_INIT -(dword) main::TIMER_INIT#0 (void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) (byte~) print_byte_at::$0 (number~) print_byte_at::$2 @@ -266,13 +299,15 @@ Adding number conversion cast (unumber) 1 in (byte) CIA_TIMER_CONTROL_START#0 Adding number conversion cast (unumber) 0 in (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (number) 0 Adding number conversion cast (unumber) 0 in (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (number) 0 Adding number conversion cast (unumber) $40 in (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (number) $40 +Adding number conversion cast (unumber) $ffffffff in (number~) clock::$0 ← (number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) +Adding number conversion cast (unumber) clock::$0 in (number~) clock::$0 ← (unumber)(number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) +Adding number conversion cast (unumber) $ffffffff in *((dword*) CIA2_TIMER_AB#0) ← (number) $ffffffff Adding number conversion cast (unumber) 2 in (byte*~) print_word_at::$3 ← (byte*) print_word_at::at#3 + (number) 2 Adding number conversion cast (unumber) 4 in (byte*~) print_dword_at::$3 ← (byte*) print_dword_at::at#2 + (number) 4 Adding number conversion cast (unumber) 4 in (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (number) 4 Adding number conversion cast (unumber) $f in (number~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (number) $f Adding number conversion cast (unumber) print_byte_at::$2 in (number~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (unumber)(number) $f Adding number conversion cast (unumber) 1 in (byte*~) print_byte_at::$3 ← (byte*) print_byte_at::at#3 + (number) 1 -Adding number conversion cast (unumber) $ffffffff in (dword) main::TIMER_INIT#0 ← (number) $ffffffff Successful SSA optimization PassNAddNumberTypeConversions Inlining cast (dword*) CIA2_TIMER_AB#0 ← (dword*)(number) $dd04 Inlining cast (byte*) CIA2_TIMER_A_CONTROL#0 ← (byte*)(number) $dd0e @@ -282,8 +317,8 @@ Inlining cast (byte) CIA_TIMER_CONTROL_START#0 ← (unumber)(number) 1 Inlining cast (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (unumber)(number) 0 Inlining cast (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (unumber)(number) 0 Inlining cast (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (unumber)(number) $40 +Inlining cast *((dword*) CIA2_TIMER_AB#0) ← (unumber)(number) $ffffffff Inlining cast (byte*) SCREEN#0 ← (byte*)(number) $400 -Inlining cast (dword) main::TIMER_INIT#0 ← (unumber)(number) $ffffffff Successful SSA optimization Pass2InlineCast Simplifying constant pointer cast (dword*) 56580 Simplifying constant pointer cast (byte*) 56590 @@ -293,27 +328,31 @@ Simplifying constant integer cast 1 Simplifying constant integer cast 0 Simplifying constant integer cast 0 Simplifying constant integer cast $40 +Simplifying constant integer cast $ffffffff +Simplifying constant integer cast $ffffffff Simplifying constant integer cast 2 Simplifying constant integer cast 4 Simplifying constant integer cast 4 Simplifying constant integer cast $f Simplifying constant integer cast 1 Simplifying constant pointer cast (byte*) 1024 -Simplifying constant integer cast $ffffffff Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $40 +Finalized unsigned number type (dword) $ffffffff +Finalized unsigned number type (dword) $ffffffff Finalized unsigned number type (byte) 2 Finalized unsigned number type (byte) 4 Finalized unsigned number type (byte) 4 Finalized unsigned number type (byte) $f Finalized unsigned number type (byte) 1 -Finalized unsigned number type (dword) $ffffffff Successful SSA optimization PassNFinalizeNumberTypeConversions +Inferred type updated to dword in (unumber~) clock::$0 ← (dword) $ffffffff - *((dword*) CIA2_TIMER_AB#0) Inferred type updated to byte in (unumber~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (byte) $f +Alias (dword) clock::return#0 = (dword~) clock::$0 (dword) clock::return#3 (dword) clock::return#1 Alias (byte) print_byte_at::b#0 = (byte~) print_word_at::$0 Alias (word) print_word_at::w#2 = (word) print_word_at::w#3 Alias (byte*) print_word_at::at#2 = (byte*) print_word_at::at#3 @@ -327,13 +366,14 @@ Alias (byte*) print_word_at::at#1 = (byte*~) print_dword_at::$3 Alias (byte) print_byte_at::b#2 = (byte) print_byte_at::b#3 Alias (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#3 Alias (byte*) print_char_at::at#1 = (byte*~) print_byte_at::$3 -Alias (dword) print_dword_at::dw#0 = (dword~) main::$8 +Alias (dword) clock::return#2 = (dword) clock::return#4 +Alias (dword) print_dword_at::dw#0 = (dword~) main::$1 Successful SSA optimization Pass2AliasElimination Identical Phi Values (dword) print_dword_at::dw#1 (dword) print_dword_at::dw#0 Identical Phi Values (byte*) print_dword_at::at#1 (byte*) print_dword_at::at#0 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [54] (byte~) main::$2 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -Identified duplicate assignment right side [61] (byte~) main::$6 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Identified duplicate assignment right side [16] (byte~) clock_start::$2 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Identified duplicate assignment right side [23] (byte~) clock_start::$6 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 Successful SSA optimization Pass2DuplicateRValueIdentification Constant (const dword*) CIA2_TIMER_AB#0 = (dword*) 56580 Constant (const byte*) CIA2_TIMER_A_CONTROL#0 = (byte*) 56590 @@ -345,65 +385,67 @@ Constant (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 = 0 Constant (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 = $40 Constant (const byte[]) print_hextab#0 = $0 Constant (const byte*) SCREEN#0 = (byte*) 1024 -Constant (const dword) main::TIMER_INIT#0 = $ffffffff Successful SSA optimization Pass2ConstantIdentification Constant (const byte*) print_dword_at::at#0 = SCREEN#0 Successful SSA optimization Pass2ConstantIdentification Constant (const byte*) print_word_at::at#0 = print_dword_at::at#0 Successful SSA optimization Pass2ConstantIdentification -if() condition always true - replacing block destination [64] if(true) goto main::@2 +if() condition always true - replacing block destination [69] if(true) goto main::@2 Successful SSA optimization Pass2ConstantIfs -Simplifying expression containing zero CIA_TIMER_CONTROL_CONTINUOUS#0 in [51] (byte~) main::$0 ← (const byte) CIA_TIMER_CONTROL_STOP#0 | (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -Simplifying expression containing zero main::$0 in [52] (byte~) main::$1 ← (byte~) main::$0 | (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 -Simplifying expression containing zero CIA_TIMER_CONTROL_START#0 in [58] (byte~) main::$4 ← (const byte) CIA_TIMER_CONTROL_START#0 | (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -Simplifying expression containing zero main::$6 in [62] (byte~) main::$7 ← (byte~) main::$6 | (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 +Simplifying expression containing zero CIA_TIMER_CONTROL_CONTINUOUS#0 in [13] (byte~) clock_start::$0 ← (const byte) CIA_TIMER_CONTROL_STOP#0 | (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Simplifying expression containing zero clock_start::$0 in [14] (byte~) clock_start::$1 ← (byte~) clock_start::$0 | (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 +Simplifying expression containing zero CIA_TIMER_CONTROL_START#0 in [20] (byte~) clock_start::$4 ← (const byte) CIA_TIMER_CONTROL_START#0 | (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Simplifying expression containing zero clock_start::$6 in [24] (byte~) clock_start::$7 ← (byte~) clock_start::$6 | (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant (const byte) CIA_TIMER_CONTROL_STOP#0 Eliminating unused constant (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 Successful SSA optimization PassNEliminateUnusedVars Removing unused block main::@return Successful SSA optimization Pass2EliminateUnusedBlocks -Alias (byte~) main::$1 = (byte~) main::$0 (byte~) main::$2 -Alias (byte~) main::$6 = (byte~) main::$4 (byte~) main::$7 +Alias (byte~) clock_start::$1 = (byte~) clock_start::$0 (byte~) clock_start::$2 +Alias (byte~) clock_start::$6 = (byte~) clock_start::$4 (byte~) clock_start::$7 Successful SSA optimization Pass2AliasElimination -Constant right-side identified [11] (byte*) print_word_at::at#1 ← (const byte*) print_dword_at::at#0 + (byte) 4 +Constant right-side identified [27] (byte*) print_word_at::at#1 ← (const byte*) print_dword_at::at#0 + (byte) 4 Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) clock_start::$1 = CIA_TIMER_CONTROL_CONTINUOUS#0 +Constant (const byte) clock_start::$6 = CIA_TIMER_CONTROL_START#0 Constant (const byte*) print_word_at::at#1 = print_dword_at::at#0+4 -Constant (const byte) main::$1 = CIA_TIMER_CONTROL_CONTINUOUS#0 -Constant (const byte) main::$6 = CIA_TIMER_CONTROL_START#0 Successful SSA optimization Pass2ConstantIdentification -Simplifying expression containing zero CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 in [32] (byte~) main::$3 ← (const byte) main::$1 | (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Simplifying expression containing zero CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 in [6] (byte~) clock_start::$3 ← (const byte) clock_start::$1 | (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 Successful SSA optimization PassNSimplifyExpressionWithZero -Constant right-side identified [31] (byte~) main::$5 ← (const byte) main::$6 | (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Constant right-side identified [6] (byte~) clock_start::$5 ← (const byte) clock_start::$6 | (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant (const byte) main::$3 = CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -Constant (const byte) main::$5 = main::$6|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Constant (const byte) clock_start::$3 = CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Constant (const byte) clock_start::$5 = clock_start::$6|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 Successful SSA optimization Pass2ConstantIdentification Inlining constant with var siblings (const byte*) print_word_at::at#0 Inlining constant with var siblings (const byte*) print_word_at::at#1 -Constant inlined main::$1 = (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Constant inlined clock_start::$1 = (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 Constant inlined print_dword_at::at#0 = (const byte*) SCREEN#0 -Constant inlined main::$5 = (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -Constant inlined main::$6 = (const byte) CIA_TIMER_CONTROL_START#0 -Constant inlined main::$3 = (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 Constant inlined print_word_at::at#1 = (const byte*) SCREEN#0+(byte) 4 Constant inlined print_word_at::at#0 = (const byte*) SCREEN#0 Constant inlined $0 = (const byte[]) print_hextab#0 +Constant inlined clock_start::$5 = (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Constant inlined clock_start::$6 = (const byte) CIA_TIMER_CONTROL_START#0 +Constant inlined clock_start::$3 = (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 Successful SSA optimization Pass2ConstantInlining Adding NOP phi() at start of @begin -Adding NOP phi() at start of @18 -Adding NOP phi() at start of @25 -Adding NOP phi() at start of @26 +Adding NOP phi() at start of @20 Adding NOP phi() at start of @27 +Adding NOP phi() at start of @28 +Adding NOP phi() at start of @29 Adding NOP phi() at start of @end -Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@9 Adding NOP phi() at start of print_dword_at::@2 Adding NOP phi() at start of print_word_at::@2 Adding NOP phi() at start of print_byte_at::@2 CALL GRAPH Calls in [] to main:4 -Calls in [main] to print_dword_at:15 +Calls in [main] to clock_start:8 clock:12 print_dword_at:15 Calls in [print_dword_at] to print_word_at:19 print_word_at:22 Calls in [print_word_at] to print_byte_at:30 print_byte_at:35 Calls in [print_byte_at] to print_char_at:44 print_char_at:50 @@ -420,19 +462,23 @@ Coalesced [43] print_char_at::at#3 ← print_char_at::at#0 Coalesced [48] print_char_at::ch#4 ← print_char_at::ch#1 Coalesced [49] print_char_at::at#4 ← print_char_at::at#1 Coalesced down to 6 phi equivalence classes -Culled Empty Block (label) @18 -Culled Empty Block (label) @25 +Culled Empty Block (label) @20 Culled Empty Block (label) @27 -Culled Empty Block (label) main::@1 +Culled Empty Block (label) @29 Culled Empty Block (label) main::@7 +Culled Empty Block (label) main::@1 +Culled Empty Block (label) main::@9 Culled Empty Block (label) print_dword_at::@2 Culled Empty Block (label) print_word_at::@2 Culled Empty Block (label) print_byte_at::@2 -Renumbering block @26 to @1 +Renumbering block @28 to @1 Renumbering block main::@2 to main::@1 +Renumbering block main::@8 to main::@2 Adding NOP phi() at start of @begin Adding NOP phi() at start of @1 Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 FINAL CONTROL FLOW GRAPH @begin: scope:[] from @@ -445,67 +491,84 @@ FINAL CONTROL FLOW GRAPH @end: scope:[] from @1 [3] phi() main: scope:[main] from @1 - asm { sei } - [5] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 - [6] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 - [7] *((const dword*) CIA2_TIMER_AB#0) ← (const dword) main::TIMER_INIT#0 - [8] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 - [9] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 + [4] phi() + [5] call clock_start to:main::@1 -main::@1: scope:[main] from main main::@1 - [10] (dword) print_dword_at::dw#0 ← (const dword) main::TIMER_INIT#0 - *((const dword*) CIA2_TIMER_AB#0) - [11] call print_dword_at +main::@1: scope:[main] from main main::@2 + [6] phi() + [7] call clock + [8] (dword) clock::return#2 ← (dword) clock::return#0 + to:main::@2 +main::@2: scope:[main] from main::@1 + [9] (dword) print_dword_at::dw#0 ← (dword) clock::return#2 + [10] call print_dword_at to:main::@1 -print_dword_at: scope:[print_dword_at] from main::@1 - [12] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 - [13] call print_word_at +print_dword_at: scope:[print_dword_at] from main::@2 + [11] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 + [12] call print_word_at to:print_dword_at::@1 print_dword_at::@1: scope:[print_dword_at] from print_dword_at - [14] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 - [15] call print_word_at + [13] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 + [14] call print_word_at to:print_dword_at::@return print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@1 - [16] return + [15] return to:@return print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 - [17] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const byte*) SCREEN#0 print_dword_at::@1/(const byte*) SCREEN#0+(byte) 4 ) - [17] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) - [18] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 - [19] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 - [20] call print_byte_at + [16] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const byte*) SCREEN#0 print_dword_at::@1/(const byte*) SCREEN#0+(byte) 4 ) + [16] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) + [17] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 + [18] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + [19] call print_byte_at to:print_word_at::@1 print_word_at::@1: scope:[print_word_at] from print_word_at - [21] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 - [22] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 - [23] call print_byte_at + [20] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 + [21] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 + [22] call print_byte_at to:print_word_at::@return print_word_at::@return: scope:[print_word_at] from print_word_at::@1 - [24] return + [23] return to:@return print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 - [25] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) - [25] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) - [26] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 - [27] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) - [28] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 - [29] call print_char_at + [24] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) + [24] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) + [25] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 + [26] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + [27] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 + [28] call print_char_at to:print_byte_at::@1 print_byte_at::@1: scope:[print_byte_at] from print_byte_at - [30] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f - [31] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 - [32] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) - [33] call print_char_at + [29] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f + [30] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 + [31] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) + [32] call print_char_at to:print_byte_at::@return print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1 - [34] return + [33] return to:@return print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 - [35] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) - [35] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) - [36] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 + [34] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) + [34] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) + [35] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 to:print_char_at::@return print_char_at::@return: scope:[print_char_at] from print_char_at - [37] return + [36] return + to:@return +clock: scope:[clock] from main::@1 + [37] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) + to:clock::@return +clock::@return: scope:[clock] from clock + [38] return + to:@return +clock_start: scope:[clock_start] from main + [39] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + [40] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [41] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff + [42] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [43] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + [44] return to:@return @@ -519,8 +582,12 @@ VARIABLE REGISTER WEIGHTS (byte) CIA_TIMER_CONTROL_START (byte) CIA_TIMER_CONTROL_STOP (byte*) SCREEN +(dword()) clock() +(dword) clock::return +(dword) clock::return#0 4.333333333333333 +(dword) clock::return#2 22.0 +(void()) clock_start() (void()) main() -(dword) main::TIMER_INIT (void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) (byte~) print_byte_at::$0 4.0 (byte~) print_byte_at::$2 2.0 @@ -561,9 +628,11 @@ Initial phi equivalence classes [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Added variable clock::return#2 to zero page equivalence class [ clock::return#2 ] Added variable print_dword_at::dw#0 to zero page equivalence class [ print_dword_at::dw#0 ] Added variable print_byte_at::$0 to zero page equivalence class [ print_byte_at::$0 ] Added variable print_byte_at::$2 to zero page equivalence class [ print_byte_at::$2 ] +Added variable clock::return#0 to zero page equivalence class [ clock::return#0 ] Complete equivalence classes [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] [ print_word_at::at#2 ] @@ -571,18 +640,22 @@ Complete equivalence classes [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +[ clock::return#2 ] [ print_dword_at::dw#0 ] [ print_byte_at::$0 ] [ print_byte_at::$2 ] +[ clock::return#0 ] Allocated zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] Allocated zp ZP_WORD:4 [ print_word_at::at#2 ] Allocated zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] Allocated zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] Allocated zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] Allocated zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] -Allocated zp ZP_DWORD:12 [ print_dword_at::dw#0 ] -Allocated zp ZP_BYTE:16 [ print_byte_at::$0 ] -Allocated zp ZP_BYTE:17 [ print_byte_at::$2 ] +Allocated zp ZP_DWORD:12 [ clock::return#2 ] +Allocated zp ZP_DWORD:16 [ print_dword_at::dw#0 ] +Allocated zp ZP_BYTE:20 [ print_byte_at::$0 ] +Allocated zp ZP_BYTE:21 [ print_byte_at::$2 ] +Allocated zp ZP_DWORD:22 [ clock::return#0 ] INITIAL ASM //SEG0 File Comments @@ -613,103 +686,93 @@ b1_from_bbegin: //SEG5 @1 b1: //SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: jsr main -//SEG7 [3] phi from @1 to @end [phi:@1->@end] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] bend_from_b1: jmp bend -//SEG8 @end +//SEG9 @end bend: -//SEG9 main +//SEG10 main main: { - // Timer AB initial value - .const TIMER_INIT = $ffffffff - //SEG10 asm { sei } - sei - //SEG11 [5] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 - // Setup CIA#2 timer A to count (down) CPU cycles - lda #CIA_TIMER_CONTROL_CONTINUOUS - sta CIA2_TIMER_A_CONTROL - //SEG12 [6] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A - sta CIA2_TIMER_B_CONTROL - //SEG13 [7] *((const dword*) CIA2_TIMER_AB#0) ← (const dword) main::TIMER_INIT#0 -- _deref_pduc1=vduc2 - lda #TIMER_INIT - sta CIA2_TIMER_AB+1 - lda #>$10 - sta CIA2_TIMER_AB+2 - lda #>TIMER_INIT>>$10 - sta CIA2_TIMER_AB+3 - //SEG14 [8] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A - sta CIA2_TIMER_B_CONTROL - //SEG15 [9] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_START - sta CIA2_TIMER_A_CONTROL + //SEG11 [5] call clock_start + jsr clock_start + //SEG12 [6] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1] + b1_from_main: + b1_from_b2: jmp b1 - //SEG16 main::@1 + //SEG13 main::@1 b1: - //SEG17 [10] (dword) print_dword_at::dw#0 ← (const dword) main::TIMER_INIT#0 - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 - lda #TIMER_INIT - sbc CIA2_TIMER_AB+1 + lda clock.return_2+1 sta print_dword_at.dw+1 - lda #>$10 - sbc CIA2_TIMER_AB+2 + lda clock.return_2+2 sta print_dword_at.dw+2 - lda #>TIMER_INIT>>$10 - sbc CIA2_TIMER_AB+3 + lda clock.return_2+3 sta print_dword_at.dw+3 - //SEG18 [11] call print_dword_at + //SEG18 [10] call print_dword_at jsr print_dword_at - jmp b1 + jmp b1_from_b2 } //SEG19 print_dword_at // Print a dword as HEX at a specific position -// print_dword_at(dword zeropage($c) dw) +// print_dword_at(dword zeropage($10) dw) print_dword_at: { - .label dw = $c - //SEG20 [12] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + .label dw = $10 + //SEG20 [11] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 lda dw+2 sta print_word_at.w lda dw+3 sta print_word_at.w+1 - //SEG21 [13] call print_word_at - //SEG22 [17] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + //SEG21 [12] call print_word_at + //SEG22 [16] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] print_word_at_from_print_dword_at: - //SEG23 [17] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + //SEG23 [16] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 lda #SCREEN sta print_word_at.at+1 - //SEG24 [17] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + //SEG24 [16] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy jsr print_word_at jmp b1 //SEG25 print_dword_at::@1 b1: - //SEG26 [14] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + //SEG26 [13] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 lda dw sta print_word_at.w lda dw+1 sta print_word_at.w+1 - //SEG27 [15] call print_word_at - //SEG28 [17] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + //SEG27 [14] call print_word_at + //SEG28 [16] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] print_word_at_from_b1: - //SEG29 [17] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + //SEG29 [16] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 lda #SCREEN+4 sta print_word_at.at+1 - //SEG30 [17] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + //SEG30 [16] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy jsr print_word_at jmp breturn //SEG31 print_dword_at::@return breturn: - //SEG32 [16] return + //SEG32 [15] return rts } //SEG33 print_word_at @@ -718,27 +781,27 @@ print_dword_at: { print_word_at: { .label w = 2 .label at = 4 - //SEG34 [18] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + //SEG34 [17] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 lda w+1 sta print_byte_at.b - //SEG35 [19] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 -- pbuz1=pbuz2 + //SEG35 [18] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 -- pbuz1=pbuz2 lda at sta print_byte_at.at lda at+1 sta print_byte_at.at+1 - //SEG36 [20] call print_byte_at - //SEG37 [25] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + //SEG36 [19] call print_byte_at + //SEG37 [24] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] print_byte_at_from_print_word_at: - //SEG38 [25] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy - //SEG39 [25] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + //SEG38 [24] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG39 [24] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy jsr print_byte_at jmp b1 //SEG40 print_word_at::@1 b1: - //SEG41 [21] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + //SEG41 [20] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 lda w sta print_byte_at.b - //SEG42 [22] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz2_plus_2 + //SEG42 [21] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz2_plus_2 lda at clc adc #2 @@ -746,56 +809,56 @@ print_word_at: { lda at+1 adc #0 sta print_byte_at.at+1 - //SEG43 [23] call print_byte_at - //SEG44 [25] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + //SEG43 [22] call print_byte_at + //SEG44 [24] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] print_byte_at_from_b1: - //SEG45 [25] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy - //SEG46 [25] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + //SEG45 [24] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG46 [24] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy jsr print_byte_at jmp breturn //SEG47 print_word_at::@return breturn: - //SEG48 [24] return + //SEG48 [23] return rts } //SEG49 print_byte_at // Print a byte as HEX at a specific position // print_byte_at(byte zeropage(6) b, byte* zeropage(7) at) print_byte_at: { - .label _0 = $10 - .label _2 = $11 + .label _0 = $14 + .label _2 = $15 .label b = 6 .label at = 7 - //SEG50 [26] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4 + //SEG50 [25] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4 lda b lsr lsr lsr lsr sta _0 - //SEG51 [27] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuz1=pbuc1_derefidx_vbuz2 + //SEG51 [26] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuz1=pbuc1_derefidx_vbuz2 ldy _0 lda print_hextab,y sta print_char_at.ch - //SEG52 [28] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + //SEG52 [27] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 lda at sta print_char_at.at lda at+1 sta print_char_at.at+1 - //SEG53 [29] call print_char_at - //SEG54 [35] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + //SEG53 [28] call print_char_at + //SEG54 [34] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] print_char_at_from_print_byte_at: - //SEG55 [35] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy - //SEG56 [35] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + //SEG55 [34] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG56 [34] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy jsr print_char_at jmp b1 //SEG57 print_byte_at::@1 b1: - //SEG58 [30] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + //SEG58 [29] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 lda #$f and b sta _2 - //SEG59 [31] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + //SEG59 [30] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 lda at clc adc #1 @@ -803,20 +866,20 @@ print_byte_at: { lda at+1 adc #0 sta print_char_at.at+1 - //SEG60 [32] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuz1=pbuc1_derefidx_vbuz2 + //SEG60 [31] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuz1=pbuc1_derefidx_vbuz2 ldy _2 lda print_hextab,y sta print_char_at.ch - //SEG61 [33] call print_char_at - //SEG62 [35] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + //SEG61 [32] call print_char_at + //SEG62 [34] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] print_char_at_from_b1: - //SEG63 [35] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy - //SEG64 [35] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + //SEG63 [34] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG64 [34] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy jsr print_char_at jmp breturn //SEG65 print_byte_at::@return breturn: - //SEG66 [34] return + //SEG66 [33] return rts } //SEG67 print_char_at @@ -825,87 +888,157 @@ print_byte_at: { print_char_at: { .label ch = 9 .label at = $a - //SEG68 [36] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuz2 + //SEG68 [35] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuz2 lda ch ldy #0 sta (at),y jmp breturn //SEG69 print_char_at::@return breturn: - //SEG70 [37] return + //SEG70 [36] return rts } -//SEG71 File Data +//SEG71 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = $16 + .label return_2 = $c + //SEG72 [37] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + jmp breturn + //SEG73 clock::@return + breturn: + //SEG74 [38] return + rts +} +//SEG75 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG76 [39] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG77 [40] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG78 [41] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG79 [42] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG80 [43] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + jmp breturn + //SEG81 clock_start::@return + breturn: + //SEG82 [44] return + rts +} +//SEG83 File Data print_hextab: .text "0123456789abcdef" REGISTER UPLIFT POTENTIAL REGISTERS -Statement [5] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [6] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [7] *((const dword*) CIA2_TIMER_AB#0) ← (const dword) main::TIMER_INIT#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [8] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [9] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [10] (dword) print_dword_at::dw#0 ← (const dword) main::TIMER_INIT#0 - *((const dword*) CIA2_TIMER_AB#0) [ print_dword_at::dw#0 ] ( main:2 [ print_dword_at::dw#0 ] ) always clobbers reg byte a -Statement [12] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 [ print_dword_at::dw#0 print_word_at::w#0 ] ( main:2::print_dword_at:11 [ print_dword_at::dw#0 print_word_at::w#0 ] ) always clobbers reg byte a -Statement [14] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 [ print_word_at::w#1 ] ( main:2::print_dword_at:11 [ print_word_at::w#1 ] ) always clobbers reg byte a -Statement [18] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ( main:2::print_dword_at:11::print_word_at:13 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] main:2::print_dword_at:11::print_word_at:15 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ) always clobbers reg byte a -Statement [19] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ( main:2::print_dword_at:11::print_word_at:13 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] main:2::print_dword_at:11::print_word_at:15 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ) always clobbers reg byte a +Statement [8] (dword) clock::return#2 ← (dword) clock::return#0 [ clock::return#2 ] ( main:2 [ clock::return#2 ] ) always clobbers reg byte a +Statement [9] (dword) print_dword_at::dw#0 ← (dword) clock::return#2 [ print_dword_at::dw#0 ] ( main:2 [ print_dword_at::dw#0 ] ) always clobbers reg byte a +Statement [11] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 [ print_dword_at::dw#0 print_word_at::w#0 ] ( main:2::print_dword_at:10 [ print_dword_at::dw#0 print_word_at::w#0 ] ) always clobbers reg byte a +Statement [13] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 [ print_word_at::w#1 ] ( main:2::print_dword_at:10 [ print_word_at::w#1 ] ) always clobbers reg byte a +Statement [17] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ( main:2::print_dword_at:10::print_word_at:12 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] main:2::print_dword_at:10::print_word_at:14 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ) always clobbers reg byte a +Statement [18] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ( main:2::print_dword_at:10::print_word_at:12 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] main:2::print_dword_at:10::print_word_at:14 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] -Statement [21] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 [ print_word_at::at#2 print_byte_at::b#1 ] ( main:2::print_dword_at:11::print_word_at:13 [ print_dword_at::dw#0 print_word_at::at#2 print_byte_at::b#1 ] main:2::print_dword_at:11::print_word_at:15 [ print_word_at::at#2 print_byte_at::b#1 ] ) always clobbers reg byte a -Statement [22] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 [ print_byte_at::b#1 print_byte_at::at#1 ] ( main:2::print_dword_at:11::print_word_at:13 [ print_dword_at::dw#0 print_byte_at::b#1 print_byte_at::at#1 ] main:2::print_dword_at:11::print_word_at:15 [ print_byte_at::b#1 print_byte_at::at#1 ] ) always clobbers reg byte a -Statement [26] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ) always clobbers reg byte a -Statement [28] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ) always clobbers reg byte a +Statement [20] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 [ print_word_at::at#2 print_byte_at::b#1 ] ( main:2::print_dword_at:10::print_word_at:12 [ print_dword_at::dw#0 print_word_at::at#2 print_byte_at::b#1 ] main:2::print_dword_at:10::print_word_at:14 [ print_word_at::at#2 print_byte_at::b#1 ] ) always clobbers reg byte a +Statement [21] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 [ print_byte_at::b#1 print_byte_at::at#1 ] ( main:2::print_dword_at:10::print_word_at:12 [ print_dword_at::dw#0 print_byte_at::b#1 print_byte_at::at#1 ] main:2::print_dword_at:10::print_word_at:14 [ print_byte_at::b#1 print_byte_at::at#1 ] ) always clobbers reg byte a +Statement [25] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ) always clobbers reg byte a +Statement [27] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] -Statement [30] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f [ print_byte_at::at#2 print_byte_at::$2 ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23 [ print_dword_at::dw#0 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23 [ print_byte_at::at#2 print_byte_at::$2 ] ) always clobbers reg byte a -Statement [31] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 [ print_byte_at::$2 print_char_at::at#1 ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23 [ print_dword_at::dw#0 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23 [ print_byte_at::$2 print_char_at::at#1 ] ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:17 [ print_byte_at::$2 ] -Statement [36] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 [ ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20::print_char_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20::print_char_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23::print_char_at:29 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23::print_char_at:29 [ print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:20::print_char_at:33 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20::print_char_at:33 [ print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23::print_char_at:33 [ print_dword_at::dw#0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23::print_char_at:33 [ ] ) always clobbers reg byte a reg byte y +Statement [29] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f [ print_byte_at::at#2 print_byte_at::$2 ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22 [ print_dword_at::dw#0 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22 [ print_byte_at::at#2 print_byte_at::$2 ] ) always clobbers reg byte a +Statement [30] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 [ print_byte_at::$2 print_char_at::at#1 ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22 [ print_dword_at::dw#0 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22 [ print_byte_at::$2 print_char_at::at#1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:21 [ print_byte_at::$2 ] +Statement [35] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 [ ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19::print_char_at:28 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19::print_char_at:28 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22::print_char_at:28 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22::print_char_at:28 [ print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:19::print_char_at:32 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19::print_char_at:32 [ print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22::print_char_at:32 [ print_dword_at::dw#0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22::print_char_at:32 [ ] ) always clobbers reg byte a reg byte y Removing always clobbered register reg byte y as potential for zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] -Statement [5] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [6] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [7] *((const dword*) CIA2_TIMER_AB#0) ← (const dword) main::TIMER_INIT#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [8] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [9] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [10] (dword) print_dword_at::dw#0 ← (const dword) main::TIMER_INIT#0 - *((const dword*) CIA2_TIMER_AB#0) [ print_dword_at::dw#0 ] ( main:2 [ print_dword_at::dw#0 ] ) always clobbers reg byte a -Statement [12] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 [ print_dword_at::dw#0 print_word_at::w#0 ] ( main:2::print_dword_at:11 [ print_dword_at::dw#0 print_word_at::w#0 ] ) always clobbers reg byte a -Statement [14] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 [ print_word_at::w#1 ] ( main:2::print_dword_at:11 [ print_word_at::w#1 ] ) always clobbers reg byte a -Statement [18] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ( main:2::print_dword_at:11::print_word_at:13 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] main:2::print_dword_at:11::print_word_at:15 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ) always clobbers reg byte a -Statement [19] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ( main:2::print_dword_at:11::print_word_at:13 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] main:2::print_dword_at:11::print_word_at:15 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ) always clobbers reg byte a -Statement [21] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 [ print_word_at::at#2 print_byte_at::b#1 ] ( main:2::print_dword_at:11::print_word_at:13 [ print_dword_at::dw#0 print_word_at::at#2 print_byte_at::b#1 ] main:2::print_dword_at:11::print_word_at:15 [ print_word_at::at#2 print_byte_at::b#1 ] ) always clobbers reg byte a -Statement [22] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 [ print_byte_at::b#1 print_byte_at::at#1 ] ( main:2::print_dword_at:11::print_word_at:13 [ print_dword_at::dw#0 print_byte_at::b#1 print_byte_at::at#1 ] main:2::print_dword_at:11::print_word_at:15 [ print_byte_at::b#1 print_byte_at::at#1 ] ) always clobbers reg byte a -Statement [26] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ) always clobbers reg byte a -Statement [28] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ) always clobbers reg byte a -Statement [30] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f [ print_byte_at::at#2 print_byte_at::$2 ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23 [ print_dword_at::dw#0 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23 [ print_byte_at::at#2 print_byte_at::$2 ] ) always clobbers reg byte a -Statement [31] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 [ print_byte_at::$2 print_char_at::at#1 ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23 [ print_dword_at::dw#0 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23 [ print_byte_at::$2 print_char_at::at#1 ] ) always clobbers reg byte a -Statement [36] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 [ ] ( main:2::print_dword_at:11::print_word_at:13::print_byte_at:20::print_char_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20::print_char_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23::print_char_at:29 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23::print_char_at:29 [ print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:20::print_char_at:33 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:20::print_char_at:33 [ print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:11::print_word_at:13::print_byte_at:23::print_char_at:33 [ print_dword_at::dw#0 ] main:2::print_dword_at:11::print_word_at:15::print_byte_at:23::print_char_at:33 [ ] ) always clobbers reg byte a reg byte y +Statement [37] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) [ clock::return#0 ] ( main:2::clock:7 [ clock::return#0 ] ) always clobbers reg byte a +Statement [39] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [40] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [41] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [42] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [43] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [8] (dword) clock::return#2 ← (dword) clock::return#0 [ clock::return#2 ] ( main:2 [ clock::return#2 ] ) always clobbers reg byte a +Statement [9] (dword) print_dword_at::dw#0 ← (dword) clock::return#2 [ print_dword_at::dw#0 ] ( main:2 [ print_dword_at::dw#0 ] ) always clobbers reg byte a +Statement [11] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 [ print_dword_at::dw#0 print_word_at::w#0 ] ( main:2::print_dword_at:10 [ print_dword_at::dw#0 print_word_at::w#0 ] ) always clobbers reg byte a +Statement [13] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 [ print_word_at::w#1 ] ( main:2::print_dword_at:10 [ print_word_at::w#1 ] ) always clobbers reg byte a +Statement [17] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ( main:2::print_dword_at:10::print_word_at:12 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] main:2::print_dword_at:10::print_word_at:14 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ) always clobbers reg byte a +Statement [18] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ( main:2::print_dword_at:10::print_word_at:12 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] main:2::print_dword_at:10::print_word_at:14 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ) always clobbers reg byte a +Statement [20] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 [ print_word_at::at#2 print_byte_at::b#1 ] ( main:2::print_dword_at:10::print_word_at:12 [ print_dword_at::dw#0 print_word_at::at#2 print_byte_at::b#1 ] main:2::print_dword_at:10::print_word_at:14 [ print_word_at::at#2 print_byte_at::b#1 ] ) always clobbers reg byte a +Statement [21] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 [ print_byte_at::b#1 print_byte_at::at#1 ] ( main:2::print_dword_at:10::print_word_at:12 [ print_dword_at::dw#0 print_byte_at::b#1 print_byte_at::at#1 ] main:2::print_dword_at:10::print_word_at:14 [ print_byte_at::b#1 print_byte_at::at#1 ] ) always clobbers reg byte a +Statement [25] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ) always clobbers reg byte a +Statement [27] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ) always clobbers reg byte a +Statement [29] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f [ print_byte_at::at#2 print_byte_at::$2 ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22 [ print_dword_at::dw#0 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22 [ print_byte_at::at#2 print_byte_at::$2 ] ) always clobbers reg byte a +Statement [30] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 [ print_byte_at::$2 print_char_at::at#1 ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22 [ print_dword_at::dw#0 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22 [ print_byte_at::$2 print_char_at::at#1 ] ) always clobbers reg byte a +Statement [35] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 [ ] ( main:2::print_dword_at:10::print_word_at:12::print_byte_at:19::print_char_at:28 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19::print_char_at:28 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22::print_char_at:28 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22::print_char_at:28 [ print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:19::print_char_at:32 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:19::print_char_at:32 [ print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:10::print_word_at:12::print_byte_at:22::print_char_at:32 [ print_dword_at::dw#0 ] main:2::print_dword_at:10::print_word_at:14::print_byte_at:22::print_char_at:32 [ ] ) always clobbers reg byte a reg byte y +Statement [37] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) [ clock::return#0 ] ( main:2::clock:7 [ clock::return#0 ] ) always clobbers reg byte a +Statement [39] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [40] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [41] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [42] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a +Statement [43] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 [ ] ( main:2::clock_start:5 [ ] ) always clobbers reg byte a Potential registers zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] : zp ZP_WORD:2 , Potential registers zp ZP_WORD:4 [ print_word_at::at#2 ] : zp ZP_WORD:4 , Potential registers zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] : zp ZP_BYTE:6 , reg byte x , Potential registers zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] : zp ZP_WORD:7 , Potential registers zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , Potential registers zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] : zp ZP_WORD:10 , -Potential registers zp ZP_DWORD:12 [ print_dword_at::dw#0 ] : zp ZP_DWORD:12 , -Potential registers zp ZP_BYTE:16 [ print_byte_at::$0 ] : zp ZP_BYTE:16 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:17 [ print_byte_at::$2 ] : zp ZP_BYTE:17 , reg byte x , reg byte y , +Potential registers zp ZP_DWORD:12 [ clock::return#2 ] : zp ZP_DWORD:12 , +Potential registers zp ZP_DWORD:16 [ print_dword_at::dw#0 ] : zp ZP_DWORD:16 , +Potential registers zp ZP_BYTE:20 [ print_byte_at::$0 ] : zp ZP_BYTE:20 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:21 [ print_byte_at::$2 ] : zp ZP_BYTE:21 , reg byte x , reg byte y , +Potential registers zp ZP_DWORD:22 [ clock::return#0 ] : zp ZP_DWORD:22 , REGISTER UPLIFT SCOPES +Uplift Scope [clock] 22: zp ZP_DWORD:12 [ clock::return#2 ] 4.33: zp ZP_DWORD:22 [ clock::return#0 ] Uplift Scope [print_char_at] 12: zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] 12: zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] -Uplift Scope [print_byte_at] 9.33: zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] 5.6: zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] 4: zp ZP_BYTE:16 [ print_byte_at::$0 ] 2: zp ZP_BYTE:17 [ print_byte_at::$2 ] +Uplift Scope [print_byte_at] 9.33: zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] 5.6: zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] 4: zp ZP_BYTE:20 [ print_byte_at::$0 ] 2: zp ZP_BYTE:21 [ print_byte_at::$2 ] Uplift Scope [print_word_at] 10: zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] 0.8: zp ZP_WORD:4 [ print_word_at::at#2 ] -Uplift Scope [print_dword_at] 5: zp ZP_DWORD:12 [ print_dword_at::dw#0 ] +Uplift Scope [print_dword_at] 5: zp ZP_DWORD:16 [ print_dword_at::dw#0 ] +Uplift Scope [clock_start] Uplift Scope [main] Uplift Scope [] -Uplifting [print_char_at] best 778 combination reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] -Uplifting [print_byte_at] best 770 combination zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] reg byte a [ print_byte_at::$0 ] reg byte y [ print_byte_at::$2 ] -Uplifting [print_word_at] best 770 combination zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] zp ZP_WORD:4 [ print_word_at::at#2 ] -Uplifting [print_dword_at] best 770 combination zp ZP_DWORD:12 [ print_dword_at::dw#0 ] -Uplifting [main] best 770 combination -Uplifting [] best 770 combination +Uplifting [clock] best 1062 combination zp ZP_DWORD:12 [ clock::return#2 ] zp ZP_DWORD:22 [ clock::return#0 ] +Uplifting [print_char_at] best 1055 combination reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Uplifting [print_byte_at] best 1047 combination zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] reg byte a [ print_byte_at::$0 ] reg byte y [ print_byte_at::$2 ] +Uplifting [print_word_at] best 1047 combination zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] zp ZP_WORD:4 [ print_word_at::at#2 ] +Uplifting [print_dword_at] best 1047 combination zp ZP_DWORD:16 [ print_dword_at::dw#0 ] +Uplifting [clock_start] best 1047 combination +Uplifting [main] best 1047 combination +Uplifting [] best 1047 combination Attempting to uplift remaining variables inzp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] -Uplifting [print_byte_at] best 770 combination zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Uplifting [print_byte_at] best 1047 combination zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] Coalescing zero page register with common assignment [ zp ZP_WORD:4 [ print_word_at::at#2 ] ] with [ zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] ] - score: 2 +Coalescing zero page register with common assignment [ zp ZP_DWORD:12 [ clock::return#2 ] ] with [ zp ZP_DWORD:16 [ print_dword_at::dw#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_DWORD:12 [ clock::return#2 print_dword_at::dw#0 ] ] with [ zp ZP_DWORD:22 [ clock::return#0 ] ] - score: 1 Allocated (was zp ZP_WORD:10) zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] -Allocated (was zp ZP_DWORD:12) zp ZP_DWORD:9 [ print_dword_at::dw#0 ] +Allocated (was zp ZP_DWORD:12) zp ZP_DWORD:9 [ clock::return#2 print_dword_at::dw#0 clock::return#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments @@ -936,103 +1069,77 @@ b1_from_bbegin: //SEG5 @1 b1: //SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: jsr main -//SEG7 [3] phi from @1 to @end [phi:@1->@end] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] bend_from_b1: jmp bend -//SEG8 @end +//SEG9 @end bend: -//SEG9 main +//SEG10 main main: { - // Timer AB initial value - .const TIMER_INIT = $ffffffff - //SEG10 asm { sei } - sei - //SEG11 [5] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 - // Setup CIA#2 timer A to count (down) CPU cycles - lda #CIA_TIMER_CONTROL_CONTINUOUS - sta CIA2_TIMER_A_CONTROL - //SEG12 [6] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A - sta CIA2_TIMER_B_CONTROL - //SEG13 [7] *((const dword*) CIA2_TIMER_AB#0) ← (const dword) main::TIMER_INIT#0 -- _deref_pduc1=vduc2 - lda #TIMER_INIT - sta CIA2_TIMER_AB+1 - lda #>$10 - sta CIA2_TIMER_AB+2 - lda #>TIMER_INIT>>$10 - sta CIA2_TIMER_AB+3 - //SEG14 [8] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A - sta CIA2_TIMER_B_CONTROL - //SEG15 [9] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_START - sta CIA2_TIMER_A_CONTROL + //SEG11 [5] call clock_start + jsr clock_start + //SEG12 [6] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1] + b1_from_main: + b1_from_b2: jmp b1 - //SEG16 main::@1 + //SEG13 main::@1 b1: - //SEG17 [10] (dword) print_dword_at::dw#0 ← (const dword) main::TIMER_INIT#0 - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 - lda #TIMER_INIT - sbc CIA2_TIMER_AB+1 - sta print_dword_at.dw+1 - lda #>$10 - sbc CIA2_TIMER_AB+2 - sta print_dword_at.dw+2 - lda #>TIMER_INIT>>$10 - sbc CIA2_TIMER_AB+3 - sta print_dword_at.dw+3 - //SEG18 [11] call print_dword_at + //SEG14 [7] call clock + jsr clock + //SEG15 [8] (dword) clock::return#2 ← (dword) clock::return#0 + jmp b2 + //SEG16 main::@2 + b2: + //SEG17 [9] (dword) print_dword_at::dw#0 ← (dword) clock::return#2 + //SEG18 [10] call print_dword_at jsr print_dword_at - jmp b1 + jmp b1_from_b2 } //SEG19 print_dword_at // Print a dword as HEX at a specific position // print_dword_at(dword zeropage(9) dw) print_dword_at: { .label dw = 9 - //SEG20 [12] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + //SEG20 [11] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 lda dw+2 sta print_word_at.w lda dw+3 sta print_word_at.w+1 - //SEG21 [13] call print_word_at - //SEG22 [17] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + //SEG21 [12] call print_word_at + //SEG22 [16] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] print_word_at_from_print_dword_at: - //SEG23 [17] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + //SEG23 [16] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 lda #SCREEN sta print_word_at.at+1 - //SEG24 [17] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + //SEG24 [16] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy jsr print_word_at jmp b1 //SEG25 print_dword_at::@1 b1: - //SEG26 [14] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + //SEG26 [13] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 lda dw sta print_word_at.w lda dw+1 sta print_word_at.w+1 - //SEG27 [15] call print_word_at - //SEG28 [17] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + //SEG27 [14] call print_word_at + //SEG28 [16] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] print_word_at_from_b1: - //SEG29 [17] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + //SEG29 [16] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 lda #SCREEN+4 sta print_word_at.at+1 - //SEG30 [17] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + //SEG30 [16] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy jsr print_word_at jmp breturn //SEG31 print_dword_at::@return breturn: - //SEG32 [16] return + //SEG32 [15] return rts } //SEG33 print_word_at @@ -1041,23 +1148,23 @@ print_dword_at: { print_word_at: { .label w = 2 .label at = 4 - //SEG34 [18] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + //SEG34 [17] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 lda w+1 sta print_byte_at.b - //SEG35 [19] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 - //SEG36 [20] call print_byte_at - //SEG37 [25] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + //SEG35 [18] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + //SEG36 [19] call print_byte_at + //SEG37 [24] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] print_byte_at_from_print_word_at: - //SEG38 [25] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy - //SEG39 [25] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + //SEG38 [24] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG39 [24] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy jsr print_byte_at jmp b1 //SEG40 print_word_at::@1 b1: - //SEG41 [21] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + //SEG41 [20] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 lda w sta print_byte_at.b - //SEG42 [22] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz1_plus_2 + //SEG42 [21] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz1_plus_2 lda print_byte_at.at clc adc #2 @@ -1065,16 +1172,16 @@ print_word_at: { bcc !+ inc print_byte_at.at+1 !: - //SEG43 [23] call print_byte_at - //SEG44 [25] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + //SEG43 [22] call print_byte_at + //SEG44 [24] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] print_byte_at_from_b1: - //SEG45 [25] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy - //SEG46 [25] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + //SEG45 [24] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG46 [24] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy jsr print_byte_at jmp breturn //SEG47 print_word_at::@return breturn: - //SEG48 [24] return + //SEG48 [23] return rts } //SEG49 print_byte_at @@ -1083,34 +1190,34 @@ print_word_at: { print_byte_at: { .label b = 6 .label at = 4 - //SEG50 [26] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 + //SEG50 [25] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 lda b lsr lsr lsr lsr - //SEG51 [27] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuxx=pbuc1_derefidx_vbuaa + //SEG51 [26] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuxx=pbuc1_derefidx_vbuaa tay ldx print_hextab,y - //SEG52 [28] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + //SEG52 [27] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 lda at sta print_char_at.at lda at+1 sta print_char_at.at+1 - //SEG53 [29] call print_char_at - //SEG54 [35] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + //SEG53 [28] call print_char_at + //SEG54 [34] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] print_char_at_from_print_byte_at: - //SEG55 [35] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy - //SEG56 [35] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + //SEG55 [34] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG56 [34] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy jsr print_char_at jmp b1 //SEG57 print_byte_at::@1 b1: - //SEG58 [30] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuyy=vbuz1_band_vbuc1 + //SEG58 [29] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuyy=vbuz1_band_vbuc1 lda #$f and b tay - //SEG59 [31] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + //SEG59 [30] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 lda at clc adc #1 @@ -1118,18 +1225,18 @@ print_byte_at: { lda at+1 adc #0 sta print_char_at.at+1 - //SEG60 [32] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuxx=pbuc1_derefidx_vbuyy + //SEG60 [31] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuxx=pbuc1_derefidx_vbuyy ldx print_hextab,y - //SEG61 [33] call print_char_at - //SEG62 [35] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + //SEG61 [32] call print_char_at + //SEG62 [34] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] print_char_at_from_b1: - //SEG63 [35] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy - //SEG64 [35] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + //SEG63 [34] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG64 [34] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy jsr print_char_at jmp breturn //SEG65 print_byte_at::@return breturn: - //SEG66 [34] return + //SEG66 [33] return rts } //SEG67 print_char_at @@ -1137,23 +1244,81 @@ print_byte_at: { // print_char_at(byte register(X) ch, byte* zeropage(7) at) print_char_at: { .label at = 7 - //SEG68 [36] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuxx + //SEG68 [35] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuxx txa ldy #0 sta (at),y jmp breturn //SEG69 print_char_at::@return breturn: - //SEG70 [37] return + //SEG70 [36] return rts } -//SEG71 File Data +//SEG71 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = 9 + //SEG72 [37] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + jmp breturn + //SEG73 clock::@return + breturn: + //SEG74 [38] return + rts +} +//SEG75 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG76 [39] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG77 [40] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG78 [41] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG79 [42] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG80 [43] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + jmp breturn + //SEG81 clock_start::@return + breturn: + //SEG82 [44] return + rts +} +//SEG83 File Data print_hextab: .text "0123456789abcdef" ASSEMBLER OPTIMIZATIONS Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp b1 +Removing instruction jmp b2 Removing instruction jmp b1 Removing instruction jmp breturn Removing instruction jmp b1 @@ -1161,12 +1326,19 @@ Removing instruction jmp breturn Removing instruction jmp b1 Removing instruction jmp breturn Removing instruction jmp breturn +Removing instruction jmp breturn +Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination +Replacing label b1_from_b2 with b1 Removing instruction b1_from_bbegin: Removing instruction b1: +Removing instruction main_from_b1: Removing instruction bend_from_b1: +Removing instruction b1_from_main: +Removing instruction b1_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination Removing instruction bend: +Removing instruction b2: Removing instruction print_word_at_from_print_dword_at: Removing instruction b1: Removing instruction print_word_at_from_b1: @@ -1180,6 +1352,8 @@ Removing instruction b1: Removing instruction print_char_at_from_b1: Removing instruction breturn: Removing instruction breturn: +Removing instruction breturn: +Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination Updating BasicUpstart to call main directly Removing instruction jsr main @@ -1207,10 +1381,16 @@ FINAL SYMBOL TABLE (byte) CIA_TIMER_CONTROL_STOP (byte*) SCREEN (const byte*) SCREEN#0 SCREEN = (byte*) 1024 +(dword()) clock() +(label) clock::@return +(dword) clock::return +(dword) clock::return#0 return zp ZP_DWORD:9 4.333333333333333 +(dword) clock::return#2 return zp ZP_DWORD:9 22.0 +(void()) clock_start() +(label) clock_start::@return (void()) main() (label) main::@1 -(dword) main::TIMER_INIT -(const dword) main::TIMER_INIT#0 TIMER_INIT = (dword) $ffffffff +(label) main::@2 (void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) (byte~) print_byte_at::$0 reg byte a 4.0 (byte~) print_byte_at::$2 reg byte y 2.0 @@ -1257,13 +1437,13 @@ zp ZP_WORD:4 [ print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] -zp ZP_DWORD:9 [ print_dword_at::dw#0 ] +zp ZP_DWORD:9 [ clock::return#2 print_dword_at::dw#0 clock::return#0 ] reg byte a [ print_byte_at::$0 ] reg byte y [ print_byte_at::$2 ] FINAL ASSEMBLER -Score: 721 +Score: 455 //SEG0 File Comments // Setup and run a simple CIA-timer @@ -1289,53 +1469,22 @@ Score: 721 //SEG4 [1] phi from @begin to @1 [phi:@begin->@1] //SEG5 @1 //SEG6 [2] call main -//SEG7 [3] phi from @1 to @end [phi:@1->@end] -//SEG8 @end -//SEG9 main +//SEG7 [4] phi from @1 to main [phi:@1->main] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +//SEG9 @end +//SEG10 main main: { - // Timer AB initial value - .const TIMER_INIT = $ffffffff - //SEG10 asm { sei } - sei - //SEG11 [5] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 - // Setup CIA#2 timer A to count (down) CPU cycles - lda #CIA_TIMER_CONTROL_CONTINUOUS - sta CIA2_TIMER_A_CONTROL - //SEG12 [6] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A - sta CIA2_TIMER_B_CONTROL - //SEG13 [7] *((const dword*) CIA2_TIMER_AB#0) ← (const dword) main::TIMER_INIT#0 -- _deref_pduc1=vduc2 - lda #TIMER_INIT - sta CIA2_TIMER_AB+1 - lda #>$10 - sta CIA2_TIMER_AB+2 - lda #>TIMER_INIT>>$10 - sta CIA2_TIMER_AB+3 - //SEG14 [8] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A - sta CIA2_TIMER_B_CONTROL - //SEG15 [9] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 - lda #CIA_TIMER_CONTROL_START - sta CIA2_TIMER_A_CONTROL - //SEG16 main::@1 + //SEG11 [5] call clock_start + jsr clock_start + //SEG12 [6] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1] + //SEG13 main::@1 b1: - //SEG17 [10] (dword) print_dword_at::dw#0 ← (const dword) main::TIMER_INIT#0 - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 - lda #TIMER_INIT - sbc CIA2_TIMER_AB+1 - sta print_dword_at.dw+1 - lda #>$10 - sbc CIA2_TIMER_AB+2 - sta print_dword_at.dw+2 - lda #>TIMER_INIT>>$10 - sbc CIA2_TIMER_AB+3 - sta print_dword_at.dw+3 - //SEG18 [11] call print_dword_at + //SEG14 [7] call clock + jsr clock + //SEG15 [8] (dword) clock::return#2 ← (dword) clock::return#0 + //SEG16 main::@2 + //SEG17 [9] (dword) print_dword_at::dw#0 ← (dword) clock::return#2 + //SEG18 [10] call print_dword_at jsr print_dword_at jmp b1 } @@ -1344,37 +1493,37 @@ main: { // print_dword_at(dword zeropage(9) dw) print_dword_at: { .label dw = 9 - //SEG20 [12] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + //SEG20 [11] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 lda dw+2 sta print_word_at.w lda dw+3 sta print_word_at.w+1 - //SEG21 [13] call print_word_at - //SEG22 [17] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] - //SEG23 [17] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + //SEG21 [12] call print_word_at + //SEG22 [16] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + //SEG23 [16] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 lda #SCREEN sta print_word_at.at+1 - //SEG24 [17] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + //SEG24 [16] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy jsr print_word_at //SEG25 print_dword_at::@1 - //SEG26 [14] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + //SEG26 [13] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 lda dw sta print_word_at.w lda dw+1 sta print_word_at.w+1 - //SEG27 [15] call print_word_at - //SEG28 [17] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] - //SEG29 [17] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + //SEG27 [14] call print_word_at + //SEG28 [16] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + //SEG29 [16] phi (byte*) print_word_at::at#2 = (const byte*) SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 lda #SCREEN+4 sta print_word_at.at+1 - //SEG30 [17] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + //SEG30 [16] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy jsr print_word_at //SEG31 print_dword_at::@return - //SEG32 [16] return + //SEG32 [15] return rts } //SEG33 print_word_at @@ -1383,20 +1532,20 @@ print_dword_at: { print_word_at: { .label w = 2 .label at = 4 - //SEG34 [18] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + //SEG34 [17] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 lda w+1 sta print_byte_at.b - //SEG35 [19] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 - //SEG36 [20] call print_byte_at - //SEG37 [25] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] - //SEG38 [25] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy - //SEG39 [25] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + //SEG35 [18] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + //SEG36 [19] call print_byte_at + //SEG37 [24] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + //SEG38 [24] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG39 [24] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy jsr print_byte_at //SEG40 print_word_at::@1 - //SEG41 [21] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + //SEG41 [20] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 lda w sta print_byte_at.b - //SEG42 [22] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz1_plus_2 + //SEG42 [21] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz1_plus_2 lda print_byte_at.at clc adc #2 @@ -1404,13 +1553,13 @@ print_word_at: { bcc !+ inc print_byte_at.at+1 !: - //SEG43 [23] call print_byte_at - //SEG44 [25] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] - //SEG45 [25] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy - //SEG46 [25] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + //SEG43 [22] call print_byte_at + //SEG44 [24] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + //SEG45 [24] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG46 [24] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy jsr print_byte_at //SEG47 print_word_at::@return - //SEG48 [24] return + //SEG48 [23] return rts } //SEG49 print_byte_at @@ -1419,31 +1568,31 @@ print_word_at: { print_byte_at: { .label b = 6 .label at = 4 - //SEG50 [26] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 + //SEG50 [25] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 lda b lsr lsr lsr lsr - //SEG51 [27] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuxx=pbuc1_derefidx_vbuaa + //SEG51 [26] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuxx=pbuc1_derefidx_vbuaa tay ldx print_hextab,y - //SEG52 [28] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + //SEG52 [27] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 lda at sta print_char_at.at lda at+1 sta print_char_at.at+1 - //SEG53 [29] call print_char_at - //SEG54 [35] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] - //SEG55 [35] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy - //SEG56 [35] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + //SEG53 [28] call print_char_at + //SEG54 [34] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + //SEG55 [34] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG56 [34] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy jsr print_char_at //SEG57 print_byte_at::@1 - //SEG58 [30] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuyy=vbuz1_band_vbuc1 + //SEG58 [29] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuyy=vbuz1_band_vbuc1 lda #$f and b tay - //SEG59 [31] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + //SEG59 [30] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 lda at clc adc #1 @@ -1451,15 +1600,15 @@ print_byte_at: { lda at+1 adc #0 sta print_char_at.at+1 - //SEG60 [32] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuxx=pbuc1_derefidx_vbuyy + //SEG60 [31] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuxx=pbuc1_derefidx_vbuyy ldx print_hextab,y - //SEG61 [33] call print_char_at - //SEG62 [35] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] - //SEG63 [35] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy - //SEG64 [35] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + //SEG61 [32] call print_char_at + //SEG62 [34] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + //SEG63 [34] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG64 [34] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy jsr print_char_at //SEG65 print_byte_at::@return - //SEG66 [34] return + //SEG66 [33] return rts } //SEG67 print_char_at @@ -1467,14 +1616,67 @@ print_byte_at: { // print_char_at(byte register(X) ch, byte* zeropage(7) at) print_char_at: { .label at = 7 - //SEG68 [36] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuxx + //SEG68 [35] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuxx txa ldy #0 sta (at),y //SEG69 print_char_at::@return - //SEG70 [37] return + //SEG70 [36] return rts } -//SEG71 File Data +//SEG71 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = 9 + //SEG72 [37] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + //SEG73 clock::@return + //SEG74 [38] return + rts +} +//SEG75 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG76 [39] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG77 [40] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG78 [41] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG79 [42] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG80 [43] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + //SEG81 clock_start::@return + //SEG82 [44] return + rts +} +//SEG83 File Data print_hextab: .text "0123456789abcdef" diff --git a/src/test/ref/cia-timer-simple.sym b/src/test/ref/cia-timer-simple.sym index 1f7c30dc1..f2b144f1f 100644 --- a/src/test/ref/cia-timer-simple.sym +++ b/src/test/ref/cia-timer-simple.sym @@ -17,10 +17,16 @@ (byte) CIA_TIMER_CONTROL_STOP (byte*) SCREEN (const byte*) SCREEN#0 SCREEN = (byte*) 1024 +(dword()) clock() +(label) clock::@return +(dword) clock::return +(dword) clock::return#0 return zp ZP_DWORD:9 4.333333333333333 +(dword) clock::return#2 return zp ZP_DWORD:9 22.0 +(void()) clock_start() +(label) clock_start::@return (void()) main() (label) main::@1 -(dword) main::TIMER_INIT -(const dword) main::TIMER_INIT#0 TIMER_INIT = (dword) $ffffffff +(label) main::@2 (void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) (byte~) print_byte_at::$0 reg byte a 4.0 (byte~) print_byte_at::$2 reg byte y 2.0 @@ -67,6 +73,6 @@ zp ZP_WORD:4 [ print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] -zp ZP_DWORD:9 [ print_dword_at::dw#0 ] +zp ZP_DWORD:9 [ clock::return#2 print_dword_at::dw#0 clock::return#0 ] reg byte a [ print_byte_at::$0 ] reg byte y [ print_byte_at::$2 ] diff --git a/src/test/ref/screen-center-angle.asm b/src/test/ref/screen-center-angle.asm index e06750f22..d9ae94739 100644 --- a/src/test/ref/screen-center-angle.asm +++ b/src/test/ref/screen-center-angle.asm @@ -4,28 +4,169 @@ :BasicUpstart(main) .pc = $80d "Program" .label D018 = $d018 + // CIA #2 Timer A+B Value (32-bit) + .label CIA2_TIMER_AB = $dd04 + // CIA #2 Timer A Control Register + .label CIA2_TIMER_A_CONTROL = $dd0e + // CIA #2 Timer B Control Register + .label CIA2_TIMER_B_CONTROL = $dd0f + // Timer Control - Start/stop timer (0:stop, 1: start) + .const CIA_TIMER_CONTROL_START = 1 + // Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT) + .const CIA_TIMER_CONTROL_CONTINUOUS = 0 + // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) + .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 // The number of iterations performed during 16-bit CORDIC atan2 calculation .const CORDIC_ITERATIONS_16 = $f + // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. + // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. + .const CLOCKS_PER_INIT = $12 .label CHARSET = $2000 .label SCREEN = $2800 main: { + .label BASE_SCREEN = $400 + .label BASE_CHARSET = $1000 .const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f + .const toD0182_return = (>(BASE_SCREEN&$3fff)*4)|(>BASE_CHARSET)/4&$f + .label _4 = $1c + .label cyclecount = $1c jsr init_font_hex lda #toD0181_return sta D018 + jsr clock_start jsr init_angle_screen + jsr clock + lda cyclecount + sec + sbc #CLOCKS_PER_INIT + sta cyclecount+1 + lda cyclecount+2 + sbc #>$10 + sta cyclecount+2 + lda cyclecount+3 + sbc #>CLOCKS_PER_INIT>>$10 + sta cyclecount+3 + jsr print_dword_at + lda #toD0182_return + sta D018 + rts +} +// Print a dword as HEX at a specific position +// print_dword_at(dword zeropage($1c) dw) +print_dword_at: { + .label dw = $1c + lda dw+2 + sta print_word_at.w + lda dw+3 + sta print_word_at.w+1 + lda #main.BASE_SCREEN + sta print_word_at.at+1 + jsr print_word_at + lda dw + sta print_word_at.w + lda dw+1 + sta print_word_at.w+1 + lda #main.BASE_SCREEN+4 + sta print_word_at.at+1 + jsr print_word_at + rts +} +// Print a word as HEX at a specific position +// print_word_at(word zeropage(2) w, byte* zeropage(4) at) +print_word_at: { + .label w = 2 + .label at = 4 + lda w+1 + sta print_byte_at.b + jsr print_byte_at + lda w + sta print_byte_at.b + lda print_byte_at.at + clc + adc #2 + sta print_byte_at.at + bcc !+ + inc print_byte_at.at+1 + !: + jsr print_byte_at + rts +} +// Print a byte as HEX at a specific position +// print_byte_at(byte zeropage(6) b, byte* zeropage(4) at) +print_byte_at: { + .label b = 6 + .label at = 4 + lda b + lsr + lsr + lsr + lsr + tay + ldx print_hextab,y + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + jsr print_char_at + lda #$f + and b + tay + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + ldx print_hextab,y + jsr print_char_at + rts +} +// Print a single char +// print_char_at(byte register(X) ch, byte* zeropage(7) at) +print_char_at: { + .label at = 7 + txa + ldy #0 + sta (at),y + rts +} +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = $1c + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 rts } // Populates 1000 bytes (a screen) with values representing the angle to the center. // The actual value stored is distance*2 to increase precision -// init_angle_screen(byte* zeropage(3) screen) +// init_angle_screen(byte* zeropage($a) screen) init_angle_screen: { - .label _7 = $a - .label xw = $15 - .label yw = $17 - .label angle_w = $a - .label screen = 3 - .label y = 2 + .label _7 = $11 + .label xw = $20 + .label yw = $22 + .label angle_w = $11 + .label screen = $a + .label y = 9 lda #SCREEN @@ -69,19 +210,19 @@ init_angle_screen: { // 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($15) x, signed word zeropage($17) y) +// atan2_16(signed word zeropage($20) x, signed word zeropage($22) y) atan2_16: { - .label _2 = 5 - .label _7 = 7 - .label yi = 5 - .label xi = 7 - .label xd = $19 - .label yd = $1b - .label angle = $a - .label i = 9 - .label return = $a - .label x = $15 - .label y = $17 + .label _2 = $c + .label _7 = $e + .label yi = $c + .label xi = $e + .label xd = $24 + .label yd = $26 + .label angle = $11 + .label i = $10 + .label return = $11 + .label x = $20 + .label y = $22 lda y+1 bmi !b1+ jmp b1 @@ -243,16 +384,38 @@ atan2_16: { sta yi+1 jmp b3 } +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + rts +} // Make charset from proto chars -// init_font_hex(byte* zeropage($f) charset) +// init_font_hex(byte* zeropage($16) charset) init_font_hex: { - .label _0 = $1d - .label idx = $14 - .label proto_lo = $11 - .label charset = $f - .label c1 = $13 - .label proto_hi = $c - .label c = $e + .label _0 = $28 + .label idx = $1b + .label proto_lo = $18 + .label charset = $16 + .label c1 = $1a + .label proto_hi = $13 + .label c = $15 lda #0 sta c lda # (dword) print_dword_at::dw#0 + [22] call print_word_at + to:print_dword_at::@1 +print_dword_at::@1: scope:[print_dword_at] from print_dword_at + [23] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 + [24] call print_word_at + to:print_dword_at::@return +print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@1 + [25] return + to:@return +print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 + [26] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const byte*) main::BASE_SCREEN#0 print_dword_at::@1/(const byte*) main::BASE_SCREEN#0+(byte) 4 ) + [26] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) + [27] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 + [28] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + [29] call print_byte_at + to:print_word_at::@1 +print_word_at::@1: scope:[print_word_at] from print_word_at + [30] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 + [31] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 + [32] call print_byte_at + to:print_word_at::@return +print_word_at::@return: scope:[print_word_at] from print_word_at::@1 + [33] return + to:@return +print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 + [34] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) + [34] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) + [35] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 + [36] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + [37] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 + [38] call print_char_at + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + [39] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f + [40] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 + [41] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) + [42] call print_char_at + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1 + [43] return + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 + [44] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) + [44] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) + [45] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + [46] return + to:@return +clock: scope:[clock] from main::@4 + [47] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) + to:clock::@return +clock::@return: scope:[clock] from clock + [48] return + to:@return +init_angle_screen: scope:[init_angle_screen] from main::@3 + [49] phi() to:init_angle_screen::@1 init_angle_screen::@1: scope:[init_angle_screen] from init_angle_screen init_angle_screen::@3 - [11] (byte*) init_angle_screen::screen#4 ← phi( init_angle_screen/(const byte*) SCREEN#0 init_angle_screen::@3/(byte*) init_angle_screen::screen#1 ) - [11] (signed byte) init_angle_screen::y#4 ← phi( init_angle_screen/(signed byte) -$c init_angle_screen::@3/(signed byte) init_angle_screen::y#1 ) + [50] (byte*) init_angle_screen::screen#4 ← phi( init_angle_screen/(const byte*) SCREEN#0 init_angle_screen::@3/(byte*) init_angle_screen::screen#1 ) + [50] (signed byte) init_angle_screen::y#4 ← phi( init_angle_screen/(signed byte) -$c init_angle_screen::@3/(signed byte) init_angle_screen::y#1 ) to:init_angle_screen::@2 init_angle_screen::@2: scope:[init_angle_screen] from init_angle_screen::@1 init_angle_screen::@4 - [12] (byte*) init_angle_screen::screen#2 ← phi( init_angle_screen::@1/(byte*) init_angle_screen::screen#4 init_angle_screen::@4/(byte*) init_angle_screen::screen#1 ) - [12] (signed byte) init_angle_screen::x#2 ← phi( init_angle_screen::@1/(signed byte) -$13 init_angle_screen::@4/(signed byte) init_angle_screen::x#1 ) - [13] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 - [14] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 - [15] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 - [16] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 - [17] call atan2_16 - [18] (word) atan2_16::return#2 ← (word) atan2_16::return#0 + [51] (byte*) init_angle_screen::screen#2 ← phi( init_angle_screen::@1/(byte*) init_angle_screen::screen#4 init_angle_screen::@4/(byte*) init_angle_screen::screen#1 ) + [51] (signed byte) init_angle_screen::x#2 ← phi( init_angle_screen::@1/(signed byte) -$13 init_angle_screen::@4/(signed byte) init_angle_screen::x#1 ) + [52] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 + [53] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 + [54] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 + [55] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 + [56] call atan2_16 + [57] (word) atan2_16::return#2 ← (word) atan2_16::return#0 to:init_angle_screen::@4 init_angle_screen::@4: scope:[init_angle_screen] from init_angle_screen::@2 - [19] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 - [20] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 - [21] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 - [22] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 - [23] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 - [24] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 - [25] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 + [58] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 + [59] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 + [60] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 + [61] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 + [62] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 + [63] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 + [64] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 to:init_angle_screen::@3 init_angle_screen::@3: scope:[init_angle_screen] from init_angle_screen::@4 - [26] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 - [27] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 + [65] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 + [66] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 to:init_angle_screen::@return init_angle_screen::@return: scope:[init_angle_screen] from init_angle_screen::@3 - [28] return + [67] return to:@return atan2_16: scope:[atan2_16] from init_angle_screen::@2 - [29] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 + [68] 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 - [30] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 + [69] (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 - [31] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word~) atan2_16::yi#11 atan2_16::@2/(signed word~) atan2_16::$2 ) - [32] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 + [70] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word~) atan2_16::yi#11 atan2_16::@2/(signed word~) atan2_16::$2 ) + [71] 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 - [33] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 + [72] (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 - [34] (signed word) atan2_16::xi#0 ← phi( atan2_16::@4/(signed word~) atan2_16::xi#8 atan2_16::@5/(signed word~) atan2_16::$7 ) + [73] (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 - [35] (word) atan2_16::angle#12 ← phi( atan2_16::@14/(word) atan2_16::angle#13 atan2_16::@6/(byte) 0 ) - [35] (byte) atan2_16::i#2 ← phi( atan2_16::@14/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 ) - [35] (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 ) - [35] (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 ) - [36] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 + [74] (word) atan2_16::angle#12 ← phi( atan2_16::@14/(word) atan2_16::angle#13 atan2_16::@6/(byte) 0 ) + [74] (byte) atan2_16::i#2 ← phi( atan2_16::@14/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 ) + [74] (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 ) + [74] (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 ) + [75] 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 - [37] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@14/(word) atan2_16::angle#13 ) - [38] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 - [39] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 + [76] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@14/(word) atan2_16::angle#13 ) + [77] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 + [78] 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 - [40] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 + [79] (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 - [41] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@16/(word) atan2_16::angle#4 ) - [42] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 + [80] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@16/(word) atan2_16::angle#4 ) + [81] 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 - [43] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 + [82] (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 - [44] (word) atan2_16::return#0 ← phi( atan2_16::@9/(word) atan2_16::angle#5 atan2_16::@7/(word) atan2_16::angle#11 ) + [83] (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 - [45] return - to:@return -atan2_16::@11: scope:[atan2_16] from atan2_16::@10 - [46] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 - [47] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 - [48] 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 - [49] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 - [50] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 - [51] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 - [52] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) 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 - [53] (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 ) - [53] (word) atan2_16::angle#13 ← phi( atan2_16::@13/(word) atan2_16::angle#2 atan2_16::@15/(word) atan2_16::angle#3 ) - [53] (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 ) - [54] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 - [55] 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 - [56] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 - [57] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 - [58] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 - [59] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) - to:atan2_16::@14 -atan2_16::@4: scope:[atan2_16] from atan2_16::@3 - [60] (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 - [61] (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 - [62] phi() - to:init_font_hex::@1 -init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5 - [63] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 ) - [63] (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 ) - [63] (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 - [64] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 ) - [64] (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 ) - [64] (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 ) - [65] *((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 - [66] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 ) - [66] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 ) - [67] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 - [68] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 - [69] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 - [70] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 - [71] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 - [72] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 - [73] 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 - [74] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 - [75] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 - [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 - [77] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 - [78] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 - [79] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 - [80] 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 - [81] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 - [82] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 - [83] 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 [84] return to:@return +atan2_16::@11: scope:[atan2_16] from atan2_16::@10 + [85] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 + [86] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 + [87] 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 + [88] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 + [89] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 + [90] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 + [91] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) 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 + [92] (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 ) + [92] (word) atan2_16::angle#13 ← phi( atan2_16::@13/(word) atan2_16::angle#2 atan2_16::@15/(word) atan2_16::angle#3 ) + [92] (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 ) + [93] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 + [94] 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 + [95] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 + [96] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 + [97] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 + [98] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) + to:atan2_16::@14 +atan2_16::@4: scope:[atan2_16] from atan2_16::@3 + [99] (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 + [100] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 + to:atan2_16::@3 +clock_start: scope:[clock_start] from main::@1 + [101] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + [102] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [103] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff + [104] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [105] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + [106] return + to:@return +init_font_hex: scope:[init_font_hex] from main + [107] phi() + to:init_font_hex::@1 +init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5 + [108] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 ) + [108] (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 ) + [108] (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 + [109] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 ) + [109] (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 ) + [109] (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 ) + [110] *((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 + [111] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 ) + [111] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 ) + [112] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 + [113] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 + [114] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 + [115] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 + [116] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 + [117] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 + [118] 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 + [119] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 + [120] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 + [121] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 + [122] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 + [123] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 + [124] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 + [125] 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 + [126] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 + [127] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 + [128] 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 + [129] return + to:@return diff --git a/src/test/ref/screen-center-angle.log b/src/test/ref/screen-center-angle.log index 04e85b821..df37dd106 100644 --- a/src/test/ref/screen-center-angle.log +++ b/src/test/ref/screen-center-angle.log @@ -6,8 +6,11 @@ Fixing pointer addition (word*~) bsearch16u::$1 ← (word*) bsearch16u::items - Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i) Fixing pointer array-indexing *((word[CORDIC_ITERATIONS_16]) CORDIC_ATAN2_ANGLES_16 + (byte) atan2_16::i) Identified constant variable (byte*) HEAP_START +Identified constant variable (byte*) main::BASE_SCREEN +Identified constant variable (byte*) main::BASE_CHARSET Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx Inlined call (byte~) main::$1 ← call toD018 (byte*) SCREEN (byte*) CHARSET +Inlined call (byte~) main::$7 ← call toD018 (byte*) main::BASE_SCREEN (byte*) main::BASE_CHARSET Culled Empty Block (label) @1 Culled Empty Block (label) @2 Culled Empty Block (label) @4 @@ -25,8 +28,31 @@ 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) @9 -Culled Empty Block (label) main::toD0181_@1 +Culled Empty Block (label) clock::@1 Culled Empty Block (label) @11 +Culled Empty Block (label) @12 +Culled Empty Block (label) @13 +Culled Empty Block (label) @14 +Culled Empty Block (label) @15 +Culled Empty Block (label) @16 +Culled Empty Block (label) @17 +Culled Empty Block (label) @18 +Culled Empty Block (label) @19 +Culled Empty Block (label) @20 +Culled Empty Block (label) @21 +Culled Empty Block (label) @22 +Culled Empty Block (label) @23 +Culled Empty Block (label) @24 +Culled Empty Block (label) @25 +Culled Empty Block (label) @27 +Culled Empty Block (label) @28 +Culled Empty Block (label) @29 +Culled Empty Block (label) @30 +Culled Empty Block (label) @31 +Culled Empty Block (label) @32 +Culled Empty Block (label) main::toD0181_@1 +Culled Empty Block (label) main::toD0182_@1 +Culled Empty Block (label) @34 Culled Empty Block (label) init_angle_screen::@4 CONTROL FLOW GRAPH SSA @@ -34,6 +60,14 @@ CONTROL FLOW GRAPH SSA to:@3 @3: scope:[] from @begin (byte*) D018#0 ← ((byte*)) (number) $d018 + (dword*) CIA2_TIMER_AB#0 ← ((dword*)) (number) $dd04 + (byte*) CIA2_TIMER_A_CONTROL#0 ← ((byte*)) (number) $dd0e + (byte*) CIA2_TIMER_B_CONTROL#0 ← ((byte*)) (number) $dd0f + (byte) CIA_TIMER_CONTROL_STOP#0 ← (number) 0 + (byte) CIA_TIMER_CONTROL_START#0 ← (number) 1 + (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (number) 0 + (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (number) 0 + (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (number) $40 to:@8 init_font_hex: scope:[init_font_hex] from main (byte*) init_font_hex::charset#6 ← phi( main/(byte*) init_font_hex::charset#1 ) @@ -260,20 +294,127 @@ atan2_16::@return: scope:[atan2_16] from atan2_16::@8 return to:@return @10: scope:[] from @8 + (dword) CLOCKS_PER_INIT#0 ← (number) $12 + to:@26 +clock: scope:[clock] from main::@5 + (number~) clock::$0 ← (number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) + (dword) clock::return#0 ← (number~) clock::$0 + to:clock::@return +clock::@return: scope:[clock] from clock + (dword) clock::return#3 ← phi( clock/(dword) clock::return#0 ) + (dword) clock::return#1 ← (dword) clock::return#3 + return + to:@return +clock_start: scope:[clock_start] from main::@1 + (byte~) clock_start::$0 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$1 ← (byte~) clock_start::$0 | (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 + *((byte*) CIA2_TIMER_A_CONTROL#0) ← (byte~) clock_start::$1 + (byte~) clock_start::$2 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$3 ← (byte~) clock_start::$2 | (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + *((byte*) CIA2_TIMER_B_CONTROL#0) ← (byte~) clock_start::$3 + *((dword*) CIA2_TIMER_AB#0) ← (number) $ffffffff + (byte~) clock_start::$4 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$5 ← (byte~) clock_start::$4 | (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + *((byte*) CIA2_TIMER_B_CONTROL#0) ← (byte~) clock_start::$5 + (byte~) clock_start::$6 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + (byte~) clock_start::$7 ← (byte~) clock_start::$6 | (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 + *((byte*) CIA2_TIMER_A_CONTROL#0) ← (byte~) clock_start::$7 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + return + to:@return +print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 + (byte*) print_word_at::at#2 ← phi( print_dword_at/(byte*) print_word_at::at#0 print_dword_at::@1/(byte*) print_word_at::at#1 ) + (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) + (byte~) print_word_at::$0 ← > (word) print_word_at::w#2 + (byte) print_byte_at::b#0 ← (byte~) print_word_at::$0 + (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + call print_byte_at + to:print_word_at::@1 +print_word_at::@1: scope:[print_word_at] from print_word_at + (byte*) print_word_at::at#3 ← phi( print_word_at/(byte*) print_word_at::at#2 ) + (word) print_word_at::w#3 ← phi( print_word_at/(word) print_word_at::w#2 ) + (byte~) print_word_at::$2 ← < (word) print_word_at::w#3 + (byte*~) print_word_at::$3 ← (byte*) print_word_at::at#3 + (number) 2 + (byte) print_byte_at::b#1 ← (byte~) print_word_at::$2 + (byte*) print_byte_at::at#1 ← (byte*~) print_word_at::$3 + call print_byte_at + to:print_word_at::@2 +print_word_at::@2: scope:[print_word_at] from print_word_at::@1 + to:print_word_at::@return +print_word_at::@return: scope:[print_word_at] from print_word_at::@2 + return + to:@return +print_dword_at: scope:[print_dword_at] from main::@6 + (byte*) print_dword_at::at#1 ← phi( main::@6/(byte*) print_dword_at::at#0 ) + (dword) print_dword_at::dw#1 ← phi( main::@6/(dword) print_dword_at::dw#0 ) + (word~) print_dword_at::$0 ← > (dword) print_dword_at::dw#1 + (word) print_word_at::w#0 ← (word~) print_dword_at::$0 + (byte*) print_word_at::at#0 ← (byte*) print_dword_at::at#1 + call print_word_at + to:print_dword_at::@1 +print_dword_at::@1: scope:[print_dword_at] from print_dword_at + (byte*) print_dword_at::at#2 ← phi( print_dword_at/(byte*) print_dword_at::at#1 ) + (dword) print_dword_at::dw#2 ← phi( print_dword_at/(dword) print_dword_at::dw#1 ) + (word~) print_dword_at::$2 ← < (dword) print_dword_at::dw#2 + (byte*~) print_dword_at::$3 ← (byte*) print_dword_at::at#2 + (number) 4 + (word) print_word_at::w#1 ← (word~) print_dword_at::$2 + (byte*) print_word_at::at#1 ← (byte*~) print_dword_at::$3 + call print_word_at + to:print_dword_at::@2 +print_dword_at::@2: scope:[print_dword_at] from print_dword_at::@1 + to:print_dword_at::@return +print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@2 + return + to:@return +@26: scope:[] from @10 + (byte[]) print_hextab#0 ← (const string) $0 + to:@33 +print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 + (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) + (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) + (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (number) 4 + (byte) print_char_at::ch#0 ← *((byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 + call print_char_at + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + (byte*) print_byte_at::at#3 ← phi( print_byte_at/(byte*) print_byte_at::at#2 ) + (byte) print_byte_at::b#3 ← phi( print_byte_at/(byte) print_byte_at::b#2 ) + (number~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (number) $f + (byte*~) print_byte_at::$3 ← (byte*) print_byte_at::at#3 + (number) 1 + (byte) print_char_at::ch#1 ← *((byte[]) print_hextab#0 + (number~) print_byte_at::$2) + (byte*) print_char_at::at#1 ← (byte*~) print_byte_at::$3 + call print_char_at + to:print_byte_at::@2 +print_byte_at::@2: scope:[print_byte_at] from print_byte_at::@1 + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@2 + return + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 + (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) + (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) + *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + return + to:@return +@33: scope:[] from @26 (byte*) CHARSET#0 ← ((byte*)) (number) $2000 (byte*) SCREEN#0 ← ((byte*)) (number) $2800 - to:@12 -main: scope:[main] from @12 + to:@35 +main: scope:[main] from @35 (byte*) init_font_hex::charset#1 ← (byte*) CHARSET#0 call init_font_hex - to:main::@2 -main::@2: scope:[main] from main + to:main::@3 +main::@3: 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::@2 - (byte*) main::toD0181_gfx#1 ← phi( main::@2/(byte*) main::toD0181_gfx#0 ) - (byte*) main::toD0181_screen#1 ← phi( main::@2/(byte*) main::toD0181_screen#0 ) +main::toD0181: scope:[main] from main::@3 + (byte*) main::toD0181_gfx#1 ← phi( main::@3/(byte*) main::toD0181_gfx#0 ) + (byte*) main::toD0181_screen#1 ← phi( main::@3/(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 @@ -293,16 +434,59 @@ main::@1: 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 clock_start + to:main::@4 +main::@4: scope:[main] from main::@1 (byte*) init_angle_screen::screen#0 ← (byte*) SCREEN#0 call init_angle_screen - to:main::@3 -main::@3: scope:[main] from main::@1 + to:main::@5 +main::@5: scope:[main] from main::@4 + call clock + (dword) clock::return#2 ← (dword) clock::return#1 + to:main::@6 +main::@6: scope:[main] from main::@5 + (dword) clock::return#4 ← phi( main::@5/(dword) clock::return#2 ) + (dword~) main::$4 ← (dword) clock::return#4 + (dword~) main::$5 ← (dword~) main::$4 - (dword) CLOCKS_PER_INIT#0 + (dword) main::cyclecount#0 ← (dword~) main::$5 + (byte*) main::BASE_SCREEN#0 ← ((byte*)) (number) $400 + (byte*) main::BASE_CHARSET#0 ← ((byte*)) (number) $1000 + (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + (byte*) print_dword_at::at#0 ← (byte*) main::BASE_SCREEN#0 + call print_dword_at + to:main::@7 +main::@7: scope:[main] from main::@6 + (byte*) main::toD0182_screen#0 ← (byte*) main::BASE_SCREEN#0 + (byte*) main::toD0182_gfx#0 ← (byte*) main::BASE_CHARSET#0 + to:main::toD0182 +main::toD0182: scope:[main] from main::@7 + (byte*) main::toD0182_gfx#1 ← phi( main::@7/(byte*) main::toD0182_gfx#0 ) + (byte*) main::toD0182_screen#1 ← phi( main::@7/(byte*) main::toD0182_screen#0 ) + (word~) main::toD0182_$0#0 ← ((word)) (byte*) main::toD0182_screen#1 + (number~) main::toD0182_$1#0 ← (word~) main::toD0182_$0#0 & (number) $3fff + (number~) main::toD0182_$2#0 ← (number~) main::toD0182_$1#0 * (number) 4 + (number~) main::toD0182_$3#0 ← > (number~) main::toD0182_$2#0 + (word~) main::toD0182_$4#0 ← ((word)) (byte*) main::toD0182_gfx#1 + (byte~) main::toD0182_$5#0 ← > (word~) main::toD0182_$4#0 + (number~) main::toD0182_$6#0 ← (byte~) main::toD0182_$5#0 / (number) 4 + (number~) main::toD0182_$7#0 ← (number~) main::toD0182_$6#0 & (number) $f + (number~) main::toD0182_$8#0 ← (number~) main::toD0182_$3#0 | (number~) main::toD0182_$7#0 + (byte) main::toD0182_return#0 ← (number~) main::toD0182_$8#0 + to:main::toD0182_@return +main::toD0182_@return: scope:[main] from main::toD0182 + (byte) main::toD0182_return#2 ← phi( main::toD0182/(byte) main::toD0182_return#0 ) + (byte) main::toD0182_return#1 ← (byte) main::toD0182_return#2 + to:main::@2 +main::@2: scope:[main] from main::toD0182_@return + (byte) main::toD0182_return#3 ← phi( main::toD0182_@return/(byte) main::toD0182_return#1 ) + (byte~) main::$7 ← (byte) main::toD0182_return#3 + *((byte*) D018#0) ← (byte~) main::$7 to:main::@return -main::@return: scope:[main] from main::@3 +main::@return: scope:[main] from main::@2 return to:@return -init_angle_screen: scope:[init_angle_screen] from main::@1 - (byte*) init_angle_screen::screen#5 ← phi( main::@1/(byte*) init_angle_screen::screen#0 ) +init_angle_screen: scope:[init_angle_screen] from main::@4 + (byte*) init_angle_screen::screen#5 ← phi( main::@4/(byte*) init_angle_screen::screen#0 ) (signed byte) init_angle_screen::y#0 ← (signed byte) -$c to:init_angle_screen::@1 init_angle_screen::@1: scope:[init_angle_screen] from init_angle_screen init_angle_screen::@3 @@ -353,23 +537,44 @@ init_angle_screen::@3: scope:[init_angle_screen] from init_angle_screen::@5 init_angle_screen::@return: scope:[init_angle_screen] from init_angle_screen::@3 return to:@return -@12: scope:[] from @10 +@35: scope:[] from @33 call main - to:@13 -@13: scope:[] from @12 + to:@36 +@36: scope:[] from @35 to:@end -@end: scope:[] from @13 +@end: scope:[] from @36 SYMBOL TABLE SSA +(const string) $0 = (string) "0123456789abcdef" (label) @10 -(label) @12 -(label) @13 +(label) @26 (label) @3 +(label) @33 +(label) @35 +(label) @36 (label) @8 (label) @begin (label) @end (byte*) CHARSET (byte*) CHARSET#0 +(dword*) CIA2_TIMER_AB +(dword*) CIA2_TIMER_AB#0 +(byte*) CIA2_TIMER_A_CONTROL +(byte*) CIA2_TIMER_A_CONTROL#0 +(byte*) CIA2_TIMER_B_CONTROL +(byte*) CIA2_TIMER_B_CONTROL#0 +(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES +(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 +(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A +(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +(byte) CIA_TIMER_CONTROL_CONTINUOUS +(byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +(byte) CIA_TIMER_CONTROL_START +(byte) CIA_TIMER_CONTROL_START#0 +(byte) CIA_TIMER_CONTROL_STOP +(byte) CIA_TIMER_CONTROL_STOP#0 +(dword) CLOCKS_PER_INIT +(dword) CLOCKS_PER_INIT#0 (word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16 (word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 (byte) CORDIC_ITERATIONS_16 @@ -516,6 +721,25 @@ SYMBOL TABLE SSA (signed word) atan2_16::yi#7 (signed word) atan2_16::yi#8 (signed word) atan2_16::yi#9 +(dword()) clock() +(number~) clock::$0 +(label) clock::@return +(dword) clock::return +(dword) clock::return#0 +(dword) clock::return#1 +(dword) clock::return#2 +(dword) clock::return#3 +(dword) clock::return#4 +(void()) clock_start() +(byte~) clock_start::$0 +(byte~) clock_start::$1 +(byte~) clock_start::$2 +(byte~) clock_start::$3 +(byte~) clock_start::$4 +(byte~) clock_start::$5 +(byte~) clock_start::$6 +(byte~) clock_start::$7 +(label) clock_start::@return (void()) init_angle_screen((byte*) init_angle_screen::screen) (byte~) init_angle_screen::$0 (word~) init_angle_screen::$1 @@ -625,10 +849,23 @@ SYMBOL TABLE SSA (byte*) init_font_hex::proto_lo#4 (void()) main() (byte~) main::$1 +(dword~) main::$4 +(dword~) main::$5 +(byte~) main::$7 (label) main::@1 (label) main::@2 (label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@7 (label) main::@return +(byte*) main::BASE_CHARSET +(byte*) main::BASE_CHARSET#0 +(byte*) main::BASE_SCREEN +(byte*) main::BASE_SCREEN#0 +(dword) main::cyclecount +(dword) main::cyclecount#0 (label) main::toD0181 (word~) main::toD0181_$0 (word~) main::toD0181_$0#0 @@ -660,10 +897,107 @@ SYMBOL TABLE SSA (byte*) main::toD0181_screen (byte*) main::toD0181_screen#0 (byte*) main::toD0181_screen#1 +(label) main::toD0182 +(word~) main::toD0182_$0 +(word~) main::toD0182_$0#0 +(number~) main::toD0182_$1 +(number~) main::toD0182_$1#0 +(number~) main::toD0182_$2 +(number~) main::toD0182_$2#0 +(number~) main::toD0182_$3 +(number~) main::toD0182_$3#0 +(word~) main::toD0182_$4 +(word~) main::toD0182_$4#0 +(byte~) main::toD0182_$5 +(byte~) main::toD0182_$5#0 +(number~) main::toD0182_$6 +(number~) main::toD0182_$6#0 +(number~) main::toD0182_$7 +(number~) main::toD0182_$7#0 +(number~) main::toD0182_$8 +(number~) main::toD0182_$8#0 +(label) main::toD0182_@return +(byte*) main::toD0182_gfx +(byte*) main::toD0182_gfx#0 +(byte*) main::toD0182_gfx#1 +(byte) main::toD0182_return +(byte) main::toD0182_return#0 +(byte) main::toD0182_return#1 +(byte) main::toD0182_return#2 +(byte) main::toD0182_return#3 +(byte*) main::toD0182_screen +(byte*) main::toD0182_screen#0 +(byte*) main::toD0182_screen#1 +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 +(number~) print_byte_at::$2 +(byte*~) print_byte_at::$3 +(label) print_byte_at::@1 +(label) print_byte_at::@2 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 +(byte*) print_byte_at::at#1 +(byte*) print_byte_at::at#2 +(byte*) print_byte_at::at#3 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 +(byte) print_byte_at::b#1 +(byte) print_byte_at::b#2 +(byte) print_byte_at::b#3 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 +(byte*) print_char_at::at#1 +(byte*) print_char_at::at#2 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 +(byte) print_char_at::ch#1 +(byte) print_char_at::ch#2 +(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at) +(word~) print_dword_at::$0 +(word~) print_dword_at::$2 +(byte*~) print_dword_at::$3 +(label) print_dword_at::@1 +(label) print_dword_at::@2 +(label) print_dword_at::@return +(byte*) print_dword_at::at +(byte*) print_dword_at::at#0 +(byte*) print_dword_at::at#1 +(byte*) print_dword_at::at#2 +(dword) print_dword_at::dw +(dword) print_dword_at::dw#0 +(dword) print_dword_at::dw#1 +(dword) print_dword_at::dw#2 +(byte[]) print_hextab +(byte[]) print_hextab#0 +(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at) +(byte~) print_word_at::$0 +(byte~) print_word_at::$2 +(byte*~) print_word_at::$3 +(label) print_word_at::@1 +(label) print_word_at::@2 +(label) print_word_at::@return +(byte*) print_word_at::at +(byte*) print_word_at::at#0 +(byte*) print_word_at::at#1 +(byte*) print_word_at::at#2 +(byte*) print_word_at::at#3 +(word) print_word_at::w +(word) print_word_at::w#0 +(word) print_word_at::w#1 +(word) print_word_at::w#2 +(word) print_word_at::w#3 Fixing inline constructor with init_angle_screen::$11 ← (byte)init_angle_screen::$0 w= (byte)0 Fixing inline constructor with init_angle_screen::$12 ← (byte)init_angle_screen::$3 w= (byte)0 Successful SSA optimization Pass2FixInlineConstructorsNew +Adding number conversion cast (unumber) 0 in (byte) CIA_TIMER_CONTROL_STOP#0 ← (number) 0 +Adding number conversion cast (unumber) 1 in (byte) CIA_TIMER_CONTROL_START#0 ← (number) 1 +Adding number conversion cast (unumber) 0 in (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (number) 0 +Adding number conversion cast (unumber) 0 in (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (number) 0 +Adding number conversion cast (unumber) $40 in (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (number) $40 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 @@ -686,6 +1020,16 @@ Adding number conversion cast (snumber) 0 in (bool~) atan2_16::$10 ← (signed w 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) $12 in (dword) CLOCKS_PER_INIT#0 ← (number) $12 +Adding number conversion cast (unumber) $ffffffff in (number~) clock::$0 ← (number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) +Adding number conversion cast (unumber) clock::$0 in (number~) clock::$0 ← (unumber)(number) $ffffffff - *((dword*) CIA2_TIMER_AB#0) +Adding number conversion cast (unumber) $ffffffff in *((dword*) CIA2_TIMER_AB#0) ← (number) $ffffffff +Adding number conversion cast (unumber) 2 in (byte*~) print_word_at::$3 ← (byte*) print_word_at::at#3 + (number) 2 +Adding number conversion cast (unumber) 4 in (byte*~) print_dword_at::$3 ← (byte*) print_dword_at::at#2 + (number) 4 +Adding number conversion cast (unumber) 4 in (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (number) 4 +Adding number conversion cast (unumber) $f in (number~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (number) $f +Adding number conversion cast (unumber) print_byte_at::$2 in (number~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (unumber)(number) $f +Adding number conversion cast (unumber) 1 in (byte*~) print_byte_at::$3 ← (byte*) print_byte_at::at#3 + (number) 1 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 @@ -696,6 +1040,16 @@ Adding number conversion cast (unumber) main::toD0181_$6#0 in (number~) main::to 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) $3fff in (number~) main::toD0182_$1#0 ← (word~) main::toD0182_$0#0 & (number) $3fff +Adding number conversion cast (unumber) main::toD0182_$1#0 in (number~) main::toD0182_$1#0 ← (word~) main::toD0182_$0#0 & (unumber)(number) $3fff +Adding number conversion cast (unumber) 4 in (number~) main::toD0182_$2#0 ← (unumber~) main::toD0182_$1#0 * (number) 4 +Adding number conversion cast (unumber) main::toD0182_$2#0 in (number~) main::toD0182_$2#0 ← (unumber~) main::toD0182_$1#0 * (unumber)(number) 4 +Adding number conversion cast (unumber) main::toD0182_$3#0 in (number~) main::toD0182_$3#0 ← > (unumber~) main::toD0182_$2#0 +Adding number conversion cast (unumber) 4 in (number~) main::toD0182_$6#0 ← (byte~) main::toD0182_$5#0 / (number) 4 +Adding number conversion cast (unumber) main::toD0182_$6#0 in (number~) main::toD0182_$6#0 ← (byte~) main::toD0182_$5#0 / (unumber)(number) 4 +Adding number conversion cast (unumber) $f in (number~) main::toD0182_$7#0 ← (unumber~) main::toD0182_$6#0 & (number) $f +Adding number conversion cast (unumber) main::toD0182_$7#0 in (number~) main::toD0182_$7#0 ← (unumber~) main::toD0182_$6#0 & (unumber)(number) $f +Adding number conversion cast (unumber) main::toD0182_$8#0 in (number~) main::toD0182_$8#0 ← (unumber~) main::toD0182_$3#0 | (unumber~) main::toD0182_$7#0 Adding number conversion cast (unumber) $80 in (number~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (number) $80 Adding number conversion cast (unumber) init_angle_screen::$7 in (number~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (unumber)(number) $80 Adding number conversion cast (unumber) init_angle_screen::$8 in (number~) init_angle_screen::$8 ← > (unumber~) init_angle_screen::$7 @@ -703,22 +1057,44 @@ 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*) D018#0 ← (byte*)(number) $d018 +Inlining cast (dword*) CIA2_TIMER_AB#0 ← (dword*)(number) $dd04 +Inlining cast (byte*) CIA2_TIMER_A_CONTROL#0 ← (byte*)(number) $dd0e +Inlining cast (byte*) CIA2_TIMER_B_CONTROL#0 ← (byte*)(number) $dd0f +Inlining cast (byte) CIA_TIMER_CONTROL_STOP#0 ← (unumber)(number) 0 +Inlining cast (byte) CIA_TIMER_CONTROL_START#0 ← (unumber)(number) 1 +Inlining cast (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 ← (unumber)(number) 0 +Inlining cast (byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 ← (unumber)(number) 0 +Inlining cast (byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 ← (unumber)(number) $40 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) atan2_16::angle#0 ← (unumber)(number) 0 +Inlining cast (dword) CLOCKS_PER_INIT#0 ← (unumber)(number) $12 +Inlining cast *((dword*) CIA2_TIMER_AB#0) ← (unumber)(number) $ffffffff 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::BASE_SCREEN#0 ← (byte*)(number) $400 +Inlining cast (byte*) main::BASE_CHARSET#0 ← (byte*)(number) $1000 +Inlining cast (word~) main::toD0182_$0#0 ← (word)(byte*) main::toD0182_screen#1 +Inlining cast (word~) main::toD0182_$4#0 ← (word)(byte*) main::toD0182_gfx#1 Inlining cast (byte~) init_angle_screen::$0 ← (byte)(signed byte) init_angle_screen::x#2 Inlining cast (signed word~) init_angle_screen::$2 ← (signed word)(word~) init_angle_screen::$1 Inlining cast (byte~) init_angle_screen::$3 ← (byte)(signed byte) init_angle_screen::y#2 Inlining cast (signed word~) init_angle_screen::$5 ← (signed word)(word~) init_angle_screen::$4 Successful SSA optimization Pass2InlineCast Simplifying constant pointer cast (byte*) 53272 +Simplifying constant pointer cast (dword*) 56580 +Simplifying constant pointer cast (byte*) 56590 +Simplifying constant pointer cast (byte*) 56591 +Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast 0 +Simplifying constant integer cast 0 +Simplifying constant integer cast $40 Simplifying constant integer cast 0 Simplifying constant integer cast 0 Simplifying constant integer cast 4 @@ -819,12 +1195,26 @@ Simplifying constant integer cast 2 Simplifying constant integer cast 0 Simplifying constant integer cast 0 Simplifying constant integer cast $8000 +Simplifying constant integer cast $12 +Simplifying constant integer cast $ffffffff +Simplifying constant integer cast $ffffffff +Simplifying constant integer cast 2 +Simplifying constant integer cast 4 +Simplifying constant integer cast 4 +Simplifying constant integer cast $f +Simplifying constant integer cast 1 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 pointer cast (byte*) 1024 +Simplifying constant pointer cast (byte*) 4096 +Simplifying constant integer cast $3fff +Simplifying constant integer cast 4 +Simplifying constant integer cast 4 +Simplifying constant integer cast $f Simplifying constant integer cast (byte~) init_angle_screen::$0 Simplifying constant integer cast 0 Simplifying constant integer cast (byte~) init_angle_screen::$3 @@ -832,6 +1222,11 @@ 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) 1 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) 0 +Finalized unsigned number type (byte) $40 +Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 4 Finalized unsigned number type (byte) 1 @@ -851,6 +1246,18 @@ 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) $12 +Finalized unsigned number type (dword) $ffffffff +Finalized unsigned number type (dword) $ffffffff +Finalized unsigned number type (byte) 2 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) 4 +Finalized unsigned number type (byte) $f +Finalized unsigned number type (byte) 1 +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 (word) $3fff Finalized unsigned number type (byte) 4 Finalized unsigned number type (byte) 4 @@ -859,17 +1266,25 @@ 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 dword in (unumber~) clock::$0 ← (dword) $ffffffff - *((dword*) CIA2_TIMER_AB#0) +Inferred type updated to byte in (unumber~) print_byte_at::$2 ← (byte) print_byte_at::b#3 & (byte) $f 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~) main::toD0182_$1#0 ← (word~) main::toD0182_$0#0 & (word) $3fff +Inferred type updated to word in (unumber~) main::toD0182_$2#0 ← (word~) main::toD0182_$1#0 * (byte) 4 +Inferred type updated to byte in (unumber~) main::toD0182_$3#0 ← > (word~) main::toD0182_$2#0 +Inferred type updated to byte in (unumber~) main::toD0182_$6#0 ← (byte~) main::toD0182_$5#0 / (byte) 4 +Inferred type updated to byte in (unumber~) main::toD0182_$7#0 ← (byte~) main::toD0182_$6#0 & (byte) $f +Inferred type updated to byte in (unumber~) main::toD0182_$8#0 ← (byte~) main::toD0182_$3#0 | (byte~) main::toD0182_$7#0 Inferred type updated to word in (unumber~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 Inferred type updated to byte in (unumber~) init_angle_screen::$8 ← > (word~) init_angle_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 [72] (bool~) atan2_16::$18 ← (signed word) atan2_16::yi#3 != (signed byte) 0 from [71] (bool~) atan2_16::$17 ← (signed word) atan2_16::yi#3 == (signed byte) 0 +Inversing boolean not [84] (bool~) atan2_16::$11 ← (signed word) atan2_16::x#4 >= (signed byte) 0 from [83] (bool~) atan2_16::$10 ← (signed word) atan2_16::x#4 < (signed byte) 0 +Inversing boolean not [102] (bool~) atan2_16::$14 ← (signed word) atan2_16::y#4 >= (signed byte) 0 from [101] (bool~) atan2_16::$13 ← (signed word) atan2_16::y#4 < (signed byte) 0 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 @@ -900,9 +1315,28 @@ 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 (dword) clock::return#0 = (dword~) clock::$0 (dword) clock::return#3 (dword) clock::return#1 +Alias (byte) print_byte_at::b#0 = (byte~) print_word_at::$0 +Alias (word) print_word_at::w#2 = (word) print_word_at::w#3 +Alias (byte*) print_word_at::at#2 = (byte*) print_word_at::at#3 +Alias (byte) print_byte_at::b#1 = (byte~) print_word_at::$2 +Alias (byte*) print_byte_at::at#1 = (byte*~) print_word_at::$3 +Alias (word) print_word_at::w#0 = (word~) print_dword_at::$0 +Alias (dword) print_dword_at::dw#1 = (dword) print_dword_at::dw#2 +Alias (byte*) print_dword_at::at#1 = (byte*) print_dword_at::at#2 +Alias (word) print_word_at::w#1 = (word~) print_dword_at::$2 +Alias (byte*) print_word_at::at#1 = (byte*~) print_dword_at::$3 +Alias (byte) print_byte_at::b#2 = (byte) print_byte_at::b#3 +Alias (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#3 +Alias (byte*) print_char_at::at#1 = (byte*~) print_byte_at::$3 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 (dword) clock::return#2 = (dword) clock::return#4 +Alias (dword) main::cyclecount#0 = (dword~) main::$5 +Alias (byte*) main::BASE_SCREEN#0 = (byte*) main::toD0182_screen#0 (byte*) main::toD0182_screen#1 +Alias (byte*) main::BASE_CHARSET#0 = (byte*) main::toD0182_gfx#0 (byte*) main::toD0182_gfx#1 +Alias (byte) main::toD0182_return#0 = (byte~) main::toD0182_$8#0 (byte) main::toD0182_return#2 (byte) main::toD0182_return#1 (byte) main::toD0182_return#3 (byte~) main::$7 Alias (word~) init_angle_screen::$1 = (word~) init_angle_screen::$11 Alias (signed word) init_angle_screen::xw#0 = (signed word~) init_angle_screen::$2 Alias (word~) init_angle_screen::$4 = (word~) init_angle_screen::$12 @@ -945,27 +1379,40 @@ 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 (dword) print_dword_at::dw#1 (dword) print_dword_at::dw#0 +Identical Phi Values (byte*) print_dword_at::at#1 (byte*) print_dword_at::at#0 Identical Phi Values (byte*) init_angle_screen::screen#5 (byte*) init_angle_screen::screen#0 Identical Phi Values (signed byte) init_angle_screen::y#2 (signed byte) init_angle_screen::y#4 Successful SSA optimization Pass2IdenticalPhiElimination -Simple Condition (bool~) init_font_hex::$3 [20] if((byte) init_font_hex::i#1!=rangelast(0,4)) goto init_font_hex::@3 -Simple Condition (bool~) init_font_hex::$4 [30] if((byte) init_font_hex::c1#1!=rangelast(0,$f)) goto init_font_hex::@2 -Simple Condition (bool~) init_font_hex::$5 [35] 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~) init_angle_screen::$9 [161] if((signed byte) init_angle_screen::x#1!=rangelast(-$13,$14)) goto init_angle_screen::@2 -Simple Condition (bool~) init_angle_screen::$10 [165] if((signed byte) init_angle_screen::y#1!=rangelast(-$c,$c)) goto init_angle_screen::@1 +Identified duplicate assignment right side [124] (byte~) clock_start::$2 ← (byte) CIA_TIMER_CONTROL_STOP#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Identified duplicate assignment right side [131] (byte~) clock_start::$6 ← (byte) CIA_TIMER_CONTROL_START#0 | (byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Successful SSA optimization Pass2DuplicateRValueIdentification +Simple Condition (bool~) init_font_hex::$3 [28] if((byte) init_font_hex::i#1!=rangelast(0,4)) goto init_font_hex::@3 +Simple Condition (bool~) init_font_hex::$4 [38] if((byte) init_font_hex::c1#1!=rangelast(0,$f)) goto init_font_hex::@2 +Simple Condition (bool~) init_font_hex::$5 [43] if((byte) init_font_hex::c#1!=rangelast(0,$f)) goto init_font_hex::@1 +Simple Condition (bool~) atan2_16::$0 [50] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 +Simple Condition (bool~) atan2_16::$5 [59] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 +Simple Condition (bool~) atan2_16::$18 [73] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@16 +Simple Condition (bool~) atan2_16::$21 [80] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@18 +Simple Condition (bool~) atan2_16::$11 [85] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 +Simple Condition (bool~) atan2_16::$22 [99] if((byte) atan2_16::i#1!=rangelast(0,atan2_16::$16)) goto atan2_16::@15 +Simple Condition (bool~) atan2_16::$14 [103] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 +Simple Condition (bool~) init_angle_screen::$9 [259] if((signed byte) init_angle_screen::x#1!=rangelast(-$13,$14)) goto init_angle_screen::@2 +Simple Condition (bool~) init_angle_screen::$10 [263] if((signed byte) init_angle_screen::y#1!=rangelast(-$c,$c)) goto init_angle_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 +Negating conditional jump and destination [99] if((byte) atan2_16::i#1==rangelast(0,atan2_16::$16)) goto atan2_16::@17 Successful SSA optimization Pass2ConditionalJumpSequenceImprovement -Constant right-side identified [37] (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 } +Constant right-side identified [45] (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*) D018#0 = (byte*) 53272 +Constant (const dword*) CIA2_TIMER_AB#0 = (dword*) 56580 +Constant (const byte*) CIA2_TIMER_A_CONTROL#0 = (byte*) 56590 +Constant (const byte*) CIA2_TIMER_B_CONTROL#0 = (byte*) 56591 +Constant (const byte) CIA_TIMER_CONTROL_STOP#0 = 0 +Constant (const byte) CIA_TIMER_CONTROL_START#0 = 1 +Constant (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 = 0 +Constant (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 = 0 +Constant (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 = $40 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 @@ -977,8 +1424,12 @@ Constant (const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 = kickasm }} Constant (const word) atan2_16::angle#0 = 0 Constant (const byte) atan2_16::i#0 = 0 +Constant (const dword) CLOCKS_PER_INIT#0 = $12 +Constant (const byte[]) print_hextab#0 = $0 Constant (const byte*) CHARSET#0 = (byte*) 8192 Constant (const byte*) SCREEN#0 = (byte*) 10240 +Constant (const byte*) main::BASE_SCREEN#0 = (byte*) 1024 +Constant (const byte*) main::BASE_CHARSET#0 = (byte*) 4096 Constant (const signed byte) init_angle_screen::y#0 = -$c Constant (const signed byte) init_angle_screen::x#0 = -$13 Successful SSA optimization Pass2ConstantIdentification @@ -988,23 +1439,34 @@ 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*) init_angle_screen::screen#0 = SCREEN#0 +Constant (const byte*) print_dword_at::at#0 = main::BASE_SCREEN#0 Successful SSA optimization Pass2ConstantIdentification -Constant value identified (word)main::toD0181_screen#0 in [114] (word~) main::toD0181_$0#0 ← (word)(const byte*) main::toD0181_screen#0 -Constant value identified (word)main::toD0181_gfx#0 in [118] (word~) main::toD0181_$4#0 ← (word)(const byte*) main::toD0181_gfx#0 +Constant (const byte*) print_word_at::at#0 = print_dword_at::at#0 +Successful SSA optimization Pass2ConstantIdentification +Constant value identified (word)main::toD0181_screen#0 in [182] (word~) main::toD0181_$0#0 ← (word)(const byte*) main::toD0181_screen#0 +Constant value identified (word)main::toD0181_gfx#0 in [186] (word~) main::toD0181_$4#0 ← (word)(const byte*) main::toD0181_gfx#0 +Constant value identified (word)main::BASE_SCREEN#0 in [214] (word~) main::toD0182_$0#0 ← (word)(const byte*) main::BASE_SCREEN#0 +Constant value identified (word)main::BASE_CHARSET#0 in [218] (word~) main::toD0182_$4#0 ← (word)(const byte*) main::BASE_CHARSET#0 Successful SSA optimization Pass2ConstantValues -Resolved ranged next value [18] init_font_hex::i#1 ← ++ init_font_hex::i#2 to ++ -Resolved ranged comparison value [20] if(init_font_hex::i#1!=rangelast(0,4)) goto init_font_hex::@3 to (number) 5 -Resolved ranged next value [28] init_font_hex::c1#1 ← ++ init_font_hex::c1#4 to ++ -Resolved ranged comparison value [30] if(init_font_hex::c1#1!=rangelast(0,$f)) goto init_font_hex::@2 to (number) $10 -Resolved ranged next value [33] init_font_hex::c#1 ← ++ init_font_hex::c#5 to ++ -Resolved ranged comparison value [35] if(init_font_hex::c#1!=rangelast(0,$f)) goto init_font_hex::@1 to (number) $10 -Resolved ranged next value [159] init_angle_screen::x#1 ← ++ init_angle_screen::x#2 to ++ -Resolved ranged comparison value [161] if(init_angle_screen::x#1!=rangelast(-$13,$14)) goto init_angle_screen::@2 to (number) $15 -Resolved ranged next value [163] init_angle_screen::y#1 ← ++ init_angle_screen::y#4 to ++ -Resolved ranged comparison value [165] if(init_angle_screen::y#1!=rangelast(-$c,$c)) goto init_angle_screen::@1 to (number) $d -Simplifying expression containing zero init_font_hex::charset#2 in [9] *((byte*) init_font_hex::charset#2 + (const byte) init_font_hex::idx#0) ← (byte) 0 +Resolved ranged next value [26] init_font_hex::i#1 ← ++ init_font_hex::i#2 to ++ +Resolved ranged comparison value [28] if(init_font_hex::i#1!=rangelast(0,4)) goto init_font_hex::@3 to (number) 5 +Resolved ranged next value [36] init_font_hex::c1#1 ← ++ init_font_hex::c1#4 to ++ +Resolved ranged comparison value [38] if(init_font_hex::c1#1!=rangelast(0,$f)) goto init_font_hex::@2 to (number) $10 +Resolved ranged next value [41] init_font_hex::c#1 ← ++ init_font_hex::c#5 to ++ +Resolved ranged comparison value [43] if(init_font_hex::c#1!=rangelast(0,$f)) goto init_font_hex::@1 to (number) $10 +Resolved ranged next value [257] init_angle_screen::x#1 ← ++ init_angle_screen::x#2 to ++ +Resolved ranged comparison value [259] if(init_angle_screen::x#1!=rangelast(-$13,$14)) goto init_angle_screen::@2 to (number) $15 +Resolved ranged next value [261] init_angle_screen::y#1 ← ++ init_angle_screen::y#4 to ++ +Resolved ranged comparison value [263] if(init_angle_screen::y#1!=rangelast(-$c,$c)) goto init_angle_screen::@1 to (number) $d +Simplifying expression containing zero init_font_hex::charset#2 in [17] *((byte*) init_font_hex::charset#2 + (const byte) init_font_hex::idx#0) ← (byte) 0 +Simplifying expression containing zero CIA_TIMER_CONTROL_CONTINUOUS#0 in [121] (byte~) clock_start::$0 ← (const byte) CIA_TIMER_CONTROL_STOP#0 | (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Simplifying expression containing zero clock_start::$0 in [122] (byte~) clock_start::$1 ← (byte~) clock_start::$0 | (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 +Simplifying expression containing zero CIA_TIMER_CONTROL_START#0 in [128] (byte~) clock_start::$4 ← (const byte) CIA_TIMER_CONTROL_START#0 | (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 +Simplifying expression containing zero clock_start::$6 in [132] (byte~) clock_start::$7 ← (byte~) clock_start::$6 | (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#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 +Eliminating unused constant (const byte) CIA_TIMER_CONTROL_STOP#0 +Eliminating unused constant (const byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES#0 Successful SSA optimization PassNEliminateUnusedVars 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 @@ -1024,6 +1486,9 @@ Finalized unsigned number type (byte) $10 Finalized signed number type (signed byte) $15 Finalized signed number type (signed byte) $d Successful SSA optimization PassNFinalizeNumberTypeConversions +Alias (byte~) clock_start::$1 = (byte~) clock_start::$0 (byte~) clock_start::$2 +Alias (byte~) clock_start::$6 = (byte~) clock_start::$4 (byte~) clock_start::$7 +Successful SSA optimization Pass2AliasElimination Self Phi Eliminated (byte*) init_font_hex::proto_hi#4 Self Phi Eliminated (byte) init_font_hex::c#5 Successful SSA optimization Pass2SelfPhiElimination @@ -1032,14 +1497,22 @@ 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 [29] (byte~) atan2_16::$16 ← (const byte) CORDIC_ITERATIONS_16#0 - (byte) 1 +Constant right-side identified [82] (byte*) print_word_at::at#1 ← (const byte*) print_dword_at::at#0 + (byte) 4 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 byte) clock_start::$1 = CIA_TIMER_CONTROL_CONTINUOUS#0 +Constant (const byte) clock_start::$6 = CIA_TIMER_CONTROL_START#0 +Constant (const byte*) print_word_at::at#1 = print_dword_at::at#0+4 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 word) main::toD0182_$0#0 = (word)main::BASE_SCREEN#0 +Constant (const word) main::toD0182_$4#0 = (word)main::BASE_CHARSET#0 Successful SSA optimization Pass2ConstantIdentification Resolved ranged next value [47] atan2_16::i#1 ← ++ atan2_16::i#2 to ++ Resolved ranged comparison value [48] if(atan2_16::i#1==rangelast(0,atan2_16::$16)) goto atan2_16::@17 to (const byte) atan2_16::$16+(number) 1 +Simplifying expression containing zero CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 in [61] (byte~) clock_start::$3 ← (const byte) clock_start::$1 | (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Successful SSA optimization PassNSimplifyExpressionWithZero 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 @@ -1048,33 +1521,50 @@ Simplifying constant integer cast 1 Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions -Constant right-side identified [54] (word~) main::toD0181_$1#0 ← (const word) main::toD0181_$0#0 & (word) $3fff -Constant right-side identified [57] (byte~) main::toD0181_$5#0 ← > (const word) main::toD0181_$4#0 +Constant right-side identified [59] (byte~) clock_start::$5 ← (const byte) clock_start::$6 | (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Constant right-side identified [90] (word~) main::toD0181_$1#0 ← (const word) main::toD0181_$0#0 & (word) $3fff +Constant right-side identified [93] (byte~) main::toD0181_$5#0 ← > (const word) main::toD0181_$4#0 +Constant right-side identified [106] (word~) main::toD0182_$1#0 ← (const word) main::toD0182_$0#0 & (word) $3fff +Constant right-side identified [109] (byte~) main::toD0182_$5#0 ← > (const word) main::toD0182_$4#0 Successful SSA optimization Pass2ConstantRValueConsolidation +Constant (const byte) clock_start::$3 = CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 +Constant (const byte) clock_start::$5 = clock_start::$6|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 Constant (const word) main::toD0181_$1#0 = main::toD0181_$0#0&$3fff Constant (const byte) main::toD0181_$5#0 = >main::toD0181_$4#0 +Constant (const word) main::toD0182_$1#0 = main::toD0182_$0#0&$3fff +Constant (const byte) main::toD0182_$5#0 = >main::toD0182_$4#0 Successful SSA optimization Pass2ConstantIdentification -Constant right-side identified [54] (word~) main::toD0181_$2#0 ← (const word) main::toD0181_$1#0 * (byte) 4 -Constant right-side identified [56] (byte~) main::toD0181_$6#0 ← (const byte) main::toD0181_$5#0 / (byte) 4 +Constant right-side identified [88] (word~) main::toD0181_$2#0 ← (const word) main::toD0181_$1#0 * (byte) 4 +Constant right-side identified [90] (byte~) main::toD0181_$6#0 ← (const byte) main::toD0181_$5#0 / (byte) 4 +Constant right-side identified [102] (word~) main::toD0182_$2#0 ← (const word) main::toD0182_$1#0 * (byte) 4 +Constant right-side identified [104] (byte~) main::toD0182_$6#0 ← (const byte) main::toD0182_$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 +Constant (const word) main::toD0182_$2#0 = main::toD0182_$1#0*4 +Constant (const byte) main::toD0182_$6#0 = main::toD0182_$5#0/4 Successful SSA optimization Pass2ConstantIdentification -Constant right-side identified [54] (byte~) main::toD0181_$3#0 ← > (const word) main::toD0181_$2#0 -Constant right-side identified [55] (byte~) main::toD0181_$7#0 ← (const byte) main::toD0181_$6#0 & (byte) $f +Constant right-side identified [88] (byte~) main::toD0181_$3#0 ← > (const word) main::toD0181_$2#0 +Constant right-side identified [89] (byte~) main::toD0181_$7#0 ← (const byte) main::toD0181_$6#0 & (byte) $f +Constant right-side identified [100] (byte~) main::toD0182_$3#0 ← > (const word) main::toD0182_$2#0 +Constant right-side identified [101] (byte~) main::toD0182_$7#0 ← (const byte) main::toD0182_$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 +Constant (const byte) main::toD0182_$3#0 = >main::toD0182_$2#0 +Constant (const byte) main::toD0182_$7#0 = main::toD0182_$6#0&$f Successful SSA optimization Pass2ConstantIdentification -Constant right-side identified [54] (byte) main::toD0181_return#0 ← (const byte) main::toD0181_$3#0 | (const byte) main::toD0181_$7#0 +Constant right-side identified [88] (byte) main::toD0181_return#0 ← (const byte) main::toD0181_$3#0 | (const byte) main::toD0181_$7#0 +Constant right-side identified [98] (byte) main::toD0182_return#0 ← (const byte) main::toD0182_$3#0 | (const byte) main::toD0182_$7#0 Successful SSA optimization Pass2ConstantRValueConsolidation Constant (const byte) main::toD0181_return#0 = main::toD0181_$3#0|main::toD0181_$7#0 +Constant (const byte) main::toD0182_return#0 = main::toD0182_$3#0|main::toD0182_$7#0 Successful SSA optimization Pass2ConstantIdentification -Inlining Noop Cast [59] (byte~) init_angle_screen::$0 ← (byte)(signed byte) init_angle_screen::x#2 keeping init_angle_screen::x#2 -Inlining Noop Cast [62] (byte~) init_angle_screen::$3 ← (byte)(signed byte) init_angle_screen::y#4 keeping init_angle_screen::y#4 +Inlining Noop Cast [101] (byte~) init_angle_screen::$0 ← (byte)(signed byte) init_angle_screen::x#2 keeping init_angle_screen::x#2 +Inlining Noop Cast [104] (byte~) init_angle_screen::$3 ← (byte)(signed byte) init_angle_screen::y#4 keeping init_angle_screen::y#4 Successful SSA optimization Pass2NopCastInlining -Inlining Noop Cast [61] (signed word) init_angle_screen::xw#0 ← (signed word)(word~) init_angle_screen::$1 keeping init_angle_screen::xw#0 -Inlining Noop Cast [64] (signed word) init_angle_screen::yw#0 ← (signed word)(word~) init_angle_screen::$4 keeping init_angle_screen::yw#0 +Inlining Noop Cast [103] (signed word) init_angle_screen::xw#0 ← (signed word)(word~) init_angle_screen::$1 keeping init_angle_screen::xw#0 +Inlining Noop Cast [106] (signed word) init_angle_screen::yw#0 ← (signed word)(word~) init_angle_screen::$4 keeping init_angle_screen::yw#0 Successful SSA optimization Pass2NopCastInlining Rewriting division to use shift [34] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 / (byte) 2 Rewriting multiplication to use shift [38] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 * (const byte) SIZEOF_WORD @@ -1090,33 +1580,51 @@ 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*) print_word_at::at#0 +Inlining constant with var siblings (const byte*) print_word_at::at#1 Inlining constant with var siblings (const signed byte) init_angle_screen::y#0 Inlining constant with var siblings (const signed byte) init_angle_screen::x#0 Inlining constant with var siblings (const byte*) init_angle_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 init_font_hex::proto_hi#0 = (const byte[]) FONT_HEX_PROTO#0 -Constant inlined atan2_16::i#0 = (byte) 0 Constant inlined init_angle_screen::y#0 = (signed byte) -$c Constant inlined init_angle_screen::x#0 = (signed byte) -$13 -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 $0 = (const byte[]) print_hextab#0 +Constant inlined clock_start::$5 = (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 Constant inlined atan2_16::angle#0 = (byte) 0 +Constant inlined clock_start::$6 = (const byte) CIA_TIMER_CONTROL_START#0 +Constant inlined clock_start::$3 = (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 Constant inlined init_font_hex::charset#1 = (const byte*) CHARSET#0 +Constant inlined print_dword_at::at#0 = (const byte*) main::BASE_SCREEN#0 +Constant inlined init_angle_screen::screen#0 = (const byte*) SCREEN#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 main::toD0182_$4#0 = (word)(const byte*) main::BASE_CHARSET#0 +Constant inlined atan2_16::i#0 = (byte) 0 +Constant inlined main::toD0182_$3#0 = >(word)(const byte*) main::BASE_SCREEN#0&(word) $3fff*(byte) 4 +Constant inlined main::toD0181_$0#0 = (word)(const byte*) SCREEN#0 +Constant inlined main::toD0182_$6#0 = >(word)(const byte*) main::BASE_CHARSET#0/(byte) 4 +Constant inlined main::toD0181_$1#0 = (word)(const byte*) SCREEN#0&(word) $3fff +Constant inlined main::toD0182_$5#0 = >(word)(const byte*) main::BASE_CHARSET#0 +Constant inlined init_font_hex::i#0 = (byte) 0 +Constant inlined main::toD0182_$7#0 = >(word)(const byte*) main::BASE_CHARSET#0/(byte) 4&(byte) $f +Constant inlined clock_start::$1 = (const byte) CIA_TIMER_CONTROL_CONTINUOUS#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::toD0182_$0#0 = (word)(const byte*) main::BASE_SCREEN#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 init_angle_screen::screen#0 = (const byte*) SCREEN#0 Constant inlined main::toD0181_$4#0 = (word)(const byte*) CHARSET#0 +Constant inlined main::toD0182_$2#0 = (word)(const byte*) main::BASE_SCREEN#0&(word) $3fff*(byte) 4 Constant inlined main::toD0181_$5#0 = >(word)(const byte*) CHARSET#0 +Constant inlined main::toD0182_$1#0 = (word)(const byte*) main::BASE_SCREEN#0&(word) $3fff 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 init_font_hex::c1#0 = (byte) 0 -Constant inlined atan2_16::$16 = (const byte) CORDIC_ITERATIONS_16#0-(byte) 1 +Constant inlined print_word_at::at#1 = (const byte*) main::BASE_SCREEN#0+(byte) 4 +Constant inlined print_word_at::at#0 = (const byte*) main::BASE_SCREEN#0 Successful SSA optimization Pass2ConstantInlining Simplifying constant integer increment ++0 Successful SSA optimization Pass2ConstantSimplification @@ -1136,66 +1644,94 @@ Adding NOP phi() at start of @begin Adding NOP phi() at start of @3 Adding NOP phi() at start of @8 Adding NOP phi() at start of @10 -Adding NOP phi() at start of @12 -Adding NOP phi() at start of @13 +Adding NOP phi() at start of @26 +Adding NOP phi() at start of @33 +Adding NOP phi() at start of @35 +Adding NOP phi() at start of @36 Adding NOP phi() at start of @end Adding NOP phi() at start of main -Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@3 Adding NOP phi() at start of main::toD0181 Adding NOP phi() at start of main::toD0181_@return -Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@4 +Adding NOP phi() at start of main::@5 +Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of main::toD0182 +Adding NOP phi() at start of main::toD0182_@return +Adding NOP phi() at start of print_dword_at::@2 +Adding NOP phi() at start of print_word_at::@2 +Adding NOP phi() at start of print_byte_at::@2 Adding NOP phi() at start of init_angle_screen Adding NOP phi() at start of init_font_hex CALL GRAPH -Calls in [] to main:5 -Calls in [main] to init_font_hex:9 init_angle_screen:14 -Calls in [init_angle_screen] to atan2_16:25 +Calls in [] to main:7 +Calls in [main] to init_font_hex:11 clock_start:16 init_angle_screen:18 clock:20 print_dword_at:25 +Calls in [print_dword_at] to print_word_at:33 print_word_at:36 +Calls in [print_word_at] to print_byte_at:44 print_byte_at:49 +Calls in [print_byte_at] to print_char_at:58 print_char_at:64 +Calls in [init_angle_screen] to atan2_16:80 -Created 24 initial phi equivalence classes -Coalesced [19] init_angle_screen::screen#8 ← init_angle_screen::screen#4 -Coalesced [37] init_angle_screen::y#6 ← init_angle_screen::y#1 -Coalesced [38] init_angle_screen::screen#7 ← init_angle_screen::screen#1 -Coalesced [39] init_angle_screen::x#4 ← init_angle_screen::x#1 -Coalesced (already) [40] init_angle_screen::screen#9 ← init_angle_screen::screen#1 -Coalesced [43] atan2_16::yi#12 ← atan2_16::$2 -Coalesced [47] atan2_16::xi#9 ← atan2_16::$7 -Coalesced [49] atan2_16::yi#14 ← atan2_16::yi#0 -Coalesced [50] atan2_16::xi#11 ← atan2_16::xi#0 -Coalesced [53] atan2_16::angle#17 ← atan2_16::angle#12 -Coalesced [58] atan2_16::angle#22 ← atan2_16::angle#4 -Coalesced [62] atan2_16::return#5 ← atan2_16::angle#5 -Coalesced [65] atan2_16::return#6 ← atan2_16::angle#11 -Coalesced [66] atan2_16::angle#21 ← atan2_16::angle#1 -Coalesced [74] atan2_16::yi#16 ← atan2_16::yi#2 -Coalesced [75] atan2_16::angle#20 ← atan2_16::angle#3 -Coalesced [76] atan2_16::xi#13 ← atan2_16::xi#2 -Coalesced [80] atan2_16::yi#13 ← atan2_16::yi#7 -Coalesced [81] atan2_16::xi#10 ← atan2_16::xi#7 -Coalesced [82] atan2_16::i#7 ← atan2_16::i#1 -Coalesced [83] atan2_16::angle#16 ← atan2_16::angle#13 -Coalesced (already) [84] atan2_16::angle#18 ← atan2_16::angle#13 -Coalesced [89] atan2_16::yi#15 ← atan2_16::yi#1 -Coalesced [90] atan2_16::angle#19 ← atan2_16::angle#2 -Coalesced [91] atan2_16::xi#12 ← atan2_16::xi#1 -Not coalescing [92] atan2_16::xi#8 ← atan2_16::x#0 -Not coalescing [93] atan2_16::yi#11 ← atan2_16::y#0 -Coalesced [96] init_font_hex::charset#9 ← init_font_hex::charset#5 -Coalesced [118] init_font_hex::charset#8 ← init_font_hex::charset#0 -Coalesced [119] init_font_hex::proto_hi#7 ← init_font_hex::proto_hi#1 -Coalesced [120] init_font_hex::c#7 ← init_font_hex::c#1 -Coalesced (already) [121] init_font_hex::charset#10 ← init_font_hex::charset#0 -Coalesced [122] init_font_hex::proto_lo#5 ← init_font_hex::proto_lo#1 -Coalesced [123] init_font_hex::c1#5 ← init_font_hex::c1#1 -Coalesced [124] init_font_hex::i#3 ← init_font_hex::i#1 -Coalesced [125] init_font_hex::idx#7 ← init_font_hex::idx#2 -Coalesced down to 17 phi equivalence classes +Created 30 initial phi equivalence classes +Coalesced [32] print_word_at::w#4 ← print_word_at::w#0 +Coalesced [35] print_word_at::w#5 ← print_word_at::w#1 +Coalesced [42] print_byte_at::b#4 ← print_byte_at::b#0 +Coalesced [43] print_byte_at::at#4 ← print_byte_at::at#0 +Coalesced [47] print_byte_at::b#5 ← print_byte_at::b#1 +Coalesced [48] print_byte_at::at#5 ← print_byte_at::at#1 +Coalesced [56] print_char_at::ch#3 ← print_char_at::ch#0 +Coalesced [57] print_char_at::at#3 ← print_char_at::at#0 +Coalesced [62] print_char_at::ch#4 ← print_char_at::ch#1 +Coalesced [63] print_char_at::at#4 ← print_char_at::at#1 +Coalesced [74] init_angle_screen::screen#8 ← init_angle_screen::screen#4 +Coalesced [92] init_angle_screen::y#6 ← init_angle_screen::y#1 +Coalesced [93] init_angle_screen::screen#7 ← init_angle_screen::screen#1 +Coalesced [94] init_angle_screen::x#4 ← init_angle_screen::x#1 +Coalesced (already) [95] init_angle_screen::screen#9 ← init_angle_screen::screen#1 +Coalesced [98] atan2_16::yi#12 ← atan2_16::$2 +Coalesced [102] atan2_16::xi#9 ← atan2_16::$7 +Coalesced [104] atan2_16::yi#14 ← atan2_16::yi#0 +Coalesced [105] atan2_16::xi#11 ← atan2_16::xi#0 +Coalesced [108] atan2_16::angle#17 ← atan2_16::angle#12 +Coalesced [113] atan2_16::angle#22 ← atan2_16::angle#4 +Coalesced [117] atan2_16::return#5 ← atan2_16::angle#5 +Coalesced [120] atan2_16::return#6 ← atan2_16::angle#11 +Coalesced [121] atan2_16::angle#21 ← atan2_16::angle#1 +Coalesced [129] atan2_16::yi#16 ← atan2_16::yi#2 +Coalesced [130] atan2_16::angle#20 ← atan2_16::angle#3 +Coalesced [131] atan2_16::xi#13 ← atan2_16::xi#2 +Coalesced [135] atan2_16::yi#13 ← atan2_16::yi#7 +Coalesced [136] atan2_16::xi#10 ← atan2_16::xi#7 +Coalesced [137] atan2_16::i#7 ← atan2_16::i#1 +Coalesced [138] atan2_16::angle#16 ← atan2_16::angle#13 +Coalesced (already) [139] atan2_16::angle#18 ← atan2_16::angle#13 +Coalesced [144] atan2_16::yi#15 ← atan2_16::yi#1 +Coalesced [145] atan2_16::angle#19 ← atan2_16::angle#2 +Coalesced [146] atan2_16::xi#12 ← atan2_16::xi#1 +Not coalescing [147] atan2_16::xi#8 ← atan2_16::x#0 +Not coalescing [148] atan2_16::yi#11 ← atan2_16::y#0 +Coalesced [157] init_font_hex::charset#9 ← init_font_hex::charset#5 +Coalesced [179] init_font_hex::charset#8 ← init_font_hex::charset#0 +Coalesced [180] init_font_hex::proto_hi#7 ← init_font_hex::proto_hi#1 +Coalesced [181] init_font_hex::c#7 ← init_font_hex::c#1 +Coalesced (already) [182] init_font_hex::charset#10 ← init_font_hex::charset#0 +Coalesced [183] init_font_hex::proto_lo#5 ← init_font_hex::proto_lo#1 +Coalesced [184] init_font_hex::c1#5 ← init_font_hex::c1#1 +Coalesced [185] init_font_hex::i#3 ← init_font_hex::i#1 +Coalesced [186] init_font_hex::idx#7 ← init_font_hex::idx#2 +Coalesced down to 23 phi equivalence classes Culled Empty Block (label) @3 Culled Empty Block (label) @8 Culled Empty Block (label) @10 -Culled Empty Block (label) @13 -Culled Empty Block (label) main::@2 -Culled Empty Block (label) main::toD0181_@return +Culled Empty Block (label) @26 +Culled Empty Block (label) @33 +Culled Empty Block (label) @36 Culled Empty Block (label) main::@3 +Culled Empty Block (label) main::toD0181_@return +Culled Empty Block (label) main::@7 +Culled Empty Block (label) main::toD0182_@return +Culled Empty Block (label) print_dword_at::@2 +Culled Empty Block (label) print_word_at::@2 +Culled Empty Block (label) print_byte_at::@2 Culled Empty Block (label) init_angle_screen::@6 Culled Empty Block (label) init_angle_screen::@7 Culled Empty Block (label) atan2_16::@27 @@ -1206,7 +1742,7 @@ 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 @12 to @1 +Renumbering block @35 to @1 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 @@ -1215,12 +1751,18 @@ 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::@3 +Renumbering block main::@5 to main::@4 +Renumbering block main::@6 to main::@5 Renumbering block init_angle_screen::@5 to init_angle_screen::@4 Adding NOP phi() at start of @begin Adding NOP phi() at start of @1 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 main::@3 +Adding NOP phi() at start of main::@4 +Adding NOP phi() at start of main::toD0182 Adding NOP phi() at start of init_angle_screen Adding NOP phi() at start of init_font_hex @@ -1243,164 +1785,261 @@ main::toD0181: scope:[main] from main to:main::@1 main::@1: scope:[main] from main::toD0181 [7] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 - [8] call init_angle_screen + [8] call clock_start + to:main::@3 +main::@3: scope:[main] from main::@1 + [9] phi() + [10] call init_angle_screen + to:main::@4 +main::@4: scope:[main] from main::@3 + [11] phi() + [12] call clock + [13] (dword) clock::return#2 ← (dword) clock::return#0 + to:main::@5 +main::@5: scope:[main] from main::@4 + [14] (dword~) main::$4 ← (dword) clock::return#2 + [15] (dword) main::cyclecount#0 ← (dword~) main::$4 - (const dword) CLOCKS_PER_INIT#0 + [16] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + [17] call print_dword_at + to:main::toD0182 +main::toD0182: scope:[main] from main::@5 + [18] phi() + to:main::@2 +main::@2: scope:[main] from main::toD0182 + [19] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0 to:main::@return -main::@return: scope:[main] from main::@1 - [9] return +main::@return: scope:[main] from main::@2 + [20] return to:@return -init_angle_screen: scope:[init_angle_screen] from main::@1 - [10] phi() +print_dword_at: scope:[print_dword_at] from main::@5 + [21] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 + [22] call print_word_at + to:print_dword_at::@1 +print_dword_at::@1: scope:[print_dword_at] from print_dword_at + [23] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 + [24] call print_word_at + to:print_dword_at::@return +print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@1 + [25] return + to:@return +print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1 + [26] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const byte*) main::BASE_SCREEN#0 print_dword_at::@1/(const byte*) main::BASE_SCREEN#0+(byte) 4 ) + [26] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 ) + [27] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 + [28] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + [29] call print_byte_at + to:print_word_at::@1 +print_word_at::@1: scope:[print_word_at] from print_word_at + [30] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 + [31] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 + [32] call print_byte_at + to:print_word_at::@return +print_word_at::@return: scope:[print_word_at] from print_word_at::@1 + [33] return + to:@return +print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1 + [34] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 ) + [34] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 ) + [35] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 + [36] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) + [37] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 + [38] call print_char_at + to:print_byte_at::@1 +print_byte_at::@1: scope:[print_byte_at] from print_byte_at + [39] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f + [40] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 + [41] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) + [42] call print_char_at + to:print_byte_at::@return +print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1 + [43] return + to:@return +print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1 + [44] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 ) + [44] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 ) + [45] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 + to:print_char_at::@return +print_char_at::@return: scope:[print_char_at] from print_char_at + [46] return + to:@return +clock: scope:[clock] from main::@4 + [47] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) + to:clock::@return +clock::@return: scope:[clock] from clock + [48] return + to:@return +init_angle_screen: scope:[init_angle_screen] from main::@3 + [49] phi() to:init_angle_screen::@1 init_angle_screen::@1: scope:[init_angle_screen] from init_angle_screen init_angle_screen::@3 - [11] (byte*) init_angle_screen::screen#4 ← phi( init_angle_screen/(const byte*) SCREEN#0 init_angle_screen::@3/(byte*) init_angle_screen::screen#1 ) - [11] (signed byte) init_angle_screen::y#4 ← phi( init_angle_screen/(signed byte) -$c init_angle_screen::@3/(signed byte) init_angle_screen::y#1 ) + [50] (byte*) init_angle_screen::screen#4 ← phi( init_angle_screen/(const byte*) SCREEN#0 init_angle_screen::@3/(byte*) init_angle_screen::screen#1 ) + [50] (signed byte) init_angle_screen::y#4 ← phi( init_angle_screen/(signed byte) -$c init_angle_screen::@3/(signed byte) init_angle_screen::y#1 ) to:init_angle_screen::@2 init_angle_screen::@2: scope:[init_angle_screen] from init_angle_screen::@1 init_angle_screen::@4 - [12] (byte*) init_angle_screen::screen#2 ← phi( init_angle_screen::@1/(byte*) init_angle_screen::screen#4 init_angle_screen::@4/(byte*) init_angle_screen::screen#1 ) - [12] (signed byte) init_angle_screen::x#2 ← phi( init_angle_screen::@1/(signed byte) -$13 init_angle_screen::@4/(signed byte) init_angle_screen::x#1 ) - [13] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 - [14] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 - [15] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 - [16] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 - [17] call atan2_16 - [18] (word) atan2_16::return#2 ← (word) atan2_16::return#0 + [51] (byte*) init_angle_screen::screen#2 ← phi( init_angle_screen::@1/(byte*) init_angle_screen::screen#4 init_angle_screen::@4/(byte*) init_angle_screen::screen#1 ) + [51] (signed byte) init_angle_screen::x#2 ← phi( init_angle_screen::@1/(signed byte) -$13 init_angle_screen::@4/(signed byte) init_angle_screen::x#1 ) + [52] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 + [53] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 + [54] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 + [55] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 + [56] call atan2_16 + [57] (word) atan2_16::return#2 ← (word) atan2_16::return#0 to:init_angle_screen::@4 init_angle_screen::@4: scope:[init_angle_screen] from init_angle_screen::@2 - [19] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 - [20] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 - [21] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 - [22] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 - [23] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 - [24] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 - [25] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 + [58] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 + [59] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 + [60] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 + [61] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 + [62] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 + [63] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 + [64] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 to:init_angle_screen::@3 init_angle_screen::@3: scope:[init_angle_screen] from init_angle_screen::@4 - [26] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 - [27] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 + [65] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 + [66] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 to:init_angle_screen::@return init_angle_screen::@return: scope:[init_angle_screen] from init_angle_screen::@3 - [28] return + [67] return to:@return atan2_16: scope:[atan2_16] from init_angle_screen::@2 - [29] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 + [68] 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 - [30] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 + [69] (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 - [31] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word~) atan2_16::yi#11 atan2_16::@2/(signed word~) atan2_16::$2 ) - [32] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 + [70] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word~) atan2_16::yi#11 atan2_16::@2/(signed word~) atan2_16::$2 ) + [71] 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 - [33] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 + [72] (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 - [34] (signed word) atan2_16::xi#0 ← phi( atan2_16::@4/(signed word~) atan2_16::xi#8 atan2_16::@5/(signed word~) atan2_16::$7 ) + [73] (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 - [35] (word) atan2_16::angle#12 ← phi( atan2_16::@14/(word) atan2_16::angle#13 atan2_16::@6/(byte) 0 ) - [35] (byte) atan2_16::i#2 ← phi( atan2_16::@14/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 ) - [35] (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 ) - [35] (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 ) - [36] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 + [74] (word) atan2_16::angle#12 ← phi( atan2_16::@14/(word) atan2_16::angle#13 atan2_16::@6/(byte) 0 ) + [74] (byte) atan2_16::i#2 ← phi( atan2_16::@14/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 ) + [74] (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 ) + [74] (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 ) + [75] 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 - [37] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@14/(word) atan2_16::angle#13 ) - [38] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 - [39] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 + [76] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@14/(word) atan2_16::angle#13 ) + [77] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 + [78] 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 - [40] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 + [79] (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 - [41] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@16/(word) atan2_16::angle#4 ) - [42] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 + [80] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@16/(word) atan2_16::angle#4 ) + [81] 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 - [43] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 + [82] (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 - [44] (word) atan2_16::return#0 ← phi( atan2_16::@9/(word) atan2_16::angle#5 atan2_16::@7/(word) atan2_16::angle#11 ) + [83] (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 - [45] return + [84] return to:@return atan2_16::@11: scope:[atan2_16] from atan2_16::@10 - [46] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 - [47] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 - [48] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@13 + [85] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 + [86] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 + [87] 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 - [49] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 - [50] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 - [51] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 - [52] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) + [88] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 + [89] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 + [90] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 + [91] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) 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 - [53] (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 ) - [53] (word) atan2_16::angle#13 ← phi( atan2_16::@13/(word) atan2_16::angle#2 atan2_16::@15/(word) atan2_16::angle#3 ) - [53] (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 ) - [54] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 - [55] if((byte) atan2_16::i#1==(const byte) CORDIC_ITERATIONS_16#0-(byte) 1+(byte) 1) goto atan2_16::@12 + [92] (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 ) + [92] (word) atan2_16::angle#13 ← phi( atan2_16::@13/(word) atan2_16::angle#2 atan2_16::@15/(word) atan2_16::angle#3 ) + [92] (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 ) + [93] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 + [94] 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 - [56] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 - [57] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 - [58] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 - [59] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) + [95] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 + [96] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 + [97] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 + [98] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) to:atan2_16::@14 atan2_16::@4: scope:[atan2_16] from atan2_16::@3 - [60] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 + [99] (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 - [61] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 + [100] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 to:atan2_16::@3 +clock_start: scope:[clock_start] from main::@1 + [101] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 + [102] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [103] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff + [104] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 + [105] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 + to:clock_start::@return +clock_start::@return: scope:[clock_start] from clock_start + [106] return + to:@return init_font_hex: scope:[init_font_hex] from main - [62] phi() + [107] phi() to:init_font_hex::@1 init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5 - [63] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 ) - [63] (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 ) - [63] (byte*) init_font_hex::charset#5 ← phi( init_font_hex/(const byte*) CHARSET#0 init_font_hex::@5/(byte*) init_font_hex::charset#0 ) + [108] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 ) + [108] (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 ) + [108] (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 - [64] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 ) - [64] (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 ) - [64] (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 ) - [65] *((byte*) init_font_hex::charset#2) ← (byte) 0 + [109] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 ) + [109] (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 ) + [109] (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 ) + [110] *((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 - [66] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 ) - [66] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 ) - [67] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 - [68] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 - [69] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 - [70] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 - [71] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 - [72] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 - [73] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 + [111] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 ) + [111] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 ) + [112] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4 + [113] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1 + [114] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 + [115] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 + [116] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 + [117] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 + [118] 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 - [74] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 - [75] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 - [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 - [77] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 - [78] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 - [79] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 - [80] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 + [119] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 + [120] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 + [121] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 + [122] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 + [123] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 + [124] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 + [125] 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 - [81] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 - [82] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 - [83] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 + [126] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 + [127] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 + [128] 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 - [84] return + [129] return to:@return VARIABLE REGISTER WEIGHTS (byte*) CHARSET +(dword*) CIA2_TIMER_AB +(byte*) CIA2_TIMER_A_CONTROL +(byte*) CIA2_TIMER_B_CONTROL +(byte) CIA_TIMER_CONTROL_A_COUNT_CYCLES +(byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A +(byte) CIA_TIMER_CONTROL_CONTINUOUS +(byte) CIA_TIMER_CONTROL_START +(byte) CIA_TIMER_CONTROL_STOP +(dword) CLOCKS_PER_INIT (word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16 (byte) CORDIC_ITERATIONS_16 (byte*) D018 @@ -1449,6 +2088,11 @@ VARIABLE REGISTER WEIGHTS (signed word) atan2_16::yi#2 667.3333333333334 (signed word) atan2_16::yi#3 858.2857142857142 (signed word) atan2_16::yi#7 1001.0 +(dword()) clock() +(dword) clock::return +(dword) clock::return#0 1.3333333333333333 +(dword) clock::return#2 4.0 +(void()) clock_start() (void()) init_angle_screen((byte*) init_angle_screen::screen) (word~) init_angle_screen::$7 202.0 (byte) init_angle_screen::ang_w @@ -1497,6 +2141,11 @@ VARIABLE REGISTER WEIGHTS (byte*) init_font_hex::proto_lo#1 50.5 (byte*) init_font_hex::proto_lo#4 92.53846153846155 (void()) main() +(dword~) main::$4 4.0 +(byte*) main::BASE_CHARSET +(byte*) main::BASE_SCREEN +(dword) main::cyclecount +(dword) main::cyclecount#0 4.0 (word~) main::toD0181_$0 (number~) main::toD0181_$1 (number~) main::toD0181_$2 @@ -1509,8 +2158,58 @@ VARIABLE REGISTER WEIGHTS (byte*) main::toD0181_gfx (byte) main::toD0181_return (byte*) main::toD0181_screen +(word~) main::toD0182_$0 +(number~) main::toD0182_$1 +(number~) main::toD0182_$2 +(number~) main::toD0182_$3 +(word~) main::toD0182_$4 +(byte~) main::toD0182_$5 +(number~) main::toD0182_$6 +(number~) main::toD0182_$7 +(number~) main::toD0182_$8 +(byte*) main::toD0182_gfx +(byte) main::toD0182_return +(byte*) main::toD0182_screen +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 4.0 +(byte~) print_byte_at::$2 2.0 +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 4.0 +(byte*) print_byte_at::at#1 4.0 +(byte*) print_byte_at::at#2 1.3333333333333333 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 2.0 +(byte) print_byte_at::b#1 2.0 +(byte) print_byte_at::b#2 1.6 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(byte*) print_char_at::at +(byte*) print_char_at::at#0 4.0 +(byte*) print_char_at::at#1 2.0 +(byte*) print_char_at::at#2 6.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 2.0 +(byte) print_char_at::ch#1 4.0 +(byte) print_char_at::ch#2 6.0 +(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at) +(byte*) print_dword_at::at +(dword) print_dword_at::dw +(dword) print_dword_at::dw#0 2.0 +(byte[]) print_hextab +(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at) +(byte*) print_word_at::at +(byte*) print_word_at::at#2 0.8 +(word) print_word_at::w +(word) print_word_at::w#0 4.0 +(word) print_word_at::w#1 4.0 +(word) print_word_at::w#2 2.0 Initial phi equivalence classes +[ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +[ print_word_at::at#2 ] +[ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +[ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +[ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +[ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] [ init_angle_screen::y#4 init_angle_screen::y#1 ] [ init_angle_screen::x#2 init_angle_screen::x#1 ] [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] @@ -1526,6 +2225,13 @@ Initial phi equivalence classes [ 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 clock::return#2 to zero page equivalence class [ clock::return#2 ] +Added variable main::$4 to zero page equivalence class [ main::$4 ] +Added variable main::cyclecount#0 to zero page equivalence class [ main::cyclecount#0 ] +Added variable print_dword_at::dw#0 to zero page equivalence class [ print_dword_at::dw#0 ] +Added variable print_byte_at::$0 to zero page equivalence class [ print_byte_at::$0 ] +Added variable print_byte_at::$2 to zero page equivalence class [ print_byte_at::$2 ] +Added variable clock::return#0 to zero page equivalence class [ clock::return#0 ] Added variable init_angle_screen::xw#0 to zero page equivalence class [ init_angle_screen::xw#0 ] Added variable init_angle_screen::yw#0 to zero page equivalence class [ init_angle_screen::yw#0 ] Added variable atan2_16::x#0 to zero page equivalence class [ atan2_16::x#0 ] @@ -1543,6 +2249,12 @@ Added variable init_font_hex::$1 to zero page equivalence class [ init_font_hex: 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 +[ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +[ print_word_at::at#2 ] +[ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +[ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +[ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +[ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] [ init_angle_screen::y#4 init_angle_screen::y#1 ] [ init_angle_screen::x#2 init_angle_screen::x#1 ] [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] @@ -1558,6 +2270,13 @@ Complete equivalence classes [ 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 ] +[ clock::return#2 ] +[ main::$4 ] +[ main::cyclecount#0 ] +[ print_dword_at::dw#0 ] +[ print_byte_at::$0 ] +[ print_byte_at::$2 ] +[ clock::return#0 ] [ init_angle_screen::xw#0 ] [ init_angle_screen::yw#0 ] [ atan2_16::x#0 ] @@ -1574,37 +2293,50 @@ Complete equivalence classes [ init_font_hex::$1 ] [ init_font_hex::$2 ] [ init_font_hex::idx#3 ] -Allocated zp ZP_BYTE:2 [ init_angle_screen::y#4 init_angle_screen::y#1 ] -Allocated zp ZP_BYTE:3 [ init_angle_screen::x#2 init_angle_screen::x#1 ] -Allocated zp ZP_WORD:4 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] -Allocated zp ZP_WORD:6 [ 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:8 [ 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:10 [ atan2_16::i#2 atan2_16::i#1 ] -Allocated zp ZP_WORD:11 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] -Allocated zp ZP_WORD:13 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] -Allocated zp ZP_WORD:15 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] -Allocated zp ZP_BYTE:17 [ init_font_hex::c#6 init_font_hex::c#1 ] -Allocated zp ZP_WORD:18 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] -Allocated zp ZP_WORD:20 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] -Allocated zp ZP_BYTE:22 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Allocated zp ZP_BYTE:23 [ init_font_hex::i#2 init_font_hex::i#1 ] -Allocated zp ZP_BYTE:24 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Allocated zp ZP_WORD:25 [ init_angle_screen::xw#0 ] -Allocated zp ZP_WORD:27 [ init_angle_screen::yw#0 ] -Allocated zp ZP_WORD:29 [ atan2_16::x#0 ] -Allocated zp ZP_WORD:31 [ atan2_16::y#0 ] -Allocated zp ZP_WORD:33 [ atan2_16::return#2 ] -Allocated zp ZP_WORD:35 [ init_angle_screen::angle_w#0 ] -Allocated zp ZP_WORD:37 [ init_angle_screen::$7 ] -Allocated zp ZP_BYTE:39 [ init_angle_screen::ang_w#0 ] -Allocated zp ZP_WORD:40 [ atan2_16::xd#0 ] -Allocated zp ZP_WORD:42 [ atan2_16::yd#0 ] -Allocated zp ZP_BYTE:44 [ atan2_16::$24 ] -Allocated zp ZP_BYTE:45 [ atan2_16::$23 ] -Allocated zp ZP_BYTE:46 [ init_font_hex::$0 ] -Allocated zp ZP_BYTE:47 [ init_font_hex::$1 ] -Allocated zp ZP_BYTE:48 [ init_font_hex::$2 ] -Allocated zp ZP_BYTE:49 [ init_font_hex::idx#3 ] +Allocated zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +Allocated zp ZP_WORD:4 [ print_word_at::at#2 ] +Allocated zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Allocated zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +Allocated zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +Allocated zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Allocated zp ZP_BYTE:12 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +Allocated zp ZP_BYTE:13 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Allocated zp ZP_WORD:14 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] +Allocated zp ZP_WORD:16 [ 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:18 [ 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:20 [ atan2_16::i#2 atan2_16::i#1 ] +Allocated zp ZP_WORD:21 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] +Allocated zp ZP_WORD:23 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] +Allocated zp ZP_WORD:25 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +Allocated zp ZP_BYTE:27 [ init_font_hex::c#6 init_font_hex::c#1 ] +Allocated zp ZP_WORD:28 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +Allocated zp ZP_WORD:30 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +Allocated zp ZP_BYTE:32 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Allocated zp ZP_BYTE:33 [ init_font_hex::i#2 init_font_hex::i#1 ] +Allocated zp ZP_BYTE:34 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Allocated zp ZP_DWORD:35 [ clock::return#2 ] +Allocated zp ZP_DWORD:39 [ main::$4 ] +Allocated zp ZP_DWORD:43 [ main::cyclecount#0 ] +Allocated zp ZP_DWORD:47 [ print_dword_at::dw#0 ] +Allocated zp ZP_BYTE:51 [ print_byte_at::$0 ] +Allocated zp ZP_BYTE:52 [ print_byte_at::$2 ] +Allocated zp ZP_DWORD:53 [ clock::return#0 ] +Allocated zp ZP_WORD:57 [ init_angle_screen::xw#0 ] +Allocated zp ZP_WORD:59 [ init_angle_screen::yw#0 ] +Allocated zp ZP_WORD:61 [ atan2_16::x#0 ] +Allocated zp ZP_WORD:63 [ atan2_16::y#0 ] +Allocated zp ZP_WORD:65 [ atan2_16::return#2 ] +Allocated zp ZP_WORD:67 [ init_angle_screen::angle_w#0 ] +Allocated zp ZP_WORD:69 [ init_angle_screen::$7 ] +Allocated zp ZP_BYTE:71 [ init_angle_screen::ang_w#0 ] +Allocated zp ZP_WORD:72 [ atan2_16::xd#0 ] +Allocated zp ZP_WORD:74 [ atan2_16::yd#0 ] +Allocated zp ZP_BYTE:76 [ atan2_16::$24 ] +Allocated zp ZP_BYTE:77 [ atan2_16::$23 ] +Allocated zp ZP_BYTE:78 [ init_font_hex::$0 ] +Allocated zp ZP_BYTE:79 [ init_font_hex::$1 ] +Allocated zp ZP_BYTE:80 [ init_font_hex::$2 ] +Allocated zp ZP_BYTE:81 [ init_font_hex::idx#3 ] INITIAL ASM //SEG0 File Comments @@ -1616,8 +2348,23 @@ INITIAL ASM .pc = $80d "Program" //SEG2 Global Constants & labels .label D018 = $d018 + // CIA #2 Timer A+B Value (32-bit) + .label CIA2_TIMER_AB = $dd04 + // CIA #2 Timer A Control Register + .label CIA2_TIMER_A_CONTROL = $dd0e + // CIA #2 Timer B Control Register + .label CIA2_TIMER_B_CONTROL = $dd0f + // Timer Control - Start/stop timer (0:stop, 1: start) + .const CIA_TIMER_CONTROL_START = 1 + // Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT) + .const CIA_TIMER_CONTROL_CONTINUOUS = 0 + // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) + .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 // The number of iterations performed during 16-bit CORDIC atan2 calculation .const CORDIC_ITERATIONS_16 = $f + // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. + // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. + .const CLOCKS_PER_INIT = $12 .label CHARSET = $2000 .label SCREEN = $2800 //SEG3 @begin @@ -1638,9 +2385,14 @@ bend_from_b1: bend: //SEG10 main main: { + .label BASE_SCREEN = $400 + .label BASE_CHARSET = $1000 .const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f + .const toD0182_return = (>(BASE_SCREEN&$3fff)*4)|(>BASE_CHARSET)/4&$f + .label _4 = $27 + .label cyclecount = $2b //SEG11 [5] call init_font_hex - //SEG12 [62] phi from main to init_font_hex [phi:main->init_font_hex] + //SEG12 [107] phi from main to init_font_hex [phi:main->init_font_hex] init_font_hex_from_main: jsr init_font_hex //SEG13 [6] phi from main to main::toD0181 [phi:main->main::toD0181] @@ -1654,97 +2406,361 @@ main: { //SEG16 [7] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG17 [8] call init_angle_screen - //SEG18 [10] phi from main::@1 to init_angle_screen [phi:main::@1->init_angle_screen] - init_angle_screen_from_b1: + //SEG17 [8] call clock_start + jsr clock_start + //SEG18 [9] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + b3_from_b1: + jmp b3 + //SEG19 main::@3 + b3: + //SEG20 [10] call init_angle_screen + //SEG21 [49] phi from main::@3 to init_angle_screen [phi:main::@3->init_angle_screen] + init_angle_screen_from_b3: jsr init_angle_screen + //SEG22 [11] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + b4_from_b3: + jmp b4 + //SEG23 main::@4 + b4: + //SEG24 [12] call clock + jsr clock + //SEG25 [13] (dword) clock::return#2 ← (dword) clock::return#0 -- vduz1=vduz2 + lda clock.return + sta clock.return_2 + lda clock.return+1 + sta clock.return_2+1 + lda clock.return+2 + sta clock.return_2+2 + lda clock.return+3 + sta clock.return_2+3 + jmp b5 + //SEG26 main::@5 + b5: + //SEG27 [14] (dword~) main::$4 ← (dword) clock::return#2 -- vduz1=vduz2 + lda clock.return_2 + sta _4 + lda clock.return_2+1 + sta _4+1 + lda clock.return_2+2 + sta _4+2 + lda clock.return_2+3 + sta _4+3 + //SEG28 [15] (dword) main::cyclecount#0 ← (dword~) main::$4 - (const dword) CLOCKS_PER_INIT#0 -- vduz1=vduz2_minus_vduc1 + lda _4 + sec + sbc #CLOCKS_PER_INIT + sta cyclecount+1 + lda _4+2 + sbc #>$10 + sta cyclecount+2 + lda _4+3 + sbc #>CLOCKS_PER_INIT>>$10 + sta cyclecount+3 + //SEG29 [16] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 -- vduz1=vduz2 + lda cyclecount + sta print_dword_at.dw + lda cyclecount+1 + sta print_dword_at.dw+1 + lda cyclecount+2 + sta print_dword_at.dw+2 + lda cyclecount+3 + sta print_dword_at.dw+3 + //SEG30 [17] call print_dword_at + jsr print_dword_at + //SEG31 [18] phi from main::@5 to main::toD0182 [phi:main::@5->main::toD0182] + toD0182_from_b5: + jmp toD0182 + //SEG32 main::toD0182 + toD0182: + jmp b2 + //SEG33 main::@2 + b2: + //SEG34 [19] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0182_return + sta D018 jmp breturn - //SEG19 main::@return + //SEG35 main::@return breturn: - //SEG20 [9] return + //SEG36 [20] return rts } -//SEG21 init_angle_screen +//SEG37 print_dword_at +// Print a dword as HEX at a specific position +// print_dword_at(dword zeropage($2f) dw) +print_dword_at: { + .label dw = $2f + //SEG38 [21] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + lda dw+2 + sta print_word_at.w + lda dw+3 + sta print_word_at.w+1 + //SEG39 [22] call print_word_at + //SEG40 [26] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + print_word_at_from_print_dword_at: + //SEG41 [26] phi (byte*) print_word_at::at#2 = (const byte*) main::BASE_SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + lda #main.BASE_SCREEN + sta print_word_at.at+1 + //SEG42 [26] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + jsr print_word_at + jmp b1 + //SEG43 print_dword_at::@1 + b1: + //SEG44 [23] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + lda dw + sta print_word_at.w + lda dw+1 + sta print_word_at.w+1 + //SEG45 [24] call print_word_at + //SEG46 [26] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + print_word_at_from_b1: + //SEG47 [26] phi (byte*) print_word_at::at#2 = (const byte*) main::BASE_SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + lda #main.BASE_SCREEN+4 + sta print_word_at.at+1 + //SEG48 [26] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + jsr print_word_at + jmp breturn + //SEG49 print_dword_at::@return + breturn: + //SEG50 [25] return + rts +} +//SEG51 print_word_at +// Print a word as HEX at a specific position +// print_word_at(word zeropage(2) w, byte* zeropage(4) at) +print_word_at: { + .label w = 2 + .label at = 4 + //SEG52 [27] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + lda w+1 + sta print_byte_at.b + //SEG53 [28] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 -- pbuz1=pbuz2 + lda at + sta print_byte_at.at + lda at+1 + sta print_byte_at.at+1 + //SEG54 [29] call print_byte_at + //SEG55 [34] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + print_byte_at_from_print_word_at: + //SEG56 [34] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG57 [34] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + jsr print_byte_at + jmp b1 + //SEG58 print_word_at::@1 + b1: + //SEG59 [30] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + lda w + sta print_byte_at.b + //SEG60 [31] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz2_plus_2 + lda at + clc + adc #2 + sta print_byte_at.at + lda at+1 + adc #0 + sta print_byte_at.at+1 + //SEG61 [32] call print_byte_at + //SEG62 [34] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + print_byte_at_from_b1: + //SEG63 [34] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG64 [34] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + jsr print_byte_at + jmp breturn + //SEG65 print_word_at::@return + breturn: + //SEG66 [33] return + rts +} +//SEG67 print_byte_at +// Print a byte as HEX at a specific position +// print_byte_at(byte zeropage(6) b, byte* zeropage(7) at) +print_byte_at: { + .label _0 = $33 + .label _2 = $34 + .label b = 6 + .label at = 7 + //SEG68 [35] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuz1=vbuz2_ror_4 + lda b + lsr + lsr + lsr + lsr + sta _0 + //SEG69 [36] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy _0 + lda print_hextab,y + sta print_char_at.ch + //SEG70 [37] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG71 [38] call print_char_at + //SEG72 [44] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + print_char_at_from_print_byte_at: + //SEG73 [44] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG74 [44] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + jmp b1 + //SEG75 print_byte_at::@1 + b1: + //SEG76 [39] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuz1=vbuz2_band_vbuc1 + lda #$f + and b + sta _2 + //SEG77 [40] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + //SEG78 [41] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy _2 + lda print_hextab,y + sta print_char_at.ch + //SEG79 [42] call print_char_at + //SEG80 [44] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + print_char_at_from_b1: + //SEG81 [44] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG82 [44] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + jmp breturn + //SEG83 print_byte_at::@return + breturn: + //SEG84 [43] return + rts +} +//SEG85 print_char_at +// Print a single char +// print_char_at(byte zeropage(9) ch, byte* zeropage($a) at) +print_char_at: { + .label ch = 9 + .label at = $a + //SEG86 [45] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuz2 + lda ch + ldy #0 + sta (at),y + jmp breturn + //SEG87 print_char_at::@return + breturn: + //SEG88 [46] return + rts +} +//SEG89 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = $35 + .label return_2 = $23 + //SEG90 [47] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + jmp breturn + //SEG91 clock::@return + breturn: + //SEG92 [48] return + rts +} +//SEG93 init_angle_screen // Populates 1000 bytes (a screen) with values representing the angle to the center. // The actual value stored is distance*2 to increase precision -// init_angle_screen(byte* zeropage(4) screen) +// init_angle_screen(byte* zeropage($e) screen) init_angle_screen: { - .label _7 = $25 - .label xw = $19 - .label yw = $1b - .label angle_w = $23 - .label ang_w = $27 - .label screen = 4 - .label x = 3 - .label y = 2 - //SEG22 [11] phi from init_angle_screen to init_angle_screen::@1 [phi:init_angle_screen->init_angle_screen::@1] + .label _7 = $45 + .label xw = $39 + .label yw = $3b + .label angle_w = $43 + .label ang_w = $47 + .label screen = $e + .label x = $d + .label y = $c + //SEG94 [50] phi from init_angle_screen to init_angle_screen::@1 [phi:init_angle_screen->init_angle_screen::@1] b1_from_init_angle_screen: - //SEG23 [11] phi (byte*) init_angle_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_angle_screen->init_angle_screen::@1#0] -- pbuz1=pbuc1 + //SEG95 [50] phi (byte*) init_angle_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_angle_screen->init_angle_screen::@1#0] -- pbuz1=pbuc1 lda #SCREEN sta screen+1 - //SEG24 [11] phi (signed byte) init_angle_screen::y#4 = (signed byte) -$c [phi:init_angle_screen->init_angle_screen::@1#1] -- vbsz1=vbsc1 + //SEG96 [50] phi (signed byte) init_angle_screen::y#4 = (signed byte) -$c [phi:init_angle_screen->init_angle_screen::@1#1] -- vbsz1=vbsc1 lda #-$c sta y jmp b1 - //SEG25 [11] phi from init_angle_screen::@3 to init_angle_screen::@1 [phi:init_angle_screen::@3->init_angle_screen::@1] + //SEG97 [50] phi from init_angle_screen::@3 to init_angle_screen::@1 [phi:init_angle_screen::@3->init_angle_screen::@1] b1_from_b3: - //SEG26 [11] phi (byte*) init_angle_screen::screen#4 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@3->init_angle_screen::@1#0] -- register_copy - //SEG27 [11] phi (signed byte) init_angle_screen::y#4 = (signed byte) init_angle_screen::y#1 [phi:init_angle_screen::@3->init_angle_screen::@1#1] -- register_copy + //SEG98 [50] phi (byte*) init_angle_screen::screen#4 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@3->init_angle_screen::@1#0] -- register_copy + //SEG99 [50] phi (signed byte) init_angle_screen::y#4 = (signed byte) init_angle_screen::y#1 [phi:init_angle_screen::@3->init_angle_screen::@1#1] -- register_copy jmp b1 - //SEG28 init_angle_screen::@1 + //SEG100 init_angle_screen::@1 b1: - //SEG29 [12] phi from init_angle_screen::@1 to init_angle_screen::@2 [phi:init_angle_screen::@1->init_angle_screen::@2] + //SEG101 [51] phi from init_angle_screen::@1 to init_angle_screen::@2 [phi:init_angle_screen::@1->init_angle_screen::@2] b2_from_b1: - //SEG30 [12] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#4 [phi:init_angle_screen::@1->init_angle_screen::@2#0] -- register_copy - //SEG31 [12] phi (signed byte) init_angle_screen::x#2 = (signed byte) -$13 [phi:init_angle_screen::@1->init_angle_screen::@2#1] -- vbsz1=vbsc1 + //SEG102 [51] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#4 [phi:init_angle_screen::@1->init_angle_screen::@2#0] -- register_copy + //SEG103 [51] phi (signed byte) init_angle_screen::x#2 = (signed byte) -$13 [phi:init_angle_screen::@1->init_angle_screen::@2#1] -- vbsz1=vbsc1 lda #-$13 sta x jmp b2 - //SEG32 [12] phi from init_angle_screen::@4 to init_angle_screen::@2 [phi:init_angle_screen::@4->init_angle_screen::@2] + //SEG104 [51] phi from init_angle_screen::@4 to init_angle_screen::@2 [phi:init_angle_screen::@4->init_angle_screen::@2] b2_from_b4: - //SEG33 [12] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@4->init_angle_screen::@2#0] -- register_copy - //SEG34 [12] phi (signed byte) init_angle_screen::x#2 = (signed byte) init_angle_screen::x#1 [phi:init_angle_screen::@4->init_angle_screen::@2#1] -- register_copy + //SEG105 [51] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@4->init_angle_screen::@2#0] -- register_copy + //SEG106 [51] phi (signed byte) init_angle_screen::x#2 = (signed byte) init_angle_screen::x#1 [phi:init_angle_screen::@4->init_angle_screen::@2#1] -- register_copy jmp b2 - //SEG35 init_angle_screen::@2 + //SEG107 init_angle_screen::@2 b2: - //SEG36 [13] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 + //SEG108 [52] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 lda x ldy #0 sta xw+1 sty xw - //SEG37 [14] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 + //SEG109 [53] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 lda y ldy #0 sta yw+1 sty yw - //SEG38 [15] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 -- vwsz1=vwsz2 + //SEG110 [54] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 -- vwsz1=vwsz2 lda xw sta atan2_16.x lda xw+1 sta atan2_16.x+1 - //SEG39 [16] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 -- vwsz1=vwsz2 + //SEG111 [55] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 -- vwsz1=vwsz2 lda yw sta atan2_16.y lda yw+1 sta atan2_16.y+1 - //SEG40 [17] call atan2_16 + //SEG112 [56] call atan2_16 jsr atan2_16 - //SEG41 [18] (word) atan2_16::return#2 ← (word) atan2_16::return#0 -- vwuz1=vwuz2 + //SEG113 [57] (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 - //SEG42 init_angle_screen::@4 + //SEG114 init_angle_screen::@4 b4: - //SEG43 [19] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 -- vwuz1=vwuz2 + //SEG115 [58] (word) init_angle_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 - //SEG44 [20] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz2_plus_vbuc1 + //SEG116 [59] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz2_plus_vbuc1 lda #$80 clc adc angle_w @@ -1752,71 +2768,71 @@ init_angle_screen: { lda #0 adc angle_w+1 sta _7+1 - //SEG45 [21] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 -- vbuz1=_hi_vwuz2 + //SEG117 [60] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 -- vbuz1=_hi_vwuz2 lda _7+1 sta ang_w - //SEG46 [22] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 -- _deref_pbuz1=vbuz2 + //SEG118 [61] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 -- _deref_pbuz1=vbuz2 lda ang_w ldy #0 sta (screen),y - //SEG47 [23] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 -- pbuz1=_inc_pbuz1 + //SEG119 [62] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 -- pbuz1=_inc_pbuz1 inc screen bne !+ inc screen+1 !: - //SEG48 [24] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 -- vbsz1=_inc_vbsz1 + //SEG120 [63] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 -- vbsz1=_inc_vbsz1 inc x - //SEG49 [25] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 -- vbsz1_neq_vbsc1_then_la1 + //SEG121 [64] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 -- vbsz1_neq_vbsc1_then_la1 lda #$15 cmp x bne b2_from_b4 jmp b3 - //SEG50 init_angle_screen::@3 + //SEG122 init_angle_screen::@3 b3: - //SEG51 [26] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 -- vbsz1=_inc_vbsz1 + //SEG123 [65] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 -- vbsz1=_inc_vbsz1 inc y - //SEG52 [27] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 -- vbsz1_neq_vbsc1_then_la1 + //SEG124 [66] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 -- vbsz1_neq_vbsc1_then_la1 lda #$d cmp y bne b1_from_b3 jmp breturn - //SEG53 init_angle_screen::@return + //SEG125 init_angle_screen::@return breturn: - //SEG54 [28] return + //SEG126 [67] return rts } -//SEG55 atan2_16 +//SEG127 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($1d) x, signed word zeropage($1f) y) +// atan2_16(signed word zeropage($3d) x, signed word zeropage($3f) y) atan2_16: { - .label _2 = 6 - .label _7 = 8 - .label _23 = $2d - .label _24 = $2c - .label yi = 6 - .label xi = 8 - .label xd = $28 - .label yd = $2a - .label angle = $d - .label angle_2 = $b - .label angle_3 = $b - .label i = $a - .label return = $d - .label x = $1d - .label y = $1f - .label return_2 = $21 - .label angle_6 = $b - .label angle_12 = $b - .label angle_13 = $b - //SEG56 [29] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 -- vwsz1_ge_0_then_la1 + .label _2 = $10 + .label _7 = $12 + .label _23 = $4d + .label _24 = $4c + .label yi = $10 + .label xi = $12 + .label xd = $48 + .label yd = $4a + .label angle = $17 + .label angle_2 = $15 + .label angle_3 = $15 + .label i = $14 + .label return = $17 + .label x = $3d + .label y = $3f + .label return_2 = $41 + .label angle_6 = $15 + .label angle_12 = $15 + .label angle_13 = $15 + //SEG128 [68] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 -- vwsz1_ge_0_then_la1 lda y+1 bpl b1 jmp b2 - //SEG57 atan2_16::@2 + //SEG129 atan2_16::@2 b2: - //SEG58 [30] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 + //SEG130 [69] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 sec lda #0 sbc y @@ -1824,20 +2840,20 @@ atan2_16: { lda #0 sbc y+1 sta _2+1 - //SEG59 [31] phi from atan2_16::@1 atan2_16::@2 to atan2_16::@3 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3] + //SEG131 [70] 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: - //SEG60 [31] 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 + //SEG132 [70] 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 - //SEG61 atan2_16::@3 + //SEG133 atan2_16::@3 b3: - //SEG62 [32] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 -- vwsz1_ge_0_then_la1 + //SEG134 [71] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 -- vwsz1_ge_0_then_la1 lda x+1 bpl b4 jmp b5 - //SEG63 atan2_16::@5 + //SEG135 atan2_16::@5 b5: - //SEG64 [33] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 + //SEG136 [72] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 sec lda #0 sbc x @@ -1845,54 +2861,54 @@ atan2_16: { lda #0 sbc x+1 sta _7+1 - //SEG65 [34] phi from atan2_16::@4 atan2_16::@5 to atan2_16::@6 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6] + //SEG137 [73] 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: - //SEG66 [34] 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 + //SEG138 [73] 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 - //SEG67 atan2_16::@6 + //SEG139 atan2_16::@6 b6: - //SEG68 [35] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] + //SEG140 [74] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] b10_from_b6: - //SEG69 [35] phi (word) atan2_16::angle#12 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#0] -- vwuz1=vbuc1 + //SEG141 [74] 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 - //SEG70 [35] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 + //SEG142 [74] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 lda #0 sta i - //SEG71 [35] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy - //SEG72 [35] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#0 [phi:atan2_16::@6->atan2_16::@10#3] -- register_copy + //SEG143 [74] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy + //SEG144 [74] 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 - //SEG73 atan2_16::@10 + //SEG145 atan2_16::@10 b10: - //SEG74 [36] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 + //SEG146 [75] 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 - //SEG75 [37] phi from atan2_16::@10 atan2_16::@14 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12] + //SEG147 [76] 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: - //SEG76 [37] phi (word) atan2_16::angle#6 = (word) atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12#0] -- register_copy + //SEG148 [76] 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 - //SEG77 atan2_16::@12 + //SEG149 atan2_16::@12 b12: - //SEG78 [38] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 -- vwuz1=vwuz2_ror_1 + //SEG150 [77] (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 - //SEG79 [39] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 -- vwsz1_ge_0_then_la1 + //SEG151 [78] 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 - //SEG80 atan2_16::@16 + //SEG152 atan2_16::@16 b16: - //SEG81 [40] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 + //SEG153 [79] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 sec lda #<$8000 sbc angle @@ -1900,20 +2916,20 @@ atan2_16: { lda #>$8000 sbc angle+1 sta angle+1 - //SEG82 [41] phi from atan2_16::@12 atan2_16::@16 to atan2_16::@7 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7] + //SEG154 [80] 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: - //SEG83 [41] phi (word) atan2_16::angle#11 = (word) atan2_16::angle#1 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7#0] -- register_copy + //SEG155 [80] 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 - //SEG84 atan2_16::@7 + //SEG156 atan2_16::@7 b7: - //SEG85 [42] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 -- vwsz1_ge_0_then_la1 + //SEG157 [81] 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 - //SEG86 atan2_16::@9 + //SEG158 atan2_16::@9 b9: - //SEG87 [43] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 + //SEG159 [82] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 sec lda #0 sbc angle @@ -1921,21 +2937,21 @@ atan2_16: { lda #0 sbc angle+1 sta angle+1 - //SEG88 [44] phi from atan2_16::@7 atan2_16::@9 to atan2_16::@8 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8] + //SEG160 [83] 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: - //SEG89 [44] phi (word) atan2_16::return#0 = (word) atan2_16::angle#11 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8#0] -- register_copy + //SEG161 [83] 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 - //SEG90 atan2_16::@8 + //SEG162 atan2_16::@8 b8: jmp breturn - //SEG91 atan2_16::@return + //SEG163 atan2_16::@return breturn: - //SEG92 [45] return + //SEG164 [84] return rts - //SEG93 atan2_16::@11 + //SEG165 atan2_16::@11 b11: - //SEG94 [46] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + //SEG166 [85] (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 @@ -1951,7 +2967,7 @@ atan2_16: { dey bne !- !e: - //SEG95 [47] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + //SEG167 [86] (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 @@ -1967,13 +2983,13 @@ atan2_16: { dey bne !- !e: - //SEG96 [48] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@13 -- vwsz1_ge_0_then_la1 + //SEG168 [87] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@13 -- vwsz1_ge_0_then_la1 lda yi+1 bpl b13 jmp b15 - //SEG97 atan2_16::@15 + //SEG169 atan2_16::@15 b15: - //SEG98 [49] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_minus_vwsz2 + //SEG170 [88] (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 @@ -1981,7 +2997,7 @@ atan2_16: { lda xi+1 sbc yd+1 sta xi+1 - //SEG99 [50] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_plus_vwsz2 + //SEG171 [89] (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 @@ -1989,11 +3005,11 @@ atan2_16: { lda yi+1 adc xd+1 sta yi+1 - //SEG100 [51] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 + //SEG172 [90] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 lda i asl sta _24 - //SEG101 [52] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuz2 + //SEG173 [91] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuz2 ldy _24 sec lda angle_3 @@ -2002,31 +3018,31 @@ atan2_16: { lda angle_3+1 sbc CORDIC_ATAN2_ANGLES_16+1,y sta angle_3+1 - //SEG102 [53] phi from atan2_16::@13 atan2_16::@15 to atan2_16::@14 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14] + //SEG174 [92] 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: - //SEG103 [53] 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 - //SEG104 [53] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy - //SEG105 [53] 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 + //SEG175 [92] 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 + //SEG176 [92] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy + //SEG177 [92] 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 - //SEG106 atan2_16::@14 + //SEG178 atan2_16::@14 b14: - //SEG107 [54] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 + //SEG179 [93] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 inc i - //SEG108 [55] 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 + //SEG180 [94] 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 - //SEG109 [35] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] + //SEG181 [74] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] b10_from_b14: - //SEG110 [35] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy - //SEG111 [35] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy - //SEG112 [35] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy - //SEG113 [35] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#7 [phi:atan2_16::@14->atan2_16::@10#3] -- register_copy + //SEG182 [74] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy + //SEG183 [74] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy + //SEG184 [74] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy + //SEG185 [74] 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 - //SEG114 atan2_16::@13 + //SEG186 atan2_16::@13 b13: - //SEG115 [56] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_plus_vwsz2 + //SEG187 [95] (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 @@ -2034,7 +3050,7 @@ atan2_16: { lda xi+1 adc yd+1 sta xi+1 - //SEG116 [57] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_minus_vwsz2 + //SEG188 [96] (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 @@ -2042,11 +3058,11 @@ atan2_16: { lda yi+1 sbc xd+1 sta yi+1 - //SEG117 [58] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 + //SEG189 [97] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 lda i asl sta _23 - //SEG118 [59] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuz2 + //SEG190 [98] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuz2 ldy _23 clc lda angle_2 @@ -2056,103 +3072,135 @@ atan2_16: { adc CORDIC_ATAN2_ANGLES_16+1,y sta angle_2+1 jmp b14_from_b13 - //SEG119 atan2_16::@4 + //SEG191 atan2_16::@4 b4: - //SEG120 [60] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 -- vwsz1=vwsz2 + //SEG192 [99] (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 - //SEG121 atan2_16::@1 + //SEG193 atan2_16::@1 b1: - //SEG122 [61] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 -- vwsz1=vwsz2 + //SEG194 [100] (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 } -//SEG123 init_font_hex +//SEG195 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG196 [101] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG197 [102] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG198 [103] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG199 [104] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG200 [105] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + jmp breturn + //SEG201 clock_start::@return + breturn: + //SEG202 [106] return + rts +} +//SEG203 init_font_hex // Make charset from proto chars -// init_font_hex(byte* zeropage($12) charset) +// init_font_hex(byte* zeropage($1c) charset) init_font_hex: { - .label _0 = $2e - .label _1 = $2f - .label _2 = $30 - .label idx = $18 - .label i = $17 - .label idx_3 = $31 - .label proto_lo = $14 - .label charset = $12 - .label c1 = $16 - .label proto_hi = $f - .label c = $11 - //SEG124 [63] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] + .label _0 = $4e + .label _1 = $4f + .label _2 = $50 + .label idx = $22 + .label i = $21 + .label idx_3 = $51 + .label proto_lo = $1e + .label charset = $1c + .label c1 = $20 + .label proto_hi = $19 + .label c = $1b + //SEG204 [108] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] b1_from_init_font_hex: - //SEG125 [63] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 + //SEG205 [108] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 lda #0 sta c - //SEG126 [63] 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 + //SEG206 [108] 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 - //SEG127 [63] phi (byte*) init_font_hex::charset#5 = (const byte*) CHARSET#0 [phi:init_font_hex->init_font_hex::@1#2] -- pbuz1=pbuc1 + //SEG207 [108] 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 - //SEG128 [63] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] + //SEG208 [108] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] b1_from_b5: - //SEG129 [63] 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 - //SEG130 [63] 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 - //SEG131 [63] 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 + //SEG209 [108] 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 + //SEG210 [108] 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 + //SEG211 [108] 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 - //SEG132 init_font_hex::@1 + //SEG212 init_font_hex::@1 b1: - //SEG133 [64] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] + //SEG213 [109] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] b2_from_b1: - //SEG134 [64] phi (byte) init_font_hex::c1#4 = (byte) 0 [phi:init_font_hex::@1->init_font_hex::@2#0] -- vbuz1=vbuc1 + //SEG214 [109] 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 - //SEG135 [64] 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 + //SEG215 [109] 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 - //SEG136 [64] 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 + //SEG216 [109] 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 - //SEG137 [64] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] + //SEG217 [109] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] b2_from_b4: - //SEG138 [64] 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 - //SEG139 [64] 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 - //SEG140 [64] 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 + //SEG218 [109] 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 + //SEG219 [109] 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 + //SEG220 [109] 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 - //SEG141 init_font_hex::@2 + //SEG221 init_font_hex::@2 b2: - //SEG142 [65] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + //SEG222 [110] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 lda #0 ldy #0 sta (charset),y - //SEG143 [66] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] + //SEG223 [111] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] b3_from_b2: - //SEG144 [66] phi (byte) init_font_hex::idx#5 = (byte) 1 [phi:init_font_hex::@2->init_font_hex::@3#0] -- vbuz1=vbuc1 + //SEG224 [111] 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 - //SEG145 [66] phi (byte) init_font_hex::i#2 = (byte) 0 [phi:init_font_hex::@2->init_font_hex::@3#1] -- vbuz1=vbuc1 + //SEG225 [111] 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 - //SEG146 [66] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] + //SEG226 [111] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] b3_from_b3: - //SEG147 [66] 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 - //SEG148 [66] 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 + //SEG227 [111] 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 + //SEG228 [111] 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 - //SEG149 init_font_hex::@3 + //SEG229 init_font_hex::@3 b3: - //SEG150 [67] (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 + //SEG230 [112] (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 @@ -2160,43 +3208,43 @@ init_font_hex: { asl asl sta _0 - //SEG151 [68] (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 + //SEG231 [113] (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 - //SEG152 [69] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 -- vbuz1=vbuz2_bor_vbuz3 + //SEG232 [114] (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 - //SEG153 [70] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 -- pbuz1_derefidx_vbuz2=vbuz3 + //SEG233 [115] *((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 - //SEG154 [71] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 + //SEG234 [116] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 inc idx - //SEG155 [72] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuz1=_inc_vbuz1 + //SEG235 [117] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuz1=_inc_vbuz1 inc i - //SEG156 [73] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 -- vbuz1_neq_vbuc1_then_la1 + //SEG236 [118] 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 - //SEG157 init_font_hex::@4 + //SEG237 init_font_hex::@4 b4: - //SEG158 [74] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 -- pbuz1_derefidx_vbuz2=vbuc1 + //SEG238 [119] *((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 - //SEG159 [75] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuz1=_inc_vbuz2 + //SEG239 [120] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuz1=_inc_vbuz2 ldy idx iny sty idx_3 - //SEG160 [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 -- pbuz1_derefidx_vbuz2=vbuc1 + //SEG240 [121] *((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 - //SEG161 [77] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + //SEG241 [122] (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 @@ -2204,7 +3252,7 @@ init_font_hex: { bcc !+ inc proto_lo+1 !: - //SEG162 [78] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 + //SEG242 [123] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 lda #8 clc adc charset @@ -2212,16 +3260,16 @@ init_font_hex: { bcc !+ inc charset+1 !: - //SEG163 [79] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 + //SEG243 [124] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 inc c1 - //SEG164 [80] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 -- vbuz1_neq_vbuc1_then_la1 + //SEG244 [125] 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 - //SEG165 init_font_hex::@5 + //SEG245 init_font_hex::@5 b5: - //SEG166 [81] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + //SEG246 [126] (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 @@ -2229,203 +3277,287 @@ init_font_hex: { bcc !+ inc proto_hi+1 !: - //SEG167 [82] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 + //SEG247 [127] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 inc c - //SEG168 [83] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 -- vbuz1_neq_vbuc1_then_la1 + //SEG248 [128] 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 - //SEG169 init_font_hex::@return + //SEG249 init_font_hex::@return breturn: - //SEG170 [84] return + //SEG250 [129] return rts } -//SEG171 File Data +//SEG251 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 -// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... CORDIC_ATAN2_ANGLES_16: .for (var i=0; i (word~) init_angle_screen::$7 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::ang_w#0 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::ang_w#0 ] ) always clobbers reg byte a -Statement [22] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 ] ) always clobbers reg byte y -Statement [29] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 [ atan2_16::x#0 atan2_16::y#0 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a -Statement [30] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ) always clobbers reg byte a -Statement [32] 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 ] ) always clobbers reg byte a -Statement [33] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::$7 ] ) always clobbers reg byte a -Statement [36] 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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:10 [ atan2_16::i#2 atan2_16::i#1 ] -Statement [38] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a -Statement [39] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 [ atan2_16::y#0 atan2_16::angle#1 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a -Statement [40] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 [ atan2_16::y#0 atan2_16::angle#4 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::y#0 atan2_16::angle#4 ] ) always clobbers reg byte a -Statement [42] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 [ atan2_16::angle#11 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::angle#11 ] ) always clobbers reg byte a -Statement [43] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 [ atan2_16::angle#5 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::angle#5 ] ) always clobbers reg byte a -Statement [46] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [47] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [48] 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [49] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [50] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [51] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [52] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [56] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [57] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [58] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [59] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [60] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [61] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#11 ] ) always clobbers reg byte a -Statement [65] *((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:2::init_font_hex:5 [ 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:17 [ init_font_hex::c#6 init_font_hex::c#1 ] -Removing always clobbered register reg byte y as potential for zp ZP_BYTE:17 [ init_font_hex::c#6 init_font_hex::c#1 ] -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:22 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Removing always clobbered register reg byte y as potential for zp ZP_BYTE:22 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Statement [67] (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:2::init_font_hex:5 [ 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:23 [ init_font_hex::i#2 init_font_hex::i#1 ] -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:24 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Statement [68] (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:2::init_font_hex:5 [ 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:46 [ init_font_hex::$0 ] -Statement [74] *((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:2::init_font_hex:5 [ 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 [76] *((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:2::init_font_hex:5 [ 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 [77] (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:2::init_font_hex: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 ] ) always clobbers reg byte a -Statement [78] (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:2::init_font_hex:5 [ 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 [81] (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:2::init_font_hex:5 [ init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::proto_hi#1 ] ) always clobbers reg byte a +Statement [13] (dword) clock::return#2 ← (dword) clock::return#0 [ clock::return#2 ] ( main:2 [ clock::return#2 ] ) always clobbers reg byte a +Statement [14] (dword~) main::$4 ← (dword) clock::return#2 [ main::$4 ] ( main:2 [ main::$4 ] ) always clobbers reg byte a +Statement [15] (dword) main::cyclecount#0 ← (dword~) main::$4 - (const dword) CLOCKS_PER_INIT#0 [ main::cyclecount#0 ] ( main:2 [ main::cyclecount#0 ] ) always clobbers reg byte a +Statement [16] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 [ print_dword_at::dw#0 ] ( main:2 [ print_dword_at::dw#0 ] ) always clobbers reg byte a +Statement [19] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [21] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 [ print_dword_at::dw#0 print_word_at::w#0 ] ( main:2::print_dword_at:17 [ print_dword_at::dw#0 print_word_at::w#0 ] ) always clobbers reg byte a +Statement [23] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 [ print_word_at::w#1 ] ( main:2::print_dword_at:17 [ print_word_at::w#1 ] ) always clobbers reg byte a +Statement [27] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ( main:2::print_dword_at:17::print_word_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] main:2::print_dword_at:17::print_word_at:24 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ) always clobbers reg byte a +Statement [28] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ( main:2::print_dword_at:17::print_word_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] main:2::print_dword_at:17::print_word_at:24 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Statement [30] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 [ print_word_at::at#2 print_byte_at::b#1 ] ( main:2::print_dword_at:17::print_word_at:22 [ print_dword_at::dw#0 print_word_at::at#2 print_byte_at::b#1 ] main:2::print_dword_at:17::print_word_at:24 [ print_word_at::at#2 print_byte_at::b#1 ] ) always clobbers reg byte a +Statement [31] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 [ print_byte_at::b#1 print_byte_at::at#1 ] ( main:2::print_dword_at:17::print_word_at:22 [ print_dword_at::dw#0 print_byte_at::b#1 print_byte_at::at#1 ] main:2::print_dword_at:17::print_word_at:24 [ print_byte_at::b#1 print_byte_at::at#1 ] ) always clobbers reg byte a +Statement [35] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ) always clobbers reg byte a +Statement [37] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +Statement [39] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f [ print_byte_at::at#2 print_byte_at::$2 ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32 [ print_dword_at::dw#0 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32 [ print_byte_at::at#2 print_byte_at::$2 ] ) always clobbers reg byte a +Statement [40] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 [ print_byte_at::$2 print_char_at::at#1 ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32 [ print_dword_at::dw#0 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32 [ print_byte_at::$2 print_char_at::at#1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:52 [ print_byte_at::$2 ] +Statement [45] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 [ ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29::print_char_at:38 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29::print_char_at:38 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32::print_char_at:38 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32::print_char_at:38 [ print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:29::print_char_at:42 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29::print_char_at:42 [ print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32::print_char_at:42 [ print_dword_at::dw#0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32::print_char_at:42 [ ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Statement [47] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) [ clock::return#0 ] ( main:2::clock:12 [ clock::return#0 ] ) always clobbers reg byte a +Statement [52] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 ] ) always clobbers reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:12 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:13 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Statement [53] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 init_angle_screen::yw#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 init_angle_screen::yw#0 ] ) always clobbers reg byte y +Statement [54] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::yw#0 atan2_16::x#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_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:12 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:13 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Statement [55] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a +Statement [57] (word) atan2_16::return#2 ← (word) atan2_16::return#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::return#2 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::return#2 ] ) always clobbers reg byte a +Statement [58] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::angle_w#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::angle_w#0 ] ) always clobbers reg byte a +Statement [59] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::$7 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::$7 ] ) always clobbers reg byte a +Statement [60] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::ang_w#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::ang_w#0 ] ) always clobbers reg byte a +Statement [61] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 ] ) always clobbers reg byte y +Statement [68] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 [ atan2_16::x#0 atan2_16::y#0 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a +Statement [69] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ) always clobbers reg byte a +Statement [71] 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 ] ) always clobbers reg byte a +Statement [72] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::$7 ] ) always clobbers reg byte a +Statement [75] 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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:20 [ atan2_16::i#2 atan2_16::i#1 ] +Statement [77] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a +Statement [78] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 [ atan2_16::y#0 atan2_16::angle#1 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a +Statement [79] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 [ atan2_16::y#0 atan2_16::angle#4 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::y#0 atan2_16::angle#4 ] ) always clobbers reg byte a +Statement [81] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 [ atan2_16::angle#11 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::angle#11 ] ) always clobbers reg byte a +Statement [82] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 [ atan2_16::angle#5 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::angle#5 ] ) always clobbers reg byte a +Statement [85] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [86] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [87] 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [88] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [89] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [90] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [91] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [95] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [96] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [97] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [98] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [99] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [100] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#11 ] ) always clobbers reg byte a +Statement [101] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [102] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [103] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [104] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [105] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [110] *((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:2::init_font_hex:5 [ 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:27 [ init_font_hex::c#6 init_font_hex::c#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:27 [ init_font_hex::c#6 init_font_hex::c#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:32 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:32 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Statement [112] (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:2::init_font_hex:5 [ 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:33 [ init_font_hex::i#2 init_font_hex::i#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:34 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Statement [113] (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:2::init_font_hex:5 [ 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:78 [ init_font_hex::$0 ] +Statement [119] *((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:2::init_font_hex:5 [ 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 [121] *((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:2::init_font_hex:5 [ 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 [122] (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:2::init_font_hex: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 ] ) always clobbers reg byte a +Statement [123] (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:2::init_font_hex:5 [ 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 [126] (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:2::init_font_hex:5 [ init_font_hex::c#6 init_font_hex::charset#0 init_font_hex::proto_hi#1 ] ) always clobbers reg byte a Statement [7] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a -Statement [13] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 ] ) always clobbers reg byte a reg byte y -Statement [14] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 init_angle_screen::yw#0 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 init_angle_screen::yw#0 ] ) always clobbers reg byte a reg byte y -Statement [15] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::yw#0 atan2_16::x#0 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::yw#0 atan2_16::x#0 ] ) always clobbers reg byte a -Statement [16] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a -Statement [18] (word) atan2_16::return#2 ← (word) atan2_16::return#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::return#2 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::return#2 ] ) always clobbers reg byte a -Statement [19] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::angle_w#0 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::angle_w#0 ] ) always clobbers reg byte a -Statement [20] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::$7 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::$7 ] ) always clobbers reg byte a -Statement [21] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::ang_w#0 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::ang_w#0 ] ) always clobbers reg byte a -Statement [22] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 ] ( main:2::init_angle_screen:8 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 ] ) always clobbers reg byte y -Statement [29] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 [ atan2_16::x#0 atan2_16::y#0 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a -Statement [30] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ) always clobbers reg byte a -Statement [32] 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 ] ) always clobbers reg byte a -Statement [33] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::$7 ] ) always clobbers reg byte a -Statement [36] 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [38] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a -Statement [39] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 [ atan2_16::y#0 atan2_16::angle#1 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a -Statement [40] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 [ atan2_16::y#0 atan2_16::angle#4 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::y#0 atan2_16::angle#4 ] ) always clobbers reg byte a -Statement [42] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 [ atan2_16::angle#11 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::angle#11 ] ) always clobbers reg byte a -Statement [43] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 [ atan2_16::angle#5 ] ( main:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::angle#5 ] ) always clobbers reg byte a -Statement [46] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [47] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [48] 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [49] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [50] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [51] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [52] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [56] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [57] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [58] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [59] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) 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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [60] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [61] (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:2::init_angle_screen:8::atan2_16:17 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#11 ] ) always clobbers reg byte a -Statement [65] *((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:2::init_font_hex:5 [ 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 [67] (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:2::init_font_hex:5 [ 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 [68] (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:2::init_font_hex:5 [ 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 [74] *((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:2::init_font_hex:5 [ 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 [76] *((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:2::init_font_hex:5 [ 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 [77] (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:2::init_font_hex: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 ] ) always clobbers reg byte a -Statement [78] (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:2::init_font_hex:5 [ 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 [81] (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:2::init_font_hex:5 [ 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_BYTE:2 [ init_angle_screen::y#4 init_angle_screen::y#1 ] : zp ZP_BYTE:2 , reg byte x , -Potential registers zp ZP_BYTE:3 [ init_angle_screen::x#2 init_angle_screen::x#1 ] : zp ZP_BYTE:3 , reg byte x , -Potential registers zp ZP_WORD:4 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] : zp ZP_WORD:4 , -Potential registers zp ZP_WORD:6 [ 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:6 , -Potential registers zp ZP_WORD:8 [ 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:8 , -Potential registers zp ZP_BYTE:10 [ atan2_16::i#2 atan2_16::i#1 ] : zp ZP_BYTE:10 , reg byte x , reg byte y , -Potential registers zp ZP_WORD:11 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] : zp ZP_WORD:11 , -Potential registers zp ZP_WORD:13 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] : zp ZP_WORD:13 , -Potential registers zp ZP_WORD:15 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] : zp ZP_WORD:15 , -Potential registers zp ZP_BYTE:17 [ init_font_hex::c#6 init_font_hex::c#1 ] : zp ZP_BYTE:17 , reg byte x , -Potential registers zp ZP_WORD:18 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] : zp ZP_WORD:18 , -Potential registers zp ZP_WORD:20 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] : zp ZP_WORD:20 , -Potential registers zp ZP_BYTE:22 [ init_font_hex::c1#4 init_font_hex::c1#1 ] : zp ZP_BYTE:22 , reg byte x , -Potential registers zp ZP_BYTE:23 [ init_font_hex::i#2 init_font_hex::i#1 ] : zp ZP_BYTE:23 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:24 [ init_font_hex::idx#5 init_font_hex::idx#2 ] : zp ZP_BYTE:24 , reg byte x , reg byte y , -Potential registers zp ZP_WORD:25 [ init_angle_screen::xw#0 ] : zp ZP_WORD:25 , -Potential registers zp ZP_WORD:27 [ init_angle_screen::yw#0 ] : zp ZP_WORD:27 , -Potential registers zp ZP_WORD:29 [ atan2_16::x#0 ] : zp ZP_WORD:29 , -Potential registers zp ZP_WORD:31 [ atan2_16::y#0 ] : zp ZP_WORD:31 , -Potential registers zp ZP_WORD:33 [ atan2_16::return#2 ] : zp ZP_WORD:33 , -Potential registers zp ZP_WORD:35 [ init_angle_screen::angle_w#0 ] : zp ZP_WORD:35 , -Potential registers zp ZP_WORD:37 [ init_angle_screen::$7 ] : zp ZP_WORD:37 , -Potential registers zp ZP_BYTE:39 [ init_angle_screen::ang_w#0 ] : zp ZP_BYTE:39 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_WORD:40 [ atan2_16::xd#0 ] : zp ZP_WORD:40 , -Potential registers zp ZP_WORD:42 [ atan2_16::yd#0 ] : zp ZP_WORD:42 , -Potential registers zp ZP_BYTE:44 [ atan2_16::$24 ] : zp ZP_BYTE:44 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:45 [ atan2_16::$23 ] : zp ZP_BYTE:45 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:46 [ init_font_hex::$0 ] : zp ZP_BYTE:46 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:47 [ init_font_hex::$1 ] : zp ZP_BYTE:47 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:48 [ init_font_hex::$2 ] : zp ZP_BYTE:48 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:49 [ init_font_hex::idx#3 ] : zp ZP_BYTE:49 , reg byte a , reg byte x , reg byte y , +Statement [13] (dword) clock::return#2 ← (dword) clock::return#0 [ clock::return#2 ] ( main:2 [ clock::return#2 ] ) always clobbers reg byte a +Statement [14] (dword~) main::$4 ← (dword) clock::return#2 [ main::$4 ] ( main:2 [ main::$4 ] ) always clobbers reg byte a +Statement [15] (dword) main::cyclecount#0 ← (dword~) main::$4 - (const dword) CLOCKS_PER_INIT#0 [ main::cyclecount#0 ] ( main:2 [ main::cyclecount#0 ] ) always clobbers reg byte a +Statement [16] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 [ print_dword_at::dw#0 ] ( main:2 [ print_dword_at::dw#0 ] ) always clobbers reg byte a +Statement [19] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [21] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 [ print_dword_at::dw#0 print_word_at::w#0 ] ( main:2::print_dword_at:17 [ print_dword_at::dw#0 print_word_at::w#0 ] ) always clobbers reg byte a +Statement [23] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 [ print_word_at::w#1 ] ( main:2::print_dword_at:17 [ print_word_at::w#1 ] ) always clobbers reg byte a +Statement [27] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ( main:2::print_dword_at:17::print_word_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] main:2::print_dword_at:17::print_word_at:24 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 ] ) always clobbers reg byte a +Statement [28] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ( main:2::print_dword_at:17::print_word_at:22 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] main:2::print_dword_at:17::print_word_at:24 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#0 print_byte_at::at#0 ] ) always clobbers reg byte a +Statement [30] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 [ print_word_at::at#2 print_byte_at::b#1 ] ( main:2::print_dword_at:17::print_word_at:22 [ print_dword_at::dw#0 print_word_at::at#2 print_byte_at::b#1 ] main:2::print_dword_at:17::print_word_at:24 [ print_word_at::at#2 print_byte_at::b#1 ] ) always clobbers reg byte a +Statement [31] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 [ print_byte_at::b#1 print_byte_at::at#1 ] ( main:2::print_dword_at:17::print_word_at:22 [ print_dword_at::dw#0 print_byte_at::b#1 print_byte_at::at#1 ] main:2::print_dword_at:17::print_word_at:24 [ print_byte_at::b#1 print_byte_at::at#1 ] ) always clobbers reg byte a +Statement [35] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32 [ print_byte_at::b#2 print_byte_at::at#2 print_byte_at::$0 ] ) always clobbers reg byte a +Statement [37] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32 [ print_byte_at::b#2 print_byte_at::at#2 print_char_at::ch#0 print_char_at::at#0 ] ) always clobbers reg byte a +Statement [39] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f [ print_byte_at::at#2 print_byte_at::$2 ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32 [ print_dword_at::dw#0 print_byte_at::at#2 print_byte_at::$2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32 [ print_byte_at::at#2 print_byte_at::$2 ] ) always clobbers reg byte a +Statement [40] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 [ print_byte_at::$2 print_char_at::at#1 ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32 [ print_dword_at::dw#0 print_byte_at::$2 print_char_at::at#1 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32 [ print_byte_at::$2 print_char_at::at#1 ] ) always clobbers reg byte a +Statement [45] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 [ ] ( main:2::print_dword_at:17::print_word_at:22::print_byte_at:29::print_char_at:38 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29::print_char_at:38 [ print_word_at::w#2 print_word_at::at#2 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32::print_char_at:38 [ print_dword_at::dw#0 print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32::print_char_at:38 [ print_byte_at::b#2 print_byte_at::at#2 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:29::print_char_at:42 [ print_dword_at::dw#0 print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:29::print_char_at:42 [ print_word_at::w#2 print_word_at::at#2 ] main:2::print_dword_at:17::print_word_at:22::print_byte_at:32::print_char_at:42 [ print_dword_at::dw#0 ] main:2::print_dword_at:17::print_word_at:24::print_byte_at:32::print_char_at:42 [ ] ) always clobbers reg byte a reg byte y +Statement [47] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) [ clock::return#0 ] ( main:2::clock:12 [ clock::return#0 ] ) always clobbers reg byte a +Statement [52] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 ] ) always clobbers reg byte a reg byte y +Statement [53] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 init_angle_screen::yw#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::xw#0 init_angle_screen::yw#0 ] ) always clobbers reg byte a reg byte y +Statement [54] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::yw#0 atan2_16::x#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::yw#0 atan2_16::x#0 ] ) always clobbers reg byte a +Statement [55] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a +Statement [57] (word) atan2_16::return#2 ← (word) atan2_16::return#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::return#2 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::return#2 ] ) always clobbers reg byte a +Statement [58] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::angle_w#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::angle_w#0 ] ) always clobbers reg byte a +Statement [59] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::$7 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::$7 ] ) always clobbers reg byte a +Statement [60] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::ang_w#0 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 init_angle_screen::ang_w#0 ] ) always clobbers reg byte a +Statement [61] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 ] ( main:2::init_angle_screen:10 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 ] ) always clobbers reg byte y +Statement [68] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 [ atan2_16::x#0 atan2_16::y#0 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 ] ) always clobbers reg byte a +Statement [69] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 [ atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::$2 ] ) always clobbers reg byte a +Statement [71] 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 ] ) always clobbers reg byte a +Statement [72] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#0 atan2_16::$7 ] ) always clobbers reg byte a +Statement [75] 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [77] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a +Statement [78] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 [ atan2_16::y#0 atan2_16::angle#1 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::y#0 atan2_16::angle#1 ] ) always clobbers reg byte a +Statement [79] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 [ atan2_16::y#0 atan2_16::angle#4 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::y#0 atan2_16::angle#4 ] ) always clobbers reg byte a +Statement [81] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 [ atan2_16::angle#11 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::angle#11 ] ) always clobbers reg byte a +Statement [82] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 [ atan2_16::angle#5 ] ( main:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::angle#5 ] ) always clobbers reg byte a +Statement [85] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [86] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [87] 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [88] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [89] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [90] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [91] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [95] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [96] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [97] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [98] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) 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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [99] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_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 [100] (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:2::init_angle_screen:10::atan2_16:56 [ init_angle_screen::y#4 init_angle_screen::x#2 init_angle_screen::screen#2 atan2_16::x#0 atan2_16::y#0 atan2_16::yi#11 ] ) always clobbers reg byte a +Statement [101] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [102] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [103] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [104] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [105] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 [ ] ( main:2::clock_start:8 [ ] ) always clobbers reg byte a +Statement [110] *((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:2::init_font_hex:5 [ 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 [112] (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:2::init_font_hex:5 [ 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 [113] (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:2::init_font_hex:5 [ 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 [119] *((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:2::init_font_hex:5 [ 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 [121] *((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:2::init_font_hex:5 [ 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 [122] (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:2::init_font_hex: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 ] ) always clobbers reg byte a +Statement [123] (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:2::init_font_hex:5 [ 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 [126] (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:2::init_font_hex:5 [ 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 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] : zp ZP_WORD:2 , +Potential registers zp ZP_WORD:4 [ print_word_at::at#2 ] : zp ZP_WORD:4 , +Potential registers zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] : zp ZP_BYTE:6 , reg byte x , +Potential registers zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] : zp ZP_WORD:7 , +Potential registers zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , +Potential registers zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] : zp ZP_WORD:10 , +Potential registers zp ZP_BYTE:12 [ init_angle_screen::y#4 init_angle_screen::y#1 ] : zp ZP_BYTE:12 , reg byte x , +Potential registers zp ZP_BYTE:13 [ init_angle_screen::x#2 init_angle_screen::x#1 ] : zp ZP_BYTE:13 , reg byte x , +Potential registers zp ZP_WORD:14 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] : zp ZP_WORD:14 , +Potential registers zp ZP_WORD:16 [ 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:16 , +Potential registers zp ZP_WORD:18 [ 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:18 , +Potential registers zp ZP_BYTE:20 [ atan2_16::i#2 atan2_16::i#1 ] : zp ZP_BYTE:20 , reg byte x , reg byte y , +Potential registers zp ZP_WORD:21 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] : zp ZP_WORD:21 , +Potential registers zp ZP_WORD:23 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] : zp ZP_WORD:23 , +Potential registers zp ZP_WORD:25 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] : zp ZP_WORD:25 , +Potential registers zp ZP_BYTE:27 [ init_font_hex::c#6 init_font_hex::c#1 ] : zp ZP_BYTE:27 , reg byte x , +Potential registers zp ZP_WORD:28 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] : zp ZP_WORD:28 , +Potential registers zp ZP_WORD:30 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] : zp ZP_WORD:30 , +Potential registers zp ZP_BYTE:32 [ init_font_hex::c1#4 init_font_hex::c1#1 ] : zp ZP_BYTE:32 , reg byte x , +Potential registers zp ZP_BYTE:33 [ init_font_hex::i#2 init_font_hex::i#1 ] : zp ZP_BYTE:33 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:34 [ init_font_hex::idx#5 init_font_hex::idx#2 ] : zp ZP_BYTE:34 , reg byte x , reg byte y , +Potential registers zp ZP_DWORD:35 [ clock::return#2 ] : zp ZP_DWORD:35 , +Potential registers zp ZP_DWORD:39 [ main::$4 ] : zp ZP_DWORD:39 , +Potential registers zp ZP_DWORD:43 [ main::cyclecount#0 ] : zp ZP_DWORD:43 , +Potential registers zp ZP_DWORD:47 [ print_dword_at::dw#0 ] : zp ZP_DWORD:47 , +Potential registers zp ZP_BYTE:51 [ print_byte_at::$0 ] : zp ZP_BYTE:51 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:52 [ print_byte_at::$2 ] : zp ZP_BYTE:52 , reg byte x , reg byte y , +Potential registers zp ZP_DWORD:53 [ clock::return#0 ] : zp ZP_DWORD:53 , +Potential registers zp ZP_WORD:57 [ init_angle_screen::xw#0 ] : zp ZP_WORD:57 , +Potential registers zp ZP_WORD:59 [ init_angle_screen::yw#0 ] : zp ZP_WORD:59 , +Potential registers zp ZP_WORD:61 [ atan2_16::x#0 ] : zp ZP_WORD:61 , +Potential registers zp ZP_WORD:63 [ atan2_16::y#0 ] : zp ZP_WORD:63 , +Potential registers zp ZP_WORD:65 [ atan2_16::return#2 ] : zp ZP_WORD:65 , +Potential registers zp ZP_WORD:67 [ init_angle_screen::angle_w#0 ] : zp ZP_WORD:67 , +Potential registers zp ZP_WORD:69 [ init_angle_screen::$7 ] : zp ZP_WORD:69 , +Potential registers zp ZP_BYTE:71 [ init_angle_screen::ang_w#0 ] : zp ZP_BYTE:71 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:72 [ atan2_16::xd#0 ] : zp ZP_WORD:72 , +Potential registers zp ZP_WORD:74 [ atan2_16::yd#0 ] : zp ZP_WORD:74 , +Potential registers zp ZP_BYTE:76 [ atan2_16::$24 ] : zp ZP_BYTE:76 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:77 [ atan2_16::$23 ] : zp ZP_BYTE:77 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:78 [ init_font_hex::$0 ] : zp ZP_BYTE:78 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:79 [ init_font_hex::$1 ] : zp ZP_BYTE:79 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:80 [ init_font_hex::$2 ] : zp ZP_BYTE:80 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:81 [ init_font_hex::idx#3 ] : zp ZP_BYTE:81 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [atan2_16] 7,706.67: zp ZP_WORD:11 [ 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:6 [ 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:8 [ 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:44 [ atan2_16::$24 ] 2,002: zp ZP_BYTE:45 [ atan2_16::$23 ] 1,930.5: zp ZP_BYTE:10 [ atan2_16::i#2 atan2_16::i#1 ] 1,501.5: zp ZP_WORD:42 [ atan2_16::yd#0 ] 600.6: zp ZP_WORD:40 [ atan2_16::xd#0 ] 202: zp ZP_WORD:33 [ atan2_16::return#2 ] 50: zp ZP_WORD:13 [ 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:29 [ atan2_16::x#0 ] 3.63: zp ZP_WORD:31 [ atan2_16::y#0 ] -Uplift Scope [init_font_hex] 2,168.83: zp ZP_BYTE:23 [ init_font_hex::i#2 init_font_hex::i#1 ] 2,002: zp ZP_BYTE:47 [ init_font_hex::$1 ] 2,002: zp ZP_BYTE:48 [ init_font_hex::$2 ] 1,151.6: zp ZP_BYTE:24 [ init_font_hex::idx#5 init_font_hex::idx#2 ] 1,001: zp ZP_BYTE:46 [ init_font_hex::$0 ] 202: zp ZP_BYTE:49 [ init_font_hex::idx#3 ] 165.86: zp ZP_WORD:18 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] 164.97: zp ZP_BYTE:22 [ init_font_hex::c1#4 init_font_hex::c1#1 ] 143.04: zp ZP_WORD:20 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] 64.17: zp ZP_WORD:15 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] 17.66: zp ZP_BYTE:17 [ init_font_hex::c#6 init_font_hex::c#1 ] -Uplift Scope [init_angle_screen] 202: zp ZP_WORD:35 [ init_angle_screen::angle_w#0 ] 202: zp ZP_WORD:37 [ init_angle_screen::$7 ] 202: zp ZP_BYTE:39 [ init_angle_screen::ang_w#0 ] 168.33: zp ZP_BYTE:3 [ init_angle_screen::x#2 init_angle_screen::x#1 ] 93.15: zp ZP_WORD:4 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] 50.5: zp ZP_WORD:25 [ init_angle_screen::xw#0 ] 50.5: zp ZP_WORD:27 [ init_angle_screen::yw#0 ] 17.97: zp ZP_BYTE:2 [ init_angle_screen::y#4 init_angle_screen::y#1 ] -Uplift Scope [main] +Uplift Scope [atan2_16] 7,706.67: zp ZP_WORD:21 [ 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:16 [ 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:18 [ 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:76 [ atan2_16::$24 ] 2,002: zp ZP_BYTE:77 [ atan2_16::$23 ] 1,930.5: zp ZP_BYTE:20 [ atan2_16::i#2 atan2_16::i#1 ] 1,501.5: zp ZP_WORD:74 [ atan2_16::yd#0 ] 600.6: zp ZP_WORD:72 [ atan2_16::xd#0 ] 202: zp ZP_WORD:65 [ atan2_16::return#2 ] 50: zp ZP_WORD:23 [ 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:61 [ atan2_16::x#0 ] 3.63: zp ZP_WORD:63 [ atan2_16::y#0 ] +Uplift Scope [init_font_hex] 2,168.83: zp ZP_BYTE:33 [ init_font_hex::i#2 init_font_hex::i#1 ] 2,002: zp ZP_BYTE:79 [ init_font_hex::$1 ] 2,002: zp ZP_BYTE:80 [ init_font_hex::$2 ] 1,151.6: zp ZP_BYTE:34 [ init_font_hex::idx#5 init_font_hex::idx#2 ] 1,001: zp ZP_BYTE:78 [ init_font_hex::$0 ] 202: zp ZP_BYTE:81 [ init_font_hex::idx#3 ] 165.86: zp ZP_WORD:28 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] 164.97: zp ZP_BYTE:32 [ init_font_hex::c1#4 init_font_hex::c1#1 ] 143.04: zp ZP_WORD:30 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] 64.17: zp ZP_WORD:25 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] 17.66: zp ZP_BYTE:27 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplift Scope [init_angle_screen] 202: zp ZP_WORD:67 [ init_angle_screen::angle_w#0 ] 202: zp ZP_WORD:69 [ init_angle_screen::$7 ] 202: zp ZP_BYTE:71 [ init_angle_screen::ang_w#0 ] 168.33: zp ZP_BYTE:13 [ init_angle_screen::x#2 init_angle_screen::x#1 ] 93.15: zp ZP_WORD:14 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] 50.5: zp ZP_WORD:57 [ init_angle_screen::xw#0 ] 50.5: zp ZP_WORD:59 [ init_angle_screen::yw#0 ] 17.97: zp ZP_BYTE:12 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +Uplift Scope [print_char_at] 12: zp ZP_BYTE:9 [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] 12: zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Uplift Scope [print_byte_at] 9.33: zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] 5.6: zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] 4: zp ZP_BYTE:51 [ print_byte_at::$0 ] 2: zp ZP_BYTE:52 [ print_byte_at::$2 ] +Uplift Scope [print_word_at] 10: zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] 0.8: zp ZP_WORD:4 [ print_word_at::at#2 ] +Uplift Scope [main] 4: zp ZP_DWORD:39 [ main::$4 ] 4: zp ZP_DWORD:43 [ main::cyclecount#0 ] +Uplift Scope [clock] 4: zp ZP_DWORD:35 [ clock::return#2 ] 1.33: zp ZP_DWORD:53 [ clock::return#0 ] +Uplift Scope [print_dword_at] 2: zp ZP_DWORD:47 [ print_dword_at::dw#0 ] +Uplift Scope [clock_start] Uplift Scope [] -Uplifting [atan2_16] best 395240 combination zp ZP_WORD:11 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp ZP_WORD:6 [ 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 [ 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:10 [ atan2_16::i#2 atan2_16::i#1 ] zp ZP_WORD:42 [ atan2_16::yd#0 ] zp ZP_WORD:40 [ atan2_16::xd#0 ] zp ZP_WORD:33 [ atan2_16::return#2 ] zp ZP_WORD:13 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] zp ZP_WORD:29 [ atan2_16::x#0 ] zp ZP_WORD:31 [ atan2_16::y#0 ] -Uplifting [init_font_hex] best 376240 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:24 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp ZP_BYTE:46 [ init_font_hex::$0 ] zp ZP_BYTE:49 [ init_font_hex::idx#3 ] zp ZP_WORD:18 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp ZP_BYTE:22 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp ZP_WORD:20 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp ZP_WORD:15 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp ZP_BYTE:17 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [atan2_16] best 395766 combination zp ZP_WORD:21 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp ZP_WORD:16 [ 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:18 [ 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:20 [ atan2_16::i#2 atan2_16::i#1 ] zp ZP_WORD:74 [ atan2_16::yd#0 ] zp ZP_WORD:72 [ atan2_16::xd#0 ] zp ZP_WORD:65 [ atan2_16::return#2 ] zp ZP_WORD:23 [ atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 ] zp ZP_WORD:61 [ atan2_16::x#0 ] zp ZP_WORD:63 [ atan2_16::y#0 ] +Uplifting [init_font_hex] best 376766 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:34 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp ZP_BYTE:78 [ init_font_hex::$0 ] zp ZP_BYTE:81 [ init_font_hex::idx#3 ] zp ZP_WORD:28 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp ZP_BYTE:32 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp ZP_WORD:30 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp ZP_WORD:25 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp ZP_BYTE:27 [ init_font_hex::c#6 init_font_hex::c#1 ] Limited combination testing to 100 combinations of 6912 possible. -Uplifting [init_angle_screen] best 374640 combination zp ZP_WORD:35 [ init_angle_screen::angle_w#0 ] zp ZP_WORD:37 [ init_angle_screen::$7 ] reg byte a [ init_angle_screen::ang_w#0 ] reg byte x [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp ZP_WORD:4 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] zp ZP_WORD:25 [ init_angle_screen::xw#0 ] zp ZP_WORD:27 [ init_angle_screen::yw#0 ] zp ZP_BYTE:2 [ init_angle_screen::y#4 init_angle_screen::y#1 ] -Uplifting [main] best 374640 combination -Uplifting [] best 374640 combination -Attempting to uplift remaining variables inzp ZP_BYTE:10 [ atan2_16::i#2 atan2_16::i#1 ] -Uplifting [atan2_16] best 374640 combination zp ZP_BYTE:10 [ atan2_16::i#2 atan2_16::i#1 ] -Attempting to uplift remaining variables inzp ZP_BYTE:24 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Uplifting [init_font_hex] best 374640 combination zp ZP_BYTE:24 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Attempting to uplift remaining variables inzp ZP_BYTE:46 [ init_font_hex::$0 ] -Uplifting [init_font_hex] best 374640 combination zp ZP_BYTE:46 [ init_font_hex::$0 ] -Attempting to uplift remaining variables inzp ZP_BYTE:49 [ init_font_hex::idx#3 ] -Uplifting [init_font_hex] best 374040 combination reg byte y [ init_font_hex::idx#3 ] -Attempting to uplift remaining variables inzp ZP_BYTE:22 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Uplifting [init_font_hex] best 374040 combination zp ZP_BYTE:22 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Attempting to uplift remaining variables inzp ZP_BYTE:2 [ init_angle_screen::y#4 init_angle_screen::y#1 ] -Uplifting [init_angle_screen] best 374040 combination zp ZP_BYTE:2 [ init_angle_screen::y#4 init_angle_screen::y#1 ] -Attempting to uplift remaining variables inzp ZP_BYTE:17 [ init_font_hex::c#6 init_font_hex::c#1 ] -Uplifting [init_font_hex] best 374040 combination zp ZP_BYTE:17 [ init_font_hex::c#6 init_font_hex::c#1 ] -Coalescing zero page register with common assignment [ zp ZP_WORD:11 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] ] with [ zp ZP_WORD:13 [ 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:25 [ init_angle_screen::xw#0 ] ] with [ zp ZP_WORD:29 [ atan2_16::x#0 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_WORD:27 [ init_angle_screen::yw#0 ] ] with [ zp ZP_WORD:31 [ atan2_16::y#0 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_WORD:33 [ atan2_16::return#2 ] ] with [ zp ZP_WORD:35 [ init_angle_screen::angle_w#0 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_WORD:11 [ 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:33 [ atan2_16::return#2 init_angle_screen::angle_w#0 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_WORD:11 [ 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_angle_screen::angle_w#0 ] ] with [ zp ZP_WORD:37 [ init_angle_screen::$7 ] ] - score: 1 -Allocated (was zp ZP_WORD:4) zp ZP_WORD:3 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] -Allocated (was zp ZP_WORD:6) zp ZP_WORD:5 [ 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:8) zp ZP_WORD:7 [ 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:10) zp ZP_BYTE:9 [ atan2_16::i#2 atan2_16::i#1 ] -Allocated (was zp ZP_WORD:11) zp ZP_WORD:10 [ 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_angle_screen::angle_w#0 init_angle_screen::$7 ] -Allocated (was zp ZP_WORD:15) zp ZP_WORD:12 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] -Allocated (was zp ZP_BYTE:17) zp ZP_BYTE:14 [ init_font_hex::c#6 init_font_hex::c#1 ] -Allocated (was zp ZP_WORD:18) zp ZP_WORD:15 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] -Allocated (was zp ZP_WORD:20) zp ZP_WORD:17 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] -Allocated (was zp ZP_BYTE:22) zp ZP_BYTE:19 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Allocated (was zp ZP_BYTE:24) zp ZP_BYTE:20 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Allocated (was zp ZP_WORD:25) zp ZP_WORD:21 [ init_angle_screen::xw#0 atan2_16::x#0 ] -Allocated (was zp ZP_WORD:27) zp ZP_WORD:23 [ init_angle_screen::yw#0 atan2_16::y#0 ] -Allocated (was zp ZP_WORD:40) zp ZP_WORD:25 [ atan2_16::xd#0 ] -Allocated (was zp ZP_WORD:42) zp ZP_WORD:27 [ atan2_16::yd#0 ] -Allocated (was zp ZP_BYTE:46) zp ZP_BYTE:29 [ init_font_hex::$0 ] +Uplifting [init_angle_screen] best 375166 combination zp ZP_WORD:67 [ init_angle_screen::angle_w#0 ] zp ZP_WORD:69 [ init_angle_screen::$7 ] reg byte a [ init_angle_screen::ang_w#0 ] reg byte x [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp ZP_WORD:14 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] zp ZP_WORD:57 [ init_angle_screen::xw#0 ] zp ZP_WORD:59 [ init_angle_screen::yw#0 ] zp ZP_BYTE:12 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +Uplifting [print_char_at] best 375159 combination reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp ZP_WORD:10 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Uplifting [print_byte_at] best 375151 combination zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] reg byte a [ print_byte_at::$0 ] reg byte y [ print_byte_at::$2 ] +Uplifting [print_word_at] best 375151 combination zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] zp ZP_WORD:4 [ print_word_at::at#2 ] +Uplifting [main] best 375151 combination zp ZP_DWORD:39 [ main::$4 ] zp ZP_DWORD:43 [ main::cyclecount#0 ] +Uplifting [clock] best 375151 combination zp ZP_DWORD:35 [ clock::return#2 ] zp ZP_DWORD:53 [ clock::return#0 ] +Uplifting [print_dword_at] best 375151 combination zp ZP_DWORD:47 [ print_dword_at::dw#0 ] +Uplifting [clock_start] best 375151 combination +Uplifting [] best 375151 combination +Attempting to uplift remaining variables inzp ZP_BYTE:20 [ atan2_16::i#2 atan2_16::i#1 ] +Uplifting [atan2_16] best 375151 combination zp ZP_BYTE:20 [ atan2_16::i#2 atan2_16::i#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:34 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Uplifting [init_font_hex] best 375151 combination zp ZP_BYTE:34 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:78 [ init_font_hex::$0 ] +Uplifting [init_font_hex] best 375151 combination zp ZP_BYTE:78 [ init_font_hex::$0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:81 [ init_font_hex::idx#3 ] +Uplifting [init_font_hex] best 374551 combination reg byte y [ init_font_hex::idx#3 ] +Attempting to uplift remaining variables inzp ZP_BYTE:32 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Uplifting [init_font_hex] best 374551 combination zp ZP_BYTE:32 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:12 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +Uplifting [init_angle_screen] best 374551 combination zp ZP_BYTE:12 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:27 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 374551 combination zp ZP_BYTE:27 [ init_font_hex::c#6 init_font_hex::c#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Uplifting [print_byte_at] best 374551 combination zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +Coalescing zero page register with common assignment [ zp ZP_WORD:4 [ print_word_at::at#2 ] ] with [ zp ZP_WORD:7 [ print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] ] - score: 2 +Coalescing zero page register with common assignment [ zp ZP_WORD:21 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] ] with [ zp ZP_WORD:23 [ 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_DWORD:35 [ clock::return#2 ] ] with [ zp ZP_DWORD:39 [ main::$4 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_DWORD:35 [ clock::return#2 main::$4 ] ] with [ zp ZP_DWORD:53 [ clock::return#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_DWORD:43 [ main::cyclecount#0 ] ] with [ zp ZP_DWORD:47 [ print_dword_at::dw#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:57 [ init_angle_screen::xw#0 ] ] with [ zp ZP_WORD:61 [ atan2_16::x#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:59 [ init_angle_screen::yw#0 ] ] with [ zp ZP_WORD:63 [ atan2_16::y#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:65 [ atan2_16::return#2 ] ] with [ zp ZP_WORD:67 [ init_angle_screen::angle_w#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:21 [ 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:65 [ atan2_16::return#2 init_angle_screen::angle_w#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_DWORD:35 [ clock::return#2 main::$4 clock::return#0 ] ] with [ zp ZP_DWORD:43 [ main::cyclecount#0 print_dword_at::dw#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:21 [ 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_angle_screen::angle_w#0 ] ] with [ zp ZP_WORD:69 [ init_angle_screen::$7 ] ] - score: 1 +Allocated (was zp ZP_WORD:10) zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Allocated (was zp ZP_BYTE:12) zp ZP_BYTE:9 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +Allocated (was zp ZP_WORD:14) zp ZP_WORD:10 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] +Allocated (was zp ZP_WORD:16) zp ZP_WORD:12 [ 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:18) zp ZP_WORD:14 [ 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:20) zp ZP_BYTE:16 [ atan2_16::i#2 atan2_16::i#1 ] +Allocated (was zp ZP_WORD:21) zp ZP_WORD:17 [ 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_angle_screen::angle_w#0 init_angle_screen::$7 ] +Allocated (was zp ZP_WORD:25) zp ZP_WORD:19 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +Allocated (was zp ZP_BYTE:27) zp ZP_BYTE:21 [ init_font_hex::c#6 init_font_hex::c#1 ] +Allocated (was zp ZP_WORD:28) zp ZP_WORD:22 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +Allocated (was zp ZP_WORD:30) zp ZP_WORD:24 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +Allocated (was zp ZP_BYTE:32) zp ZP_BYTE:26 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Allocated (was zp ZP_BYTE:34) zp ZP_BYTE:27 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Allocated (was zp ZP_DWORD:35) zp ZP_DWORD:28 [ clock::return#2 main::$4 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ] +Allocated (was zp ZP_WORD:57) zp ZP_WORD:32 [ init_angle_screen::xw#0 atan2_16::x#0 ] +Allocated (was zp ZP_WORD:59) zp ZP_WORD:34 [ init_angle_screen::yw#0 atan2_16::y#0 ] +Allocated (was zp ZP_WORD:72) zp ZP_WORD:36 [ atan2_16::xd#0 ] +Allocated (was zp ZP_WORD:74) zp ZP_WORD:38 [ atan2_16::yd#0 ] +Allocated (was zp ZP_BYTE:78) zp ZP_BYTE:40 [ init_font_hex::$0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments @@ -2437,8 +3569,23 @@ ASSEMBLER BEFORE OPTIMIZATION .pc = $80d "Program" //SEG2 Global Constants & labels .label D018 = $d018 + // CIA #2 Timer A+B Value (32-bit) + .label CIA2_TIMER_AB = $dd04 + // CIA #2 Timer A Control Register + .label CIA2_TIMER_A_CONTROL = $dd0e + // CIA #2 Timer B Control Register + .label CIA2_TIMER_B_CONTROL = $dd0f + // Timer Control - Start/stop timer (0:stop, 1: start) + .const CIA_TIMER_CONTROL_START = 1 + // Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT) + .const CIA_TIMER_CONTROL_CONTINUOUS = 0 + // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) + .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 // The number of iterations performed during 16-bit CORDIC atan2 calculation .const CORDIC_ITERATIONS_16 = $f + // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. + // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. + .const CLOCKS_PER_INIT = $12 .label CHARSET = $2000 .label SCREEN = $2800 //SEG3 @begin @@ -2459,9 +3606,14 @@ bend_from_b1: bend: //SEG10 main main: { + .label BASE_SCREEN = $400 + .label BASE_CHARSET = $1000 .const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f + .const toD0182_return = (>(BASE_SCREEN&$3fff)*4)|(>BASE_CHARSET)/4&$f + .label _4 = $1c + .label cyclecount = $1c //SEG11 [5] call init_font_hex - //SEG12 [62] phi from main to init_font_hex [phi:main->init_font_hex] + //SEG12 [107] phi from main to init_font_hex [phi:main->init_font_hex] init_font_hex_from_main: jsr init_font_hex //SEG13 [6] phi from main to main::toD0181 [phi:main->main::toD0181] @@ -2475,78 +3627,306 @@ main: { //SEG16 [7] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG17 [8] call init_angle_screen - //SEG18 [10] phi from main::@1 to init_angle_screen [phi:main::@1->init_angle_screen] - init_angle_screen_from_b1: + //SEG17 [8] call clock_start + jsr clock_start + //SEG18 [9] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + b3_from_b1: + jmp b3 + //SEG19 main::@3 + b3: + //SEG20 [10] call init_angle_screen + //SEG21 [49] phi from main::@3 to init_angle_screen [phi:main::@3->init_angle_screen] + init_angle_screen_from_b3: jsr init_angle_screen + //SEG22 [11] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + b4_from_b3: + jmp b4 + //SEG23 main::@4 + b4: + //SEG24 [12] call clock + jsr clock + //SEG25 [13] (dword) clock::return#2 ← (dword) clock::return#0 + jmp b5 + //SEG26 main::@5 + b5: + //SEG27 [14] (dword~) main::$4 ← (dword) clock::return#2 + //SEG28 [15] (dword) main::cyclecount#0 ← (dword~) main::$4 - (const dword) CLOCKS_PER_INIT#0 -- vduz1=vduz1_minus_vduc1 + lda cyclecount + sec + sbc #CLOCKS_PER_INIT + sta cyclecount+1 + lda cyclecount+2 + sbc #>$10 + sta cyclecount+2 + lda cyclecount+3 + sbc #>CLOCKS_PER_INIT>>$10 + sta cyclecount+3 + //SEG29 [16] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + //SEG30 [17] call print_dword_at + jsr print_dword_at + //SEG31 [18] phi from main::@5 to main::toD0182 [phi:main::@5->main::toD0182] + toD0182_from_b5: + jmp toD0182 + //SEG32 main::toD0182 + toD0182: + jmp b2 + //SEG33 main::@2 + b2: + //SEG34 [19] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0182_return + sta D018 jmp breturn - //SEG19 main::@return + //SEG35 main::@return breturn: - //SEG20 [9] return + //SEG36 [20] return rts } -//SEG21 init_angle_screen +//SEG37 print_dword_at +// Print a dword as HEX at a specific position +// print_dword_at(dword zeropage($1c) dw) +print_dword_at: { + .label dw = $1c + //SEG38 [21] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + lda dw+2 + sta print_word_at.w + lda dw+3 + sta print_word_at.w+1 + //SEG39 [22] call print_word_at + //SEG40 [26] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + print_word_at_from_print_dword_at: + //SEG41 [26] phi (byte*) print_word_at::at#2 = (const byte*) main::BASE_SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + lda #main.BASE_SCREEN + sta print_word_at.at+1 + //SEG42 [26] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + jsr print_word_at + jmp b1 + //SEG43 print_dword_at::@1 + b1: + //SEG44 [23] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + lda dw + sta print_word_at.w + lda dw+1 + sta print_word_at.w+1 + //SEG45 [24] call print_word_at + //SEG46 [26] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + print_word_at_from_b1: + //SEG47 [26] phi (byte*) print_word_at::at#2 = (const byte*) main::BASE_SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + lda #main.BASE_SCREEN+4 + sta print_word_at.at+1 + //SEG48 [26] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + jsr print_word_at + jmp breturn + //SEG49 print_dword_at::@return + breturn: + //SEG50 [25] return + rts +} +//SEG51 print_word_at +// Print a word as HEX at a specific position +// print_word_at(word zeropage(2) w, byte* zeropage(4) at) +print_word_at: { + .label w = 2 + .label at = 4 + //SEG52 [27] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + lda w+1 + sta print_byte_at.b + //SEG53 [28] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + //SEG54 [29] call print_byte_at + //SEG55 [34] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + print_byte_at_from_print_word_at: + //SEG56 [34] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG57 [34] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + jsr print_byte_at + jmp b1 + //SEG58 print_word_at::@1 + b1: + //SEG59 [30] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + lda w + sta print_byte_at.b + //SEG60 [31] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz1_plus_2 + lda print_byte_at.at + clc + adc #2 + sta print_byte_at.at + bcc !+ + inc print_byte_at.at+1 + !: + //SEG61 [32] call print_byte_at + //SEG62 [34] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + print_byte_at_from_b1: + //SEG63 [34] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG64 [34] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + jsr print_byte_at + jmp breturn + //SEG65 print_word_at::@return + breturn: + //SEG66 [33] return + rts +} +//SEG67 print_byte_at +// Print a byte as HEX at a specific position +// print_byte_at(byte zeropage(6) b, byte* zeropage(4) at) +print_byte_at: { + .label b = 6 + .label at = 4 + //SEG68 [35] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 + lda b + lsr + lsr + lsr + lsr + //SEG69 [36] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuxx=pbuc1_derefidx_vbuaa + tay + ldx print_hextab,y + //SEG70 [37] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG71 [38] call print_char_at + //SEG72 [44] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + print_char_at_from_print_byte_at: + //SEG73 [44] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG74 [44] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + jmp b1 + //SEG75 print_byte_at::@1 + b1: + //SEG76 [39] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuyy=vbuz1_band_vbuc1 + lda #$f + and b + tay + //SEG77 [40] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + //SEG78 [41] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuxx=pbuc1_derefidx_vbuyy + ldx print_hextab,y + //SEG79 [42] call print_char_at + //SEG80 [44] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + print_char_at_from_b1: + //SEG81 [44] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG82 [44] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + jmp breturn + //SEG83 print_byte_at::@return + breturn: + //SEG84 [43] return + rts +} +//SEG85 print_char_at +// Print a single char +// print_char_at(byte register(X) ch, byte* zeropage(7) at) +print_char_at: { + .label at = 7 + //SEG86 [45] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuxx + txa + ldy #0 + sta (at),y + jmp breturn + //SEG87 print_char_at::@return + breturn: + //SEG88 [46] return + rts +} +//SEG89 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = $1c + //SEG90 [47] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + jmp breturn + //SEG91 clock::@return + breturn: + //SEG92 [48] return + rts +} +//SEG93 init_angle_screen // Populates 1000 bytes (a screen) with values representing the angle to the center. // The actual value stored is distance*2 to increase precision -// init_angle_screen(byte* zeropage(3) screen) +// init_angle_screen(byte* zeropage($a) screen) init_angle_screen: { - .label _7 = $a - .label xw = $15 - .label yw = $17 - .label angle_w = $a - .label screen = 3 - .label y = 2 - //SEG22 [11] phi from init_angle_screen to init_angle_screen::@1 [phi:init_angle_screen->init_angle_screen::@1] + .label _7 = $11 + .label xw = $20 + .label yw = $22 + .label angle_w = $11 + .label screen = $a + .label y = 9 + //SEG94 [50] phi from init_angle_screen to init_angle_screen::@1 [phi:init_angle_screen->init_angle_screen::@1] b1_from_init_angle_screen: - //SEG23 [11] phi (byte*) init_angle_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_angle_screen->init_angle_screen::@1#0] -- pbuz1=pbuc1 + //SEG95 [50] phi (byte*) init_angle_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_angle_screen->init_angle_screen::@1#0] -- pbuz1=pbuc1 lda #SCREEN sta screen+1 - //SEG24 [11] phi (signed byte) init_angle_screen::y#4 = (signed byte) -$c [phi:init_angle_screen->init_angle_screen::@1#1] -- vbsz1=vbsc1 + //SEG96 [50] phi (signed byte) init_angle_screen::y#4 = (signed byte) -$c [phi:init_angle_screen->init_angle_screen::@1#1] -- vbsz1=vbsc1 lda #-$c sta y jmp b1 - //SEG25 [11] phi from init_angle_screen::@3 to init_angle_screen::@1 [phi:init_angle_screen::@3->init_angle_screen::@1] + //SEG97 [50] phi from init_angle_screen::@3 to init_angle_screen::@1 [phi:init_angle_screen::@3->init_angle_screen::@1] b1_from_b3: - //SEG26 [11] phi (byte*) init_angle_screen::screen#4 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@3->init_angle_screen::@1#0] -- register_copy - //SEG27 [11] phi (signed byte) init_angle_screen::y#4 = (signed byte) init_angle_screen::y#1 [phi:init_angle_screen::@3->init_angle_screen::@1#1] -- register_copy + //SEG98 [50] phi (byte*) init_angle_screen::screen#4 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@3->init_angle_screen::@1#0] -- register_copy + //SEG99 [50] phi (signed byte) init_angle_screen::y#4 = (signed byte) init_angle_screen::y#1 [phi:init_angle_screen::@3->init_angle_screen::@1#1] -- register_copy jmp b1 - //SEG28 init_angle_screen::@1 + //SEG100 init_angle_screen::@1 b1: - //SEG29 [12] phi from init_angle_screen::@1 to init_angle_screen::@2 [phi:init_angle_screen::@1->init_angle_screen::@2] + //SEG101 [51] phi from init_angle_screen::@1 to init_angle_screen::@2 [phi:init_angle_screen::@1->init_angle_screen::@2] b2_from_b1: - //SEG30 [12] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#4 [phi:init_angle_screen::@1->init_angle_screen::@2#0] -- register_copy - //SEG31 [12] phi (signed byte) init_angle_screen::x#2 = (signed byte) -$13 [phi:init_angle_screen::@1->init_angle_screen::@2#1] -- vbsxx=vbsc1 + //SEG102 [51] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#4 [phi:init_angle_screen::@1->init_angle_screen::@2#0] -- register_copy + //SEG103 [51] phi (signed byte) init_angle_screen::x#2 = (signed byte) -$13 [phi:init_angle_screen::@1->init_angle_screen::@2#1] -- vbsxx=vbsc1 ldx #-$13 jmp b2 - //SEG32 [12] phi from init_angle_screen::@4 to init_angle_screen::@2 [phi:init_angle_screen::@4->init_angle_screen::@2] + //SEG104 [51] phi from init_angle_screen::@4 to init_angle_screen::@2 [phi:init_angle_screen::@4->init_angle_screen::@2] b2_from_b4: - //SEG33 [12] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@4->init_angle_screen::@2#0] -- register_copy - //SEG34 [12] phi (signed byte) init_angle_screen::x#2 = (signed byte) init_angle_screen::x#1 [phi:init_angle_screen::@4->init_angle_screen::@2#1] -- register_copy + //SEG105 [51] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@4->init_angle_screen::@2#0] -- register_copy + //SEG106 [51] phi (signed byte) init_angle_screen::x#2 = (signed byte) init_angle_screen::x#1 [phi:init_angle_screen::@4->init_angle_screen::@2#1] -- register_copy jmp b2 - //SEG35 init_angle_screen::@2 + //SEG107 init_angle_screen::@2 b2: - //SEG36 [13] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 -- vwuz1=vbuxx_word_vbuc1 + //SEG108 [52] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 -- vwuz1=vbuxx_word_vbuc1 ldy #0 txa sta xw+1 sty xw - //SEG37 [14] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 + //SEG109 [53] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 lda y ldy #0 sta yw+1 sty yw - //SEG38 [15] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 - //SEG39 [16] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 - //SEG40 [17] call atan2_16 + //SEG110 [54] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 + //SEG111 [55] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 + //SEG112 [56] call atan2_16 jsr atan2_16 - //SEG41 [18] (word) atan2_16::return#2 ← (word) atan2_16::return#0 + //SEG113 [57] (word) atan2_16::return#2 ← (word) atan2_16::return#0 jmp b4 - //SEG42 init_angle_screen::@4 + //SEG114 init_angle_screen::@4 b4: - //SEG43 [19] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 - //SEG44 [20] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz1_plus_vbuc1 + //SEG115 [58] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 + //SEG116 [59] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz1_plus_vbuc1 lda #$80 clc adc _7 @@ -2554,60 +3934,60 @@ init_angle_screen: { bcc !+ inc _7+1 !: - //SEG45 [21] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 -- vbuaa=_hi_vwuz1 + //SEG117 [60] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 -- vbuaa=_hi_vwuz1 lda _7+1 - //SEG46 [22] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 -- _deref_pbuz1=vbuaa + //SEG118 [61] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 -- _deref_pbuz1=vbuaa ldy #0 sta (screen),y - //SEG47 [23] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 -- pbuz1=_inc_pbuz1 + //SEG119 [62] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 -- pbuz1=_inc_pbuz1 inc screen bne !+ inc screen+1 !: - //SEG48 [24] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 -- vbsxx=_inc_vbsxx + //SEG120 [63] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 -- vbsxx=_inc_vbsxx inx - //SEG49 [25] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 -- vbsxx_neq_vbsc1_then_la1 + //SEG121 [64] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 -- vbsxx_neq_vbsc1_then_la1 cpx #$15 bne b2_from_b4 jmp b3 - //SEG50 init_angle_screen::@3 + //SEG122 init_angle_screen::@3 b3: - //SEG51 [26] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 -- vbsz1=_inc_vbsz1 + //SEG123 [65] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 -- vbsz1=_inc_vbsz1 inc y - //SEG52 [27] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 -- vbsz1_neq_vbsc1_then_la1 + //SEG124 [66] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 -- vbsz1_neq_vbsc1_then_la1 lda #$d cmp y bne b1_from_b3 jmp breturn - //SEG53 init_angle_screen::@return + //SEG125 init_angle_screen::@return breturn: - //SEG54 [28] return + //SEG126 [67] return rts } -//SEG55 atan2_16 +//SEG127 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($15) x, signed word zeropage($17) y) +// atan2_16(signed word zeropage($20) x, signed word zeropage($22) y) atan2_16: { - .label _2 = 5 - .label _7 = 7 - .label yi = 5 - .label xi = 7 - .label xd = $19 - .label yd = $1b - .label angle = $a - .label i = 9 - .label return = $a - .label x = $15 - .label y = $17 - //SEG56 [29] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 -- vwsz1_ge_0_then_la1 + .label _2 = $c + .label _7 = $e + .label yi = $c + .label xi = $e + .label xd = $24 + .label yd = $26 + .label angle = $11 + .label i = $10 + .label return = $11 + .label x = $20 + .label y = $22 + //SEG128 [68] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 -- vwsz1_ge_0_then_la1 lda y+1 bpl b1 jmp b2 - //SEG57 atan2_16::@2 + //SEG129 atan2_16::@2 b2: - //SEG58 [30] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 + //SEG130 [69] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 sec lda #0 sbc y @@ -2615,20 +3995,20 @@ atan2_16: { lda #0 sbc y+1 sta _2+1 - //SEG59 [31] phi from atan2_16::@1 atan2_16::@2 to atan2_16::@3 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3] + //SEG131 [70] 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: - //SEG60 [31] 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 + //SEG132 [70] 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 - //SEG61 atan2_16::@3 + //SEG133 atan2_16::@3 b3: - //SEG62 [32] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 -- vwsz1_ge_0_then_la1 + //SEG134 [71] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 -- vwsz1_ge_0_then_la1 lda x+1 bpl b4 jmp b5 - //SEG63 atan2_16::@5 + //SEG135 atan2_16::@5 b5: - //SEG64 [33] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 + //SEG136 [72] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 sec lda #0 sbc x @@ -2636,50 +4016,50 @@ atan2_16: { lda #0 sbc x+1 sta _7+1 - //SEG65 [34] phi from atan2_16::@4 atan2_16::@5 to atan2_16::@6 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6] + //SEG137 [73] 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: - //SEG66 [34] 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 + //SEG138 [73] 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 - //SEG67 atan2_16::@6 + //SEG139 atan2_16::@6 b6: - //SEG68 [35] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] + //SEG140 [74] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] b10_from_b6: - //SEG69 [35] phi (word) atan2_16::angle#12 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#0] -- vwuz1=vbuc1 + //SEG141 [74] 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 - //SEG70 [35] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 + //SEG142 [74] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 lda #0 sta i - //SEG71 [35] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy - //SEG72 [35] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#0 [phi:atan2_16::@6->atan2_16::@10#3] -- register_copy + //SEG143 [74] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy + //SEG144 [74] 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 - //SEG73 atan2_16::@10 + //SEG145 atan2_16::@10 b10: - //SEG74 [36] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 + //SEG146 [75] 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 - //SEG75 [37] phi from atan2_16::@10 atan2_16::@14 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12] + //SEG147 [76] 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: - //SEG76 [37] phi (word) atan2_16::angle#6 = (word) atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12#0] -- register_copy + //SEG148 [76] 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 - //SEG77 atan2_16::@12 + //SEG149 atan2_16::@12 b12: - //SEG78 [38] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 -- vwuz1=vwuz1_ror_1 + //SEG150 [77] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 -- vwuz1=vwuz1_ror_1 lsr angle+1 ror angle - //SEG79 [39] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 -- vwsz1_ge_0_then_la1 + //SEG151 [78] 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 - //SEG80 atan2_16::@16 + //SEG152 atan2_16::@16 b16: - //SEG81 [40] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 + //SEG153 [79] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 sec lda #<$8000 sbc angle @@ -2687,20 +4067,20 @@ atan2_16: { lda #>$8000 sbc angle+1 sta angle+1 - //SEG82 [41] phi from atan2_16::@12 atan2_16::@16 to atan2_16::@7 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7] + //SEG154 [80] 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: - //SEG83 [41] phi (word) atan2_16::angle#11 = (word) atan2_16::angle#1 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7#0] -- register_copy + //SEG155 [80] 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 - //SEG84 atan2_16::@7 + //SEG156 atan2_16::@7 b7: - //SEG85 [42] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 -- vwsz1_ge_0_then_la1 + //SEG157 [81] 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 - //SEG86 atan2_16::@9 + //SEG158 atan2_16::@9 b9: - //SEG87 [43] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 + //SEG159 [82] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 sec lda #0 sbc angle @@ -2708,21 +4088,21 @@ atan2_16: { lda #0 sbc angle+1 sta angle+1 - //SEG88 [44] phi from atan2_16::@7 atan2_16::@9 to atan2_16::@8 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8] + //SEG160 [83] 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: - //SEG89 [44] phi (word) atan2_16::return#0 = (word) atan2_16::angle#11 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8#0] -- register_copy + //SEG161 [83] 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 - //SEG90 atan2_16::@8 + //SEG162 atan2_16::@8 b8: jmp breturn - //SEG91 atan2_16::@return + //SEG163 atan2_16::@return breturn: - //SEG92 [45] return + //SEG164 [84] return rts - //SEG93 atan2_16::@11 + //SEG165 atan2_16::@11 b11: - //SEG94 [46] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + //SEG166 [85] (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 @@ -2738,7 +4118,7 @@ atan2_16: { dey bne !- !e: - //SEG95 [47] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + //SEG167 [86] (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 @@ -2754,13 +4134,13 @@ atan2_16: { dey bne !- !e: - //SEG96 [48] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@13 -- vwsz1_ge_0_then_la1 + //SEG168 [87] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@13 -- vwsz1_ge_0_then_la1 lda yi+1 bpl b13 jmp b15 - //SEG97 atan2_16::@15 + //SEG169 atan2_16::@15 b15: - //SEG98 [49] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_minus_vwsz2 + //SEG170 [88] (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 @@ -2768,7 +4148,7 @@ atan2_16: { lda xi+1 sbc yd+1 sta xi+1 - //SEG99 [50] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_plus_vwsz2 + //SEG171 [89] (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 @@ -2776,10 +4156,10 @@ atan2_16: { lda yi+1 adc xd+1 sta yi+1 - //SEG100 [51] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + //SEG172 [90] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 lda i asl - //SEG101 [52] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuaa + //SEG173 [91] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuaa tay sec lda angle @@ -2788,31 +4168,31 @@ atan2_16: { lda angle+1 sbc CORDIC_ATAN2_ANGLES_16+1,y sta angle+1 - //SEG102 [53] phi from atan2_16::@13 atan2_16::@15 to atan2_16::@14 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14] + //SEG174 [92] 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: - //SEG103 [53] 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 - //SEG104 [53] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy - //SEG105 [53] 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 + //SEG175 [92] 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 + //SEG176 [92] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy + //SEG177 [92] 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 - //SEG106 atan2_16::@14 + //SEG178 atan2_16::@14 b14: - //SEG107 [54] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 + //SEG179 [93] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 inc i - //SEG108 [55] 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 + //SEG180 [94] 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 - //SEG109 [35] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] + //SEG181 [74] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] b10_from_b14: - //SEG110 [35] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy - //SEG111 [35] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy - //SEG112 [35] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy - //SEG113 [35] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#7 [phi:atan2_16::@14->atan2_16::@10#3] -- register_copy + //SEG182 [74] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy + //SEG183 [74] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy + //SEG184 [74] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy + //SEG185 [74] 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 - //SEG114 atan2_16::@13 + //SEG186 atan2_16::@13 b13: - //SEG115 [56] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_plus_vwsz2 + //SEG187 [95] (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 @@ -2820,7 +4200,7 @@ atan2_16: { lda xi+1 adc yd+1 sta xi+1 - //SEG116 [57] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_minus_vwsz2 + //SEG188 [96] (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 @@ -2828,10 +4208,10 @@ atan2_16: { lda yi+1 sbc xd+1 sta yi+1 - //SEG117 [58] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + //SEG189 [97] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 lda i asl - //SEG118 [59] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuaa + //SEG190 [98] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuaa tay clc lda angle @@ -2841,98 +4221,130 @@ atan2_16: { adc CORDIC_ATAN2_ANGLES_16+1,y sta angle+1 jmp b14_from_b13 - //SEG119 atan2_16::@4 + //SEG191 atan2_16::@4 b4: - //SEG120 [60] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 -- vwsz1=vwsz2 + //SEG192 [99] (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 - //SEG121 atan2_16::@1 + //SEG193 atan2_16::@1 b1: - //SEG122 [61] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 -- vwsz1=vwsz2 + //SEG194 [100] (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 } -//SEG123 init_font_hex +//SEG195 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG196 [101] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG197 [102] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG198 [103] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG199 [104] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG200 [105] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + jmp breturn + //SEG201 clock_start::@return + breturn: + //SEG202 [106] return + rts +} +//SEG203 init_font_hex // Make charset from proto chars -// init_font_hex(byte* zeropage($f) charset) +// init_font_hex(byte* zeropage($16) charset) init_font_hex: { - .label _0 = $1d - .label idx = $14 - .label proto_lo = $11 - .label charset = $f - .label c1 = $13 - .label proto_hi = $c - .label c = $e - //SEG124 [63] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] + .label _0 = $28 + .label idx = $1b + .label proto_lo = $18 + .label charset = $16 + .label c1 = $1a + .label proto_hi = $13 + .label c = $15 + //SEG204 [108] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] b1_from_init_font_hex: - //SEG125 [63] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 + //SEG205 [108] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 lda #0 sta c - //SEG126 [63] 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 + //SEG206 [108] 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 - //SEG127 [63] phi (byte*) init_font_hex::charset#5 = (const byte*) CHARSET#0 [phi:init_font_hex->init_font_hex::@1#2] -- pbuz1=pbuc1 + //SEG207 [108] 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 - //SEG128 [63] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] + //SEG208 [108] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] b1_from_b5: - //SEG129 [63] 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 - //SEG130 [63] 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 - //SEG131 [63] 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 + //SEG209 [108] 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 + //SEG210 [108] 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 + //SEG211 [108] 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 - //SEG132 init_font_hex::@1 + //SEG212 init_font_hex::@1 b1: - //SEG133 [64] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] + //SEG213 [109] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] b2_from_b1: - //SEG134 [64] phi (byte) init_font_hex::c1#4 = (byte) 0 [phi:init_font_hex::@1->init_font_hex::@2#0] -- vbuz1=vbuc1 + //SEG214 [109] 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 - //SEG135 [64] 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 + //SEG215 [109] 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 - //SEG136 [64] 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 + //SEG216 [109] 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 - //SEG137 [64] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] + //SEG217 [109] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] b2_from_b4: - //SEG138 [64] 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 - //SEG139 [64] 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 - //SEG140 [64] 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 + //SEG218 [109] 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 + //SEG219 [109] 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 + //SEG220 [109] 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 - //SEG141 init_font_hex::@2 + //SEG221 init_font_hex::@2 b2: - //SEG142 [65] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + //SEG222 [110] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 lda #0 ldy #0 sta (charset),y - //SEG143 [66] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] + //SEG223 [111] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] b3_from_b2: - //SEG144 [66] phi (byte) init_font_hex::idx#5 = (byte) 1 [phi:init_font_hex::@2->init_font_hex::@3#0] -- vbuz1=vbuc1 + //SEG224 [111] 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 - //SEG145 [66] phi (byte) init_font_hex::i#2 = (byte) 0 [phi:init_font_hex::@2->init_font_hex::@3#1] -- vbuxx=vbuc1 + //SEG225 [111] 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 - //SEG146 [66] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] + //SEG226 [111] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] b3_from_b3: - //SEG147 [66] 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 - //SEG148 [66] 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 + //SEG227 [111] 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 + //SEG228 [111] 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 - //SEG149 init_font_hex::@3 + //SEG229 init_font_hex::@3 b3: - //SEG150 [67] (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 + //SEG230 [112] (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 @@ -2941,37 +4353,37 @@ init_font_hex: { asl asl sta _0 - //SEG151 [68] (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 + //SEG231 [113] (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 - //SEG152 [69] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 -- vbuaa=vbuz1_bor_vbuaa + //SEG232 [114] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 -- vbuaa=vbuz1_bor_vbuaa ora _0 - //SEG153 [70] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 -- pbuz1_derefidx_vbuz2=vbuaa + //SEG233 [115] *((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 - //SEG154 [71] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 + //SEG234 [116] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 inc idx - //SEG155 [72] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuxx=_inc_vbuxx + //SEG235 [117] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuxx=_inc_vbuxx inx - //SEG156 [73] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 -- vbuxx_neq_vbuc1_then_la1 + //SEG236 [118] 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 - //SEG157 init_font_hex::@4 + //SEG237 init_font_hex::@4 b4: - //SEG158 [74] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 -- pbuz1_derefidx_vbuz2=vbuc1 + //SEG238 [119] *((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 - //SEG159 [75] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuyy=_inc_vbuz1 + //SEG239 [120] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuyy=_inc_vbuz1 ldy idx iny - //SEG160 [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 -- pbuz1_derefidx_vbuyy=vbuc1 + //SEG240 [121] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 -- pbuz1_derefidx_vbuyy=vbuc1 lda #0 sta (charset),y - //SEG161 [77] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + //SEG241 [122] (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 @@ -2979,7 +4391,7 @@ init_font_hex: { bcc !+ inc proto_lo+1 !: - //SEG162 [78] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 + //SEG242 [123] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 lda #8 clc adc charset @@ -2987,16 +4399,16 @@ init_font_hex: { bcc !+ inc charset+1 !: - //SEG163 [79] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 + //SEG243 [124] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 inc c1 - //SEG164 [80] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 -- vbuz1_neq_vbuc1_then_la1 + //SEG244 [125] 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 - //SEG165 init_font_hex::@5 + //SEG245 init_font_hex::@5 b5: - //SEG166 [81] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + //SEG246 [126] (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 @@ -3004,32 +4416,46 @@ init_font_hex: { bcc !+ inc proto_hi+1 !: - //SEG167 [82] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 + //SEG247 [127] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 inc c - //SEG168 [83] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 -- vbuz1_neq_vbuc1_then_la1 + //SEG248 [128] 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 - //SEG169 init_font_hex::@return + //SEG249 init_font_hex::@return breturn: - //SEG170 [84] return + //SEG250 [129] return rts } -//SEG171 File Data +//SEG251 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 -// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... 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 +(label) main::toD0182 +(word~) main::toD0182_$0 +(number~) main::toD0182_$1 +(number~) main::toD0182_$2 +(number~) main::toD0182_$3 +(word~) main::toD0182_$4 +(byte~) main::toD0182_$5 +(number~) main::toD0182_$6 +(number~) main::toD0182_$7 +(number~) main::toD0182_$8 +(byte*) main::toD0182_gfx +(byte) main::toD0182_return +(const byte) main::toD0182_return#0 toD0182_return = >(word)(const byte*) main::BASE_SCREEN#0&(word) $3fff*(byte) 4|>(word)(const byte*) main::BASE_CHARSET#0/(byte) 4&(byte) $f +(byte*) main::toD0182_screen +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 reg byte a 4.0 +(byte~) print_byte_at::$2 reg byte y 2.0 +(label) print_byte_at::@1 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 at zp ZP_WORD:4 4.0 +(byte*) print_byte_at::at#1 at zp ZP_WORD:4 4.0 +(byte*) print_byte_at::at#2 at zp ZP_WORD:4 1.3333333333333333 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 b zp ZP_BYTE:6 2.0 +(byte) print_byte_at::b#1 b zp ZP_BYTE:6 2.0 +(byte) print_byte_at::b#2 b zp ZP_BYTE:6 1.6 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 at zp ZP_WORD:7 4.0 +(byte*) print_char_at::at#1 at zp ZP_WORD:7 2.0 +(byte*) print_char_at::at#2 at zp ZP_WORD:7 6.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 reg byte x 2.0 +(byte) print_char_at::ch#1 reg byte x 4.0 +(byte) print_char_at::ch#2 reg byte x 6.0 +(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at) +(label) print_dword_at::@1 +(label) print_dword_at::@return +(byte*) print_dword_at::at +(dword) print_dword_at::dw +(dword) print_dword_at::dw#0 dw zp ZP_DWORD:28 2.0 +(byte[]) print_hextab +(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef" +(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at) +(label) print_word_at::@1 +(label) print_word_at::@return +(byte*) print_word_at::at +(byte*) print_word_at::at#2 at zp ZP_WORD:4 0.8 +(word) print_word_at::w +(word) print_word_at::w#0 w zp ZP_WORD:2 4.0 +(word) print_word_at::w#1 w zp ZP_WORD:2 4.0 +(word) print_word_at::w#2 w zp ZP_WORD:2 2.0 -zp ZP_BYTE:2 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +zp ZP_WORD:4 [ print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +zp ZP_BYTE:9 [ init_angle_screen::y#4 init_angle_screen::y#1 ] reg byte x [ init_angle_screen::x#2 init_angle_screen::x#1 ] -zp ZP_WORD:3 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] -zp ZP_WORD:5 [ 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:7 [ 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:9 [ atan2_16::i#2 atan2_16::i#1 ] -zp ZP_WORD:10 [ 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_angle_screen::angle_w#0 init_angle_screen::$7 ] -zp ZP_WORD:12 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] -zp ZP_BYTE:14 [ init_font_hex::c#6 init_font_hex::c#1 ] -zp ZP_WORD:15 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] -zp ZP_WORD:17 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] -zp ZP_BYTE:19 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +zp ZP_WORD:10 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] +zp ZP_WORD:12 [ 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:14 [ 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:16 [ atan2_16::i#2 atan2_16::i#1 ] +zp ZP_WORD:17 [ 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_angle_screen::angle_w#0 init_angle_screen::$7 ] +zp ZP_WORD:19 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +zp ZP_BYTE:21 [ init_font_hex::c#6 init_font_hex::c#1 ] +zp ZP_WORD:22 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +zp ZP_WORD:24 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +zp ZP_BYTE:26 [ 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:20 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -zp ZP_WORD:21 [ init_angle_screen::xw#0 atan2_16::x#0 ] -zp ZP_WORD:23 [ init_angle_screen::yw#0 atan2_16::y#0 ] +zp ZP_BYTE:27 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +zp ZP_DWORD:28 [ clock::return#2 main::$4 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ] +reg byte a [ print_byte_at::$0 ] +reg byte y [ print_byte_at::$2 ] +zp ZP_WORD:32 [ init_angle_screen::xw#0 atan2_16::x#0 ] +zp ZP_WORD:34 [ init_angle_screen::yw#0 atan2_16::y#0 ] reg byte a [ init_angle_screen::ang_w#0 ] -zp ZP_WORD:25 [ atan2_16::xd#0 ] -zp ZP_WORD:27 [ atan2_16::yd#0 ] +zp ZP_WORD:36 [ atan2_16::xd#0 ] +zp ZP_WORD:38 [ atan2_16::yd#0 ] reg byte a [ atan2_16::$24 ] reg byte a [ atan2_16::$23 ] -zp ZP_BYTE:29 [ init_font_hex::$0 ] +zp ZP_BYTE:40 [ 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: 347105 +Score: 347462 //SEG0 File Comments // Calculate the angle to the center of the screen - and show it using font-hex @@ -3331,8 +4877,23 @@ Score: 347105 .pc = $80d "Program" //SEG2 Global Constants & labels .label D018 = $d018 + // CIA #2 Timer A+B Value (32-bit) + .label CIA2_TIMER_AB = $dd04 + // CIA #2 Timer A Control Register + .label CIA2_TIMER_A_CONTROL = $dd0e + // CIA #2 Timer B Control Register + .label CIA2_TIMER_B_CONTROL = $dd0f + // Timer Control - Start/stop timer (0:stop, 1: start) + .const CIA_TIMER_CONTROL_START = 1 + // Timer Control - Time CONTINUOUS/ONE-SHOT (0:CONTINUOUS, 1: ONE-SHOT) + .const CIA_TIMER_CONTROL_CONTINUOUS = 0 + // Timer B Control - Timer counts (00:system cycles, 01: CNT pulses, 10: timer A underflow, 11: time A underflow while CNT is high) + .const CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A = $40 // The number of iterations performed during 16-bit CORDIC atan2 calculation .const CORDIC_ITERATIONS_16 = $f + // Clock cycles used to start & read the cycle clock by calling clock_start() and clock() once. Can be subtracted when calculating the number of cycles used by a routine. + // To make precise cycle measurements interrupts and the display must be disabled so neither steals any cycles from the code. + .const CLOCKS_PER_INIT = $12 .label CHARSET = $2000 .label SCREEN = $2800 //SEG3 @begin @@ -3344,9 +4905,14 @@ Score: 347105 //SEG9 @end //SEG10 main main: { + .label BASE_SCREEN = $400 + .label BASE_CHARSET = $1000 .const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f + .const toD0182_return = (>(BASE_SCREEN&$3fff)*4)|(>BASE_CHARSET)/4&$f + .label _4 = $1c + .label cyclecount = $1c //SEG11 [5] call init_font_hex - //SEG12 [62] phi from main to init_font_hex [phi:main->init_font_hex] + //SEG12 [107] phi from main to init_font_hex [phi:main->init_font_hex] jsr init_font_hex //SEG13 [6] phi from main to main::toD0181 [phi:main->main::toD0181] //SEG14 main::toD0181 @@ -3354,64 +4920,257 @@ main: { //SEG16 [7] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG17 [8] call init_angle_screen - //SEG18 [10] phi from main::@1 to init_angle_screen [phi:main::@1->init_angle_screen] + //SEG17 [8] call clock_start + jsr clock_start + //SEG18 [9] phi from main::@1 to main::@3 [phi:main::@1->main::@3] + //SEG19 main::@3 + //SEG20 [10] call init_angle_screen + //SEG21 [49] phi from main::@3 to init_angle_screen [phi:main::@3->init_angle_screen] jsr init_angle_screen - //SEG19 main::@return - //SEG20 [9] return + //SEG22 [11] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + //SEG23 main::@4 + //SEG24 [12] call clock + jsr clock + //SEG25 [13] (dword) clock::return#2 ← (dword) clock::return#0 + //SEG26 main::@5 + //SEG27 [14] (dword~) main::$4 ← (dword) clock::return#2 + //SEG28 [15] (dword) main::cyclecount#0 ← (dword~) main::$4 - (const dword) CLOCKS_PER_INIT#0 -- vduz1=vduz1_minus_vduc1 + lda cyclecount + sec + sbc #CLOCKS_PER_INIT + sta cyclecount+1 + lda cyclecount+2 + sbc #>$10 + sta cyclecount+2 + lda cyclecount+3 + sbc #>CLOCKS_PER_INIT>>$10 + sta cyclecount+3 + //SEG29 [16] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0 + //SEG30 [17] call print_dword_at + jsr print_dword_at + //SEG31 [18] phi from main::@5 to main::toD0182 [phi:main::@5->main::toD0182] + //SEG32 main::toD0182 + //SEG33 main::@2 + //SEG34 [19] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0182_return + sta D018 + //SEG35 main::@return + //SEG36 [20] return rts } -//SEG21 init_angle_screen +//SEG37 print_dword_at +// Print a dword as HEX at a specific position +// print_dword_at(dword zeropage($1c) dw) +print_dword_at: { + .label dw = $1c + //SEG38 [21] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0 -- vwuz1=_hi_vduz2 + lda dw+2 + sta print_word_at.w + lda dw+3 + sta print_word_at.w+1 + //SEG39 [22] call print_word_at + //SEG40 [26] phi from print_dword_at to print_word_at [phi:print_dword_at->print_word_at] + //SEG41 [26] phi (byte*) print_word_at::at#2 = (const byte*) main::BASE_SCREEN#0 [phi:print_dword_at->print_word_at#0] -- pbuz1=pbuc1 + lda #main.BASE_SCREEN + sta print_word_at.at+1 + //SEG42 [26] phi (word) print_word_at::w#2 = (word) print_word_at::w#0 [phi:print_dword_at->print_word_at#1] -- register_copy + jsr print_word_at + //SEG43 print_dword_at::@1 + //SEG44 [23] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0 -- vwuz1=_lo_vduz2 + lda dw + sta print_word_at.w + lda dw+1 + sta print_word_at.w+1 + //SEG45 [24] call print_word_at + //SEG46 [26] phi from print_dword_at::@1 to print_word_at [phi:print_dword_at::@1->print_word_at] + //SEG47 [26] phi (byte*) print_word_at::at#2 = (const byte*) main::BASE_SCREEN#0+(byte) 4 [phi:print_dword_at::@1->print_word_at#0] -- pbuz1=pbuc1 + lda #main.BASE_SCREEN+4 + sta print_word_at.at+1 + //SEG48 [26] phi (word) print_word_at::w#2 = (word) print_word_at::w#1 [phi:print_dword_at::@1->print_word_at#1] -- register_copy + jsr print_word_at + //SEG49 print_dword_at::@return + //SEG50 [25] return + rts +} +//SEG51 print_word_at +// Print a word as HEX at a specific position +// print_word_at(word zeropage(2) w, byte* zeropage(4) at) +print_word_at: { + .label w = 2 + .label at = 4 + //SEG52 [27] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2 -- vbuz1=_hi_vwuz2 + lda w+1 + sta print_byte_at.b + //SEG53 [28] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2 + //SEG54 [29] call print_byte_at + //SEG55 [34] phi from print_word_at to print_byte_at [phi:print_word_at->print_byte_at] + //SEG56 [34] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#0 [phi:print_word_at->print_byte_at#0] -- register_copy + //SEG57 [34] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#0 [phi:print_word_at->print_byte_at#1] -- register_copy + jsr print_byte_at + //SEG58 print_word_at::@1 + //SEG59 [30] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2 -- vbuz1=_lo_vwuz2 + lda w + sta print_byte_at.b + //SEG60 [31] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2 -- pbuz1=pbuz1_plus_2 + lda print_byte_at.at + clc + adc #2 + sta print_byte_at.at + bcc !+ + inc print_byte_at.at+1 + !: + //SEG61 [32] call print_byte_at + //SEG62 [34] phi from print_word_at::@1 to print_byte_at [phi:print_word_at::@1->print_byte_at] + //SEG63 [34] phi (byte*) print_byte_at::at#2 = (byte*) print_byte_at::at#1 [phi:print_word_at::@1->print_byte_at#0] -- register_copy + //SEG64 [34] phi (byte) print_byte_at::b#2 = (byte) print_byte_at::b#1 [phi:print_word_at::@1->print_byte_at#1] -- register_copy + jsr print_byte_at + //SEG65 print_word_at::@return + //SEG66 [33] return + rts +} +//SEG67 print_byte_at +// Print a byte as HEX at a specific position +// print_byte_at(byte zeropage(6) b, byte* zeropage(4) at) +print_byte_at: { + .label b = 6 + .label at = 4 + //SEG68 [35] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4 -- vbuaa=vbuz1_ror_4 + lda b + lsr + lsr + lsr + lsr + //SEG69 [36] (byte) print_char_at::ch#0 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$0) -- vbuxx=pbuc1_derefidx_vbuaa + tay + ldx print_hextab,y + //SEG70 [37] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2 -- pbuz1=pbuz2 + lda at + sta print_char_at.at + lda at+1 + sta print_char_at.at+1 + //SEG71 [38] call print_char_at + //SEG72 [44] phi from print_byte_at to print_char_at [phi:print_byte_at->print_char_at] + //SEG73 [44] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#0 [phi:print_byte_at->print_char_at#0] -- register_copy + //SEG74 [44] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#0 [phi:print_byte_at->print_char_at#1] -- register_copy + jsr print_char_at + //SEG75 print_byte_at::@1 + //SEG76 [39] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f -- vbuyy=vbuz1_band_vbuc1 + lda #$f + and b + tay + //SEG77 [40] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1 -- pbuz1=pbuz2_plus_1 + lda at + clc + adc #1 + sta print_char_at.at + lda at+1 + adc #0 + sta print_char_at.at+1 + //SEG78 [41] (byte) print_char_at::ch#1 ← *((const byte[]) print_hextab#0 + (byte~) print_byte_at::$2) -- vbuxx=pbuc1_derefidx_vbuyy + ldx print_hextab,y + //SEG79 [42] call print_char_at + //SEG80 [44] phi from print_byte_at::@1 to print_char_at [phi:print_byte_at::@1->print_char_at] + //SEG81 [44] phi (byte*) print_char_at::at#2 = (byte*) print_char_at::at#1 [phi:print_byte_at::@1->print_char_at#0] -- register_copy + //SEG82 [44] phi (byte) print_char_at::ch#2 = (byte) print_char_at::ch#1 [phi:print_byte_at::@1->print_char_at#1] -- register_copy + jsr print_char_at + //SEG83 print_byte_at::@return + //SEG84 [43] return + rts +} +//SEG85 print_char_at +// Print a single char +// print_char_at(byte register(X) ch, byte* zeropage(7) at) +print_char_at: { + .label at = 7 + //SEG86 [45] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2 -- _deref_pbuz1=vbuxx + txa + ldy #0 + sta (at),y + //SEG87 print_char_at::@return + //SEG88 [46] return + rts +} +//SEG89 clock +// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program). +// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start() +clock: { + .label return = $1c + //SEG90 [47] (dword) clock::return#0 ← (dword) $ffffffff - *((const dword*) CIA2_TIMER_AB#0) -- vduz1=vduc1_minus__deref_pduc2 + lda #<$ffffffff + sec + sbc CIA2_TIMER_AB + sta return + lda #>$ffffffff + sbc CIA2_TIMER_AB+1 + sta return+1 + lda #<$ffffffff>>$10 + sbc CIA2_TIMER_AB+2 + sta return+2 + lda #>$ffffffff>>$10 + sbc CIA2_TIMER_AB+3 + sta return+3 + //SEG91 clock::@return + //SEG92 [48] return + rts +} +//SEG93 init_angle_screen // Populates 1000 bytes (a screen) with values representing the angle to the center. // The actual value stored is distance*2 to increase precision -// init_angle_screen(byte* zeropage(3) screen) +// init_angle_screen(byte* zeropage($a) screen) init_angle_screen: { - .label _7 = $a - .label xw = $15 - .label yw = $17 - .label angle_w = $a - .label screen = 3 - .label y = 2 - //SEG22 [11] phi from init_angle_screen to init_angle_screen::@1 [phi:init_angle_screen->init_angle_screen::@1] - //SEG23 [11] phi (byte*) init_angle_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_angle_screen->init_angle_screen::@1#0] -- pbuz1=pbuc1 + .label _7 = $11 + .label xw = $20 + .label yw = $22 + .label angle_w = $11 + .label screen = $a + .label y = 9 + //SEG94 [50] phi from init_angle_screen to init_angle_screen::@1 [phi:init_angle_screen->init_angle_screen::@1] + //SEG95 [50] phi (byte*) init_angle_screen::screen#4 = (const byte*) SCREEN#0 [phi:init_angle_screen->init_angle_screen::@1#0] -- pbuz1=pbuc1 lda #SCREEN sta screen+1 - //SEG24 [11] phi (signed byte) init_angle_screen::y#4 = (signed byte) -$c [phi:init_angle_screen->init_angle_screen::@1#1] -- vbsz1=vbsc1 + //SEG96 [50] phi (signed byte) init_angle_screen::y#4 = (signed byte) -$c [phi:init_angle_screen->init_angle_screen::@1#1] -- vbsz1=vbsc1 lda #-$c sta y - //SEG25 [11] phi from init_angle_screen::@3 to init_angle_screen::@1 [phi:init_angle_screen::@3->init_angle_screen::@1] - //SEG26 [11] phi (byte*) init_angle_screen::screen#4 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@3->init_angle_screen::@1#0] -- register_copy - //SEG27 [11] phi (signed byte) init_angle_screen::y#4 = (signed byte) init_angle_screen::y#1 [phi:init_angle_screen::@3->init_angle_screen::@1#1] -- register_copy - //SEG28 init_angle_screen::@1 + //SEG97 [50] phi from init_angle_screen::@3 to init_angle_screen::@1 [phi:init_angle_screen::@3->init_angle_screen::@1] + //SEG98 [50] phi (byte*) init_angle_screen::screen#4 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@3->init_angle_screen::@1#0] -- register_copy + //SEG99 [50] phi (signed byte) init_angle_screen::y#4 = (signed byte) init_angle_screen::y#1 [phi:init_angle_screen::@3->init_angle_screen::@1#1] -- register_copy + //SEG100 init_angle_screen::@1 b1: - //SEG29 [12] phi from init_angle_screen::@1 to init_angle_screen::@2 [phi:init_angle_screen::@1->init_angle_screen::@2] - //SEG30 [12] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#4 [phi:init_angle_screen::@1->init_angle_screen::@2#0] -- register_copy - //SEG31 [12] phi (signed byte) init_angle_screen::x#2 = (signed byte) -$13 [phi:init_angle_screen::@1->init_angle_screen::@2#1] -- vbsxx=vbsc1 + //SEG101 [51] phi from init_angle_screen::@1 to init_angle_screen::@2 [phi:init_angle_screen::@1->init_angle_screen::@2] + //SEG102 [51] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#4 [phi:init_angle_screen::@1->init_angle_screen::@2#0] -- register_copy + //SEG103 [51] phi (signed byte) init_angle_screen::x#2 = (signed byte) -$13 [phi:init_angle_screen::@1->init_angle_screen::@2#1] -- vbsxx=vbsc1 ldx #-$13 - //SEG32 [12] phi from init_angle_screen::@4 to init_angle_screen::@2 [phi:init_angle_screen::@4->init_angle_screen::@2] - //SEG33 [12] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@4->init_angle_screen::@2#0] -- register_copy - //SEG34 [12] phi (signed byte) init_angle_screen::x#2 = (signed byte) init_angle_screen::x#1 [phi:init_angle_screen::@4->init_angle_screen::@2#1] -- register_copy - //SEG35 init_angle_screen::@2 + //SEG104 [51] phi from init_angle_screen::@4 to init_angle_screen::@2 [phi:init_angle_screen::@4->init_angle_screen::@2] + //SEG105 [51] phi (byte*) init_angle_screen::screen#2 = (byte*) init_angle_screen::screen#1 [phi:init_angle_screen::@4->init_angle_screen::@2#0] -- register_copy + //SEG106 [51] phi (signed byte) init_angle_screen::x#2 = (signed byte) init_angle_screen::x#1 [phi:init_angle_screen::@4->init_angle_screen::@2#1] -- register_copy + //SEG107 init_angle_screen::@2 b2: - //SEG36 [13] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 -- vwuz1=vbuxx_word_vbuc1 + //SEG108 [52] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0 -- vwuz1=vbuxx_word_vbuc1 ldy #0 txa sta xw+1 sty xw - //SEG37 [14] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 + //SEG109 [53] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0 -- vwuz1=vbuz2_word_vbuc1 lda y sta yw+1 sty yw - //SEG38 [15] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 - //SEG39 [16] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 - //SEG40 [17] call atan2_16 + //SEG110 [54] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0 + //SEG111 [55] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0 + //SEG112 [56] call atan2_16 jsr atan2_16 - //SEG41 [18] (word) atan2_16::return#2 ← (word) atan2_16::return#0 - //SEG42 init_angle_screen::@4 - //SEG43 [19] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 - //SEG44 [20] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz1_plus_vbuc1 + //SEG113 [57] (word) atan2_16::return#2 ← (word) atan2_16::return#0 + //SEG114 init_angle_screen::@4 + //SEG115 [58] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2 + //SEG116 [59] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80 -- vwuz1=vwuz1_plus_vbuc1 lda #$80 clc adc _7 @@ -3419,56 +5178,56 @@ init_angle_screen: { bcc !+ inc _7+1 !: - //SEG45 [21] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 -- vbuaa=_hi_vwuz1 + //SEG117 [60] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7 -- vbuaa=_hi_vwuz1 lda _7+1 - //SEG46 [22] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 -- _deref_pbuz1=vbuaa + //SEG118 [61] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0 -- _deref_pbuz1=vbuaa ldy #0 sta (screen),y - //SEG47 [23] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 -- pbuz1=_inc_pbuz1 + //SEG119 [62] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2 -- pbuz1=_inc_pbuz1 inc screen bne !+ inc screen+1 !: - //SEG48 [24] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 -- vbsxx=_inc_vbsxx + //SEG120 [63] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2 -- vbsxx=_inc_vbsxx inx - //SEG49 [25] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 -- vbsxx_neq_vbsc1_then_la1 + //SEG121 [64] if((signed byte) init_angle_screen::x#1!=(signed byte) $15) goto init_angle_screen::@2 -- vbsxx_neq_vbsc1_then_la1 cpx #$15 bne b2 - //SEG50 init_angle_screen::@3 - //SEG51 [26] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 -- vbsz1=_inc_vbsz1 + //SEG122 init_angle_screen::@3 + //SEG123 [65] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4 -- vbsz1=_inc_vbsz1 inc y - //SEG52 [27] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 -- vbsz1_neq_vbsc1_then_la1 + //SEG124 [66] if((signed byte) init_angle_screen::y#1!=(signed byte) $d) goto init_angle_screen::@1 -- vbsz1_neq_vbsc1_then_la1 lda #$d cmp y bne b1 - //SEG53 init_angle_screen::@return - //SEG54 [28] return + //SEG125 init_angle_screen::@return + //SEG126 [67] return rts } -//SEG55 atan2_16 +//SEG127 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($15) x, signed word zeropage($17) y) +// atan2_16(signed word zeropage($20) x, signed word zeropage($22) y) atan2_16: { - .label _2 = 5 - .label _7 = 7 - .label yi = 5 - .label xi = 7 - .label xd = $19 - .label yd = $1b - .label angle = $a - .label i = 9 - .label return = $a - .label x = $15 - .label y = $17 - //SEG56 [29] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 -- vwsz1_ge_0_then_la1 + .label _2 = $c + .label _7 = $e + .label yi = $c + .label xi = $e + .label xd = $24 + .label yd = $26 + .label angle = $11 + .label i = $10 + .label return = $11 + .label x = $20 + .label y = $22 + //SEG128 [68] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@1 -- vwsz1_ge_0_then_la1 lda y+1 bmi !b1+ jmp b1 !b1: - //SEG57 atan2_16::@2 - //SEG58 [30] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 + //SEG129 atan2_16::@2 + //SEG130 [69] (signed word~) atan2_16::$2 ← - (signed word) atan2_16::y#0 -- vwsz1=_neg_vwsz2 sec lda #0 sbc y @@ -3476,17 +5235,17 @@ atan2_16: { lda #0 sbc y+1 sta _2+1 - //SEG59 [31] phi from atan2_16::@1 atan2_16::@2 to atan2_16::@3 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3] - //SEG60 [31] 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 - //SEG61 atan2_16::@3 + //SEG131 [70] phi from atan2_16::@1 atan2_16::@2 to atan2_16::@3 [phi:atan2_16::@1/atan2_16::@2->atan2_16::@3] + //SEG132 [70] 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 + //SEG133 atan2_16::@3 b3: - //SEG62 [32] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 -- vwsz1_ge_0_then_la1 + //SEG134 [71] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@4 -- vwsz1_ge_0_then_la1 lda x+1 bmi !b4+ jmp b4 !b4: - //SEG63 atan2_16::@5 - //SEG64 [33] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 + //SEG135 atan2_16::@5 + //SEG136 [72] (signed word~) atan2_16::$7 ← - (signed word) atan2_16::x#0 -- vwsz1=_neg_vwsz2 sec lda #0 sbc x @@ -3494,38 +5253,38 @@ atan2_16: { lda #0 sbc x+1 sta _7+1 - //SEG65 [34] phi from atan2_16::@4 atan2_16::@5 to atan2_16::@6 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6] - //SEG66 [34] 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 - //SEG67 atan2_16::@6 + //SEG137 [73] phi from atan2_16::@4 atan2_16::@5 to atan2_16::@6 [phi:atan2_16::@4/atan2_16::@5->atan2_16::@6] + //SEG138 [73] 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 + //SEG139 atan2_16::@6 b6: - //SEG68 [35] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] - //SEG69 [35] phi (word) atan2_16::angle#12 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#0] -- vwuz1=vbuc1 + //SEG140 [74] phi from atan2_16::@6 to atan2_16::@10 [phi:atan2_16::@6->atan2_16::@10] + //SEG141 [74] 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 - //SEG70 [35] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 + //SEG142 [74] phi (byte) atan2_16::i#2 = (byte) 0 [phi:atan2_16::@6->atan2_16::@10#1] -- vbuz1=vbuc1 sta i - //SEG71 [35] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy - //SEG72 [35] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#0 [phi:atan2_16::@6->atan2_16::@10#3] -- register_copy - //SEG73 atan2_16::@10 + //SEG143 [74] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#0 [phi:atan2_16::@6->atan2_16::@10#2] -- register_copy + //SEG144 [74] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#0 [phi:atan2_16::@6->atan2_16::@10#3] -- register_copy + //SEG145 atan2_16::@10 b10: - //SEG74 [36] if((signed word) atan2_16::yi#3!=(signed byte) 0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 + //SEG146 [75] 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 - //SEG75 [37] phi from atan2_16::@10 atan2_16::@14 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12] - //SEG76 [37] phi (word) atan2_16::angle#6 = (word) atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12#0] -- register_copy - //SEG77 atan2_16::@12 + //SEG147 [76] phi from atan2_16::@10 atan2_16::@14 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12] + //SEG148 [76] phi (word) atan2_16::angle#6 = (word) atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@14->atan2_16::@12#0] -- register_copy + //SEG149 atan2_16::@12 b12: - //SEG78 [38] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 -- vwuz1=vwuz1_ror_1 + //SEG150 [77] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1 -- vwuz1=vwuz1_ror_1 lsr angle+1 ror angle - //SEG79 [39] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 -- vwsz1_ge_0_then_la1 + //SEG151 [78] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7 -- vwsz1_ge_0_then_la1 lda x+1 bpl b7 - //SEG80 atan2_16::@16 - //SEG81 [40] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 + //SEG152 atan2_16::@16 + //SEG153 [79] (word) atan2_16::angle#4 ← (word) $8000 - (word) atan2_16::angle#1 -- vwuz1=vwuc1_minus_vwuz1 sec lda #<$8000 sbc angle @@ -3533,15 +5292,15 @@ atan2_16: { lda #>$8000 sbc angle+1 sta angle+1 - //SEG82 [41] phi from atan2_16::@12 atan2_16::@16 to atan2_16::@7 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7] - //SEG83 [41] phi (word) atan2_16::angle#11 = (word) atan2_16::angle#1 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7#0] -- register_copy - //SEG84 atan2_16::@7 + //SEG154 [80] phi from atan2_16::@12 atan2_16::@16 to atan2_16::@7 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7] + //SEG155 [80] phi (word) atan2_16::angle#11 = (word) atan2_16::angle#1 [phi:atan2_16::@12/atan2_16::@16->atan2_16::@7#0] -- register_copy + //SEG156 atan2_16::@7 b7: - //SEG85 [42] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 -- vwsz1_ge_0_then_la1 + //SEG157 [81] if((signed word) atan2_16::y#0>=(signed byte) 0) goto atan2_16::@8 -- vwsz1_ge_0_then_la1 lda y+1 bpl b8 - //SEG86 atan2_16::@9 - //SEG87 [43] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 + //SEG158 atan2_16::@9 + //SEG159 [82] (word) atan2_16::angle#5 ← - (word) atan2_16::angle#11 -- vwuz1=_neg_vwuz1 sec lda #0 sbc angle @@ -3549,16 +5308,16 @@ atan2_16: { lda #0 sbc angle+1 sta angle+1 - //SEG88 [44] phi from atan2_16::@7 atan2_16::@9 to atan2_16::@8 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8] - //SEG89 [44] phi (word) atan2_16::return#0 = (word) atan2_16::angle#11 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8#0] -- register_copy - //SEG90 atan2_16::@8 + //SEG160 [83] phi from atan2_16::@7 atan2_16::@9 to atan2_16::@8 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8] + //SEG161 [83] phi (word) atan2_16::return#0 = (word) atan2_16::angle#11 [phi:atan2_16::@7/atan2_16::@9->atan2_16::@8#0] -- register_copy + //SEG162 atan2_16::@8 b8: - //SEG91 atan2_16::@return - //SEG92 [45] return + //SEG163 atan2_16::@return + //SEG164 [84] return rts - //SEG93 atan2_16::@11 + //SEG165 atan2_16::@11 b11: - //SEG94 [46] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + //SEG166 [85] (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 @@ -3574,7 +5333,7 @@ atan2_16: { dey bne !- !e: - //SEG95 [47] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2 -- vwsz1=vwsz2_ror_vbuz3 + //SEG167 [86] (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 @@ -3590,11 +5349,11 @@ atan2_16: { dey bne !- !e: - //SEG96 [48] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@13 -- vwsz1_ge_0_then_la1 + //SEG168 [87] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@13 -- vwsz1_ge_0_then_la1 lda yi+1 bpl b13 - //SEG97 atan2_16::@15 - //SEG98 [49] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_minus_vwsz2 + //SEG169 atan2_16::@15 + //SEG170 [88] (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 @@ -3602,7 +5361,7 @@ atan2_16: { lda xi+1 sbc yd+1 sta xi+1 - //SEG99 [50] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_plus_vwsz2 + //SEG171 [89] (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 @@ -3610,10 +5369,10 @@ atan2_16: { lda yi+1 adc xd+1 sta yi+1 - //SEG100 [51] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + //SEG172 [90] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 lda i asl - //SEG101 [52] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuaa + //SEG173 [91] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24) -- vwuz1=vwuz1_minus_pwuc1_derefidx_vbuaa tay sec lda angle @@ -3622,29 +5381,29 @@ atan2_16: { lda angle+1 sbc CORDIC_ATAN2_ANGLES_16+1,y sta angle+1 - //SEG102 [53] phi from atan2_16::@13 atan2_16::@15 to atan2_16::@14 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14] - //SEG103 [53] 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 - //SEG104 [53] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy - //SEG105 [53] 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 - //SEG106 atan2_16::@14 + //SEG174 [92] phi from atan2_16::@13 atan2_16::@15 to atan2_16::@14 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14] + //SEG175 [92] 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 + //SEG176 [92] phi (word) atan2_16::angle#13 = (word) atan2_16::angle#2 [phi:atan2_16::@13/atan2_16::@15->atan2_16::@14#1] -- register_copy + //SEG177 [92] 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 + //SEG178 atan2_16::@14 b14: - //SEG107 [54] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 + //SEG179 [93] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuz1=_inc_vbuz1 inc i - //SEG108 [55] 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 + //SEG180 [94] 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: - //SEG109 [35] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] - //SEG110 [35] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy - //SEG111 [35] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy - //SEG112 [35] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy - //SEG113 [35] phi (signed word) atan2_16::yi#3 = (signed word) atan2_16::yi#7 [phi:atan2_16::@14->atan2_16::@10#3] -- register_copy + //SEG181 [74] phi from atan2_16::@14 to atan2_16::@10 [phi:atan2_16::@14->atan2_16::@10] + //SEG182 [74] phi (word) atan2_16::angle#12 = (word) atan2_16::angle#13 [phi:atan2_16::@14->atan2_16::@10#0] -- register_copy + //SEG183 [74] phi (byte) atan2_16::i#2 = (byte) atan2_16::i#1 [phi:atan2_16::@14->atan2_16::@10#1] -- register_copy + //SEG184 [74] phi (signed word) atan2_16::xi#3 = (signed word) atan2_16::xi#7 [phi:atan2_16::@14->atan2_16::@10#2] -- register_copy + //SEG185 [74] 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 - //SEG114 atan2_16::@13 + //SEG186 atan2_16::@13 b13: - //SEG115 [56] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0 -- vwsz1=vwsz1_plus_vwsz2 + //SEG187 [95] (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 @@ -3652,7 +5411,7 @@ atan2_16: { lda xi+1 adc yd+1 sta xi+1 - //SEG116 [57] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0 -- vwsz1=vwsz1_minus_vwsz2 + //SEG188 [96] (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 @@ -3660,10 +5419,10 @@ atan2_16: { lda yi+1 sbc xd+1 sta yi+1 - //SEG117 [58] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 + //SEG189 [97] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 lda i asl - //SEG118 [59] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuaa + //SEG190 [98] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23) -- vwuz1=vwuz1_plus_pwuc1_derefidx_vbuaa tay clc lda angle @@ -3673,86 +5432,116 @@ atan2_16: { adc CORDIC_ATAN2_ANGLES_16+1,y sta angle+1 jmp b14 - //SEG119 atan2_16::@4 + //SEG191 atan2_16::@4 b4: - //SEG120 [60] (signed word~) atan2_16::xi#8 ← (signed word) atan2_16::x#0 -- vwsz1=vwsz2 + //SEG192 [99] (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 - //SEG121 atan2_16::@1 + //SEG193 atan2_16::@1 b1: - //SEG122 [61] (signed word~) atan2_16::yi#11 ← (signed word) atan2_16::y#0 -- vwsz1=vwsz2 + //SEG194 [100] (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 } -//SEG123 init_font_hex +//SEG195 clock_start +// Reset & start the processor clock time. The value can be read using clock(). +// This uses CIA #2 Timer A+B on the C64 +clock_start: { + //SEG196 [101] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0 -- _deref_pbuc1=vbuc2 + // Setup CIA#2 timer A to count (down) CPU cycles + lda #CIA_TIMER_CONTROL_CONTINUOUS + sta CIA2_TIMER_A_CONTROL + //SEG197 [102] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG198 [103] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff -- _deref_pduc1=vduc2 + lda #<$ffffffff + sta CIA2_TIMER_AB + lda #>$ffffffff + sta CIA2_TIMER_AB+1 + lda #<$ffffffff>>$10 + sta CIA2_TIMER_AB+2 + lda #>$ffffffff>>$10 + sta CIA2_TIMER_AB+3 + //SEG199 [104] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START|CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A + sta CIA2_TIMER_B_CONTROL + //SEG200 [105] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0 -- _deref_pbuc1=vbuc2 + lda #CIA_TIMER_CONTROL_START + sta CIA2_TIMER_A_CONTROL + //SEG201 clock_start::@return + //SEG202 [106] return + rts +} +//SEG203 init_font_hex // Make charset from proto chars -// init_font_hex(byte* zeropage($f) charset) +// init_font_hex(byte* zeropage($16) charset) init_font_hex: { - .label _0 = $1d - .label idx = $14 - .label proto_lo = $11 - .label charset = $f - .label c1 = $13 - .label proto_hi = $c - .label c = $e - //SEG124 [63] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] - //SEG125 [63] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 + .label _0 = $28 + .label idx = $1b + .label proto_lo = $18 + .label charset = $16 + .label c1 = $1a + .label proto_hi = $13 + .label c = $15 + //SEG204 [108] phi from init_font_hex to init_font_hex::@1 [phi:init_font_hex->init_font_hex::@1] + //SEG205 [108] phi (byte) init_font_hex::c#6 = (byte) 0 [phi:init_font_hex->init_font_hex::@1#0] -- vbuz1=vbuc1 lda #0 sta c - //SEG126 [63] 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 + //SEG206 [108] 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 - //SEG127 [63] phi (byte*) init_font_hex::charset#5 = (const byte*) CHARSET#0 [phi:init_font_hex->init_font_hex::@1#2] -- pbuz1=pbuc1 + //SEG207 [108] 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 - //SEG128 [63] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] - //SEG129 [63] 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 - //SEG130 [63] 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 - //SEG131 [63] 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 - //SEG132 init_font_hex::@1 + //SEG208 [108] phi from init_font_hex::@5 to init_font_hex::@1 [phi:init_font_hex::@5->init_font_hex::@1] + //SEG209 [108] 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 + //SEG210 [108] 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 + //SEG211 [108] 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 + //SEG212 init_font_hex::@1 b1: - //SEG133 [64] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] - //SEG134 [64] phi (byte) init_font_hex::c1#4 = (byte) 0 [phi:init_font_hex::@1->init_font_hex::@2#0] -- vbuz1=vbuc1 + //SEG213 [109] phi from init_font_hex::@1 to init_font_hex::@2 [phi:init_font_hex::@1->init_font_hex::@2] + //SEG214 [109] 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 - //SEG135 [64] 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 + //SEG215 [109] 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 - //SEG136 [64] 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 - //SEG137 [64] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] - //SEG138 [64] 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 - //SEG139 [64] 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 - //SEG140 [64] 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 - //SEG141 init_font_hex::@2 + //SEG216 [109] 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 + //SEG217 [109] phi from init_font_hex::@4 to init_font_hex::@2 [phi:init_font_hex::@4->init_font_hex::@2] + //SEG218 [109] 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 + //SEG219 [109] 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 + //SEG220 [109] 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 + //SEG221 init_font_hex::@2 b2: - //SEG142 [65] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 + //SEG222 [110] *((byte*) init_font_hex::charset#2) ← (byte) 0 -- _deref_pbuz1=vbuc1 lda #0 tay sta (charset),y - //SEG143 [66] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] - //SEG144 [66] phi (byte) init_font_hex::idx#5 = (byte) 1 [phi:init_font_hex::@2->init_font_hex::@3#0] -- vbuz1=vbuc1 + //SEG223 [111] phi from init_font_hex::@2 to init_font_hex::@3 [phi:init_font_hex::@2->init_font_hex::@3] + //SEG224 [111] 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 - //SEG145 [66] phi (byte) init_font_hex::i#2 = (byte) 0 [phi:init_font_hex::@2->init_font_hex::@3#1] -- vbuxx=vbuc1 + //SEG225 [111] phi (byte) init_font_hex::i#2 = (byte) 0 [phi:init_font_hex::@2->init_font_hex::@3#1] -- vbuxx=vbuc1 ldx #0 - //SEG146 [66] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] - //SEG147 [66] 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 - //SEG148 [66] 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 - //SEG149 init_font_hex::@3 + //SEG226 [111] phi from init_font_hex::@3 to init_font_hex::@3 [phi:init_font_hex::@3->init_font_hex::@3] + //SEG227 [111] 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 + //SEG228 [111] 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 + //SEG229 init_font_hex::@3 b3: - //SEG150 [67] (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 + //SEG230 [112] (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 @@ -3761,33 +5550,33 @@ init_font_hex: { asl asl sta _0 - //SEG151 [68] (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 + //SEG231 [113] (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 - //SEG152 [69] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 -- vbuaa=vbuz1_bor_vbuaa + //SEG232 [114] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1 -- vbuaa=vbuz1_bor_vbuaa ora _0 - //SEG153 [70] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2 -- pbuz1_derefidx_vbuz2=vbuaa + //SEG233 [115] *((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 - //SEG154 [71] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 + //SEG234 [116] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5 -- vbuz1=_inc_vbuz1 inc idx - //SEG155 [72] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuxx=_inc_vbuxx + //SEG235 [117] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2 -- vbuxx=_inc_vbuxx inx - //SEG156 [73] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 -- vbuxx_neq_vbuc1_then_la1 + //SEG236 [118] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3 -- vbuxx_neq_vbuc1_then_la1 cpx #5 bne b3 - //SEG157 init_font_hex::@4 - //SEG158 [74] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0 -- pbuz1_derefidx_vbuz2=vbuc1 + //SEG237 init_font_hex::@4 + //SEG238 [119] *((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 - //SEG159 [75] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuyy=_inc_vbuz1 + //SEG239 [120] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2 -- vbuyy=_inc_vbuz1 iny - //SEG160 [76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 -- pbuz1_derefidx_vbuyy=vbuc1 + //SEG240 [121] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0 -- pbuz1_derefidx_vbuyy=vbuc1 sta (charset),y - //SEG161 [77] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + //SEG241 [122] (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 @@ -3795,7 +5584,7 @@ init_font_hex: { bcc !+ inc proto_lo+1 !: - //SEG162 [78] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 + //SEG242 [123] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8 -- pbuz1=pbuz1_plus_vbuc1 lda #8 clc adc charset @@ -3803,14 +5592,14 @@ init_font_hex: { bcc !+ inc charset+1 !: - //SEG163 [79] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 + //SEG243 [124] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4 -- vbuz1=_inc_vbuz1 inc c1 - //SEG164 [80] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2 -- vbuz1_neq_vbuc1_then_la1 + //SEG244 [125] 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 - //SEG165 init_font_hex::@5 - //SEG166 [81] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5 -- pbuz1=pbuz1_plus_vbuc1 + //SEG245 init_font_hex::@5 + //SEG246 [126] (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 @@ -3818,22 +5607,23 @@ init_font_hex: { bcc !+ inc proto_hi+1 !: - //SEG167 [82] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 + //SEG247 [127] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6 -- vbuz1=_inc_vbuz1 inc c - //SEG168 [83] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1 -- vbuz1_neq_vbuc1_then_la1 + //SEG248 [128] 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 - //SEG169 init_font_hex::@return - //SEG170 [84] return + //SEG249 init_font_hex::@return + //SEG250 [129] return rts } -//SEG171 File Data +//SEG251 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 -// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... + // Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ... 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 +(label) main::toD0182 +(word~) main::toD0182_$0 +(number~) main::toD0182_$1 +(number~) main::toD0182_$2 +(number~) main::toD0182_$3 +(word~) main::toD0182_$4 +(byte~) main::toD0182_$5 +(number~) main::toD0182_$6 +(number~) main::toD0182_$7 +(number~) main::toD0182_$8 +(byte*) main::toD0182_gfx +(byte) main::toD0182_return +(const byte) main::toD0182_return#0 toD0182_return = >(word)(const byte*) main::BASE_SCREEN#0&(word) $3fff*(byte) 4|>(word)(const byte*) main::BASE_CHARSET#0/(byte) 4&(byte) $f +(byte*) main::toD0182_screen +(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at) +(byte~) print_byte_at::$0 reg byte a 4.0 +(byte~) print_byte_at::$2 reg byte y 2.0 +(label) print_byte_at::@1 +(label) print_byte_at::@return +(byte*) print_byte_at::at +(byte*) print_byte_at::at#0 at zp ZP_WORD:4 4.0 +(byte*) print_byte_at::at#1 at zp ZP_WORD:4 4.0 +(byte*) print_byte_at::at#2 at zp ZP_WORD:4 1.3333333333333333 +(byte) print_byte_at::b +(byte) print_byte_at::b#0 b zp ZP_BYTE:6 2.0 +(byte) print_byte_at::b#1 b zp ZP_BYTE:6 2.0 +(byte) print_byte_at::b#2 b zp ZP_BYTE:6 1.6 +(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at) +(label) print_char_at::@return +(byte*) print_char_at::at +(byte*) print_char_at::at#0 at zp ZP_WORD:7 4.0 +(byte*) print_char_at::at#1 at zp ZP_WORD:7 2.0 +(byte*) print_char_at::at#2 at zp ZP_WORD:7 6.0 +(byte) print_char_at::ch +(byte) print_char_at::ch#0 reg byte x 2.0 +(byte) print_char_at::ch#1 reg byte x 4.0 +(byte) print_char_at::ch#2 reg byte x 6.0 +(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at) +(label) print_dword_at::@1 +(label) print_dword_at::@return +(byte*) print_dword_at::at +(dword) print_dword_at::dw +(dword) print_dword_at::dw#0 dw zp ZP_DWORD:28 2.0 +(byte[]) print_hextab +(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef" +(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at) +(label) print_word_at::@1 +(label) print_word_at::@return +(byte*) print_word_at::at +(byte*) print_word_at::at#2 at zp ZP_WORD:4 0.8 +(word) print_word_at::w +(word) print_word_at::w#0 w zp ZP_WORD:2 4.0 +(word) print_word_at::w#1 w zp ZP_WORD:2 4.0 +(word) print_word_at::w#2 w zp ZP_WORD:2 2.0 -zp ZP_BYTE:2 [ init_angle_screen::y#4 init_angle_screen::y#1 ] +zp ZP_WORD:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ] +zp ZP_WORD:4 [ print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ] +zp ZP_BYTE:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ] +reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] +zp ZP_WORD:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +zp ZP_BYTE:9 [ init_angle_screen::y#4 init_angle_screen::y#1 ] reg byte x [ init_angle_screen::x#2 init_angle_screen::x#1 ] -zp ZP_WORD:3 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] -zp ZP_WORD:5 [ 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:7 [ 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:9 [ atan2_16::i#2 atan2_16::i#1 ] -zp ZP_WORD:10 [ 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_angle_screen::angle_w#0 init_angle_screen::$7 ] -zp ZP_WORD:12 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] -zp ZP_BYTE:14 [ init_font_hex::c#6 init_font_hex::c#1 ] -zp ZP_WORD:15 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] -zp ZP_WORD:17 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] -zp ZP_BYTE:19 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +zp ZP_WORD:10 [ init_angle_screen::screen#2 init_angle_screen::screen#4 init_angle_screen::screen#1 ] +zp ZP_WORD:12 [ 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:14 [ 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:16 [ atan2_16::i#2 atan2_16::i#1 ] +zp ZP_WORD:17 [ 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_angle_screen::angle_w#0 init_angle_screen::$7 ] +zp ZP_WORD:19 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] +zp ZP_BYTE:21 [ init_font_hex::c#6 init_font_hex::c#1 ] +zp ZP_WORD:22 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] +zp ZP_WORD:24 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] +zp ZP_BYTE:26 [ 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:20 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -zp ZP_WORD:21 [ init_angle_screen::xw#0 atan2_16::x#0 ] -zp ZP_WORD:23 [ init_angle_screen::yw#0 atan2_16::y#0 ] +zp ZP_BYTE:27 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +zp ZP_DWORD:28 [ clock::return#2 main::$4 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ] +reg byte a [ print_byte_at::$0 ] +reg byte y [ print_byte_at::$2 ] +zp ZP_WORD:32 [ init_angle_screen::xw#0 atan2_16::x#0 ] +zp ZP_WORD:34 [ init_angle_screen::yw#0 atan2_16::y#0 ] reg byte a [ init_angle_screen::ang_w#0 ] -zp ZP_WORD:25 [ atan2_16::xd#0 ] -zp ZP_WORD:27 [ atan2_16::yd#0 ] +zp ZP_WORD:36 [ atan2_16::xd#0 ] +zp ZP_WORD:38 [ atan2_16::yd#0 ] reg byte a [ atan2_16::$24 ] reg byte a [ atan2_16::$23 ] -zp ZP_BYTE:29 [ init_font_hex::$0 ] +zp ZP_BYTE:40 [ 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 ]