The Museum of HP Calculators

HP Articles Forum

[Return to the Index ]
[ Previous ]


HP-41 MCODE: The Last Function - at last!

Posted by Ángel Martin on 8 Nov 2013, 4:55 a.m.

The Last Function - at last!

The latest releases of the PowerCL, SandMath and SandMatrix modules all include support for the LASTF functionality. This is a handy choice for repeat executions of the same function (i.e. to execute again the last-executed function), without having to type its name or navigate the different launchers to access it.

The implementation is not universal - it only covers functions invoked using the dedicated launchers, but not those called using the mainframe XEQ function. It does however support two scenarios: (a) functions in the main FATs, as well as (b) those sub-functions from the auxiliary FATs. Because the latter group cannot be assigned to a key in the user keyboard, the LASTF solution is especially useful in this case.

The following table summarizes the launchers that have this feature: (lower case s denotes the SIGMA character)

Module	     Launchers   	        LASTF Method

Power_CL sCL, XCAT, TURBO, BAUD, MMU, rev. BS14 IMDB, HEPX, YBUF, XXEQ Captures (sub)fnc id# IOBUS, IOPG#, STR$, ALP$ Captures (sub)fnc id# XQ1 _ , XQ2 _ Captures (sub)fnc NAME PLUG, XFAT , XROM Not supported

SandMath 3x3 sFL, HYP, FRC, RCL# Captures (sub)fnc id# rev. 4K sFL$ _ Captures (sub)fnc NAME sFL# _ _ _ Captures (sub)fnc id#

SandMatrix sML, sDST Captures (sub)fnc id# rev. 4M sVL$ _ Captures (sub)fnc NAME sVL# _ _ _ Captures (sub)fnc id#

Note that the launchers XQ1, XQ2, sFL$ and sVL$ will switch to ALPHA mode automatically.

Operating Instructions

The Last Function feature is triggered by pressing the radix key (decimal point - the same key used by LastX) while the launcher is up. This is consistently implemented across all launchers supporting the functionality in the three modules - all work the same way.

When this feature is invoked, it first shows "LASFT" briefly in the display, quickly followed by the last-function name. Keeping the key depressed for a while shows "NULL" and cancels the action. In RUN mode the function is executed, and in PRGM mode it's added as a program step if programmable, or directly executed if not programmable.

If no last-function yet exists, the mainframe function XEQ is parsed in the SandMath and PowerCL modules; whilst the error message "NO LASTF" is shown in the SandMatrix module. If the buffer #9 is not present, the error message is "NO BUF" instead in all cases.

Implementation details.

The functionality is a two-step process: a first one to capture the function id#, and a second that retrieves it, shows the function name, and finally parses it. All launchers have been enhanced to store the appropriate function information (either index codes or full names) in registers within a dedicated buffer (with id# = 9). The buffer is maintained automatically by the modules (created if not present when the calculator is switched ON), and its contents are preserved while it is turned off (during "deep sleep"). No user interaction is required.

The buffer has one register reserved for each of the three modules, so that up to three last-functions are simultaneously available. A total of five registers are used, as follows:

Register	    Used for:
b4	    SandMatrix fcn id# 
b3	    SandMath fcn id#  
b2	    PowerCL fcn id#
b1	    Time-based Seed
b0	    Buffer Header
The fcn id# format can be either a string of alpha characters (stored in reversed order) representing the function name, or a three-digit hex value representing the sub-function index. In the latter case the [MS] field is marked with an "F" to tell the cases apart.

When the LASTF action is triggered pressing the Radix key, the code seeks for the function data in the relevant buffer register, depending on the module carrying the action. When found, it displays the sub-function name (either by mirror-imaging the id# or by looking it up in the corresponding auxiliary FAT. Finally it's parsed to the corresponding section responsible for the execution of the sub-functions.

Dependencies

These three modules do require the 41-CX OS and the Library#4 installed. Note that the Library#4 was also updated to revision "K" - now including subroutines in support of this functionality. As always, make sure that matching revisions are installed in your machine.

Note as well that the SandMatrix also requires the SandMath installed.

Edited: 8 Nov 2013, 5:19 a.m.

Password:

[ Return to the Message Index ]

Go back to the main exhibit hall