Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 19:32:47 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 2 3 [4] 5   Go Down
  Print  
Author Topic: Prizm Useful Routines -- post here! -  (Read 3997 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #45 on: 26 October, 2011, 16:57:22 »
0

Ok thanks. Should add a name in the credits for the help?
Eww, why some functions asks char, and elses asks shorts? Undecided
« Last Edit: 26 October, 2011, 17:58:59 by Eiyeron » Logged




calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Today at 16:59:06
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #46 on: 26 October, 2011, 19:38:54 »
0

Feel free to add credits if you want. Also, shorts are used because the Prizm has 16-bit color. What functions want char?
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #47 on: 26 October, 2011, 20:26:55 »
0

CopySprite, and all thats use the Sprite Coder tool
Logged




z80man
Casio Traitor
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 04 September, 2012, 19:42:33
Date Registered: 26 December, 2010, 10:02:50
Location: City 17
Posts: 966


Total Post Ratings: +83

View Profile
« Reply #48 on: 27 October, 2011, 06:52:11 »
0

CopySprite, and all thats use the Sprite Coder tool
I believe those are Kerm's old routines. The reason why he used chars was because they are guaranteed to be 1 byte on every C compiler while a short, though almost always 16 bits, is up to the implementation and we weren't sure yet what size gcc used for shorts yet on the SuperH. Now that shorts have been confirmed to be 2 bytes in memory it is safe to convert those routines from chars. It is also possible to use 32 bit int's or long's for a speed optimization at the cost of size. The reason why the size increases is because the code has to check for 32 bit alignment and if that condition is not met shorts must be used for the leading and/or trailing pixels. Plus if the sprites are small using int's or longs would result in a slower speed due to the alignment checking code. Because of this the only area where you would want to use 32 bit VRAM writes is if you can be guaranteed that the sprite is drawn in alignment (for example if you're drawing a background image) otherwise shorts are perfect for almost all drawing operations.
Logged


List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)
Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #49 on: 27 October, 2011, 13:14:01 »
0

So, We must now convert theses functions, and change the sprites, right?
Logged




z80man
Casio Traitor
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 04 September, 2012, 19:42:33
Date Registered: 26 December, 2010, 10:02:50
Location: City 17
Posts: 966


Total Post Ratings: +83

View Profile
« Reply #50 on: 27 October, 2011, 17:29:35 »
0

So, We must now convert theses functions, and change the sprites, right?
It's easier than you would think. The routines would stay mostly the same and the sprites can be kept the way they are. All you need to do is have a (short*) cast on the char sprite array and it can be used with short based routines. For example if const char test[8450] is your sprite, to convert to a short use short * newtest = (short*)test;
Logged


List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)
Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #51 on: 27 October, 2011, 17:30:56 »
0


1
I saw that, and I made that on alpha_clip...
So... Maybe tell with cemetech to change Source Coder?

Test with copysprite


1
2
3
4
5
6
7
8
9
void CopySprite(short* data, int x, int y, int width, int height) {
   short* VRAM = (short*)0xA8000000;
   VRAM += (LCD_WIDTH_PX*y + x);  // what should I do?
   for(int j=y; j<y+height; j++) {
      memcpy(VRAM,data,width); // and here?
      VRAM += LCD_WIDTH_PX;
      data += width;
   }
}
Is is right? I can't now test
« Last Edit: 27 October, 2011, 17:33:52 by Eiyeron » Logged




Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #52 on: 30 October, 2011, 21:00:49 »
0

I've got a suggestion to do:
Zommed sprites!
Z_sprite(spr, x, y, int factor)
Logged




z80man
Casio Traitor
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 04 September, 2012, 19:42:33
Date Registered: 26 December, 2010, 10:02:50
Location: City 17
Posts: 966


Total Post Ratings: +83

View Profile
« Reply #53 on: 30 October, 2011, 23:13:40 »
0

Do you mean to say zoomed as in a scaled sprite? That is doable but I think you would want to change that function to say Z_sprite(short * spr, int x, int y, int width, int height, float factor)
It is better to use a float there because the factor is often not an integer value especially if you want to shrink a sprite.
Logged


List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)
Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #54 on: 31 October, 2011, 10:21:50 »
0

Maybe with a float, bout would see just *1, *2, io know that would be a quite heavy, but that will us gain size, and raam: WHy stock a 32*32 sprite, when we can just stock the same sprite, in 1:1 dimension, in a 16*16 tile?
Logged




z80man
Casio Traitor
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 04 September, 2012, 19:42:33
Date Registered: 26 December, 2010, 10:02:50
Location: City 17
Posts: 966


Total Post Ratings: +83

View Profile
« Reply #55 on: 01 November, 2011, 07:46:58 »
0

The size of float based routines is really quite negligible and they don't use any extra ram because the entire executable is stored in flash. You could use a fixed point float in this situation but I would advise against them in this situation as the best way to write them out would be to use pre-defined macros such as TWO_POINT_FIVE which would be 0x00028000 in a 32 bit fixed point notation. The other alternative here is to specify when calling the function what size you would like to scale it to instead of providing a scale factor. Perhaps in this situation 2 different functions ought to be developed. One for rather straightforward scales that can be easily implemented such as x.5, x2, x4 and so on. This would be called as 2 raised to the x power. For example passing 0 as the scale will result in a sprite with no change in size while 1 will be x2, 2 as x4, 3 as x8, and so on. That would also mean that -1 would be .5, -2 as .25 and so on. The second routine would require much more overhead and be called with either a float factor or specify the new image size. If this sounds good I can start work on the first routine and have that out in not too long.
Logged


List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)
Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #56 on: 01 November, 2011, 14:25:34 »
0

I try to understand: for me, flaot system is imprecise, and more cpu-eater than prefixe coeffs.
THe system with power of 2 sounds good to me.
Logged




Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #57 on: 27 November, 2011, 15:59:00 »
0

Set colors to a short? Useful for paint-like things (that i want to make...)

1
2
short setColors(unsigned char red, unsigned char green, unsigned char blue)
return ((red & 0x1F) << 11 ) | ((green & 0x3F) << 5 ) | ((blue & 0x1F));

ANyone to optimize this?

Damn, double post... What would i do?
« Last Edit: 27 November, 2011, 19:54:43 by Eiyeron » Logged




calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Today at 16:59:06
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #58 on: 27 November, 2011, 19:23:35 »
0

Set colors to a short? Useful for paint-like things (that i want to make...)

1
2
void setColors(unsigned char red, unsigned char green, unsigned char blue)
return ((red & 0x1F) << 11 ) | ((green & 0x3F) << 5 ) | ((blue & 0x1F));

ANyone to optimize this?

Damn, double post... What would i do?
Actually, that function should return short or unsigned short, not void. And it's hard to tell how to optimize simple C code like this when it all depends on how the assembler generates the code.
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #59 on: 27 November, 2011, 19:54:56 »
0

Yeah! Forgotten that!
Logged




Pages: 1 2 3 [4] 5   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.326 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.