Author Topic: HP 39gII BASIC(?) speed testing  (Read 10262 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
HP 39gII BASIC(?) speed testing
« on: March 16, 2013, 01:14:54 am »
Code: [Select]
EXPORT Test()
BEGIN
0->A
WHILE 1 DO
A+1->A;
TEXTOUT(A,1,1,2,0,65,2); // str/var,Y,X,FontSize,Color1,Width,BackgroundColor (0=black, 1=dark gray, 2=light gray, 3=white, transparent bg if not setup)
TEXTOUT(A,2,1,2,0);
TEXTOUT(A,3,1,2,3);
TEXTOUT(A,4,1,2,3);
END;
END;

Result: Bold text counter with a shadow behind. In 1 second, I can reach 150! This might look a bit slow, but I used 4 text commands per loop and 3 shades of gray (For some reason the speed seems to get faster sometimes, so much that I reached 400 once)

Also fun fact: The calculator language has rectangle commands, filled, not filled and inverted.

Code: [Select]
EXPORT Test()
BEGIN
0->A
WHILE 1 DO
A+1->A;
INVERT(); (no arguments inverts the entire screen by default. Light gray pixels becomes dark gray or vice-versa)
TEXTOUT(A,1,1,2,0,65,2);
TEXTOUT(A,2,1,2,0);
TEXTOUT(A,3,1,2,3);
TEXTOUT(A,4,1,2,3);
END;
END;

This time, I get 30 frames per second! However, it seems that the LCD is unable to keep up being updated in its entirety at such speed, so there's a lot of frame skipping and tearing (at least it doesn't appear to bottleneck program execution, though)

As a result of the slow LCD, I was unable to check how fast INVERT() alone in a loop was, since it just took like 4 seconds to update at such speed (with some static appearing at times as it inverted gradually)


Now for regular text:

Code: [Select]
EXPORT Test()
BEGIN
0->A
WHILE 1 DO
A+1->A;
TEXTOUT(A,1,1,2,0,65,2);
END;
END;

500 in 1 second. Frame skipping appears to occur, though. This tells me that if a game happens to run incredibly fast, it might need to be adapted so that it looks nice at lower framerate.


Now for the following code:

Code: [Select]
EXPORT TF()
BEGIN
FOR A FROM 0 TO 99999 DO
END;
END;

Executes in 4 seconds.


Have you taken note, TI? :P
« Last Edit: March 16, 2013, 01:22:09 am by DJ_O »

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: HP 39gII BASIC(?) speed testing
« Reply #1 on: March 16, 2013, 05:05:45 am »
Heh :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline totoyo

  • LV3 Member (Next: 100)
  • ***
  • Posts: 68
  • Rating: +2/-0
    • View Profile
    • Planète-Casio
Re: HP 39gII BASIC(?) speed testing
« Reply #2 on: March 16, 2013, 12:38:29 pm »
Quote
Have you taken note, TI?  :P
And Casio too  ;D
Sorry for my bad english, i'm french. Thanks :-)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP 39gII BASIC(?) speed testing
« Reply #3 on: March 17, 2013, 01:26:34 am »
Yeah too.

The only disappointment, though, is:

-Lots of bugs and crashes (had to pull all batteries a few times, although that didn't cause much data damage)
-Being forced to add ; after every line of code can get annoying at times, especially considering you need to press shift everytime
-You need to have the exact same firmware as the calc emu to send programs (and the latest firmwares for both aren't in sync), so basically I am unable to transfer files (although the connectivity kit lets me edit code, so I can copy it easily on the computer)
-There are barely any instructions about sending stuff, nor for the calc maintenance (for example, it isn't told anywhere how to use the flash memory).
-The lower the batteries, the slower the calc gets. This can be problematic for game programming, since nobody got the same battery level. It seems we can change this via the maintenance menu (ON+F4), but then it gets slower again and again so you have to constantly change it back to Full :X .
-The latest firmware I just got appears a bit slower in general.


The funny thing, though, is that despite running at 20 MHz, my Tunnel program actually runs faster than if an equivalent was done in TI-BASIC (in HP's case it is helped a lot by rectangle commands) or Casio BASIC.

This calc can be interesting for programming purposes and has some potential, but I would wait before buying it because it's not fully mature yet. IIRC it was released in China in 2012 before being released here and it's like if it was still in beta stages. If HP gets their act together maybe it could become great, otherwise it probably won't have a very bright future.

Offline TravisE

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 182
  • Rating: +33/-0
    • View Profile
    • ticalc.org
Re: HP 39gII BASIC(?) speed testing
« Reply #4 on: March 18, 2013, 06:39:48 am »
Interesting. I take it the 39gII is a recently released calc model? And it appears to support grayscale directly in the user programming language? That sounds pretty cool.

The HP 50g is rather weird—there is SysRPL (no UserRPL) support for manipulating grayscale graphics, but none for actually displaying them—they apparently leave that up to third-party libraries. Go figure. :P Actually, though, there was a grayscale Easter egg on some ROM versions, and I sometimes see gray pixels when I crash it with bad SysRPL code… I've never really explored grayscale on the 50g yet, so I don't know.
ticalc.org staff member—http://www.ticalc.org/

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP 39gII BASIC(?) speed testing
« Reply #5 on: March 19, 2013, 01:07:48 pm »
Yeah I think the screen supports 4 levels grayscale, and yes even the language lets you use it. It was released in 2012 if I remember, but only in China (probably the reason why they didn't do much effort fixing bugs and why the calc design looks like an old printer). Then in 2013 it was quietly released in Europe.


Also I just made this small program that fills the screen with squares (that has a white border and a different color):

Code: [Select]
EXPORT Tunnel()
BEGIN
0►X;
0►Y;
0►Z;
WHILE 1 DO
Y-ISKEYDOWN(9)+ISKEYDOWN(15)►Y;
X-ISKEYDOWN(14)+ISKEYDOWN(10)►X;
FOR A FROM 0 TO 4 DO
FOR B FROM 0 TO 8 DO
RECT_P(X+(32*B),Y+(32*A),X+32+(32*B),Y+32+(32*A),3,Z);

IF X>0 THEN
−31►X
ELSE
IF X<−31 THEN
0►X
END;
END;
IF Y>0 THEN
−31►Y
ELSE
IF Y<−31 THEN
0►Y
END;
END;
Z+1►Z;
IF Z>3 THEN
0►Z;
END;
END;
END;
END;
END;

This displays 45 flashing squares on the screen that you can move around. When they reach a certain location their position resets so it looks like a loop. In a bit more than a single second I can scroll an entire square in. If the LCD wasn't capped around 10 FPS I would get about 25-30.

I tried the same program earlier but with 16x16 squares instead of 32x32 (meaning 153 squares displayed per frame) and got around 4 FPS.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: HP 39gII BASIC(?) speed testing
« Reply #6 on: March 19, 2013, 07:52:07 pm »
Very cool! ^^

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: HP 39gII BASIC(?) speed testing
« Reply #7 on: March 19, 2013, 08:11:32 pm »
This is not a color calc, correct?

Also, is the great speed a direct benefit of having the CPU built specifically for the calculator? I find that pretty cool about HP calcs. :)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: HP 39gII BASIC(?) speed testing
« Reply #8 on: March 19, 2013, 08:19:22 pm »
Yup, it's a grayscale LCD (so not color, but not black and white either).

I had the chance to take a look at this calc yesterday, it kinda looks like the 68k line of TI calcs in terms of functionality (you can call programs as functions on the homescreen and stuff like that), but it's also pretty glitchy due to the LCD not being able to keep up with the processor.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: HP 39gII BASIC(?) speed testing
« Reply #9 on: March 19, 2013, 10:49:18 pm »
Yup, it's a grayscale LCD (so not color, but not black and white either).

Interesting note is that HP calc screens have been capable of grayscale (not faked at all) for quite some time. ;)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP 39gII BASIC(?) speed testing
« Reply #10 on: March 20, 2013, 12:17:25 am »
Indeed, but this is the first ever model to let people use it inside BASIC programs without ASM libs.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP 39gII BASIC(?) speed testing
« Reply #11 on: March 30, 2013, 02:43:59 am »
Filling the entire screen pixel by pixel:


As you can notice, it's much faster than on the TI-84 Plus. However, it will not be fast enough for scrolling/animated tilemaps made of actual sprites. Single sprite movement (16x32 mario sprite, for instance) appears like it might be fast enough, though, because I get 20 frames per second on a 16x32 square. I get around 8 per second if I draw a 16x32 square made of random static (using the random function, which is a little slow) every frame.


On the other hand, a scrolling tilemap made of squares (all tiles are redrawn every frame) will be very fast:



Of course both of those screenshots were artificially slowed down to match the real calculator speed.

Some notes:

-Games sent to the PC will no longer work on the calculator it seems. My tunnel game has to be recopied by hand in order to run, otherwise it will freeze.

-If you use the connectivity kit to edit your code, you need the emulator open in order to save it. This will then save the program in the emulator, allowing you to send it back to the calc afterward. Else, saving will do nothing.

-As you will see in the Tunnel topic, grayscale is absolutely terrible in the emulator. The LCD color is green-ish, but everything else is actually gray/black. This means that light gray is actually lighter than white! O.O If someone decided to render a Zelda game in it this is how it would look like:



This is the latest emulator build: http://www.hp.com/sbso/product/calculators-emulators/graphic-calculator-emulators.html
« Last Edit: July 16, 2013, 09:55:59 am by DJ Omnimaga »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP 39gII BASIC(?) speed testing
« Reply #12 on: April 21, 2013, 10:44:18 pm »
Something off-topic, but I just noticed something: THe calc-to-calc cable that comes with the HP 39gII has a Mini USB A end, but the other is Mini B...

What's up with that? O.O (the calc only has a mini A port)

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: HP 39gII BASIC(?) speed testing
« Reply #13 on: April 21, 2013, 11:29:53 pm »
You mean with B end now the female end? O.O

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HP 39gII BASIC(?) speed testing
« Reply #14 on: April 22, 2013, 12:02:35 am »
Actually sorry I got it the other way around. The calc has the Mini USB B plug like the TI-84 Plus series, but one end of the link cable is Mini USB A male instead of Mini USB B.