Author Topic: HP-Prime prototype performance test: color graphic programs  (Read 31614 times)

0 Members and 1 Guest are viewing this topic.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: HP-Prime prototype performance test: color graphic programs
« Reply #15 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...
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP-Prime prototype performance test: color graphic programs
« Reply #16 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.
« Last Edit: August 10, 2013, 02:23:27 am by DJ Omnimaga »

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: HP-Prime prototype performance test: color graphic programs
« Reply #17 on: August 11, 2013, 06:38:57 am »
Here is your program video:

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: HP-Prime prototype performance test: color graphic programs
« Reply #18 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. *.*

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP-Prime prototype performance test: color graphic programs
« Reply #19 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 >.<

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: HP-Prime prototype performance test: color graphic programs
« Reply #20 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

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP-Prime prototype performance test: color graphic programs
« Reply #21 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)
« Last Edit: August 11, 2013, 05:21:10 pm by DJ Omnimaga »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP-Prime prototype performance test: color graphic programs
« Reply #22 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)




« Last Edit: August 12, 2013, 01:20:00 am by DJ Omnimaga »

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: HP-Prime prototype performance test: color graphic programs
« Reply #23 on: August 12, 2013, 02:06:09 am »
Wow, that's sweet!  :crazy: I wonder what other fun things HP BASIC can do?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP-Prime prototype performance test: color graphic programs
« Reply #24 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.
« Last Edit: August 12, 2013, 02:34:17 am by DJ Omnimaga »

Offline timwessman

  • LV3 Member (Next: 100)
  • ***
  • Posts: 94
  • Rating: +32/-0
    • View Profile
Re: HP-Prime prototype performance test: color graphic programs
« Reply #25 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.
« Last Edit: August 12, 2013, 03:14:19 am by timwessman »
TW

Although I work for the HP calculator group, the comments and opinions I post here are my own.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP-Prime prototype performance test: color graphic programs
« Reply #26 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?
« Last Edit: August 12, 2013, 04:09:07 am by DJ Omnimaga »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: HP-Prime prototype performance test: color graphic programs
« Reply #27 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.

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: HP-Prime prototype performance test: color graphic programs
« Reply #28 on: August 12, 2013, 09:49:13 am »
Tested scaling + scrolling:

« Last Edit: August 12, 2013, 09:49:36 am by critor »
TI-Planet co-admin.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP-Prime prototype performance test: color graphic programs
« Reply #29 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.
« Last Edit: August 12, 2013, 12:51:31 pm by DJ Omnimaga »