Author Topic: HP 39gII grayscale tunnel clone  (Read 8193 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Former TI programmer
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55914
  • Rating: +3152/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
HP 39gII grayscale tunnel clone
« on: March 17, 2013, 11:33:27 pm »
This is a crude Tunnel clone for the HP 39gII calculators and probably the first ever game ever made available for download for this calculator model outside of China. It's crude in the way that it was coded very quickly so it might need plenty of optimizing. I am new to programming this calc and probably won't do much of it due to how instable it is. :P

Because of how incredibly fast this calc is, this is why I manage to get such high framerate even with redrawing the entire screen rectangles and text every frame. This is the BASIC-like language available on-calc. The game is ridiculously big (9.1 KB), probably due to code not being tokenized and partly due to lack of optimizing.

Two particular features seen in this Tunnel clone are grayscale road and bolded text (which is much easier to do than on TI calcs because you can set the text background transparent).

It's available in source code since I am unable to get the linking softwares to work. Here's a Youtube video below:

Code: [Select]
EXPORT Tunnel()
BEGIN
1►C;
0►P;
35►Y;
20►T;
70►L;
0►L1(512);
FOR Z FROM 0 TO 16 DO
3-INT(RANDOM(2))►L1(2Z+1);
20-INT(RANDOM(4))►L1(2Z+2);
END;
RECT();INVERT();
FOR Z FROM 0 TO 2 DO
TEXTOUT_P("Score:",Z,0,2,3,50);
TEXTOUT_P("τ υ η η ε ι  39ǤII",142+Z,0,2,3,128);
END;
WHILE Y>0 DO
FOR Z FROM 0 TO 15 DO
C+1►C;
IF C>16 THEN
1►C;
END;
L1(2C+2)►O;
L1(2C+1)►Q;
RECT_P(16*Z,15,16*Z+15,O,0);
RECT_P(16*Z,O,16*Z+15,O+L,Q,Q);
RECT_P(16*Z,O+L,16*Z+15,126,0);
IF Z=0 THEN
RECT_P(0,Y,8,Y+12,0,3);
RECT_P(2,Y+4,14,Y+8,1,2);
IF Y<O OR Y+12>O+L THEN
−9►Y;
END;
END;
END;
TEXTOUT_P(P,46,0,2,3,48,0);
TEXTOUT_P(P,47,0,2,3);
P+1►P;
L1(2C+2)►S;
3-INT(RANDOM(2))►U;
S+INT(RANDOM(20)-10)►Ans;
IF Ans<15 THEN
15►Ans;
ELSE
IF Ans>120-L THEN
120-L►Ans;
END;
END;
C+1►C;
IF C>16 THEN
1►C;
L-1►L;
END;
Ans►L1(2C+2);
U►L1(2C+1);
Y-(5*ISKEYDOWN(9))+(5*ISKEYDOWN(15))►Y;
END;
FOR Z FROM 0 TO 5 DO
INVERT();
FOR Y FROM 0 TO 999 DO
END;
END;
RECT_P(0,15,256,126,0,0);
MSGBOX("SCORE: "+P,1);
END;



By the way if a staff could create an HP section in the downloads section it would be appreciated. :P Here's the misplaced file for now: http://www.omnimaga.org/index.php?action=downloads;sa=view;down=846


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 grayscale tunnel clone
« Reply #1 on: March 17, 2013, 11:52:35 pm »
Nice :D

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 Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: HP 39gII grayscale tunnel clone
« Reply #2 on: March 18, 2013, 04:16:04 am »
It's HP Basic btw ?

Also, even unoptimized, the thing is going at a reasonable speed I think ;)
« Last Edit: March 18, 2013, 04:16:35 am by Matrefeytontias »

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: HP 39gII grayscale tunnel clone
« Reply #3 on: March 18, 2013, 04:36:00 am »
That's pretty awesome! :D I hope Hp gets around to releasing it stateside, it looks like it could be a very nice calc! :)

Offline TravisE

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 182
  • Rating: +33/-0
    • View Profile
    • ticalc.org
Re: HP 39gII grayscale tunnel clone
« Reply #4 on: March 18, 2013, 06:18:50 am »
That does sound ridiculously fast. :O I'm not sure UserRPL code on the HP 50g would even come near that speed redrawing everything every frame (though scrolling the screen and redrawing new pixel columns each frame should work nicely in SysRPL, I think). Games on the 50g are tricky if you're using RPL due to the annoying garbage collection “pause” that occurs every so often; you have to force it to occur more often (“GARBAGE” in SysRPL or “MEM DROP” in User), but doing it every frame noticeably slows down the frame rate. If you get lucky, you can do it every few frames and get decent speed without the animation looking too jerky, but it seems to depend on exactly what you're doing.

I'm not familiar with the 39 series (I get the impression it has a significantly different internal software design from the 50g, but I have no idea). I can't imagine what would cause that program to take 9KB—even the untokenized text isn't even 1KB. I know the 39s have some kind of unusual “app” system or something like that; perhaps the 9KB includes all the configuration for the current app or something like that? (In case anyone's curious, the 50g compiles user programs into SysRPL code; each command word normally takes about 2.5 bytes (20 bits) each.)
« Last Edit: March 18, 2013, 06:21:25 am by TravisE »
ticalc.org staff member—http://www.ticalc.org/

Offline DJ Omnimaga

  • Former TI programmer
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55914
  • Rating: +3152/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: HP 39gII grayscale tunnel clone
« Reply #5 on: March 18, 2013, 10:14:59 am »
It's HP Basic btw ?

Also, even unoptimized, the thing is going at a reasonable speed I think ;)
Yup, or at least it's the on-calc language that looks like BASIC. :) No ASM nor C were used. At 17-20 MHz with low batteries, I still managed to get 3 FPS with 25 columns of rectangles (3 per column) appearing. In Casio BASIC this thing would take 1 minute per frame to render for sure. I can't imagine how fast it would get if this language had scrolling commands. O.O

However, making this game was a challenge because:

-I don't think this language supports screen shifting commands. To scroll, you have to redraw everything like I did. I could speed my tunnel up by drawing 2 rectangles by column, but then the tunnel would flicker a lot.
-There's no way to redim a list, so no possibility to just shift a list content around by concatenating it with an extra element then truncating the end.
-Matrices can be resized, but you can't concatenate them together.
-You need to add semicolon after most code lines, although that is rather common on computers languages.

As for the rest of the 39 series I think they're way less powerful than the 50g except maybe the 39gs, and very different from the 39gII. THe 39gII was really redone from scratch, uses different screen resolution and as a result its language seems much faster. However it uses the same ARM processor as the 50g I think.

Also I just checked the apps section and they seemed to use the RAM. I am not sure what does use the rest of the flash memory. As for the large program size, I heard it was due to using unicode characters but I'm not sure if this is why.

Offline TravisE

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 182
  • Rating: +33/-0
    • View Profile
    • ticalc.org
Re: HP 39gII grayscale tunnel clone
« Reply #6 on: March 18, 2013, 12:38:51 pm »
If they recoded the 39gII in C or in some language that compiles to ARM ASM, that would definitely explain why it seems so fast. The 50g is somewhat held back due to most of its OS being written in RPL, running in an interpreter written in Saturn ASM, running in a Saturn emulator written for the ARM. In many ways, it actually seems surprisingly fast despite the overhead (many operations are much faster than on the TI calculators with their native CPU OSes). Though, it is possible to write programs directly in Saturn ASM, ARM ASM, C, or whatever for the 50g—I haven't looked into that, and to be honest, I haven't really tried any games even though I've had this calc for several years already—always too busy coding my own stuff. :P
« Last Edit: March 18, 2013, 12:41:52 pm by TravisE »
ticalc.org staff member—http://www.ticalc.org/

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 grayscale tunnel clone
« Reply #7 on: March 18, 2013, 06:58:32 pm »
Looking nice, is the 39gcll a new calculator by hp? It seems to have a lot of power :)

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

Offline DJ Omnimaga

  • Former TI programmer
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55914
  • Rating: +3152/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: HP 39gII grayscale tunnel clone
« Reply #8 on: March 18, 2013, 07:50:03 pm »
I think I recall watching a video of HP 49 or 50g calcs graphing equations and was surprised at how slow it was considering how fast it was on TI. On the 39gII it's much faster.

The downside is still that the 39gII OS is really buggy. It's not as bad as 2.71MP, though, but enough to turn people away. :P

Offline TravisE

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 182
  • Rating: +33/-0
    • View Profile
    • ticalc.org
Re: HP 39gII grayscale tunnel clone
« Reply #9 on: March 18, 2013, 09:16:56 pm »
My 50g seems to graph sin(x) at roughly the same speed as my 89t, when both are set to the same plotting resolution. Fast3D beats the 89's 3D hands-down, though, when it comes to interactive rotation framerate. :) It's possible that older 49-series calcs might be slower, though; the old models with actual Saturn processors would be much slower, of course. It's also possible that various speed optimizations may have been made in the ROM code over time.

I'd be interested in seeing some videos of the 39gII graphing equations for comparison purposes.
ticalc.org staff member—http://www.ticalc.org/

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: HP 39gII grayscale tunnel clone
« Reply #10 on: March 18, 2013, 09:17:01 pm »
Nice work!
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline DJ Omnimaga

  • Former TI programmer
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55914
  • Rating: +3152/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: HP 39gII grayscale tunnel clone
« Reply #11 on: March 19, 2013, 03:42:46 pm »
Thanks, and TravisE the HP 49g+, 50g and 39gII are all 203 MHz CPUs, clocked down to around 75 MHz. The 39gII, however, slows down even more if batteries are low. As for the original 49g it's a 4 MHz Saturn. There is also a HP 48gII, which clocks down the 203 MHz CPU to 48 MHz and isn't a 48g upgrade.

Offline DJ Omnimaga

  • Former TI programmer
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55914
  • Rating: +3152/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: HP 39gII grayscale tunnel clone
« Reply #12 on: March 30, 2013, 03:07:35 am »
I finally found an update to the emulator and can now send most files to my calc or vice-versa! However to edit code from the computer I must keep a copy of the emulator open in order to save changes. It seems fairly recent, and according to a tibank rumor there is supposedly a new calc firmware coming out in May.

Anyway this allowed me to make screenshots! The first is animated, from the emulator (slowed down to calculator speed):


And the second one is a still image modified from an emulator capture, fixing the grayscale problems:


http://www.omnimaga.org/index.php?action=downloads;sa=view;down=846
« Last Edit: March 30, 2013, 03:09:45 am by DJ Omnimaga (Not Admin) »

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: HP 39gII grayscale tunnel clone
« Reply #13 on: March 30, 2013, 03:50:55 am »
HP seems to keep manufacturing "powerful" calculator hardware (severely sub-par compared to recent equipment from the real world, still), and that particular model's OS' BASIC provides screen drawing abilities, unlike the Nspire's BASIC :)
This demo is smooth enough, but such a CPU should be able to do better than this, even in BASIC.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline CompSystems

  • LV3 Member (Next: 100)
  • ***
  • Posts: 68
  • Rating: +7/-4
  • HP48GX,HP50G and TInspireCAS Calculator Programmer
    • View Profile
    • HP48GX,HP50G and TInspireCAS Calculator Programmer
Re: HP 39gII grayscale tunnel clone
« Reply #14 on: March 30, 2013, 01:05:32 pm »
I finally found an update to the emulator and can now send most files to my calc or vice-versa!

What version of emulator?
My emulator:  2012 9 4 revision 18360
http://www.hpgraphingcalc.org/hp39gii.html

>>tibank rumor there is supposedly a new calc firmware coming out in May.

I hope dialog boxes similar to the TI-89 calculator, none calculator relaunched  dialog boxes (TI-Nspire, ClassPad etc) =(
« Last Edit: March 30, 2013, 01:22:12 pm by CompSystems »