mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-20 02:32:36 +00:00
Changed plasma routines to use standard C types.
This commit is contained in:
parent
63f10a28de
commit
b2a0b629e3
@ -9,9 +9,9 @@ import "c64"
|
||||
import "print"
|
||||
import "sid"
|
||||
|
||||
const byte* SCREEN1 = $2800;
|
||||
const byte* CHARSET = $2000;
|
||||
const byte* SINTABLE = $1f00;
|
||||
const unsigned char* SCREEN1 = $2800;
|
||||
const unsigned char* CHARSET = $2000;
|
||||
const unsigned char* SINTABLE = $1f00;
|
||||
|
||||
kickasm(pc SINTABLE) {{
|
||||
.for(var i=0;i<$100;i++)
|
||||
@ -22,7 +22,7 @@ void main() {
|
||||
asm { sei }
|
||||
*BORDERCOL = BLUE;
|
||||
*BGCOL = BLUE;
|
||||
for(byte* col : COLS..COLS+1000) *col = BLACK;
|
||||
for(unsigned char* col : COLS..COLS+1000) *col = BLACK;
|
||||
makecharset(CHARSET);
|
||||
*D018 = toD018(SCREEN1, CHARSET);
|
||||
while(true) {
|
||||
@ -32,52 +32,52 @@ void main() {
|
||||
}
|
||||
|
||||
// Plasma state variables
|
||||
byte c1A = 0;
|
||||
byte c1B = 0;
|
||||
byte c2A = 0;
|
||||
byte c2B = 0;
|
||||
unsigned char c1A = 0;
|
||||
unsigned char c1B = 0;
|
||||
unsigned char c2A = 0;
|
||||
unsigned char c2B = 0;
|
||||
|
||||
// Render plasma to the passed screen
|
||||
void doplasma(byte* screen) {
|
||||
void doplasma(unsigned char* screen) {
|
||||
|
||||
byte[40] xbuf;
|
||||
byte[25] ybuf;
|
||||
unsigned char[40] xbuf;
|
||||
unsigned char[25] ybuf;
|
||||
|
||||
byte c1a = c1A;
|
||||
byte c1b = c1B;
|
||||
for (byte i = 0; i < 25; ++i) {
|
||||
unsigned char c1a = c1A;
|
||||
unsigned char c1b = c1B;
|
||||
for (unsigned char i = 0; i < 25; ++i) {
|
||||
ybuf[i] = (SINTABLE[c1a] + SINTABLE[c1b]);
|
||||
c1a += 4;
|
||||
c1b += 9;
|
||||
}
|
||||
c1A += 3;
|
||||
c1B -= 5;
|
||||
byte c2a = c2A;
|
||||
byte c2b = c2B;
|
||||
for (byte i = 0; i < 40; ++i) {
|
||||
unsigned char c2a = c2A;
|
||||
unsigned char c2b = c2B;
|
||||
for (unsigned char i = 0; i < 40; ++i) {
|
||||
xbuf[i] = (SINTABLE[c2a] + SINTABLE[c2b]);
|
||||
c2a += 3;
|
||||
c2b += 7;
|
||||
}
|
||||
c2A += 2;
|
||||
c2B -= 3;
|
||||
for (byte i = 0; i < 40; ++i) {
|
||||
inline for (byte ii = 0; ii < 25; ++ii) {
|
||||
for (unsigned char i = 0; i < 40; ++i) {
|
||||
inline for (unsigned char ii = 0; ii < 25; ++ii) {
|
||||
(screen+ii*40)[i] = (xbuf[i] + ybuf[ii]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make a plasma-friendly charset where the chars are randomly filled
|
||||
void makecharset(byte* charset) {
|
||||
const byte[8] bittab = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
|
||||
void makecharset(unsigned char* charset) {
|
||||
const unsigned char[8] bittab = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
|
||||
sid_rnd_init();
|
||||
print_cls();
|
||||
for (word c = 0; c < 0x100; ++c) {
|
||||
byte s = SINTABLE[<c];
|
||||
for ( byte i = 0; i < 8; ++i){
|
||||
byte b = 0;
|
||||
for (byte ii = 0; ii < 8; ++ii) {
|
||||
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) {
|
||||
if ((sid_rnd() & 0xFF) > s) {
|
||||
b |= bittab[ii];
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ import "c64"
|
||||
import "print"
|
||||
import "sid"
|
||||
|
||||
const byte* SCREEN1 = $2800;
|
||||
const byte* SCREEN2 = $2c00;
|
||||
const byte* CHARSET = $2000;
|
||||
const byte* SINTABLE = $1f00;
|
||||
const unsigned char* SCREEN1 = $2800;
|
||||
const unsigned char* SCREEN2 = $2c00;
|
||||
const unsigned char* CHARSET = $2000;
|
||||
const unsigned char* SINTABLE = $1f00;
|
||||
|
||||
kickasm(pc SINTABLE) {{
|
||||
.for(var i=0;i<$100;i++)
|
||||
@ -22,7 +22,7 @@ void main() {
|
||||
asm { sei }
|
||||
*BORDERCOL = BLUE;
|
||||
*BGCOL = BLUE;
|
||||
for(byte* col : COLS..COLS+1000) *col = BLACK;
|
||||
for(unsigned char* col : COLS..COLS+1000) *col = BLACK;
|
||||
makecharset(CHARSET);
|
||||
// Show double-buffered plasma
|
||||
while(true) {
|
||||
@ -34,37 +34,37 @@ void main() {
|
||||
}
|
||||
|
||||
// Plasma state variables
|
||||
byte c1A = 0;
|
||||
byte c1B = 0;
|
||||
byte c2A = 0;
|
||||
byte c2B = 0;
|
||||
unsigned char c1A = 0;
|
||||
unsigned char c1B = 0;
|
||||
unsigned char c2A = 0;
|
||||
unsigned char c2B = 0;
|
||||
|
||||
// Render plasma to the passed screen
|
||||
void doplasma (byte* screen) {
|
||||
void doplasma (unsigned char* screen) {
|
||||
|
||||
byte[40] xbuf;
|
||||
byte[25] ybuf;
|
||||
unsigned char[40] xbuf;
|
||||
unsigned char[25] ybuf;
|
||||
|
||||
byte c1a = c1A;
|
||||
byte c1b = c1B;
|
||||
for (byte i = 0; i < 25; ++i) {
|
||||
unsigned char c1a = c1A;
|
||||
unsigned char c1b = c1B;
|
||||
for (unsigned char i = 0; i < 25; ++i) {
|
||||
ybuf[i] = (SINTABLE[c1a] + SINTABLE[c1b]);
|
||||
c1a += 4;
|
||||
c1b += 9;
|
||||
}
|
||||
c1A += 3;
|
||||
c1B -= 5;
|
||||
byte c2a = c2A;
|
||||
byte c2b = c2B;
|
||||
for (byte i = 0; i < 40; ++i) {
|
||||
unsigned char c2a = c2A;
|
||||
unsigned char c2b = c2B;
|
||||
for (unsigned char i = 0; i < 40; ++i) {
|
||||
xbuf[i] = (SINTABLE[c2a] + SINTABLE[c2b]);
|
||||
c2a += 3;
|
||||
c2b += 7;
|
||||
}
|
||||
c2A += 2;
|
||||
c2B -= 3;
|
||||
for (byte ii = 0; ii < 25; ++ii) {
|
||||
for (byte i = 0; i < 40; ++i) {
|
||||
for (unsigned char ii = 0; ii < 25; ++ii) {
|
||||
for (unsigned char i = 0; i < 40; ++i) {
|
||||
screen[i] = (xbuf[i] + ybuf[ii]);
|
||||
}
|
||||
screen += 40;
|
||||
@ -72,15 +72,15 @@ void doplasma (byte* screen) {
|
||||
}
|
||||
|
||||
// Make a plasma-friendly charset where the chars are randomly filled
|
||||
void makecharset(byte* charset) {
|
||||
const byte[8] bittab = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
|
||||
void makecharset(unsigned char* charset) {
|
||||
const unsigned char[8] bittab = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
|
||||
sid_rnd_init();
|
||||
print_cls();
|
||||
for (word c = 0; c < 0x100; ++c) {
|
||||
byte s = SINTABLE[<c];
|
||||
for ( byte i = 0; i < 8; ++i){
|
||||
byte b = 0;
|
||||
for (byte ii = 0; ii < 8; ++ii) {
|
||||
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) {
|
||||
if ((sid_rnd() & 0xFF) > s) {
|
||||
b |= bittab[ii];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user