1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-20 02:32:36 +00:00

Now works in 4 quadrants.

This commit is contained in:
Jesper Gravgaard 2019-06-28 09:34:02 +02:00
parent c3cff0dff1
commit 13652f61f2
5 changed files with 3419 additions and 993 deletions

View File

@ -1,16 +1,27 @@
// Find atan2(x, y) using the CORDIC method
// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf
import "font-hex"
import "c64"
const byte* CHARSET = 0x2000;
const byte* SCREEN = 0x2800;
void main() {
byte* screen = 0x0400;
for(signed byte y: 0..24) {
for(signed byte x: 0..39) {
init_font_hex(CHARSET);
*D018 = toD018(SCREEN, CHARSET);
byte* screen = SCREEN;
for(signed byte y: -12..12) {
for(signed byte x: -19..20) {
byte angle = atan2(x, y);
screen[x] = angle;
*screen++ = angle;
}
screen+=40;
}
byte* col00 = COLS+12*40+19;
while(true) (*col00)++;
}
// The number of iterations performed during CORDIC atan2 calculation
@ -21,32 +32,36 @@ byte* CORDIC_ATAN2_ANGLES = 0x1000;
// Populate cordic angles table
kickasm(pc CORDIC_ATAN2_ANGLES) {{
.fill CORDIC_ITERATIONS, 256*atan(1/pow(2,i))/PI/2
.fill CORDIC_ITERATIONS, 2*256*atan(1/pow(2,i))/PI/2
}}
// 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
// Returns the angle in hex-degrees (0=0, 128=PI, 256=2*PI)
byte atan2(signed byte x, signed byte y) {
signed byte yi = (y>0)?y:-y;
signed byte xi = (x>0)?x:-x;
byte angle = 0;
for( byte i: 0..CORDIC_ITERATIONS) {
if(y==0) {
if(yi==0) {
// We found the correct angle!
break;
}
signed byte xd = x>>i;
signed byte yd = y>>i;
if(y>0) {
x += yd;
y -= xd;
signed byte xd = xi>>i;
signed byte yd = yi>>i;
if(yi>0) {
xi += yd;
yi -= xd;
angle += CORDIC_ATAN2_ANGLES[i];
} else {
x -= yd;
y += xd;
xi -= yd;
yi += xd;
angle -= CORDIC_ATAN2_ANGLES[i];
}
}
angle /=2;
if(x<0) angle = 128-angle;
if(y<0) angle = -angle;
// Iterations complete - return estimated angle
return angle;
}

View File

@ -3,69 +3,126 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label D018 = $d018
// Color Ram
.label COLS = $d800
.label CHARSET = $2000
.label SCREEN = $2800
// The number of iterations performed during CORDIC atan2 calculation
.const CORDIC_ITERATIONS = 8
// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ...
.label CORDIC_ATAN2_ANGLES = $1000
// Populate cordic angles table
main: {
.label x = 5
.label screen = 3
.const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f
.label screen = 4
.label x = 3
.label y = 2
lda #<$400
jsr init_font_hex
lda #toD0181_return
sta D018
lda #<SCREEN
sta screen
lda #>$400
lda #>SCREEN
sta screen+1
lda #0
lda #-$c
sta y
b1:
lda #0
lda #-$13
sta x
b2:
lda x
sta atan2.x
lda y
sta atan2.y
jsr atan2
txa
ldy x
ldy #0
sta (screen),y
inc x
lda #$28
cmp x
bne b2
clc
adc screen
sta screen
bcc !+
inc screen
bne !+
inc screen+1
!:
inc x
lda #$15
cmp x
bne b2
inc y
lda #$19
lda #$d
cmp y
bne b1
rts
b4:
lda COLS+$c*$28+$13
clc
adc #1
sta COLS+$c*$28+$13
jmp b4
}
// 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
// Returns the angle in hex-degrees (0=0, 128=PI, 256=2*PI)
// atan2(signed byte zeropage(7) x, signed byte zeropage(6) y)
// atan2(signed byte zeropage(3) x, signed byte zeropage(2) y)
atan2: {
.label x = 7
.label y = 6
.label xd = 9
.label i = 8
ldx #0
txa
sta i
b1:
.label _7 = 6
.label x = 3
.label y = 2
.label xi = 6
.label xd = $12
.label angle = 8
.label i = 7
lda y
cmp #0
bne b2
beq !+
bmi !b1+
jmp b1
!b1:
!:
lda y
eor #$ff
clc
adc #1
tax
b3:
rts
b2:
lda x
cmp #0
beq !+
bmi !b4+
jmp b4
!b4:
!:
lda x
eor #$ff
clc
adc #1
sta _7
b6:
lda #0
sta angle
sta i
b10:
txa
cmp #0
bne b11
b12:
lda angle
lsr
tax
lda x
cmp #0
bpl b7
txa
eor #$ff
clc
adc #$80+1
tax
b7:
lda y
cmp #0
bpl b8
dex
txa
eor #$ff
tax
b8:
rts
b11:
lda xi
ldy i
cpy #0
beq !e+
@ -76,8 +133,8 @@ atan2: {
bne !l-
!e:
sta xd
lda y
ldy i
txa
cpy #0
beq !e+
!l:
@ -87,47 +144,146 @@ atan2: {
bne !l-
!e:
tay
lda y
txa
cmp #0
beq !+
bpl b4
bpl b13
!:
tya
eor #$ff
sec
adc x
sta x
lda y
adc xi
sta xi
txa
clc
adc xd
sta y
txa
ldx i
sec
sbc CORDIC_ATAN2_ANGLES,x
tax
b5:
lda angle
ldy i
sec
sbc CORDIC_ATAN2_ANGLES,y
sta angle
b14:
inc i
lda #CORDIC_ITERATIONS+1
cmp i
beq b3
jmp b1
b4:
beq b12
jmp b10
b13:
tya
clc
adc x
sta x
lda y
adc xi
sta xi
txa
sec
sbc xd
sta y
txa
ldx i
clc
adc CORDIC_ATAN2_ANGLES,x
tax
jmp b5
lda angle
ldy i
clc
adc CORDIC_ATAN2_ANGLES,y
sta angle
jmp b14
b4:
lda x
sta xi
jmp b6
b1:
ldx y
jmp b3
}
// Make charset from proto chars
// init_font_hex(byte* zeropage($c) charset)
init_font_hex: {
.label _0 = $13
.label idx = $11
.label proto_lo = $e
.label charset = $c
.label c1 = $10
.label proto_hi = 9
.label c = $b
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 "CORDIC_ATAN2_ANGLES"
.fill CORDIC_ITERATIONS, 256*atan(1/pow(2,i))/PI/2
.fill CORDIC_ITERATIONS, 2*256*atan(1/pow(2,i))/PI/2

View File

@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
kickasm(location (const byte*) CORDIC_ATAN2_ANGLES#0) {{ .fill CORDIC_ITERATIONS, 256*atan(1/pow(2,i))/PI/2
kickasm(location (const byte*) CORDIC_ATAN2_ANGLES#0) {{ .fill CORDIC_ITERATIONS, 2*256*atan(1/pow(2,i))/PI/2
}}
to:@2
@2: scope:[] from @1
@ -13,67 +13,151 @@
[4] phi()
main: scope:[main] from @2
[5] phi()
[6] call init_font_hex
to:main::toD0181
main::toD0181: scope:[main] from main
[7] phi()
to:main::@5
main::@5: scope:[main] from main::toD0181
[8] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0
to:main::@1
main::@1: scope:[main] from main main::@3
[6] (byte*) main::screen#5 ← phi( main/(byte*) 1024 main::@3/(byte*) main::screen#1 )
[6] (signed byte) main::y#4 ← phi( main/(signed byte) 0 main::@3/(signed byte) main::y#1 )
main::@1: scope:[main] from main::@3 main::@5
[9] (byte*) main::screen#4 ← phi( main::@5/(const byte*) SCREEN#0 main::@3/(byte*) main::screen#1 )
[9] (signed byte) main::y#4 ← phi( main::@5/(signed byte) -$c main::@3/(signed byte) main::y#1 )
to:main::@2
main::@2: scope:[main] from main::@1 main::@4
[7] (signed byte) main::x#2 ← phi( main::@1/(signed byte) 0 main::@4/(signed byte) main::x#1 )
[8] (signed byte) atan2::x#0 ← (signed byte) main::x#2
[9] (signed byte) atan2::y#0 ← (signed byte) main::y#4
[10] call atan2
[11] (byte) atan2::return#0 ← (byte) atan2::return#1
to:main::@4
main::@4: scope:[main] from main::@2
[12] (byte) main::angle#0 ← (byte) atan2::return#0
[13] *((byte*) main::screen#5 + (signed byte) main::x#2) ← (byte) main::angle#0
[14] (signed byte) main::x#1 ← ++ (signed byte) main::x#2
[15] if((signed byte) main::x#1!=(signed byte) $28) goto main::@2
main::@2: scope:[main] from main::@1 main::@6
[10] (byte*) main::screen#2 ← phi( main::@1/(byte*) main::screen#4 main::@6/(byte*) main::screen#1 )
[10] (signed byte) main::x#2 ← phi( main::@1/(signed byte) -$13 main::@6/(signed byte) main::x#1 )
[11] (signed byte) atan2::x#0 ← (signed byte) main::x#2
[12] (signed byte) atan2::y#0 ← (signed byte) main::y#4
[13] call atan2
[14] (byte) atan2::return#0 ← (byte) atan2::return#1
to:main::@6
main::@6: scope:[main] from main::@2
[15] (byte) main::angle#0 ← (byte) atan2::return#0
[16] *((byte*) main::screen#2) ← (byte) main::angle#0
[17] (byte*) main::screen#1 ← ++ (byte*) main::screen#2
[18] (signed byte) main::x#1 ← ++ (signed byte) main::x#2
[19] if((signed byte) main::x#1!=(signed byte) $15) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@4
[16] (byte*) main::screen#1 ← (byte*) main::screen#5 + (byte) $28
[17] (signed byte) main::y#1 ← ++ (signed byte) main::y#4
[18] if((signed byte) main::y#1!=(signed byte) $19) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[19] return
to:@return
main::@3: scope:[main] from main::@6
[20] (signed byte) main::y#1 ← ++ (signed byte) main::y#4
[21] if((signed byte) main::y#1!=(signed byte) $d) goto main::@1
to:main::@4
main::@4: scope:[main] from main::@3 main::@4
[22] *((const byte*) COLS#0+(word)(number) $c*(number) $28+(byte) $13) ← ++ *((const byte*) COLS#0+(word)(number) $c*(number) $28+(byte) $13)
to:main::@4
atan2: scope:[atan2] from main::@2
[20] phi()
to:atan2::@1
atan2::@1: scope:[atan2] from atan2 atan2::@5
[21] (byte) atan2::angle#4 ← phi( atan2/(byte) 0 atan2::@5/(byte) atan2::angle#7 )
[21] (byte) atan2::i#2 ← phi( atan2/(byte) 0 atan2::@5/(byte) atan2::i#1 )
[21] (signed byte) atan2::x#3 ← phi( atan2/(signed byte) atan2::x#0 atan2::@5/(signed byte) atan2::x#8 )
[21] (signed byte) atan2::y#3 ← phi( atan2/(signed byte) atan2::y#0 atan2::@5/(signed byte) atan2::y#8 )
[22] if((signed byte) atan2::y#3!=(signed byte) 0) goto atan2::@2
[23] if((signed byte) atan2::y#0>(signed byte) 0) goto atan2::@1
to:atan2::@2
atan2::@2: scope:[atan2] from atan2
[24] (signed byte~) atan2::$2 ← - (signed byte) atan2::y#0
to:atan2::@3
atan2::@3: scope:[atan2] from atan2::@1 atan2::@5
[23] (byte) atan2::return#1 ← phi( atan2::@1/(byte) atan2::angle#4 atan2::@5/(byte) atan2::angle#7 )
to:atan2::@return
atan2::@return: scope:[atan2] from atan2::@3
[24] return
to:@return
atan2::@2: scope:[atan2] from atan2::@1
[25] (signed byte) atan2::xd#0 ← (signed byte) atan2::x#3 >> (byte) atan2::i#2
[26] (signed byte) atan2::yd#0 ← (signed byte) atan2::y#3 >> (byte) atan2::i#2
[27] if((signed byte) atan2::y#3>(signed byte) 0) goto atan2::@4
atan2::@3: scope:[atan2] from atan2::@1 atan2::@2
[25] (signed byte) atan2::yi#0 ← phi( atan2::@1/(signed byte~) atan2::yi#11 atan2::@2/(signed byte~) atan2::$2 )
[26] if((signed byte) atan2::x#0>(signed byte) 0) goto atan2::@4
to:atan2::@5
atan2::@5: scope:[atan2] from atan2::@3
[27] (signed byte~) atan2::$7 ← - (signed byte) atan2::x#0
to:atan2::@6
atan2::@6: scope:[atan2] from atan2::@2
[28] (signed byte) atan2::x#2 ← (signed byte) atan2::x#3 - (signed byte) atan2::yd#0
[29] (signed byte) atan2::y#2 ← (signed byte) atan2::y#3 + (signed byte) atan2::xd#0
[30] (byte) atan2::angle#2 ← (byte) atan2::angle#4 - *((const byte*) CORDIC_ATAN2_ANGLES#0 + (byte) atan2::i#2)
to:atan2::@5
atan2::@5: scope:[atan2] from atan2::@4 atan2::@6
[31] (signed byte) atan2::x#8 ← phi( atan2::@4/(signed byte) atan2::x#1 atan2::@6/(signed byte) atan2::x#2 )
[31] (byte) atan2::angle#7 ← phi( atan2::@4/(byte) atan2::angle#1 atan2::@6/(byte) atan2::angle#2 )
[31] (signed byte) atan2::y#8 ← phi( atan2::@4/(signed byte) atan2::y#1 atan2::@6/(signed byte) atan2::y#2 )
[32] (byte) atan2::i#1 ← ++ (byte) atan2::i#2
[33] if((byte) atan2::i#1==(const byte) CORDIC_ITERATIONS#0+(byte) 1) goto atan2::@3
to:atan2::@1
atan2::@4: scope:[atan2] from atan2::@2
[34] (signed byte) atan2::x#1 ← (signed byte) atan2::x#3 + (signed byte) atan2::yd#0
[35] (signed byte) atan2::y#1 ← (signed byte) atan2::y#3 - (signed byte) atan2::xd#0
[36] (byte) atan2::angle#1 ← (byte) atan2::angle#4 + *((const byte*) CORDIC_ATAN2_ANGLES#0 + (byte) atan2::i#2)
to:atan2::@5
atan2::@6: scope:[atan2] from atan2::@4 atan2::@5
[28] (signed byte) atan2::xi#0 ← phi( atan2::@4/(signed byte~) atan2::xi#8 atan2::@5/(signed byte~) atan2::$7 )
to:atan2::@10
atan2::@10: scope:[atan2] from atan2::@14 atan2::@6
[29] (byte) atan2::angle#12 ← phi( atan2::@14/(byte) atan2::angle#13 atan2::@6/(byte) 0 )
[29] (byte) atan2::i#2 ← phi( atan2::@14/(byte) atan2::i#1 atan2::@6/(byte) 0 )
[29] (signed byte) atan2::xi#3 ← phi( atan2::@14/(signed byte) atan2::xi#7 atan2::@6/(signed byte) atan2::xi#0 )
[29] (signed byte) atan2::yi#3 ← phi( atan2::@14/(signed byte) atan2::yi#7 atan2::@6/(signed byte) atan2::yi#0 )
[30] if((signed byte) atan2::yi#3!=(signed byte) 0) goto atan2::@11
to:atan2::@12
atan2::@12: scope:[atan2] from atan2::@10 atan2::@14
[31] (byte) atan2::angle#6 ← phi( atan2::@10/(byte) atan2::angle#12 atan2::@14/(byte) atan2::angle#13 )
[32] (byte) atan2::angle#1 ← (byte) atan2::angle#6 >> (byte) 1
[33] if((signed byte) atan2::x#0>=(signed byte) 0) goto atan2::@7
to:atan2::@16
atan2::@16: scope:[atan2] from atan2::@12
[34] (byte) atan2::angle#4 ← (byte) $80 - (byte) atan2::angle#1
to:atan2::@7
atan2::@7: scope:[atan2] from atan2::@12 atan2::@16
[35] (byte) atan2::angle#11 ← phi( atan2::@12/(byte) atan2::angle#1 atan2::@16/(byte) atan2::angle#4 )
[36] if((signed byte) atan2::y#0>=(signed byte) 0) goto atan2::@8
to:atan2::@9
atan2::@9: scope:[atan2] from atan2::@7
[37] (byte) atan2::angle#5 ← - (byte) atan2::angle#11
to:atan2::@8
atan2::@8: scope:[atan2] from atan2::@7 atan2::@9
[38] (byte) atan2::return#1 ← phi( atan2::@9/(byte) atan2::angle#5 atan2::@7/(byte) atan2::angle#11 )
to:atan2::@return
atan2::@return: scope:[atan2] from atan2::@8
[39] return
to:@return
atan2::@11: scope:[atan2] from atan2::@10
[40] (signed byte) atan2::xd#0 ← (signed byte) atan2::xi#3 >> (byte) atan2::i#2
[41] (signed byte) atan2::yd#0 ← (signed byte) atan2::yi#3 >> (byte) atan2::i#2
[42] if((signed byte) atan2::yi#3>(signed byte) 0) goto atan2::@13
to:atan2::@15
atan2::@15: scope:[atan2] from atan2::@11
[43] (signed byte) atan2::xi#2 ← (signed byte) atan2::xi#3 - (signed byte) atan2::yd#0
[44] (signed byte) atan2::yi#2 ← (signed byte) atan2::yi#3 + (signed byte) atan2::xd#0
[45] (byte) atan2::angle#3 ← (byte) atan2::angle#12 - *((const byte*) CORDIC_ATAN2_ANGLES#0 + (byte) atan2::i#2)
to:atan2::@14
atan2::@14: scope:[atan2] from atan2::@13 atan2::@15
[46] (signed byte) atan2::xi#7 ← phi( atan2::@13/(signed byte) atan2::xi#1 atan2::@15/(signed byte) atan2::xi#2 )
[46] (byte) atan2::angle#13 ← phi( atan2::@13/(byte) atan2::angle#2 atan2::@15/(byte) atan2::angle#3 )
[46] (signed byte) atan2::yi#7 ← phi( atan2::@13/(signed byte) atan2::yi#1 atan2::@15/(signed byte) atan2::yi#2 )
[47] (byte) atan2::i#1 ← ++ (byte) atan2::i#2
[48] if((byte) atan2::i#1==(const byte) CORDIC_ITERATIONS#0+(byte) 1) goto atan2::@12
to:atan2::@10
atan2::@13: scope:[atan2] from atan2::@11
[49] (signed byte) atan2::xi#1 ← (signed byte) atan2::xi#3 + (signed byte) atan2::yd#0
[50] (signed byte) atan2::yi#1 ← (signed byte) atan2::yi#3 - (signed byte) atan2::xd#0
[51] (byte) atan2::angle#2 ← (byte) atan2::angle#12 + *((const byte*) CORDIC_ATAN2_ANGLES#0 + (byte) atan2::i#2)
to:atan2::@14
atan2::@4: scope:[atan2] from atan2::@3
[52] (signed byte~) atan2::xi#8 ← (signed byte) atan2::x#0
to:atan2::@6
atan2::@1: scope:[atan2] from atan2
[53] (signed byte~) atan2::yi#11 ← (signed byte) atan2::y#0
to:atan2::@3
init_font_hex: scope:[init_font_hex] from main
[54] phi()
to:init_font_hex::@1
init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5
[55] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 )
[55] (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 )
[55] (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
[56] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 )
[56] (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 )
[56] (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 )
[57] *((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
[58] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 )
[58] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 )
[59] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4
[60] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1
[61] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1
[62] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2
[63] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5
[64] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2
[65] 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
[66] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0
[67] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2
[68] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0
[69] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5
[70] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8
[71] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4
[72] 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
[73] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5
[74] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6
[75] 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
[76] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -2,71 +2,166 @@
(label) @2
(label) @begin
(label) @end
(byte*) CHARSET
(const byte*) CHARSET#0 CHARSET = (byte*) 8192
(byte*) COLS
(const byte*) COLS#0 COLS = (byte*) 55296
(byte*) CORDIC_ATAN2_ANGLES
(const byte*) CORDIC_ATAN2_ANGLES#0 CORDIC_ATAN2_ANGLES = (byte*) 4096
(byte) CORDIC_ITERATIONS
(const byte) CORDIC_ITERATIONS#0 CORDIC_ITERATIONS = (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
(byte()) atan2((signed byte) atan2::x , (signed byte) atan2::y)
(signed byte~) atan2::$2 reg byte x 4.0
(signed byte~) atan2::$7 $7 zp ZP_BYTE:6 4.0
(label) atan2::@1
(label) atan2::@10
(label) atan2::@11
(label) atan2::@12
(label) atan2::@13
(label) atan2::@14
(label) atan2::@15
(label) atan2::@16
(label) atan2::@2
(label) atan2::@3
(label) atan2::@4
(label) atan2::@5
(label) atan2::@6
(label) atan2::@7
(label) atan2::@8
(label) atan2::@9
(label) atan2::@return
(byte) atan2::angle
(byte) atan2::angle#1 reg byte x 2002.0
(byte) atan2::angle#2 reg byte x 2002.0
(byte) atan2::angle#4 reg byte x 444.8888888888889
(byte) atan2::angle#7 reg byte x 1334.6666666666667
(byte) atan2::angle#1 reg byte x 3.0
(byte) atan2::angle#11 reg byte x 4.0
(byte) atan2::angle#12 angle zp ZP_BYTE:8 444.8888888888889
(byte) atan2::angle#13 angle zp ZP_BYTE:8 1334.6666666666667
(byte) atan2::angle#2 angle zp ZP_BYTE:8 2002.0
(byte) atan2::angle#3 angle zp ZP_BYTE:8 2002.0
(byte) atan2::angle#4 reg byte x 4.0
(byte) atan2::angle#5 reg byte x 4.0
(byte) atan2::angle#6 angle zp ZP_BYTE:8 2004.0
(byte) atan2::i
(byte) atan2::i#1 i zp ZP_BYTE:8 1501.5
(byte) atan2::i#2 i zp ZP_BYTE:8 500.50000000000006
(byte) atan2::i#1 i zp ZP_BYTE:7 1501.5
(byte) atan2::i#2 i zp ZP_BYTE:7 500.50000000000006
(byte) atan2::return
(byte) atan2::return#0 reg byte a 202.0
(byte) atan2::return#1 reg byte x 701.0
(byte) atan2::return#1 reg byte x 34.99999999999999
(signed byte) atan2::x
(signed byte) atan2::x#0 x zp ZP_BYTE:7 34.33333333333333
(signed byte) atan2::x#1 x zp ZP_BYTE:7 667.3333333333334
(signed byte) atan2::x#2 x zp ZP_BYTE:7 667.3333333333334
(signed byte) atan2::x#3 x zp ZP_BYTE:7 801.2
(signed byte) atan2::x#8 x zp ZP_BYTE:7 1001.0
(signed byte) atan2::x#0 x zp ZP_BYTE:3 4.192307692307692
(signed byte) atan2::xd
(signed byte) atan2::xd#0 xd zp ZP_BYTE:9 600.5999999999999
(signed byte) atan2::xd#0 xd zp ZP_BYTE:18 600.5999999999999
(signed byte) atan2::xi
(signed byte) atan2::xi#0 xi zp ZP_BYTE:6 6.0
(signed byte) atan2::xi#1 xi zp ZP_BYTE:6 667.3333333333334
(signed byte) atan2::xi#2 xi zp ZP_BYTE:6 667.3333333333334
(signed byte) atan2::xi#3 xi zp ZP_BYTE:6 801.2
(signed byte) atan2::xi#7 xi zp ZP_BYTE:6 1001.0
(signed byte~) atan2::xi#8 xi zp ZP_BYTE:6 4.0
(signed byte) atan2::y
(signed byte) atan2::y#0 y zp ZP_BYTE:6 51.5
(signed byte) atan2::y#1 y zp ZP_BYTE:6 1001.0
(signed byte) atan2::y#2 y zp ZP_BYTE:6 1001.0
(signed byte) atan2::y#3 y zp ZP_BYTE:6 858.2857142857142
(signed byte) atan2::y#8 y zp ZP_BYTE:6 1001.0
(signed byte) atan2::y#0 y zp ZP_BYTE:2 3.8928571428571437
(signed byte) atan2::yd
(signed byte) atan2::yd#0 reg byte y 1501.5
(signed byte) atan2::yi
(signed byte) atan2::yi#0 reg byte x 1.2000000000000002
(signed byte) atan2::yi#1 reg byte x 1001.0
(signed byte~) atan2::yi#11 reg byte x 4.0
(signed byte) atan2::yi#2 reg byte x 1001.0
(signed byte) atan2::yi#3 reg byte x 858.2857142857142
(signed byte) atan2::yi#7 reg byte x 1001.0
(void()) init_font_hex((byte*) init_font_hex::charset)
(byte~) init_font_hex::$0 $0 zp ZP_BYTE:19 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:11 16.5
(byte) init_font_hex::c#6 c zp ZP_BYTE:11 1.1578947368421053
(byte) init_font_hex::c1
(byte) init_font_hex::c1#1 c1 zp ZP_BYTE:16 151.5
(byte) init_font_hex::c1#4 c1 zp ZP_BYTE:16 13.466666666666667
(byte*) init_font_hex::charset
(byte*) init_font_hex::charset#0 charset zp ZP_WORD:12 35.5
(byte*) init_font_hex::charset#2 charset zp ZP_WORD:12 108.35714285714285
(byte*) init_font_hex::charset#5 charset zp ZP_WORD:12 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:17 551.0
(byte) init_font_hex::idx#3 reg byte y 202.0
(byte) init_font_hex::idx#5 idx zp ZP_BYTE:17 600.5999999999999
(byte*) init_font_hex::proto_hi
(byte*) init_font_hex::proto_hi#1 proto_hi zp ZP_WORD:9 7.333333333333333
(byte*) init_font_hex::proto_hi#6 proto_hi zp ZP_WORD:9 56.83333333333334
(byte*) init_font_hex::proto_lo
(byte*) init_font_hex::proto_lo#1 proto_lo zp ZP_WORD:14 50.5
(byte*) init_font_hex::proto_lo#4 proto_lo zp ZP_WORD:14 92.53846153846155
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return
(label) main::@5
(label) main::@6
(byte) main::angle
(byte) main::angle#0 reg byte a 202.0
(byte*) main::col00
(byte*) main::screen
(byte*) main::screen#1 screen zp ZP_WORD:3 7.333333333333333
(byte*) main::screen#5 screen zp ZP_WORD:3 12.299999999999999
(byte*) main::screen#1 screen zp ZP_WORD:4 42.599999999999994
(byte*) main::screen#2 screen zp ZP_WORD:4 44.85714285714286
(byte*) main::screen#4 screen zp ZP_WORD:4 22.0
(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
(signed byte) main::x
(signed byte) main::x#1 x zp ZP_BYTE:5 151.5
(signed byte) main::x#2 x zp ZP_BYTE:5 57.714285714285715
(signed byte) main::x#1 x zp ZP_BYTE:3 151.5
(signed byte) main::x#2 x zp ZP_BYTE:3 37.875
(signed byte) main::y
(signed byte) main::y#1 y zp ZP_BYTE:2 16.5
(signed byte) main::y#4 y zp ZP_BYTE:2 11.181818181818182
zp ZP_BYTE:2 [ main::y#4 main::y#1 ]
zp ZP_WORD:3 [ main::screen#5 main::screen#1 ]
zp ZP_BYTE:5 [ main::x#2 main::x#1 ]
zp ZP_BYTE:6 [ atan2::y#3 atan2::y#0 atan2::y#8 atan2::y#1 atan2::y#2 ]
zp ZP_BYTE:7 [ atan2::x#3 atan2::x#0 atan2::x#8 atan2::x#1 atan2::x#2 ]
zp ZP_BYTE:8 [ atan2::i#2 atan2::i#1 ]
reg byte x [ atan2::return#1 atan2::angle#4 atan2::angle#7 atan2::angle#1 atan2::angle#2 ]
zp ZP_BYTE:2 [ main::y#4 main::y#1 atan2::y#0 ]
zp ZP_BYTE:3 [ main::x#2 main::x#1 atan2::x#0 ]
zp ZP_WORD:4 [ main::screen#2 main::screen#4 main::screen#1 ]
reg byte x [ atan2::yi#3 atan2::yi#7 atan2::yi#0 atan2::yi#11 atan2::$2 atan2::yi#1 atan2::yi#2 ]
zp ZP_BYTE:6 [ atan2::xi#3 atan2::xi#7 atan2::xi#0 atan2::xi#8 atan2::$7 atan2::xi#1 atan2::xi#2 ]
zp ZP_BYTE:7 [ atan2::i#2 atan2::i#1 ]
zp ZP_BYTE:8 [ atan2::angle#6 atan2::angle#12 atan2::angle#13 atan2::angle#2 atan2::angle#3 ]
reg byte x [ atan2::return#1 atan2::angle#5 atan2::angle#11 atan2::angle#1 atan2::angle#4 ]
zp ZP_WORD:9 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ]
zp ZP_BYTE:11 [ init_font_hex::c#6 init_font_hex::c#1 ]
zp ZP_WORD:12 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ]
zp ZP_WORD:14 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ]
zp ZP_BYTE:16 [ 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:17 [ init_font_hex::idx#5 init_font_hex::idx#2 ]
reg byte a [ atan2::return#0 ]
reg byte a [ main::angle#0 ]
zp ZP_BYTE:9 [ atan2::xd#0 ]
zp ZP_BYTE:18 [ atan2::xd#0 ]
reg byte y [ atan2::yd#0 ]
zp ZP_BYTE:19 [ 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 ]