This section of the Ferranti Orion site is concerned with the Orion 2 Extracode system. The following is a slightly edited excerpt taken from Section 4.1 of the Programmers' Reference Manual and summarises how the Extracode programs were used on Orion 2.
The version that is documented here does not include support for the Orion 2/1900 Direct Data Link.
On Orion 1, the data are transferred directly between the core-store area and the peripheral device. Once a 140/142 pair has initiated a transfer, subsequent instructions can be obeyed while the data are passing between the store and the peripheral. The peripheral lockouts and core-store lockouts are effected by hardware. The lockouts except for magnetic tape are advancing.
On Orion 2, the peripheral transfer instruction (140/142, 141/142, 140/154, 140/155) are performed by extracode. It also performs some processes which on Orion 1 are done in the peripheral control unit (e.g. conversion of a card-column to u and v characters) and also provides, for some peripherals the equivalent of lockouts.
Magnetic Tape and Drum Store (Fast devices). The data are transferred directly between the core-store and the peripherals as in Orion 1. The Core-Store area is lockout by means of a lockout tester in the hardware of the associated peripheral control unit.
Slow Input Peripherals
The extracode reads data into its own buffer areas (it double buffers for paper-tape readers; these are two 8-word buffers for each paper tape reader, and for cards two 20-word buffers for each card reader) and when the object-program obeys a 140/142 pair, the extracode then copies (142/142 pair) the required data from its buffers to the object program's input core-store area.
Note that the object-program cannot progress beyond a 140/142 pair until the transfer has been completed and the data are in object program's input region. Thus it is impossible for the program to attempt to use the data before they are all in the input region and therefore there is no need for lockouts on the input region.
For slow input devices, some or all of the data are already in the extracode buffers, having been read autonomously while instructions preceding the 140/142 pair were being obeyed.
Pressing of the select button on a reader causes the extracode to clear (or ignore) the data in its buffers.
Peripheral incidents (see 5.5) which are not signalled at the time they actually happen but at the time the data involved are handed over to the object program, are paper tape parity failures and card read check failures and illegal punching. Other incidents, operator attention or disabled, are signalled when they happen.
Reading punched paper-tape is now described to typify the handling of transfers used by slow devices. The isolated region of the working-store occupied and used by the extracodes includes two 8-word buffers for each paper-tape reader attached to the computer.
When a 140-instruction is encountered in the object-program, entry to the "140" extracode routines takes place.
From the device's name (e.g. *SR2) the routine determines which section of itself is appropriate for that type of device. Then a 146-instruction is obeyed, searching a table to find which physical device has the given programmers' name: this table is in fact part of the job's directory-entry. (If the search stops because a zero modifier has been encountered, then a peripheral violation is implied.) The extracode routine then causes another table to be searched to check that the mode and device-name are consistent and to select a section of the routine to carry out any special action required by the mode. The peripheral control unit involved is made ready for a transfer.
A return to the main program occurs next to obey any instructions pre-modifying the 142-instruction and then the 142-instruction itself causes re-entry to the extracodes. Upon this re-entry, lockouts and reservations are checked.
Suppose that this transfer is the first initiated on that reader by the object-program. Then, when the 140/142 instruction-pair is encountered in the object-program, the program is interrupted and recorded as waiting for the reader. The extracode routine then reads 8 words (64 characters) into the first of the extracode buffers. Note that 64 characters are read, regardless of the number actually called for by the object-program.
When the object-program is re-entered from the Time-sharer, the required number of characters (Y in the 142-instruction) is copied from the buffer into the object-program's input area.
If the object-program required up to 64 characters, its demands are satisfied and it can continue. If, on the other hand, it required more than 64 characters, it is interrupted again. In either case, 64 more characters are read into the second extracode buffer. If the program required more than 64 characters then, when it is re-entered from the Time-sharer the remaining characters (up to the maximum of 64) are copied from the second buffer into the object-program's input region, and another 64 characters read into the first buffer.
Thereafter, whenever a 140/142 instruction-pair to read from that reader is encountered in the object-program, the characters called for are copied from one of the extracode buffers and, if the buffer is thereby "emptied", it is refilled with 64 more characters from the tape. If a transfer calls for more characters than are in the extracode buffer, those which are available are copied across, a read transfer to refill the emptied buffer is initiated and the Time-sharer is entered. When the buffer has been refilled, a return to be object-program occurs for the next part of the transfer, which may or may not complete the transfer. Thus during "long" transfers, the object-program may be interrupted several times for one transfer.
From the above it follows that the tape is always read 64 characters at a time and tape-reading is never terminated because a "newline" character has been read, even when the object-program calls for transfers in mode 1; the effect of reading up to NL is achieved during the copying from the extracode buffers into the object-program's input region. Also it is necessary to have at least 127 characters (about 13 inches) of run-out (repeated upper-case) after the data on the tape in addition to any which would be called for by the program.
There is a slight increase in program efficiency if the object-program always calls for 64 characters.
Slow Output Peripheral Devices
The extracode buffer for a paper tape punch holds 128 characters, for a card punch it holds one card, and for a line printer it holds one line. The data from the object-program's core region is copied (142/142) into the extracode buffer and after any conversion, the device is started and the program returned to (if more than 128 characters on the paper tape punch were called for then return is to deal with the rest or the next 128 and so on). Peripheral incidents are signalled at the time they occur. For restart procedures note that the object-program core region is not locked out and the original data can be overwritten before the transfer has been completed; double buffering can be used to preserve the data in case of a failure occurring.
Entry to the Extracodes
The instructions which are extracoded are 102, 103, 125, 126, 140/142, 141/142, 140/154, 140/155 (156 when in monitoring or engineers mode). It is also entered for division orders 40-45 when the quotient appears out of range when in fact it is not. Certain operand combinations of the 101 and 95 orders also require help from Extracode.
The function-number in an Orion instruction is a 7-bit quantity. However, it so happens that, for all the function-numbers which are extracoded, except for 40-45, have their most significant function bit 1; the extracoded function-numbers can therefore be distinguished from each other by considering the l.s. 6 bits only; the 45/125 case is looked for specially.
When an instruction with one of these particular function-numbers comes to be obeyed, the X- and Y-addresses are replaced and modified as necessary by the microprogram, after which:-
(a) the function-number is stored at absolute address 513, with the l.s. 2 bits of the function-number at the m.s. end of the word and the remaining 4 bits of the (effectively) 6-bit function-number at the l.s. end, i.e.
l.s. 2 bits of
4 bits of
the function number the function number
(b) the effective X-, Y- and Z-addresses are stored at absolute addresses 512, 514 and 515 respectively, in each case including the datum-point of the object-program.
(c) the control-number (address of the instruction) is set in the modifier half of register 516, OVR is represented by m.s. bit in that register (0 if OVR clear, 1 if set) and OVR is left clear; thus  is a link for return to the object-program.
(d) the control-number is reset to 517,
(e) the datum-point is set equal to 512,
the "extracode flip-flop" is set. This
is a 1-bit indicator which shows whether or not the extracode program is being
When it is set:-
(a) testing for lockouts and reservations is inhibited,
(b) certain function-numbers when in extracode mode (the letter E is conventionally written after the number in this case) carry out quite different operations (e.g. 125E instruction has the effect, Test Lockout and Reservation Region for Input Transfer and does not standardise a floating-point number - its effect in non-extracode mode). These function-numbers are 20 to 27, 87, 102, 103, 105, 106, 107, 125 and 127 and 140.
Then the instruction in register 517 is obeyed. It is a 2-address 122-instruction which, using some Symbolic Addresses in lieu of the actual addresses, can be written as
122Y WS TABLE A1
The rearranged function number as explained above is used as a character-modifier in the 122 instruction: using the notation*
f1 = value of the l.s. 2 bits of the function number (0 ≤ f1≤ 3)
f2 = value of the m.s. 4 bits of the (effectively 6 bit) function number (0 ≤ f1 ≤ 15)
then m = f2 and c = 2f1 and so word [TABLE + f2] is shifted cyclically left 2f1 characters, i.e. f1 quarter-words.
Now starting at address TABLE is a table in which each significant entry (12 bits) is the address at which the corresponding extracode routine starts.
Therefore, given a function, the 122-instruction selects the entry-point address of the corresponding routine, putting it at the l.s. end of register WS. The instruction in register 5l8 isolates those 12 bits which are then used to modify the destination address of an unconditional jump-instruction in register 519; this jump, of course, causes the appropriate extracode routine to be entered and obeyed. When entered, the extracode routine performs the following processes:-
(a) using the special "extracode" functions 125 and 127, lockouts and reservations are checked,
(b) the instruction is simulated,
(c) the word in register 516 is used as a link for return to the main program, by means of the instruction.
87 1 516
This is essentially similar to a normal 87-instruction but with the addition effect of clearing the extracode flip-flop. Note that, since [5l6]m is the address of the instruction being simulated, the X-address in the 87 instruction must be 1.
*Denoting the group and position of the function-number by G and P respectively then 8G + P = 64 + 4f1 + f2