From b2a0b629e30420227d59fb090b58a9285ca1e661 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Mon, 8 Apr 2019 16:33:52 +0200 Subject: [PATCH] Changed plasma routines to use standard C types. --- src/test/kc/examples/plasma/plasma-unroll.kc | 52 +++++++++---------- src/test/kc/examples/plasma/plasma.kc | 54 ++++++++++---------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/test/kc/examples/plasma/plasma-unroll.kc b/src/test/kc/examples/plasma/plasma-unroll.kc index 5400666f5..7ae77990e 100644 --- a/src/test/kc/examples/plasma/plasma-unroll.kc +++ b/src/test/kc/examples/plasma/plasma-unroll.kc @@ -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[ s) { b |= bittab[ii]; } diff --git a/src/test/kc/examples/plasma/plasma.kc b/src/test/kc/examples/plasma/plasma.kc index 4a5e27661..daef2dd08 100644 --- a/src/test/kc/examples/plasma/plasma.kc +++ b/src/test/kc/examples/plasma/plasma.kc @@ -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[ s) { b |= bittab[ii]; }