CHAPTER 3
B-ORDERS AND TEST ORDERS

3.1 General

Titan has 120 B-registers (modifier registers or index registers) which can be used for address modification, for integer arithmetic, or for logical operations. The B-arithmetic unit is independent of, and can operate at the same time as, the floating-point accumulator. In addition to the ordinary B-registers there are some special registers (see Section 3.12) which are treated as B-registers. These include the accumulator exponent and the sequence control register, so that instead of having special jump orders, jumps are achieved by setting the sequence control register using normal B-orders.

A further group of orders, the test orders, carry out operations on a specified B-register if a particular condition is satisfied (see Section 3.9). This mechanism provides conditional jumps, but is also of use in its own right. A further set of orders, the test-and-count orders, facilitate programming of loops.

Most B-orders can have a singly-modified address: most test orders cannot have a modified address since the instruction itself must refer to two B-registers (one to be tested and the other to be set). However, when the test does not involve a B-register (e.g. accumulator sign), the address can be singly modified.

3.2 General Purpose B-registers

B0 always contains zero, and writing to it has no effect. B1 to B119 are 24-bit registers which may be regarded as holding an address, an integer or a set of logical quantities. B120-127 are special purpose registers (see Section 3.12). Ordinary programs should use B-registers 1 to 80 inclusive. (B91-119 are by convention reserved for system programs. There is no check on the use of these B-registers by ordinary programs, and the system will not be harmed if they are so used. However, their contents are likely to change in an unpredictable manner during execution of a program, so that they are not of any real use to the ordinary programmer.)

3.3 B-Arithmetic

The B-arithmetic unit treats the contents of a B-register as a 24-bit positive integer: addition is carried out modulo 224, and subtraction is effected by adding the two's complement.

By convention a B-register is usually regarded, for arithmetic purposes, as holding a 21-bit integer with an octal fraction, the most significant digit being a sign digit and two's complements used for negative numbers. However, the contents can equally well be regarded as an integer of 23 bits plus sign, or even as a 24-bit positive integer (though in this use, of course, sign discriminations are meaningless). Although overflow is ignored in B-arithmetic, the carry out of the B-adder can be sensed by extracode (see Section 3.11).

3.4 Notation

B-register number q is denoted by Bq. For its contents a small b is used, thus
bqcontents of Bq
b1contents of B1.

A B-order is written in the usual way

F  Ba  Bm  S

Ba is the B-register to be operated on, Bm either specifies another operand B-register, or modifies the address. The effective address is used in different ways by different orders. It can be

  1. a store address, in which case it is denoted by s, and the order is said to be s-type

    or

  2. the actual operand, in which case it is denoted by n, and the order is said to be n-type.

Note that s-type B-orders refer to half-word addresses in store.

3.5 Arithmetic operations

  1. n-type
    120ba'=n-ba
    121ba'=n
    122ba'=ba-n
    123ba'=-n
    124ba'=ba+n
  2. s-type
    100ba'=s-ba
    101ba'=s
    102ba'=ba-s
    103ba'=-s
    104ba'=ba+s
  3. s-type, result to store
    110s'=s-ba
    111s'=-ba
    112s'=ba-s
    113s'=ba
    114s'=ba+s

3.6 Logical operations

  1. and
    107ba'=ba∧s
    117s'=ba∧s
    127ba'=ba∧n
    165ba'=bm∧n)address cannot be modified
    164ba'=ba+bm∧n)

    N.B. If Bm = 0, the 165 order behaves as a 121 order, and the 164 order behaves as a 124 order. However, 164 and 165 work as expected if bm = 0.

  2. or
    147ba'=ba∨s
    167ba'=ba∨n
  3. not equivalent
    106ba'=ba ≢ s
    116s'=ba ≢ s
    126ba'=ba ≢ n

3.7 Shifts

The following circular shifts are provided:

  1. six places left
    105ba'=26ba + s
    125ba'=26ba + n
  2. one place right
    143ba'=2-1ba - s
    163ba'=2-1ba - n

Note that an arithmetic shift one place left can be obtained by doubling, thus:

124  6  6  0

3.8 Jump orders

B127 is the control counter, therefore jumps are achieved by setting B127, e.g.
1211270xjump to x
10112744yjump to position specified in dictionary, indexed by B44

3.9 Test Instructions (see also Section 3.10)

  1. B-register tests
    214ba' = nifbm = 0
    215ba' = nifbm ≠ 0
    216ba' = nifbm ≥ 0
    217ba' = nifbm < 0
    210ba' = nifleast significant digit of bm = 1
    211ba' = nifleast significant digit of bm = 0
  2. Accumulator tests
    234ba' = nifxa = 0
    235ba' = nifxa ≠ 0
    236ba' = nifxa ≥ 0
    237ba' = nifxa < 0
  3. Test-and-count instructions
    200ba' = n,bm' = bm + 0.4ifbm ≠ 0
    201ba' = n,bm' = bm + 1ifbm ≠ 0
    202ba' = n,bm' = bm - 0.4ifbm ≠ 0
    203ba' = n,bm' = bm - 1ifbm ≠ 0

Note that the test on bm is made before the count, and that if bm = 0 nothing is done, i.e. once a count reaches zero, it stays there. If Bm = 127, counting does not take place.

3.10 The B-test register

The B-test register, called Bt, enables tests to be made on a B-register and the result stored for a later discrimination: it also enables a B-register to be tested without destroying its contents. The orders which set Bt carry out a B-register subtraction and record the result (positive, negative or zero) in Bt: a complete range of test codes is provided to discriminate on the content of Bt.

  1. orders setting Bt
    150bt'=s-ba
    152bt'=ba-s
    170bt'=n-ba
    172bt'=ba-n
  2. orders testing Bt
    220ba' = n,bm' = bm+0.4)if bt ≠ 0
    221ba' = n,bm' = bm+1)
    222ba' = n,bm' = bm-0.4)
    223ba' = n,bm' = bm-1)

    (If Bm = 127, counting does not take place)
    224ba' = nifbt = 0
    225ba' = nifbt ≠ 0
    226ba' = nifbt ≥ 0
    227ba' = nifbt < 0

Note the correspondence with the orders 200-203 and 214-217. Note also that 224-227 can have a singly-modified address.

3.11 B-Carry

The B-carry digit, Bc, records the carry out of the B-adder on an arithmetic operation. It is set by those B-codes whose last digit is 0, 2 or 4, and can be sensed by extracode 1223 (see Chapter 5).

3.12 Special Purpose B-registers

With the exception of B90, B121, B124 and B127, programs will not normally use B-registers above B80. However, a list is given here for completeness.
B0Always zero
B1-B80Object programs
B81-B89Library routines
B90Subroutine link
B91-B99Extracodes
B100-B112Supervisor
B113-B118Interrupt routines
B119Extracode operand address
B120Always zero
B121)Substitution register (see below)
B122)
B123Interrupt priority decoder
B124Accumulator exponent (see Chapter 4)
B125Interrupt control counter
B126Extracode and Supervisor control counter
B127Main control counter

B121 and B122 allow indirect addressing of B-registers. If Ba=122 in an instruction, the B-register whose number is held in B121 is used as Ba. Note however that B121 consists of digits 8-2, thus
121121032.4
...
3561220(3)

causes the address of the 356 order to be modified by the contents of B65. Note also that B121 is changed whenever an extracode is obeyed, and that Bm = 122 does not cause modification of the address.

B124 consists of digits 23 - 15 only. It contains the 8-bit accumulator exponent in digits 22 - 15; negative exponents are stored as 2-s complements, so that d22 acts as a sign bit. Digit 23 is a guard digit; when setting B124, digit 23 should be the same as digit 22.


Copyright © 1965-1966 University of Cambridge Computer Laboratory. Distributed by permission. Thanks to Barry Landy, Roger Needham and David Hartley for giving permission to distribute these documents. Thanks to Barry Landy for lending me the paper document from which this was scanned. Any typographical errors probably arose in the course of OCR.


Previous chapter: Chapter 2: The Titan Computer
Next chapter: Chapter 4: The Accumulator Orders
Return to TITAN Machine-Code Programming Manual
Return to CUCPS TITAN page
Return to CUCPS home page
Return to University of Cambridge home page


Contact: CUCPS Committee (soc-cucps-committee@lists.cam.ac.uk)
This HTML version last updated: $Date: 2001/07/02 21:08:56 $