Skip to main content

HP-41CX Emulator Tool - Decoder

HP-41CX Emulator Tool - Decoder #

Unlock the secrets hidden within those cryptic memory dumps with the Decoder—the trusty sidekick in the hp41cx_tools suite, ready to resurrect your HP-41CX FOCAL programmes from the digital archives! This command-line virtuoso effortlessly decodes .px41 and .dm41 files into crisp, readable Unicode FOCAL source code, auto-detecting formats so you can focus on the joy of retro tinkering. Forged in the unyielding Ada 2022 for flawless fidelity, and battle-tested with AUnit via make test, it runs like a dream on macOS, Linux, and Windows—a cross-platform beacon for enthusiasts scripting in ZShell or pondering Ada’s tasking wonders.

Whether you’re salvaging a long-lost programme from PX-41CX or DM41X, the Decoder handles the heavy lifting, preserving every nuanced glyph and command with the precision of a well-crafted procedure. It’s the perfect companion to the Encoder, turning opaque binaries into editable poetry that sparks new ideas in our vibrant retro computing community.

Example: Decoding #

Decode a DM41 memory dump to Unicode FOCAL code:

hp41cx_tools-main --decode in_GRAVITY.dm41 out_GRAVITY.utf8.focal

Example Input: in_Number.px41 #

DM41
08  4b000000000000  00000000000000  00000000000000  00000000000000
0c  0000000000019c  1a70016919c175  0000002c048000  00000000000000
174  00000000000000  00000000c8262d  93021036ba0000  402143668e2142
178  225140668e5222  8e042126421242  0010362266ba00  452e2e2e2163b4
17c  45502053504143  06ba0003fd4445  12437120424092  40ce0220512442
180  aa001330244222  00431371457502  40542467b200a9  a80066b2005222
184  42124222517141  42134321413426  2345759303207a  2e2e7e897f3061
188  77f75a45524f2e  4e452e2e2e7e89  2e2e2e7e89f64f  2e7e89f654574f
18c  54485245452e2e  7e892367b300f8  3d9b06f37f2046  537e894585f241
190  9b71f57f20462f  45f27f46f27f3d  226e261a15f156  454c3d9b037e89
194  899c000af54655  9c02a91d9b017e  10322533f2473d  101010361c1510
198  10104035cf6615  61181010421112  56495459a81b31  c000f800475241
A: c000f800475241  B: 0000002c0480fd  C: 0000002c0480fd
S: 00001100000000
M: 00011cd5ff73cb  N: 000000000000c0 G: 00

Example Output: out_GRAVITY.focal #

; ALPHA = ⊤                     ⊤
; SIZE =  100
; ΣREG =  624
; A: c000f800475241  B: 0000002c0480fd  C: 0000002c0480fd
; S: 00001100000000
; M: 00011cd5ff73cb  N: 000000000000c0  G: 00
LBL ⊤GRAVITY⊤
SF 27
STO 01
ABS
800
*
1200
+
STO 05
LBL A
5000
STO 06
-500
STO 02
RCL 05
STO 03
⊤G=⊤
FIX 2
CF 29
ARCL 01
AVIEW
PSE
FIX 0
LBL 09
⊤FUEL=⊤
ARCL 03
AVIEW
PSE
RCL 02
RND
RCL 06
.5
⊤V⊤
X>Y?
⊤⊦F⊤
⊤⊦=⊤
ARCL 13
⊤⊦ F/S⊤
AVIEW
PSE
X>Y?
RTN
⊤A=⊤
ARCL 06
⊤⊦ F⊤
AVIEW
PSE
RCL 03
X=0?
GTO 02
⊤THREE...⊤
AVIEW
PSE
⊤TWO...⊤
AVIEW
PSE
⊤ONE...⊤
AVIEW
PSE
CLX
⊤ZERO...⊤
AVIEW
PSE
CLD
STO 00
ABS
RCL 03
X>Y?
RDN
ST- 03
RCL 00
SIGN
*
3
/
RCL 01
-
STO 04
RCL 06
*
2
*
RCL 02
X↑2
X<>Y
-
SF 00
X<0?
GTO 01
SQRT
RCL 02
+
CHS
RCL 04
X=0?
GTO 01
CF 00
/
3
X<>Y
X>Y?
RDN
LBL 01
FS?C 00
3
STO 00
RCL 04
*
RCL 02
+
X<> 02
RCL 00
X↑2
RCL 04
*
2
/
X<>Y
RCL 00
*
+
ST+ 06
GTO 09
LBL 02
⊤DEEP SPACE...⊤
RCL 01
X≠0?
GTO 03
0
STO 06
RCL 02
X<0?
GTO 09
PROMPT
LBL 03
RCL 01
RCL 06
*
2
*
RCL 02
X↑2
+
X<0?
PROMPT
SQRT
RCL 02
+
RCL 01
/
X<0?
PROMPT
RCL 01
*
ST- 02
0
STO 06
GTO 09
.END.