HP35s Assembler - translate symbolic assembler programs for the HP-35s
This project parses HP-35s assembler source, resolves labels and named constants, and converts the resulting program to calculator keystrokes. It provides the Parser::HPC parser module and the asm2hpc.pl command-line frontend. The output is a readable or encoded keystroke listing, not machine code.
Assembler directives, symbols, and diagnostic messages are also described in the project wiki.
The runtime dependency is Parser::MGC version 0.16 or later. Install the distribution with the make utility configured for your Perl installation:
perl Makefile.PL
make
make test
make installOn Windows, use the make utility provided by the Perl distribution, such as dmake.
Run the frontend from the project directory. It reads source from standard input unless an input file is specified; generated output is written to standard output and diagnostics to standard error.
perl -Ilib bin/asm2hpc.pl --help
perl -Ilib bin/asm2hpc.pl --unicode --file=examples/C/C.asm > C.35sThe frontend supports these options:
-?,--helpShow usage information.
--manShow the full command documentation.
-v,--versionShow the frontend version.
-f FILE,--file=FILERead assembler source from a file instead of standard input.
-j,--jumpmarkMark jump targets in the listing.
-c,--clearInclude keystrokes to clear calculator program memory. This requires shortcut output, enabled with
--shortcutor--encoded.-p,--plainOutput a 7-bit ASCII listing.
-m,--markdownOutput a Markdown listing with inline HTML.
-u,--unicodeOutput a UTF-8 listing.
-s,--shortcutInclude shortcut keystrokes as comments.
-e,--encodedOutput key codes in the macro encoding format.
--debugWrite debug information to standard error.
For example, to create a plain-text listing or an encoded macro stream:
perl bin/asm2hpc.pl --plain --file=examples/C/C.asm > C.raw
perl bin/asm2hpc.pl --clear --encoded --file=examples/J/J.asm \
| perl extras/tools/uudecode.plParser::HPC parses HP35s source and returns a Perl data structure containing its segments, labels, statements, and optional title and start address. Its supported grammar, programmatic usage, return structure, and limitations are documented in Parser::HPC.
The examples/ directory contains assembler programs and generated listings. The AppData/ directory contains emulator program files, while AppData/Macros/ contains macro files for importing or testing programs with the emulator.