The Museum of HP Calculators


HP-41C/CV/CX Programming

The HP-41C series is complex and extensible. This guide covers basic operations of the calculators, card readers, and wands. Application ROMS, HP-IL devices etc. are currently not covered. Synthetic programming is covered separately.

Contents:

Features

Basic Programming

Entering And Running A Sample Program

A simple program is essentially just the keystrokes you would press to solve the program manually. The calculator remembers a sequence of keys and executes them in order at the touch of a key. In the simplest programs, the only additional steps are a name (LBL) and an end instruction.

To enter a program, press the PRGM button to switch the calculator into PRGM mode (notice the annunciator). Then press shift GTO .. to pack program memory and to set the calculator to an unused space. (The HP-41C series is designed around the idea of have many programs loaded at once so we won't be clearing memory in these examples.) The display will show 00 REG # where # indicates the number of unused registers in program memory.

With the calculator in PRGM (program mode) the number you see on the left side indicates the step number. As keystrokes are entered, they will be displayed on the right. Step 00 is really just a placeholder. The first keys you press will go into step 01.

Enter the program below to compute the area of a circle. The program begins with LBL AREA which indicates that this program can be executed by pressing the XEQ ALPHA AREA ALPHA keys on the calculator.

shiftLBL ALPHA    Give the program a name 
AREA ALPHA     AREA is entered using the blue alpha key labels
shiftx2           These three instructions
shiftπ            are just the normal keystrokes
×              for computing the area given the radius in X

The calculator will display the first line as LBL ᵀAREA with the little "ᵀ" indicating a text string. If printed with one of the optional printers, then it will print as LBL "AREA". Most listings in the HP-41C Software Library use the printed format.

Now press shift GTO .. to insert an end instruction and the calculator will show 00 REG #. Press the PRGM button again to switch to normal mode. To run the program, key in a radius and press XEQ ALPHA AREA ALPHA and the area will be displayed. The program can be run as many times as you like by entering new values and pressing XEQ ALPHA AREA ALPHA. Of course, this is a lot to type and fortunately, after running the program by name the first time, it becomes the current program so now you can just enter a radius and press R/S to run it again.

When you run programs, you'll see a "flying goose display" like the one shown below. (With this short program, you'll only get a glimpse of it.)


Flying goose animation by Rafael Millán

If you wanted to use this function a lot and you wanted to easily switch between it and other programs, you could assign it to a key on the keypad. Press:

shiftASN          The calculator prompts you for a name so press
ALPHA
AREA ALPHA     then the calculator prompts for a key so press:
Σ+

Now press the USER key to activate the USER keypad. By default, all keys on this keypad act as labeled but key in a radius and press Σ+ and you'll compute the area with your program. You can assign the entire keyboard to your functions in this way. HP made blank keypad overlays that allow you to label the keys to match your definitions.

Also notice that if you hold down the Σ+ key, it displays the name of your program. This feature works for all the keys, not just the ones you've assigned. If you continue to hold the key, the display changes to NULL indicating that nothing will be executed when you release the key. This allows you to browse the keyboard without executing functions.

The USER mode will remain active until you press USER again even if the calculator is turned off. The assignment will remain active until you reassign the key or delete the program. To return the key to its original meaning even in USER mode, press:

shiftASN ALPHA ALPHA Σ+

HP-41C END instructions are important to understand. When you press shift GTO .. the calculator checks to see if the last program in memory is followed by an END instruction and if it isn't it adds one. The HP-41C also has a permanent end marker at the bottom of memory which is indicated by ".END." If you don't press shift GTO .. after entering a program and then press SST, you will be able to see the .END. marker.

This distinction is important because program loads from the optional card reader, wand and other devices replace the "last program in memory" which is defined as the program between the last END and the .END. If you have an END statement after your last program, the program will replace the memory between that last END and the .END. which means the new program will be added. If your last program doesn't have an END, the new program will replace it. This feature allows you to load multiple programs that will each overwrite each other (the standard behavior or previous HP card readers) rather than fill memory with multiple programs.

Getting started with the HP-41C is a little more complicated than previous calculators because it's designed to do so much more.

Calculator Modes

The calculator keyboard has several modes:

USER Keys assigned by the user keyboard (via ASN) override the labels printed on the calculator. USER mode remains active even if the calculator is turned off and on.
ALPHA The blue legends on the keys are active for specifying strings including prompts and program names. Pressing shift followed by a number or +, -, x, or ÷ causes the white legends on the tops of these keys to be entered as alpha characters. The label on the bottom of the calculator shows other shifted alpha functions. Pressing shift before STO and RCL invokes the ASTO and ARCL functions.
PRGM The calculator is ready to record programs. (The PRGM annunciator also shows along with a moving busy indicator when a program is executing.)
normal The other modes aren't active. The calculator executes the white and shifted yellow functions immediately. In most of the following text, where normal mode is called for, USER mode is also acceptable. Normal mode often just means not PRGM mode.

The shift key activates the SHIFT annunciator but this is active only for the next keystroke.

Program Memory

Programs and storage registers share the same memory in the calculator. By default, the HP-41C and CV calculators allocate 46 registers to program memory leaving 17 storage registers on the HP-41C and 273 on the CV. The CX models default to 219 program registers and 100 registers for data storage. Anytime you fill program memory, the calculator will attempt to pack it and display TRY AGAIN. If the second attempt fails, you can reallocate memory with the SIZE command. When you execute SIZE, the calculator prompts you for a three-digit number between 000 and 319 which indicates the total number of data storage registers to be allocated. For example:

XEQ ALPHA SIZE ALPHA 021

Would allocate storage registers 00-20.

The rest of the memory is available for programs. Note that you can't use SIZE to reduce the program memory to less than the size required to contain the current programs. You must delete some programs first. This prevents you from accidentally losing code.

Multiple programs, separated by END instructions, are typically stored in an HP-41C. An END instruction is automatically added to the current program when you press GTO ..

Stopping, Interrupting and Entering Data

Many programs only require data to be entered at the beginning as the one above did. Remember that you can use the stack and store values in registers before execution. You can also enter STOP instructions into the program by pressing the R/S key (or by pressing XEQ ALPHA STOP ALPHA) to allow additional data to be entered. The user can enter the data and then press R/S to resume. If you create a program that runs for too long (possibly due to an infinite loop) you can stop it by pressing R/S and if necessary, resume it by pressing R/S again. If you press R/S in the middle of a program, you can see where the program is executing by pressing and holding SST (see below) or switching to PRGM mode.

Stepping And Editing programs

The following commands are used to edit or step through programs and are not recordable. (Prefix keys are not shown and those not on the keyboard are keyed as XEQ ALPHA name ALPHA.)

Entering an instruction causes the new instruction to be inserted after the instruction displayed and all following instructions to be pushed down.

The following diagram when read from left to right shows the insertion of a multiply after the ENTER. Start with the display showing the ENTER instruction. The x is inserted after the ENTER and the display moves down to show it. Reading right to left, with the display showing the x, pressing the ← key, deletes the x, and leaves the display on the line above (ENTER.)

shift RTN can be pressed in normal (or USER) mode to reset the program counter to step 000 of the current program. shift GTO .000 has the same effect and works in PGRM or normal (or USER) mode.

PACK may be executed to pack memory (remove any blank spaces). PACK is automatically done when you press shift GTO .. or when you add a step when memory is full.

CATALOG may be used to step through the labels of programs. Press shift Catalog 1 and then press R/S to allow you to SST/BST through the entries. Each SST takes you to either another program (LBL) or END instruction. At any time, you may press the PRGM key to edit the program at the step currently shown in the CATALOG display. (Catalog 2 lists functions in plug-in modules and Catalog 3 lists built-in HP-41C functions.)

You may perform a master clear by turning the calculator off, holding down the ← key and turning the calculator back on. The calculator will display MEMORY LOST.

Programming Techniques

Addressing

The HP-41C uses label addressing. Global labels are used to name programs and are alphanumeric consisting of up to seven characters. They may contain any character except the comma, period or colon.

The single letter labels A-J and a-e and the two-digit numeric labels are local labels. You may use these labels multiple times within different programs in memory without fear of  executing a subroutine from the wrong program.

The calculator always searches backwards from the most recent (lowest program in memory) to older programs when searching for alpha (global) labels. Thus, if you have two programs named XYZ loaded, the last will be executed. On the other hand, the calculator always searches downward through program memory from the current location for local labels. After it gets to the end of the current program it resumes searching from the beginning. If there are multiple copies of a local label within a single program the calculator will execute the first one it finds.

The single character labels have a special property. When the HP-41C is in USER mode, and you press one of the keys in the top two rows (or shift and one the keys in the top row) the calculator searches for the local label corresponding to the blue legend in the current program. If the label doesn't exist in the program, the calculator executes the white or yellow function printed on the calculator. This allows these keys to behave like the top row of keys on the HP-65 and HP67/97. (Press shift A-E to execute a-e.)

If you have assigned (via ASN) a function or program to any of the keys in the top two rows, these functions will always be executed - the local label search will not happen for these keys.

Example Labels:

COMPUTE Valid Program name/global label
COMPUTER Bad - too long
JUMP1 Valid global
00 Valid local numeric
199 Too many digits
B Valid local label - will be executed when the program is current and the user presses 1/x in USER mode.
GO.BACK Invalid character

Jumps and Subroutines

The program below calculates the volume of a cylinder by calling the first example as a subroutine. If you don't have the first example in memory, key it in now after pressing PRGM shift GTO .. :

shiftLBL ALPHA    Give the program a name 
AREA ALPHA     AREA is entered using the blue alpha key labels
shiftx2           These three instructions
shiftπ            are just the normal keystrokes
×              for computing the area given the radius in X

Now add the cylinder program: (Press GTO .. to add an end to the previous program and prepare for the new one.)

shiftLBL ALPHA
CYLIND ALPHA
XEQ ALPHA AREA ALPHA       Call the previous program
×                          Multiply by length

Press GTO .. and switch to normal mode. Type the cylinder length, press ENTER, then type the cylinder radius and press XEQ ALPHA CYLIND ALPHA to display the volume. The program uses the radius in X and calls the subroutine AREA to determine the area of the circle. When the subroutine returns, the area is in X and the length is still in Y so X and Y are multiplied to calculate the volume.

Any time a label is not found, the calculator will display NONEXISTENT. Press ← to clear the error.

Conditional Tests and Flags

The calculator has instructions for comparing X to Y and X to 0. If the comparison is true the calculator executes the next instruction. If the comparison is false the calculator skips the next instruction.

The next instruction is most commonly a GTO or XEQ like:

X=0?
GTO 01      Go to label 01 if X is equal to zero
STO 02      The line above is skipped and execution continues here
            if x is not zero. 

Four common comparisons are supplied as shifted functions over the math function keys. Other comparisons may be entered via the alpha keyboard (XEQ ALPHA x... ALPHA.) See the back label for the positions of < > and ≠ characters in Alpha mode and don't forget to end the comparison with the question mark.

The calculator also has 30 user and 26 system flags that can be set and tested in program execution. A flag is set with the SF nn instruction where nn is between 00 and 55. A flag is tested by the FS? nn instruction and if the flag is set the next instruction is executed. Otherwise, the next instruction is skipped. A flag is cleared with CF nn instruction. Additional instructions include FC? (test if flag is clear), FS?C (test for flag set and clear it) FC?C (test for flag clear and clear it.)  These last three are not on the keyboard.

Flags 0-29 are user flags which can be set, cleared and tested. The system flags (30 and above) can only be tested. The flags are:

General Purpose Flags (00 through 10)
The HP-41C has 11 general purpose user flags. Your program can set, clear or test them as needed.
Special Purpose Flags (11 through 20)
These flags can also be set tested and cleared in your program, however they have special meaning to the calculator and sometimes it controls them.
Automatic Execution Flag
If flag 11 is set the HP-41C automatically begins executing the current program whenever the calculators turned on.
Card Reader Overwrite Flag
When set, flag 14 allows you to overwrite write-protected cards with the optional card reader.
Printer Enable Flag (21)
This flag is used to enable or disable printing. Printing is enabled when this flag is set.
Data Entry Flags (22 and 23)
These two flags detect keyboard input. The calculator sets flag 22 when numeric data is entered from the keyboard and flag 23 when alpha data is entered. Both flags are cleared each time calculator is turned on.
Range Error And Error Ignore Flags (24 and 25)
That these flags control how the HP-41C reacts to range errors and operating errors. If flag 24 is set range errors are ignored and numbers such as 9.999999999x1099 are returned in place of errors. Flag 24 remains set until you clear it. If flag 25 set other errors are ignored. Flag 25 is cleared each time an error occurs.
Audio Enable Flag (26)
This flag controls whether tones are produced.
User Mode Flag (27)
This flag is used to place the calculator in user mode.
Number Display Control Flags (28 to 29)
Flag 28 controls the radix and separator marks. It may be set for American or European styles. When flag 29 is set groups of three digits are separated with commas or points depending on the setting of flag 28.
Catalog Flag (30)
For internal use.
Peripheral Flags (31 through 35)
These flags are used internally for the operation of certain peripherals.
Number Of Digits (36 through 39)
These flags are used internally to control the number of digits displayed.
Display Format Flags (40 and 41)
These flags control the display mode.
Trigonometry Mode Flags (42 and 43)
When flag 42 is set the calculator is in GRAD mode. When flag 43 a set the calculator is in RAD mode.
Continuous On Flag (44)
If flag 44 is on the HP-41C will stay on indefinitely. If it is clear the calculator will turn off after 10 minutes of inactivity.
System Data Entry Flag (45)
Used internally and always tests clear.
Partial Key Sequence (46)
Used internally and always tests clear.
Shift Set Flag (47)
Used internally and always tests clear.
Alpha Mode Flag (48)
When the HP-41C is in alpha mode flag 48 is set, otherwise flag 48 is clear.
Low Battery Flag (49)
When this flag is set battery power is low. The BAT annunciator will also show in the display when this flag is set.
Message Flag (50)
If set, the display contains some message (not the Alpha or X register).
SST Flag (51)
Used internally and always tests clear.
PRGM Mode Flag (50)
Used internally and always tests clear.
I/O Flag (53)
When set, a peripheral extension is ready for I/O. Otherwise device is not ready for I/O.
Pause Flag (54)
When set a PSE (pause) instruction in a program is in progress.
Printer Existence Flag (55)
When set, an HP-41C printer is attached to the calculator.

Indirect Addressing

Any primary register (R00-99), any stack register (X, Y, Z, T) or the LAST x register (L) can be used for indirect addressing. Store a number in a register, and use it for indirection by pressing shift (which displays as IND) before specifying the register number. Examples:

5 STO 02           Store the number 5 in register 02
10 STO shift 02       Store the number 10 in the register indicated by 02.
                   In this case register 05.  (Displays as STO IND 02.)

7 ENTER            Place 7 in the Y register of the stack
20 STO shift . Y      Store 20 in the register indicated by the Y stack
                   register.  In this case 07  (It is not necessary to
                   press the ALPHA key before pressing Y since the
                   calculator is expecting X, Y, Z, T, or L at this point.
                   (Displays as STO IND ST Y.)

6 STO 01           Store the number 6 in register 1
shift SCI shift          Display is now showing SCI IND __
01                 Display format changes to SCI 6

Indirection can be used on the following functions:

For GTO or XEQ, the value of the indirection register can be numeric between 00 and 99 or Alpha. For example, if AREA is stored in register 05 then XEQ shift 05 would execute the AREA program. If you still have the AREA program loaded, try executing it indirectly from the keyboard by pressing:

                               This is a key sequence not a program!
ALPHA AREA shift ASTO 05 ALPHA    Store AREA in reg 05 (ASTO is shift STO)
5                              Enter a 5 as the radius
XEQ shift 05                      78.54 will be displayed

The indirect register can contain a non-integer number but only the integer part is used.

Looping Constructs

Two looping functions are available:

For both functions, register nn is loaded with a number of the form iiiii.fffcc where:

When the register is first loaded you start with iiiii set to the value at which you wish to begin counting. This portion of the register will change after an ISG or DSE instruction. The fff portion is the value you wish to test for ending the loop and must always be specified as three digits. (For example, 5 would be 005.) The cc portion is added or subtracted to/from iiiii on each iteration. (fff and cc don't change.)

On each iteration of ISG, cc is added to iiiii. If iiiii is now greater than fff, the calculator skips the next line. For example, if you stored 50.10002 in register 25, the first iteration of the ISG 25 instruction would add 2 to 50 changing the value of register 25 to 52.10002. Since 52 is not greater than 100, the next line would not be skipped. (The next line, is typically a GTO to continue looping.)

On each iteration of DSE, cc is subtracted from iiiii. If iiiii is now equal to (or less than) fff, the HP-41C skips the next line. For example, if you stored 50.01005 in register 05, the first iteration of DSE 05 would subtract 5 from 50 leaving 45.01005 in register 05. Since 45 is still greater than 10, the next instruction would not be skipped.

The following example counts from 0 to 100 by 5s displaying each number for about a second.

PRGM
shiftGTO ..
shiftLBL ALPHA    Give the program a name 
INC ALPHA      INC is entered using the blue alpha key labels
0.10005        We're going to count to 100 by 5s
STO 01
shiftLBL 01       Numeric labels are internal to programs
RCL 01
XEQ ALPHA
INT ALPHA      Built-in that returns just the integer portion
XEQ ALPHA
PSE ALPHA      Display the integer part of R01 for a second
shiftISG 01       Increment and skip the next instruction if greater
shiftGTO 01       Do it again

Now press shiftGTO .., go back to normal mode (press PRGM again) and press XEQ ALPHA INC ALPHA and watch the results. Because the program counter is left in the current program, you can re-execute this program by just pressing R/S after it has finished.

Here's an example that combines looping and indirect addressing to store the squares of 0-20 in registers 0-20.

PRGM
shiftGTO ..
shiftLBL ALPHA    Give the program a name 
SETREG ALPHA   SETREG is entered using the blue alpha key labels
0.02001        We're going to count to 20 by 1s
STO 21         A register out of the range that we're going to write
shiftLBL 01       Numeric labels are internal to programs
RCL 21
XEQ ALPHA
INT ALPHA      Built-in that returns just the integer portion
shiftx2           Square (int(R21))
STOshift21        The STO IND will only use the integer part of register 21
shiftISG 21       Increment and skip the next instruction if greater
shiftGTO 01       Do it again

Now press shiftGTO .., go back to normal mode (press PRGM again) and press XEQ ALPHA SETREG ALPHA and then use the RCL key to review the numbers deposited in R00-R20.

Input/Output

R/S can be used as an instruction or pressed from the keyboard. If a program is stopped, pressing R/S starts it. If the program is running, pressing R/S stops it. R/S can also be pressed to insert a STOP into a program to allow the user to input data.

The PSE (pause) instruction shows the X register for about a second. Pressing any of the data entry keys causes it to re-pause for another second to allow you to continue inputting before the program continues. (This allows you to write programs that pause for optional data inputs but continue automatically if left unattended.)

Alpha strings (below), allow inputs and outputs to be labelled.

Advanced and Unusual Features

Alpha Strings

The HP-41C allows you to program with alphabetic characters as well as numbers. The AVIEW a command is used to display the alpha register. The AVIEW command may be used to display strings while the program executes or to prompt the user for data. In the former case the string replaces the normal program busy indicator. (The PRGM annunciator is still shown.)

The PROMPT instruction displays the contents of the alpha register and stops execution of the program. The following program demonstrates a simple use of the PROMPT instruction.

PRGM
shift GTO ..
shift LBL ALPHA AL ALPHA       Name the program AL
ALPHA INPUT ALPHA           Places INPUT in the Alpha Register
XEQ ALPHA PROMPT ALPHA      Prompt the user
3
×                           Multiply it by three
shift GTO ..
PRGM

Execute the program by pressing XEQ ALPHA AL ALPHA and it will stop and display INPUT. Enter a number and press R/S and it will display the number times 3.

Alpha strings can also be used to label results. Here's a rewritten form that does this. First clear the previous version with XEQ ALPHA CLP ALPHA ALPHA AL ALPHA and enter:

PRGM
shift GTO ..
shift LBL ALPHA AL ALPHA       Name the program AL
ALPHA INPUT ALPHA           Places INPUT in the Alpha Register
XEQ ALPHA PROMPT ALPHA      Prompt the user
3
×
ALPHA shift 3 shift x =           Use Shift to enter numbers & the 4 basic
                            math functions into an alpha string.
shift ARCL . X                 Recall X register into Alpha Register
                            The value in x is appended to 3*=
                            (ARCL is shift RCL in ALPHA mode.)
shift AVIEW                    Display the alpha register
                            (AVIEW is shift R/S in ALPHA mode.)
ALPHA
GTO ..
PRGM

Press XEQ ALPHA AL ALPHA to run the program.

The AON and AOFF can be used to place the calculator in and out of ALPHA mode within a program. When and ALPHA input is needed, you can save the user the effort of pressing ALPHA by inserting an AON before stopping for input.

CLA clears the Alpha Register. (shift ← in ALPHA mode.)

CLD clears the display and the register that is currently being displayed (X or Alpha.)

ASTO (shift STO in ALPHA mode) stores the left-most six characters from the Alpha register to the specified register. ASHF shifts the Alpha Register 6 places to the left which is handy for storing a long alpha string into several registers.

ARCL (shift RCL in ALPHA mode) recalls the contents of a register and appends to the alpha register.

AVIEW (shift R/S in ALPHA mode) is used to display the alpha register without switching to alpha mode. This is most often used in programs.

The maximum number of alpha characters on a single program line is 15. You can use APPEND (shift K in ALPHA mode) to construct strings up to 24 characters long. (Use the APPEND at the beginning of the next line.)

The calculator displays append as ⊢, so in many programs in the HP-41C Software Library you will see lines such as: "⊢ M/S" which will append " M/S" to the alpha register. To enter that line, in ALPHA mode, press shift APPEND (shift K) SPACE M / (shift ÷) S. On the display, this will show as: ᵀ⊢ M/S.

Using the Optional HP 82104A Card Reader

The HP 82104A snaps on to the top of the HP-41C and allows you to save and record programs and data to magnetic cards. The reader also has built-in intelligence that allows it to read nearly all HP-67/97 programs and convert them for use on the HP-41C.

Programs

To save a program to magnetic card, switch the calculator to PRGM mode by pressing the PRGM button and set the HP-41C to the program you which to write by pressing shift GTO . ALPHA some_lbl ALPHA. (Don't leave out the "." or the GTO will be inserted at the current location.)

Place track one of a blank card (always label side up) in the card reader and let the card be drawn through. Each side of a card holds 16 registers (or an equivalent amount of program space.) Each card has two sides allowing 32 total registers to be stored.

If the program is longer than 16 registers, the calculator displays RDY nn OF tt  where nn is the number of the next track to be written and tt is the total number of tracks that will be required. Because the HP-41Cs memory can be quite large, multiple cards may be needed. Flip the card around to insert track 2 (still label side up) and continue with additional cards as needed until the program is completely written. (If you run out of cards and have to abort, you can press R/S or ←.)

You may wish to label the card(s). Use a marker with a fairly soft point that won't emboss the cards. Permanent ink marking pens like Sanford "Sharpies" work well. Make sure you give the ink time to dry. For temporary cards, you may write on them very carefully with a soft pencil. Keep in mind though that the lead will probably smear after a while.

You may cut off the corners of a magnetic card to prevent it from being overwritten. If a clipped card card is passed through the reader in PRGM mode, the calculator will normally display PROTECTED but you can override the protection by setting flag 14 which is the card reader overwrite flag. This flag is cleared after each card operation or when the calculator is turned on to prevent accidental overwrites.

When programs are written, the calculator also records any key assignments of labels in the program, however, these assignments will only be restored if the calculator is in USER mode when the card is read.

To load a program, make sure the calculator is in normal mode (use the PRGM button to switch it out of PRGM mode.) When the card is read, the program it contains will be written into the program memory between the last END instruction and the end of the calculator's memory (.END.) This means that if your last program doesn't have an END instruction, it will be overwritten by the program on the card. (Pressing shift GTO .. before reading will ensure that the last program has an END instruction.)

If you want the key assignments on the card to be read, be sure to activate USER mode before reading the card. When the calculator is not in USER mode, the calculator ignores the key assignments on the card. This can be handy when you don't want the card to change your current USER keyboard.

Now insert track one of the card (label side up). If the program is longer than 16 registers, the calculator will display RDY nn OF tt where nn is the number of the next track to be read and tt is the total number of tracks that will be read. Reverse the card direction for the 2nd track and continue as needed.)

If the checksum does not match the one recorded on the card, the calculator will display TRY AGAIN. The registers and the stack are not changed when a program is written or read. If there isn't enough space for the program (along with the other programs already in memory) the HP-41C will display NO ROOM. You may abort a multi-track read by pressing R/S or ← but you will be left with part of the program in memory.

A card can be marked as private which means that it can be read and the program can be executed, but the program can't be viewed, edited, or copied onto another card. To create a private program, make sure the calculator is in normal or USER mode, set the HP-41C to the program you wish to write by pressing shift GTO ALPHA some_lbl ALPHA and press XEQ ALPHA WPRV ALPHA. The calculator will then give you the RDY nn OF tt prompt and you proceed as in writing a normal program card. Any attempt to step through or save a program read from a private card will cause the calculator to display PRIVATE.

Subroutines

The RSUB (read subroutine) function can be used in a program to read in a card which replaces the last program in memory. The HP-41C will prompt with CARD and if more than one track is required, it will then prompt with RDY nn OF tt. The RSUB function simply reads the card and returns to the program. The program can then XEQ any label loaded from the card.

Merging Programs

The MRG (merge program) function may be used from the keyboard or in a program and causes instructions on a card to replace the instructions following the current location of the calculator (the instructions after the MRG if MRG is used in a program.) The calculator will prompt you with CARD and if additional tracks are required it will prompt with RDY nn OF tt.

The program position is unchanged by the MRG. If the MRG is used in a program, execution continues with the instruction following the MRG (which was just read.)

The current program must be the last program in memory, meaning it must end with the permanent .END. If it isn't, the calculator will display MRG ERR.

Data

Data can be saved to a magnetic card by making sure that calculator is in normal (not PRGM) mode and executing either WDTA (write data) or WDTAX (write data as directed by x).

WDTA simply writes all registers starting at register 00 and finishing at the top register as defined by the last SIZE command issued. The calculator prompts you with RDY nn OF tt (see above) messages until all the registers have been recorded.

WDTAX is a more complex command that gives you control over which registers are written. A number of the form bbb.eee is placed in the X register where bbb is the beginning storage register address and eee is the ending storage register address. For example15.070 XEQ ALPHA WDTAX ALPHA would cause the HP-41C to write registers 15 through 70 inclusive to magnetic cards. As with WDTA you will be prompted with RDY nn OF tt (in this case 4 times for 4 tracks of 16 or fewer registers each.) The calculator will display NONEXISTENT if the beginning register (bbb) does not exist. If eee is greater than the highest register, the calculator writes to the end of the allocated registers.

These commands may be used in programs or from the command line and may be aborted with the R/S or ← keys. The overwrite flag (14) discussed in the programs section above may also be set to overwrite protected data cards.

In the simplest cases, cards can be read by simply assuring that the calculator is in normal or USER mode (not PRGM mode) and inserting the card. Since the HP-41C knows how many registers were recorded together it will display RDY nn OF tt to prompt you to insert additional tracks as needed. Data is loaded starting at R00 which may not be what you want so the RDTAX instruction may be used to get more control. This command takes a number of the form bbb.eee in the X register just like WDTAX described above.

RDTA is like WDTA described above. It is essentially the same as inserting data card without any command as the data is read starting at R00. If you want to load data in a program, however, it's better to use RDTA than simply stopping with an R/S because the calculator will prompt the user to load the card.

When reading data CARD ERR will be displayed if there are not enough storage registers allocated to hold the data on the current track. Use SIZE to increase the number of registers. Program memory is not changed when data is written or read.

Status Cards

In USER or normal mode, the WSTS (write status) function can be used to save:

The calculator will prompt you with RDY nn OF tt. You may press R/S or ← to abort after the first track if you don't want to save key assignments. To read a status card, just make sure the calculator is not in PRGM mode and insert the card.

Write-All Cards

The WALL (Write all) function allows you to write the entire HP-41C memory (program, data, status) onto cards. WALL can't be keyed in as part of a program. To execute, press XEQ ALPHA WALL ALPHA and feed tracks until the RDY nn OF tt prompts stop appearing.

To read WALL cards, simply insert them when the calculator is not in PRGM mode. When reading back cards, the calculator configuration (optional modules, and peripherals) should be identical to the configuration present when the cards where written. Also, if you interrupt the process with R/S or ←, the memory will be completely cleared and MEMORY LOST will be displayed.

HP-67/HP97 Cards

The HP-41C card reader can read most HP-67/HP-97 cards. The card reader contains ROM with some HP-67/97 emulation functions and alters or inserts other instructions to run on the HP-41C.

To load an HP67/79 program, make sure there are at least 26 registers allocated (execute a SIZE instruction with an argument of 026 or higher) and that the calculator is in normal or USER mode. Press shift GTO .. if you want the last program currently in memory to be preserved. Then insert the card.

The card reader should be left in place when executing HP67/97 programs because it contains emulation functions in ROM. Place the calculator in USER mode to allow the upper row of keys to function just like the A-E keys on the HP-67/97. (Press shift for the lower-case shifted labels.)

Note that A-E and a-e are local labels on the HP-41C. Thus, the calculator must be positioned within that program for these keys to be used. When the card is read, the HP-41C sets the calculator to point at the newly loaded program.

Using the Optional HP 82153A Wand

The optical wand plugs into one the ports on the HP-41C and allows it to read barcode programs, data and even keystrokes. (The wand should be plugged into a higher numbered port than any memory modules in use.)

Before loading a program, check its register requirements and execute a SIZE function if necessary.

For best performance, the wand should be held at a 70° to 80° angle to the paper. Place the tip about 1 cm in front of the row of codes to be read, press the scan switch and scan across the barcodes at a relatively fast and constant speed. (Most speed problems are caused by scanning too slow.) Make sure to the wand doesn't drift above or below the row of bars and after you've swept beyond the end of the row, release the scan button.

If the data was successfully read, the HP-41C sounds a short tone. If the scan was unsuccessful, a longer error tone is sounded.

After you scan data or a keystroke, it is entered or executed. Most programs require multiple rows of bar codes and the calculator will display W: RDY nn where nn is the number of the next row to be read. HP's program bar codes have a human readable label which indicates the row number and range of steps it contains in the form "ROW # (first - last)". After the last row is read, the calculator will temporarily display W: WORKING and then the normal display appears.

As with the card reader, a program read from the card reader overwrites the last program in memory. To preserve the last program in memory, press GTO .. to add an END to the last program in memory.

Bar codes can also contain simple keystrokes and data as well as programs. You can drive your HP-41C by scanning codes and never touching the keyboard.

The WNDDTA program can be used in a program to cause the program to pause and prompt the user to enter a single row a barcode. The user is prompted by W: SCAN DATA and the data is scanned into the X register.

The WNDDTX command is more powerful and expects a control number in the X register of the form lll.hhh where lll is the lowest register and hhh is the highest register to load. The user is prompted to scan the data bardcode rows with W: SC TO nn where nn is the register in which the data about to be scanned will be placed.

The WNDLNK (wand link) function causes the program to halt so the user can scan a subroutine that will be loaded and executed. The program scanned will replace the last program in memory unless the WNDLNK instruction is in the last program in memory or the WNDLNK is executed from the keyboard when the HP-41C is positioned in the last program in memory.

When WNDLNK is executed, the user is prompted with W: SCN SUBLNK. If additional rows are needed, the calculator prompts with the standard W: RDY nn. After the subroutine is scanned, it is automatically executed.

The WNDSUB (wand subroutine) function is just like the WNDLNK function except that after reading the subroutine, the program resumes after the WNDSUB instruction. It is the wand analogue to RSUB.

Go back to the HP-41C
Go to HP-41C synthetic programming
Go to the HP-41C software library
Go back to the main exhibit hall