previous | contents | next

Chapter 19 The OLIVETTI Programma 101 desk calculator 241

Subtraction - . An instruction containing the operation - directs the computer to subtract the contents of the selected register (subtrahend) from the contents of the A register (minuend).

1 Transfer the contents of the selected register (subtrahend) to M.

2 Subtract the contents of M from the contents of A (minuend), obtaining in A the difference truncated according to the setting of the decimal wheel. The complete difference is in R. M contains the subtrahend. (M ¬ r; next R ¬ A - next A ¬ f(R,decimal_ wheel))

Division ¸ . An instruction containing the operation ¸ directs the computer to divide the contents of the selected register (divisor) into the contents of the A register (dividend).

1 Transfer the contents of the addressed register to M.

2 Divide the contents of M into the contents of A, obtaining in A the quotient truncated according to the setting of the decimal wheel. The decimally correct fractional remainder is in R. M contains the divisor. (M ¬ r; next A ¬ A ¸ M; R¬ A mod M)

Square Root Ö . An instruction containing the operation Ö directs the computer to:

1 Transfer the contents of the selected register to M.

2 Extract the square root of the contents of M, as an absolute value, obtaining in A the result truncated according to the setting of the decimal wheel. The R register contains a nonfunctional remainder. At the end of the operation, M contains double the square root. (M ¬ r; next M,R ¬ sqrt(abs(M)) X 2; next A ¬ f(M/2, decimal_ wheel))

Absolute Value A½ . The absolute-value instruction A½ changes the contents of the A register, if negative, to positive. (A ¬ abs(A)

Jump operations

The jump operation directs the computer to depart from the normal sequence of step-by-step instructions and jump to a preselected point in the program.

These instructions provide both internal and external (manual) decision capability and are useful to create "loops" that allow repetitive sequences in a program to be executed; routines or subroutines to be performed at the discretion of the operator; and automatically to "branch" to alternate routines or subroutines according to the value in the A register.

The jump process consists of two related instructions or characters:

1 The reference point or label, 1, is where the program begins or where the jump is to start. The sequence is restarted at this point. This label has no effect when interpreted.

2 The jump instruction specifies the label for the instruction sequence.

There are two types of jump instructions: unconditional jumps and conditional jumps.

Unconditional jumps. These jumps are executed whenever the instruction is read. The labels or reference points for unconditional jumps, L, and the corresponding jump instructions, j, are given as (L,j). The permissible jump labels and jump constructions are:

(AV,V), (AW,W), (AY,Y), (AZ,Z), (BV,CV) , . . . ,
(BZ,CZ), (EV,DV), . . . , (EZ,DZ), (FV,RV), . . . , (FZ,RZ)

All programs must begin with reference parts of an unconditional jump instruction. Reference points AV, AW, AY, AZ are used so that these program sequences can be started by touching the routine selection keys V, W, Y, or Z.

Conditional Jumps. If the contents of the A register are:

Greater than zero: the program jumps to the corresponding reference point (label).

Zero or less: the program continues with the next instruction in sequence.

The labels or reference points for conditional jumps, L, and the corresponding conditional jump instruction, cj, are given as (L,cj). The permissible jump labels and jump instructions are

(aV,/V), . . . , (aZ,/Z), (bV,cV), . . . ,

(bZ,cZ), (eV,dV), . . . , (eZ,dZ), (fV,rV),

. . . ,(fZ,rZ)

Constants as instructions A/½ . A one-digit constant can be generated by a special instruction. The results of the instruction place the digit in M. The digit value of the constant must follow A/½ .

Instructions and data in the same register. An instruction can be considered to be data and, therefore, used as both a constant and an instruction. Another technique allows the computer to interpret

previous | contents | next