Skip to main content

PX-41CX to DM41 FOCAL Converter

·

PX-41CX to DM41 FOCAL Converter #

Reignite the retro spark of the HP-41CX with hp41cx_tools-px41_to_dm41, a nimble tool that converts PX-41CX FOCAL source code (.px41.focal) to DM41 format (.dm41.focal). Built in Ada 2022 for unwavering reliability, this filter transforms single-quoted alpha strings to double quotes and double-comments XROM key assignments (e.g., ;; KEY = XOR -81) to prevent detection by the DM41 encoder, while preserving standard key assignments like ; KEY = TONE 42. Part of the work-in-progress hp41cx_tools suite, it’s tested with Make (make test) and runs seamlessly on macOS, Linux, and Windows, outshining Windows-only tools.

Features #

  • Precise Conversion: Converts .px41.focal (ASCII, single quotes) to .dm41.focal (ASCII, double quotes), handling subtle format differences.
  • XROM Handling: Double-comments XROM key assignments (e.g., ;; KEY = XOR -81) to ensure DM41 compatibility, leaving standard key assignments intact.
  • Pipe-Friendly: Reads from standard input and writes to standard output, ideal for scripting and pipelines.
  • Cross-Platform: Works on macOS, Linux, and Windows, perfect for any retro computing setup.
  • Open Source: Explore the code on SourceForge.
  • Robust Testing: Backed by AUnit tests via make test for reliable performance.

Usage #

No command-line options—just pipe PX-41CX FOCAL code in and get DM41 code out:

hp41cx_tools-px41_to_dm41 < in_ASN.px41.focal > out_ASN.dm41.focal

Example #

Convert a PX-41CX FOCAL file to DM41 format:

hp41cx_tools-px41_to_dm41 < in_ASN.px41.focal > out_ASN.dm41.focal

Example Output #

; STACK =  6.000000000E00  6.000000000E00  3.600000000E03  0.000000000E00  6.000000000E00
; ALPHA = ""
; SIZE =  100
; ΣREG =  624
; KEY = TONE  42
; KEY = FRC -15
; KEY = INT  15
;; KEY = XOR -81
;; KEY = NOT -51
;; KEY = AND -71
;; KEY = OR -61
;; KEY = HEXVIEW -13
;; KEY = OCTVIEW -12
;; KEY = BINVIEW -11
;; KEY = HEXIN  13
;; KEY = OCTIN  12
;; KEY = BININ  11
; A: 099999999994f0  B: 0000002c0480fd  C: 000000002c00fd
; S: 00101010000000
; M: 000018a9ff82fb  N: 016919418e049f  G: 19
LBL "LBLTEST"       ; c000f8004c424c54455354
STO 00              ; 30
LBL 00              ; 01
STO 01              ; 31
LBL 99              ; cf63
STO 02              ; 32
LBL A               ; cf66
STO 03              ; 33
LBL "Z"             ; cc02f2005a
STO 04              ; 34
LBL "T"             ; cc00f20054
STO 05              ; 35
LBL "TE"            ; Key:  81
STO 06              ; 36
LBL "TES"           ; c001f400544553
STO 06              ; 36
LBL "TEST"          ; c201f50054455354
STO 07              ; 37
LBL "TEST5"         ; Key:  43
STO 09              ; 39
LBL "TEST 6"        ; Key:  44
STO 00              ; 30
LBL "TEST--7"       ; Key: -44
RTN                 ; 85
.END.               ; ca0109
                    ; 000000cc002
; MEM = 040 000000000000bf 00000000000000 00000000000000 00000000000000
; MEM = 0bc 00000000000000 00000000000000 00000000000000 ffffffffffffff
; MEM = 200 00000000000000 03ef0010bf0201 00000000000000 00000000000000
; MEM = 300 00000000000000 00000000000301 00000000000000 00000000000000

Notes #

  • Input/Output: Reads .px41.focal (ASCII, single quotes) and outputs .dm41.focal (ASCII, double quotes).
  • XROM Handling: Double-comments XROM key assignments to prevent DM41 encoder issues, carefully preservig standard key assignments.
  • Work in Progress: Part of the evolving hp41cx_tools suite, with more features planned.

Relive the HP-41CX’s golden era with this clever converter, smoothing out compatibility hiccups with the finesse of a vintage calculator!