I knew rejig was getting complicated when it began exhibiting emergent behaviors…
Raise the COMPLEXity
In addition to its lovely 𝒊 and 𝒊⊙ ops, the R47 supports the same legacy complex number entry scheme as the HP-42S, but R47 fans gain a happy consequence from our support of its ancestor:
rejig program.p47 | rejig --from utf8 -o raised.p47
That one-liner converts any real + imaginary + COMPLEX sequences found in the input to a complex literal. The P47 input processor does not know this trick itself, but the UTF-8 input does, and round-tripping grants it the feature indirectly.
E pluribus unum
You may pass rejig multiple input files, but it obeys a single -o. What use is that? Try this:
rejig *.p47 -o combined.p47u
The happy outcome for the HP-42S and its descendants is that this yields either:
- multiple separate program spaces; or
- a combined “program” with each input as a source of subroutines
It depends entirely on which inputs have END statements.
With this, we may arguably add “linker” to our operating mode list, or at least archiver. 🤓
Text to VoyagerSave Memory Dump
Sr. Divassón’s lovely VoyagerCalc emulator allows exporting programs to a text file, but it can only read from a memory dump; rejig to the rescue!
rejig \
--from=emu12c program.txt \
--to=hp12cmem --output program.12c
Both file name extensions clash with longstanding rejig defaults, but by specifying formats via --from/to, we can use the ones VoyagerCalc prefers.
Useful as that type of transformation is, the power you have on tap extends beyond the VoyagerCalc sphere. Your input could just as well be an RLM-12C simulator program, in its JSON key code listing format:
rejig program.12c -o program.12cmem
Now we’re making good use of the built-in rejig file name extension rules to imply the --from/to formats.
Useful as the RLM simulators are, they aren’t firmware-based emulators.
Disassemble Core Routines
Ever wanted to know how the calculator implements its core routines, but you didn’t want to learn the Nut CPU microcode first, for understanding a firmware disassembly listing? The HP-41C MOD file conversion features might suffice:
$ rejig /path/to/advantage.mod \
--modules advantage \
--syntax hp41c
⋮
LBL "TVM"
10
XROM 24,33
FC?C 25
PROMPT
CF 00
⋮
Yep, that’s the start of this module’s time value of money subroutine!
That won’t work for MCODE subroutines, but you might be surprised which modules use the FOCAL-in-ROM technique that allows rejig to pretty-print the code.
(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