So recently I've been trying to make a little effect on a Casio Prizm and have finally managed to draw sprites to the screen (thanks to that new pre-compiled SDK, may I add!) though I've ran into another wall. I'm trying to fill the white background of my program with a blue color, but the pre-made function suggested by the wiki isn't working. Here is my code:
Code:
I've also tried using values that aren't LCD_WIDTH_/HEIGHT_PX and placing the line after using CopySprite but it still doesn't work. Any suggestions on what I'm doing wrong?
Code:
#include <fxcg/display.h>
#include <fxcg/keyboard.h>
#include <math.h>
void CopySprite(const color_t* palette, int x, int y, int width, int height) {
color_t *VRAM = (color_t*)GetVRAMAddress();
VRAM += LCD_WIDTH_PX * y + x;
for (int j = y; j < y + height; j++) {
for (int i = x; i < x + height; i++) {
*(VRAM++) = *(palette++);
}
VRAM += LCD_WIDTH_PX - width;
}
}
void fillArea(unsigned x, unsigned y, unsigned w, unsigned h, unsigned short col) {
unsigned short*s = (unsigned short*)0xA8000000;
s += (y * 384) + x;
while (h--) {
unsigned w2 = w;
while (w2--)
*s++ = col;
s += 384 - w;
}
}
int main() {
const color_t sprite[2048] = {
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0xff64,0xff64,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x042a,0x042a,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0x042a,0x042a,0x042a,0x042a,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x042a,0x042a,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0x042a,0x042a,0x042a,0x042a,0xff64,0xff64,0xff64,0xff64,0xff64,0xff64,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,
0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,
0x0726,0x0726,0xfbb5,0xfbb5,0xfbb5,0xfbb5,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0xfbb5,0xfbb5,0xfbb5,0xfbb5,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,
0x0726,0x0726,0xfbb5,0xfbb5,0xfbb5,0xfbb5,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0xfbb5,0xfbb5,0xfbb5,0xfbb5,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,
0x0726,0x0726,0xfbb5,0xfbb5,0xfbb5,0xfbb5,0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0xfbb5,0xfbb5,0xfbb5,0xfbb5,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,
0x0726,0x0726,0xfbb5,0xfbb5,0xfbb5,0xfbb5,0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0xfbb5,0xfbb5,0xfbb5,0xfbb5,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,
0x042a,0x042a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,
0x042a,0x042a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x194a,0x194a,0x194a,0x194a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,
0x042a,0x042a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,
0x042a,0x042a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x042a,0x042a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x042a,0x042a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x042a,0x042a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x042a,0x042a,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x0726,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x042a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,
0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a,0x194a
};
fillArea(0, 0, LCD_WIDTH_PX, LCD_HEIGHT_PX, 0x194a);
CopySprite(sprite, 64, 64, 32, 32);
int key;
while (1) GetKey(&key);
return 0;
}
I've also tried using values that aren't LCD_WIDTH_/HEIGHT_PX and placing the line after using CopySprite but it still doesn't work. Any suggestions on what I'm doing wrong?