Calculator Community > HP Calculators

HP 39gII grayscale tunnel clone

(1/4) > >>

DJ Omnimaga:
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: ---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;
--- End code ---



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

Juju:
Nice :D

Matrefeytontias:
It's HP Basic btw ?

Also, even unoptimized, the thing is going at a reasonable speed I think ;)

TIfanx1999:
That's pretty awesome! :D I hope Hp gets around to releasing it stateside, it looks like it could be a very nice calc! :)

TravisE:
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.)

Navigation

[0] Message Index

[#] Next page

Go to full version