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:

/*
//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! Razz
i have found an error in your code my good sir
you are using to many // or /*
this usage is making most of your code go into just notes
for instance instead of using //



const sega_palette[251] = {
// balhbalhbalh......
};


which is the the main error it finds try to eliminate most of your //
so the actual code of that segment looks like this


const sega_palette[251] = {
balhbalhbalh......
};


try to find and delete all if not most of the //
also if you want it to be text from the sprites you need to use quotations
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement