Skip to main content

Unicode to PX-41CX FOCAL Converter

·

Unicode to PX-41CX FOCAL Converter #

Rekindle the retro magic of the HP-41CX with hp41cx_tools-unicode_to_px41, a sleek tool that converts Unicode-encoded FOCAL source code (.utf8.focal) to PX-41CX format (.px41.focal). Built in Ada 2022 for unshakeable reliability, this filter expertly handles special characters (Σ, , ) with context-sensitive conversions and uses single quotes for alpha strings, ensuring seamless PX-41CX compatibility. Unlike its DM41 counterpart, it preserves XROM key assignments, as PX-41CX supports them natively. Part of the work-in-progress hp41cx_tools suite, it’s tested with Make (make test) and runs flawlessly on macOS, Linux, and Windows, outpacing Windows-only tools.

Features #

  • Smart Conversion: Transforms .utf8.focal (Unicode, HP-style quotes) to .px41.focal (ASCII, single quotes), with precise handling of special characters.
  • Context-Sensitive Handling:
    • In ALPHA Strings:
      • Σ~
      • ^
      • \x1D
    • In Commands:
      • ENTER↑ENTER
      • ^
      • ΣS
      • #
  • XROM Support: Preserves XROM key assignments (e.g., ; KEY = XOR -81), as PX-41CX supports them natively.
  • 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 Unicode FOCAL code in and get PX-41CX code out:

hp41cx_tools-unicode_to_px41 < in_program.utf8.focal > out_program.px41.focal

Notes #

  • Input/Output: Reads .utf8.focal (Unicode, HP-style quotes) and outputs .px41.focal (ASCII, single quotes).
  • Character Handling: Uses AdaCL.Wide_Strings.Spitbol.Patterns for context-sensitive substitutions, as regular expressions fall short for distinguishing ALPHA strings from commands.
  • XROM Preservation: Unlike the DM41 converter, XROM key assignments are kept intact, as PX-41CX supports them.
  • Work in Progress: Part of the evolving hp41cx_tools suite, with more features planned.

Relive the HP-41CX’s golden era with this sharp converter, transforming Unicode elegance into PX-41CX-ready code with the finesse of a vintage calculator!