1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-02-17 10:30:43 +00:00

Added center-based plasma, some fragments and some synth rules.

This commit is contained in:
jespergravgaard 2019-07-07 00:17:00 +02:00
parent b05160bfff
commit 1d092962b3
17 changed files with 13930 additions and 72 deletions

View File

@ -0,0 +1,8 @@
lda ({z4}),y
sta $ff
lda ({z2}),y
tay
lda ({z1}),y
ldy $ff
clc
adc ({z3}),y

View File

@ -0,0 +1,7 @@
lda ({z1}),y
sta $ff
lda ({z3}),y
tay
lda ({z2}),y
clc
adc $ff

View File

@ -89,22 +89,32 @@ public class AsmFragmentTemplate {
VariableVersion v2 = new VariableVersion("$tmp2", SymbolType.BYTE, null);
VariableVersion v3 = new VariableVersion("$tmp3", SymbolType.BYTE, null);
VariableVersion v4 = new VariableVersion("$tmp4", SymbolType.BYTE, null);
VariableVersion v5 = new VariableVersion("$tmp5", SymbolType.BYTE, null);
VariableVersion v6 = new VariableVersion("$tmp6", SymbolType.BYTE, null);
v1.setScope(scope);
v2.setScope(scope);
v3.setScope(scope);
v4.setScope(scope);
v5.setScope(scope);
v6.setScope(scope);
v1.setAllocation(new Registers.RegisterZpByte(2));
v2.setAllocation(new Registers.RegisterZpByte(4));
v3.setAllocation(new Registers.RegisterZpByte(6));
v4.setAllocation(new Registers.RegisterZpByte(8));
v5.setAllocation(new Registers.RegisterZpByte(9));
v6.setAllocation(new Registers.RegisterZpByte(10));
if(signature.contains("z1")) bindings.put("z1", v1);
if(signature.contains("z2")) bindings.put("z2", v2);
if(signature.contains("z3")) bindings.put("z3", v3);
if(signature.contains("z4")) bindings.put("z4", v4);
if(signature.contains("z5")) bindings.put("z5", v5);
if(signature.contains("z6")) bindings.put("z6", v6);
if(signature.contains("c1")) bindings.put("c1", new ConstantInteger(10L));
if(signature.contains("c2")) bindings.put("c2", new ConstantInteger(20L));
if(signature.contains("c3")) bindings.put("c3", new ConstantInteger(30L));
if(signature.contains("c4")) bindings.put("c4", new ConstantInteger(40L));
if(signature.contains("c5")) bindings.put("c5", new ConstantInteger(50L));
if(signature.contains("c6")) bindings.put("c6", new ConstantInteger(60L));
if(signature.contains("la1")) bindings.put("la1", new Label("@1", scope, true));
AsmFragmentInstance fragmentInstance =
new AsmFragmentInstance(new Program(), signature, ScopeRef.ROOT, this, bindings);

View File

@ -200,26 +200,52 @@ class AsmFragmentTemplateSynthesisRule {
}
private static List<AsmFragmentTemplateSynthesisRule> initFragmentSyntheses() {
// Z1 is replaced by something non-ZP - all above are moved down
Map<String, String> mapZ1 = new LinkedHashMap<>();
mapZ1.put("z2", "z1");
mapZ1.put("z3", "z2");
mapZ1.put("z4", "z3");
mapZ1.put("z5", "z4");
mapZ1.put("z6", "z5");
// Z2 is replaced by something non-ZP - all above are moved down
Map<String, String> mapZ2 = new LinkedHashMap<>();
mapZ2.put("z3", "z1");
mapZ2.put("z3", "z2");
mapZ2.put("z4", "z3");
mapZ2.put("z5", "z4");
mapZ2.put("z6", "z5");
// Z3 is replaced by something non-ZP - all above are moved down
Map<String, String> mapZ3 = new LinkedHashMap<>();
mapZ3.put("z3", "z2");
Map<String, String> mapZ4 = new LinkedHashMap<>();
mapZ3.put("z4", "z3");
mapZ3.put("z5", "z4");
mapZ3.put("z6", "z5");
// Z4 is replaced by something non-ZP - all above are moved down
Map<String, String> mapZ4 = new LinkedHashMap<>();
mapZ4.put("z5", "z4");
mapZ4.put("z6", "z5");
// C1 is replaced by something non-C - all above are moved down
Map<String, String> mapC1 = new LinkedHashMap<>();
mapC1.put("c2", "c1");
mapC1.put("c3", "c2");
mapC1.put("c4", "c3");
mapC1.put("c5", "c4");
mapC1.put("c6", "c5");
// C2 is replaced by something non-C - all above are moved down
Map<String, String> mapC2 = new LinkedHashMap<>();
mapC2.put("c3", "c2");
mapC2.put("c4", "c3");
Map<String, String> mapZC = new LinkedHashMap<>();
mapZC.putAll(mapZ1);
mapZC.putAll(mapC1);
mapC2.put("c5", "c4");
mapC2.put("c6", "c5");
// Z1 and Z2 are replaced by something non-ZP - all above are moved down
Map<String, String> mapZ12 = new LinkedHashMap<>();
mapZ12.put("z3", "z1");
mapZ12.put("z4", "z2");
mapZ12.put("z5", "z3");
mapZ12.put("z6", "z4");
// Z1 and C1 are replaced by something non-ZP - all above are moved down
Map<String, String> mapZ1C1 = new LinkedHashMap<>();
mapZ1C1.putAll(mapZ1);
mapZ1C1.putAll(mapC1);
// Use unsigned in place of a signed
Map<String, String> mapSToU = new LinkedHashMap<>();
mapSToU.put("vbsz1", "vbuz1");
mapSToU.put("vbsz2", "vbuz2");
@ -254,10 +280,12 @@ class AsmFragmentTemplateSynthesisRule {
mapSToU.put("pwsc1", "pwuc1");
mapSToU.put("pwsc2", "pwuc2");
mapSToU.put("pwsc3", "pwuc3");
// Swap z1 and z2
Map<String, String> mapZ2Swap = new LinkedHashMap<>();
mapZ2Swap.put("z2", "zn");
mapZ2Swap.put("z1", "z2");
mapZ2Swap.put("zn", "z1");
// Swap z2 and z3
Map<String, String> mapZ3Swap = new LinkedHashMap<>();
mapZ3Swap.put("z3", "zn");
mapZ3Swap.put("z2", "z3");
@ -276,6 +304,8 @@ class AsmFragmentTemplateSynthesisRule {
String lvalDerefIdxAa = ".*_derefidx_...aa=.*";
String lvalDerefIdxZ1 = ".*_derefidx_...z1=.*";
String lvalDerefIdxZ2 = ".*_derefidx_...z2=.*";
String lvalDerefIdxZ3 = ".*_derefidx_...z3=.*";
String lvalDerefIdxZ4 = ".*_derefidx_...z4=.*";
// AA/XX/YY/Z1 is an LValue
String lvalAa = "...aa=.*";
String lvalXx = "...xx=.*";
@ -292,6 +322,8 @@ class AsmFragmentTemplateSynthesisRule {
String threeC1 = ".*c1.*c1.*c1.*";
String threeZ1 = ".*z1.*z1.*z1.*";
String threeZ2 = ".*z2.*z2.*z2.*";
String threeZ3 = ".*z3.*z3.*z3.*";
String threeZ4 = ".*z4.*z4.*z4.*";
String threeAa = ".*aa.*aa.*aa.*";
// Presence of unwanted single symbols
@ -380,38 +412,38 @@ class AsmFragmentTemplateSynthesisRule {
synths.add(new AsmFragmentTemplateSynthesisRule("(vb.)z1=(.*)", twoZ1, null, "$1xx=$2", "stx {z1}", mapZ1));
// Replace Z2 with AA (only one)
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)", lvalZ2+"|"+rvalAa+"|"+twoZ2, "lda {z2}", "$1aa$2", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)", lvalZ2+"|"+rvalAa+"|"+twoZ2, "lda {z2}", "$1aa$2", null, mapZ2));
// Replace two Z2s with AA
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalAa+"|"+threeZ2, "lda {z2}", "$1aa$2aa$3", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalAa+"|"+threeZ2, "lda {z2}", "$1aa$2aa$3", null, mapZ2));
// Replace first (of 2) Z2 with AA
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)z2(.*)", lvalZ2+"|"+rvalAa, "lda {z2}", "$1aa$2z2$3", null, null));
// Replace second (of 2) Z2 with AA
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalAa, "lda {z2}", "$1z2$2aa$3", null, null));
// Replace Z2 with YY (only one)
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)", lvalZ2+"|"+rvalYy+"|"+twoZ2, "ldy {z2}", "$1yy$2", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)", lvalZ2+"|"+rvalYy+"|"+twoZ2, "ldy {z2}", "$1yy$2", null, mapZ2));
// Replace two Z2s with YY
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalYy+"|"+threeZ2, "ldy {z2}", "$1yy$2yy$3", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalYy+"|"+threeZ2, "ldy {z2}", "$1yy$2yy$3", null, mapZ2));
// Replace first (of 2) Z2 with YY
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)z2(.*)", lvalZ2+"|"+rvalYy, "ldy {z2}", "$1yy$2z2$3", null, null));
// Replace second (of 2) Z2 with YY
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalYy, "ldy {z2}", "$1z2$2yy$3", null, null));
// Replace Z2 with XX(only one)
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)", lvalZ2+"|"+rvalXx+"|"+twoZ2, "ldx {z2}", "$1xx$2", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)", lvalZ2+"|"+rvalXx+"|"+twoZ2, "ldx {z2}", "$1xx$2", null, mapZ2));
// Replace two Z2s with XX
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalXx+"|"+threeZ2, "ldx {z2}", "$1xx$2xx$3", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalXx+"|"+threeZ2, "ldx {z2}", "$1xx$2xx$3", null, mapZ2));
// Replace first (of 2) Z2 with XX
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z2(.*)z2(.*)", lvalZ2+"|"+rvalXx, "ldx {z2}", "$1xx$2z2$3", null, null));
// Replace second (of 2) Z2 with XX
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z2(.*vb.)z2(.*)", lvalZ2+"|"+rvalXx, "ldx {z2}", "$1z2$2xx$3", null, null));
// Replace Z3 with AA (only one)
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z3(.*)", lvalZ3+"|"+twoZ3+"|"+rvalAa, "lda {z3}", "$1aa$2", null, mapZ4));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z3(.*)", lvalZ3+"|"+twoZ3+"|"+rvalAa, "lda {z3}", "$1aa$2", null, mapZ3));
// Replace Z3 with YY (only one)
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z3(.*)", lvalZ3+"|"+twoZ3+"|"+rvalYy, "ldy {z3}", "$1yy$2", null, mapZ4));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z3(.*)", lvalZ3+"|"+twoZ3+"|"+rvalYy, "ldy {z3}", "$1yy$2", null, mapZ3));
// Replace Z3 with XX (only one)
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z3(.*)", lvalZ3+"|"+twoZ3+"|"+rvalXx, "ldx {z3}", "$1xx$2", null, mapZ4));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*vb.)z3(.*)", lvalZ3+"|"+twoZ3+"|"+rvalXx, "ldx {z3}", "$1xx$2", null, mapZ3));
// Correct wrong ordered Z2/Z1
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z2(.*)z1(.*)", twoZ1+"|"+twoZ2, null, "$1z1$2z2$3", null, mapZ2Swap, false));
@ -553,8 +585,8 @@ class AsmFragmentTemplateSynthesisRule {
// OLD STYLE REWRITES - written when only one rule could be taken
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuz1=(.*)", twoZ1+"|"+twoC1, null, "vb$1aa=$2", "ldx {z1}\n" + "sta {c1},x", mapZC));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuz2=(.*)", twoZ1+"|"+twoZ2, null, "vb$1aa=$2", "ldy {z2}\n" + "sta ({z1}),y", mapZ2));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuz1=(.*)", twoZ1+"|"+twoC1, null, "vb$1aa=$2", "ldx {z1}\n" + "sta {c1},x", mapZ1C1));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuz2=(.*)", twoZ1+"|"+twoZ2, null, "vb$1aa=$2", "ldy {z2}\n" + "sta ({z1}),y", mapZ12));
// Convert array indexing with A register to X/Y register by prefixing tax/tay (..._derefidx_vbuaa... -> ..._derefidx_vbuxx... /... _derefidx_vbuyy... )
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuaa(.*)", rvalXx, "tax", "$1=$2_derefidx_vbuxx$3", null, null));
@ -565,8 +597,8 @@ class AsmFragmentTemplateSynthesisRule {
// Convert array indexing with zero page to x/y register by prefixing ldx z1 / ldy z1 ( ..._derefidx_vbuzn... -> ..._derefidx_vbuxx... / ..._derefidx_vbuyy... )
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuz1(.*)", rvalXx+"|"+twoZ1, "ldx {z1}", "$1=$2_derefidx_vbuxx$3", null, mapZ1));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuz1(.*)", rvalYy+"|"+twoZ1, "ldy {z1}", "$1=$2_derefidx_vbuyy$3", null, mapZ1));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuz2(.*)", rvalXx+"|"+twoZ2, "ldx {z2}", "$1=$2_derefidx_vbuxx$3", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuz2(.*)", rvalYy+"|"+twoZ2, "ldy {z2}", "$1=$2_derefidx_vbuyy$3", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuz2(.*)", rvalXx+"|"+twoZ2, "ldx {z2}", "$1=$2_derefidx_vbuxx$3", null, mapZ2));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuz2(.*)", rvalYy+"|"+twoZ2, "ldy {z2}", "$1=$2_derefidx_vbuyy$3", null, mapZ2));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuz3(.*)", rvalYy, "ldy {z3}", "$1=$2_derefidx_vbuyy$3", null, null));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)_derefidx_vbuz3(.*)", rvalXx, "ldx {z3}", "$1=$2_derefidx_vbuxx$3", null, null));
@ -575,9 +607,13 @@ class AsmFragmentTemplateSynthesisRule {
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuaa(.*)_derefidx_vbuaa(.*)", threeAa+"|"+rvalYy+"|"+lvalDerefIdxAa, "tay", "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", null, null));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz1(.*)_derefidx_vbuz1(.*)", threeZ1+"|"+rvalXx+"|"+lvalDerefIdxZ1, "ldx {z1}", "$1_derefidx_vbuxx$2_derefidx_vbuxx$3", null, mapZ1));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz1(.*)_derefidx_vbuz1(.*)", threeZ1+"|"+rvalYy+"|"+lvalDerefIdxZ1, "ldy {z1}", "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", null, mapZ1));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz2(.*)_derefidx_vbuz2(.*)", threeZ2+"|"+rvalXx+"|"+lvalDerefIdxZ2, "ldx {z2}", "$1_derefidx_vbuxx$2_derefidx_vbuxx$3", null, mapZ1));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz2(.*)_derefidx_vbuz2(.*)", threeZ2+"|"+rvalYy+"|"+lvalDerefIdxZ2, "ldy {z2}", "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", null, mapZ1));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz2(.*)_derefidx_vbuz2(.*)", threeZ2+"|"+rvalXx+"|"+lvalDerefIdxZ2, "ldx {z2}", "$1_derefidx_vbuxx$2_derefidx_vbuxx$3", null, mapZ2));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz2(.*)_derefidx_vbuz2(.*)", threeZ2+"|"+rvalYy+"|"+lvalDerefIdxZ2, "ldy {z2}", "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", null, mapZ2));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz3(.*)_derefidx_vbuz3(.*)", threeZ3+"|"+rvalXx+"|"+lvalDerefIdxZ3, "ldx {z3}", "$1_derefidx_vbuxx$2_derefidx_vbuxx$3", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz3(.*)_derefidx_vbuz3(.*)", threeZ3+"|"+rvalYy+"|"+lvalDerefIdxZ3, "ldy {z3}", "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", null, mapZ3));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz4(.*)_derefidx_vbuz4(.*)", threeZ4+"|"+rvalXx+"|"+lvalDerefIdxZ4, "ldx {z4}", "$1_derefidx_vbuxx$2_derefidx_vbuxx$3", null, mapZ4));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz4(.*)_derefidx_vbuz4(.*)", threeZ4+"|"+rvalYy+"|"+lvalDerefIdxZ4, "ldy {z4}", "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", null, mapZ4));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuz1=(.*c1.*)", twoZ1, null, "vb$1aa=$2", "ldx {z1}\n" + "sta {c1},x", mapZ1));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuz1=(.*z1.*)", twoC1, null, "vb$1aa=$2", "ldx {z1}\n" + "sta {c1},x", mapC1));

View File

@ -5,9 +5,9 @@ typedef word size_t ;
// Copy block of memory (forwards)
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
void* memcpy( void* destination, void* source, size_t num ) {
byte* src = source;
byte* dst = destination;
byte* src_end = (byte*)source+num;
char* src = source;
char* dst = destination;
char* src_end = (char*)source+num;
while(src!=src_end) *dst++ = *src++;
return destination;
}
@ -19,25 +19,25 @@ void* memmove( void* destination, void* source, size_t num ) {
memcpy(destination, source, num);
} else {
// copy backwards
byte* src = (byte*)source+num;
byte* dst = (byte*)destination+num;
char* src = (char*)source+num;
char* dst = (char*)destination+num;
for( size_t i=0; i<num; i++) *--dst = *--src;
}
return destination;
}
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
void *memset(void *str, byte c, size_t num) {
byte* end = (byte*)str + num;
for(byte* dst = str; dst!=end; dst++)
void *memset(void *str, char c, size_t num) {
char* end = (char*)str + num;
for(char* dst = str; dst!=end; dst++)
*dst = c;
return str;
}
// Copies the C string pointed by source into the array pointed by destination, including the terminating null character (and stopping at that point).
byte* strcpy( byte* destination, byte* source ) {
byte* src = source;
byte* dst = destination;
char* strcpy( char* destination, byte* source ) {
char* src = source;
char* dst = destination;
while(*src) *dst++ = *src++;
*dst = 0;
return destination;

View File

@ -138,10 +138,7 @@ public class TestFragments {
@Test
public void testFragmentsExist() {
testFragmentExists("vbuaa=pbuc2_derefidx_vbuxx");
testFragmentExists("pwsc1_derefidx_vbuxx=vwsc2");
testFragmentExists("pwsc1_derefidx_vbuyy=vwsc2");
testFragmentExists("pwsc1_derefidx_vbuxx=pwsc1_derefidx_vbuxx_minus_vwsc2");
@ -173,6 +170,8 @@ public class TestFragments {
testFragmentExists("vbsaa=pbsc1_derefidx_vbsz1_minus_pbsc1_derefidx_vbsz2");
testFragmentExists("vbsaa=pbsc1_derefidx_vbsxx_minus_pbsc1_derefidx_vbsyy");
testFragmentExists("vbuz1=pbuz2_derefidx_vbuz3_plus_pbuz4_derefidx_pbuz5_derefidx_vbuz3");
testFragmentExists("vbuz1=pbuz2_derefidx_pbuz3_derefidx_vbuz4_plus_pbuz5_derefidx_pbuz6_derefidx_vbuz4");
}

View File

@ -36,7 +36,12 @@ public class TestPrograms {
}
@Test
public void testSCreenShowSpiral() throws IOException, URISyntaxException {
public void testPlasmaCenter() throws IOException, URISyntaxException {
compileAndCompare("plasma-center");
}
@Test
public void testScreenShowSpiral() throws IOException, URISyntaxException {
compileAndCompare("screen-show-spiral");
}

View File

@ -8,20 +8,20 @@ import "c64"
import "print"
import "sid"
const unsigned char* SCREEN1 = $2800;
const unsigned char* SCREEN2 = $2c00;
const unsigned char* CHARSET = $2000;
const char* SCREEN1 = 0x2800;
const char* SCREEN2 = 0x2c00;
const char* CHARSET = 0x2000;
const unsigned char[0x100] align(0x100) SINTABLE = kickasm {{
const char[0x100] align(0x100) SINTABLE = kickasm {{
.for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))
}};
void main() {
asm { sei }
*BORDERCOL = BLUE;
*BGCOL = BLUE;
for(unsigned char* col : COLS..COLS+1000) *col = BLACK;
for(char* col : COLS..COLS+1000) *col = BLACK;
makecharset(CHARSET);
// Show double-buffered plasma
while(true) {
@ -33,37 +33,37 @@ void main() {
}
// Plasma state variables
unsigned char c1A = 0;
unsigned char c1B = 0;
unsigned char c2A = 0;
unsigned char c2B = 0;
char c1A = 0;
char c1B = 0;
char c2A = 0;
char c2B = 0;
// Render plasma to the passed screen
void doplasma (unsigned char* screen) {
void doplasma (char* screen) {
unsigned char[40] xbuf;
unsigned char[25] ybuf;
char[40] xbuf;
char[25] ybuf;
unsigned char c1a = c1A;
unsigned char c1b = c1B;
for (unsigned char i = 0; i < 25; ++i) {
char c1a = c1A;
char c1b = c1B;
for (char i = 0; i < 25; ++i) {
ybuf[i] = (SINTABLE[c1a] + SINTABLE[c1b]);
c1a += 4;
c1b += 9;
}
c1A += 3;
c1B -= 5;
unsigned char c2a = c2A;
unsigned char c2b = c2B;
for (unsigned char i = 0; i < 40; ++i) {
char c2a = c2A;
char c2b = c2B;
for (char i = 0; i < 40; ++i) {
xbuf[i] = (SINTABLE[c2a] + SINTABLE[c2b]);
c2a += 3;
c2b += 7;
}
c2A += 2;
c2B -= 3;
for (unsigned char ii = 0; ii < 25; ++ii) {
for (unsigned char i = 0; i < 40; ++i) {
for (char ii = 0; ii < 25; ++ii) {
for (char i = 0; i < 40; ++i) {
screen[i] = (xbuf[i] + ybuf[ii]);
}
screen += 40;
@ -71,15 +71,15 @@ void doplasma (unsigned char* screen) {
}
// Make a plasma-friendly charset where the chars are randomly filled
void makecharset(unsigned char* charset) {
const unsigned char[8] bittab = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
void makecharset(char* charset) {
const char[8] bittab = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
sid_rnd_init();
print_cls();
for (unsigned int c = 0; c < 0x100; ++c) {
unsigned char s = SINTABLE[<c];
for ( unsigned char i = 0; i < 8; ++i){
unsigned char b = 0;
for (unsigned char ii = 0; ii < 8; ++ii) {
char s = SINTABLE[<c];
for ( char i = 0; i < 8; ++i){
char b = 0;
for (char ii = 0; ii < 8; ++ii) {
if ((sid_rnd() & 0xFF) > s) {
b |= bittab[ii];
}

View File

@ -0,0 +1,133 @@
// Plasma based on the distance/angle to the screen center
import "c64"
import "stdlib"
import "string"
import "sqr"
import "atan2"
import "print"
import "sid"
const char[0x200] align(0x100) SINTABLE = kickasm {{
.for(var i=0;i<$200;i++)
.byte round(127.5+127.5*sin(2*PI*i/256))
}};
// Screen containing distance to center
const byte* SCREEN_DIST = malloc(1000);
// Screen containing angle to center
const byte* SCREEN_ANGLE = malloc(1000);
// Plasma charset
const char* CHARSET = 0x2000;
// Plasma screen 1
const char* SCREEN1 = 0x2800;
// Plasma screen 2
const char* SCREEN2 = 0x2c00;
void main() {
init_dist_screen(SCREEN_DIST);
init_angle_screen(SCREEN_ANGLE);
make_plasma_charset(CHARSET);
memset(COLS, BLACK, 1000);
// Show double-buffered plasma
while(true) {
doplasma(SCREEN1);
*D018 = toD018(SCREEN1, CHARSET);
doplasma(SCREEN2);
*D018 = toD018(SCREEN2, CHARSET);
}
}
// Offsets for the sines
byte sin_offset_x = 0;
byte sin_offset_y = 0;
// Render plasma to the passed screen
void doplasma (char* screen) {
char* angle = SCREEN_ANGLE;
char* dist = SCREEN_DIST;
byte* sin_x = SINTABLE+sin_offset_x;
byte* sin_y = SINTABLE+sin_offset_y;
for( char y: 0..25) {
for( char x: 0..39) {
screen[x] = sin_x[angle[x]] + sin_y[dist[x]];
}
screen += 40;
angle += 40;
dist += 40;
}
sin_offset_x -= 3;
sin_offset_y -= 7;
}
// Populates 1000 bytes (a screen) with values representing the angle to the center.
// Utilizes symmetry around the center
void init_angle_screen(byte* screen) {
byte* screen_topline = screen+40*12;
byte *screen_bottomline = screen+40*12;
for(byte y: 0..12) {
for( byte x=0,xb=39; x<=19; x++, xb--) {
signed word xw = (signed word)(word){ 39-x*2, 0 };
signed word yw = (signed word)(word){ y*2, 0 };
word angle_w = atan2_16(xw, yw);
byte ang_w = >(angle_w+0x0080);
screen_bottomline[xb] = ang_w;
screen_topline[xb] = -ang_w;
screen_topline[x] = 0x80+ang_w;
screen_bottomline[x] = 0x80-ang_w;
}
screen_topline -= 40;
screen_bottomline += 40;
}
}
// Populates 1000 bytes (a screen) with values representing the distance to the center.
// The actual value stored is distance*2 to increase precision
void init_dist_screen(byte* screen) {
NUM_SQUARES = 0x30;
init_squares();
byte* screen_topline = screen;
byte *screen_bottomline = screen+40*24;
for(byte y: 0..12) {
byte y2 = y*2;
byte yd = (y2>=24)?(y2-24):(24-y2);
word yds = sqr(yd);
for( byte x=0,xb=39; x<=19; x++, xb--) {
byte x2 = x*2;
byte xd = (x2>=39)?(x2-39):(39-x2);
word xds = sqr(xd);
word ds = xds+yds;
byte d = sqrt(ds);
screen_topline[x] = d;
screen_bottomline[x] = d;
screen_topline[xb] = d;
screen_bottomline[xb] = d;
}
screen_topline += 40;
screen_bottomline -= 40;
}
}
// Make a plasma-friendly charset where the chars are randomly filled
void make_plasma_charset(char* charset) {
const char[8] bittab = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
sid_rnd_init();
print_cls();
for (unsigned int c = 0; c < 0x100; ++c) {
char s = SINTABLE[<c];
for ( char i = 0; i < 8; ++i){
char b = 0;
for (char ii = 0; ii < 8; ++ii) {
if ((sid_rnd() & 0xFF) > s) {
b |= bittab[ii];
}
}
charset[(c*8) + i] = b;
}
if ((c & 0x07) == 0) {
print_char('.');
}
}
}

27
src/test/kc/sid.kc Normal file
View File

@ -0,0 +1,27 @@
// SID registers for random number generation
const word* SID_VOICE3_FREQ = $d40e;
const byte* SID_VOICE3_FREQ_LOW = $d40e;
const byte* SID_VOICE3_FREQ_HIGH = $d40f;
const byte* SID_VOICE3_CONTROL = $d412;
const byte SID_CONTROL_NOISE = $80;
const byte SID_CONTROL_PULSE = $40;
const byte SID_CONTROL_SAWTOOTH = $20;
const byte SID_CONTROL_TRIANGLE = $10;
const byte SID_CONTROL_TEST = $08;
const byte SID_CONTROL_RING = $04;
const byte SID_CONTROL_SYNC = $02;
const byte SID_CONTROL_GATE = $01;
const byte* SID_VOICE3_OSC = $d41b;
// Initialize SID voice 3 for random number generation
void sid_rnd_init() {
*SID_VOICE3_FREQ = $ffff;
*SID_VOICE3_CONTROL = SID_CONTROL_NOISE;
}
// Get a random number from the SID voice 3,
// Must be initialized with sid_rnd_init()
byte sid_rnd() {
return *SID_VOICE3_OSC;
}

View File

@ -322,5 +322,5 @@ sid_rnd_init: {
.align $100
SINTABLE:
.for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))

View File

@ -118,7 +118,7 @@ sid_rnd::@return: scope:[sid_rnd] from sid_rnd
(byte*) SCREEN2#0 ← ((byte*)) (number) $2c00
(byte*) CHARSET#0 ← ((byte*)) (number) $2000
(byte[$100]) SINTABLE#0 ← kickasm {{ .for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))
}}
to:@28
main: scope:[main] from @30
@ -1614,7 +1614,7 @@ Constant (const byte*) SCREEN1#0 = (byte*) 10240
Constant (const byte*) SCREEN2#0 = (byte*) 11264
Constant (const byte*) CHARSET#0 = (byte*) 8192
Constant (const byte[$100]) SINTABLE#0 = kickasm {{ .for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))
}}
Constant (const byte) c1A#19 = 0
Constant (const byte) c1B#19 = 0
@ -3037,7 +3037,7 @@ sid_rnd_init: {
.align $100
SINTABLE:
.for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))
REGISTER UPLIFT POTENTIAL REGISTERS
@ -3862,7 +3862,7 @@ sid_rnd_init: {
.align $100
SINTABLE:
.for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))
ASSEMBLER OPTIMIZATIONS
@ -4032,7 +4032,7 @@ FINAL SYMBOL TABLE
(const byte*) SID_VOICE3_OSC#0 SID_VOICE3_OSC = (byte*) 54299
(byte[$100]) SINTABLE
(const byte[$100]) SINTABLE#0 SINTABLE = kickasm {{ .for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))
}}
(byte) c1A
(byte) c1A#10 c1A zp ZP_BYTE:4 2.6000000000000005
@ -4768,6 +4768,6 @@ sid_rnd_init: {
.align $100
SINTABLE:
.for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))

View File

@ -29,7 +29,7 @@
(const byte*) SID_VOICE3_OSC#0 SID_VOICE3_OSC = (byte*) 54299
(byte[$100]) SINTABLE
(const byte[$100]) SINTABLE#0 SINTABLE = kickasm {{ .for(var i=0;i<$100;i++)
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
.byte round(127.5+127.5*sin(2*PI*i/256))
}}
(byte) c1A
(byte) c1A#10 c1A zp ZP_BYTE:4 2.6000000000000005

View File

@ -0,0 +1,940 @@
// Plasma based on the distance/angle to the screen center
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
.const SIZEOF_WORD = 2
.label D018 = $d018
// Color Ram
.label COLS = $d800
// The colors of the C64
.const BLACK = 0
// Start of the heap used by malloc()
.label HEAP_START = $c000
// The number of iterations performed during 16-bit CORDIC atan2 calculation
.const CORDIC_ITERATIONS_16 = $f
.label print_line_cursor = $400
// SID registers for random number generation
.label SID_VOICE3_FREQ = $d40e
.label SID_VOICE3_CONTROL = $d412
.const SID_CONTROL_NOISE = $80
.label SID_VOICE3_OSC = $d41b
// Plasma charset
.label CHARSET = $2000
// Plasma screen 1
.label SCREEN1 = $2800
// Plasma screen 2
.label SCREEN2 = $2c00
.const NUM_SQUARES = $30
.label heap_head = $32
.label SQUARES = $4f
.label print_char_cursor = $f
// Screen containing distance to center
.label SCREEN_DIST = $36
// Screen containing angle to center
.label SCREEN_ANGLE = $38
.label sin_offset_x = 2
.label sin_offset_y = 3
bbegin:
lda #<$3e8
sta malloc.size
lda #>$3e8
sta malloc.size+1
lda #<HEAP_START
sta heap_head
lda #>HEAP_START
sta heap_head+1
jsr malloc
lda malloc.mem
sta SCREEN_DIST
lda malloc.mem+1
sta SCREEN_DIST+1
lda #<$3e8
sta malloc.size
lda #>$3e8
sta malloc.size+1
jsr malloc
lda malloc.mem
sta SCREEN_ANGLE
lda malloc.mem+1
sta SCREEN_ANGLE+1
jsr main
rts
main: {
.const toD0181_return = (>(SCREEN1&$3fff)*4)|(>CHARSET)/4&$f
.const toD0182_return = (>(SCREEN2&$3fff)*4)|(>CHARSET)/4&$f
lda SCREEN_DIST
sta init_dist_screen.screen
lda SCREEN_DIST+1
sta init_dist_screen.screen+1
jsr init_dist_screen
lda SCREEN_ANGLE
sta init_angle_screen.screen
lda SCREEN_ANGLE+1
sta init_angle_screen.screen+1
jsr init_angle_screen
jsr make_plasma_charset
jsr memset
lda #0
sta sin_offset_y
sta sin_offset_x
// Show double-buffered plasma
b2:
lda #<SCREEN1
sta doplasma.screen
lda #>SCREEN1
sta doplasma.screen+1
jsr doplasma
lda #toD0181_return
sta D018
lda #<SCREEN2
sta doplasma.screen
lda #>SCREEN2
sta doplasma.screen+1
jsr doplasma
lda #toD0182_return
sta D018
jmp b2
}
// Render plasma to the passed screen
// doplasma(byte* zeropage(8) screen)
doplasma: {
.label angle = 4
.label dist = 6
.label sin_x = $3a
.label sin_y = $3c
.label screen = 8
.label y = $a
lda SCREEN_ANGLE
sta angle
lda SCREEN_ANGLE+1
sta angle+1
lda SCREEN_DIST
sta dist
lda SCREEN_DIST+1
sta dist+1
lda sin_offset_x
clc
adc #<SINTABLE
sta sin_x
lda #>SINTABLE
adc #0
sta sin_x+1
lda sin_offset_y
clc
adc #<SINTABLE
sta sin_y
lda #>SINTABLE
adc #0
sta sin_y+1
lda #0
sta y
b1:
ldx #0
b2:
txa
tay
lda (dist),y
sta $ff
lda (angle),y
tay
lda (sin_x),y
ldy $ff
clc
adc (sin_y),y
stx $ff
ldy $ff
sta (screen),y
inx
cpx #$28
bne b2
lda #$28
clc
adc screen
sta screen
bcc !+
inc screen+1
!:
lda #$28
clc
adc angle
sta angle
bcc !+
inc angle+1
!:
lda #$28
clc
adc dist
sta dist
bcc !+
inc dist+1
!:
inc y
lda #$1a
cmp y
bne b1
lax sin_offset_x
axs #3
stx sin_offset_x
lax sin_offset_y
axs #7
stx sin_offset_y
rts
}
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
memset: {
.const num = $3e8
.label str = COLS
.label end = str+num
.label dst = $b
lda #<str
sta dst
lda #>str
sta dst+1
b1:
lda #BLACK
ldy #0
sta (dst),y
inc dst
bne !+
inc dst+1
!:
lda dst+1
cmp #>end
bne b1
lda dst
cmp #<end
bne b1
rts
}
// Make a plasma-friendly charset where the chars are randomly filled
make_plasma_charset: {
.label _4 = $3f
.label _8 = $40
.label _9 = $40
.label s = $3e
.label i = $11
.label c = $d
.label _16 = $40
jsr sid_rnd_init
jsr print_cls
lda #<print_line_cursor
sta print_char_cursor
lda #>print_line_cursor
sta print_char_cursor+1
lda #0
sta c
sta c+1
b1:
lda c
tay
lda SINTABLE,y
sta s
lda #0
sta i
b2:
ldy #0
ldx #0
b3:
jsr sid_rnd
and #$ff
sta _4
lda s
cmp _4
bcs b4
tya
ora bittab,x
tay
b4:
inx
cpx #8
bcc b3
lda c
asl
sta _8
lda c+1
rol
sta _8+1
asl _8
rol _8+1
asl _8
rol _8+1
lda i
clc
adc _9
sta _9
bcc !+
inc _9+1
!:
clc
lda _16
adc #<CHARSET
sta _16
lda _16+1
adc #>CHARSET
sta _16+1
tya
ldy #0
sta (_16),y
inc i
lda i
cmp #8
bcc b2
lda c
and #7
cmp #0
bne b9
jsr print_char
b9:
inc c
bne !+
inc c+1
!:
lda c+1
cmp #>$100
bcc b1
bne !+
lda c
cmp #<$100
bcc b1
!:
rts
bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80
}
// Print a single char
print_char: {
.const ch = '.'
lda #ch
ldy #0
sta (print_char_cursor),y
inc print_char_cursor
bne !+
inc print_char_cursor+1
!:
rts
}
// Get a random number from the SID voice 3,
// Must be initialized with sid_rnd_init()
sid_rnd: {
lda SID_VOICE3_OSC
rts
}
// Clear the screen. Also resets current line/char cursor.
print_cls: {
.label sc = $12
lda #<print_line_cursor
sta sc
lda #>print_line_cursor
sta sc+1
b1:
lda #' '
ldy #0
sta (sc),y
inc sc
bne !+
inc sc+1
!:
lda sc+1
cmp #>print_line_cursor+$3e8
bne b1
lda sc
cmp #<print_line_cursor+$3e8
bne b1
rts
}
// Initialize SID voice 3 for random number generation
sid_rnd_init: {
lda #<$ffff
sta SID_VOICE3_FREQ
lda #>$ffff
sta SID_VOICE3_FREQ+1
lda #SID_CONTROL_NOISE
sta SID_VOICE3_CONTROL
rts
}
// Populates 1000 bytes (a screen) with values representing the angle to the center.
// Utilizes symmetry around the center
// init_angle_screen(byte* zeropage($15) screen)
init_angle_screen: {
.label _10 = $1f
.label screen = $15
.label screen_topline = $17
.label screen_bottomline = $15
.label xw = $42
.label yw = $44
.label angle_w = $1f
.label ang_w = $46
.label x = $19
.label xb = $1a
.label y = $14
lda screen
clc
adc #<$28*$c
sta screen_topline
lda screen+1
adc #>$28*$c
sta screen_topline+1
clc
lda screen_bottomline
adc #<$28*$c
sta screen_bottomline
lda screen_bottomline+1
adc #>$28*$c
sta screen_bottomline+1
lda #0
sta y
b1:
lda #$27
sta xb
lda #0
sta x
b2:
lda x
asl
eor #$ff
clc
adc #$27+1
ldy #0
sta xw+1
sty xw
lda y
asl
sta yw+1
sty yw
jsr atan2_16
lda #$80
clc
adc _10
sta _10
bcc !+
inc _10+1
!:
lda _10+1
sta ang_w
ldy xb
sta (screen_bottomline),y
eor #$ff
clc
adc #1
sta (screen_topline),y
lda #$80
clc
adc ang_w
ldy x
sta (screen_topline),y
lda #$80
sec
sbc ang_w
sta (screen_bottomline),y
inc x
dec xb
lda x
cmp #$13+1
bcc b2
lda screen_topline
sec
sbc #<$28
sta screen_topline
lda screen_topline+1
sbc #>$28
sta screen_topline+1
lda #$28
clc
adc screen_bottomline
sta screen_bottomline
bcc !+
inc screen_bottomline+1
!:
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($42) x, signed word zeropage($44) y)
atan2_16: {
.label _2 = $1b
.label _7 = $1d
.label yi = $1b
.label xi = $1d
.label angle = $1f
.label xd = $23
.label yd = $21
.label return = $1f
.label x = $42
.label y = $44
lda y+1
bmi !b1+
jmp b1
!b1:
sec
lda #0
sbc y
sta _2
lda #0
sbc y+1
sta _2+1
b3:
lda x+1
bmi !b4+
jmp b4
!b4:
sec
lda #0
sbc x
sta _7
lda #0
sbc x+1
sta _7+1
b6:
lda #0
sta angle
sta angle+1
tax
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:
txa
tay
lda xi
sta xd
lda xi+1
sta xd+1
lda yi
sta yd
lda yi+1
sta yd+1
b13:
cpy #2
bcs b14
cpy #0
beq b17
lda xd+1
cmp #$80
ror xd+1
ror xd
lda yd+1
cmp #$80
ror yd+1
ror yd
b17:
lda yi+1
bpl b18
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
txa
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
b19:
inx
cpx #CORDIC_ITERATIONS_16-1+1
bne !b12+
jmp b12
!b12:
jmp b10
b18:
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
txa
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 b19
b14:
lda xd+1
cmp #$80
ror xd+1
ror xd
lda xd+1
cmp #$80
ror xd+1
ror xd
lda yd+1
cmp #$80
ror yd+1
ror yd
lda yd+1
cmp #$80
ror yd+1
ror yd
dey
dey
jmp b13
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
}
// Populates 1000 bytes (a screen) with values representing the distance to the center.
// The actual value stored is distance*2 to increase precision
// init_dist_screen(byte* zeropage($26) screen)
init_dist_screen: {
.label screen = $26
.label screen_bottomline = $28
.label yds = $47
.label xds = $49
.label ds = $49
.label x = $2a
.label xb = $2b
.label screen_topline = $26
.label y = $25
jsr init_squares
lda screen
clc
adc #<$28*$18
sta screen_bottomline
lda screen+1
adc #>$28*$18
sta screen_bottomline+1
lda #0
sta y
b1:
lda y
asl
cmp #$18
bcs b2
eor #$ff
clc
adc #$18+1
b4:
jsr sqr
lda sqr.return
sta sqr.return_2
lda sqr.return+1
sta sqr.return_2+1
lda #$27
sta xb
lda #0
sta x
b5:
lda x
asl
cmp #$27
bcs b6
eor #$ff
clc
adc #$27+1
b8:
jsr sqr
lda ds
clc
adc yds
sta ds
lda ds+1
adc yds+1
sta ds+1
jsr sqrt
ldy x
sta (screen_topline),y
sta (screen_bottomline),y
ldy xb
sta (screen_topline),y
sta (screen_bottomline),y
inc x
dec xb
lda x
cmp #$13+1
bcc b5
lda #$28
clc
adc screen_topline
sta screen_topline
bcc !+
inc screen_topline+1
!:
lda screen_bottomline
sec
sbc #<$28
sta screen_bottomline
lda screen_bottomline+1
sbc #>$28
sta screen_bottomline+1
inc y
lda #$d
cmp y
bne b1
rts
b6:
sec
sbc #$27
jmp b8
b2:
sec
sbc #$18
jmp b4
}
// Find the (integer) square root of a word value
// If the square is not an integer then it returns the largest integer N where N*N <= val
// Uses a table of squares that must be initialized by calling init_squares()
// sqrt(word zeropage($49) val)
sqrt: {
.label _1 = $2c
.label _3 = $2c
.label found = $2c
.label val = $49
lda SQUARES
sta bsearch16u.items
lda SQUARES+1
sta bsearch16u.items+1
jsr bsearch16u
lda _3
sec
sbc SQUARES
sta _3
lda _3+1
sbc SQUARES+1
sta _3+1
lsr _1+1
ror _1
lda _1
rts
}
// Searches an array of nitems unsigned words, the initial member of which is pointed to by base, for a member that matches the value key.
// - key - The value to look for
// - items - Pointer to the start of the array to search in
// - num - The number of items in the array
// Returns pointer to an entry in the array that matches the search key
// bsearch16u(word zeropage($49) key, word* zeropage($2c) items, byte register(X) num)
bsearch16u: {
.label _2 = $2c
.label pivot = $4b
.label result = $4d
.label return = $2c
.label items = $2c
.label key = $49
ldx #NUM_SQUARES
b3:
cpx #0
bne b4
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq b2
!:
bcc b2
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
b2:
rts
b4:
txa
lsr
asl
clc
adc items
sta pivot
lda #0
adc items+1
sta pivot+1
sec
lda key
ldy #0
sbc (pivot),y
sta result
lda key+1
iny
sbc (pivot),y
sta result+1
bne b6
lda result
bne b6
lda pivot
sta return
lda pivot+1
sta return+1
rts
b6:
lda result+1
bmi b7
bne !+
lda result
beq b7
!:
lda #1*SIZEOF_WORD
clc
adc pivot
sta items
lda #0
adc pivot+1
sta items+1
dex
b7:
txa
lsr
tax
jmp b3
}
// Find the square of a byte value
// Uses a table of squares that must be initialized by calling init_squares()
// sqr(byte register(A) val)
sqr: {
.label return = $49
.label return_2 = $47
asl
tay
lda (SQUARES),y
sta return
iny
lda (SQUARES),y
sta return+1
rts
}
// Initialize squares table
// Uses iterative formula (x+1)^2 = x^2 + 2*x + 1
init_squares: {
.label squares = $30
.label sqr = $2e
lda #NUM_SQUARES*SIZEOF_WORD
sta malloc.size
lda #0
sta malloc.size+1
jsr malloc
lda SQUARES
sta squares
lda SQUARES+1
sta squares+1
ldx #0
txa
sta sqr
sta sqr+1
b1:
ldy #0
lda sqr
sta (squares),y
iny
lda sqr+1
sta (squares),y
lda #SIZEOF_WORD
clc
adc squares
sta squares
bcc !+
inc squares+1
!:
txa
asl
clc
adc #1
clc
adc sqr
sta sqr
bcc !+
inc sqr+1
!:
inx
cpx #NUM_SQUARES-1+1
bne b1
rts
}
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
// malloc(word zeropage($34) size)
malloc: {
.label mem = $4f
.label size = $34
lda heap_head
sta mem
lda heap_head+1
sta mem+1
lda heap_head
clc
adc size
sta heap_head
lda heap_head+1
adc size+1
sta heap_head+1
rts
}
// 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
.align $100
SINTABLE:
.for(var i=0;i<$200;i++)
.byte round(127.5+127.5*sin(2*PI*i/256))

View File

@ -0,0 +1,511 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call malloc
to:@3
@3: scope:[] from @1
[3] (void*) SCREEN_DIST#0 ← (void*)(byte*) malloc::mem#0
[4] call malloc
to:@4
@4: scope:[] from @3
[5] (void*) SCREEN_ANGLE#0 ← (void*)(byte*) malloc::mem#0
to:@2
@2: scope:[] from @4
[6] phi()
[7] call main
to:@end
@end: scope:[] from @2
[8] phi()
main: scope:[main] from @2
[9] (byte*) init_dist_screen::screen#0 ← (byte*)(void*) SCREEN_DIST#0
[10] call init_dist_screen
to:main::@5
main::@5: scope:[main] from main
[11] (byte*) init_angle_screen::screen#0 ← (byte*)(void*) SCREEN_ANGLE#0
[12] call init_angle_screen
to:main::@6
main::@6: scope:[main] from main::@5
[13] phi()
[14] call make_plasma_charset
to:main::@7
main::@7: scope:[main] from main::@6
[15] phi()
[16] call memset
to:main::@1
main::@1: scope:[main] from main::@4 main::@7
[17] (byte) sin_offset_y#14 ← phi( main::@7/(byte) 0 main::@4/(byte) sin_offset_y#12 )
[17] (byte) sin_offset_x#14 ← phi( main::@7/(byte) 0 main::@4/(byte) sin_offset_x#12 )
to:main::@2
main::@2: scope:[main] from main::@1
[18] phi()
[19] call doplasma
to:main::toD0181
main::toD0181: scope:[main] from main::@2
[20] phi()
to:main::@3
main::@3: scope:[main] from main::toD0181
[21] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0
[22] call doplasma
to:main::toD0182
main::toD0182: scope:[main] from main::@3
[23] phi()
to:main::@4
main::@4: scope:[main] from main::toD0182
[24] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0
to:main::@1
doplasma: scope:[doplasma] from main::@2 main::@3
[25] (byte*) doplasma::screen#6 ← phi( main::@2/(const byte*) SCREEN1#0 main::@3/(const byte*) SCREEN2#0 )
[25] (byte) sin_offset_y#10 ← phi( main::@2/(byte) sin_offset_y#14 main::@3/(byte) sin_offset_y#12 )
[25] (byte) sin_offset_x#10 ← phi( main::@2/(byte) sin_offset_x#14 main::@3/(byte) sin_offset_x#12 )
[26] (byte*) doplasma::angle#0 ← (byte*)(void*) SCREEN_ANGLE#0
[27] (byte*) doplasma::dist#0 ← (byte*)(void*) SCREEN_DIST#0
[28] (byte*) doplasma::sin_x#0 ← (const byte[$200]) SINTABLE#0 + (byte) sin_offset_x#10
[29] (byte*) doplasma::sin_y#0 ← (const byte[$200]) SINTABLE#0 + (byte) sin_offset_y#10
to:doplasma::@1
doplasma::@1: scope:[doplasma] from doplasma doplasma::@3
[30] (byte) doplasma::y#4 ← phi( doplasma/(byte) 0 doplasma::@3/(byte) doplasma::y#1 )
[30] (byte*) doplasma::screen#5 ← phi( doplasma/(byte*) doplasma::screen#6 doplasma::@3/(byte*) doplasma::screen#2 )
[30] (byte*) doplasma::dist#4 ← phi( doplasma/(byte*) doplasma::dist#0 doplasma::@3/(byte*) doplasma::dist#1 )
[30] (byte*) doplasma::angle#4 ← phi( doplasma/(byte*) doplasma::angle#0 doplasma::@3/(byte*) doplasma::angle#1 )
to:doplasma::@2
doplasma::@2: scope:[doplasma] from doplasma::@1 doplasma::@2
[31] (byte) doplasma::x#2 ← phi( doplasma::@1/(byte) 0 doplasma::@2/(byte) doplasma::x#1 )
[32] (byte~) doplasma::$2 ← *((byte*) doplasma::sin_x#0 + *((byte*) doplasma::angle#4 + (byte) doplasma::x#2)) + *((byte*) doplasma::sin_y#0 + *((byte*) doplasma::dist#4 + (byte) doplasma::x#2))
[33] *((byte*) doplasma::screen#5 + (byte) doplasma::x#2) ← (byte~) doplasma::$2
[34] (byte) doplasma::x#1 ← ++ (byte) doplasma::x#2
[35] if((byte) doplasma::x#1!=(byte) $28) goto doplasma::@2
to:doplasma::@3
doplasma::@3: scope:[doplasma] from doplasma::@2
[36] (byte*) doplasma::screen#2 ← (byte*) doplasma::screen#5 + (byte) $28
[37] (byte*) doplasma::angle#1 ← (byte*) doplasma::angle#4 + (byte) $28
[38] (byte*) doplasma::dist#1 ← (byte*) doplasma::dist#4 + (byte) $28
[39] (byte) doplasma::y#1 ← ++ (byte) doplasma::y#4
[40] if((byte) doplasma::y#1!=(byte) $1a) goto doplasma::@1
to:doplasma::@4
doplasma::@4: scope:[doplasma] from doplasma::@3
[41] (byte) sin_offset_x#12 ← (byte) sin_offset_x#10 - (byte) 3
[42] (byte) sin_offset_y#12 ← (byte) sin_offset_y#10 - (byte) 7
to:doplasma::@return
doplasma::@return: scope:[doplasma] from doplasma::@4
[43] return
to:@return
memset: scope:[memset] from main::@7
[44] phi()
to:memset::@1
memset::@1: scope:[memset] from memset memset::@1
[45] (byte*) memset::dst#2 ← phi( memset/(byte*)(const void*) memset::str#0 memset::@1/(byte*) memset::dst#1 )
[46] *((byte*) memset::dst#2) ← (const byte) BLACK#0
[47] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
[48] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@1
to:memset::@return
memset::@return: scope:[memset] from memset::@1
[49] return
to:@return
make_plasma_charset: scope:[make_plasma_charset] from main::@6
[50] phi()
[51] call sid_rnd_init
to:make_plasma_charset::@10
make_plasma_charset::@10: scope:[make_plasma_charset] from make_plasma_charset
[52] phi()
[53] call print_cls
to:make_plasma_charset::@1
make_plasma_charset::@1: scope:[make_plasma_charset] from make_plasma_charset::@10 make_plasma_charset::@9
[54] (byte*) print_char_cursor#49 ← phi( make_plasma_charset::@10/(const byte*) print_line_cursor#0 make_plasma_charset::@9/(byte*) print_char_cursor#18 )
[54] (word) make_plasma_charset::c#2 ← phi( make_plasma_charset::@10/(byte) 0 make_plasma_charset::@9/(word) make_plasma_charset::c#1 )
[55] (byte~) make_plasma_charset::$2 ← < (word) make_plasma_charset::c#2
[56] (byte) make_plasma_charset::s#0 ← *((const byte[$200]) SINTABLE#0 + (byte~) make_plasma_charset::$2)
to:make_plasma_charset::@2
make_plasma_charset::@2: scope:[make_plasma_charset] from make_plasma_charset::@1 make_plasma_charset::@6
[57] (byte) make_plasma_charset::i#7 ← phi( make_plasma_charset::@1/(byte) 0 make_plasma_charset::@6/(byte) make_plasma_charset::i#1 )
to:make_plasma_charset::@3
make_plasma_charset::@3: scope:[make_plasma_charset] from make_plasma_charset::@2 make_plasma_charset::@4
[58] (byte) make_plasma_charset::b#2 ← phi( make_plasma_charset::@2/(byte) 0 make_plasma_charset::@4/(byte) make_plasma_charset::b#3 )
[58] (byte) make_plasma_charset::ii#2 ← phi( make_plasma_charset::@2/(byte) 0 make_plasma_charset::@4/(byte) make_plasma_charset::ii#1 )
[59] call sid_rnd
[60] (byte) sid_rnd::return#2 ← (byte) sid_rnd::return#0
to:make_plasma_charset::@11
make_plasma_charset::@11: scope:[make_plasma_charset] from make_plasma_charset::@3
[61] (byte~) make_plasma_charset::$3 ← (byte) sid_rnd::return#2
[62] (byte~) make_plasma_charset::$4 ← (byte~) make_plasma_charset::$3 & (byte) $ff
[63] if((byte~) make_plasma_charset::$4<=(byte) make_plasma_charset::s#0) goto make_plasma_charset::@4
to:make_plasma_charset::@5
make_plasma_charset::@5: scope:[make_plasma_charset] from make_plasma_charset::@11
[64] (byte) make_plasma_charset::b#1 ← (byte) make_plasma_charset::b#2 | *((const byte[8]) make_plasma_charset::bittab#0 + (byte) make_plasma_charset::ii#2)
to:make_plasma_charset::@4
make_plasma_charset::@4: scope:[make_plasma_charset] from make_plasma_charset::@11 make_plasma_charset::@5
[65] (byte) make_plasma_charset::b#3 ← phi( make_plasma_charset::@11/(byte) make_plasma_charset::b#2 make_plasma_charset::@5/(byte) make_plasma_charset::b#1 )
[66] (byte) make_plasma_charset::ii#1 ← ++ (byte) make_plasma_charset::ii#2
[67] if((byte) make_plasma_charset::ii#1<(byte) 8) goto make_plasma_charset::@3
to:make_plasma_charset::@6
make_plasma_charset::@6: scope:[make_plasma_charset] from make_plasma_charset::@4
[68] (word~) make_plasma_charset::$8 ← (word) make_plasma_charset::c#2 << (byte) 3
[69] (word~) make_plasma_charset::$9 ← (word~) make_plasma_charset::$8 + (byte) make_plasma_charset::i#7
[70] (byte*~) make_plasma_charset::$16 ← (const byte*) CHARSET#0 + (word~) make_plasma_charset::$9
[71] *((byte*~) make_plasma_charset::$16) ← (byte) make_plasma_charset::b#3
[72] (byte) make_plasma_charset::i#1 ← ++ (byte) make_plasma_charset::i#7
[73] if((byte) make_plasma_charset::i#1<(byte) 8) goto make_plasma_charset::@2
to:make_plasma_charset::@7
make_plasma_charset::@7: scope:[make_plasma_charset] from make_plasma_charset::@6
[74] (byte~) make_plasma_charset::$11 ← (word) make_plasma_charset::c#2 & (byte) 7
[75] if((byte~) make_plasma_charset::$11!=(byte) 0) goto make_plasma_charset::@9
to:make_plasma_charset::@8
make_plasma_charset::@8: scope:[make_plasma_charset] from make_plasma_charset::@7
[76] phi()
[77] call print_char
to:make_plasma_charset::@9
make_plasma_charset::@9: scope:[make_plasma_charset] from make_plasma_charset::@7 make_plasma_charset::@8
[78] (byte*) print_char_cursor#18 ← phi( make_plasma_charset::@8/(byte*) print_char_cursor#1 make_plasma_charset::@7/(byte*) print_char_cursor#49 )
[79] (word) make_plasma_charset::c#1 ← ++ (word) make_plasma_charset::c#2
[80] if((word) make_plasma_charset::c#1<(word) $100) goto make_plasma_charset::@1
to:make_plasma_charset::@return
make_plasma_charset::@return: scope:[make_plasma_charset] from make_plasma_charset::@9
[81] return
to:@return
print_char: scope:[print_char] from make_plasma_charset::@8
[82] *((byte*) print_char_cursor#49) ← (const byte) print_char::ch#0
[83] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#49
to:print_char::@return
print_char::@return: scope:[print_char] from print_char
[84] return
to:@return
sid_rnd: scope:[sid_rnd] from make_plasma_charset::@3
[85] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0)
to:sid_rnd::@return
sid_rnd::@return: scope:[sid_rnd] from sid_rnd
[86] return
to:@return
print_cls: scope:[print_cls] from make_plasma_charset::@10
[87] phi()
to:print_cls::@1
print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
[88] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 )
[89] *((byte*) print_cls::sc#2) ← (byte) ' '
[90] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2
[91] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word) $3e8) goto print_cls::@1
to:print_cls::@return
print_cls::@return: scope:[print_cls] from print_cls::@1
[92] return
to:@return
sid_rnd_init: scope:[sid_rnd_init] from make_plasma_charset
[93] *((const word*) SID_VOICE3_FREQ#0) ← (word) $ffff
[94] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0
to:sid_rnd_init::@return
sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init
[95] return
to:@return
init_angle_screen: scope:[init_angle_screen] from main::@5
[96] (byte*) init_angle_screen::screen_topline#0 ← (byte*) init_angle_screen::screen#0 + (word)(number) $28*(number) $c
[97] (byte*) init_angle_screen::screen_bottomline#0 ← (byte*) init_angle_screen::screen#0 + (word)(number) $28*(number) $c
to:init_angle_screen::@1
init_angle_screen::@1: scope:[init_angle_screen] from init_angle_screen init_angle_screen::@3
[98] (byte*) init_angle_screen::screen_topline#5 ← phi( init_angle_screen/(byte*) init_angle_screen::screen_topline#0 init_angle_screen::@3/(byte*) init_angle_screen::screen_topline#1 )
[98] (byte*) init_angle_screen::screen_bottomline#5 ← phi( init_angle_screen/(byte*) init_angle_screen::screen_bottomline#0 init_angle_screen::@3/(byte*) init_angle_screen::screen_bottomline#1 )
[98] (byte) init_angle_screen::y#4 ← phi( init_angle_screen/(byte) 0 init_angle_screen::@3/(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
[99] (byte) init_angle_screen::xb#2 ← phi( init_angle_screen::@1/(byte) $27 init_angle_screen::@4/(byte) init_angle_screen::xb#1 )
[99] (byte) init_angle_screen::x#2 ← phi( init_angle_screen::@1/(byte) 0 init_angle_screen::@4/(byte) init_angle_screen::x#1 )
[100] (byte~) init_angle_screen::$2 ← (byte) init_angle_screen::x#2 << (byte) 1
[101] (byte~) init_angle_screen::$3 ← (byte) $27 - (byte~) init_angle_screen::$2
[102] (word) init_angle_screen::xw#0 ← (byte~) init_angle_screen::$3 w= (byte) 0
[103] (byte~) init_angle_screen::$6 ← (byte) init_angle_screen::y#4 << (byte) 1
[104] (word) init_angle_screen::yw#0 ← (byte~) init_angle_screen::$6 w= (byte) 0
[105] (signed word) atan2_16::x#0 ← (signed word)(word) init_angle_screen::xw#0
[106] (signed word) atan2_16::y#0 ← (signed word)(word) init_angle_screen::yw#0
[107] call atan2_16
[108] (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
[109] (word) init_angle_screen::angle_w#0 ← (word) atan2_16::return#2
[110] (word~) init_angle_screen::$10 ← (word) init_angle_screen::angle_w#0 + (byte) $80
[111] (byte) init_angle_screen::ang_w#0 ← > (word~) init_angle_screen::$10
[112] *((byte*) init_angle_screen::screen_bottomline#5 + (byte) init_angle_screen::xb#2) ← (byte) init_angle_screen::ang_w#0
[113] (byte~) init_angle_screen::$12 ← - (byte) init_angle_screen::ang_w#0
[114] *((byte*) init_angle_screen::screen_topline#5 + (byte) init_angle_screen::xb#2) ← (byte~) init_angle_screen::$12
[115] (byte~) init_angle_screen::$13 ← (byte) $80 + (byte) init_angle_screen::ang_w#0
[116] *((byte*) init_angle_screen::screen_topline#5 + (byte) init_angle_screen::x#2) ← (byte~) init_angle_screen::$13
[117] (byte~) init_angle_screen::$14 ← (byte) $80 - (byte) init_angle_screen::ang_w#0
[118] *((byte*) init_angle_screen::screen_bottomline#5 + (byte) init_angle_screen::x#2) ← (byte~) init_angle_screen::$14
[119] (byte) init_angle_screen::x#1 ← ++ (byte) init_angle_screen::x#2
[120] (byte) init_angle_screen::xb#1 ← -- (byte) init_angle_screen::xb#2
[121] if((byte) init_angle_screen::x#1<(byte) $13+(byte) 1) goto init_angle_screen::@2
to:init_angle_screen::@3
init_angle_screen::@3: scope:[init_angle_screen] from init_angle_screen::@4
[122] (byte*) init_angle_screen::screen_topline#1 ← (byte*) init_angle_screen::screen_topline#5 - (byte) $28
[123] (byte*) init_angle_screen::screen_bottomline#1 ← (byte*) init_angle_screen::screen_bottomline#5 + (byte) $28
[124] (byte) init_angle_screen::y#1 ← ++ (byte) init_angle_screen::y#4
[125] if((byte) init_angle_screen::y#1!=(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
[126] return
to:@return
atan2_16: scope:[atan2_16] from init_angle_screen::@2
[127] 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
[128] (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
[129] (signed word) atan2_16::yi#0 ← phi( atan2_16::@1/(signed word~) atan2_16::yi#16 atan2_16::@2/(signed word~) atan2_16::$2 )
[130] 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
[131] (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
[132] (signed word) atan2_16::xi#0 ← phi( atan2_16::@4/(signed word~) atan2_16::xi#13 atan2_16::@5/(signed word~) atan2_16::$7 )
to:atan2_16::@10
atan2_16::@10: scope:[atan2_16] from atan2_16::@19 atan2_16::@6
[133] (word) atan2_16::angle#12 ← phi( atan2_16::@19/(word) atan2_16::angle#13 atan2_16::@6/(byte) 0 )
[133] (byte) atan2_16::i#2 ← phi( atan2_16::@19/(byte) atan2_16::i#1 atan2_16::@6/(byte) 0 )
[133] (signed word) atan2_16::xi#3 ← phi( atan2_16::@19/(signed word) atan2_16::xi#8 atan2_16::@6/(signed word) atan2_16::xi#0 )
[133] (signed word) atan2_16::yi#3 ← phi( atan2_16::@19/(signed word) atan2_16::yi#8 atan2_16::@6/(signed word) atan2_16::yi#0 )
[134] 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::@19
[135] (word) atan2_16::angle#6 ← phi( atan2_16::@10/(word) atan2_16::angle#12 atan2_16::@19/(word) atan2_16::angle#13 )
[136] (word) atan2_16::angle#1 ← (word) atan2_16::angle#6 >> (byte) 1
[137] if((signed word) atan2_16::x#0>=(signed byte) 0) goto atan2_16::@7
to:atan2_16::@21
atan2_16::@21: scope:[atan2_16] from atan2_16::@12
[138] (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::@21
[139] (word) atan2_16::angle#11 ← phi( atan2_16::@12/(word) atan2_16::angle#1 atan2_16::@21/(word) atan2_16::angle#4 )
[140] 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
[141] (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
[142] (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
[143] return
to:@return
atan2_16::@11: scope:[atan2_16] from atan2_16::@10
[144] (byte~) atan2_16::shift#5 ← (byte) atan2_16::i#2
[145] (signed word~) atan2_16::xd#10 ← (signed word) atan2_16::xi#3
[146] (signed word~) atan2_16::yd#10 ← (signed word) atan2_16::yi#3
to:atan2_16::@13
atan2_16::@13: scope:[atan2_16] from atan2_16::@11 atan2_16::@14
[147] (signed word) atan2_16::yd#3 ← phi( atan2_16::@11/(signed word~) atan2_16::yd#10 atan2_16::@14/(signed word) atan2_16::yd#1 )
[147] (signed word) atan2_16::xd#3 ← phi( atan2_16::@11/(signed word~) atan2_16::xd#10 atan2_16::@14/(signed word) atan2_16::xd#1 )
[147] (byte) atan2_16::shift#2 ← phi( atan2_16::@11/(byte~) atan2_16::shift#5 atan2_16::@14/(byte) atan2_16::shift#1 )
[148] if((byte) atan2_16::shift#2>=(byte) 2) goto atan2_16::@14
to:atan2_16::@15
atan2_16::@15: scope:[atan2_16] from atan2_16::@13
[149] if((byte) 0==(byte) atan2_16::shift#2) goto atan2_16::@17
to:atan2_16::@16
atan2_16::@16: scope:[atan2_16] from atan2_16::@15
[150] (signed word) atan2_16::xd#2 ← (signed word) atan2_16::xd#3 >> (signed byte) 1
[151] (signed word) atan2_16::yd#2 ← (signed word) atan2_16::yd#3 >> (signed byte) 1
to:atan2_16::@17
atan2_16::@17: scope:[atan2_16] from atan2_16::@15 atan2_16::@16
[152] (signed word) atan2_16::xd#5 ← phi( atan2_16::@15/(signed word) atan2_16::xd#3 atan2_16::@16/(signed word) atan2_16::xd#2 )
[152] (signed word) atan2_16::yd#5 ← phi( atan2_16::@15/(signed word) atan2_16::yd#3 atan2_16::@16/(signed word) atan2_16::yd#2 )
[153] if((signed word) atan2_16::yi#3>=(signed byte) 0) goto atan2_16::@18
to:atan2_16::@20
atan2_16::@20: scope:[atan2_16] from atan2_16::@17
[154] (signed word) atan2_16::xi#2 ← (signed word) atan2_16::xi#3 - (signed word) atan2_16::yd#5
[155] (signed word) atan2_16::yi#2 ← (signed word) atan2_16::yi#3 + (signed word) atan2_16::xd#5
[156] (byte~) atan2_16::$24 ← (byte) atan2_16::i#2 << (byte) 1
[157] (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::@19
atan2_16::@19: scope:[atan2_16] from atan2_16::@18 atan2_16::@20
[158] (signed word) atan2_16::xi#8 ← phi( atan2_16::@18/(signed word) atan2_16::xi#1 atan2_16::@20/(signed word) atan2_16::xi#2 )
[158] (word) atan2_16::angle#13 ← phi( atan2_16::@18/(word) atan2_16::angle#2 atan2_16::@20/(word) atan2_16::angle#3 )
[158] (signed word) atan2_16::yi#8 ← phi( atan2_16::@18/(signed word) atan2_16::yi#1 atan2_16::@20/(signed word) atan2_16::yi#2 )
[159] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2
[160] 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::@18: scope:[atan2_16] from atan2_16::@17
[161] (signed word) atan2_16::xi#1 ← (signed word) atan2_16::xi#3 + (signed word) atan2_16::yd#5
[162] (signed word) atan2_16::yi#1 ← (signed word) atan2_16::yi#3 - (signed word) atan2_16::xd#5
[163] (byte~) atan2_16::$23 ← (byte) atan2_16::i#2 << (byte) 1
[164] (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::@19
atan2_16::@14: scope:[atan2_16] from atan2_16::@13
[165] (signed word) atan2_16::xd#1 ← (signed word) atan2_16::xd#3 >> (signed byte) 2
[166] (signed word) atan2_16::yd#1 ← (signed word) atan2_16::yd#3 >> (signed byte) 2
[167] (byte) atan2_16::shift#1 ← (byte) atan2_16::shift#2 - (byte) 2
to:atan2_16::@13
atan2_16::@4: scope:[atan2_16] from atan2_16::@3
[168] (signed word~) atan2_16::xi#13 ← (signed word) atan2_16::x#0
to:atan2_16::@6
atan2_16::@1: scope:[atan2_16] from atan2_16
[169] (signed word~) atan2_16::yi#16 ← (signed word) atan2_16::y#0
to:atan2_16::@3
init_dist_screen: scope:[init_dist_screen] from main
[170] phi()
[171] call init_squares
to:init_dist_screen::@10
init_dist_screen::@10: scope:[init_dist_screen] from init_dist_screen
[172] (byte*) init_dist_screen::screen_bottomline#0 ← (byte*) init_dist_screen::screen#0 + (word)(number) $28*(number) $18
to:init_dist_screen::@1
init_dist_screen::@1: scope:[init_dist_screen] from init_dist_screen::@10 init_dist_screen::@9
[173] (byte*) init_dist_screen::screen_bottomline#10 ← phi( init_dist_screen::@9/(byte*) init_dist_screen::screen_bottomline#1 init_dist_screen::@10/(byte*) init_dist_screen::screen_bottomline#0 )
[173] (byte*) init_dist_screen::screen_topline#10 ← phi( init_dist_screen::@9/(byte*) init_dist_screen::screen_topline#1 init_dist_screen::@10/(byte*) init_dist_screen::screen#0 )
[173] (byte) init_dist_screen::y#10 ← phi( init_dist_screen::@9/(byte) init_dist_screen::y#1 init_dist_screen::@10/(byte) 0 )
[174] (byte) init_dist_screen::y2#0 ← (byte) init_dist_screen::y#10 << (byte) 1
[175] if((byte) init_dist_screen::y2#0>=(byte) $18) goto init_dist_screen::@2
to:init_dist_screen::@3
init_dist_screen::@3: scope:[init_dist_screen] from init_dist_screen::@1
[176] (byte~) init_dist_screen::$5 ← (byte) $18 - (byte) init_dist_screen::y2#0
to:init_dist_screen::@4
init_dist_screen::@4: scope:[init_dist_screen] from init_dist_screen::@2 init_dist_screen::@3
[177] (byte) init_dist_screen::yd#0 ← phi( init_dist_screen::@2/(byte~) init_dist_screen::$7 init_dist_screen::@3/(byte~) init_dist_screen::$5 )
[178] (byte) sqr::val#0 ← (byte) init_dist_screen::yd#0
[179] call sqr
[180] (word) sqr::return#2 ← (word) sqr::return#0
to:init_dist_screen::@11
init_dist_screen::@11: scope:[init_dist_screen] from init_dist_screen::@4
[181] (word) init_dist_screen::yds#0 ← (word) sqr::return#2
to:init_dist_screen::@5
init_dist_screen::@5: scope:[init_dist_screen] from init_dist_screen::@11 init_dist_screen::@13
[182] (byte) init_dist_screen::xb#2 ← phi( init_dist_screen::@11/(byte) $27 init_dist_screen::@13/(byte) init_dist_screen::xb#1 )
[182] (byte) init_dist_screen::x#2 ← phi( init_dist_screen::@11/(byte) 0 init_dist_screen::@13/(byte) init_dist_screen::x#1 )
[183] (byte) init_dist_screen::x2#0 ← (byte) init_dist_screen::x#2 << (byte) 1
[184] if((byte) init_dist_screen::x2#0>=(byte) $27) goto init_dist_screen::@6
to:init_dist_screen::@7
init_dist_screen::@7: scope:[init_dist_screen] from init_dist_screen::@5
[185] (byte~) init_dist_screen::$13 ← (byte) $27 - (byte) init_dist_screen::x2#0
to:init_dist_screen::@8
init_dist_screen::@8: scope:[init_dist_screen] from init_dist_screen::@6 init_dist_screen::@7
[186] (byte) init_dist_screen::xd#0 ← phi( init_dist_screen::@6/(byte~) init_dist_screen::$15 init_dist_screen::@7/(byte~) init_dist_screen::$13 )
[187] (byte) sqr::val#1 ← (byte) init_dist_screen::xd#0
[188] call sqr
[189] (word) sqr::return#3 ← (word) sqr::return#0
to:init_dist_screen::@12
init_dist_screen::@12: scope:[init_dist_screen] from init_dist_screen::@8
[190] (word) init_dist_screen::xds#0 ← (word) sqr::return#3
[191] (word) init_dist_screen::ds#0 ← (word) init_dist_screen::xds#0 + (word) init_dist_screen::yds#0
[192] (word) sqrt::val#0 ← (word) init_dist_screen::ds#0
[193] call sqrt
[194] (byte) sqrt::return#2 ← (byte) sqrt::return#0
to:init_dist_screen::@13
init_dist_screen::@13: scope:[init_dist_screen] from init_dist_screen::@12
[195] (byte) init_dist_screen::d#0 ← (byte) sqrt::return#2
[196] *((byte*) init_dist_screen::screen_topline#10 + (byte) init_dist_screen::x#2) ← (byte) init_dist_screen::d#0
[197] *((byte*) init_dist_screen::screen_bottomline#10 + (byte) init_dist_screen::x#2) ← (byte) init_dist_screen::d#0
[198] *((byte*) init_dist_screen::screen_topline#10 + (byte) init_dist_screen::xb#2) ← (byte) init_dist_screen::d#0
[199] *((byte*) init_dist_screen::screen_bottomline#10 + (byte) init_dist_screen::xb#2) ← (byte) init_dist_screen::d#0
[200] (byte) init_dist_screen::x#1 ← ++ (byte) init_dist_screen::x#2
[201] (byte) init_dist_screen::xb#1 ← -- (byte) init_dist_screen::xb#2
[202] if((byte) init_dist_screen::x#1<(byte) $13+(byte) 1) goto init_dist_screen::@5
to:init_dist_screen::@9
init_dist_screen::@9: scope:[init_dist_screen] from init_dist_screen::@13
[203] (byte*) init_dist_screen::screen_topline#1 ← (byte*) init_dist_screen::screen_topline#10 + (byte) $28
[204] (byte*) init_dist_screen::screen_bottomline#1 ← (byte*) init_dist_screen::screen_bottomline#10 - (byte) $28
[205] (byte) init_dist_screen::y#1 ← ++ (byte) init_dist_screen::y#10
[206] if((byte) init_dist_screen::y#1!=(byte) $d) goto init_dist_screen::@1
to:init_dist_screen::@return
init_dist_screen::@return: scope:[init_dist_screen] from init_dist_screen::@9
[207] return
to:@return
init_dist_screen::@6: scope:[init_dist_screen] from init_dist_screen::@5
[208] (byte~) init_dist_screen::$15 ← (byte) init_dist_screen::x2#0 - (byte) $27
to:init_dist_screen::@8
init_dist_screen::@2: scope:[init_dist_screen] from init_dist_screen::@1
[209] (byte~) init_dist_screen::$7 ← (byte) init_dist_screen::y2#0 - (byte) $18
to:init_dist_screen::@4
sqrt: scope:[sqrt] from init_dist_screen::@12
[210] (word) bsearch16u::key#0 ← (word) sqrt::val#0
[211] (word*) bsearch16u::items#1 ← (word*)(void*) SQUARES#1
[212] call bsearch16u
[213] (word*) bsearch16u::return#3 ← (word*) bsearch16u::return#1
to:sqrt::@1
sqrt::@1: scope:[sqrt] from sqrt
[214] (word*) sqrt::found#0 ← (word*) bsearch16u::return#3
[215] (word~) sqrt::$3 ← (word*) sqrt::found#0 - (word*)(void*) SQUARES#1
[216] (word~) sqrt::$1 ← (word~) sqrt::$3 >> (byte) 1
[217] (byte) sqrt::return#0 ← (byte)(word~) sqrt::$1
to:sqrt::@return
sqrt::@return: scope:[sqrt] from sqrt::@1
[218] return
to:@return
bsearch16u: scope:[bsearch16u] from sqrt
[219] phi()
to:bsearch16u::@3
bsearch16u::@3: scope:[bsearch16u] from bsearch16u bsearch16u::@7
[220] (word*) bsearch16u::items#2 ← phi( bsearch16u/(word*) bsearch16u::items#1 bsearch16u::@7/(word*) bsearch16u::items#8 )
[220] (byte) bsearch16u::num#3 ← phi( bsearch16u/(const byte) NUM_SQUARES#3 bsearch16u::@7/(byte) bsearch16u::num#0 )
[221] if((byte) bsearch16u::num#3>(byte) 0) goto bsearch16u::@4
to:bsearch16u::@5
bsearch16u::@5: scope:[bsearch16u] from bsearch16u::@3
[222] if(*((word*) bsearch16u::items#2)<=(word) bsearch16u::key#0) goto bsearch16u::@2
to:bsearch16u::@1
bsearch16u::@1: scope:[bsearch16u] from bsearch16u::@5
[223] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#2 - (byte) 1*(const byte) SIZEOF_WORD
to:bsearch16u::@2
bsearch16u::@2: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@5
[224] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#2 bsearch16u::@1/(word*~) bsearch16u::$2 )
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@8
[225] (word*) bsearch16u::return#1 ← phi( bsearch16u::@8/(word*~) bsearch16u::return#6 bsearch16u::@2/(word*) bsearch16u::return#2 )
[226] return
to:@return
bsearch16u::@4: scope:[bsearch16u] from bsearch16u::@3
[227] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#3 >> (byte) 1
[228] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[229] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#2 + (byte~) bsearch16u::$16
[230] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[231] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@4
[232] (word*~) bsearch16u::return#6 ← (word*) bsearch16u::pivot#0
to:bsearch16u::@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[233] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@7
to:bsearch16u::@9
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@6
[234] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[235] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#3
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@6 bsearch16u::@9
[236] (word*) bsearch16u::items#8 ← phi( bsearch16u::@9/(word*) bsearch16u::items#0 bsearch16u::@6/(word*) bsearch16u::items#2 )
[236] (byte) bsearch16u::num#5 ← phi( bsearch16u::@9/(byte) bsearch16u::num#1 bsearch16u::@6/(byte) bsearch16u::num#3 )
[237] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
sqr: scope:[sqr] from init_dist_screen::@4 init_dist_screen::@8
[238] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[239] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[240] (word) sqr::return#0 ← *((word*)(void*) SQUARES#1 + (byte~) sqr::$0)
to:sqr::@return
sqr::@return: scope:[sqr] from sqr
[241] return
to:@return
init_squares: scope:[init_squares] from init_dist_screen
[242] phi()
[243] call malloc
to:init_squares::@2
init_squares::@2: scope:[init_squares] from init_squares
[244] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[245] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares::@1 init_squares::@2
[246] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 )
[246] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 )
[246] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(byte) 0 )
[247] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[248] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[249] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[250] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[251] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[252] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[253] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1
[254] return
to:@return
malloc: scope:[malloc] from @1 @3 init_squares
[255] (word) malloc::size#3 ← phi( @1/(word) $3e8 @3/(word) $3e8 init_squares/(const byte) NUM_SQUARES#3*(const byte) SIZEOF_WORD )
[255] (byte*) heap_head#12 ← phi( @1/(const byte*) HEAP_START#0 @3/(byte*) heap_head#1 init_squares/(byte*) heap_head#1 )
[256] (byte*) malloc::mem#0 ← (byte*) heap_head#12
[257] (byte*) heap_head#1 ← (byte*) heap_head#12 + (word) malloc::size#3
to:malloc::@return
malloc::@return: scope:[malloc] from malloc
[258] return
to:@return

11650
src/test/ref/plasma-center.log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,532 @@
(label) @1
(label) @2
(label) @3
(label) @4
(label) @begin
(label) @end
(byte) BLACK
(const byte) BLACK#0 BLACK = (byte) 0
(byte*) CHARSET
(const byte*) CHARSET#0 CHARSET = (byte*) 8192
(byte*) COLS
(const byte*) COLS#0 COLS = (byte*) 55296
(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
}}
(byte) CORDIC_ITERATIONS_16
(const byte) CORDIC_ITERATIONS_16#0 CORDIC_ITERATIONS_16 = (byte) $f
(byte*) D018
(const byte*) D018#0 D018 = (byte*) 53272
(byte*) HEAP_START
(const byte*) HEAP_START#0 HEAP_START = (byte*) 49152
(byte) NUM_SQUARES
(const byte) NUM_SQUARES#3 NUM_SQUARES = (byte) $30
(byte*) SCREEN1
(const byte*) SCREEN1#0 SCREEN1 = (byte*) 10240
(byte*) SCREEN2
(const byte*) SCREEN2#0 SCREEN2 = (byte*) 11264
(byte*) SCREEN_ANGLE
(void*) SCREEN_ANGLE#0 SCREEN_ANGLE zp ZP_WORD:56 0.05405405405405406
(byte*) SCREEN_DIST
(void*) SCREEN_DIST#0 SCREEN_DIST zp ZP_WORD:54 0.05128205128205128
(byte) SID_CONTROL_NOISE
(const byte) SID_CONTROL_NOISE#0 SID_CONTROL_NOISE = (byte) $80
(byte*) SID_VOICE3_CONTROL
(const byte*) SID_VOICE3_CONTROL#0 SID_VOICE3_CONTROL = (byte*) 54290
(word*) SID_VOICE3_FREQ
(const word*) SID_VOICE3_FREQ#0 SID_VOICE3_FREQ = (word*) 54286
(byte*) SID_VOICE3_OSC
(const byte*) SID_VOICE3_OSC#0 SID_VOICE3_OSC = (byte*) 54299
(byte[$200]) SINTABLE
(const byte[$200]) SINTABLE#0 SINTABLE = kickasm {{ .for(var i=0;i<$200;i++)
.byte round(127.5+127.5*sin(2*PI*i/256))
}}
(const byte) SIZEOF_WORD SIZEOF_WORD = (byte) 2
(word*) SQUARES
(void*) SQUARES#1 SQUARES zp ZP_WORD:79 0.03225806451612903
(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y)
(signed word~) atan2_16::$2 $2 zp ZP_WORD:27 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:29 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::@17
(label) atan2_16::@18
(label) atan2_16::@19
(label) atan2_16::@2
(label) atan2_16::@20
(label) atan2_16::@21
(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:31 3.0
(word) atan2_16::angle#11 angle zp ZP_WORD:31 4.0
(word) atan2_16::angle#12 angle zp ZP_WORD:31 190.66666666666666
(word) atan2_16::angle#13 angle zp ZP_WORD:31 1334.6666666666667
(word) atan2_16::angle#2 angle zp ZP_WORD:31 2002.0
(word) atan2_16::angle#3 angle zp ZP_WORD:31 2002.0
(word) atan2_16::angle#4 angle zp ZP_WORD:31 4.0
(word) atan2_16::angle#5 angle zp ZP_WORD:31 4.0
(word) atan2_16::angle#6 angle zp ZP_WORD:31 2004.0
(byte) atan2_16::i
(byte) atan2_16::i#1 reg byte x 1501.5
(byte) atan2_16::i#2 reg byte x 208.54166666666669
(word) atan2_16::return
(word) atan2_16::return#0 return zp ZP_WORD:31 34.99999999999999
(word) atan2_16::return#2 return zp ZP_WORD:31 202.0
(byte) atan2_16::shift
(byte) atan2_16::shift#1 reg byte y 20002.0
(byte) atan2_16::shift#2 reg byte y 8001.25
(byte~) atan2_16::shift#5 reg byte y 667.3333333333334
(signed word) atan2_16::x
(signed word) atan2_16::x#0 x zp ZP_WORD:66 2.8684210526315796
(signed word) atan2_16::xd
(signed word) atan2_16::xd#1 xd zp ZP_WORD:35 6667.333333333333
(signed word~) atan2_16::xd#10 xd zp ZP_WORD:35 1001.0
(signed word) atan2_16::xd#2 xd zp ZP_WORD:35 1001.0
(signed word) atan2_16::xd#3 xd zp ZP_WORD:35 7668.333333333332
(signed word) atan2_16::xd#5 xd zp ZP_WORD:35 1001.0
(signed word) atan2_16::xi
(signed word) atan2_16::xi#0 xi zp ZP_WORD:29 6.0
(signed word) atan2_16::xi#1 xi zp ZP_WORD:29 500.5
(signed word~) atan2_16::xi#13 xi zp ZP_WORD:29 4.0
(signed word) atan2_16::xi#2 xi zp ZP_WORD:29 500.5
(signed word) atan2_16::xi#3 xi zp ZP_WORD:29 267.0666666666667
(signed word) atan2_16::xi#8 xi zp ZP_WORD:29 1001.0
(signed word) atan2_16::y
(signed word) atan2_16::y#0 y zp ZP_WORD:68 2.724999999999999
(signed word) atan2_16::yd
(signed word) atan2_16::yd#1 yd zp ZP_WORD:33 10001.0
(signed word~) atan2_16::yd#10 yd zp ZP_WORD:33 2002.0
(signed word) atan2_16::yd#2 yd zp ZP_WORD:33 2002.0
(signed word) atan2_16::yd#3 yd zp ZP_WORD:33 4601.0
(signed word) atan2_16::yd#5 yd zp ZP_WORD:33 2002.0
(signed word) atan2_16::yi
(signed word) atan2_16::yi#0 yi zp ZP_WORD:27 1.2000000000000002
(signed word) atan2_16::yi#1 yi zp ZP_WORD:27 667.3333333333334
(signed word~) atan2_16::yi#16 yi zp ZP_WORD:27 4.0
(signed word) atan2_16::yi#2 yi zp ZP_WORD:27 667.3333333333334
(signed word) atan2_16::yi#3 yi zp ZP_WORD:27 353.4117647058823
(signed word) atan2_16::yi#8 yi zp ZP_WORD:27 1001.0
(word*()) bsearch16u((word) bsearch16u::key , (word*) bsearch16u::items , (byte) bsearch16u::num)
(byte~) bsearch16u::$16 reg byte a 2002.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:44 4.0
(byte~) bsearch16u::$6 reg byte a 2002.0
(label) bsearch16u::@1
(label) bsearch16u::@2
(label) bsearch16u::@3
(label) bsearch16u::@4
(label) bsearch16u::@5
(label) bsearch16u::@6
(label) bsearch16u::@7
(label) bsearch16u::@8
(label) bsearch16u::@9
(label) bsearch16u::@return
(word*) bsearch16u::items
(word*) bsearch16u::items#0 items zp ZP_WORD:44 1001.0
(word*) bsearch16u::items#1 items zp ZP_WORD:44 2.0
(word*) bsearch16u::items#2 items zp ZP_WORD:44 334.5555555555556
(word*) bsearch16u::items#8 items zp ZP_WORD:44 1501.5
(word) bsearch16u::key
(word) bsearch16u::key#0 key zp ZP_WORD:73 0.26666666666666666
(byte) bsearch16u::num
(byte) bsearch16u::num#0 reg byte x 2002.0
(byte) bsearch16u::num#1 reg byte x 2002.0
(byte) bsearch16u::num#3 reg byte x 556.1111111111111
(byte) bsearch16u::num#5 reg byte x 3003.0
(word*) bsearch16u::pivot
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:75 501.0
(signed word) bsearch16u::result
(signed word) bsearch16u::result#0 result zp ZP_WORD:77 1501.5
(word*) bsearch16u::return
(word*) bsearch16u::return#1 return zp ZP_WORD:44 2.0
(word*) bsearch16u::return#2 return zp ZP_WORD:44 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:44 4.0
(word*~) bsearch16u::return#6 return zp ZP_WORD:44 4.0
(void()) doplasma((byte*) doplasma::screen)
(byte~) doplasma::$2 reg byte a 2002.0
(label) doplasma::@1
(label) doplasma::@2
(label) doplasma::@3
(label) doplasma::@4
(label) doplasma::@return
(byte*) doplasma::angle
(byte*) doplasma::angle#0 angle zp ZP_WORD:4 1.0
(byte*) doplasma::angle#1 angle zp ZP_WORD:4 50.5
(byte*) doplasma::angle#4 angle zp ZP_WORD:4 172.14285714285714
(byte*) doplasma::dist
(byte*) doplasma::dist#0 dist zp ZP_WORD:6 1.3333333333333333
(byte*) doplasma::dist#1 dist zp ZP_WORD:6 67.33333333333333
(byte*) doplasma::dist#4 dist zp ZP_WORD:6 150.625
(byte*) doplasma::screen
(byte*) doplasma::screen#2 screen zp ZP_WORD:8 40.4
(byte*) doplasma::screen#5 screen zp ZP_WORD:8 200.83333333333334
(byte*) doplasma::screen#6 screen zp ZP_WORD:8 0.4
(byte*) doplasma::sin_x
(byte*) doplasma::sin_x#0 sin_x zp ZP_WORD:58 77.15384615384616
(byte*) doplasma::sin_y
(byte*) doplasma::sin_y#0 sin_y zp ZP_WORD:60 83.58333333333334
(byte) doplasma::x
(byte) doplasma::x#1 reg byte x 1501.5
(byte) doplasma::x#2 reg byte x 1668.3333333333335
(byte) doplasma::y
(byte) doplasma::y#1 y zp ZP_BYTE:10 151.5
(byte) doplasma::y#4 y zp ZP_BYTE:10 22.444444444444443
(byte*) heap_head
(byte*) heap_head#1 heap_head zp ZP_WORD:50 0.6000000000000001
(byte*) heap_head#12 heap_head zp ZP_WORD:50 4.0
(void()) init_angle_screen((byte*) init_angle_screen::screen)
(word~) init_angle_screen::$10 $10 zp ZP_WORD:31 202.0
(byte~) init_angle_screen::$12 reg byte a 202.0
(byte~) init_angle_screen::$13 reg byte a 202.0
(byte~) init_angle_screen::$14 reg byte a 202.0
(byte~) init_angle_screen::$2 reg byte a 202.0
(byte~) init_angle_screen::$3 reg byte a 202.0
(byte~) init_angle_screen::$6 reg byte a 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 ang_w zp ZP_BYTE:70 84.16666666666666
(word) init_angle_screen::angle_w
(word) init_angle_screen::angle_w#0 angle_w zp ZP_WORD:31 202.0
(byte*) init_angle_screen::screen
(byte*) init_angle_screen::screen#0 screen zp ZP_WORD:21 3.0
(byte*) init_angle_screen::screen_bottomline
(byte*) init_angle_screen::screen_bottomline#0 screen_bottomline zp ZP_WORD:21 4.0
(byte*) init_angle_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:21 7.333333333333333
(byte*) init_angle_screen::screen_bottomline#5 screen_bottomline zp ZP_WORD:21 9.040000000000001
(byte*) init_angle_screen::screen_topline
(byte*) init_angle_screen::screen_topline#0 screen_topline zp ZP_WORD:23 2.0
(byte*) init_angle_screen::screen_topline#1 screen_topline zp ZP_WORD:23 5.5
(byte*) init_angle_screen::screen_topline#5 screen_topline zp ZP_WORD:23 9.416666666666666
(byte) init_angle_screen::x
(byte) init_angle_screen::x#1 x zp ZP_BYTE:25 101.0
(byte) init_angle_screen::x#2 x zp ZP_BYTE:25 25.25
(byte) init_angle_screen::xb
(byte) init_angle_screen::xb#1 xb zp ZP_BYTE:26 101.0
(byte) init_angle_screen::xb#2 xb zp ZP_BYTE:26 19.238095238095237
(signed word) init_angle_screen::xw
(word) init_angle_screen::xw#0 xw zp ZP_WORD:66 33.666666666666664
(byte) init_angle_screen::y
(byte) init_angle_screen::y#1 y zp ZP_BYTE:20 16.5
(byte) init_angle_screen::y#4 y zp ZP_BYTE:20 4.730769230769231
(signed word) init_angle_screen::yw
(word) init_angle_screen::yw#0 yw zp ZP_WORD:68 50.5
(void()) init_dist_screen((byte*) init_dist_screen::screen)
(byte~) init_dist_screen::$13 reg byte a 202.0
(byte~) init_dist_screen::$15 reg byte a 202.0
(byte~) init_dist_screen::$5 reg byte a 22.0
(byte~) init_dist_screen::$7 reg byte a 22.0
(label) init_dist_screen::@1
(label) init_dist_screen::@10
(label) init_dist_screen::@11
(label) init_dist_screen::@12
(label) init_dist_screen::@13
(label) init_dist_screen::@2
(label) init_dist_screen::@3
(label) init_dist_screen::@4
(label) init_dist_screen::@5
(label) init_dist_screen::@6
(label) init_dist_screen::@7
(label) init_dist_screen::@8
(label) init_dist_screen::@9
(label) init_dist_screen::@return
(byte) init_dist_screen::d
(byte) init_dist_screen::d#0 reg byte a 126.25
(word) init_dist_screen::ds
(word) init_dist_screen::ds#0 ds zp ZP_WORD:73 202.0
(byte*) init_dist_screen::screen
(byte*) init_dist_screen::screen#0 screen zp ZP_WORD:38 1.5
(byte*) init_dist_screen::screen_bottomline
(byte*) init_dist_screen::screen_bottomline#0 screen_bottomline zp ZP_WORD:40 4.0
(byte*) init_dist_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:40 7.333333333333333
(byte*) init_dist_screen::screen_bottomline#10 screen_bottomline zp ZP_WORD:40 6.848484848484849
(byte*) init_dist_screen::screen_topline
(byte*) init_dist_screen::screen_topline#1 screen_topline zp ZP_WORD:38 5.5
(byte*) init_dist_screen::screen_topline#10 screen_topline zp ZP_WORD:38 7.0625
(byte) init_dist_screen::x
(byte) init_dist_screen::x#1 x zp ZP_BYTE:42 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:42 26.578947368421055
(byte) init_dist_screen::x2
(byte) init_dist_screen::x2#0 reg byte a 202.0
(byte) init_dist_screen::xb
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:43 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:43 20.2
(byte) init_dist_screen::xd
(byte) init_dist_screen::xd#0 reg byte a 303.0
(word) init_dist_screen::xds
(word) init_dist_screen::xds#0 xds zp ZP_WORD:73 202.0
(byte) init_dist_screen::y
(byte) init_dist_screen::y#1 y zp ZP_BYTE:37 16.5
(byte) init_dist_screen::y#10 y zp ZP_BYTE:37 0.9705882352941178
(byte) init_dist_screen::y2
(byte) init_dist_screen::y2#0 reg byte a 22.0
(byte) init_dist_screen::yd
(byte) init_dist_screen::yd#0 reg byte a 33.0
(word) init_dist_screen::yds
(word) init_dist_screen::yds#0 yds zp ZP_WORD:71 4.869565217391305
(void()) init_squares()
(byte~) init_squares::$3 reg byte a 22.0
(byte~) init_squares::$4 reg byte a 22.0
(label) init_squares::@1
(label) init_squares::@2
(label) init_squares::@return
(byte) init_squares::i
(byte) init_squares::i#1 reg byte x 16.5
(byte) init_squares::i#2 reg byte x 5.5
(word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp ZP_WORD:46 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:46 6.6000000000000005
(word*) init_squares::squares
(word*) init_squares::squares#0 squares zp ZP_WORD:48 4.0
(word*) init_squares::squares#1 squares zp ZP_WORD:48 3.6666666666666665
(word*) init_squares::squares#2 squares zp ZP_WORD:48 17.5
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(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*) SCREEN1#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*) SCREEN2#0&(word) $3fff*(byte) 4|>(word)(const byte*) CHARSET#0/(byte) 4&(byte) $f
(byte*) main::toD0182_screen
(void()) make_plasma_charset((byte*) make_plasma_charset::charset)
(byte~) make_plasma_charset::$11 reg byte a 22.0
(byte*~) make_plasma_charset::$16 $16 zp ZP_WORD:64 202.0
(byte~) make_plasma_charset::$2 reg byte a 22.0
(byte~) make_plasma_charset::$3 reg byte a 2002.0
(byte~) make_plasma_charset::$4 $4 zp ZP_BYTE:63 2002.0
(word~) make_plasma_charset::$8 $8 zp ZP_WORD:64 202.0
(word~) make_plasma_charset::$9 $9 zp ZP_WORD:64 202.0
(label) make_plasma_charset::@1
(label) make_plasma_charset::@10
(label) make_plasma_charset::@11
(label) make_plasma_charset::@2
(label) make_plasma_charset::@3
(label) make_plasma_charset::@4
(label) make_plasma_charset::@5
(label) make_plasma_charset::@6
(label) make_plasma_charset::@7
(label) make_plasma_charset::@8
(label) make_plasma_charset::@9
(label) make_plasma_charset::@return
(byte) make_plasma_charset::b
(byte) make_plasma_charset::b#1 reg byte y 2002.0
(byte) make_plasma_charset::b#2 reg byte y 500.5
(byte) make_plasma_charset::b#3 reg byte y 517.3333333333334
(byte[8]) make_plasma_charset::bittab
(const byte[8]) make_plasma_charset::bittab#0 bittab = { (byte) 1, (byte) 2, (byte) 4, (byte) 8, (byte) $10, (byte) $20, (byte) $40, (byte) $80 }
(word) make_plasma_charset::c
(word) make_plasma_charset::c#1 c zp ZP_WORD:13 16.5
(word) make_plasma_charset::c#2 c zp ZP_WORD:13 5.800000000000001
(byte*) make_plasma_charset::charset
(byte) make_plasma_charset::i
(byte) make_plasma_charset::i#1 i zp ZP_BYTE:17 151.5
(byte) make_plasma_charset::i#7 i zp ZP_BYTE:17 20.2
(byte) make_plasma_charset::ii
(byte) make_plasma_charset::ii#1 reg byte x 1501.5
(byte) make_plasma_charset::ii#2 reg byte x 375.375
(byte) make_plasma_charset::s
(byte) make_plasma_charset::s#0 s zp ZP_BYTE:62 56.22222222222223
(void*()) malloc((word) malloc::size)
(label) malloc::@return
(byte*) malloc::mem
(byte*) malloc::mem#0 mem zp ZP_WORD:79 0.3333333333333333
(void*) malloc::return
(word) malloc::size
(word) malloc::size#3 size zp ZP_WORD:52 1.0
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(label) memset::@1
(label) memset::@return
(byte) memset::c
(byte*) memset::dst
(byte*) memset::dst#1 dst zp ZP_WORD:11 16.5
(byte*) memset::dst#2 dst zp ZP_WORD:11 16.5
(byte*) memset::end
(const byte*) memset::end#0 end = (byte*)(const void*) memset::str#0+(const word) memset::num#0
(word) memset::num
(const word) memset::num#0 num = (word) $3e8
(void*) memset::return
(void*) memset::str
(const void*) memset::str#0 str = (void*)(const byte*) COLS#0
(void()) print_char((byte) print_char::ch)
(label) print_char::@return
(byte) print_char::ch
(const byte) print_char::ch#0 ch = (byte) '.'
(byte*) print_char_cursor
(byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:15 4.333333333333333
(byte*) print_char_cursor#18 print_char_cursor zp ZP_WORD:15 11.0
(byte*) print_char_cursor#49 print_char_cursor zp ZP_WORD:15 1.0833333333333333
(void()) print_cls()
(label) print_cls::@1
(label) print_cls::@return
(byte*) print_cls::sc
(byte*) print_cls::sc#1 sc zp ZP_WORD:18 16.5
(byte*) print_cls::sc#2 sc zp ZP_WORD:18 16.5
(byte*) print_line_cursor
(const byte*) print_line_cursor#0 print_line_cursor = (byte*) 1024
(byte*) print_screen
(byte()) sid_rnd()
(label) sid_rnd::@return
(byte) sid_rnd::return
(byte) sid_rnd::return#0 reg byte a 334.33333333333337
(byte) sid_rnd::return#2 reg byte a 2002.0
(void()) sid_rnd_init()
(label) sid_rnd_init::@return
(byte) sin_offset_x
(byte) sin_offset_x#10 sin_offset_x zp ZP_BYTE:2 1.625
(byte) sin_offset_x#12 sin_offset_x zp ZP_BYTE:2 2.666666666666667
(byte) sin_offset_x#14 sin_offset_x zp ZP_BYTE:2 11.0
(byte) sin_offset_y
(byte) sin_offset_y#10 sin_offset_y zp ZP_BYTE:3 1.5294117647058825
(byte) sin_offset_y#12 sin_offset_y zp ZP_BYTE:3 3.0
(byte) sin_offset_y#14 sin_offset_y zp ZP_BYTE:3 11.0
(word()) sqr((byte) sqr::val)
(byte~) sqr::$0 reg byte a 4.0
(label) sqr::@return
(word) sqr::return
(word) sqr::return#0 return zp ZP_WORD:73 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:71 22.0
(word) sqr::return#3 return zp ZP_WORD:73 202.0
(byte) sqr::val
(byte) sqr::val#0 reg byte a 22.0
(byte) sqr::val#1 reg byte a 202.0
(byte) sqr::val#2 reg byte a 114.0
(byte()) sqrt((word) sqrt::val)
(word~) sqrt::$1 $1 zp ZP_WORD:44 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:44 4.0
(label) sqrt::@1
(label) sqrt::@return
(word*) sqrt::found
(word*) sqrt::found#0 found zp ZP_WORD:44 4.0
(byte) sqrt::return
(byte) sqrt::return#0 reg byte a 34.33333333333333
(byte) sqrt::return#2 reg byte a 202.0
(byte) sqrt::sq
(word) sqrt::val
(word) sqrt::val#0 val zp ZP_WORD:73 103.0
zp ZP_BYTE:2 [ sin_offset_x#10 sin_offset_x#14 sin_offset_x#12 ]
zp ZP_BYTE:3 [ sin_offset_y#10 sin_offset_y#14 sin_offset_y#12 ]
zp ZP_WORD:4 [ doplasma::angle#4 doplasma::angle#0 doplasma::angle#1 ]
zp ZP_WORD:6 [ doplasma::dist#4 doplasma::dist#0 doplasma::dist#1 ]
zp ZP_WORD:8 [ doplasma::screen#5 doplasma::screen#6 doplasma::screen#2 ]
zp ZP_BYTE:10 [ doplasma::y#4 doplasma::y#1 ]
reg byte x [ doplasma::x#2 doplasma::x#1 ]
zp ZP_WORD:11 [ memset::dst#2 memset::dst#1 ]
zp ZP_WORD:13 [ make_plasma_charset::c#2 make_plasma_charset::c#1 ]
zp ZP_WORD:15 [ print_char_cursor#49 print_char_cursor#18 print_char_cursor#1 ]
zp ZP_BYTE:17 [ make_plasma_charset::i#7 make_plasma_charset::i#1 ]
reg byte x [ make_plasma_charset::ii#2 make_plasma_charset::ii#1 ]
reg byte y [ make_plasma_charset::b#2 make_plasma_charset::b#3 make_plasma_charset::b#1 ]
zp ZP_WORD:18 [ print_cls::sc#2 print_cls::sc#1 ]
zp ZP_BYTE:20 [ init_angle_screen::y#4 init_angle_screen::y#1 ]
zp ZP_WORD:21 [ init_angle_screen::screen_bottomline#5 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 init_angle_screen::screen#0 ]
zp ZP_WORD:23 [ init_angle_screen::screen_topline#5 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 ]
zp ZP_BYTE:25 [ init_angle_screen::x#2 init_angle_screen::x#1 ]
zp ZP_BYTE:26 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ]
zp ZP_WORD:27 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ]
zp ZP_WORD:29 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ]
reg byte x [ atan2_16::i#2 atan2_16::i#1 ]
zp ZP_WORD:31 [ 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::$10 ]
reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ]
zp ZP_WORD:33 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ]
zp ZP_WORD:35 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ]
zp ZP_BYTE:37 [ init_dist_screen::y#10 init_dist_screen::y#1 ]
zp ZP_WORD:38 [ init_dist_screen::screen_topline#10 init_dist_screen::screen_topline#1 init_dist_screen::screen#0 ]
zp ZP_WORD:40 [ init_dist_screen::screen_bottomline#10 init_dist_screen::screen_bottomline#1 init_dist_screen::screen_bottomline#0 ]
reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ]
zp ZP_BYTE:42 [ init_dist_screen::x#2 init_dist_screen::x#1 ]
zp ZP_BYTE:43 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ]
reg byte a [ init_dist_screen::xd#0 init_dist_screen::$15 init_dist_screen::$13 ]
zp ZP_WORD:44 [ bsearch16u::return#1 bsearch16u::return#6 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::items#0 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ]
reg byte a [ sqr::val#2 sqr::val#0 sqr::val#1 ]
zp ZP_WORD:46 [ init_squares::sqr#2 init_squares::sqr#1 ]
zp ZP_WORD:48 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ]
reg byte x [ init_squares::i#2 init_squares::i#1 ]
zp ZP_WORD:50 [ heap_head#12 heap_head#1 ]
zp ZP_WORD:52 [ malloc::size#3 ]
zp ZP_WORD:54 [ SCREEN_DIST#0 ]
zp ZP_WORD:56 [ SCREEN_ANGLE#0 ]
zp ZP_WORD:58 [ doplasma::sin_x#0 ]
zp ZP_WORD:60 [ doplasma::sin_y#0 ]
reg byte a [ doplasma::$2 ]
reg byte a [ make_plasma_charset::$2 ]
zp ZP_BYTE:62 [ make_plasma_charset::s#0 ]
reg byte a [ sid_rnd::return#2 ]
reg byte a [ make_plasma_charset::$3 ]
zp ZP_BYTE:63 [ make_plasma_charset::$4 ]
zp ZP_WORD:64 [ make_plasma_charset::$8 make_plasma_charset::$9 make_plasma_charset::$16 ]
reg byte a [ make_plasma_charset::$11 ]
reg byte a [ sid_rnd::return#0 ]
reg byte a [ init_angle_screen::$2 ]
reg byte a [ init_angle_screen::$3 ]
zp ZP_WORD:66 [ init_angle_screen::xw#0 atan2_16::x#0 ]
reg byte a [ init_angle_screen::$6 ]
zp ZP_WORD:68 [ init_angle_screen::yw#0 atan2_16::y#0 ]
zp ZP_BYTE:70 [ init_angle_screen::ang_w#0 ]
reg byte a [ init_angle_screen::$12 ]
reg byte a [ init_angle_screen::$13 ]
reg byte a [ init_angle_screen::$14 ]
reg byte a [ atan2_16::$24 ]
reg byte a [ atan2_16::$23 ]
reg byte a [ init_dist_screen::y2#0 ]
zp ZP_WORD:71 [ sqr::return#2 init_dist_screen::yds#0 ]
reg byte a [ init_dist_screen::x2#0 ]
zp ZP_WORD:73 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 ]
reg byte a [ sqrt::return#2 ]
reg byte a [ init_dist_screen::d#0 ]
reg byte a [ sqrt::return#0 ]
reg byte a [ bsearch16u::$6 ]
reg byte a [ bsearch16u::$16 ]
zp ZP_WORD:75 [ bsearch16u::pivot#0 ]
zp ZP_WORD:77 [ bsearch16u::result#0 ]
reg byte a [ sqr::$0 ]
zp ZP_WORD:79 [ SQUARES#1 malloc::mem#0 ]
reg byte a [ init_squares::$3 ]
reg byte a [ init_squares::$4 ]