Focal (HP-41)
Overview
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...
the HP-41
HP-41
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...
range of expandable science/engineering calculators from Hewlett-Packard
Hewlett-Packard
Hewlett-Packard Company or HP is an American multinational information technology corporation headquartered in Palo Alto, California, USA that provides products, technologies, softwares, solutions and services to consumers, small- and medium-sized businesses and large enterprises, including...
.
As with most other calculator programming languages of the 1980s, a Focal program is a linear list of instructions. Each instruction (or step) roughly correspond to a key (or key combination)
press, and thus correspond to what the user would do if he was to perform the computation himself on the calculator.
This paradigm made Focal programming relatively easy for the newcomer, but program maintenance could be a nightmare.
Add to that the use of GOTO
Goto
goto is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control...
instructions—including going to a program step based on a value in a data register ("GTO IND"), a technique known as computed goto—and you had all the ingredients for the dreaded spaghetti code
Spaghetti code
Spaghetti code is a pejorative term for source code that has a complex and tangled control structure, especially one using many GOTOs, exceptions, threads, or other "unstructured" branching constructs. It is named such because program flow tends to look like a bowl of spaghetti, i.e. twisted and...
syndrome.
Program steps are numbered starting from 1, but this numbering has no intrinsic meaning, and can change as new instructions are
added or removed in the middle of a program.