Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 00:09:09 *
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 ... 3 4 [5]   Go Down
  Print  
Author Topic: Prizm Useful Routines -- post here! -  (Read 3992 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
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 #60 on: 28 November, 2011, 09:23:04 »
0

Not much optimization I can see there other than changing the flags in the makefile. The only thing I might do is include some type casts because your arguments are unsigned chars which don't have the necessary width for your bit shifts. My own personal preference is to use 24 bit color and then convert it to 16 bits using a simple routine because it's much easier to write out in code but your method does have a speed advantage.
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)
PierrotLL
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 02 December, 2012, 19:26:25
Date Registered: 14 February, 2011, 23:12:59
Location: France
Posts: 19


Total Post Ratings: +2

View Profile
« Reply #61 on: 28 November, 2011, 14:36:04 »
0

IsKeyDown equivalent

1
2
3
4
5
6
7
8
9
10
int keydown(int basic_keycode)
{
const unsigned short* keyboard_register = (unsigned short*)0xA44B0000;
int row, col, word, bit;
row = basic_keycode%10;
col = basic_keycode/10-1;
word = row>>1;
bit = col + 8*(row&1);
return (0 != (keyboard_register[word] & 1<<bit));
}
Expect a Basic keycode (27=right, 38=left) or 10 to test the AC/ON key.
It allow to detect multiple pressed keys simultaneous.
« Last Edit: 29 November, 2011, 03:02:10 by PierrotLL » 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 #62 on: 16 December, 2011, 00:05:47 »
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.
Bump-bi-di-bump the topic for asking someone to realize zoo-msacled sprite drawing function. That could be very useful to some animations..
I think always that 2^factors would be easier and faster to use...

moderator edit: fixed
« Last Edit: 22 December, 2011, 08:11:39 by z80man » Logged




DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 19:10:11
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50232


Total Post Ratings: +2615

View Profile WWW
« Reply #63 on: 22 December, 2011, 07:42:03 »
0

I think you put your answer inside the quote Eiyeron Huh?
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
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 #64 on: 22 December, 2011, 08:16:02 »
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.
Bump-bi-di-bump the topic for asking someone to realize zoo-msacled sprite drawing function. That could be very useful to some animations..
I think always that 2^factors would be easier and faster to use...

moderator edit: fixed
For shrinking sprites factors of 2 would be much faster while for enlarging there wouldn't be a difference. What could be done is that the routine checks if a factor of 2 is used and then resizes using the proper routine. It isn't too hard to check whether an integer is a factor of 2 or not especially if you limit the the scale size to something like x16
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 #65 on: 23 December, 2011, 22:53:45 »
0

I think you put your answer inside the quote Eiyeron Huh?
I think I should miswrite somewhere: I request the help from someone to make this function...

Anyway, my function for my project

Two pixels are concatened like this:
0bAAAABBBB
or
0xAB


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void CopySprite_Palette_Alpha_Nibbles(unsigned char* data, unsigned short* palette, int x, int y, int width, int height) {
   unsigned short* VRAM = (unsigned short*)0xA8000000;
   unsigned short* ptr = VRAM + y*LCD_WIDTH_PX + x;
   int i,j;
   unsigned char nibble;  //Get the color's index to use.
   for(j=0; j<height; j++) {
                for(i = 0; i < width; i+=2)
                {
                nibble = (*data)>>4; We get the first pixel
                        if(nibble)  //First index is alpha.
                                *ptr = palette[nibble];  //COpy from the palette
                nibble = (*data) %16; We get the second pixel
                        if(nibble)  //On the road again
                                *(ptr+1) = palette[nibble];
/*                      else
                                *(ptr+1) = palette[0];*/ // FOr tests
                        ptr+=2; //We go furtherer on the VRAM
                        data++; //Idem
                }
                ptr += LCD_WIDTH_PX-width; // Go one line lower.
   }
}

Max 16 colours, enough for Pokémons, in example... :-°
First index is alpha
(Could you please too adapt this function to add a zoom factor, please? I would be erternally grateful)
« Last Edit: 29 December, 2011, 19:53:58 by Eiyeron » 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 #66 on: 24 December, 2011, 00:05:01 »
0

Could I get some comments on that routine. Always a good practice cause it can often be difficult for some people to understand others code. I'm out of town right now but I'll write something up when I get back tomorrow
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 #67 on: 29 December, 2011, 19:50:25 »
0

Okay... I'll do that!

EDIT: DONE!
« Last Edit: 29 December, 2011, 19:54:10 by Eiyeron » Logged




[email protected]
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 28 April, 2013, 19:38:12
Date Registered: 12 September, 2012, 02:31:13
Posts: 33

Total Post Ratings: 0

View Profile
« Reply #68 on: 13 September, 2012, 01:04:58 »
0

Sorry to go off topic, but z80man, PLEASE could you tell me how you got a gb emulator on your casio, and is there a way to run ti games on a casio?

Edit: oh wait, I was on topic, lol, but is there something like ti-boy for casio prizm that converts file to calc format rather than running it as an emulator, or maybe even an emulator (I want Pokemon but emulators are usually too slow but I'm sure GBC will be fine with Prizm if can't use that method)
« Last Edit: 13 September, 2012, 01:09:27 by [email protected] » Logged
JosJuice
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: Yesterday at 22:11:00
Date Registered: 24 September, 2010, 16:46:12
Location: Sweden
Posts: 1300


Total Post Ratings: +51

View Profile
« Reply #69 on: 14 September, 2012, 22:12:38 »
0

Sorry to go off topic, but z80man, PLEASE could you tell me how you got a gb emulator on your casio, and is there a way to run ti games on a casio?

Edit: oh wait, I was on topic, lol, but is there something like ti-boy for casio prizm that converts file to calc format rather than running it as an emulator, or maybe even an emulator (I want Pokemon but emulators are usually too slow but I'm sure GBC will be fine with Prizm if can't use that method)
TI-Boy is actually an emulator. There aren't any emulators for the Prizm right now, and I don't know of any current projects to make one.
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 #70 on: 19 September, 2012, 22:38:18 »
0

CopySrpite alpha palette with clipping :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void CopySprite_Palette_Alpha_clipping(const unsigned char* data, const unsigned short* palette, int x, int y, int width, int height)
{
   unsigned short* VRAM = (unsigned short*)VRAM_ADRESS;
   unsigned short* ptr = VRAM + y*LCD_WIDTH_PX + x;
   int i,j;
   int real_width = x+width > LCD_WIDTH_PX ? LCD_WIDTH_PX - x : width;
   int decal = x < 0? -x : 0;
   if(real_width <= 0 || decal >= width) return;
   for(j=0; j<height; j++) {
ptr += decal;
data += decal;
for(i = decal; i < real_width; i++)
{
if(*data)
*ptr = palette[*(data)];
ptr++;
data++;
}
data += width - real_width;
ptr += LCD_WIDTH_PX-real_width;
   }
}
Logged




sry9681
LV0 Newcomer (Next: 5)

Offline Offline

Last Login: 28 September, 2012, 06:06:05
Date Registered: 28 September, 2012, 05:49:42
Posts: 1

Total Post Ratings: 0

View Profile
« Reply #71 on: 28 September, 2012, 06:02:00 »
0

hey z80man. I was just wondering, is it possible to have an emulator on the casio prizm? any type of emulator because i see your avatar picture with pokemon on the screen and i was wondering if that was real or photoshopped?
Logged
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 15:37:20
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #72 on: 28 September, 2012, 06:10:22 »
0

Emulators are certainly possible, but nobody's written any. Don't look at me... Also I'm pretty sure that's photoshopped from a common TI-Boy blog screenshot Tongue
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
Pages: 1 ... 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.238 seconds with 31 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.