comp41

NAME
SYNOPSIS
DESCRIPTION
INPUT FILE FORMAT
OPTIONS
FILES
REFERENCES
EXAMPLES
BUGS
AUTHOR

NAME

comp41 - compile a HP41C user-language (FOCAL) program

SYNOPSIS

lifutils comp41 [-l] [-g] [-s] [-h] [-f LIFFILENAME ] [-x XROMFILE ] ... INPUTFILE > Output file

lifutils comp41 [-l] [-g] [-s] [-h] [-f LIFFILENAME ] [-x XROMFILE ] ... < Input file > Output file

lifutils comp41 -?

DESCRIPTION

comp41 compiles a text file containing a HP-41 user program (FOCAL) from standard input or the file specified by the command line parameter INPUTFILE and writes the byte code to a LIF or binary raw file (default).

A XROMFILE consists of a number of lines, each consisting of 2 decimal numbers and one or two strings (containing no whitespace), in that order, separated by whitespace. The first string gives a name to the function specified by the first number as rr and the second number as nn. The optional second string is the function name containing the Unicode characters listed above, which must not be used in the first string. The proper XROMFILE is necessary to compile commands of module or peripheral functions.

INPUT FILE FORMAT

Prefixes are case-insensitive: ’rcl 00’ same as ’RCL 00’.

Postfixes are case-sensitive: ’lbl a’ different than ’lbl A’.

Append text is allowed using: ’>"text"’ , ’ "|-text" ’, or ’"\-text"’.

Text must be either encosed in ’"’ or "’". If the text contains an enclosing character, it must be escaped with ’\’.

The following Unicode characters are translated to the HP-41 FOCAL character set: text append (hex 0x251c), greek small mu (hex 0x03bc), angle (hex 0x2280), not equal to (hex 0x2260), greek capital sigma (hex 0x03A3). and may be used in text and instructions.

Synthetic instructions are allowed: ’rcl M’, ’sto R’

Synthetic NOP (TEXT0) is allowed using an empty string: ’""’

Synthetic strings are allowed using C-style esc-sequences: ’"\x0D\x0A"’

Comments are allowed if preceded by ’;’ or ’#’ : ’# comment’

OPTIONS

-l

Skip line numbers

-g

Force global for "A..J", "a..e" with quotes: lbl "A"

-s

Output source listing to standard error

-h

Output byte code to standard error, requires -s.

-f LIFFILENAME

Create a LIF file instead of a raw file on standard output. A valid lif file name must be provided, which must apply the rules of HP-71 file names: capital letters and digits, starting with a capital letter.

-x XROMFILE

Use XROMFILE to define names for functions in plug-in modules. This option may be repeated to load multiple XROMFILEs. The file name has to be specified either as a full pathname or as the filename without the extension .xrom in the default location that is specified with the environment variable LIFUTILSXROMDIR (see below). There is a special XROMFILE hpdevices.xrom that contains all definitions for the standard HP peripheral ROM functions.

-?

Print a message giving the program usage to standard error.

FILES

xroms/*

xrom function definition files. Use the environment variable LIFUTILSXROMDIR to point to the location of this directory. On Linux the default location is /usr/share/lifutils/xroms, if the variable is not specified.

REFERENCES

The format of an HP41C program is documented in many books. Amongst the most useful references are Extend Your HP41 (W. A. C. Mier-Jedrzejowicz) and The HP41 Synthetic Programming Quick Reference Guide (Jeremy Smith)

EXAMPLES

If prog1.txt is a text file with a FOCAL program that uses functions of the HP-IL and time module and hp41prog.dat is a LIF image file then

cat prog1.txt | lifutils comp41 -x hpil -x time -f PROG1 | lifutils lifput hp41prog.dat

will compile the file prog1.txt to a LIF file named PROG1 that is stored in the LIF image file hp41prog.dat

BUGS

Unknown.

AUTHOR

comp41 was written using code of the User-Code File Converter/Compiler/De-compiler/Bar-Code Generator Version 1.31 Copyright (c) Leo Duran, 2000-2023 and has been placed under the GNU Public License version 2.0