1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-03 12:07:26 +00:00

Completed KickC implementation of flipper

This commit is contained in:
Jesper Gravgaard 2017-07-13 00:50:53 +02:00
parent 8d7dfa8a8d
commit d41f762a8b
5 changed files with 55 additions and 2 deletions

View File

@ -0,0 +1 @@
dey

View File

@ -0,0 +1,4 @@
tya
sec
sbc #{coby1}
tay

View File

@ -0,0 +1,4 @@
tya
clc
adc #{coby1}
tay

View File

@ -94,6 +94,31 @@ public class Pass3RegisterAllocation {
allocation.allocate(symbols.getVariable("prepare::i#0"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("prepare::i#1"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("prepare::i#2"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::srcIdx#0"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::srcIdx#0"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::srcIdx#1"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::srcIdx#2"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::srcIdx#3"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::srcIdx#4"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::dstIdx#0"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("flip::dstIdx#1"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("flip::dstIdx#2"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("flip::dstIdx#3"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("flip::dstIdx#4"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("flip::dstIdx#5"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("flip::c#0"), new RegisterAllocation.RegisterZpByte(103));
allocation.allocate(symbols.getVariable("flip::c#1"), new RegisterAllocation.RegisterZpByte(103));
allocation.allocate(symbols.getVariable("flip::c#2"), new RegisterAllocation.RegisterZpByte(103));
allocation.allocate(symbols.getVariable("flip::r#0"), new RegisterAllocation.RegisterZpByte(104));
allocation.allocate(symbols.getVariable("flip::r#1"), new RegisterAllocation.RegisterZpByte(104));
allocation.allocate(symbols.getVariable("flip::r#2"), new RegisterAllocation.RegisterZpByte(104));
allocation.allocate(symbols.getVariable("flip::r#3"), new RegisterAllocation.RegisterZpByte(104));
allocation.allocate(symbols.getVariable("flip::r#4"), new RegisterAllocation.RegisterZpByte(104));
allocation.allocate(symbols.getVariable("flip::i#0"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::i#1"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::i#2"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("flip::$0"), RegisterAllocation.getRegisterA());
allocation.allocate(symbols.getVariable("flip::$8"), RegisterAllocation.getRegisterA());
symbols.setAllocation(allocation);

View File

@ -8,8 +8,8 @@ do {
flip();
} while(true)
// Prepare buffer
void prepare() {
// Prepare buffer
byte i=0;
do {
buffer[i] = i;
@ -17,8 +17,27 @@ void prepare() {
} while (i!=0)
}
// Flip buffer
void flip() {
// Flip buffer
byte srcIdx = 0;
byte dstIdx = 15;
byte r=0;
do {
byte c = 0;
do {
buffer2[dstIdx] = buffer[srcIdx];
srcIdx = srcIdx+1;
dstIdx = dstIdx+16;
c=c+1;
} while(c<16)
r=r+1;
dstIdx = dstIdx-1;
} while(r<16)
byte i=0;
do {
buffer[i] = buffer2[i];
i=i+1;
} while (i!=0)
}
// Plot buffer on screen