mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-17 10:30:43 +00:00
Added speed test for filling screen with atan2
This commit is contained in:
parent
e02f3bc2e0
commit
ee11c66a79
@ -35,6 +35,11 @@ public class TestPrograms {
|
||||
public TestPrograms() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScreenCenterAngle() throws IOException, URISyntaxException {
|
||||
compileAndCompare("screen-center-angle");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCordicAtan2Clear() throws IOException, URISyntaxException {
|
||||
compileAndCompare("cordic-atan2-clear");
|
||||
|
31
src/test/kc/screen-center-angle.kc
Normal file
31
src/test/kc/screen-center-angle.kc
Normal file
@ -0,0 +1,31 @@
|
||||
// Calculate the angle to the center of the screen - and show it using font-hex
|
||||
// 4.65 million cycles
|
||||
import "stdlib"
|
||||
import "c64"
|
||||
import "font-hex"
|
||||
import "atan2"
|
||||
|
||||
#reserve(08)
|
||||
|
||||
const byte* CHARSET = 0x2000;
|
||||
const byte* SCREEN = 0x2800;
|
||||
|
||||
void main() {
|
||||
init_font_hex(CHARSET);
|
||||
*D018 = toD018(SCREEN, CHARSET);
|
||||
init_angle_screen(SCREEN);
|
||||
}
|
||||
|
||||
// Populates 1000 bytes (a screen) with values representing the angle to the center.
|
||||
// The actual value stored is distance*2 to increase precision
|
||||
void init_angle_screen(byte* screen) {
|
||||
for(signed byte y: -12..12) {
|
||||
for(signed byte x: -19..20) {
|
||||
signed word xw = (signed word)(word){ (byte)x, 0 };
|
||||
signed word yw = (signed word)(word){ (byte)y, 0 };
|
||||
word angle_w = atan2_16(xw, yw);
|
||||
byte ang_w = >(angle_w+0x0080);
|
||||
*screen++ = ang_w;
|
||||
}
|
||||
}
|
||||
}
|
370
src/test/ref/screen-center-angle.asm
Normal file
370
src/test/ref/screen-center-angle.asm
Normal file
@ -0,0 +1,370 @@
|
||||
// Calculate the angle to the center of the screen - and show it using font-hex
|
||||
// 4.65 million cycles
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.label D018 = $d018
|
||||
// The number of iterations performed during 16-bit CORDIC atan2 calculation
|
||||
.const CORDIC_ITERATIONS_16 = $f
|
||||
// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ...
|
||||
.label CORDIC_ATAN2_ANGLES_16 = $1000
|
||||
// The number of iterations performed during 8-bit CORDIC atan2 calculation
|
||||
.const CORDIC_ITERATIONS_8 = 8
|
||||
// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ...
|
||||
.label CORDIC_ATAN2_ANGLES_8 = $1100
|
||||
.label CHARSET = $2000
|
||||
.label SCREEN = $2800
|
||||
// Populate cordic angles table
|
||||
// Populate cordic angles table
|
||||
main: {
|
||||
.const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f
|
||||
jsr init_font_hex
|
||||
lda #toD0181_return
|
||||
sta D018
|
||||
jsr init_angle_screen
|
||||
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: {
|
||||
.label _7 = $c
|
||||
.label xw = $17
|
||||
.label yw = $19
|
||||
.label angle_w = $c
|
||||
.label screen = 3
|
||||
.label y = 2
|
||||
lda #<SCREEN
|
||||
sta screen
|
||||
lda #>SCREEN
|
||||
sta screen+1
|
||||
lda #-$c
|
||||
sta y
|
||||
b1:
|
||||
ldx #-$13
|
||||
b2:
|
||||
ldy #0
|
||||
txa
|
||||
sta xw+1
|
||||
sty xw
|
||||
lda y
|
||||
sta yw+1
|
||||
sty yw
|
||||
jsr atan2_16
|
||||
lda #$80
|
||||
clc
|
||||
adc _7
|
||||
sta _7
|
||||
bcc !+
|
||||
inc _7+1
|
||||
!:
|
||||
lda _7+1
|
||||
ldy #0
|
||||
sta (screen),y
|
||||
inc screen
|
||||
bne !+
|
||||
inc screen+1
|
||||
!:
|
||||
inx
|
||||
cpx #$15
|
||||
bne b2
|
||||
inc y
|
||||
lda #$d
|
||||
cmp y
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
|
||||
// Finding the angle requires a binary search using CORDIC_ITERATIONS_16
|
||||
// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI)
|
||||
// atan2_16(signed word zeropage($17) x, signed word zeropage($19) y)
|
||||
atan2_16: {
|
||||
.label _2 = 5
|
||||
.label _7 = 9
|
||||
.label yi = 5
|
||||
.label xi = 9
|
||||
.label xd = $1b
|
||||
.label yd = $1d
|
||||
.label angle = $c
|
||||
.label i = $b
|
||||
.label return = $c
|
||||
.label x = $17
|
||||
.label y = $19
|
||||
lda y+1
|
||||
bne !+
|
||||
lda y
|
||||
beq !e+
|
||||
lsr
|
||||
!:
|
||||
bmi !b1+
|
||||
jmp b1
|
||||
!b1:
|
||||
!e:
|
||||
sec
|
||||
lda #0
|
||||
sbc y
|
||||
sta _2
|
||||
lda #0
|
||||
sbc y+1
|
||||
sta _2+1
|
||||
b3:
|
||||
lda x+1
|
||||
bne !+
|
||||
lda x
|
||||
beq !e+
|
||||
lsr
|
||||
!:
|
||||
bmi !b4+
|
||||
jmp b4
|
||||
!b4:
|
||||
!e:
|
||||
sec
|
||||
lda #0
|
||||
sbc x
|
||||
sta _7
|
||||
lda #0
|
||||
sbc x+1
|
||||
sta _7+1
|
||||
b6:
|
||||
lda #0
|
||||
sta angle
|
||||
sta angle+1
|
||||
sta i
|
||||
b10:
|
||||
lda yi+1
|
||||
bne b11
|
||||
lda yi
|
||||
bne b11
|
||||
b12:
|
||||
lsr angle+1
|
||||
ror angle
|
||||
lda x+1
|
||||
bpl b7
|
||||
sec
|
||||
lda #<$8000
|
||||
sbc angle
|
||||
sta angle
|
||||
lda #>$8000
|
||||
sbc angle+1
|
||||
sta angle+1
|
||||
b7:
|
||||
lda y+1
|
||||
bpl b8
|
||||
sec
|
||||
lda #0
|
||||
sbc angle
|
||||
sta angle
|
||||
lda #0
|
||||
sbc angle+1
|
||||
sta angle+1
|
||||
b8:
|
||||
rts
|
||||
b11:
|
||||
ldy i
|
||||
lda xi
|
||||
sta xd
|
||||
lda xi+1
|
||||
sta xd+1
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
lda xd+1
|
||||
cmp #$80
|
||||
ror xd+1
|
||||
ror xd
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
ldy i
|
||||
lda yi
|
||||
sta yd
|
||||
lda yi+1
|
||||
sta yd+1
|
||||
cpy #0
|
||||
beq !e+
|
||||
!:
|
||||
lda yd+1
|
||||
cmp #$80
|
||||
ror yd+1
|
||||
ror yd
|
||||
dey
|
||||
bne !-
|
||||
!e:
|
||||
lda yi+1
|
||||
bne !+
|
||||
lda yi
|
||||
beq !e+
|
||||
lsr
|
||||
!:
|
||||
bpl b13
|
||||
!e:
|
||||
lda xi
|
||||
sec
|
||||
sbc yd
|
||||
sta xi
|
||||
lda xi+1
|
||||
sbc yd+1
|
||||
sta xi+1
|
||||
lda yi
|
||||
clc
|
||||
adc xd
|
||||
sta yi
|
||||
lda yi+1
|
||||
adc xd+1
|
||||
sta yi+1
|
||||
lda i
|
||||
asl
|
||||
tay
|
||||
sec
|
||||
lda angle
|
||||
sbc CORDIC_ATAN2_ANGLES_16,y
|
||||
sta angle
|
||||
lda angle+1
|
||||
sbc CORDIC_ATAN2_ANGLES_16+1,y
|
||||
sta angle+1
|
||||
b14:
|
||||
inc i
|
||||
lda #CORDIC_ITERATIONS_16-1+1
|
||||
cmp i
|
||||
bne !b12+
|
||||
jmp b12
|
||||
!b12:
|
||||
jmp b10
|
||||
b13:
|
||||
lda xi
|
||||
clc
|
||||
adc yd
|
||||
sta xi
|
||||
lda xi+1
|
||||
adc yd+1
|
||||
sta xi+1
|
||||
lda yi
|
||||
sec
|
||||
sbc xd
|
||||
sta yi
|
||||
lda yi+1
|
||||
sbc xd+1
|
||||
sta yi+1
|
||||
lda i
|
||||
asl
|
||||
tay
|
||||
clc
|
||||
lda angle
|
||||
adc CORDIC_ATAN2_ANGLES_16,y
|
||||
sta angle
|
||||
lda angle+1
|
||||
adc CORDIC_ATAN2_ANGLES_16+1,y
|
||||
sta angle+1
|
||||
jmp b14
|
||||
b4:
|
||||
lda x
|
||||
sta xi
|
||||
lda x+1
|
||||
sta xi+1
|
||||
jmp b6
|
||||
b1:
|
||||
lda y
|
||||
sta yi
|
||||
lda y+1
|
||||
sta yi+1
|
||||
jmp b3
|
||||
}
|
||||
// Make charset from proto chars
|
||||
// init_font_hex(byte* zeropage($11) charset)
|
||||
init_font_hex: {
|
||||
.label _0 = $1f
|
||||
.label idx = $16
|
||||
.label proto_lo = $13
|
||||
.label charset = $11
|
||||
.label c1 = $15
|
||||
.label proto_hi = $e
|
||||
.label c = $10
|
||||
lda #0
|
||||
sta c
|
||||
lda #<FONT_HEX_PROTO
|
||||
sta proto_hi
|
||||
lda #>FONT_HEX_PROTO
|
||||
sta proto_hi+1
|
||||
lda #<CHARSET
|
||||
sta charset
|
||||
lda #>CHARSET
|
||||
sta charset+1
|
||||
b1:
|
||||
lda #0
|
||||
sta c1
|
||||
lda #<FONT_HEX_PROTO
|
||||
sta proto_lo
|
||||
lda #>FONT_HEX_PROTO
|
||||
sta proto_lo+1
|
||||
b2:
|
||||
lda #0
|
||||
tay
|
||||
sta (charset),y
|
||||
lda #1
|
||||
sta idx
|
||||
ldx #0
|
||||
b3:
|
||||
txa
|
||||
tay
|
||||
lda (proto_hi),y
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta _0
|
||||
txa
|
||||
tay
|
||||
lda (proto_lo),y
|
||||
asl
|
||||
ora _0
|
||||
ldy idx
|
||||
sta (charset),y
|
||||
inc idx
|
||||
inx
|
||||
cpx #5
|
||||
bne b3
|
||||
lda #0
|
||||
ldy idx
|
||||
sta (charset),y
|
||||
iny
|
||||
sta (charset),y
|
||||
lda #5
|
||||
clc
|
||||
adc proto_lo
|
||||
sta proto_lo
|
||||
bcc !+
|
||||
inc proto_lo+1
|
||||
!:
|
||||
lda #8
|
||||
clc
|
||||
adc charset
|
||||
sta charset
|
||||
bcc !+
|
||||
inc charset+1
|
||||
!:
|
||||
inc c1
|
||||
lda #$10
|
||||
cmp c1
|
||||
bne b2
|
||||
lda #5
|
||||
clc
|
||||
adc proto_hi
|
||||
sta proto_hi
|
||||
bcc !+
|
||||
inc proto_hi+1
|
||||
!:
|
||||
inc c
|
||||
lda #$10
|
||||
cmp c
|
||||
bne b1
|
||||
rts
|
||||
}
|
||||
// Bit patterns for symbols 0-f (3x5 pixels) used in font hex
|
||||
FONT_HEX_PROTO: .byte 2, 5, 5, 5, 2, 6, 2, 2, 2, 7, 6, 1, 2, 4, 7, 6, 1, 2, 1, 6, 5, 5, 7, 1, 1, 7, 4, 6, 1, 6, 3, 4, 6, 5, 2, 7, 1, 1, 1, 1, 2, 5, 2, 5, 2, 2, 5, 3, 1, 1, 2, 5, 7, 5, 5, 6, 5, 6, 5, 6, 2, 5, 4, 5, 2, 6, 5, 5, 5, 6, 7, 4, 6, 4, 7, 7, 4, 6, 4, 4
|
||||
.pc = CORDIC_ATAN2_ANGLES_16 "CORDIC_ATAN2_ANGLES_16"
|
||||
.for (var i=0; i<CORDIC_ITERATIONS_16; i++)
|
||||
.word 256*2*256*atan(1/pow(2,i))/PI/2
|
||||
|
||||
.pc = CORDIC_ATAN2_ANGLES_8 "CORDIC_ATAN2_ANGLES_8"
|
||||
.fill CORDIC_ITERATIONS_8, 2*256*atan(1/pow(2,i))/PI/2
|
||||
|
181
src/test/ref/screen-center-angle.cfg
Normal file
181
src/test/ref/screen-center-angle.cfg
Normal file
@ -0,0 +1,181 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi()
|
||||
to:@1
|
||||
@1: scope:[] from @begin
|
||||
kickasm(location (const word*) CORDIC_ATAN2_ANGLES_16#0 uses CORDIC_ITERATIONS_16#0) {{ .for (var i=0; i<CORDIC_ITERATIONS_16; i++)
|
||||
.word 256*2*256*atan(1/pow(2,i))/PI/2
|
||||
}}
|
||||
to:@2
|
||||
@2: scope:[] from @1
|
||||
kickasm(location (const byte*) CORDIC_ATAN2_ANGLES_8#0 uses CORDIC_ITERATIONS_8#0) {{ .fill CORDIC_ITERATIONS_8, 2*256*atan(1/pow(2,i))/PI/2
|
||||
}}
|
||||
to:@3
|
||||
@3: scope:[] from @2
|
||||
[3] phi()
|
||||
[4] call main
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
[5] phi()
|
||||
main: scope:[main] from @3
|
||||
[6] phi()
|
||||
[7] call init_font_hex
|
||||
to:main::toD0181
|
||||
main::toD0181: scope:[main] from main
|
||||
[8] phi()
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main::toD0181
|
||||
[9] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0
|
||||
[10] call init_angle_screen
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@1
|
||||
[11] return
|
||||
to:@return
|
||||
init_angle_screen: scope:[init_angle_screen] from main::@1
|
||||
[12] phi()
|
||||
to:init_angle_screen::@1
|
||||
init_angle_screen::@1: scope:[init_angle_screen] from init_angle_screen init_angle_screen::@3
|
||||
[13] (byte*) init_angle_screen::screen#4 ← phi( init_angle_screen/(const byte*) SCREEN#0 init_angle_screen::@3/(byte*) init_angle_screen::screen#1 )
|
||||
[13] (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
|
||||
[14] (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 )
|
||||
[14] (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 )
|
||||
[15] (word) init_angle_screen::xw#0 ← (byte)(signed byte) init_angle_screen::x#2 w= (byte) 0
|
||||
[16] (word) init_angle_screen::yw#0 ← (byte)(signed byte) init_angle_screen::y#4 w= (byte) 0
|
||||
[17] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0
|
||||
[18] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0
|
||||
[19] call atan2_16
|
||||
[20] (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
|
||||
[21] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2
|
||||
[22] (word~) init_angle_screen::$7 ← (word) init_angle_screen::angle_w#0 + (byte) $80
|
||||
[23] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$7
|
||||
[24] *((byte*) init_angle_screen::screen#2) ← (byte) init_angle_screen::ang_w#0
|
||||
[25] (byte*) init_angle_screen::screen#1 ← ++ (byte*) init_angle_screen::screen#2
|
||||
[26] (signed byte) init_angle_screen::x#1 ← ++ (signed byte) init_angle_screen::x#2
|
||||
[27] 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
|
||||
[28] (signed byte) init_angle_screen::y#1 ← ++ (signed byte) init_angle_screen::y#4
|
||||
[29] 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
|
||||
[30] return
|
||||
to:@return
|
||||
atan2_16: scope:[atan2_16] from init_angle_screen::@2
|
||||
[31] 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
|
||||
[32] (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
|
||||
[33] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word~) atan2_16::yi#11 atan2_16::@2/(signed word~) atan2_16::$2 )
|
||||
[34] 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
|
||||
[35] (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
|
||||
[36] (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
|
||||
[37] (word) atan2_16::angle#12 ← phi( atan2_16::@14/(word) atan2_16::angle#13 atan2_16::@6/(byte) 0 )
|
||||
[37] (byte) atan2_16::i#2 ← phi( atan2_16::@14/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 )
|
||||
[37] (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 )
|
||||
[37] (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 )
|
||||
[38] 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
|
||||
[39] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@14/(word) atan2_16::angle#13 )
|
||||
[40] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1
|
||||
[41] 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
|
||||
[42] (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
|
||||
[43] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@16/(word) atan2_16::angle#4 )
|
||||
[44] 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
|
||||
[45] (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
|
||||
[46] (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
|
||||
[47] return
|
||||
to:@return
|
||||
atan2_16::@11: scope:[atan2_16] from atan2_16::@10
|
||||
[48] (signed word) atan2_16::xd#0 ← (signed word) atan2_16::xi#3 >> (byte) atan2_16::i#2
|
||||
[49] (signed word) atan2_16::yd#0 ← (signed word) atan2_16::yi#3 >> (byte) atan2_16::i#2
|
||||
[50] 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
|
||||
[51] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#0
|
||||
[52] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#0
|
||||
[53] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1
|
||||
[54] (word) atan2_16::angle#3 ← (word) atan2_16::angle#12 - *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$24)
|
||||
to:atan2_16::@14
|
||||
atan2_16::@14: scope:[atan2_16] from atan2_16::@13 atan2_16::@15
|
||||
[55] (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 )
|
||||
[55] (word) atan2_16::angle#13 ← phi( atan2_16::@13/(word) atan2_16::angle#2 atan2_16::@15/(word) atan2_16::angle#3 )
|
||||
[55] (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 )
|
||||
[56] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2
|
||||
[57] 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
|
||||
[58] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#0
|
||||
[59] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#0
|
||||
[60] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1
|
||||
[61] (word) atan2_16::angle#2 ← (word) atan2_16::angle#12 + *((const word*) CORDIC_ATAN2_ANGLES_16#0 + (byte~) atan2_16::$23)
|
||||
to:atan2_16::@14
|
||||
atan2_16::@4: scope:[atan2_16] from atan2_16::@3
|
||||
[62] (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
|
||||
[63] (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
|
||||
[64] phi()
|
||||
to:init_font_hex::@1
|
||||
init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5
|
||||
[65] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 )
|
||||
[65] (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 )
|
||||
[65] (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
|
||||
[66] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 )
|
||||
[66] (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 )
|
||||
[66] (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 )
|
||||
[67] *((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
|
||||
[68] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 )
|
||||
[68] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 )
|
||||
[69] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4
|
||||
[70] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1
|
||||
[71] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1
|
||||
[72] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2
|
||||
[73] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5
|
||||
[74] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2
|
||||
[75] 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
|
||||
[76] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0
|
||||
[77] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2
|
||||
[78] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0
|
||||
[79] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5
|
||||
[80] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8
|
||||
[81] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4
|
||||
[82] 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
|
||||
[83] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5
|
||||
[84] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6
|
||||
[85] 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
|
||||
[86] return
|
||||
to:@return
|
4030
src/test/ref/screen-center-angle.log
Normal file
4030
src/test/ref/screen-center-angle.log
Normal file
File diff suppressed because it is too large
Load Diff
182
src/test/ref/screen-center-angle.sym
Normal file
182
src/test/ref/screen-center-angle.sym
Normal file
@ -0,0 +1,182 @@
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @3
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) CHARSET
|
||||
(const byte*) CHARSET#0 CHARSET = (byte*) 8192
|
||||
(word*) CORDIC_ATAN2_ANGLES_16
|
||||
(const word*) CORDIC_ATAN2_ANGLES_16#0 CORDIC_ATAN2_ANGLES_16 = (word*) 4096
|
||||
(byte*) CORDIC_ATAN2_ANGLES_8
|
||||
(const byte*) CORDIC_ATAN2_ANGLES_8#0 CORDIC_ATAN2_ANGLES_8 = (byte*) 4352
|
||||
(byte) CORDIC_ITERATIONS_16
|
||||
(const byte) CORDIC_ITERATIONS_16#0 CORDIC_ITERATIONS_16 = (byte) $f
|
||||
(byte) CORDIC_ITERATIONS_8
|
||||
(const byte) CORDIC_ITERATIONS_8#0 CORDIC_ITERATIONS_8 = (byte) 8
|
||||
(byte*) D018
|
||||
(const byte*) D018#0 D018 = (byte*) 53272
|
||||
(byte[]) FONT_HEX_PROTO
|
||||
(const byte[]) FONT_HEX_PROTO#0 FONT_HEX_PROTO = { (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 }
|
||||
(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
|
||||
(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:9 4.0
|
||||
(label) atan2_16::@1
|
||||
(label) atan2_16::@10
|
||||
(label) atan2_16::@11
|
||||
(label) atan2_16::@12
|
||||
(label) atan2_16::@13
|
||||
(label) atan2_16::@14
|
||||
(label) atan2_16::@15
|
||||
(label) atan2_16::@16
|
||||
(label) atan2_16::@2
|
||||
(label) atan2_16::@3
|
||||
(label) atan2_16::@4
|
||||
(label) atan2_16::@5
|
||||
(label) atan2_16::@6
|
||||
(label) atan2_16::@7
|
||||
(label) atan2_16::@8
|
||||
(label) atan2_16::@9
|
||||
(label) atan2_16::@return
|
||||
(word) atan2_16::angle
|
||||
(word) atan2_16::angle#1 angle zp ZP_WORD:12 3.0
|
||||
(word) atan2_16::angle#11 angle zp ZP_WORD:12 4.0
|
||||
(word) atan2_16::angle#12 angle zp ZP_WORD:12 364.0
|
||||
(word) atan2_16::angle#13 angle zp ZP_WORD:12 1334.6666666666667
|
||||
(word) atan2_16::angle#2 angle zp ZP_WORD:12 2002.0
|
||||
(word) atan2_16::angle#3 angle zp ZP_WORD:12 2002.0
|
||||
(word) atan2_16::angle#4 angle zp ZP_WORD:12 4.0
|
||||
(word) atan2_16::angle#5 angle zp ZP_WORD:12 4.0
|
||||
(word) atan2_16::angle#6 angle zp ZP_WORD:12 2004.0
|
||||
(byte) atan2_16::i
|
||||
(byte) atan2_16::i#1 i zp ZP_BYTE:11 1501.5
|
||||
(byte) atan2_16::i#2 i zp ZP_BYTE:11 429.0
|
||||
(word) atan2_16::return
|
||||
(word) atan2_16::return#0 return zp ZP_WORD:12 34.99999999999999
|
||||
(word) atan2_16::return#2 return zp ZP_WORD:12 202.0
|
||||
(signed word) atan2_16::x
|
||||
(signed word) atan2_16::x#0 x zp ZP_WORD:23 3.8928571428571437
|
||||
(signed word) atan2_16::xd
|
||||
(signed word) atan2_16::xd#0 xd zp ZP_WORD:27 600.5999999999999
|
||||
(signed word) atan2_16::xi
|
||||
(signed word) atan2_16::xi#0 xi zp ZP_WORD:9 6.0
|
||||
(signed word) atan2_16::xi#1 xi zp ZP_WORD:9 500.5
|
||||
(signed word) atan2_16::xi#2 xi zp ZP_WORD:9 500.5
|
||||
(signed word) atan2_16::xi#3 xi zp ZP_WORD:9 801.2
|
||||
(signed word) atan2_16::xi#7 xi zp ZP_WORD:9 1001.0
|
||||
(signed word~) atan2_16::xi#8 xi zp ZP_WORD:9 4.0
|
||||
(signed word) atan2_16::y
|
||||
(signed word) atan2_16::y#0 y zp ZP_WORD:25 3.633333333333334
|
||||
(signed word) atan2_16::yd
|
||||
(signed word) atan2_16::yd#0 yd zp ZP_WORD:29 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
|
||||
(void()) init_angle_screen((byte*) init_angle_screen::screen)
|
||||
(word~) init_angle_screen::$7 $7 zp ZP_WORD:12 202.0
|
||||
(label) init_angle_screen::@1
|
||||
(label) init_angle_screen::@2
|
||||
(label) init_angle_screen::@3
|
||||
(label) init_angle_screen::@4
|
||||
(label) init_angle_screen::@return
|
||||
(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:12 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
|
||||
(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:23 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 word) init_angle_screen::yw
|
||||
(word) init_angle_screen::yw#0 yw zp ZP_WORD:25 50.5
|
||||
(void()) init_font_hex((byte*) init_font_hex::charset)
|
||||
(byte~) init_font_hex::$0 $0 zp ZP_BYTE:31 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
|
||||
(label) init_font_hex::@2
|
||||
(label) init_font_hex::@3
|
||||
(label) init_font_hex::@4
|
||||
(label) init_font_hex::@5
|
||||
(label) init_font_hex::@return
|
||||
(byte) init_font_hex::c
|
||||
(byte) init_font_hex::c#1 c zp ZP_BYTE:16 16.5
|
||||
(byte) init_font_hex::c#6 c zp ZP_BYTE:16 1.1578947368421053
|
||||
(byte) init_font_hex::c1
|
||||
(byte) init_font_hex::c1#1 c1 zp ZP_BYTE:21 151.5
|
||||
(byte) init_font_hex::c1#4 c1 zp ZP_BYTE:21 13.466666666666667
|
||||
(byte*) init_font_hex::charset
|
||||
(byte*) init_font_hex::charset#0 charset zp ZP_WORD:17 35.5
|
||||
(byte*) init_font_hex::charset#2 charset zp ZP_WORD:17 108.35714285714285
|
||||
(byte*) init_font_hex::charset#5 charset zp ZP_WORD:17 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:22 551.0
|
||||
(byte) init_font_hex::idx#3 reg byte y 202.0
|
||||
(byte) init_font_hex::idx#5 idx zp ZP_BYTE:22 600.5999999999999
|
||||
(byte*) init_font_hex::proto_hi
|
||||
(byte*) init_font_hex::proto_hi#1 proto_hi zp ZP_WORD:14 7.333333333333333
|
||||
(byte*) init_font_hex::proto_hi#6 proto_hi zp ZP_WORD:14 56.83333333333334
|
||||
(byte*) init_font_hex::proto_lo
|
||||
(byte*) init_font_hex::proto_lo#1 proto_lo zp ZP_WORD:19 50.5
|
||||
(byte*) init_font_hex::proto_lo#4 proto_lo zp ZP_WORD:19 92.53846153846155
|
||||
(void()) main()
|
||||
(label) main::@1
|
||||
(label) main::@return
|
||||
(label) main::toD0181
|
||||
(word~) main::toD0181_$0
|
||||
(number~) main::toD0181_$1
|
||||
(number~) main::toD0181_$2
|
||||
(number~) main::toD0181_$3
|
||||
(word~) main::toD0181_$4
|
||||
(byte~) main::toD0181_$5
|
||||
(number~) main::toD0181_$6
|
||||
(number~) main::toD0181_$7
|
||||
(number~) main::toD0181_$8
|
||||
(byte*) main::toD0181_gfx
|
||||
(byte) main::toD0181_return
|
||||
(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
|
||||
|
||||
zp ZP_BYTE:2 [ 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:9 [ atan2_16::xi#3 atan2_16::xi#7 atan2_16::xi#0 atan2_16::xi#8 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ]
|
||||
zp ZP_BYTE:11 [ atan2_16::i#2 atan2_16::i#1 ]
|
||||
zp ZP_WORD:12 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_angle_screen::angle_w#0 init_angle_screen::$7 ]
|
||||
zp ZP_WORD:14 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ]
|
||||
zp ZP_BYTE:16 [ init_font_hex::c#6 init_font_hex::c#1 ]
|
||||
zp ZP_WORD:17 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ]
|
||||
zp ZP_WORD:19 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ]
|
||||
zp ZP_BYTE:21 [ init_font_hex::c1#4 init_font_hex::c1#1 ]
|
||||
reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ]
|
||||
zp ZP_BYTE:22 [ init_font_hex::idx#5 init_font_hex::idx#2 ]
|
||||
zp ZP_WORD:23 [ init_angle_screen::xw#0 atan2_16::x#0 ]
|
||||
zp ZP_WORD:25 [ init_angle_screen::yw#0 atan2_16::y#0 ]
|
||||
reg byte a [ init_angle_screen::ang_w#0 ]
|
||||
zp ZP_WORD:27 [ atan2_16::xd#0 ]
|
||||
zp ZP_WORD:29 [ atan2_16::yd#0 ]
|
||||
reg byte a [ atan2_16::$24 ]
|
||||
reg byte a [ atan2_16::$23 ]
|
||||
zp ZP_BYTE:31 [ init_font_hex::$0 ]
|
||||
reg byte a [ init_font_hex::$1 ]
|
||||
reg byte a [ init_font_hex::$2 ]
|
||||
reg byte y [ init_font_hex::idx#3 ]
|
Loading…
x
Reference in New Issue
Block a user