HP Calculator Page
Here is some source code to a rotating shape demo running on the HP48 GX or the HP 49 graphing calculators. It compiles under JAZZ 6.8c on the GX and 6.8d on the HP49. It uses 1.7 signed fixed point code to do the calculations, and the source has code for a Bresenham line algorithm, Sin and Cos look up tables, demonstrates double buffering for the display surfaces, does hidden line removal and shape rotation and scaling in realtime, and features 16 polyhedral shapes generated with C++ and Mathematica 4.0. It consists of 2000 lines of SATURN assembly code, and took about a week of spare time to write (it is my first SATURN assembly code program, and probably my last - it was an experiment). Given time I have some ideas to speed it up, and so may release another version if I get inspired. I may also add a key to toggle the hidden surface removal on/off.
Some screen shots:
BACKUP YOUR HP BEFORE USING THESE PROGRAMS! I have tested them on my calculators, but if you eat your data it is your own fault. And if you do find any bugs in here please let me know.
NOTE: This program uses self modifying code, so may not run in a port!
Program for the HP48GX (tested under ROM version M)
Program for the HP49 (tested under ROM version 1.19-5 - get from HP)
Visit www.hpcalc.org to get a lot of good software
If I get time I plan to write a tutorial showing how to set up your PC to develop software for the HP calculators. I used the EMU48 emulator for the 48 and the HPSDK for the 49 (the 49 emulator is quite buggy). I edited the files with the Visual C++ IDE (since I like it), and dragged all the files to the calculator emulator. I had installed JAZZ on the emulators to compile the code.
The source files
(they format poorly in a browser):
RotShape.s - the main file
DrawLine.s - line drawing rountine
FrameBuffer.s - implements double buffered screen
Rot2D.s - 2D rotations, composed give 3D
Shape.s - generic shape manipulation routines
Shape3D.s - 3D specific routines
SinCos.s - sin/cos routines
Misc.s - miscellaneous routines
TetraLoad.s - load tetrahedron
CubeLoad.s - cube...
OctaLoad.s - octahedron...
DodecaLoad.s - dodecahedron...
IcosaLoad.s - icosahedron...
MiscShape.s - loads the other 11 shapes