Omnimaga

Omnimaga => News => Topic started by: critor on August 08, 2013, 04:26:20 pm

Title: HP-Prime prototype performance test: color graphic programs
Post by: critor on August 08, 2013, 04:26:20 pm
Several websites have begun comparing the TI-Nspire CX, Casio Classpad II fx-400CP and HP-Prime performances by using the softwares now available online (http://tiplanet.org/forum/viewtopic.php?t=12809).

It is a mistake because beyond the performance of the host computer, those software are often not emulators but simulators. They're running a system which has been rebuilt for the computer.



The calculation performances are often in direct link with the processor speed, and therefore we can expect the HP-Prime calculating faster than all its competitors.

Where we sometimes do have some surprises, is with programs dealing with lots of outputs/displays, mostly games. In fact, there is no dedicated graphic processor on our calculators. Thus output instructions "plunders" processor time, which consequently has less time to process calculations of the program itself. The more pixels and colors the screen can display, the more calculations required are required and it is a problem particularly for the TI-84 Plus C Silver Edition.



Therefore lets's check this evening if the HP-Prime's processor has the same problem. We will use our HP-Prime DVT prototype, and the new color tunnel game made by DJ_O for the HP-Prime software:
(http://www.omnimaga.org/index.php?action=dlattach;topic=16752.0;attach=15850;image)

Now lets get a look of the game directly on the calculator itself:

It rocks... it's so fast that it becomes unplayable! ;D(http://www.omnimaga.org/Themes/default/images/gpbp_arrow_up.gif)

On the HP-Prime we don't have access to assembly programs, and we wouldn't dare imagining what it would have done... The power of assembly is usually used by other calculator models for games. It seems it might be possible on the HP-Prime to develop huge games without a single line of assembly! You might even need to slow down your games with some loops! :P
But of course, the speed is not the only advantage of the assembly language, it also allows you to perform many usually achievable things... ;)



Download:
http://www.omnimaga.org/index.php?action=dlattach;topic=16752.0;attach=15851

Program source:
http://ourl.ca/19349/357143

Cross-posted from:
http://tiplanet.org/forum/viewtopic.php?p=146654&lang=en
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Sorunome on August 08, 2013, 04:40:56 pm
Wow, that is pretty awesome! The HP-Prime is so faaast O.O/me wants
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 08, 2013, 05:31:26 pm
Dang! This speed is insane! O.O

It's like 4-5 times the speed of the original tunnel (which this game is based on):

[ Invalid YouTube link ]

This makes me wonder about sprites. I wonder what kind of data storage this calc supports besides lists, strings and vars? If there is a different smaller format, then maybe we could store sprite data then recall it later to display tilemaps pixel by pixel?

My concern are math operations, though. On the 39gII, maths, especially floating points calculations, were particularly slow compared to graphical display. In the Prime emu, if I use decimals I see a noticeable slowdown when I do complex animations and stuff.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: timwessman on August 08, 2013, 06:28:38 pm
Well, the goal was to make it so the default user language was fast enough that what previously only possible in assembly would be possible with the user language. Granted, assembly will always win since hand tuned code will always win over anything else no matter what. However, should be able to do a ton with what is there already, and it will only get better over time.

This is only first release... :-D

TW
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: TIfanx1999 on August 08, 2013, 07:25:06 pm
Indeed, and it's looking great so far Tim. :)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: timwessman on August 08, 2013, 08:23:23 pm
This makes me wonder about sprites.

Something like this should work... haven't tested it. Scales it up too.

EXPORT Sprite()
BEGIN
DIMGROB_P(G2,4,4,{ #7C0003E0001F0000:64, #0, #0, #7C0003E0001F0000:64 });
BLIT_P(G0,20,20,100,100,G2,RGB(0,0,0));
WAIT(3);
END;

Quote
My concern are math operations, though. On the 39gII, maths, especially floating points calculations, were particularly slow compared to graphical display. In the Prime emu, if I use decimals I see a noticeable slowdown when I do complex animations and stuff.

Please elaborate. Basically, in the non-CAS programming there is absolutely no difference internally between 1 1.0, 1.1 or 1.1111111111. They are all the same thing.

TW
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Hooloovoo on August 08, 2013, 09:14:41 pm
You might even need to slow down your games with some loops! :P
On the computer software, it seems as if there is a WAIT() command to wait a certain number of seconds, and it works with fractions of seconds. there is also TICKS for the overall system clock in milliseconds, which could be used to make timing or scoring more accurate/precise/cool.
Title: Re: Re: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 08, 2013, 09:31:59 pm
This makes me wonder about sprites.

Something like this should work... haven't tested it. Scales it up too.

EXPORT Sprite()
BEGIN
DIMGROB_P(G2,4,4,{ #7C0003E0001F0000:64, #0, #0, #7C0003E0001F0000:64 });
BLIT_P(G0,20,20,100,100,G2,RGB(0,0,0));
WAIT(3);
END;

Quote
My concern are math operations, though. On the 39gII, maths, especially floating points calculations, were particularly slow compared to graphical display. In the Prime emu, if I use decimals I see a noticeable slowdown when I do complex animations and stuff.

Please elaborate. Basically, in the non-CAS programming there is absolutely no difference internally between 1 1.0, 1.1 or 1.1111111111. They are all the same thing.

TW
thanks, I'll try that code later. As for decimals, I mean that in the emulator, I noticed that stuff like A+1.1 is noticeably slower than A+1. I'll have to give that another try when i get home on my comp.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: bb010g on August 08, 2013, 09:43:03 pm
thanks, I'll try that code later. As for decimals, I mean that in the emulator, I noticed that stuff like A+1.1 is noticeably slower than A+1. I'll have to give that another try when i get home on my comp.
It might be that the C++ compiler is able to optimize Ints and Integers more than Floats and Doubles on the computer, yet on the calculator they are just as fast.
Title: Re: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 08, 2013, 09:54:26 pm
Oh that could explain it. Hopefully this doesn't cause speed disparity in games where stuff is calculated in both format alternatively. Not that speed should be a serious issue, from what I could see, though.

@critor: Question: Is the LCD refresh rate capped at a certain framerate like on the 39gII (which was 10 FPS)?
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Spenceboy98 on August 08, 2013, 09:54:30 pm
I have a question. What do we know about lists on the Prime? I'd like to test some things. :P

Also, I love the speed. :D I'd much rather have one of these than a TI84PCSE.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Hooloovoo on August 08, 2013, 10:02:03 pm
I did some tests using the  TIME() command (times how long the argument takes), and it seems that floating points take about the same amount of time than any other number.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 08, 2013, 10:09:41 pm
Interesting. Anyway I personally hope we can also use smaller type of numbers and data, because if someone decides to make an RPG like Pokémon, that game will be absolutely massive >.<
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: timwessman on August 08, 2013, 10:18:24 pm
It might be that the C++ compiler is able to optimize Ints and Integers more than Floats and Doubles on the computer, yet on the calculator they are just as fast.

No, this wouldn't explain it. The only possible difference here might be on the PC with a binary integer object (#<digits>:<-sign><size><o|b|h|d>) and the normal reals (BCD encoded), but I would expect that is so tiny as to be nearly negligible.

All numbers in the numerical part of the system (ie not in the CAS) are BCD encoded. On the HW there are some hand written assembly routines for the low level BCD addition, subtraction, multiplication and so on, but just normal C code for the same on windows.

@critor: Question: Is the LCD refresh rate capped at a certain framerate like on the 39gII (which was 10 FPS)?

I believe the screen refresh is at 52hz.

TW
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Hooloovoo on August 08, 2013, 10:27:17 pm
Next time, hit the modify button above your post instead of 'double posting'. Also, if you happen to have an IRC client, there is a lot of good conversation about calculators and other stuff going on in #omnimaga on EFNet.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Lionel Debroux on August 09, 2013, 03:08:56 am
Quote
All numbers in the numerical part of the system (ie not in the CAS) are BCD encoded.
Good. Though using BCD floats is usually slower than using binary floats is, BCD floats have at least one advantage: 2.0 + 1.0 = 3.0, instead of, say, 2.0 + 1.0 = 2.9999999999999999 with binary floats. Arbitrary shifts and rotates in the ARM ISA probably helps reducing the performance gap between BCD and binary floats.

TI-68k/AMS uses the so-called "SMAP II BCD" format, described in http://debrouxl.github.io/gcc4ti/timath.html#bcd . I don't know for the Nspire, but the Nspire's CAS is a close derivative of the TI-68k CAS...
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 10, 2013, 02:14:59 am
Critor,

Could you test the following program and tell me what performance do you get?

It displays a randomized tilemap made of weird looking sprites (stored to the right of the screen, since I haven't figured out how to get BLIT_P to work with G1-G9), but I am curious about the frame rate at which a new tilemap is displayed or at least how long does it take to fill the screen?

Code: [Select]
EXPORT Sprite()
BEGIN
FOR Z FROM 0 TO 239 DO
RECT_P(G0,304,Z,319,Z+1,RGB(INT(RANDOM(256)),Z,240-Z));
END;
WHILE 1 DO
FOR X FROM 0 TO 18 DO
FOR Y FROM 0 TO 14 DO
16*INT(RANDOM(14))->V;
BLIT_P(G0,16*X,16*Y,G0,304,V,320,V+16);
END;
END;
END;
END;

The tilemap is 19x15 large.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: critor on August 11, 2013, 06:38:57 am
Here is your program video:
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Streetwalrus on August 11, 2013, 07:06:16 am
That's freaking awesome ! O.O This shows that a Zelda GBC style game could be made in pure BASIC. *.*
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 11, 2013, 07:28:03 am
Wow 5 FPS is actually pretty darn good considering that is BASIC. Even the CSE has an hard time pulling this with pure ASM when in 320x240 mode.

SO basically no scrolling unless you want your game to scroll tile by tile, but pretty fast sprite movement and no long map loading :D

Now to figure out how to avoid having to keep a bunch of tiles displayed to the right side of the screen >.<
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: TIfanx1999 on August 11, 2013, 02:05:16 pm
Very nice! I'd also like to say thank you critor, for being our Guinea pig. :P
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 11, 2013, 05:20:07 pm
Now to hope that the official product will not be clocked down to 10 MHz :P (although even then, drawing the tilemap would still be faster than in pure TI-BASIC)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 12, 2013, 12:54:26 am
EDIT: Had code issue but realized it was a typo. My bad.

However... I just discovered the most awesome thing ever in a calc BASIC (including hybrid):

Scaling support! *.*

Code: [Select]
EXPORT spritetest2()
BEGIN
DIMGROB_P(G1,120,48,RGB(0,0,0));
TEXTOUT_P("HELLO",G1,0,0,7);
FOR Z FROM 1 TO 800 DO
RECT_P(RGB(Z/4,Z/4,255));
BLIT_P(G0,0,0,Z,Z,G1,RGB(80,255,255));
WAIT(0.03);
END;
END;

(Text seems to look weird, though)




Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: TIfanx1999 on August 12, 2013, 02:06:09 am
Wow, that's sweet!  :crazy: I wonder what other fun things HP BASIC can do?
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 12, 2013, 02:28:56 am
Even scrolling! O.O (assuming the program runs fast enough on Critor's calc)

Code: [Select]
EXPORT scrollingtest()
BEGIN
DIMGROB_P(G1,800,800);
FOR Z FROM 0 TO 800 DO
RECT_P(G1,0,Z,800,Z+1,RGB(INT(RANDOM(125)),INT(Z/7),0));
END;
FOR Z FROM 0 TO 800 STEP 4 DO
RECT_P(G1,Z,0,Z+1,800,RGB(INT(Z/6),INT(RANDOM(156)),INT(RANDOM(156))));
END;
0▶X;
0▶Y;
1▶Z;
WHILE 1 DO
Y-(ISKEYDOWN(2))+(ISKEYDOWN(12))▶Y;
X-(ISKEYDOWN(7))+(ISKEYDOWN(8))▶X;
Z-(0.1*ISKEYDOWN(45))+(0.1*ISKEYDOWN(50))▶Z;
BLIT_P(G0,0,0,INT(320/Z),INT(240/Z),G1,X,Y,320+X,240+Y);
WAIT(0.02);
END;
END;

This works because GROB vars can be larger than the screen.

Sorry for the choppy GIF, it's because VirtualDub seems to have an hard time compressing such kind of GIF and I didn't want to upload a 3 MB screenshot.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: timwessman on August 12, 2013, 03:09:42 am
Hello,

The code I'd posted previously (the little sprite command), shows how to load colors to a grob, and how to scale it.

Code: [Select]
EXPORT Sprite()
BEGIN
DIMGROB_P(G2,4,4,{ #7C0003E0001F0000:64, #0, #0, #7C0003E0001F0000:64 });
BLIT_P(G0,20,20,100,100,G2,RGB(0,0,0));
WAIT(3);
END;

Note that scaling is only a pixel by pixel things. It doesn't not interpolate. Also note that you can specify different source regions from the grob. This means you could have a larger grob containing a tileset, and blit in from a specific location.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 12, 2013, 04:06:06 am
Yeah I was confused at the first values at first but then by re-reading that code earlier this is how I realized that scaling was possible.

By the way, is there any image<>hex converter that supports A1R5G5B5 format or something that can convert JPEG/BMP/GIF to exactly that image format?
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Jim Bauwens on August 12, 2013, 05:33:54 am
By the way, is there any image<>hex converter that supports A1R5G5B5 format or something that can convert JPEG/BMP/GIF to exactly that image format?

Do you have any sample HEX strings? Just to see what endianness is needed. Once I got this I'll add an export option to my TI-Nspire sprite editor as Nspire Lua also uses A1R5G5B5 for its sprites.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: critor on August 12, 2013, 09:49:13 am
Tested scaling + scrolling:

Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 12, 2013, 12:48:50 pm
You forgot to remove the WAIT(0.02) commands D:

That said, we already notice it's not even running at 50 FPS like the WAIT command tried to slow it down to, but there will be a speed gain if you remove it for sure.

By the way, is there any image<>hex converter that supports A1R5G5B5 format or something that can convert JPEG/BMP/GIF to exactly that image format?

Do you have any sample HEX strings? Just to see what endianness is needed. Once I got this I'll add an export option to my TI-Nspire sprite editor as Nspire Lua also uses A1R5G5B5 for its sprites.
Sadly nope. I still am unsure how to make them. D: However, I know that it's 16 bits and uses 4 hex characters (such as 4EF8) for 1 pixel.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Jim Bauwens on August 12, 2013, 03:06:34 pm
Hello,

The code I'd posted previously (the little sprite command), shows how to load colors to a grob, and how to scale it.

Code: [Select]
EXPORT Sprite()
BEGIN
DIMGROB_P(G2,4,4,{ #7C0003E0001F0000:64, #0, #0, #7C0003E0001F0000:64 });
BLIT_P(G0,20,20,100,100,G2,RGB(0,0,0));
WAIT(3);
END;

Note that scaling is only a pixel by pixel things. It doesn't not interpolate. Also note that you can specify different source regions from the grob. This means you could have a larger grob containing a tileset, and blit in from a specific location.

I've tried some of my own 4x4 sprites and they work fine. However, I can't manage to go beyond 4x4 because I can't specify hex strings longer than 64 bits. Any way that bigger sprites can be done (using hex strings)?
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: critor on August 12, 2013, 03:38:30 pm
You forgot to remove the WAIT(0.02) commands D:

That said, we already notice it's not even running at 50 FPS like the WAIT command tried to slow it down to, but there will be a speed gain if you remove it for sure.

Thank you DJ_O.

I've retried the scaling demo by:
- removing the wait command
- adding double buffering to avoid flicking (which happened because of redrawing the screen twice on each loop)

Except that the display is better, the speed seems similar:
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: TIfanx1999 on August 12, 2013, 03:44:17 pm
The speed actually looks faster, even with double buffering. Very nice! :)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: critor on August 12, 2013, 03:56:58 pm
You forgot to remove the WAIT(0.02) commands D:

That said, we already notice it's not even running at 50 FPS like the WAIT command tried to slow it down to, but there will be a speed gain if you remove it for sure.

Thank you DJ_O.

I've retried the scrolling demo by removing the wait command.

It's much faster:
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: TIfanx1999 on August 12, 2013, 03:59:34 pm
That looks great! ;D By the way, how is the directional pad in the center? Does it feel solid, and is it responsive?
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 12, 2013, 04:02:51 pm
Yup it definitively seems faster. The speed may not be as fast as drawing 1 sprite, but it's still very impressive.

Hello,

The code I'd posted previously (the little sprite command), shows how to load colors to a grob, and how to scale it.

Code: [Select]
EXPORT Sprite()
BEGIN
DIMGROB_P(G2,4,4,{ #7C0003E0001F0000:64, #0, #0, #7C0003E0001F0000:64 });
BLIT_P(G0,20,20,100,100,G2,RGB(0,0,0));
WAIT(3);
END;

Note that scaling is only a pixel by pixel things. It doesn't not interpolate. Also note that you can specify different source regions from the grob. This means you could have a larger grob containing a tileset, and blit in from a specific location.

I've tried some of my own 4x4 sprites and they work fine. However, I can't manage to go beyond 4x4 because I can't specify hex strings longer than 64 bits. Any way that bigger sprites can be done (using hex strings)?
Hmm that sucks >.<. I assume this means that our sprites (for example 16x16 tiles) will have to split into 16 chunks placed one after another vertically? (So if your game has 16 tiles that are 16x16, you would have a 4x1024 pixels GROB instead of 16x256). Then to draw the sprite, you would just use a For loop that scans through the 16 chunks vertically.

Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: critor on August 12, 2013, 04:07:35 pm
That looks great! ;D By the way, how is the directional pad in the center? Does it feel solid, and is it responsive?

Unlike the TI-Nspire CX/CM, the directional pad is a normal key here, thus being as responsive as the other keys. :)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: TIfanx1999 on August 12, 2013, 04:10:34 pm
I see, that's very good news indeed. :D
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: timwessman on August 12, 2013, 05:53:15 pm
By the way, is there any image<>hex converter that supports A1R5G5B5 format or something that can convert JPEG/BMP/GIF to exactly that image format?

No, don't have anything for that. Sorry. (might tweak one and post it later though). It is a very basic encoding scheme though.


Basically, all that is happening is that you convert a #FF value into a linearly scaled #1F value. Here is a C macro that shows how this is done internally.

#define RGBToColor(R,G,B) (((R>>3)<<10)+((G>>3)<<5)+((B>>3))) // transforms 0-255 RGB into color

The 16 bit is just a flag that signifies transparency.

Note that the DIMGROB command just takes the information in order. So if you want to make a 6x3 grob, The first 4 16 bit groups come out of the first hex numb, the next hex num takes the first 2 and then the last 2 are the start of the second line and so on...  { |#64bits, #(upper32)||(lower32), #64bits|,|#64bits,#(upper32bits)|(unused) }.

Each line in the 6 width takes the first 6 16 bit groups it finds. Each "line" of the grob is defined between the paired | |. Remember that all hex numbers, regardless of sign/unsigned/bits is internally 64 bits of data.


Title: Re: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 12, 2013, 10:44:00 pm
Oh ok thanks, so after all sprites larger than 4x4 are possible. :)

That said I was contemplating just using 8x8 sprites scaled up to twice their size, because when xLIB comes out for the TI-84 Plus C Silver Edition it would make it easier to port games to the Prime and it would be 4 times smaller anyway.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Jim Bauwens on August 13, 2013, 06:39:21 am
By the way, is there any image<>hex converter that supports A1R5G5B5 format or something that can convert JPEG/BMP/GIF to exactly that image format?

No, don't have anything for that. Sorry. (might tweak one and post it later though). It is a very basic encoding scheme though.


Basically, all that is happening is that you convert a #FF value into a linearly scaled #1F value. Here is a C macro that shows how this is done internally.

#define RGBToColor(R,G,B) (((R>>3)<<10)+((G>>3)<<5)+((B>>3))) // transforms 0-255 RGB into color

The 16 bit is just a flag that signifies transparency.

Note that the DIMGROB command just takes the information in order. So if you want to make a 6x3 grob, The first 4 16 bit groups come out of the first hex numb, the next hex num takes the first 2 and then the last 2 are the start of the second line and so on...  { |#64bits, #(upper32)||(lower32), #64bits|,|#64bits,#(upper32bits)|(unused) }.

Each line in the 6 width takes the first 6 16 bit groups it finds. Each "line" of the grob is defined between the paired | |. Remember that all hex numbers, regardless of sign/unsigned/bits is internally 64 bits of data.

Ah thanks for the information. I made a quick converter in javascript to convert sprites: http://bwns.be/jim/hpsprite.html .
(http://i.imgur.com/vIZH6Nw.png)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: deeph on August 13, 2013, 06:49:12 am
And here is a small converter for windows : img2prime.zip (http://www.mirari.fr/rPwG) (just drag and drop the image to convert on it) :)

(http://www.mirari.fr/OPfq)

It even handles transparency :P

But I'm not sure if the ":64" are always necessary.
Title: Re: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 13, 2013, 03:19:00 pm
I was scared when I saw the 56 KB thing lol O.O, but then I saw your program and said phew. I hope that a 16x16 sprite won't take 50 KB because imagine if someone decides to port Zelda Links Awakening or something.

Anyway thanks, I'll try both programs :)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: bb010g on August 13, 2013, 05:38:39 pm
And here is a small converter for windows : img2prime.zip (http://www.mirari.fr/rPwG) (just drag and drop the image to convert on it) :)

(image)

It even handles transparency :P

But I'm not sure if the ":64" are always necessary.

For Linux and OS X users:
The source file is small enough that you can install the PureBasic demo and compile an executable for deeph's program on your respective platform.
I have attached an i686 Linux executable made on Arch Linux with GCC 4.8.1-2, for those on Linux who don't want to install it. (If it doesn't work, just pull down the demo.)
http://db.tt/9PLl5hL8
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: deeph on August 13, 2013, 05:56:08 pm
Cool, thanks !

Don't hesitate to optimise it or ask me for new features/bug fixes.

I've not tested it a lot so I don't know if there are bugs in some cases.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 13, 2013, 05:56:28 pm
By the way, Deeph's converter doesn't appear to do sprites larger than 16x16, so to convert multiple images, you might have to convert them separately then merge the sprite data.

Otherwise, if you try to convert, for example, a sprite sheet that is 144x96, all you'll get is 16x16 worth of data. For example, the following image gave the following code:

(http://www.omnimaga.org/index.php?action=dlattach;topic=3611.0;attach=15883;image)

Code: [Select]
{ #839B839B839B839B:64, #010001000100839B:64, #839B010001000100:64, #839B839B839B839B:64, #839B839B839B839B:64, #7DE17DE17DE10100:64, #01007DE17DE17DE1:64, #839B839B839B839B:64, #0100839B839B839B:64, #7DE17DE17DE17DE1:64, #7DE17DE17DE17DE1:64, #839B839B839B0100:64, #0100839B839B839B:64, #01007DE17DE17DE1:64, #7DE17DE17DE10100:64, #839B839B839B0100:64, #01000100839B839B:64, #010001007DE17DE1:64, #7DE17DE101000100:64, #839B839B01000100:64, #01000100839B839B:64, #7DE17DE101000100:64, #010001007DE17DE1:64, #839B839B01000100:64, #01007F6A0100839B:64, #7F6A7F6A7F6A7F6A:64, #7F6A7F6A7F6A7F6A:64, #839B01007F6A0100:64, #7F6A7F6A0100839B:64, #7F6A01007F6A7F6A:64, #7F6A7F6A01007F6A:64, #839B01007F6A7F6A:64, #01000100839B839B:64, #7F6A01007F6A7F6A:64, #7F6A7F6A01007F6A:64, #839B839B01000100:64, #0100839B839B839B:64, #7DE17F6A7F6A0100:64, #01007F6A7F6A7DE1:64, #839B839B839B0100:64, #01000100839B839B:64, #010001007DE17F6A:64, #7F6A7DE101000100:64, #839B839B01000100:64, #7F6A7F6A0100839B:64, #7DE17F6A7F6A0100:64, #01007F6A7F6A7DE1:64, #839B01007F6A7F6A:64, #7F6A7F6A0100839B:64, #7F6A7DE17DE10100:64, #01007DE17DE17F6A:64, #839B01007F6A7F6A:64, #01000100839B839B:64, #0100010001000100:64, #0100010001000100:64, #839B839B01000100:64, #0100839B839B839B:64, #010001007DE17DE1:64, #7DE17DE101000100:64, #839B839B839B0100:64, #839B839B839B839B:64, #839B010001000100:64, #010001000100839B:64, #839B839B839B839B:64 }
Using Jim Bauwens' converter, the code didn't even fit in one post lol.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: deeph on August 13, 2013, 06:22:15 pm
It works fine here, with your image I get ~70kb of data (which seems too much for the prime to draw).

How did you use it ?
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 13, 2013, 06:39:55 pm
I drag-dropped the image above into your batch file.

By the way I created a new topic to continue this sprite converter/compression discussion, so that it's in the HP Prime section and not lost later in news. http://ourl.ca/19398
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: deeph on August 13, 2013, 06:42:17 pm
The batch file is just an example of how to use it inline (it only converts sprite.png), you have to drop your image on img2prime.exe (I know it's a bit confusing)...
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 13, 2013, 06:42:56 pm
Oh ok lol, my bad.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: deeph on August 13, 2013, 06:51:01 pm
Looks like there are some colors messed up in some cases, I'll have to fix that tomorow :o

And I'll certainly remove the spaces between the values because it increases the program size uselessly.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 13, 2013, 06:59:56 pm
Yeah true. That said, if someone prefers his sprites to be in a format where it shows each column in separate lines for readability, it's good, but since the screen has no word wrapping, I feel it's better to keep them in one line. It takes much less time to scroll through the code lol.

Hopefully, if one day there is ASM support on the Prime, maybe someone could write a program that compresses BASIC programs that don't contain special chars into ASCII and that decompresses them back into Unicode when you try to run them, so they would take less space.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: deeph on August 13, 2013, 07:29:24 pm
Ok I've debugged my program, now it works perfectly :)

(http://www.mirari.fr/gJQV)

img2prime.zip (http://www.mirari.fr/mjJj)

bb010g > can you recompile it for linux ?

Also, you can now throw as many images as you want on it.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 13, 2013, 10:38:04 pm
Nice :D. It appears a little distorted in your program, but I guess just some minor BLIT dimensions adjusting would fix the problem.

Btw does programs written in English mode work on French mode or vice-versa? I remember that on the TI-89 it wasn't the case.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: bb010g on August 14, 2013, 01:36:18 am
Ok I've debugged my program, now it works perfectly :)

(image)

img2prime.zip (http://www.mirari.fr/mjJj)

bb010g > can you recompile it for linux ?

Also, you can now throw as many images as you want on it.

I'm planning to have a program to do sprites with RECTs by Thursday, but for now:
http://db.tt/9PLl5hL8
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: deeph on August 14, 2013, 04:44:10 am
Btw does programs written in English mode work on French mode or vice-versa? I remember that on the TI-89 it wasn't the case.
Yes, the functions names aren't translated since I think it's not tokenized so there are no problems of compatibility (luckily).

I'm planning to have a program to do sprites with RECTs by Thursday
Is that really more optimised than with GROBs ?

edit : I've optimised a bit more the converter, now when he finds "#0000000000000000:64" (black) it only writes "#0:64".

The download link is the same ( http://www.mirari.fr/mjJj ), but bb010g, can you recompile it again ? Sorry :-[
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 14, 2013, 05:52:45 pm
Thanks for the update :)

Also I saw the video at
and I'm betting that parallax scrolling might be possible or at least displaying multiple sprites on the screen.


EDIT: Fixed link
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Gilles59 on August 15, 2013, 05:25:53 pm
Hi all,

2 examples of programs and videos with the hardware :

http://www.dailymotion.com/video/x132v9e_defender_tech (http://www.dailymotion.com/video/x132v9e_defender_tech)
Code: [Select]
EXPORT Defender()
BEGIN
 LOCAL xv:=10,yv:=20;
 DIMGROB_P(G1,640, 48);
 DIMGROB_P(G2,320,240);
 Y:=32;
 FOR X:=0 TO 640 DO
  Y:=MIN(MAX(Y-1+IP(RANDOM(3)),0),47);
  LINE_P(G1,X,48,X,48-Y);
  FREEZE;
 END;
 RECT();
 FOR X:=0 TO (640-64) DO
  xv:=xv+2*(ISKEYDOWN(8)-ISKEYDOWN(7));
  yv:=yv+2*(ISKEYDOWN(12)-ISKEYDOWN(2));
  BLIT_P(G2,0,0,320,240,G1,X,0,X+64,48);
  IF GETPIX_P(G2,xv+10,yv+5)==0 THEN BREAK; END;
  RECT_P(G2,xv,yv,xv+10,yv+5,0,#20B2AAh);
  BLIT_P(G0,G2);
 END;
 FOR N:=1 TO 100 DO INVERT_P; END;
END;

I tried the same program with a 40*20 pixels for the spaceship and it run at the same speed

Scroll(1) ->1 pixel scroll :D

http://www.dailymotion.com/video/x130nft_scroll-prime_tech (http://www.dailymotion.com/video/x130nft_scroll-prime_tech)

Code: [Select]
EXPORT Scroll(s)

BEGIN
LOCAL x:=100,y:=100;

DIMGROB_P(G1,640,480);  

FOR N:=1 TO 200 DO
RECT_P(G1,IP(RANDOM(640)),IP(RANDOM(480)),IP(RANDOM(640)),IP(RANDOM(480)),0,IP(RANDOM(255^3)));
END;

REPEAT
x:=MAX(MIN(x+ISKEYDOWN(8)-ISKEYDOWN(7),320),0);
y:=MAX(MIN(y+ISKEYDOWN(12)-ISKEYDOWN(2),240),0);
BLIT_P(G0,0,0,G1,x,y,320+x,240+y);
UNTIL ISKEYDOWN(4);

END;
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: deeph on August 15, 2013, 05:52:28 pm
Wow this is impressive. HP really made a great work with its Basic :thumbsup:

I wasn't sure if I should buy a 84+CSE knowing it is so slow (they simply should have put an eZ80 at 50 MHz on it  ::)), but I'll surely get one of this. At least even if we don't have the possibility to execute ASM/C code on it for some time it still looks like a great plateforme for programing :)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: chickendude on August 15, 2013, 08:08:57 pm
It does look like a nice platform for programming, but i'd only get it for ASM/C programming ;) Everything so far has impressed me, though. Congrats, HP!
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 15, 2013, 10:44:54 pm
Try to keep NES, SNES and such emulators for later if you code one, though, because as soon as we got emulators on the Nspire, this pretty much killed game development on the platform D:
Hi all,

2 examples of programs and videos with the hardware :

http://www.dailymotion.com/video/x132v9e_defender_tech (http://www.dailymotion.com/video/x132v9e_defender_tech)
Code: [Select]
EXPORT Defender()
BEGIN
 LOCAL xv:=10,yv:=20;
 DIMGROB_P(G1,640, 48);
 DIMGROB_P(G2,320,240);
 Y:=32;
 FOR X:=0 TO 640 DO
  Y:=MIN(MAX(Y-1+IP(RANDOM(3)),0),47);
  LINE_P(G1,X,48,X,48-Y);
  FREEZE;
 END;
 RECT();
 FOR X:=0 TO (640-64) DO
  xv:=xv+2*(ISKEYDOWN(8)-ISKEYDOWN(7));
  yv:=yv+2*(ISKEYDOWN(12)-ISKEYDOWN(2));
  BLIT_P(G2,0,0,320,240,G1,X,0,X+64,48);
  IF GETPIX_P(G2,xv+10,yv+5)==0 THEN BREAK; END;
  RECT_P(G2,xv,yv,xv+10,yv+5,0,#20B2AAh);
  BLIT_P(G0,G2);
 END;
 FOR N:=1 TO 100 DO INVERT_P; END;
END;

I tried the same program with a 40*20 pixels for the spaceship and it run at the same speed

Scroll(1) ->1 pixel scroll :D

http://www.dailymotion.com/video/x130nft_scroll-prime_tech (http://www.dailymotion.com/video/x130nft_scroll-prime_tech)

Code: [Select]
EXPORT Scroll(s)

BEGIN
LOCAL x:=100,y:=100;

DIMGROB_P(G1,640,480);  

FOR N:=1 TO 200 DO
RECT_P(G1,IP(RANDOM(640)),IP(RANDOM(480)),IP(RANDOM(640)),IP(RANDOM(480)),0,IP(RANDOM(255^3)));
END;

REPEAT
x:=MAX(MIN(x+ISKEYDOWN(8)-ISKEYDOWN(7),320),0);
y:=MAX(MIN(y+ISKEYDOWN(12)-ISKEYDOWN(2),240),0);
BLIT_P(G0,0,0,G1,x,y,320+x,240+y);
UNTIL ISKEYDOWN(4);

END;
Wow that looks really cool and fun to play! One suggestion, though, would be to add colors and make the sky black like in the original game. It's a color screen, after all. ;)

Also welcome here Gilles59!
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Lionel Debroux on August 16, 2013, 01:28:10 am
Welcome, Gilles ;)

Quote
Try to keep NES, SNES and such emulators for later if you code one, though, because as soon as we got emulators on the Nspire, this pretty much killed game development on the platform :(
Emulators do have their share of responsibility in the fact that native Nspire ports / brand-new games are relatively scarce, but I think that the very facts the platform is a closed one, and TI repeatedly actively fights developers, have an even greater responsibility :)

Emulators are not to blame for the unusually long time it took for porting Linux to the Nspire (on most platforms, porting Linux is a challenge which lasts several weeks or months - lack of such a port simply shows general lack of developer interest); TI's behaviour and the availability of platforms which are all of more open, more powerful and cheaper, are to blame.
Title: Re: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 16, 2013, 12:10:19 pm
Yeah true, but the issue with HP and Casio is that their smaller market share will already have an impact on how many programmers venture into those calcs, so the effects would be as bad as with TI's actions against 3rd party ASM dev on the Nspire.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: ruler501 on August 16, 2013, 05:48:43 pm
I'll get this if it is <$150 and has C/Asm support. It looks like a great calculator and I'd love to see it with an SDL port.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 16, 2013, 06:38:14 pm
Sadly I think it will be the same price as the regular TI-Nspire D:

As for now it only has BASIC, but it's very fast. But yeah I bet people will try to hack it to get ASM/C running on it, then the community mission will be to prevent people from posting cheating tools on forums to avoid HP from blocking ASM support.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Lionel Debroux on August 17, 2013, 01:35:15 am
Quote
I'll get this if it is <$150 and has C/Asm support.
It's supposed to be around this price tag, but it has been made clear that it has no native code support either.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: ruler501 on August 17, 2013, 09:31:49 am
I was going to wait until the community found a way. We were also told the nspire wouldn't have native code and we have linux for it now. I have lots of hope that we will get native code support eventually.
Title: Re: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 17, 2013, 12:02:42 pm
With the Nspire it took 3 years, though. I hope it won't take as long with the Prime. With the Prizm at least, Assembly hacks arrived before the calc even came out
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: TIfanx1999 on August 17, 2013, 03:12:19 pm
Hey Gilles59, that's some great looking stuff. :D Thanks for sharing, and welcome to Omnimaga.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Gilles59 on August 19, 2013, 07:20:11 am
Hey Gilles59, that's some great looking stuff. :D Thanks for sharing, and welcome to Omnimaga.

Thanks!

I've no time for now but I did some little tests with the small skeletton of the 'defender'  program (change color, use sprites, kind of 'radar' in the upper of the screen...). I think the integrated langage of the prime is fast enough for fluid programs  like  tretis, 'snake', space invader ... even with scrolling...  

Add to this  the 'touch screen' behavoir and the possibilities are infinite. Of course, no 3D real time and  probably limitations with 2 D games...

All graphics command are really fast (including copy of parts of 'grob'in another grobs or in the screen (grob G0), ,and the keyboard management is fine.

I tried a 90° rotate with a 100x100 pixels in the more easy way to do (FOR x:1->100, FOR y:1->100, getpix (x,y)  -> pixon(y,x) in ... It tooks less than 0.6 sec (with the copy from G0 -> G1 and G1 ->G0 and 10000 pixels in 24 bits) . Not ASM for sure, but fast enough for many things
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: TIfanx1999 on August 19, 2013, 04:45:36 pm
I've no time for now but I did some little tests with the small skeletton of the 'defender'  program (change color, use sprites, kind of 'radar' in the upper of the screen...). I think the integrated langage of the prime is fast enough for fluid programs  like  tretis, 'snake', space invader ... even with scrolling... 

I've been thinking the same based on the demonstrations I've seen so far. :)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 19, 2013, 06:31:28 pm
I guess someone could always do some sprite/tile rotation to draw pre-rendered maps that rotates by 90° when turning around, like Brandish for the SNES. Heck, maybe even 45° would be possible if you know how to calculate the new tiles location.
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Gilles59 on August 20, 2013, 05:33:52 pm
Small program example...
Real time rotation with a 40x40 pixels bloc

Code: [Select]

EXPORT Rota
BEGIN
 LOCAL sa,ca;
 DIMGROB(G1,40,40);
 RECT_P(99,79,140,120,0,RGB(255,255,255));
 FOR A:=0 TO 10*PI STEP PI/12 DO
  RECT_P(G1);
  sa:=SIN(-A); ca:=COS(-A);
  FOR X:=-20 TO 20 DO
   FOR Y:=-20 TO 20 DO
    PIXON_P(G1,X+20,Y+20,GETPIX_P(G0,X*ca-Y*sa+20,X*sa+Y*ca+20));
   END;
  END;
 BLIT_P(G0,100,80,140,120,G1,0,0,40,40);
 END;
 WAIT();
END;

Video hdw : http://www.dailymotion.com/video/x13eb0q_rotation (http://www.dailymotion.com/video/x13eb0q_rotation)
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 20, 2013, 11:07:17 pm
Wow that is great! If a game in particular was kept kinda simple (without too many tiles), someone could just pre-render each frame of the rotated tile, store them into GROB's then display them whenever needed. Of course since 20x15 tilemapping is a bit on the slow side too, it would probably be best to just use larger tiles and use maps such as 10x7 though.

Good job!
Title: Re: HP-Prime prototype performance test: color graphic programs
Post by: Gilles59 on August 21, 2013, 09:55:54 am
Wow 5 FPS is actually pretty darn good considering that is BASIC. Even the CSE has an hard time pulling this with pure ASM when in 320x240 mode.

SO basically no scrolling unless you want your game to scroll tile by tile, but pretty fast sprite movement and no long map loading :D

Now to figure out how to avoid having to keep a bunch of tiles displayed to the right side of the screen >.<

Hi, Just try :

EXPORT Sprite()
BEGIN
DIMGROB(G1,16,239);
FOR Z FROM 0 TO 239 DO
RECT_P(G1,0,Z,16,Z+1,RGB(IP(RANDOM(256)),Z,240-Z));
END;
WHILE 1 DO
FOR X FROM 0 TO 19 DO
FOR Y FROM 0 TO 14 DO
V:=16*IP(RANDOM(14));
BLIT_P(G0,16*X,16*Y,G1,0,V,16,V+16);
END;
END;
END;
END;

It's cuirous that INT works for Integer Part. The correct keyword accordind the help is IP  (INT is for calculate Integral)
Title: Re: Re: Re: HP-Prime prototype performance test: color graphic programs
Post by: DJ Omnimaga on August 21, 2013, 10:26:33 am
Wow 5 FPS is actually pretty darn good considering that is BASIC. Even the CSE has an hard time pulling this with pure ASM when in 320x240 mode.

SO basically no scrolling unless you want your game to scroll tile by tile, but pretty fast sprite movement and no long map loading :D

Now to figure out how to avoid having to keep a bunch of tiles displayed to the right side of the screen >.<

Hi, Just try :

EXPORT Sprite()
BEGIN
DIMGROB(G1,16,239);
FOR Z FROM 0 TO 239 DO
RECT_P(G1,0,Z,16,Z+1,RGB(IP(RANDOM(256)),Z,240-Z));
END;
WHILE 1 DO
FOR X FROM 0 TO 19 DO
FOR Y FROM 0 TO 14 DO
V:=16*IP(RANDOM(14));
BLIT_P(G0,16*X,16*Y,G1,0,V,16,V+16);
END;
END;
END;
END;

It's cuirous that INT works for Integer Part. The correct keyword accordind the help is IP  (INT is for calculate Integral)
actually that post you quoted was kinda old and outdated, since I figured out since then why DIMGROB and BlIT weren't working with G1 to G9. Thanks anyway though!