zeldaking wrote:
KermMartian wrote:
Ask us if you need help; you're probably either using the sprite routines wrong or not properly erasing the sprite when a mouse movement event is occurring.

It was doing that before I added the movement code. :/
And does it always do it? I mean, what does it do exactly? Are you using the masked sprite routine or the non-masking overwriting one?
Well, since I had to delete my 90-day trial emulator, I can't get a screenshot. So I will try to explain it. My sprite is pretty much the same as the DCS arrow, except more pixels, I have 4 grays in the sprite so I ran it through source coder and it gave me my data. In my program I call "CopySprite( curX, curY, 16, 16)" becuase my sprite is 16x16 pixels. After compiling and running it, what shows up on the screen is this: No color, just black and white sprite. Two of my sprites side to side. To top it off it drew a black box, 32x16 pixels right underneath both arrow sprites. The code is right... maybe.
About the emulator, you can install it on a virtual machin.

For the arrow, the problem could be in the sprite data, or in the sprite function. Verify first if data are correct.
You can also use the Screen Receiver application to take screenshots. It sounds to me as if you've mismatched the 8-bit and 16-bit sprites and routines, personally. Smile
I wasn't aware there was any differences in the 16-bit and 8-bit routines. Mind to fill me in?
Pierrot: Virtual machine?
zeldaking wrote:
I wasn't aware there was any differences in the 16-bit and 8-bit routines. Mind to fill me in?
Pierrot: Virtual machine?


8bit versus 16bit routines: 16bit routines take raw pixel data in RGB:5-6-5 format and simply draw them. 8bit routines use a palette of 256 colors, and sprite data made up of 8 bit values that correspond to colors in the palette.

As for a virtual machine, you can run another instance of Windows in a program such as VirtualBox and install it into that; the Prizm Emulation software will think you installed it on a whole new machine.
zeldaking wrote:
I wasn't aware there was any differences in the 16-bit and 8-bit routines. Mind to fill me in?
Pierrot: Virtual machine?
The 16-bit sprites and routines hold 16 bits of data per pixel, arranged as 5-6-5: 5 bits of red, 6 bits of green, 5 bits of blue. The 8-bit sprites and routines, on the other hand, work with 8 bits of data per pixel, as 3-3-2. The 8-bit sprites take up half the memory of the 16-bit sprites for a sprite of the same pixel dimensions, but can be made only of 1/256th the possible colors of the 16-bit versions.
Yeah I understand that, but what is the difference in the routines?
*Bump question

Code:

#include <color.h>
#include <display.h>
#include <display_syscalls.h>
#include <keyboard.hpp>
#include <string.h>
#include <keyboard_syscalls.h>
#include <system.h>
#include <stdlib.h>
#include <stdio.h>
#include "data.h"

#define true 1
#define LCD_WIDTH_PX 384 
#define LCD_HEIGHT_PX 216

void CopySprite(const void* data, int x, int y, int width, int height);
int keydownlast(int basic_keycode);
int curX=10;
int curY=10;

int main() {
   CopySprite(cursor, curX, curY, 16, 16);
   int key;
   while(true) {
      GetKey(&key);
      if (keydownlast(KEY_PRGM_UP) && curY > 8) {
         curY = curY-1;
         CopySprite(cursor, curX, curY, 16, 16);
         } else if (keydownlast(KEY_PRGM_DOWN) && curY < 160) {
         curY = curY+1;
         CopySprite(cursor, curX, curY, 16, 16);
      }

   Bdisp_PutDisp_DD();
}
return 0;
}
void CopySprite(const void* datar, int x, int y, int width, int height) {
   color_t*data = (color_t*) datar;
   color_t* VRAM = (color_t*)0xA8000000;
   VRAM += LCD_WIDTH_PX*y + x;
   for(int j=y; j<y+height; j++) {
      for(int i=x; i<x+width; i++) {
         *(VRAM++) = *(data++);
     }
     VRAM += LCD_WIDTH_PX-width;
   }
}
int keydownlast(int basic_keycode) {
   int row, col, word, bit;
   row = basic_keycode%10;
   col = basic_keycode/10-1;
   word = row>>1;
   bit = col + 8*(row&1);
   return (0 != (lastkey[word] & 1<<bit));
}

That is my code so far. Just very primitive cursor movements. But when I try to compile I get this:

Code:


C:\PrizmSDK-0.3\projects\Paint>..\..\bin\make.exe clean
rm -f -fr build C:/PrizmSDK-0.3/projects/Paint/Paint.bin C:/PrizmSDK-0.3/project
s/Paint/Paint.g3a

C:\PrizmSDK-0.3\projects\Paint>..\..\bin\make.exe
sh3eb-elf-gcc -MMD -MP -MF C:/PrizmSDK-0.3/projects/Paint/build/Paint.d -Os -Wal
l -std=c99 -mb -m4a-nofpu -mhitachi -nostdlib   -IC:/PrizmSDK-0.3/projects/Paint
/build -IC:/PrizmSDK-0.3/include -c C:/PrizmSDK-0.3/projects/Paint/src/Paint.c -
o Paint.o
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c: In function 'keydownlast':
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:55:18: error: 'lastkey' undeclared (f
irst use in this function)
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:55:18: note: each undeclared identifi
er is reported only once for each function it appears in
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:50:18: warning: variable 'word' set b
ut not used [-Wunused-but-set-variable]
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:56:1: warning: control reaches end of
 non-void function [-Wreturn-type]
make[1]: *** [Paint.o] Error 1
make: *** [build] Error 2

C:\PrizmSDK-0.3\projects\Paint>pause
Press any key to continue . . .

I know I sound very dumb, but what is wrong? :/
Debugging compilation errors:

1) Find things that say "error". Fix them.
2) Find things that say "warning". Fix them.

For example, the thing to deal with first is this:
Code:
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:55:18: error: 'lastkey' undeclared (f
irst use in this function)
You didn't declare lastkey. Change int key; to int key,lastkey;, or add an int lastkey; somewhere in main().
I have it figured out. It now has a moveable cursor.
Concern:
Before I used Getkey(&key); to quit when pushing menu it wouldn't quit, obviously. Now when I added that in you can quit by pushing menu, but the screen has the battery satus image and the line across the top. How do I get rid of that.
Also I need to re-xor my sprites so when I move it doesn't leave a trail. How would I do that? Thanks
  
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 4 of 4
» 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