[net.micro.hp] Overview of synthetic programming on the HP-41 C/CV/CX

rjnoe@ihlts.UUCP (Roger Noe) (03/15/84)

This newsgroup, net.micro.hp, has been created for discussion of machines
manufactured by Hewlett-Packard which fall into the "micro" category.
Much of the motivation for doing so (from my point of view) was to discuss
the HP-41 handheld computer line, but by no means should discussion be
limited to this system.  As a first article (well, the actual first article
was apparently dropped into the bit bucket) I thought I'd post a copy of
my answer to a query I received, "What exactly is synthetic programming?"
I encourage readers of this newsgroup who are familiar with this topic to
correct the many simplifications and inaccuracies which appear below.  The
note is not meant to be comprehensive in any way, but to explain some of the
more basic ideas behind synthetic programming on the HP-41.
---
	Synthetic programming is a means by which one can insert into HP-41
programs (and assign to keys) statements which were not intended by the
makers of the HP-41 to be used by HP-41 owners.  This gives the programmer
almost systems level programming capabilities, rather than applications
level stuff, which is what the Owner's Handbook covers.  It's not micro-
programming, but just a more comprehensive machine programming.  It allows
you full access to all 16 machine status registers.  You already have
access to the automatic stack (the T, Z, Y, X, and L [last X] registers),
and partial access to the four alpha registers (M, N, O, and P, although
access is as if to ONE 24-byte register rather than to four 7-byte registers)
through ordinary commands.  Synthetic programming (among many other things)
allows you FULL access to all 16 registers.  This includes the bit maps
that specify which keys have assignments in USER mode, all 56 flags can be
set/cleared/read at will, the locations of the start of program memory
(actually, the physical address of data register 00), the "program counter",
the statistics (sigma) registers, and the return address stack (actually
two shift registers which are modified every time a subroutine is called or
a RTN is hit) can all be found or changed.  You have full access to every
part of physical RAM, whether it's data registers, program memory,
key assignments, or extended memory.  Easier access to ROM routines, too.
An interesting (although not especially useful) note is that synthetic
programming allows you to use audible tones lower in pitch than TONE 0
(they are TONE A through TONE F, hexadecimal) and of varying duration.
There are 16 durations for every pitch, not allowing for a few duplications.
Some are so short they sound like a "click" and some are about 5 seconds
long!  A few good books have been written on synthetic programming and
should be available wherever HP-41 accessories are sold.
	There are both advantages and disadvantages to synthetic programming.
On the plus side, it allows one to do things which are just plain impossible
(not to mention things which are possible but difficult) otherwise.  For
example, how would one go about writing a general program to determine where
the block of statistics (SIGMA) registers are located, or how many data
registers are in the current configuration (SIZE)?  It's quite impossible
with just the capabilities mentioned in the Owner's Handbook, but really
quite simple with synthetic programming.  Also, using synthetic programming
techniques, one can speed up programs and make them smaller.  Character and
arithmetic manipulation without using data registers also becomes easier.
Disadvantages?  Well, no synthetic programming techniques are supported by
HP.  Definitive documentation is difficult (impossible?) to find.  Up to a
few years ago, mentioning synthetic programming to anyone at HP typically
would get you a comment like "I don't know what you're talking about" or
"There's no such thing."  I could speculate endlessly on their reasons for
their actions, never mind the topic of whether or not they intended to
leave in the bugs (undocumented features?) which make synthetic programming
possible.  The only other disadvantage of synthetic programming is that once
in a while (particularly as a novice), you'll lock up your HP-41, forcing
battery removal (and loss of data) to recover.  This is irritating, but never
disastrous.  Synthetic programming won't harm your HP-41 permanently.
	Synthetic programming is still a growing body of knowledge.  One of
the principal agencies pushing back the frontiers of understanding in this
respect is PPC, a non-profit California organization.  They have also come
out with the PPC ROM, a real programmer's ROM (vs. applications).  This ROM
uses quite a number of synthetic programming tricks to accomplish the things
it does.
---
I'll be commenting more on these topics in the weeks to come.  I welcome
comments from any and all interested in the HP-41.
	Roger Noe		ihnp4!ihlts!rjnoe