mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-07 06:37:31 +00:00
Added time.kc C standard library compatible. Added cycle counting to a few tests.
This commit is contained in:
parent
7d049f70a3
commit
647775223c
31
src/main/kc/stdlib/time.kc
Normal file
31
src/main/kc/stdlib/time.kc
Normal file
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
20
src/test/kc/cia-timer-cyclecount.kc
Normal file
20
src/test/kc/cia-timer-cyclecount.kc
Normal file
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
169
src/test/ref/cia-timer-cyclecount.asm
Normal file
169
src/test/ref/cia-timer-cyclecount.asm
Normal file
@ -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
|
||||
lda cyclecount+1
|
||||
sbc #>CLOCKS_PER_INIT
|
||||
sta cyclecount+1
|
||||
lda cyclecount+2
|
||||
sbc #<CLOCKS_PER_INIT>>$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
|
||||
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
|
||||
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"
|
94
src/test/ref/cia-timer-cyclecount.cfg
Normal file
94
src/test/ref/cia-timer-cyclecount.cfg
Normal file
@ -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
|
1811
src/test/ref/cia-timer-cyclecount.log
Normal file
1811
src/test/ref/cia-timer-cyclecount.log
Normal file
File diff suppressed because it is too large
Load Diff
84
src/test/ref/cia-timer-cyclecount.sym
Normal file
84
src/test/ref/cia-timer-cyclecount.sym
Normal file
@ -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 ]
|
@ -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
|
||||
lda #>TIMER_INIT
|
||||
sta CIA2_TIMER_AB+1
|
||||
lda #<TIMER_INIT>>$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
|
||||
sec
|
||||
sbc CIA2_TIMER_AB
|
||||
sta print_dword_at.dw
|
||||
lda #>TIMER_INIT
|
||||
sbc CIA2_TIMER_AB+1
|
||||
sta print_dword_at.dw+1
|
||||
lda #<TIMER_INIT>>$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"
|
||||
|
@ -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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 ]
|
||||
|
@ -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
|
||||
lda cyclecount+1
|
||||
sbc #>CLOCKS_PER_INIT
|
||||
sta cyclecount+1
|
||||
lda cyclecount+2
|
||||
sbc #<CLOCKS_PER_INIT>>$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
|
||||
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
|
||||
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
|
||||
sta screen
|
||||
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 #<FONT_HEX_PROTO
|
||||
@ -335,8 +498,9 @@ init_font_hex: {
|
||||
}
|
||||
// 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<CORDIC_ITERATIONS_16; i++)
|
||||
.word 256*2*256*atan(1/pow(2,i))/PI/2
|
||||
|
||||
print_hextab: .text "0123456789abcdef"
|
||||
|
@ -16,157 +16,245 @@ 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
|
||||
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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,22 @@
|
||||
(label) @end
|
||||
(byte*) CHARSET
|
||||
(const byte*) CHARSET#0 CHARSET = (byte*) 8192
|
||||
(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
|
||||
(word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16
|
||||
(const word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16#0 CORDIC_ATAN2_ANGLES_16 = kickasm {{ .for (var i=0; i<CORDIC_ITERATIONS_16; i++)
|
||||
.word 256*2*256*atan(1/pow(2,i))/PI/2
|
||||
@ -16,10 +32,10 @@
|
||||
(byte*) SCREEN
|
||||
(const byte*) SCREEN#0 SCREEN = (byte*) 10240
|
||||
(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y)
|
||||
(signed word~) atan2_16::$2 $2 zp ZP_WORD:5 4.0
|
||||
(signed word~) atan2_16::$2 $2 zp ZP_WORD:12 4.0
|
||||
(byte~) atan2_16::$23 reg byte a 2002.0
|
||||
(byte~) atan2_16::$24 reg byte a 2002.0
|
||||
(signed word~) atan2_16::$7 $7 zp ZP_WORD:7 4.0
|
||||
(signed word~) atan2_16::$7 $7 zp ZP_WORD:14 4.0
|
||||
(label) atan2_16::@1
|
||||
(label) atan2_16::@10
|
||||
(label) atan2_16::@11
|
||||
@ -38,45 +54,52 @@
|
||||
(label) atan2_16::@9
|
||||
(label) atan2_16::@return
|
||||
(word) atan2_16::angle
|
||||
(word) atan2_16::angle#1 angle zp ZP_WORD:10 3.0
|
||||
(word) atan2_16::angle#11 angle zp ZP_WORD:10 4.0
|
||||
(word) atan2_16::angle#12 angle zp ZP_WORD:10 364.0
|
||||
(word) atan2_16::angle#13 angle zp ZP_WORD:10 1334.6666666666667
|
||||
(word) atan2_16::angle#2 angle zp ZP_WORD:10 2002.0
|
||||
(word) atan2_16::angle#3 angle zp ZP_WORD:10 2002.0
|
||||
(word) atan2_16::angle#4 angle zp ZP_WORD:10 4.0
|
||||
(word) atan2_16::angle#5 angle zp ZP_WORD:10 4.0
|
||||
(word) atan2_16::angle#6 angle zp ZP_WORD:10 2004.0
|
||||
(word) atan2_16::angle#1 angle zp ZP_WORD:17 3.0
|
||||
(word) atan2_16::angle#11 angle zp ZP_WORD:17 4.0
|
||||
(word) atan2_16::angle#12 angle zp ZP_WORD:17 364.0
|
||||
(word) atan2_16::angle#13 angle zp ZP_WORD:17 1334.6666666666667
|
||||
(word) atan2_16::angle#2 angle zp ZP_WORD:17 2002.0
|
||||
(word) atan2_16::angle#3 angle zp ZP_WORD:17 2002.0
|
||||
(word) atan2_16::angle#4 angle zp ZP_WORD:17 4.0
|
||||
(word) atan2_16::angle#5 angle zp ZP_WORD:17 4.0
|
||||
(word) atan2_16::angle#6 angle zp ZP_WORD:17 2004.0
|
||||
(byte) atan2_16::i
|
||||
(byte) atan2_16::i#1 i zp ZP_BYTE:9 1501.5
|
||||
(byte) atan2_16::i#2 i zp ZP_BYTE:9 429.0
|
||||
(byte) atan2_16::i#1 i zp ZP_BYTE:16 1501.5
|
||||
(byte) atan2_16::i#2 i zp ZP_BYTE:16 429.0
|
||||
(word) atan2_16::return
|
||||
(word) atan2_16::return#0 return zp ZP_WORD:10 34.99999999999999
|
||||
(word) atan2_16::return#2 return zp ZP_WORD:10 202.0
|
||||
(word) atan2_16::return#0 return zp ZP_WORD:17 34.99999999999999
|
||||
(word) atan2_16::return#2 return zp ZP_WORD:17 202.0
|
||||
(signed word) atan2_16::x
|
||||
(signed word) atan2_16::x#0 x zp ZP_WORD:21 3.8928571428571437
|
||||
(signed word) atan2_16::x#0 x zp ZP_WORD:32 3.8928571428571437
|
||||
(signed word) atan2_16::xd
|
||||
(signed word) atan2_16::xd#0 xd zp ZP_WORD:25 600.5999999999999
|
||||
(signed word) atan2_16::xd#0 xd zp ZP_WORD:36 600.5999999999999
|
||||
(signed word) atan2_16::xi
|
||||
(signed word) atan2_16::xi#0 xi zp ZP_WORD:7 6.0
|
||||
(signed word) atan2_16::xi#1 xi zp ZP_WORD:7 500.5
|
||||
(signed word) atan2_16::xi#2 xi zp ZP_WORD:7 500.5
|
||||
(signed word) atan2_16::xi#3 xi zp ZP_WORD:7 801.2
|
||||
(signed word) atan2_16::xi#7 xi zp ZP_WORD:7 1001.0
|
||||
(signed word~) atan2_16::xi#8 xi zp ZP_WORD:7 4.0
|
||||
(signed word) atan2_16::xi#0 xi zp ZP_WORD:14 6.0
|
||||
(signed word) atan2_16::xi#1 xi zp ZP_WORD:14 500.5
|
||||
(signed word) atan2_16::xi#2 xi zp ZP_WORD:14 500.5
|
||||
(signed word) atan2_16::xi#3 xi zp ZP_WORD:14 801.2
|
||||
(signed word) atan2_16::xi#7 xi zp ZP_WORD:14 1001.0
|
||||
(signed word~) atan2_16::xi#8 xi zp ZP_WORD:14 4.0
|
||||
(signed word) atan2_16::y
|
||||
(signed word) atan2_16::y#0 y zp ZP_WORD:23 3.633333333333334
|
||||
(signed word) atan2_16::y#0 y zp ZP_WORD:34 3.633333333333334
|
||||
(signed word) atan2_16::yd
|
||||
(signed word) atan2_16::yd#0 yd zp ZP_WORD:27 1501.5
|
||||
(signed word) atan2_16::yd#0 yd zp ZP_WORD:38 1501.5
|
||||
(signed word) atan2_16::yi
|
||||
(signed word) atan2_16::yi#0 yi zp ZP_WORD:5 1.2000000000000002
|
||||
(signed word) atan2_16::yi#1 yi zp ZP_WORD:5 667.3333333333334
|
||||
(signed word~) atan2_16::yi#11 yi zp ZP_WORD:5 4.0
|
||||
(signed word) atan2_16::yi#2 yi zp ZP_WORD:5 667.3333333333334
|
||||
(signed word) atan2_16::yi#3 yi zp ZP_WORD:5 858.2857142857142
|
||||
(signed word) atan2_16::yi#7 yi zp ZP_WORD:5 1001.0
|
||||
(signed word) atan2_16::yi#0 yi zp ZP_WORD:12 1.2000000000000002
|
||||
(signed word) atan2_16::yi#1 yi zp ZP_WORD:12 667.3333333333334
|
||||
(signed word~) atan2_16::yi#11 yi zp ZP_WORD:12 4.0
|
||||
(signed word) atan2_16::yi#2 yi zp ZP_WORD:12 667.3333333333334
|
||||
(signed word) atan2_16::yi#3 yi zp ZP_WORD:12 858.2857142857142
|
||||
(signed word) atan2_16::yi#7 yi zp ZP_WORD:12 1001.0
|
||||
(dword()) clock()
|
||||
(label) clock::@return
|
||||
(dword) clock::return
|
||||
(dword) clock::return#0 return zp ZP_DWORD:28 1.3333333333333333
|
||||
(dword) clock::return#2 return zp ZP_DWORD:28 4.0
|
||||
(void()) clock_start()
|
||||
(label) clock_start::@return
|
||||
(void()) init_angle_screen((byte*) init_angle_screen::screen)
|
||||
(word~) init_angle_screen::$7 $7 zp ZP_WORD:10 202.0
|
||||
(word~) init_angle_screen::$7 $7 zp ZP_WORD:17 202.0
|
||||
(label) init_angle_screen::@1
|
||||
(label) init_angle_screen::@2
|
||||
(label) init_angle_screen::@3
|
||||
@ -85,23 +108,23 @@
|
||||
(byte) init_angle_screen::ang_w
|
||||
(byte) init_angle_screen::ang_w#0 reg byte a 202.0
|
||||
(word) init_angle_screen::angle_w
|
||||
(word) init_angle_screen::angle_w#0 angle_w zp ZP_WORD:10 202.0
|
||||
(word) init_angle_screen::angle_w#0 angle_w zp ZP_WORD:17 202.0
|
||||
(byte*) init_angle_screen::screen
|
||||
(byte*) init_angle_screen::screen#1 screen zp ZP_WORD:3 42.599999999999994
|
||||
(byte*) init_angle_screen::screen#2 screen zp ZP_WORD:3 28.545454545454547
|
||||
(byte*) init_angle_screen::screen#4 screen zp ZP_WORD:3 22.0
|
||||
(byte*) init_angle_screen::screen#1 screen zp ZP_WORD:10 42.599999999999994
|
||||
(byte*) init_angle_screen::screen#2 screen zp ZP_WORD:10 28.545454545454547
|
||||
(byte*) init_angle_screen::screen#4 screen zp ZP_WORD:10 22.0
|
||||
(signed byte) init_angle_screen::x
|
||||
(signed byte) init_angle_screen::x#1 reg byte x 151.5
|
||||
(signed byte) init_angle_screen::x#2 reg byte x 16.833333333333332
|
||||
(signed word) init_angle_screen::xw
|
||||
(word) init_angle_screen::xw#0 xw zp ZP_WORD:21 50.5
|
||||
(word) init_angle_screen::xw#0 xw zp ZP_WORD:32 50.5
|
||||
(signed byte) init_angle_screen::y
|
||||
(signed byte) init_angle_screen::y#1 y zp ZP_BYTE:2 16.5
|
||||
(signed byte) init_angle_screen::y#4 y zp ZP_BYTE:2 1.4666666666666666
|
||||
(signed byte) init_angle_screen::y#1 y zp ZP_BYTE:9 16.5
|
||||
(signed byte) init_angle_screen::y#4 y zp ZP_BYTE:9 1.4666666666666666
|
||||
(signed word) init_angle_screen::yw
|
||||
(word) init_angle_screen::yw#0 yw zp ZP_WORD:23 50.5
|
||||
(word) init_angle_screen::yw#0 yw zp ZP_WORD:34 50.5
|
||||
(void()) init_font_hex((byte*) init_font_hex::charset)
|
||||
(byte~) init_font_hex::$0 $0 zp ZP_BYTE:29 1001.0
|
||||
(byte~) init_font_hex::$0 $0 zp ZP_BYTE:40 1001.0
|
||||
(byte~) init_font_hex::$1 reg byte a 2002.0
|
||||
(byte~) init_font_hex::$2 reg byte a 2002.0
|
||||
(label) init_font_hex::@1
|
||||
@ -111,31 +134,42 @@
|
||||
(label) init_font_hex::@5
|
||||
(label) init_font_hex::@return
|
||||
(byte) init_font_hex::c
|
||||
(byte) init_font_hex::c#1 c zp ZP_BYTE:14 16.5
|
||||
(byte) init_font_hex::c#6 c zp ZP_BYTE:14 1.1578947368421053
|
||||
(byte) init_font_hex::c#1 c zp ZP_BYTE:21 16.5
|
||||
(byte) init_font_hex::c#6 c zp ZP_BYTE:21 1.1578947368421053
|
||||
(byte) init_font_hex::c1
|
||||
(byte) init_font_hex::c1#1 c1 zp ZP_BYTE:19 151.5
|
||||
(byte) init_font_hex::c1#4 c1 zp ZP_BYTE:19 13.466666666666667
|
||||
(byte) init_font_hex::c1#1 c1 zp ZP_BYTE:26 151.5
|
||||
(byte) init_font_hex::c1#4 c1 zp ZP_BYTE:26 13.466666666666667
|
||||
(byte*) init_font_hex::charset
|
||||
(byte*) init_font_hex::charset#0 charset zp ZP_WORD:15 35.5
|
||||
(byte*) init_font_hex::charset#2 charset zp ZP_WORD:15 108.35714285714285
|
||||
(byte*) init_font_hex::charset#5 charset zp ZP_WORD:15 22.0
|
||||
(byte*) init_font_hex::charset#0 charset zp ZP_WORD:22 35.5
|
||||
(byte*) init_font_hex::charset#2 charset zp ZP_WORD:22 108.35714285714285
|
||||
(byte*) init_font_hex::charset#5 charset zp ZP_WORD:22 22.0
|
||||
(byte) init_font_hex::i
|
||||
(byte) init_font_hex::i#1 reg byte x 1501.5
|
||||
(byte) init_font_hex::i#2 reg byte x 667.3333333333334
|
||||
(byte) init_font_hex::idx
|
||||
(byte) init_font_hex::idx#2 idx zp ZP_BYTE:20 551.0
|
||||
(byte) init_font_hex::idx#2 idx zp ZP_BYTE:27 551.0
|
||||
(byte) init_font_hex::idx#3 reg byte y 202.0
|
||||
(byte) init_font_hex::idx#5 idx zp ZP_BYTE:20 600.5999999999999
|
||||
(byte) init_font_hex::idx#5 idx zp ZP_BYTE:27 600.5999999999999
|
||||
(byte*) init_font_hex::proto_hi
|
||||
(byte*) init_font_hex::proto_hi#1 proto_hi zp ZP_WORD:12 7.333333333333333
|
||||
(byte*) init_font_hex::proto_hi#6 proto_hi zp ZP_WORD:12 56.83333333333334
|
||||
(byte*) init_font_hex::proto_hi#1 proto_hi zp ZP_WORD:19 7.333333333333333
|
||||
(byte*) init_font_hex::proto_hi#6 proto_hi zp ZP_WORD:19 56.83333333333334
|
||||
(byte*) init_font_hex::proto_lo
|
||||
(byte*) init_font_hex::proto_lo#1 proto_lo zp ZP_WORD:17 50.5
|
||||
(byte*) init_font_hex::proto_lo#4 proto_lo zp ZP_WORD:17 92.53846153846155
|
||||
(byte*) init_font_hex::proto_lo#1 proto_lo zp ZP_WORD:24 50.5
|
||||
(byte*) init_font_hex::proto_lo#4 proto_lo zp ZP_WORD:24 92.53846153846155
|
||||
(void()) main()
|
||||
(dword~) main::$4 $4 zp ZP_DWORD:28 4.0
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@return
|
||||
(byte*) main::BASE_CHARSET
|
||||
(const byte*) main::BASE_CHARSET#0 BASE_CHARSET = (byte*) 4096
|
||||
(byte*) main::BASE_SCREEN
|
||||
(const byte*) main::BASE_SCREEN#0 BASE_SCREEN = (byte*) 1024
|
||||
(dword) main::cyclecount
|
||||
(dword) main::cyclecount#0 cyclecount zp ZP_DWORD:28 4.0
|
||||
(label) main::toD0181
|
||||
(word~) main::toD0181_$0
|
||||
(number~) main::toD0181_$1
|
||||
@ -150,29 +184,91 @@
|
||||
(byte) main::toD0181_return
|
||||
(const byte) main::toD0181_return#0 toD0181_return = >(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 ]
|
||||
|
Loading…
x
Reference in New Issue
Block a user