Because the HP-15C support in rejig shares many of the 30-series limitations — and for the same essential reasons — I will not repeat all that here. Instead, I will give the differences particular to these I/O paths.
The general limitations of rejig are also worth review, to set the broader context.
Input
There are four alternative input paths:
--from utf8 --validate hp15c: Parse human-friendly UTF-8 text, constrained to the HP-15C operation set. This mode is implied by file extension.hp15c. The intent of this mode is to accept as input programs in text form as copied from HP-15C manuals and other printed sources.When given a NutEm/PC program listing,
rejiginfers this same processing from a leading#! 15Ccomment.--from hp15c: Program files for Torsten Manz’ HP-15C Simulator, which may be used withrejigas-is, implied by the.15cfile extension. This simulator’s Devices feature combines well withrejigby serving as an interface to the USB connections on the HP-15C Collector’s Edition or SwissMicros’ DM15 family of machines. The Manz format has also been adopted by the Jovial JRPN simulator. This format therefore serves as a fine lingua franca for HP-15C family machines.What documentation for the Manz format exists is only distributed with the simulator,1 making the simplest path to viewing it as: open the program and hit F1.
--from rlm15c: The JSON-based program format used by the RLM-15C simulator. Because it unfortunately also uses the extension.15c, you must specify it explicitly on the command line; therejigfile type inferencing does not even try to guess, though perhaps it should.--from hp15cmem: Read program as Nut CPU nibbles from a VoyagerCalc style memory dump file. Such a file may also be produced byvoyem --save.--from emu15c: Input parsing of VoyagerCalc text program exports. Details
The following HP-15C features needed careful mapping:
The solver in the R47 takes after the HP-42S, where you pick a program that serves as the equation to be solved, then pick an
MVARdefined in that program which you want the programmed equation to be solved for. The key difference in the HP-15C is that it always uses the X register for this instead.We resolve that discrepancy by injecting an
MVARandRCLpair into theSOLVEtarget referencing a specialrejigXvariable that stands in for this use of X on the HP-15C. It also translates these programmedSOLVEops to the R47’sPGMSLVvariant, allowing a more nearly 1:1 mapping.This works regardless of the order of declarations; the solved program can appear before or after the
SOLVEcall.Numeric integration maps the same way because it operates on similar principles. Targeting the same labeled subroutine with both this and
SOLVEresults in a single mapping.Complex numbers translate despite the huge differences in the HP-15C dual-stack scheme and the R47’s first-class complex number support, but there are a few known 15C-specific incompatibilities worth noting.
First, the HP-15C allows use of
f (i)as an op, but because it is a momentary “peek at imaginary part” feature meant for interactive use,rejigcurrently refuses to process programs including it. In a program, you are far more likely to wantRe⇄Iminstead.Second, our
DROP𝑥emulation leaves the imaginary part of X untouched, thus ends up corrupting the imaginary part of Y at the+step. A proper complexDROP𝑥is expensive enough that it justifies a subroutine:LBL D ; complex DROPx emulation CLx F? 8 ; complex mode enabled? GTO C ; yes; also clear imaginary part GTO A ; no; skip to the add step LBL C Re<>Im CLx Re<>Im LBL A + RTNBurning three of the HP-15C’s precious 25 labels like this merely on the possibility that you might be in complex mode at the time of the
DROP𝑥is not something I am prepared to put intorejig. I offer it here as a manual replacement for cases where you know it is needed. That at least lets you skip the flag test, theGTO, and the two interior labels, which in turn might make you willing to inline it and save the thirdLBL:CLx Re<>Im CLx Re<>Im +I’m unwilling to put that into
rejigin place of the current implementation because it forces the calculator into complex mode whether you want it or not. Plus, it turns the current 2:1 instruction magnification into 5:1.Keep the core issue in mind: the
rejigemulation ofDROP𝑥is a convenience to aid lowering programs originally written for more capable machines. If you find this feature a net hindrance, you can avoid triggering it by manually rewritingDROP𝑥instructions in the programs you give as input.Random number generation works entirely differently on the R47. It uses much better algorithms, it supports swappable probability density functions, and it allows the user to change the endpoints of those PDFs. This means some things translate well while others do not.
Calls to the
RAN#op work as expected across all supported calculators and program formats, but purely because the R47 implements it using a uniform probability distribution as HP did back in the day, albeit with a better PRNG behind it. If you want a random number pulled from a different PDF, you do it differently on the R47.The Voyager-class “
STO RAN#” instruction translates to an R47SEEDcall and back.What does not round-trip losslessly is the opposite instruction (
RCL RAN#) because the R47 code does not presently offer this feature. If you need to know the seed, save out a state file and take a look; it’s in there.
Matrices
Is the following a valid HP-15C program?
LBL A
STO B
RTN
It depends, because HP-15C registers A-E can only be used to store matrices, which then calls into question whether the indexing registers (R0 and R1) are within the predefined range for B’s dimensions. If not, the machine will spit an unfriendly Error 3 back at you when you run the program.
In the interest of not being overly restrictive, rejig does not attempt any type of static analysis to predict HP-15C register misuse. While it could in principle produce a call graph, then walk it with the intent of finding the DIM that applies to each matrix register at each step in the program, a proper model of the calculator’s runtime rules would also require knowing the contents of the stack. Lacking this, our translation-time rejig validation rules must presume the programmer knows their own business and blindly allow STO/RCL with A-E for HP-15C I/O.
There is no mapping for any of the HP-15C’s programmable MATRIX ops due to the near-total mismatch with the way the R47 handles matrices. Take MATRIX 0 for example, which zeroes the dimensions for all five (A-E) matrices; for that to work on the R47, it would have to walk not only its vastly larger register space looking for matrices to redimension, it’d have to do the same for the named variables. That’s doable in principle, but one may readily see why the R47 developers chose not to offer that facility. Without an IR form to raise an HP-15C MATRIX call to, there is nothing to lower it from even in a 15-to-15 translation.
Automatic register name mapping is restricted to the numbered registers when the target is an HP-15C format. It will only use the named registers A-E in its output when they were explicitly given as input.
Numeric Entry Tricks
Because Voyagers encode each numeric input keypress separately, while the R47 instead stores numbers whole, constructs like this will fail:
x=? 0.
.
1
That puts either .1 or 1 into X depending on whether the prior value was nonzero, giving you a conditional divide-by-10 factor. While there is doubtless at least one way to recode that to work as intended on an R47, rejig is not yet clever enough to apply such a transformation automatically on your behalf, and as a result, it must currently abort the conversion with an error when it detects such trickery.
Output
Excepting the single input-only path documented above, inverses for each exist on the output side:
--to utf8 --syntax hp15c: Pretty-printed UTF-8 output restricted to what an HP-15C supports, with HP-15C styling. This allows lowering R47 and other sources to a pretty-printed human-readable form, as might be wanted for a forum post or a web article.--to hp15c: Output to Manz simulator’s custom text format, which implies those same restrictions. While this is also human-readable, it is meant more for running the resulting program.--to rlm15c: Much the same, but for the RLM-15C simulator’s JSON-based format. Because this is distinctly less human-readable, lacking comments and key sequence decoding as it does, you might wish to proof your results via one of the above options before loading it into the simulator.--to hp15cmem: Write a VoyagerSave/VoyagerCalc.15cmembinary memory dump file. Also suitable forvoyem --load.
Lowering programs using SOLVE strips the injected instructions mentioned above. It also translates PGMSLV ops back to the SOLVE key codes.
Of what’s left, I believe everything round-trips cleanly. Where you are most likely to run into trouble is when starting with --from $SOMETHING_ELSE.
Cosmetics
There are several minor cosmetic differences between rejig --to hp15c output and that of the simulators:
The decoded form of the
LAST𝑥op in output from the Manz simulator misuses the Greek capital letter chi (Χ) instead of the mathematical capital italic (𝑋) letter. I could makerejigconform, but I don’t wish to perpetrate the error.The JRPN simulator uses plain ASCII output, with the decoded ops shown like
x^2instead of𝑥².The Manz simulator defaults2 to UTF-16 + BOM output in service of its enhanced op decoding info.
The header comment styles differ considerably:
Manz:
HP-15C Simulator program Created with version 5.1.00The version number changes in each release.
JRPN:
Program produced by JRPN 15C. Character encoding: UTF-8 Generated 2025-9-27 11:41 MDT. Program occupies 21 bytes.It doesn’t declare the writing program’s version number, but the timestamp line changes every minute, even for identical output.
rejigmelds the best of both:HP-15C program generated by rejig --to hp15c (v0.10.0) Character encoding: UTF-8 Byte count: 17Starting with
rejig0.24.0, its byte counting algorithm matches3 the HP-15C behavior.In order to reduce unhelpful differences in
make testoutput while running a pre-release build, the bit at the end of the first line changes to “trunk build” (or whatever the branch name was) instead of showing the commit ID prefix as the--versionflag does. This same motivation leads me to resist adding a timestamp to the output; that’s what mtimes are for!
The point of listing these differences is that it affects my round-tripping tests. If you load one of my programs up into one of the simulators and save it right back out, the differences listed will make this test appear to fail. A proper round-trip test uses rejig throughout the chain.
RLM-15C
This is another fine HP-15C simulator, which uses a different (JSON-based) file format. Because it uses the *.15C file name extension and rejig matches that case-insensitively, you must give --from/to rlm15c to read these files in/write them out.
This format can include non-program data such as the contents of the stack, the simulator settings, etc., but rejig ignores all that. Because the RLM simulator preserves elements not explicitly overwritten, round-tripping a program through rejig does not necessarily lose these other elements. Simply load the new program atop the existing configuration, then save it back out with those items checked in the “Select data to Save” dialog that pops up.
(You may now wish to return to the rejig home page.)
License
This work is © 2026 by Warren Young and is licensed under CC BY-NC-SA 4.0
- ^
The author “…sees no advantage in offering the help files without the simulator.” Well, I see one: it would let me point people directly to the docs I used without using OS-specific
file://URLs like this one for macOS. - ^ The Manz sim will conform to my strong preference for UTF-8 if one goes into its Preferences and unchecks the “Encode programs in UTF-16 (LE)” option on the Files tab.
- ^
Well, mostly. Because HP-15C matrix support in
rejigis nearly nonexistent, our instruction counter cannot recognize their key codes and classify them with the 2-byte set. This includes the oddballSTO/RCLg(i)instruction;rejigcannot parse it, so there’s no point teaching its byte counter about it.