I'm trying to make some add-ins these day.
What I want to do is using the 'CopySprite' function to bring up an imagine.However,Neither of them worked well:(
It never brings up anything on the screen.Just this.I use RGB565,8 bit and 1 bit.Sometimes it even causes SYSTEM ERROR:TLB ERROR.
Code:
Here is my stuff.
Thanks to someone can help me
P.S.My native language isn't English so I may not know the manners here.If I said something wrong,please correct me.Thank you for reading!
What I want to do is using the 'CopySprite' function to bring up an imagine.However,Neither of them worked well:(
It never brings up anything on the screen.Just this.I use RGB565,8 bit and 1 bit.Sometimes it even causes SYSTEM ERROR:TLB ERROR.
Code:
/*
//16 bit
const sega[92160] = {
// balhbalhbalh......
};
*/
//8bit
const sega_palette[251] = {
// balhbalhbalh......
};
// */
/*
// 1 bit(cause crash)
// const color_t SEGA_palette[2] = {0xffff, 0xffdf};
const unsigned char SEGA[11520] = {
// balhbalhbalh.......
};
*/
//main body
#include <fxcg/display.h>
#include <fxcg/keyboard.h>
//#include <color.h>
/*
struct display_graph {
int x;
int y;
int xofs;
int yofs;
int width;
int height;
char colormode;
char zero4;
char P20_1;
char P20_2;
int bitmap;
char color_idx1;
char color_idx2;
char color_idx3;
char P20_3;
char writemodify;
char writekind;
char zero6;
char one1;
int transparency;
};
*/
void main(void) {
int key;
struct display_graph sega;
/*
sega.x = 10;
sega.y = 10;
sega.xofs = 0;
sega.yofs = 0;
sega.colormode = 2;
sega.bitmap = &sega;
sega.color_idx1 = 1;
sega.color_idx2 = 1;
sega.color_idx3 = 1;
sega.writemodify = 1;
sega.writekind = 1;
sega.transparency = 0;
sega.zero4,sega.zero6,sega.one1 = 0;
sega.P20_1,sega.P20_2 = 0x20;
sega.P20_3 = 1;
*/
Bdisp_AllClr_VRAM();
CopySprite(sega,10,10,384,240);
// Bdisp_WriteGraphVRAM(&sega);
Print_OS("Press EXE to exit", 0, 0);
while (1) {
GetKey(&key);
if (key == KEY_CTRL_EXE) {
break;
}
}
return;
}
void CopySprite(color_t* sprite, 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+width; i++) {
*(VRAM++) = *(sprite++);
}
VRAM += LCD_WIDTH_PX-width;
}
}
Here is my stuff.
Thanks to someone can help me
P.S.My native language isn't English so I may not know the manners here.If I said something wrong,please correct me.Thank you for reading!
