mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-26 03:32:23 +00:00
Added library for using BASIC functions. Improved print library. Added test creating a sine. Added asserts for methods with to few/many parameters. Added assert for requiring procedure return value. Added som missing fragments.
This commit is contained in:
parent
878d3ae36b
commit
e18a8cb7d8
@ -118,6 +118,7 @@ public class Compiler {
|
||||
getLog().append("INITIAL CONTROL FLOW GRAPH");
|
||||
getLog().append(program.getGraph().toString(program));
|
||||
|
||||
new Pass1AssertReturn(program).execute();
|
||||
new Pass1AssertUsedVars(program).execute();
|
||||
new Pass1ExtractInlineStrings(program).execute();
|
||||
new Pass1EliminateUncalledProcedures(program).execute();
|
||||
|
@ -0,0 +1 @@
|
||||
lda {zpwo1}+1
|
@ -0,0 +1 @@
|
||||
lda {zpwo1}
|
@ -0,0 +1,4 @@
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
@ -0,0 +1,4 @@
|
||||
lda {zpptrby1}
|
||||
sta {zpwo1}
|
||||
lda {zpptrby1}+1
|
||||
sta {zpwo1}+1
|
@ -0,0 +1,4 @@
|
||||
lda {cowo2}
|
||||
sta {zpwo1}
|
||||
lda #0
|
||||
sta {zpwo1}+1
|
@ -0,0 +1,2 @@
|
||||
lda {cowo1}
|
||||
sta {zpwo1}+1
|
@ -0,0 +1,4 @@
|
||||
lda {cowo1}
|
||||
sta {zpwo1}+1
|
||||
lda {zpwo2}
|
||||
sta {zpwo1}
|
@ -0,0 +1,63 @@
|
||||
package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.model.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
/**
|
||||
* Asserts that all control flow paths in a method with a defined return value ends at a return statement
|
||||
*/
|
||||
public class Pass1AssertReturn extends Pass1Base {
|
||||
|
||||
public Pass1AssertReturn(Program program) {
|
||||
super(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeStep() {
|
||||
Collection<Procedure> allProcedures = getProgram().getScope().getAllProcedures(true);
|
||||
for (Procedure procedure : allProcedures) {
|
||||
if (procedure.getReturnType() != null && !SymbolType.VOID.equals(procedure.getReturnType())) {
|
||||
LabelRef entryLabel = procedure.getRef().getLabelRef();
|
||||
ControlFlowBlock entryBlock = getProgram().getGraph().getBlock(entryLabel);
|
||||
assertReturn(entryBlock, new LinkedHashSet<>());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that all control flows end at a return statement.
|
||||
* Follow the control flow of the graph recursively.
|
||||
*
|
||||
* @param block The block to examine
|
||||
* @param visited Blocks already visited
|
||||
*/
|
||||
public void assertReturn(ControlFlowBlock block, Collection<LabelRef> visited) {
|
||||
if (visited.contains(block.getLabel())) {
|
||||
return;
|
||||
}
|
||||
visited.add(block.getLabel());
|
||||
for (Statement statement : block.getStatements()) {
|
||||
if (statement instanceof StatementAssignment) {
|
||||
StatementAssignment assignment = (StatementAssignment) statement;
|
||||
if(assignment.getlValue() instanceof VariableRef && ((VariableRef) assignment.getlValue()).getLocalName().equals("return")) {
|
||||
// Happy days - return found!
|
||||
return;
|
||||
}
|
||||
} else if (statement instanceof StatementConditionalJump) {
|
||||
StatementConditionalJump cond = (StatementConditionalJump) statement;
|
||||
ControlFlowBlock jumpTo = getProgram().getGraph().getBlock(cond.getDestination());
|
||||
assertReturn(jumpTo, visited);
|
||||
}
|
||||
}
|
||||
ControlFlowBlock successor = getProgram().getGraph().getBlock(block.getDefaultSuccessor());
|
||||
if (successor == null || successor.getLabel().getLocalName().equals(SymbolRef.PROCEXIT_BLOCK_NAME)) {
|
||||
throw new CompileError("Error! Method must end with a return statement. "+block.getScope().toString(getProgram()));
|
||||
} else {
|
||||
assertReturn(successor, visited);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -46,7 +46,7 @@ public class Pass1EliminateUncalledProcedures extends Pass1Base {
|
||||
procedure.getScope().remove(procedure);
|
||||
}
|
||||
|
||||
return false;
|
||||
return unusedProcedures.size()>0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,6 +52,9 @@ public class Pass1TypeInference extends Pass1Base {
|
||||
LValue lValue = call.getlValue();
|
||||
String procedureName = call.getProcedureName();
|
||||
Procedure procedure = scopes.peek().getProcedure(procedureName);
|
||||
if(procedure==null) {
|
||||
throw new CompileError("Called procedure not found. "+call.toString(getProgram(), false));
|
||||
}
|
||||
call.setProcedure(procedure.getRef());
|
||||
if(procedure.getParameters().size()!=call.getParameters().size()) {
|
||||
throw new CompileError("Wrong number of parameters in call. Expected " +procedure.getParameters().size()+". "+statement.toString());
|
||||
|
@ -52,7 +52,10 @@ public class Pass3PhiLifting {
|
||||
newVar.setType(phiLValue.getType());
|
||||
newVar.setInferredType(true);
|
||||
List<Statement> predecessorStatements = predecessorBlock.getStatements();
|
||||
Statement lastPredecessorStatement = predecessorStatements.get(predecessorStatements.size() - 1);
|
||||
Statement lastPredecessorStatement = null;
|
||||
if(predecessorStatements.size()>0) {
|
||||
lastPredecessorStatement = predecessorStatements.get(predecessorStatements.size() - 1);
|
||||
}
|
||||
StatementAssignment newAssignment = new StatementAssignment(newVar, phiRValue.getrValue());
|
||||
if (lastPredecessorStatement instanceof StatementConditionalJump) {
|
||||
// Use or Create a new block between the predecessor and this one - getReplacement labels where appropriate
|
||||
|
@ -29,7 +29,7 @@ public class TestPrograms extends TestCase {
|
||||
}
|
||||
|
||||
public void testBasicFloats() throws IOException, URISyntaxException {
|
||||
compileAndCompare("basic-floats");
|
||||
compileAndCompare("sinus-basic");
|
||||
}
|
||||
|
||||
public void testDoubleImport() throws IOException, URISyntaxException {
|
||||
@ -57,7 +57,7 @@ public class TestPrograms extends TestCase {
|
||||
}
|
||||
|
||||
public void testPrint() throws IOException, URISyntaxException {
|
||||
compileAndCompare("print");
|
||||
compileAndCompare("printmsg");
|
||||
}
|
||||
|
||||
public void testUnusedMethod() throws IOException, URISyntaxException {
|
||||
@ -258,77 +258,53 @@ public class TestPrograms extends TestCase {
|
||||
}
|
||||
|
||||
public void testAssignConst() throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare("assign-const");
|
||||
} catch (CompileError e) {
|
||||
// expecting error!
|
||||
return;
|
||||
}
|
||||
fail("Expected compile error.");
|
||||
assertError("assign-const", "Constants can not be modified");
|
||||
}
|
||||
|
||||
public void testStmtOutsideMethod() throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare("stmt-outside-method");
|
||||
} catch (CompileError e) {
|
||||
// expecting error!
|
||||
return;
|
||||
}
|
||||
fail("Expected compile error.");
|
||||
assertError("stmt-outside-method", "Error parsing");
|
||||
}
|
||||
|
||||
public void testUseUndeclared() throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare("useundeclared");
|
||||
} catch (CompileError e) {
|
||||
// expecting error!
|
||||
return;
|
||||
}
|
||||
fail("Expected compile error.");
|
||||
assertError("useundeclared", "Unknown variable");
|
||||
}
|
||||
|
||||
public void testUseUninitialized() throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare("useuninitialized");
|
||||
} catch (CompileError e) {
|
||||
// expecting error!
|
||||
return;
|
||||
}
|
||||
fail("Expected compile error.");
|
||||
assertError("useuninitialized", "Variable used before being defined");
|
||||
}
|
||||
|
||||
public void testTypeMismatch() throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare("typemismatch");
|
||||
} catch (CompileError e) {
|
||||
// expecting error!
|
||||
return;
|
||||
}
|
||||
fail("Expected compile error.");
|
||||
assertError("typemismatch", "Type mismatch");
|
||||
}
|
||||
|
||||
public void testToManyParams() throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare("tomanyparams");
|
||||
} catch (CompileError e) {
|
||||
// expecting error!
|
||||
return;
|
||||
}
|
||||
fail("Expected compile error.");
|
||||
assertError("tomanyparams", "Wrong number of parameters in call");
|
||||
}
|
||||
|
||||
public void testToFewParams() throws IOException, URISyntaxException {
|
||||
assertError("tofewparams", "Wrong number of parameters in call");
|
||||
}
|
||||
|
||||
public void testNoReturn() throws IOException, URISyntaxException {
|
||||
assertError("noreturn", "Method must end with a return statement");
|
||||
}
|
||||
|
||||
public void testProcedureNotFound() throws IOException, URISyntaxException {
|
||||
assertError("procedurenotfound", "Called procedure not found");
|
||||
}
|
||||
|
||||
private void assertError(String kcFile, String expectError) throws IOException, URISyntaxException {
|
||||
try {
|
||||
compileAndCompare("tofewparams");
|
||||
compileAndCompare(kcFile);
|
||||
} catch (CompileError e) {
|
||||
// expecting error!
|
||||
assertTrue("Error message expected '"+expectError+"' - was:"+e.getMessage(), e.getMessage().contains(expectError));
|
||||
return;
|
||||
}
|
||||
fail("Expected compile error.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void compileAndCompare(String filename) throws IOException, URISyntaxException {
|
||||
TestPrograms tester = new TestPrograms();
|
||||
tester.testFile(filename);
|
||||
|
@ -1,19 +1,267 @@
|
||||
// Library wrapping the BASIC floating point functions
|
||||
// See https://www.c64-wiki.com/wiki/Floating_point_arithmetic
|
||||
// See http://www.pagetable.com/c64rom/c64rom_sc.html
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
// FAC = word
|
||||
// Set the FAC (floating point accumulator) to the integer value of a 16bit word
|
||||
void setFAC(word w) {
|
||||
const byte* lo = $fe;
|
||||
const byte* hi = $ff;
|
||||
*lo = <w;
|
||||
*hi = >w;
|
||||
// Load word register Y,A into FAC (floating point accumulator)
|
||||
asm {
|
||||
lda #$55
|
||||
ldy #$aa
|
||||
ldy $fe
|
||||
lda $ff
|
||||
jsr $b391
|
||||
}
|
||||
}
|
||||
|
||||
// word = FAC
|
||||
// Get the value of the FAC (floating point accumulator) as an integer 16bit word
|
||||
// Destroys the value in the FAC in the process
|
||||
word getFAC() {
|
||||
const byte* lo = $fe;
|
||||
const byte* hi = $ff;
|
||||
// Load FAC (floating point accumulator) integer part into word register Y,A
|
||||
asm {
|
||||
jsr $b1aa
|
||||
sty $fe
|
||||
sta $ff
|
||||
}
|
||||
|
||||
word w = 0;
|
||||
<w = *lo;
|
||||
>w = *hi;
|
||||
return w;
|
||||
}
|
||||
|
||||
// ARG = FAC
|
||||
// Set the ARG (floating point argument) to the value of the FAC (floating point accumulator)
|
||||
void setARGtoFAC() {
|
||||
asm {
|
||||
jsr $bc0f
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = ARG
|
||||
// Set the FAC (floating point accumulator) to the value of the ARG (floating point argument)
|
||||
void setFACtoARG() {
|
||||
asm {
|
||||
jsr $bbfc
|
||||
}
|
||||
}
|
||||
|
||||
// Zeropage addresses used to hold lo/hi-bytes of addresses of float numbers in MEM
|
||||
const byte* memLo = $fe;
|
||||
const byte* memHi = $ff;
|
||||
|
||||
// Prepare MEM pointers for operations using MEM
|
||||
void prepareMEM(byte* mem) {
|
||||
*memLo = <mem;
|
||||
*memHi = >mem;
|
||||
}
|
||||
|
||||
// MEM = FAC
|
||||
// Stores the value of the FAC to memory
|
||||
// Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};)
|
||||
void setMEMtoFAC(byte* mem) {
|
||||
prepareMEM(mem);
|
||||
asm {
|
||||
ldx $fe
|
||||
ldy $ff
|
||||
jsr $bbd4
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = MEM
|
||||
// Set the FAC to value from MEM (float saved in memory)
|
||||
// Reads 5 bytes
|
||||
void setFACtoMEM(byte* mem) {
|
||||
prepareMEM(mem);
|
||||
asm {
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $bba2
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = PI/2
|
||||
// Set the FAC to PI/2
|
||||
// Reads 5 bytes from the BASIC ROM
|
||||
void setFACtoPIhalf() {
|
||||
asm {
|
||||
lda #$e0
|
||||
ldy #$e2
|
||||
jsr $bba2
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = 2*PI
|
||||
// Set the FAC to 2*PI
|
||||
// Reads 5 bytes from the BASIC ROM
|
||||
void setFACto2PI() {
|
||||
asm {
|
||||
lda #$e5
|
||||
ldy #$e2
|
||||
jsr $bba2
|
||||
}
|
||||
}
|
||||
|
||||
// ARG = MEM
|
||||
// Load the ARG from memory
|
||||
// Reads 5 bytes
|
||||
void setARGtoMEM(byte* mem) {
|
||||
prepareMEM(mem);
|
||||
asm {
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $ba8c
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = MEM+FAC
|
||||
// Set FAC to MEM (float saved in memory) plus FAC (float accumulator)
|
||||
// Reads 5 bytes from memory
|
||||
void addMEMtoFAC(byte* mem) {
|
||||
prepareMEM(mem);
|
||||
asm {
|
||||
lda $fe //memLo
|
||||
ldy $ff //memHi
|
||||
jsr $b867
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = ARG+FAC
|
||||
// Add ARG (floating point argument) to FAC (floating point accumulator)
|
||||
void addARGtoFAC() {
|
||||
asm {
|
||||
jsr $b86a
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = MEM-FAC
|
||||
// Set FAC to MEM (float saved in memory) minus FAC (float accumulator)
|
||||
// Reads 5 bytes from memory
|
||||
void subFACfromMEM(byte* mem) {
|
||||
prepareMEM(mem);
|
||||
asm {
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $b850
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = ARG-FAC
|
||||
// Set FAC to ARG minus FAC
|
||||
void subFACfromARG() {
|
||||
asm {
|
||||
jsr $b853
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = MEM/FAC
|
||||
// Set FAC to MEM (float saved in memory) divided by FAC (float accumulator)
|
||||
// Reads 5 bytes from memory
|
||||
void divMEMbyFAC(byte* mem) {
|
||||
prepareMEM(mem);
|
||||
asm {
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $bb0f
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = MEM*FAC
|
||||
// Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator)
|
||||
// Reads 5 bytes from memory
|
||||
void mulFACbyMEM(byte* mem) {
|
||||
prepareMEM(mem);
|
||||
asm {
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $ba28
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = MEM^FAC
|
||||
// Set FAC to MEM (float saved in memory) raised to power of FAC (float accumulator)
|
||||
// Reads 5 bytes from memory
|
||||
void pwrMEMbyFAC(byte* mem) {
|
||||
prepareMEM(mem);
|
||||
asm {
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $bf78
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = int(FAC)
|
||||
// Set FAC to integer part of the FAC - int(FAC)
|
||||
// The integer part is defined as the next lower integer - like java floor()
|
||||
void intFAC() {
|
||||
asm {
|
||||
jsr $bccc
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = sin(FAC)
|
||||
// Set FAC to sinus of the FAC - sin(FAC)
|
||||
// Sinus is calculated on radians (0-2*PI)
|
||||
void sinFAC() {
|
||||
asm {
|
||||
jsr $e26b
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = cos(FAC)
|
||||
// Set FAC to cosinus of the FAC - cos(FAC)
|
||||
// Cosinus is calculated on radians (0-2*PI)
|
||||
void cosFAC() {
|
||||
asm {
|
||||
jsr $e264
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = tan(FAC)
|
||||
// Set FAC to the tangens of FAC - tan(FAC)
|
||||
// Tangens is calculated on radians (0-2*PI)
|
||||
void tanFAC() {
|
||||
asm {
|
||||
jsr $e2b4
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = atn(FAC)
|
||||
// Set FAC to the arc tangens of FAC - atn(FAC)
|
||||
// Arc Tangens is calculated on radians (0-2*PI)
|
||||
void atnFAC() {
|
||||
asm {
|
||||
jsr $e303
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = sqr(FAC)
|
||||
// Set FAC to the square root of FAC - sqr(FAC)
|
||||
void sqrFAC() {
|
||||
asm {
|
||||
jsr $bf71
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = exp(FAC)
|
||||
// Set FAC to the exponential function of FAC - exp(FAC)
|
||||
// Exp is based on the natural logarithm e=2.71828183
|
||||
void expFAC() {
|
||||
asm {
|
||||
jsr $bfed
|
||||
}
|
||||
}
|
||||
|
||||
// FAC = log(FAC)
|
||||
// Set FAC to the logarithm of FAC - log(FAC)
|
||||
// Log is based on the natural logarithm e=2.71828183
|
||||
void logFAC() {
|
||||
asm {
|
||||
jsr $b9ea
|
||||
}
|
||||
}
|
8
src/main/java/dk/camelot64/kickc/test/noreturn.kc
Normal file
8
src/main/java/dk/camelot64/kickc/test/noreturn.kc
Normal file
@ -0,0 +1,8 @@
|
||||
void main() {
|
||||
byte b = get();
|
||||
byte* screen = $400;
|
||||
}
|
||||
|
||||
byte get() {
|
||||
byte b = 4;
|
||||
}
|
@ -1,17 +1,4 @@
|
||||
|
||||
byte[] msg = "hello world! @";
|
||||
byte[] msg2 = "hello c64! @";
|
||||
byte[] msg3 = "hello 2017! @";
|
||||
|
||||
void main() {
|
||||
print_str(msg);
|
||||
print_ln();
|
||||
print_str(msg2);
|
||||
print_ln();
|
||||
print_str(msg3);
|
||||
print_ln();
|
||||
}
|
||||
|
||||
byte* line_cursor = $0400;
|
||||
byte* char_cursor = line_cursor;
|
||||
|
||||
@ -29,3 +16,24 @@ void print_ln() {
|
||||
} while (line_cursor<char_cursor);
|
||||
char_cursor = line_cursor;
|
||||
}
|
||||
|
||||
// Print a word as HEX
|
||||
void print_word(word w) {
|
||||
print_byte(>w);
|
||||
print_byte(<w);
|
||||
}
|
||||
|
||||
// Table of hexadecimal digits
|
||||
byte[] hextab = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
|
||||
// Print a byte as HEX
|
||||
void print_byte(byte b) {
|
||||
print_char(hextab[b>>4]);
|
||||
print_char(hextab[b&$f]);
|
||||
}
|
||||
|
||||
// Print a single char
|
||||
void print_char(byte ch) {
|
||||
*(char_cursor++) = ch;
|
||||
}
|
||||
|
||||
|
14
src/main/java/dk/camelot64/kickc/test/printmsg.kc
Normal file
14
src/main/java/dk/camelot64/kickc/test/printmsg.kc
Normal file
@ -0,0 +1,14 @@
|
||||
import "print"
|
||||
|
||||
byte[] msg = "hello world! @";
|
||||
byte[] msg2 = "hello c64! @";
|
||||
byte[] msg3 = "hello 2017! @";
|
||||
|
||||
void main() {
|
||||
print_str(msg);
|
||||
print_ln();
|
||||
print_str(msg2);
|
||||
print_ln();
|
||||
print_str(msg3);
|
||||
print_ln();
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
void main() {
|
||||
testme();
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@3
|
||||
@3: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @3
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call print_str param-assignment [ char_cursor#20 ] ( main:2 [ char_cursor#20 ] )
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
[6] phi() [ char_cursor#20 ] ( main:2 [ char_cursor#20 ] )
|
||||
[7] call print_ln param-assignment [ print_ln::$0 ] ( main:2 [ print_ln::$0 ] )
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
[8] (byte*~) char_cursor#33 ← (byte*~) print_ln::$0 [ char_cursor#33 print_ln::$0 ] ( main:2 [ char_cursor#33 print_ln::$0 ] )
|
||||
[9] call print_str param-assignment [ print_ln::$0 char_cursor#20 ] ( main:2 [ print_ln::$0 char_cursor#20 ] )
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2
|
||||
[10] phi() [ print_ln::$0 char_cursor#20 ] ( main:2 [ print_ln::$0 char_cursor#20 ] )
|
||||
[11] call print_ln param-assignment [ print_ln::$0 ] ( main:2 [ print_ln::$0 ] )
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
[12] (byte*~) char_cursor#34 ← (byte*~) print_ln::$0 [ print_ln::$0 char_cursor#34 ] ( main:2 [ print_ln::$0 char_cursor#34 ] )
|
||||
[13] call print_str param-assignment [ print_ln::$0 char_cursor#20 ] ( main:2 [ print_ln::$0 char_cursor#20 ] )
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@4
|
||||
[14] phi() [ print_ln::$0 char_cursor#20 ] ( main:2 [ print_ln::$0 char_cursor#20 ] )
|
||||
[15] call print_ln param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@5
|
||||
[16] return [ ] ( main:2 [ ] )
|
||||
to:@return
|
||||
print_ln: scope:[print_ln] from main::@1 main::@3 main::@5
|
||||
[17] (byte*) line_cursor#19 ← phi( main::@1/((byte*))(word/signed word) 1024 main::@3/(byte*~) print_ln::$0 main::@5/(byte*~) print_ln::$0 ) [ line_cursor#19 char_cursor#20 ] ( main:2::print_ln:7 [ line_cursor#19 char_cursor#20 ] main:2::print_ln:11 [ line_cursor#19 char_cursor#20 ] main:2::print_ln:15 [ line_cursor#19 char_cursor#20 ] )
|
||||
to:print_ln::@1
|
||||
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
||||
[18] (byte*) line_cursor#12 ← phi( print_ln/(byte*) line_cursor#19 print_ln::@1/(byte*~) print_ln::$0 ) [ line_cursor#12 char_cursor#20 ] ( main:2::print_ln:7 [ line_cursor#12 char_cursor#20 ] main:2::print_ln:11 [ line_cursor#12 char_cursor#20 ] main:2::print_ln:15 [ line_cursor#12 char_cursor#20 ] )
|
||||
[19] (byte*~) print_ln::$0 ← (byte*) line_cursor#12 + (byte/signed byte/word/signed word) 40 [ print_ln::$0 char_cursor#20 ] ( main:2::print_ln:7 [ print_ln::$0 char_cursor#20 ] main:2::print_ln:11 [ print_ln::$0 char_cursor#20 ] main:2::print_ln:15 [ print_ln::$0 char_cursor#20 ] )
|
||||
[20] if((byte*~) print_ln::$0<(byte*) char_cursor#20) goto print_ln::@1 [ print_ln::$0 char_cursor#20 ] ( main:2::print_ln:7 [ print_ln::$0 char_cursor#20 ] main:2::print_ln:11 [ print_ln::$0 char_cursor#20 ] main:2::print_ln:15 [ print_ln::$0 char_cursor#20 ] )
|
||||
to:print_ln::@return
|
||||
print_ln::@return: scope:[print_ln] from print_ln::@1
|
||||
[21] return [ print_ln::$0 ] ( main:2::print_ln:7 [ print_ln::$0 ] main:2::print_ln:11 [ print_ln::$0 ] main:2::print_ln:15 [ print_ln::$0 ] )
|
||||
to:@return
|
||||
print_str: scope:[print_str] from main main::@2 main::@4
|
||||
[22] (byte*) char_cursor#29 ← phi( main/((byte*))(word/signed word) 1024 main::@2/(byte*~) char_cursor#33 main::@4/(byte*~) char_cursor#34 ) [ print_str::str#6 char_cursor#29 ] ( main:2::print_str:5 [ print_str::str#6 char_cursor#29 ] main:2::print_str:9 [ print_ln::$0 print_str::str#6 char_cursor#29 ] main:2::print_str:13 [ print_ln::$0 print_str::str#6 char_cursor#29 ] )
|
||||
[22] (byte*) print_str::str#6 ← phi( main/(const byte[]) msg#0 main::@2/(const byte[]) msg2#0 main::@4/(const byte[]) msg3#0 ) [ print_str::str#6 char_cursor#29 ] ( main:2::print_str:5 [ print_str::str#6 char_cursor#29 ] main:2::print_str:9 [ print_ln::$0 print_str::str#6 char_cursor#29 ] main:2::print_str:13 [ print_ln::$0 print_str::str#6 char_cursor#29 ] )
|
||||
to:print_str::@1
|
||||
print_str::@1: scope:[print_str] from print_str print_str::@2
|
||||
[23] (byte*) char_cursor#20 ← phi( print_str/(byte*) char_cursor#29 print_str::@2/(byte*) char_cursor#8 ) [ char_cursor#20 print_str::str#4 ] ( main:2::print_str:5 [ char_cursor#20 print_str::str#4 ] main:2::print_str:9 [ print_ln::$0 char_cursor#20 print_str::str#4 ] main:2::print_str:13 [ print_ln::$0 char_cursor#20 print_str::str#4 ] )
|
||||
[23] (byte*) print_str::str#4 ← phi( print_str/(byte*) print_str::str#6 print_str::@2/(byte*) print_str::str#3 ) [ char_cursor#20 print_str::str#4 ] ( main:2::print_str:5 [ char_cursor#20 print_str::str#4 ] main:2::print_str:9 [ print_ln::$0 char_cursor#20 print_str::str#4 ] main:2::print_str:13 [ print_ln::$0 char_cursor#20 print_str::str#4 ] )
|
||||
[24] if(*((byte*) print_str::str#4)!=(byte) '@') goto print_str::@2 [ char_cursor#20 print_str::str#4 ] ( main:2::print_str:5 [ char_cursor#20 print_str::str#4 ] main:2::print_str:9 [ print_ln::$0 char_cursor#20 print_str::str#4 ] main:2::print_str:13 [ print_ln::$0 char_cursor#20 print_str::str#4 ] )
|
||||
to:print_str::@return
|
||||
print_str::@return: scope:[print_str] from print_str::@1
|
||||
[25] return [ char_cursor#20 ] ( main:2::print_str:5 [ char_cursor#20 ] main:2::print_str:9 [ print_ln::$0 char_cursor#20 ] main:2::print_str:13 [ print_ln::$0 char_cursor#20 ] )
|
||||
to:@return
|
||||
print_str::@2: scope:[print_str] from print_str::@1
|
||||
[26] *((byte*) char_cursor#20) ← *((byte*) print_str::str#4) [ char_cursor#20 print_str::str#4 ] ( main:2::print_str:5 [ char_cursor#20 print_str::str#4 ] main:2::print_str:9 [ print_ln::$0 char_cursor#20 print_str::str#4 ] main:2::print_str:13 [ print_ln::$0 char_cursor#20 print_str::str#4 ] )
|
||||
[27] (byte*) char_cursor#8 ← ++ (byte*) char_cursor#20 [ print_str::str#4 char_cursor#8 ] ( main:2::print_str:5 [ print_str::str#4 char_cursor#8 ] main:2::print_str:9 [ print_ln::$0 print_str::str#4 char_cursor#8 ] main:2::print_str:13 [ print_ln::$0 print_str::str#4 char_cursor#8 ] )
|
||||
[28] (byte*) print_str::str#3 ← ++ (byte*) print_str::str#4 [ print_str::str#3 char_cursor#8 ] ( main:2::print_str:5 [ print_str::str#3 char_cursor#8 ] main:2::print_str:9 [ print_ln::$0 print_str::str#3 char_cursor#8 ] main:2::print_str:13 [ print_ln::$0 print_str::str#3 char_cursor#8 ] )
|
||||
to:print_str::@1
|
64
src/main/java/dk/camelot64/kickc/test/ref/printmsg.cfg
Normal file
64
src/main/java/dk/camelot64/kickc/test/ref/printmsg.cfg
Normal file
@ -0,0 +1,64 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@3
|
||||
@3: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @3
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call print_str param-assignment [ char_cursor#13 ] ( main:2 [ char_cursor#13 ] )
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
[6] phi() [ char_cursor#13 ] ( main:2 [ char_cursor#13 ] )
|
||||
[7] call print_ln param-assignment [ print_ln::$0 ] ( main:2 [ print_ln::$0 ] )
|
||||
to:main::@2
|
||||
main::@2: scope:[main] from main::@1
|
||||
[8] (byte*~) char_cursor#34 ← (byte*~) print_ln::$0 [ char_cursor#34 print_ln::$0 ] ( main:2 [ char_cursor#34 print_ln::$0 ] )
|
||||
[9] call print_str param-assignment [ print_ln::$0 char_cursor#13 ] ( main:2 [ print_ln::$0 char_cursor#13 ] )
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2
|
||||
[10] phi() [ print_ln::$0 char_cursor#13 ] ( main:2 [ print_ln::$0 char_cursor#13 ] )
|
||||
[11] call print_ln param-assignment [ print_ln::$0 ] ( main:2 [ print_ln::$0 ] )
|
||||
to:main::@4
|
||||
main::@4: scope:[main] from main::@3
|
||||
[12] (byte*~) char_cursor#35 ← (byte*~) print_ln::$0 [ print_ln::$0 char_cursor#35 ] ( main:2 [ print_ln::$0 char_cursor#35 ] )
|
||||
[13] call print_str param-assignment [ print_ln::$0 char_cursor#13 ] ( main:2 [ print_ln::$0 char_cursor#13 ] )
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@4
|
||||
[14] phi() [ print_ln::$0 char_cursor#13 ] ( main:2 [ print_ln::$0 char_cursor#13 ] )
|
||||
[15] call print_ln param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@5
|
||||
[16] return [ ] ( main:2 [ ] )
|
||||
to:@return
|
||||
print_ln: scope:[print_ln] from main::@1 main::@3 main::@5
|
||||
[17] (byte*) line_cursor#16 ← phi( main::@1/((byte*))(word/signed word) 1024 main::@3/(byte*~) print_ln::$0 main::@5/(byte*~) print_ln::$0 ) [ line_cursor#16 char_cursor#13 ] ( main:2::print_ln:7 [ line_cursor#16 char_cursor#13 ] main:2::print_ln:11 [ line_cursor#16 char_cursor#13 ] main:2::print_ln:15 [ line_cursor#16 char_cursor#13 ] )
|
||||
to:print_ln::@1
|
||||
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
||||
[18] (byte*) line_cursor#8 ← phi( print_ln/(byte*) line_cursor#16 print_ln::@1/(byte*~) print_ln::$0 ) [ line_cursor#8 char_cursor#13 ] ( main:2::print_ln:7 [ line_cursor#8 char_cursor#13 ] main:2::print_ln:11 [ line_cursor#8 char_cursor#13 ] main:2::print_ln:15 [ line_cursor#8 char_cursor#13 ] )
|
||||
[19] (byte*~) print_ln::$0 ← (byte*) line_cursor#8 + (byte/signed byte/word/signed word) 40 [ print_ln::$0 char_cursor#13 ] ( main:2::print_ln:7 [ print_ln::$0 char_cursor#13 ] main:2::print_ln:11 [ print_ln::$0 char_cursor#13 ] main:2::print_ln:15 [ print_ln::$0 char_cursor#13 ] )
|
||||
[20] if((byte*~) print_ln::$0<(byte*) char_cursor#13) goto print_ln::@1 [ print_ln::$0 char_cursor#13 ] ( main:2::print_ln:7 [ print_ln::$0 char_cursor#13 ] main:2::print_ln:11 [ print_ln::$0 char_cursor#13 ] main:2::print_ln:15 [ print_ln::$0 char_cursor#13 ] )
|
||||
to:print_ln::@return
|
||||
print_ln::@return: scope:[print_ln] from print_ln::@1
|
||||
[21] return [ print_ln::$0 ] ( main:2::print_ln:7 [ print_ln::$0 ] main:2::print_ln:11 [ print_ln::$0 ] main:2::print_ln:15 [ print_ln::$0 ] )
|
||||
to:@return
|
||||
print_str: scope:[print_str] from main main::@2 main::@4
|
||||
[22] (byte*) char_cursor#29 ← phi( main/((byte*))(word/signed word) 1024 main::@2/(byte*~) char_cursor#34 main::@4/(byte*~) char_cursor#35 ) [ print_str::str#6 char_cursor#29 ] ( main:2::print_str:5 [ print_str::str#6 char_cursor#29 ] main:2::print_str:9 [ print_ln::$0 print_str::str#6 char_cursor#29 ] main:2::print_str:13 [ print_ln::$0 print_str::str#6 char_cursor#29 ] )
|
||||
[22] (byte*) print_str::str#6 ← phi( main/(const byte[]) msg#0 main::@2/(const byte[]) msg2#0 main::@4/(const byte[]) msg3#0 ) [ print_str::str#6 char_cursor#29 ] ( main:2::print_str:5 [ print_str::str#6 char_cursor#29 ] main:2::print_str:9 [ print_ln::$0 print_str::str#6 char_cursor#29 ] main:2::print_str:13 [ print_ln::$0 print_str::str#6 char_cursor#29 ] )
|
||||
to:print_str::@1
|
||||
print_str::@1: scope:[print_str] from print_str print_str::@2
|
||||
[23] (byte*) char_cursor#13 ← phi( print_str/(byte*) char_cursor#29 print_str::@2/(byte*) char_cursor#1 ) [ char_cursor#13 print_str::str#4 ] ( main:2::print_str:5 [ char_cursor#13 print_str::str#4 ] main:2::print_str:9 [ print_ln::$0 char_cursor#13 print_str::str#4 ] main:2::print_str:13 [ print_ln::$0 char_cursor#13 print_str::str#4 ] )
|
||||
[23] (byte*) print_str::str#4 ← phi( print_str/(byte*) print_str::str#6 print_str::@2/(byte*) print_str::str#0 ) [ char_cursor#13 print_str::str#4 ] ( main:2::print_str:5 [ char_cursor#13 print_str::str#4 ] main:2::print_str:9 [ print_ln::$0 char_cursor#13 print_str::str#4 ] main:2::print_str:13 [ print_ln::$0 char_cursor#13 print_str::str#4 ] )
|
||||
[24] if(*((byte*) print_str::str#4)!=(byte) '@') goto print_str::@2 [ char_cursor#13 print_str::str#4 ] ( main:2::print_str:5 [ char_cursor#13 print_str::str#4 ] main:2::print_str:9 [ print_ln::$0 char_cursor#13 print_str::str#4 ] main:2::print_str:13 [ print_ln::$0 char_cursor#13 print_str::str#4 ] )
|
||||
to:print_str::@return
|
||||
print_str::@return: scope:[print_str] from print_str::@1
|
||||
[25] return [ char_cursor#13 ] ( main:2::print_str:5 [ char_cursor#13 ] main:2::print_str:9 [ print_ln::$0 char_cursor#13 ] main:2::print_str:13 [ print_ln::$0 char_cursor#13 ] )
|
||||
to:@return
|
||||
print_str::@2: scope:[print_str] from print_str::@1
|
||||
[26] *((byte*) char_cursor#13) ← *((byte*) print_str::str#4) [ char_cursor#13 print_str::str#4 ] ( main:2::print_str:5 [ char_cursor#13 print_str::str#4 ] main:2::print_str:9 [ print_ln::$0 char_cursor#13 print_str::str#4 ] main:2::print_str:13 [ print_ln::$0 char_cursor#13 print_str::str#4 ] )
|
||||
[27] (byte*) char_cursor#1 ← ++ (byte*) char_cursor#13 [ print_str::str#4 char_cursor#1 ] ( main:2::print_str:5 [ print_str::str#4 char_cursor#1 ] main:2::print_str:9 [ print_ln::$0 print_str::str#4 char_cursor#1 ] main:2::print_str:13 [ print_ln::$0 print_str::str#4 char_cursor#1 ] )
|
||||
[28] (byte*) print_str::str#0 ← ++ (byte*) print_str::str#4 [ print_str::str#0 char_cursor#1 ] ( main:2::print_str:5 [ print_str::str#0 char_cursor#1 ] main:2::print_str:9 [ print_ln::$0 print_str::str#0 char_cursor#1 ] main:2::print_str:13 [ print_ln::$0 print_str::str#0 char_cursor#1 ] )
|
||||
to:print_str::@1
|
File diff suppressed because it is too large
Load Diff
@ -2,14 +2,14 @@
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) char_cursor
|
||||
(byte*) char_cursor#20 char_cursor zp ZP_PTR_BYTE:6 3.2857142857142856
|
||||
(byte*) char_cursor#1 char_cursor zp ZP_PTR_BYTE:6 11.0
|
||||
(byte*) char_cursor#13 char_cursor zp ZP_PTR_BYTE:6 3.2857142857142856
|
||||
(byte*) char_cursor#29 char_cursor zp ZP_PTR_BYTE:6 6.0
|
||||
(byte*~) char_cursor#33 char_cursor zp ZP_PTR_BYTE:6 4.0
|
||||
(byte*~) char_cursor#34 char_cursor zp ZP_PTR_BYTE:6 4.0
|
||||
(byte*) char_cursor#8 char_cursor zp ZP_PTR_BYTE:6 11.0
|
||||
(byte*~) char_cursor#35 char_cursor zp ZP_PTR_BYTE:6 4.0
|
||||
(byte*) line_cursor
|
||||
(byte*) line_cursor#12 line_cursor zp ZP_PTR_BYTE:2 24.0
|
||||
(byte*) line_cursor#19 line_cursor zp ZP_PTR_BYTE:2 6.0
|
||||
(byte*) line_cursor#16 line_cursor zp ZP_PTR_BYTE:2 6.0
|
||||
(byte*) line_cursor#8 line_cursor zp ZP_PTR_BYTE:2 24.0
|
||||
(void()) main()
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
@ -32,10 +32,10 @@
|
||||
(label) print_str::@2
|
||||
(label) print_str::@return
|
||||
(byte*) print_str::str
|
||||
(byte*) print_str::str#3 str zp ZP_PTR_BYTE:4 22.0
|
||||
(byte*) print_str::str#0 str zp ZP_PTR_BYTE:4 22.0
|
||||
(byte*) print_str::str#4 str zp ZP_PTR_BYTE:4 11.5
|
||||
(byte*) print_str::str#6 str zp ZP_PTR_BYTE:4 2.0
|
||||
|
||||
zp ZP_PTR_BYTE:2 [ line_cursor#12 line_cursor#19 print_ln::$0 ]
|
||||
zp ZP_PTR_BYTE:4 [ print_str::str#4 print_str::str#6 print_str::str#3 ]
|
||||
zp ZP_PTR_BYTE:6 [ char_cursor#20 char_cursor#29 char_cursor#33 char_cursor#34 char_cursor#8 ]
|
||||
zp ZP_PTR_BYTE:2 [ line_cursor#8 line_cursor#16 print_ln::$0 ]
|
||||
zp ZP_PTR_BYTE:4 [ print_str::str#4 print_str::str#6 print_str::str#0 ]
|
||||
zp ZP_PTR_BYTE:6 [ char_cursor#13 char_cursor#29 char_cursor#34 char_cursor#35 char_cursor#1 ]
|
214
src/main/java/dk/camelot64/kickc/test/ref/sinus-basic.asm
Normal file
214
src/main/java/dk/camelot64/kickc/test/ref/sinus-basic.asm
Normal file
@ -0,0 +1,214 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.const memLo = $fe
|
||||
.const memHi = $ff
|
||||
.const f_2pi = $e2e5
|
||||
.label char_cursor = 5
|
||||
.label line_cursor = 3
|
||||
hextab: .byte '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
||||
f_i: .byte 0, 0, 0, 0, 0
|
||||
f_127: .byte 0, 0, 0, 0, 0
|
||||
jsr main
|
||||
main: {
|
||||
.label _2 = 9
|
||||
.label _11 = 9
|
||||
.label i = 2
|
||||
lda #$7f
|
||||
sta setFAC.w
|
||||
lda #0
|
||||
sta setFAC.w+1
|
||||
jsr setFAC
|
||||
lda #<f_127
|
||||
sta setMEMtoFAC.mem
|
||||
lda #>f_127
|
||||
sta setMEMtoFAC.mem+1
|
||||
jsr setMEMtoFAC
|
||||
lda #<$400
|
||||
sta line_cursor
|
||||
lda #>$400
|
||||
sta line_cursor+1
|
||||
lda #<$400
|
||||
sta char_cursor
|
||||
lda #>$400
|
||||
sta char_cursor+1
|
||||
lda #1
|
||||
sta i
|
||||
b1:
|
||||
lda i
|
||||
sta _2
|
||||
lda #0
|
||||
sta _2+1
|
||||
jsr setFAC
|
||||
lda #<f_2pi
|
||||
sta mulFACbyMEM.mem
|
||||
lda #>f_2pi
|
||||
sta mulFACbyMEM.mem+1
|
||||
jsr mulFACbyMEM
|
||||
lda #<f_i
|
||||
sta setMEMtoFAC.mem
|
||||
lda #>f_i
|
||||
sta setMEMtoFAC.mem+1
|
||||
jsr setMEMtoFAC
|
||||
lda #$19
|
||||
sta setFAC.w
|
||||
lda #0
|
||||
sta setFAC.w+1
|
||||
jsr setFAC
|
||||
jsr divMEMbyFAC
|
||||
jsr sinFAC
|
||||
lda #<f_127
|
||||
sta mulFACbyMEM.mem
|
||||
lda #>f_127
|
||||
sta mulFACbyMEM.mem+1
|
||||
jsr mulFACbyMEM
|
||||
jsr addMEMtoFAC
|
||||
jsr getFAC
|
||||
jsr print_word
|
||||
jsr print_ln
|
||||
inc i
|
||||
lda i
|
||||
cmp #$1a
|
||||
bne b16
|
||||
rts
|
||||
b16:
|
||||
lda print_ln._0
|
||||
sta char_cursor
|
||||
lda print_ln._0+1
|
||||
sta char_cursor+1
|
||||
jmp b1
|
||||
}
|
||||
print_ln: {
|
||||
.label _0 = 3
|
||||
b1:
|
||||
lda _0
|
||||
clc
|
||||
adc #$28
|
||||
sta _0
|
||||
bcc !+
|
||||
inc _0+1
|
||||
!:
|
||||
lda _0+1
|
||||
cmp char_cursor+1
|
||||
bcc b1
|
||||
bne !+
|
||||
lda _0
|
||||
cmp char_cursor
|
||||
bcc b1
|
||||
!:
|
||||
rts
|
||||
}
|
||||
print_word: {
|
||||
.label w = 9
|
||||
lda w+1
|
||||
tax
|
||||
jsr print_byte
|
||||
lda w
|
||||
tax
|
||||
jsr print_byte
|
||||
rts
|
||||
}
|
||||
print_byte: {
|
||||
txa
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tay
|
||||
lda hextab,y
|
||||
jsr print_char
|
||||
txa
|
||||
and #$f
|
||||
tax
|
||||
lda hextab,x
|
||||
jsr print_char
|
||||
rts
|
||||
}
|
||||
print_char: {
|
||||
ldy #0
|
||||
sta (char_cursor),y
|
||||
inc char_cursor
|
||||
bne !+
|
||||
inc char_cursor+1
|
||||
!:
|
||||
rts
|
||||
}
|
||||
getFAC: {
|
||||
.const lo = $fe
|
||||
.const hi = $ff
|
||||
.label w = 9
|
||||
.label return = 9
|
||||
jsr $b1aa
|
||||
sty $fe
|
||||
sta $ff
|
||||
lda lo
|
||||
sta w
|
||||
lda #0
|
||||
sta w+1
|
||||
lda hi
|
||||
sta return+1
|
||||
rts
|
||||
}
|
||||
addMEMtoFAC: {
|
||||
lda #<f_127
|
||||
sta prepareMEM.mem
|
||||
lda #>f_127
|
||||
sta prepareMEM.mem+1
|
||||
jsr prepareMEM
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $b867
|
||||
rts
|
||||
}
|
||||
prepareMEM: {
|
||||
.label mem = 7
|
||||
lda mem
|
||||
sta memLo
|
||||
lda mem+1
|
||||
sta memHi
|
||||
rts
|
||||
}
|
||||
mulFACbyMEM: {
|
||||
.label mem = 7
|
||||
jsr prepareMEM
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $ba28
|
||||
rts
|
||||
}
|
||||
sinFAC: {
|
||||
jsr $e26b
|
||||
rts
|
||||
}
|
||||
divMEMbyFAC: {
|
||||
lda #<f_i
|
||||
sta prepareMEM.mem
|
||||
lda #>f_i
|
||||
sta prepareMEM.mem+1
|
||||
jsr prepareMEM
|
||||
lda $fe
|
||||
ldy $ff
|
||||
jsr $bb0f
|
||||
rts
|
||||
}
|
||||
setFAC: {
|
||||
.const lo = $fe
|
||||
.const hi = $ff
|
||||
.label w = 9
|
||||
lda w
|
||||
sta lo
|
||||
lda w+1
|
||||
sta hi
|
||||
ldy $fe
|
||||
lda $ff
|
||||
jsr $b391
|
||||
rts
|
||||
}
|
||||
setMEMtoFAC: {
|
||||
.label mem = 7
|
||||
jsr prepareMEM
|
||||
ldx $fe
|
||||
ldy $ff
|
||||
jsr $bbd4
|
||||
rts
|
||||
}
|
204
src/main/java/dk/camelot64/kickc/test/ref/sinus-basic.cfg
Normal file
204
src/main/java/dk/camelot64/kickc/test/ref/sinus-basic.cfg
Normal file
@ -0,0 +1,204 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@31
|
||||
@31: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @31
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @31
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call setFAC param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main
|
||||
[6] phi() [ ] ( main:2 [ ] )
|
||||
[7] call setMEMtoFAC param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main::@16 main::@3
|
||||
[8] (byte*) line_cursor#13 ← phi( main::@16/(byte*~) print_ln::$0 main::@3/((byte*))(word/signed word) 1024 ) [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[8] (byte*) char_cursor#32 ← phi( main::@16/(byte*~) char_cursor#49 main::@3/((byte*))(word/signed word) 1024 ) [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[8] (byte) main::i#10 ← phi( main::@16/(byte) main::i#1 main::@3/(byte/signed byte/word/signed word) 1 ) [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[9] (word~) main::$2 ← ((word)) (byte) main::i#10 [ main::i#10 char_cursor#32 line_cursor#13 main::$2 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 main::$2 ] )
|
||||
[10] (word) setFAC::w#1 ← (word~) main::$2 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::w#1 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::w#1 ] )
|
||||
[11] call setFAC param-assignment [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@1
|
||||
[12] phi() [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[13] call mulFACbyMEM param-assignment [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:main::@6
|
||||
main::@6: scope:[main] from main::@5
|
||||
[14] phi() [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[15] call setMEMtoFAC param-assignment [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:main::@7
|
||||
main::@7: scope:[main] from main::@6
|
||||
[16] phi() [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[17] call setFAC param-assignment [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:main::@8
|
||||
main::@8: scope:[main] from main::@7
|
||||
[18] phi() [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[19] call divMEMbyFAC param-assignment [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:main::@9
|
||||
main::@9: scope:[main] from main::@8
|
||||
[20] phi() [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[21] call sinFAC param-assignment [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:main::@10
|
||||
main::@10: scope:[main] from main::@9
|
||||
[22] phi() [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[23] call mulFACbyMEM param-assignment [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:main::@11
|
||||
main::@11: scope:[main] from main::@10
|
||||
[24] phi() [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[25] call addMEMtoFAC param-assignment [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:main::@12
|
||||
main::@12: scope:[main] from main::@11
|
||||
[26] phi() [ main::i#10 char_cursor#32 line_cursor#13 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[27] call getFAC param-assignment [ main::i#10 char_cursor#32 line_cursor#13 getFAC::return#0 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 getFAC::return#0 ] )
|
||||
[28] (word) getFAC::return#2 ← (word) getFAC::return#0 [ main::i#10 char_cursor#32 line_cursor#13 getFAC::return#2 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 getFAC::return#2 ] )
|
||||
to:main::@13
|
||||
main::@13: scope:[main] from main::@12
|
||||
[29] (word~) main::$11 ← (word) getFAC::return#2 [ main::i#10 char_cursor#32 line_cursor#13 main::$11 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 main::$11 ] )
|
||||
[30] (word) print_word::w#0 ← (word~) main::$11 [ main::i#10 char_cursor#32 line_cursor#13 print_word::w#0 ] ( main:2 [ main::i#10 char_cursor#32 line_cursor#13 print_word::w#0 ] )
|
||||
[31] call print_word param-assignment [ main::i#10 line_cursor#13 char_cursor#10 ] ( main:2 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
to:main::@14
|
||||
main::@14: scope:[main] from main::@13
|
||||
[32] phi() [ main::i#10 line_cursor#13 char_cursor#10 ] ( main:2 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
[33] call print_ln param-assignment [ main::i#10 print_ln::$0 ] ( main:2 [ main::i#10 print_ln::$0 ] )
|
||||
to:main::@15
|
||||
main::@15: scope:[main] from main::@14
|
||||
[34] (byte) main::i#1 ← ++ (byte) main::i#10 [ main::i#1 print_ln::$0 ] ( main:2 [ main::i#1 print_ln::$0 ] )
|
||||
[35] if((byte) main::i#1!=(byte/signed byte/word/signed word) 26) goto main::@16 [ main::i#1 print_ln::$0 ] ( main:2 [ main::i#1 print_ln::$0 ] )
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@15
|
||||
[36] return [ ] ( main:2 [ ] )
|
||||
to:@return
|
||||
main::@16: scope:[main] from main::@15
|
||||
[37] (byte*~) char_cursor#49 ← (byte*~) print_ln::$0 [ main::i#1 char_cursor#49 print_ln::$0 ] ( main:2 [ main::i#1 char_cursor#49 print_ln::$0 ] )
|
||||
to:main::@1
|
||||
print_ln: scope:[print_ln] from main::@14
|
||||
[38] phi() [ line_cursor#13 char_cursor#10 ] ( main:2::print_ln:33 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
to:print_ln::@1
|
||||
print_ln::@1: scope:[print_ln] from print_ln print_ln::@1
|
||||
[39] (byte*) line_cursor#6 ← phi( print_ln/(byte*) line_cursor#13 print_ln::@1/(byte*~) print_ln::$0 ) [ line_cursor#6 char_cursor#10 ] ( main:2::print_ln:33 [ main::i#10 line_cursor#6 char_cursor#10 ] )
|
||||
[40] (byte*~) print_ln::$0 ← (byte*) line_cursor#6 + (byte/signed byte/word/signed word) 40 [ print_ln::$0 char_cursor#10 ] ( main:2::print_ln:33 [ main::i#10 print_ln::$0 char_cursor#10 ] )
|
||||
[41] if((byte*~) print_ln::$0<(byte*) char_cursor#10) goto print_ln::@1 [ print_ln::$0 char_cursor#10 ] ( main:2::print_ln:33 [ main::i#10 print_ln::$0 char_cursor#10 ] )
|
||||
to:print_ln::@return
|
||||
print_ln::@return: scope:[print_ln] from print_ln::@1
|
||||
[42] return [ print_ln::$0 ] ( main:2::print_ln:33 [ main::i#10 print_ln::$0 ] )
|
||||
to:@return
|
||||
print_word: scope:[print_word] from main::@13
|
||||
[43] (byte~) print_word::$0 ← > (word) print_word::w#0 [ char_cursor#32 print_word::w#0 print_word::$0 ] ( main:2::print_word:31 [ main::i#10 line_cursor#13 char_cursor#32 print_word::w#0 print_word::$0 ] )
|
||||
[44] (byte) print_byte::b#0 ← (byte~) print_word::$0 [ char_cursor#32 print_word::w#0 print_byte::b#0 ] ( main:2::print_word:31 [ main::i#10 line_cursor#13 char_cursor#32 print_word::w#0 print_byte::b#0 ] )
|
||||
[45] call print_byte param-assignment [ print_word::w#0 char_cursor#10 ] ( main:2::print_word:31 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 ] )
|
||||
to:print_word::@1
|
||||
print_word::@1: scope:[print_word] from print_word
|
||||
[46] (byte~) print_word::$2 ← < (word) print_word::w#0 [ char_cursor#10 print_word::$2 ] ( main:2::print_word:31 [ main::i#10 line_cursor#13 char_cursor#10 print_word::$2 ] )
|
||||
[47] (byte) print_byte::b#1 ← (byte~) print_word::$2 [ char_cursor#10 print_byte::b#1 ] ( main:2::print_word:31 [ main::i#10 line_cursor#13 char_cursor#10 print_byte::b#1 ] )
|
||||
[48] call print_byte param-assignment [ char_cursor#10 ] ( main:2::print_word:31 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
to:print_word::@return
|
||||
print_word::@return: scope:[print_word] from print_word::@1
|
||||
[49] return [ char_cursor#10 ] ( main:2::print_word:31 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
to:@return
|
||||
print_byte: scope:[print_byte] from print_word print_word::@1
|
||||
[50] (byte*) char_cursor#31 ← phi( print_word/(byte*) char_cursor#32 print_word::@1/(byte*) char_cursor#10 ) [ print_byte::b#2 char_cursor#31 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 char_cursor#31 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 print_byte::b#2 char_cursor#31 ] )
|
||||
[50] (byte) print_byte::b#2 ← phi( print_word/(byte) print_byte::b#0 print_word::@1/(byte) print_byte::b#1 ) [ print_byte::b#2 char_cursor#31 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 char_cursor#31 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 print_byte::b#2 char_cursor#31 ] )
|
||||
[51] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word) 4 [ print_byte::b#2 char_cursor#31 print_byte::$0 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 char_cursor#31 print_byte::$0 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 print_byte::b#2 char_cursor#31 print_byte::$0 ] )
|
||||
[52] (byte~) print_byte::$1 ← (const byte[]) hextab#0 *idx (byte~) print_byte::$0 [ print_byte::b#2 char_cursor#31 print_byte::$1 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 char_cursor#31 print_byte::$1 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 print_byte::b#2 char_cursor#31 print_byte::$1 ] )
|
||||
[53] (byte) print_char::ch#0 ← (byte~) print_byte::$1 [ print_byte::b#2 char_cursor#31 print_char::ch#0 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 char_cursor#31 print_char::ch#0 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 print_byte::b#2 char_cursor#31 print_char::ch#0 ] )
|
||||
[54] call print_char param-assignment [ char_cursor#10 print_byte::b#2 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 print_byte::b#2 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 char_cursor#10 print_byte::b#2 ] )
|
||||
to:print_byte::@1
|
||||
print_byte::@1: scope:[print_byte] from print_byte
|
||||
[55] (byte~) print_byte::$3 ← (byte) print_byte::b#2 & (byte/signed byte/word/signed word) 15 [ char_cursor#10 print_byte::$3 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 print_byte::$3 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 char_cursor#10 print_byte::$3 ] )
|
||||
[56] (byte~) print_byte::$4 ← (const byte[]) hextab#0 *idx (byte~) print_byte::$3 [ char_cursor#10 print_byte::$4 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 print_byte::$4 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 char_cursor#10 print_byte::$4 ] )
|
||||
[57] (byte) print_char::ch#1 ← (byte~) print_byte::$4 [ char_cursor#10 print_char::ch#1 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 print_char::ch#1 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 char_cursor#10 print_char::ch#1 ] )
|
||||
[58] call print_char param-assignment [ char_cursor#10 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
to:print_byte::@return
|
||||
print_byte::@return: scope:[print_byte] from print_byte::@1
|
||||
[59] return [ char_cursor#10 ] ( main:2::print_word:31::print_byte:45 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 ] main:2::print_word:31::print_byte:48 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
to:@return
|
||||
print_char: scope:[print_char] from print_byte print_byte::@1
|
||||
[60] (byte*) char_cursor#23 ← phi( print_byte/(byte*) char_cursor#31 print_byte::@1/(byte*) char_cursor#10 ) [ print_char::ch#2 char_cursor#23 ] ( main:2::print_word:31::print_byte:45::print_char:54 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 print_char::ch#2 char_cursor#23 ] main:2::print_word:31::print_byte:48::print_char:54 [ main::i#10 line_cursor#13 print_byte::b#2 print_char::ch#2 char_cursor#23 ] main:2::print_word:31::print_byte:45::print_char:58 [ main::i#10 line_cursor#13 print_word::w#0 print_char::ch#2 char_cursor#23 ] main:2::print_word:31::print_byte:48::print_char:58 [ main::i#10 line_cursor#13 print_char::ch#2 char_cursor#23 ] )
|
||||
[60] (byte) print_char::ch#2 ← phi( print_byte/(byte) print_char::ch#0 print_byte::@1/(byte) print_char::ch#1 ) [ print_char::ch#2 char_cursor#23 ] ( main:2::print_word:31::print_byte:45::print_char:54 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 print_char::ch#2 char_cursor#23 ] main:2::print_word:31::print_byte:48::print_char:54 [ main::i#10 line_cursor#13 print_byte::b#2 print_char::ch#2 char_cursor#23 ] main:2::print_word:31::print_byte:45::print_char:58 [ main::i#10 line_cursor#13 print_word::w#0 print_char::ch#2 char_cursor#23 ] main:2::print_word:31::print_byte:48::print_char:58 [ main::i#10 line_cursor#13 print_char::ch#2 char_cursor#23 ] )
|
||||
[61] *((byte*) char_cursor#23) ← (byte) print_char::ch#2 [ char_cursor#23 ] ( main:2::print_word:31::print_byte:45::print_char:54 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 char_cursor#23 ] main:2::print_word:31::print_byte:48::print_char:54 [ main::i#10 line_cursor#13 print_byte::b#2 char_cursor#23 ] main:2::print_word:31::print_byte:45::print_char:58 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#23 ] main:2::print_word:31::print_byte:48::print_char:58 [ main::i#10 line_cursor#13 char_cursor#23 ] )
|
||||
[62] (byte*) char_cursor#10 ← ++ (byte*) char_cursor#23 [ char_cursor#10 ] ( main:2::print_word:31::print_byte:45::print_char:54 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 char_cursor#10 ] main:2::print_word:31::print_byte:48::print_char:54 [ main::i#10 line_cursor#13 print_byte::b#2 char_cursor#10 ] main:2::print_word:31::print_byte:45::print_char:58 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 ] main:2::print_word:31::print_byte:48::print_char:58 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
to:print_char::@return
|
||||
print_char::@return: scope:[print_char] from print_char
|
||||
[63] return [ char_cursor#10 ] ( main:2::print_word:31::print_byte:45::print_char:54 [ main::i#10 line_cursor#13 print_word::w#0 print_byte::b#2 char_cursor#10 ] main:2::print_word:31::print_byte:48::print_char:54 [ main::i#10 line_cursor#13 print_byte::b#2 char_cursor#10 ] main:2::print_word:31::print_byte:45::print_char:58 [ main::i#10 line_cursor#13 print_word::w#0 char_cursor#10 ] main:2::print_word:31::print_byte:48::print_char:58 [ main::i#10 line_cursor#13 char_cursor#10 ] )
|
||||
to:@return
|
||||
getFAC: scope:[getFAC] from main::@12
|
||||
asm { jsr$b1aasty$festa$ff }
|
||||
[65] (word) getFAC::w#1 ← (byte/signed byte/word/signed word) 0 lo= *((const byte*) getFAC::lo#0) [ getFAC::w#1 ] ( main:2::getFAC:27 [ main::i#10 char_cursor#32 line_cursor#13 getFAC::w#1 ] )
|
||||
[66] (word) getFAC::return#0 ← (word) getFAC::w#1 hi= *((const byte*) getFAC::hi#0) [ getFAC::return#0 ] ( main:2::getFAC:27 [ main::i#10 char_cursor#32 line_cursor#13 getFAC::return#0 ] )
|
||||
to:getFAC::@return
|
||||
getFAC::@return: scope:[getFAC] from getFAC
|
||||
[67] return [ getFAC::return#0 ] ( main:2::getFAC:27 [ main::i#10 char_cursor#32 line_cursor#13 getFAC::return#0 ] )
|
||||
to:@return
|
||||
addMEMtoFAC: scope:[addMEMtoFAC] from main::@11
|
||||
[68] phi() [ ] ( main:2::addMEMtoFAC:25 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[69] call prepareMEM param-assignment [ ] ( main:2::addMEMtoFAC:25 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:addMEMtoFAC::@1
|
||||
addMEMtoFAC::@1: scope:[addMEMtoFAC] from addMEMtoFAC
|
||||
asm { lda$feldy$ffjsr$b867 }
|
||||
to:addMEMtoFAC::@return
|
||||
addMEMtoFAC::@return: scope:[addMEMtoFAC] from addMEMtoFAC::@1
|
||||
[71] return [ ] ( main:2::addMEMtoFAC:25 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:@return
|
||||
prepareMEM: scope:[prepareMEM] from addMEMtoFAC divMEMbyFAC mulFACbyMEM setMEMtoFAC
|
||||
[72] (byte*) prepareMEM::mem#4 ← phi( addMEMtoFAC/(const byte[]) f_127#0 divMEMbyFAC/(const byte[]) f_i#0 mulFACbyMEM/(byte*) prepareMEM::mem#3 setMEMtoFAC/(byte*) prepareMEM::mem#0 ) [ prepareMEM::mem#4 ] ( main:2::addMEMtoFAC:25::prepareMEM:69 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] main:2::mulFACbyMEM:13::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] main:2::mulFACbyMEM:23::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] main:2::divMEMbyFAC:19::prepareMEM:86 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] main:2::setMEMtoFAC:7::prepareMEM:98 [ prepareMEM::mem#4 ] main:2::setMEMtoFAC:15::prepareMEM:98 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] )
|
||||
[73] (byte~) prepareMEM::$0 ← < (byte*) prepareMEM::mem#4 [ prepareMEM::mem#4 prepareMEM::$0 ] ( main:2::addMEMtoFAC:25::prepareMEM:69 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 prepareMEM::$0 ] main:2::mulFACbyMEM:13::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 prepareMEM::$0 ] main:2::mulFACbyMEM:23::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 prepareMEM::$0 ] main:2::divMEMbyFAC:19::prepareMEM:86 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 prepareMEM::$0 ] main:2::setMEMtoFAC:7::prepareMEM:98 [ prepareMEM::mem#4 prepareMEM::$0 ] main:2::setMEMtoFAC:15::prepareMEM:98 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 prepareMEM::$0 ] )
|
||||
[74] *((const byte*) memLo#0) ← (byte~) prepareMEM::$0 [ prepareMEM::mem#4 ] ( main:2::addMEMtoFAC:25::prepareMEM:69 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] main:2::mulFACbyMEM:13::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] main:2::mulFACbyMEM:23::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] main:2::divMEMbyFAC:19::prepareMEM:86 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] main:2::setMEMtoFAC:7::prepareMEM:98 [ prepareMEM::mem#4 ] main:2::setMEMtoFAC:15::prepareMEM:98 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#4 ] )
|
||||
[75] (byte~) prepareMEM::$1 ← > (byte*) prepareMEM::mem#4 [ prepareMEM::$1 ] ( main:2::addMEMtoFAC:25::prepareMEM:69 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::$1 ] main:2::mulFACbyMEM:13::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::$1 ] main:2::mulFACbyMEM:23::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::$1 ] main:2::divMEMbyFAC:19::prepareMEM:86 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::$1 ] main:2::setMEMtoFAC:7::prepareMEM:98 [ prepareMEM::$1 ] main:2::setMEMtoFAC:15::prepareMEM:98 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::$1 ] )
|
||||
[76] *((const byte*) memHi#0) ← (byte~) prepareMEM::$1 [ ] ( main:2::addMEMtoFAC:25::prepareMEM:69 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::mulFACbyMEM:13::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::mulFACbyMEM:23::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::divMEMbyFAC:19::prepareMEM:86 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::setMEMtoFAC:7::prepareMEM:98 [ ] main:2::setMEMtoFAC:15::prepareMEM:98 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:prepareMEM::@return
|
||||
prepareMEM::@return: scope:[prepareMEM] from prepareMEM
|
||||
[77] return [ ] ( main:2::addMEMtoFAC:25::prepareMEM:69 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::mulFACbyMEM:13::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::mulFACbyMEM:23::prepareMEM:80 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::divMEMbyFAC:19::prepareMEM:86 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::setMEMtoFAC:7::prepareMEM:98 [ ] main:2::setMEMtoFAC:15::prepareMEM:98 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:@return
|
||||
mulFACbyMEM: scope:[mulFACbyMEM] from main::@10 main::@5
|
||||
[78] (byte*) mulFACbyMEM::mem#2 ← phi( main::@10/(const byte[]) f_127#0 main::@5/(const byte*) f_2pi#0 ) [ mulFACbyMEM::mem#2 ] ( main:2::mulFACbyMEM:13 [ main::i#10 char_cursor#32 line_cursor#13 mulFACbyMEM::mem#2 ] main:2::mulFACbyMEM:23 [ main::i#10 char_cursor#32 line_cursor#13 mulFACbyMEM::mem#2 ] )
|
||||
[79] (byte*) prepareMEM::mem#3 ← (byte*) mulFACbyMEM::mem#2 [ prepareMEM::mem#3 ] ( main:2::mulFACbyMEM:13 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#3 ] main:2::mulFACbyMEM:23 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#3 ] )
|
||||
[80] call prepareMEM param-assignment [ ] ( main:2::mulFACbyMEM:13 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::mulFACbyMEM:23 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:mulFACbyMEM::@1
|
||||
mulFACbyMEM::@1: scope:[mulFACbyMEM] from mulFACbyMEM
|
||||
asm { lda$feldy$ffjsr$ba28 }
|
||||
to:mulFACbyMEM::@return
|
||||
mulFACbyMEM::@return: scope:[mulFACbyMEM] from mulFACbyMEM::@1
|
||||
[82] return [ ] ( main:2::mulFACbyMEM:13 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::mulFACbyMEM:23 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:@return
|
||||
sinFAC: scope:[sinFAC] from main::@9
|
||||
asm { jsr$e26b }
|
||||
to:sinFAC::@return
|
||||
sinFAC::@return: scope:[sinFAC] from sinFAC
|
||||
[84] return [ ] ( main:2::sinFAC:21 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:@return
|
||||
divMEMbyFAC: scope:[divMEMbyFAC] from main::@8
|
||||
[85] phi() [ ] ( main:2::divMEMbyFAC:19 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
[86] call prepareMEM param-assignment [ ] ( main:2::divMEMbyFAC:19 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:divMEMbyFAC::@1
|
||||
divMEMbyFAC::@1: scope:[divMEMbyFAC] from divMEMbyFAC
|
||||
asm { lda$feldy$ffjsr$bb0f }
|
||||
to:divMEMbyFAC::@return
|
||||
divMEMbyFAC::@return: scope:[divMEMbyFAC] from divMEMbyFAC::@1
|
||||
[88] return [ ] ( main:2::divMEMbyFAC:19 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:@return
|
||||
setFAC: scope:[setFAC] from main main::@1 main::@7
|
||||
[89] (word) setFAC::w#3 ← phi( main/(byte/signed byte/word/signed word) 127 main::@1/(word) setFAC::w#1 main::@7/(byte/signed byte/word/signed word) 25 ) [ setFAC::w#3 ] ( main:2::setFAC:5 [ setFAC::w#3 ] main:2::setFAC:11 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::w#3 ] main:2::setFAC:17 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::w#3 ] )
|
||||
[90] (byte~) setFAC::$0 ← < (word) setFAC::w#3 [ setFAC::w#3 setFAC::$0 ] ( main:2::setFAC:5 [ setFAC::w#3 setFAC::$0 ] main:2::setFAC:11 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::w#3 setFAC::$0 ] main:2::setFAC:17 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::w#3 setFAC::$0 ] )
|
||||
[91] *((const byte*) setFAC::lo#0) ← (byte~) setFAC::$0 [ setFAC::w#3 ] ( main:2::setFAC:5 [ setFAC::w#3 ] main:2::setFAC:11 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::w#3 ] main:2::setFAC:17 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::w#3 ] )
|
||||
[92] (byte~) setFAC::$1 ← > (word) setFAC::w#3 [ setFAC::$1 ] ( main:2::setFAC:5 [ setFAC::$1 ] main:2::setFAC:11 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::$1 ] main:2::setFAC:17 [ main::i#10 char_cursor#32 line_cursor#13 setFAC::$1 ] )
|
||||
[93] *((const byte*) setFAC::hi#0) ← (byte~) setFAC::$1 [ ] ( main:2::setFAC:5 [ ] main:2::setFAC:11 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::setFAC:17 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
asm { ldy$felda$ffjsr$b391 }
|
||||
to:setFAC::@return
|
||||
setFAC::@return: scope:[setFAC] from setFAC
|
||||
[95] return [ ] ( main:2::setFAC:5 [ ] main:2::setFAC:11 [ main::i#10 char_cursor#32 line_cursor#13 ] main:2::setFAC:17 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:@return
|
||||
setMEMtoFAC: scope:[setMEMtoFAC] from main::@3 main::@6
|
||||
[96] (byte*) setMEMtoFAC::mem#2 ← phi( main::@3/(const byte[]) f_127#0 main::@6/(const byte[]) f_i#0 ) [ setMEMtoFAC::mem#2 ] ( main:2::setMEMtoFAC:7 [ setMEMtoFAC::mem#2 ] main:2::setMEMtoFAC:15 [ main::i#10 char_cursor#32 line_cursor#13 setMEMtoFAC::mem#2 ] )
|
||||
[97] (byte*) prepareMEM::mem#0 ← (byte*) setMEMtoFAC::mem#2 [ prepareMEM::mem#0 ] ( main:2::setMEMtoFAC:7 [ prepareMEM::mem#0 ] main:2::setMEMtoFAC:15 [ main::i#10 char_cursor#32 line_cursor#13 prepareMEM::mem#0 ] )
|
||||
[98] call prepareMEM param-assignment [ ] ( main:2::setMEMtoFAC:7 [ ] main:2::setMEMtoFAC:15 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:setMEMtoFAC::@1
|
||||
setMEMtoFAC::@1: scope:[setMEMtoFAC] from setMEMtoFAC
|
||||
asm { ldx$feldy$ffjsr$bbd4 }
|
||||
to:setMEMtoFAC::@return
|
||||
setMEMtoFAC::@return: scope:[setMEMtoFAC] from setMEMtoFAC::@1
|
||||
[100] return [ ] ( main:2::setMEMtoFAC:7 [ ] main:2::setMEMtoFAC:15 [ main::i#10 char_cursor#32 line_cursor#13 ] )
|
||||
to:@return
|
9235
src/main/java/dk/camelot64/kickc/test/ref/sinus-basic.log
Normal file
9235
src/main/java/dk/camelot64/kickc/test/ref/sinus-basic.log
Normal file
File diff suppressed because it is too large
Load Diff
141
src/main/java/dk/camelot64/kickc/test/ref/sinus-basic.sym
Normal file
141
src/main/java/dk/camelot64/kickc/test/ref/sinus-basic.sym
Normal file
@ -0,0 +1,141 @@
|
||||
(label) @31
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) addMEMtoFAC((byte*) addMEMtoFAC::mem)
|
||||
(label) addMEMtoFAC::@1
|
||||
(label) addMEMtoFAC::@return
|
||||
(byte*) addMEMtoFAC::mem
|
||||
(byte*) char_cursor
|
||||
(byte*) char_cursor#10 char_cursor zp ZP_PTR_BYTE:5 5.631578947368422
|
||||
(byte*) char_cursor#23 char_cursor zp ZP_PTR_BYTE:5 4.0
|
||||
(byte*) char_cursor#31 char_cursor zp ZP_PTR_BYTE:5 1.5
|
||||
(byte*) char_cursor#32 char_cursor zp ZP_PTR_BYTE:5 0.52
|
||||
(byte*~) char_cursor#49 char_cursor zp ZP_PTR_BYTE:5 22.0
|
||||
(void()) divMEMbyFAC((byte*) divMEMbyFAC::mem)
|
||||
(label) divMEMbyFAC::@1
|
||||
(label) divMEMbyFAC::@return
|
||||
(byte*) divMEMbyFAC::mem
|
||||
(byte[]) f_127
|
||||
(const byte[]) f_127#0 f_127 = { (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 0 }
|
||||
(byte*) f_2pi
|
||||
(const byte*) f_2pi#0 f_2pi = ((byte*))(word) 58085
|
||||
(byte[]) f_i
|
||||
(const byte[]) f_i#0 f_i = { (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 0 }
|
||||
(word()) getFAC()
|
||||
(label) getFAC::@return
|
||||
(byte*) getFAC::hi
|
||||
(const byte*) getFAC::hi#0 hi = ((byte*))(byte/word/signed word) 255
|
||||
(byte*) getFAC::lo
|
||||
(const byte*) getFAC::lo#0 lo = ((byte*))(byte/word/signed word) 254
|
||||
(word) getFAC::return
|
||||
(word) getFAC::return#0 return zp ZP_WORD:9 4.333333333333333
|
||||
(word) getFAC::return#2 return zp ZP_WORD:9 22.0
|
||||
(word) getFAC::w
|
||||
(word) getFAC::w#1 w zp ZP_WORD:9 4.0
|
||||
(byte[]) hextab
|
||||
(const byte[]) hextab#0 hextab = { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' }
|
||||
(byte*) line_cursor
|
||||
(byte*) line_cursor#13 line_cursor zp ZP_PTR_BYTE:3 0.5
|
||||
(byte*) line_cursor#6 line_cursor zp ZP_PTR_BYTE:3 204.0
|
||||
(void()) main()
|
||||
(word~) main::$11 $11 zp ZP_WORD:9 22.0
|
||||
(word~) main::$2 $2 zp ZP_WORD:9 22.0
|
||||
(label) main::@1
|
||||
(label) main::@10
|
||||
(label) main::@11
|
||||
(label) main::@12
|
||||
(label) main::@13
|
||||
(label) main::@14
|
||||
(label) main::@15
|
||||
(label) main::@16
|
||||
(label) main::@3
|
||||
(label) main::@5
|
||||
(label) main::@6
|
||||
(label) main::@7
|
||||
(label) main::@8
|
||||
(label) main::@9
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte) main::i#1 i zp ZP_BYTE:2 11.0
|
||||
(byte) main::i#10 i zp ZP_BYTE:2 1.2692307692307692
|
||||
(byte*) memHi
|
||||
(const byte*) memHi#0 memHi = ((byte*))(byte/word/signed word) 255
|
||||
(byte*) memLo
|
||||
(const byte*) memLo#0 memLo = ((byte*))(byte/word/signed word) 254
|
||||
(void()) mulFACbyMEM((byte*) mulFACbyMEM::mem)
|
||||
(label) mulFACbyMEM::@1
|
||||
(label) mulFACbyMEM::@return
|
||||
(byte*) mulFACbyMEM::mem
|
||||
(byte*) mulFACbyMEM::mem#2 mem zp ZP_PTR_BYTE:7 2.0
|
||||
(void()) prepareMEM((byte*) prepareMEM::mem)
|
||||
(byte~) prepareMEM::$0 reg byte a 4.0
|
||||
(byte~) prepareMEM::$1 reg byte a 4.0
|
||||
(label) prepareMEM::@return
|
||||
(byte*) prepareMEM::mem
|
||||
(byte*) prepareMEM::mem#0 mem zp ZP_PTR_BYTE:7 4.0
|
||||
(byte*) prepareMEM::mem#3 mem zp ZP_PTR_BYTE:7 4.0
|
||||
(byte*) prepareMEM::mem#4 mem zp ZP_PTR_BYTE:7 2.6666666666666665
|
||||
(void()) print_byte((byte) print_byte::b)
|
||||
(byte~) print_byte::$0 reg byte y 4.0
|
||||
(byte~) print_byte::$1 reg byte a 4.0
|
||||
(byte~) print_byte::$3 reg byte a 4.0
|
||||
(byte~) print_byte::$4 reg byte a 4.0
|
||||
(label) print_byte::@1
|
||||
(label) print_byte::@return
|
||||
(byte) print_byte::b
|
||||
(byte) print_byte::b#0 reg byte x 4.0
|
||||
(byte) print_byte::b#1 reg byte x 4.0
|
||||
(byte) print_byte::b#2 reg byte x 1.6
|
||||
(void()) print_char((byte) print_char::ch)
|
||||
(label) print_char::@return
|
||||
(byte) print_char::ch
|
||||
(byte) print_char::ch#0 reg byte a 4.0
|
||||
(byte) print_char::ch#1 reg byte a 4.0
|
||||
(byte) print_char::ch#2 reg byte a 6.0
|
||||
(void()) print_ln()
|
||||
(byte*~) print_ln::$0 $0 zp ZP_PTR_BYTE:3 46.42857142857143
|
||||
(label) print_ln::@1
|
||||
(label) print_ln::@return
|
||||
(void()) print_word((word) print_word::w)
|
||||
(byte~) print_word::$0 reg byte a 4.0
|
||||
(byte~) print_word::$2 reg byte a 4.0
|
||||
(label) print_word::@1
|
||||
(label) print_word::@return
|
||||
(word) print_word::w
|
||||
(word) print_word::w#0 w zp ZP_WORD:9 3.75
|
||||
(void()) setFAC((word) setFAC::w)
|
||||
(byte~) setFAC::$0 reg byte a 4.0
|
||||
(byte~) setFAC::$1 reg byte a 4.0
|
||||
(label) setFAC::@return
|
||||
(byte*) setFAC::hi
|
||||
(const byte*) setFAC::hi#0 hi = ((byte*))(byte/word/signed word) 255
|
||||
(byte*) setFAC::lo
|
||||
(const byte*) setFAC::lo#0 lo = ((byte*))(byte/word/signed word) 254
|
||||
(word) setFAC::w
|
||||
(word) setFAC::w#1 w zp ZP_WORD:9 22.0
|
||||
(word) setFAC::w#3 w zp ZP_WORD:9 5.0
|
||||
(void()) setMEMtoFAC((byte*) setMEMtoFAC::mem)
|
||||
(label) setMEMtoFAC::@1
|
||||
(label) setMEMtoFAC::@return
|
||||
(byte*) setMEMtoFAC::mem
|
||||
(byte*) setMEMtoFAC::mem#2 mem zp ZP_PTR_BYTE:7 2.0
|
||||
(void()) sinFAC()
|
||||
(label) sinFAC::@return
|
||||
|
||||
zp ZP_BYTE:2 [ main::i#10 main::i#1 ]
|
||||
zp ZP_PTR_BYTE:3 [ line_cursor#6 line_cursor#13 print_ln::$0 ]
|
||||
reg byte x [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
|
||||
reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ]
|
||||
zp ZP_PTR_BYTE:5 [ char_cursor#23 char_cursor#31 char_cursor#32 char_cursor#49 char_cursor#10 ]
|
||||
zp ZP_PTR_BYTE:7 [ prepareMEM::mem#4 prepareMEM::mem#3 prepareMEM::mem#0 mulFACbyMEM::mem#2 setMEMtoFAC::mem#2 ]
|
||||
zp ZP_WORD:9 [ setFAC::w#3 setFAC::w#1 main::$2 getFAC::return#2 main::$11 print_word::w#0 getFAC::w#1 getFAC::return#0 ]
|
||||
reg byte a [ print_word::$0 ]
|
||||
reg byte a [ print_word::$2 ]
|
||||
reg byte y [ print_byte::$0 ]
|
||||
reg byte a [ print_byte::$1 ]
|
||||
reg byte a [ print_byte::$3 ]
|
||||
reg byte a [ print_byte::$4 ]
|
||||
reg byte a [ prepareMEM::$0 ]
|
||||
reg byte a [ prepareMEM::$1 ]
|
||||
reg byte a [ setFAC::$0 ]
|
||||
reg byte a [ setFAC::$1 ]
|
23
src/main/java/dk/camelot64/kickc/test/sinus-basic.kc
Normal file
23
src/main/java/dk/camelot64/kickc/test/sinus-basic.kc
Normal file
@ -0,0 +1,23 @@
|
||||
import "print"
|
||||
import "basic-floats"
|
||||
|
||||
byte[] f_i = {0, 0, 0, 0, 0};
|
||||
byte[] f_127 = {0, 0, 0, 0, 0};
|
||||
byte* f_2pi = $e2e5;
|
||||
|
||||
void main() {
|
||||
setFAC(127);
|
||||
setMEMtoFAC(f_127);
|
||||
for(byte i : 1..25) {
|
||||
setFAC((word)i);
|
||||
mulFACbyMEM(f_2pi);
|
||||
setMEMtoFAC(f_i);
|
||||
setFAC(25);
|
||||
divMEMbyFAC(f_i);
|
||||
sinFAC();
|
||||
mulFACbyMEM(f_127);
|
||||
addMEMtoFAC(f_127);
|
||||
print_word(getFAC());
|
||||
print_ln();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user