The HPG-CC Programming language
The hp 39g+ was the first of this family of calculators which didn't use the
Saturn 5
as its ROM chip. Up to
that point the HP38G, HP39G & HP40G had all shared the same chip along with others in the HP48 family.
However, supplies of the chip ran out world wide in about 2003 and so the hp 39g+ took a different route.
Instead it uses an extremely fast ARM processor (slowed down slightly to save battery power) and simply
emulates the Saturn 5. That is, it runs a special program on the ARM processor in machine code that
'pretends' to be a Saturn 5 chip. This virtual chip then runs the calculator's operating system. The calculator
is completely unaware that it is not using a Saturn 5. This may seem a strange thing to do but it avoided
having to completely re-write the operating system, which would have been very expensive. To the user there
is no difference except for a considerable increase in speed. The 39g+ was on the order of 10 times as fast
as the 39G. To the programmer, however, there is potentially a BIG difference.
Because the underlying chip is a fast ARM processor it is possible to write code which completely bypasses
the virtual chip and runs directly on the underlying ARM chip. This results in incredibly fast code, sometimes
on the order of 100 times faster. It also means that you can use other high level languages to write your
programs, rather than being confined to HP Basic. In particular, you can use a version of C called HPG-CC
created by a very talented group of programmers.
The drawback of this is that by bypassing the virtual chip, you lose access to ALL the abilities of the calculator
itself - it's graphing facilities, it's built in functions and so on. Essentially you are operating on a bare chip
and having to create everything yourself. It is possible to access some of these via back door methods but
they are not simple. In addition, the HPG-CC language itself provides some of these abilities, such as writing
to the screen and these abilities are being added to all the time.
Warning!!
A drawback of HPG-CC is that it is possible to write code that will completely crash your
calculator! By this I mean not just to the point where you have to do a hard reboot and lose
the user memory but to the point where you overwrite the calculator's operating system and
can't even reboot. A programmer might also write a loop in their program that took over
the ARM chip and monopolized it to the extent that you could not interrupt it using the
normal keyboard reset.
This language is
not
for the beginner programmer. Unless you have some experience with
using C in another, safer, environment I would
very
strongly suggest that you not consider
using it! Windows for example, has safeguards built into it that prevent a program from
damaging the operating system itself. The calculator does not.
The good news is that even if you do manage to overwrite the operating system you can
always download a new copy from Hewlett Packard’s website and re-install it into the flash
ROM (see page 284). This is not hard to do although it would obviously be annoying. A
loop that can’t be reset using the normal keyboard methods can still be interrupted using
the physical reset button located inside the hole in the back of the calculator (see page 42),
since this button actually interrupts the power from the batteries and so will ‘kill’ any
program. If necessary, remove the batteries.
282