Misplaced Pages

HP-41C

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
(Redirected from FOCAL keystroke programming) Hewlett-Packard handheld RPN calculator

HP-41C series
HP-41CX with magnetic card reader and thermal printer
TypeProgrammable scientific
Introduced1979
Discontinued1990
Calculator
Entry modeRPN
Display typeLCD fourteen-segment display
Display size12 14-segment (alphanumeric) digits
CPU
ProcessorHP Nut core (1LF5-0002)
Programming
Programming language(s)RPN key stroke (fully merged, Turing complete)
Memory register63 .. 319
Program steps441 .. 2233
Interfaces
Portsfour vendor specific
Connects tomicro-cassette via:

floppy disk via:

  • HP-IL

PC via one of:

Other
Power supplyfour size N batteries or HP 82120A rechargeable battery pack

The HP-41C series are programmable, expandable, continuous memory handheld RPN calculators made by Hewlett-Packard from 1979 to 1990. The original model, HP-41C, was the first of its kind to offer alphanumeric display capabilities. Later came the HP-41CV and HP-41CX, offering more memory and functionality.

The alphanumeric "revolution"

The HP-41C's alphanumeric display allowed it to display numbers, characters, and symbols.
The HP-41CV had a memory five times larger than that of the first model HP-41C. On the lower, inclined flank of the keys, the alphanumeric characters are printed in blue, which are accessible after pressing the "ALPHA" key top right.

The alphanumeric LCD screen of the HP-41C revolutionized the way a pocket calculator could be used, providing user friendliness (for its time) and expandability (keyboard-unassigned functions could be spelled out alphabetically). By using an alphanumeric display, the calculator could tell the user what was going on: it could display error messages, such as showing ("DATA ERROR") upon attempting to divide by zero instead of simply displaying a blinking zero; it could also specifically prompt the user for arguments ("ENTER RADIUS") instead of just displaying a question mark.

Earlier calculators needed a key, or key combination, for every available function. The HP-67 had three shift keys (gold "f", blue "g" and black "h" prefix keys); the competing Texas Instruments calculators had two (2nd and INV) and close to 50 keys (the TI-59 had 45). Hewlett-Packard were constrained by their one byte only instruction format. The more flexible storage format for programs in the TI-59 allowed combining more keys into one instruction. The longest instruction required eleven keypresses, re-using the shift keys four times. The TI-59 also made use of the Op key followed by two digits to access another 40 different functions, but the user had to remember the codes for them. Clearly, a more convenient and flexible method of executing the calculator's instructions was needed. The HP-41C had a relatively small keyboard, and only one shift key, but provided hundreds of functions. Every function that was not assigned to a key could be invoked through the XEQ key (pronounced EXEQTE — "execute") and spelled out in full, e.g. XEQ FACT for the factorial function.

The calculator had a special user mode where the user could assign any function to any key if the default assignments provided by HP were not suited to a specific application. For this mode, the HP-41C came with blank keyboard templates; i.e. plastic covers with holes for the keys, so the user could annotate customized keys. Hewlett-Packard even sold a version of the calculator where hardly any keys had function names printed on them, meant for users who would be using the HP-41C for custom calculations only (thus not needing the standard key layout at all); this version of the calculator was colloquially known, within HP's Corvallis calculator team, as a "Blanknut" (because the development code name for the HP-41C's processor was known as the "coconut").

Alphanumeric display also greatly eased editing programs, as functions were spelled out in full. Numeric-only calculators displayed programming steps as a list of numbers, each number generally mapped to a key on the keyboard, often via row and column coordinates. Encoding functions to the corresponding numeric codes, and vice versa, was left to the user, having to look up the function–code combinations in a reference guide. The busy programmer quickly learned most of the codes, but having to learn the codes intimidated the beginners. In addition to this, the user had to mentally keep function codes separate from numeric constants in the program listing.

The HP-41C displayed each character in a block consisting of 14 segments that could be turned on or off; a so-called fourteen segment display (similar to the much more common seven segment displays, which can be used to display digits only). The HP-41C used a liquid-crystal display instead of the ubiquitous LED displays of the era, to reduce power consumption.

While this allowed the display of uppercase letters, digits, and a few punctuation characters (the FOCAL character set), some designs needed to be twisted arbitrarily (e.g. to distinguish S from 5) and lowercase letters were unreadable (HP only provided display of lowercase letters a through e). HP's competitor Sharp, when introducing the PC-1211, used a dot matrix of 5×7 dots and displayed the characters in principle as we see them today on computer screens (and, in fact, many LCD screens on various embedded systems); this was later used by HP with the HP-71B handheld computer.

The HP-41CV and CX

Many users had used all four ports for memory expansion, leaving no room for other modules. HP designed the Quad Memory Module with four times the amount of memory, providing the maximum available memory and leaving three empty ports available. The HP-41CV (V being the Roman numeral for 5) included this memory module on the main board, thus providing five times the memory of the HP-41C, and four available slots.

The internal architecture prohibited the addition of more memory, so HP designed an extended memory module that could be seen as secondary storage. The data could not be access directly, but it was possible to transfer data to and from main memory. To the calculator (and the user), data located in the extended memory looked like files on a modern hard disk do for a PC (user).

The final HP-41 model, the HP-41CX, included extended memory, a built-in time module, and extended functions. It was introduced in 1983 and discontinued in 1990.

Programming

The HP-41C is keystroke programmable meaning that it can remember and later execute sequences of keystrokes to solve particular problems of interest to the user. These keystroke programs, in addition to performing any operation normally available on the keyboard, can also make use of conditional and unconditional branching and looping instructions, allowing programs to perform repetitive operations and make decisions.

The HP-41C also supports indirect addressing (computed goto) with which it is possible to implement a Universal Turing machine and therefore the programming model of the HP-41C can be considered Turing complete. The combination of indirect addressing and gotos easily led to spaghetti code.

Program steps are numbered starting from 1, but this numbering has no intrinsic meaning and changes as new instructions are added or removed in the middle of a program. A special LBL instruction is used to create a label that is then referenced by the user to invoke the program, or by the program itself as target of a GTO (unconditional goto) or XEQ (execute) instruction.

Programming example

Here is a sample program that computes the factorial of an integer between 1 and 69 (70! needing an exponent greater than 99, the calculator's maximum). The integer is entered in the X register and passed as an input parameter when the program is run. The program takes up two registers, which is ≈14 bytes.

Step  Op-code      Comment
01    LBL'Fac      ALPHA global label makes program callable by 'XEQ Fac'
02    STO 00       Store X=input parameter in register 00
03    1            Enter 1 in X, "lifting", or "pushing", the stack: Y=input parameter (no longer used)
                                                                     X=1
04    LBL 00       Local label for goto
05    RCL 00       Recall register 00 into X, lifting the stack: Z=input parameter (no longer used)
                                                                Y=1 or interim or final factorial
                                                                X=input parameter (N) minus effect of DSE command (-0, -1, ..., -(N-1))
06    *            Multiply X and Y, "dropping", or "popping", the stack: Y=input parameter (no longer used)
                                                                          X=interim or final factorial
07    DSE 00       Decrement register 00 and Skip next command when register value is Equal to 0
08    GTO 00       Go to local label 00
09    END          End program - result displayed in X

FOCAL

The box (top) in which the HP-41CV was sold with most of the manuals, programming handbooks and accessories; the power supply is not depicted

Though the programming language used on the 41 series is a version of the keystroke programming languages used in all preceding programmable HP calculators, the range of technologies, and programming-related usability and extensibility features available in 41 series models (notably keyboard overlays, a fully remappable keyboard, I/O capabilities for storing and sharing programs, and alphanumeric support), led some users to propose a new name for the language, resulting in a competition that was won by "FOCAL" for "Forty One Calculator Language". As the name FOCAL was already in use by the Digital Equipment Corporation, the name was never formally adopted by HP.

Synthetic programming

A large user community was built around the HP-41C. Enthusiasts around the world found new ways of programming, created their own software (such as a codebreaking game, and a version of Hunt the Wumpus) and expansion modules, and sped up the clock (see overclocking). Most of these activities were coordinated by the PPC club and its president, Richard J. Nelson. The PPC club published the PPC Journal and produced the PPC ROM, a collection of highly optimized low-level programs for the HP-41C.

One of the discoveries of the community was that, because some FOCAL instructions were stored in memory as more than one byte, it is possible to exploit a bug in the program editor to assign strange functions to keys. The most important function was known as the byte jumper or byte grabber, a way to step partially through programming instructions and edit them in ways that were not otherwise allowed. The use of the resulting instructions was called synthetic programming.

Through synthetic instructions, a user could access memory and special status flags reserved for the operating system, and do very strange things, including completely locking the machine. It was possible to create sounds or display characters, and create animations not officially supported by the operating system. The system flags were also accessed as low-level shortcuts to Boolean programming techniques. Hewlett-Packard did not officially support synthetic programming, but neither did it do anything to prevent it, and eventually even provided internal documentation to the user groups.

Reception

In its December 1980 issue, BYTE magazine described the HP-41C as "the most versatile machine ever". The author praised HP's documentation as "among the best in the industry", and reported that the calculator was "much easier to program and debug" than the TI-59. Stating "I found the HP-41C far more pleasurable to program and use than its predecessors" because of its alphanumeric display, the author concluded that it was "maybe not quite" a pocket computer. In the next issue, another author wrote that "The HP-41C ... is among the programmable calculators that lie closest to the computer borderline. It comes close enough for the jargon of computers to be useful in describing it", and praised the simplicity and reliability of the card reader and compatibility with HP-67 and HP-97 software. The review criticized the inaccuracies in calculations from the lack of guard digits; "There is something absurd about the world's fanciest calculator not being able to give results accurate to more than seven or eight decimal places". Hewlett-Packard responded that the alleged imprecision was inherent to arithmetic on any computer with finite precision.

Use on the Space Shuttle

NASA HP-41CV with Velcro to hold it in carrying case, 1983
Sally Ride, the first female astronaut of the USA, on Space Shuttle mission STS-7 (1983) with three HP-41C floating beside her

An HP-41C that flew on nine early Space Shuttle missions is on display in the National Air and Space Museum in Washington, D.C. HP-41Cs with some special hardware configurations (the addition of Velcro strips, pre-production time module, and louder beeper, as well as the removal of parts whose outgassing could cause contamination) were carried on early Shuttle missions for the purpose of performing mundane but necessary calculations, such as calculating the change to the center of gravity due to fuel consumption. The HP-41C was also programmed to handle calculations usually performed by the main on-board computer, such as determining ignition times for re-entry, in the case of a main computer failure.

Expandability

The functions of the calculator could be expanded by adding modules at the top of the machine. Four slots were available to add more memory, pre-programmed solution packs containing programs covering engineering, surveying, physics, math, finance, games, etc. As such, an HP-41 could in fact be tailored to the personal needs of the user. Hardware extensions included a thermal printer, a magnetic card reader (HP-67 compatible via converter software), and a barcode "wand" (reader).

Extension modules could also add new instructions to the machine. The standard set of mathematical functions of the 41-series was somewhat limited when compared to the functionality of some contemporary HP calculators (notably the HP-34C and the HP-15C). Among others, the standard function set offered no integration or root-finding capabilities and lacked support for matrices and complex numbers; these extra functions could be added by an extension module.

Another module, known as the Interface Loop allowed for connection of more peripherals: larger printers, microcassette tape recorders, 31⁄2-inch floppy disk drives, RS-232 communication interfaces, video display interfaces, etc. The Interface Loop could also be used with the HP-71B, HP-75 and HP-110 computers.

Extension slots of the HP-41CX

HP-41 extension (or expansion) modules allowed the user of an HP-41 programmable calculator to extend the functionality of the machine. The HP-41 had room for up to four expansion modules at the back of calculator.

The HP-41 was not the only calculator of its generation that allowed expansion modules. The TI-58 and TI-59 also had pluggable ROM modules. The HP-41 modules were however much more versatile.

Memory modules (HP-41C only)

HP 82106A memory module for HP-41C
HP 82170A QUAD memory module for HP-41C

Memory modules added RAM main memory to the calculator, allowing more programming steps and/or more data registers.

The original HP-41C had a main memory of 63 registers of 7 bytes each. Each register could hold either a number, a 6-character string, or up to seven program steps in the FOCAL language (program steps used a variable number of bytes).

Each memory module added 64 registers, and the calculator could hold up to four of them, for a grand total of 319 registers. While this was considered huge for the time (a little more than 2 kilobytes,) all expansion slots were used. User groups found a way to merge two memory chips in a single module, thus freeing two expansion slots. HP designed a module holding all four in one slot, the so-called Quad Memory Module. The later HP-41CV had the quad module built-in.

Application pacs

The ROM-based application 'pac' modules added up to 4 kilobytes of read-only memory (some up to 8 kilobytes, but these were simply two independent 4K modules in the same box). Most modules held dozens of programs written in the HP-41C programming language, FOCAL.

Programs in the ROM modules could be called from a user program, using the ubiquitous XEQ function. In the program code, XEQ appeared as "XROM" when it was used to call a ROM program.

82104A card reader

HP 82104A - card reader/writer
HP magnetic card

The card reader was a device able to read and write small rectangular plastic cards with two magnetic strips. The card reader could copy contents of memory onto magnetic cards, and later read back the data into memory.

As the HP-41C had non-volatile memory (user programs and data were not wiped out when power was off) there was no absolute need for a permanent storage device, so the card reader was optional.

Each card held two strips of 112 bytes each, that could hold 16 data registers or up to 112 program steps. This limited capacity resulted in typical programs requiring five or more magnetic cards to be saved. A full backup of the machine's 319 memory registers plus internal data required 11 magnetic cards (each card had to be inserted twice.)

The card reader could read magnetic cards from the earlier model HP-67. HP-67 programs were translated into HP-41C instructions, as the HP-67 and HP-41 share the same programming model and operation stack. Some instructions however were specific to the HP-67, and the card reader provided additional instructions to emulate the 67.

Magnetic cards could be write-protected, and programs saved as private: once loaded back, the source code for the program could not be displayed. This made magnetic cards an obvious choice for program distribution.

However, the electric motor put a heavy strain on the calculator batteries, and the price tag for blank cards put an even heavier strain on the user's wallet.

82182A time module

The time module added a real-time clock. The clock allowed use of real-world time in programs. The user could set alarms that triggered calls to user programs. The alarms were able to switch the calculator on, so it was possible to create programs that executed at some point during the day, then switch the calculator off until the next alarm. As the HP-41 was often used as a data-gathering device in labs, this allowed the calculator to read data from monitored devices at specific times every day, without having to remain fully powered up in between readings (thus saving battery capacity).

The HP-41CX had the time module built in.

82143A thermal printer/plotter

The printer used rolls of thermal paper to print lines of up to 24 characters. The thermal paper provided for a bluish printout, but was somewhat unstable, as the printout could vanish or the whole paper turn blue due to excessive heat.

The printer had some graphical capabilities, to allow the user to design character shapes, or even turn on or off individual pixels. However, the buffer memory could not hold sufficient information to print a whole line in graphic mode, and could not alter line spacing, so it was impossible to print continuous graphics in horizontal mode. The printer, nevertheless, provided some printing utilities that were able to graph a function vertically onto the narrow strip of printer paper.

82242A infrared printer interface

Instead of using the aforementioned printer, this module could be used to interface a thermal printer with an infrared interface, namely the HP 82240A and the HP 82240B. This allows for on-the-go printing without using cables - but the printer itself needs batteries as well.

82153A optical wand

HP 82153A - optical wand

The optical wand was a barcode reader shaped like a thick pen, and was designed to read lines of HP-proprietary standard barcodes into the calculator memory. The barcodes, printed in e.g. HP solutions books, could consist of programs, numeric or alphabetical constants, and even keypresses (letting the calculator be operated without using the keyboard) — useful for diagnosing calculators where the keyboard was suspected to be faulty.

82180A extended functions module

X Functions module 82180A for HP-41C/CV

The Extended Functions module added many functions which had long been requested by users, such as the ability to programmatically assign functions to keys, repartition memory, etc.

But the most important new function was the management of extended memory: while the HP-41C could theoretically access up to 1024 registers, the early design limited main memory to 319 registers only. The Extended Functions module added instructions to manage a bank of additional memory in the available addressing space of the machine. As this memory was not directly addressable by user programs, it was seen as a set of named files containing either programs or data. Programs and data registers could be copied back and forth from the extended memory to the main memory, where they could be accessed as usual.

Extended memory could also hold ASCII files, and a rudimentary text editor was added also.

The Extended Functions module contained 124 registers of Extended memory. More could be added by ... Extended Memory modules. The HP-41CX contained the Extended Functions module as standard.

82181A extended memory module

X Memory module HP82181A for HP-41CX

Extended memory modules added more extended memory to the HP-41C. They required an extended functions module to be present, or the HP-41CX version of the calculator.

Each module added 238 registers of extended memory. Up to two extended memory modules could be inserted, for a grand total of 124 + 2*238 = 600 registers. Added to the 319 registers of main memory, this covered practically all of the machine's 1024 addressable registers, for a total of 919 registers, or 6433 bytes.

HP82160A HP interface loop (HP-IL) module

See the main article on HP-IL.

Clones

DM41 et al.

The continued popularity of the HP-41CX among users prompted SwissMicros to produce a miniature calculator approximating the size of an ID-1 credit card (88 mm × 59 mm × 7 mm) in 2015. Named DM41, it runs the original HP-41CX firmware with extended memory and realtime clock in an emulator on an ARM Cortex-M0-based NXP LPC1115 processor. Deviating from the original, it comes in a landscape form factor (as known from Hewlett-Packard's Voyager series) with rearranged keys, it features a dot-matrix display, switchable clock speeds, and, based on a Silicon Labs CP2102 converter chip, it comes with a USB (Mini-B) serial interface to exchange data with a PC etc. for backup purposes, to possibly communicate with applications (like PC-based emulators), or to update the firmware. In December 2015, SwissMicros introduced the DM41L, a version of the calculator about the same size as the calculators of the HP Voyager series. It still comes with a USB Mini-B connector. Since September 2020, its successor, the DM41X, has also been offered with an extended range of functions and a conventional design that is very close to the classic original version.

HP41CL

In addition to clones based on emulated HP-41 hardware, there exists at least one actual hardware clone of the HP-41 series. This is the HP41CL HP-41-series CPU board upgrade created by Monte Dalrymple at Systemyde. The HP41CL is a ground up redesign of the components found on the HP-41 CPU board, including the CPU, which is implemented on an FPGA and coded in Verilog RTL. The HP41CL upgrade board is made as a drop-in replacement for the HP-41 series CPU board, assuming that one has an HP-41 that has a compatible CPU board connector and a separate CPU board as well. The upgrade comes with an over 600 register extended memory and over 320 plug-in module images. This is possible due to the fact that the HP41CL has over 1024 pages of 4K-word flash memory built in, of which over 500 pages are pre-loaded with HP-41 software, as well as the upgrade board providing 128 RAM pages, which are made available to the user via a custom MMU. In addition, a "turbo" mode is provided by the HP41CL upgrade board's "NEWT" CPU design, which allows the user to speed up their calculator by a factor of around 50 times. Also, the HP41CL maintains full compatibility with the HP-41 series bus, so that most plug-in modules can still be used in a fully backward compatible fashion. Additionally, Systemyde makes an HP-41 compatible timer module clone as well as a GPS receiver interface module. Furthermore, an optional RS-232 full-duplex serial connector (with a 2.5mm stereo jack physical interface) is available, if one has a free module slot.

Emulators

An emulation app for the HP-41CX running on Apple iOS. Additionally, the simulated output of the thermal printer can be displayed.

Unusually for pocket calculators, the devices still have a fan base more than 30 years after their production was discontinued in 1989. As a result, emulator programs are available for a variety of operating systems, including Windows, Mac OS, Unix variants, Pocket PC, Palm OS, Apple iOS and Android.

Images

  • Alphanumeric display of an HP-41CX Alphanumeric display of an HP-41CX
  • HP-IL interface module HP-IL interface module
  • HP82162A thermal printer (with HP-IL connection) HP82162A thermal printer (with HP-IL connection)
  • HP82161A cassette drive with storage medium (with HP-IL connection) HP82161A cassette drive with storage medium (with HP-IL connection)
  • Interface loop with thermal printer HP82162A (front left), a cassette drive HP82161A (back left) and an HP-41CX Interface loop with thermal printer HP82162A (front left), a cassette drive HP82161A (back left) and an HP-41CX
  • HP 82163B - 32 columns video interface for HP-IL HP 82163B - 32 columns video interface for HP-IL
  • Extension slots of an HP-41CX Extension slots of an HP-41CX
  • HP82242A IR-interface (to a thermal printer) HP82242A IR-interface (to a thermal printer)
  • HP 82104A - card reader/writer for HP-41C HP 82104A - card reader/writer for HP-41C
  • X Memory module HP82181A (memory extension) X Memory module HP82181A (memory extension)
  • Statistics module Statistics module
  • HP 82106A memory module for HP-41C HP 82106A memory module for HP-41C
  • HP 82120A battery pack for the HP-41CX with damaged NiCd cells (original) HP 82120A battery pack for the HP-41CX with damaged NiCd cells (original)
  • HP 82120A battery pack for the HP-41CX (the original NiCd cells were replaced by NiMH cells) HP 82120A battery pack for the HP-41CX (the original NiCd cells were replaced by NiMH cells)

See also

References

  1. "HP-41C/CV/CX Alphanumeric Programmable Scientific Calculator, Service Manual" (PDF). Retrieved 2022-07-01.
  2. HP documentation released to the HP-41C hobbyist community in the early 1980s; available at HP-41 Internal Documentation.
  3. "Series 40 File". Professional Computing Magazine. 1 (3). John Wiley & Sons: 65. August 1984. The June–August 1982 issue of HP Key Notes had a "Name-That-Language" contest for the keystroke code used on the 41. FOCAL, for Forty-One Calculator Language, was the winning entry. Although not widely recognized due to lack of publicity, it was supposed to be, and yet may become, the common description for standard keystroke language.
  4. Extend your HP-41. 1985. p. 12. (NB. Mentions "FOCAL".)
  5. HEPAX manual. Vol. 2. 1988. p. 16 (95). Forty One CAlculator Language
  6. ^ Carbrey, Bruce D. (December 1980). "A Pocket Computer? Sizing up the HP-41C". BYTE: 244–262.
  7. Librach, Hank (February 1981). "Hunt the Wumpus with Your HP-41C". BYTE: 230, 232. Retrieved 2013-10-18.
  8. Hayes, Brian P. (January 1981). "The HP-41C: A Literate Calculator?". BYTE: 118. Retrieved 2013-10-18.
  9. Abell, Steve (April 1981). "Well-Rounded Machine". BYTE: 16–17. Retrieved 2013-10-18.
  10. "Hewlett-Packard HP-41C Calculator". Smithsonian National Air and Space Museum. 1999-08-18. Archived from the original on 2000-12-10. Retrieved 2015-11-03.
  11. Jarett, Keith (October–November 1984). "HP 41 in Orbit" (PDF). Professional Computing. 1 (4). John Wiley & Sons: 50–54. Archived (PDF) from the original on 2022-03-26. Retrieved 2024-01-08.
  12. "SwissMicros.com". Retrieved 2015-11-02.
  13. ^ "SwissMicros DM15 Scientific Calculator". JEPSPECTRO. 2017-12-22. Archived from the original on 2017-12-20. Retrieved 2018-01-04.
  14. "SwissMicros" (PDF). SwissMicros. Archived (PDF) from the original on 2017-12-20. Retrieved 2018-01-04.
  15. ^ "41CL Calculator". Systemyde International Corporation. Systemyde International Corporation. 2019-02-21. Retrieved 2020-12-17.
  16. "Hardware". Systemyde International Corporation. 2020-09-10. Retrieved 2020-12-17.
  17. "41CL User Manual" (PDF). Systemyde International Corporation. 2020-12-08. Retrieved 2020-12-17.
  18. "Manuals". Systemyde International Corporation. 2020-12-08. Retrieved 2020-12-17.
  19. "HP-41CL (replacement CPU board) Project". HP Calculator Wiki. 2017-11-28. Retrieved 2020-12-17.
  20. List of emulators for the HP-41 series , www.hp41.org

Further reading

External links

Developer view of the 14 segment LCD Code of the HP41CX Calculator emulation
Hewlett-Packard (HP) calculators
Graphing
Scientific programmable
Scientific non-programmable
Financial and business
Other
Related topics
Emulation software
Categories: