Post Reply 
static recompilation of the HP-15C ROM
02-14-2014, 04:39 PM
Post: #1
static recompilation of the HP-15C ROM
nope, i've not done it, but would like to suggest it is a good idea. for an example of what is possible, have a look here:

essentially static recompilation involved writing a translation program that knows how to decompose individual compiled instructions for a source processor, and recreate equivalent 'instructions' built out of C code, said instructions operating upon a set of 'registers' that exist as C variables. as an example, in very bad C code (my C is weak):

int A, R1; /* source processor registers */
bool ZF; /* source processor flags */
/* instruction at address 1234 */
R1=A ; /* move contents of A into R1 */
ZF=(A==0); /* sets the zero flag if A was zero */

in the above example A and R1 are two registers in the source processor, and the two line of C code are the C translation of the instruction to move the contents of A into R1 and then set the zero flag true of A was zero.

the recompiler has to either be clever enough to identify blocks of data, or be guided around them. access to hardware (keyboard, display, timers, etc) needs to generate calls to a set of external library routines that are specific to the new target. jumps and branches are handled with 'goto' statements, making the resulting C code is very much a can of worms; certainly not something that is easily maintained.

BUT, the output can be recompiled on ANY platform that supports a suitable C compiler. all one has to do is rewrite the small set of library routines to handle I/O, etc. plus, it is relatively easy to handle adding enhancements and extensions.

for example, in the case of the 15C ROM there is a block of code that handles display of a program listing. the display is filled with <address> - <key codes>. the end of this block can easily be patched to replace the key codes with the english instruction. so "001 - 42,21,11" displays as "001 label A" with just a little bit of C code added in (yep, the above is 11C code).

are there any takers out there?

it could be a neat open-source project. all that needs to be published is the static recompiler, ready to run, and a set of example library routines. the individual can then provide the 15C ROM image to create their own recompilation and start customizing. for those of us with a hardware bent, creating our own 15C becomes just a matter of hooking up a 16x1 matrix display and some buttons to a suitably large atmel or pic processor, or compiling for a PC or mac if so inclined.

rob :-)
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
static recompilation of the HP-15C ROM - robert rozee - 02-14-2014 04:39 PM

User(s) browsing this thread: 1 Guest(s)