1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-02 00:41:42 +00:00

Added array-based bresenham

This commit is contained in:
jespergravgaard 2017-05-29 22:54:36 +02:00
parent 1540439d36
commit cc3158e387
3 changed files with 7 additions and 9 deletions

View File

@ -2,6 +2,6 @@ lda {zpptrby1}
clc
adc #{coby1}
sta {zpptrby1}
lda {zpptrby1}+1
adc #0
sta {zpptrby1}+1
bcs !+
inc {zpptrby1}+1
!:

View File

@ -30,17 +30,12 @@ public class Pass3RegisterAllocation {
throw new RuntimeException("Unhandled variable type "+var);
}
}
/*
allocation.allocate(symbols.getVariable("i#0"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("i#1"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("i#2"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("i#3"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("n1#1"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("n1#2"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("ptr#1"), new RegisterAllocation.RegisterZpPointerByte(2));
allocation.allocate(symbols.getVariable("ptr#2"), new RegisterAllocation.RegisterZpPointerByte(2));
allocation.allocate(symbols.getVariable("ptr#3"), new RegisterAllocation.RegisterZpPointerByte(2));
*/
allocation.allocate(symbols.getVariable("e#2"), new RegisterAllocation.RegisterZpByte(128));
allocation.allocate(symbols.getVariable("e#3"), new RegisterAllocation.RegisterZpByte(128));
allocation.allocate(symbols.getVariable("e#4"), new RegisterAllocation.RegisterZpByte(128));
@ -58,6 +53,9 @@ public class Pass3RegisterAllocation {
allocation.allocate(symbols.getVariable("cursor#3"), new RegisterAllocation.RegisterZpPointerByte(133));
allocation.allocate(symbols.getVariable("cursor#4"), new RegisterAllocation.RegisterZpPointerByte(133));
allocation.allocate(symbols.getVariable("cursor#5"), new RegisterAllocation.RegisterZpPointerByte(133));
allocation.allocate(symbols.getVariable("ptr#1"), new RegisterAllocation.RegisterZpPointerByte(135));
allocation.allocate(symbols.getVariable("ptr#2"), new RegisterAllocation.RegisterZpPointerByte(135));
allocation.allocate(symbols.getVariable("ptr#3"), new RegisterAllocation.RegisterZpPointerByte(135));
symbols.setAllocation(allocation);
}

View File

@ -13,7 +13,7 @@ import java.util.List;
/** Test my KickC Grammar */
public class Main {
public static void main(String[] args) throws IOException {
final String fileName = "src/dk/camelot64/kickc/test/bresenham.kc";
final String fileName = "src/dk/camelot64/kickc/test/bresenhamarr.kc";
final CharStream input = CharStreams.fromFileName(fileName);
System.out.println(input.toString());
KickCLexer lexer = new KickCLexer(input);