- 40 -

       5.2.2 P16 (OUT 1)

             After various checks, the value 2 (A-program) or 3 is set in V29P104M5,
             and D46 of V25P104M5 made non-zero. The main subprogram is suspended
             if the store area of the program is locked out, if the second (OUT 8)
             subprogram is not closed down, or if V0P120 (A program)/V0P52 (B
             program) is positive, and will not be resumed until all these
             conditions are absent On resumption, the priority number will be
             stored in V0P120 or V0P52, to indicate that A- or B-program input is
             going on.

             Before this suspension a message "OUT 1" is typed: the operator will
             be aware that the suspension has not been lifted if the new program
             identifier is not typed subsequently.

             Finally P16 obeys J22P120 to transfer control to the program input
             routines. Parameters for P120 will have been left in V1P104M5 (the
             amount of store used by the previous section, not to be exceeded
             by the new one) and in V45P104M5 (the identifier of the required
             new program section).

             Any failures after entry to P120 will of course be dealt with by
             P121 (CRNP failure), which recognises that the program input was
             initiated by OUT 1 (since D46 of V29P104M5 is non-zero) and
             accordingly transfers control to P2 - having first set the ending
             number 5 in V0P2 to guarantee termination.

       5.2.3 P18 (OUT 3) and P24 (OUT9)

             These two very simple routines are examples of the way in which
             OUT routines may, until their first suspension, rely on the
             program's Nest staying in the V-stores of Pl. The appropriate
             times (Run or Real) are transferred to V0P1 (N1 of the program's
             Nest). Thus the OUT number is erased and the result inserted
             with just one instruction.

       5.2.4 P19 (OUT 4) and P61 (OUT 10)

             These routines both, after performing all the necessary checks,
             use P58, whose action has been described in 4.1.6. If the
             required identifier is one-word, an artificial second word is
             introduced which has D0-2 0, D2-47 = all l's.

             A marker is set in V45P104M5 to distinguish OUT 4 (marker non­
             zero) from OUT 10 (marker zero).

       5.2.5 P20 (OUT 5) and P21 (OUT 6). P26

             The behaviour of the OUT 5 routine depends largely on whether the
             program obeying OUT 5 is A or B. An A program can only be
             allocated units of status P, and program failure results if there
             are none available. A B program will be allocated a P unit if
             there is one (a unit may be pre-allocated to a B program either
             as the result of TINT T, which can pre-allocate the input paper

- 41 - tape reader, or following the de-allocation of a unit previously allocated by OUT 5*); if there is no P unit of the required type, a U unit must be allocated and if there is not one of these the "AWAITS TYPE tt" message is typed and the subprogram suspended (with SHUL negative, and SHUP = type number + D0). This suspension is cleared either by a unit of the right type becoming available, or by TINT A or I0. OUT 5* (when the type number supplied by the program in N2 has D44 added) is dealt with as follows:- When a B-program asks for a unit of a certain type in this way, P20 inserts a marker bit in V21P104M5. The bits of this word are assigned to type numbers in such a way that type (16a + b) is represented by D(48 - 8a - b). When a B-program uses OUT 6 to de-allocate a unit whose type bit in V21P104M5 is non-zero, P21 clears that bit and the unit is given status P, rather than U as would normally happen. If a B-program tries to use OUT 5 or 5* to allocate a unit, specifying a type whose bit is non-zero, Program Failure 2 occurs even if a unit of the required type is available. The system. thus has exactly the same effect as in the non-Time-Sharing Director. This only applies to B-programs. Because any unit (not magnetic tape) which is de-allocated by an A-program is given status P, and only one unit of each type is pre-allocated, OUT 5 and OUT 5* are identical for A-programs. For an A-program V21P104M5 instead contains a record of all the units pre-allocated to the program: D47 = unit 0, D46 = unit 1, D37 = unit (octal) 12, etc. This correspondence of bits with unit numbers, which is the same as that used in CPDAR (N2.1.4), also applies to the copy of the programs CPDAR kept in V17P104M5, which is updated by P20 and P21 as units are allocated and de-allocated. When de-allocating a magnetic tape unit, P21 sets a brick indicator and uses JS10P100 (see 4.1.1) to alter the unit's status to W. For any other type of unit, P21 has to wait until the unit is not busy before changing its status to P or U. Therefore if the unit is busy the subprogram is suspended, with SHUL positive and the unit number in D0-15 of SHUP, The end of such a suspension will not usually be signalled by an EDT and so may have to wait for an EDT from some other source. As has already been pointed out (5.2.1) if TINT A is used to terminate the program while this suspension is still present, the unit, if still busy, may have its transfer forcibly terminated. The "descriptor" of unit n is stored in Vn of P26. Each descriptor is laid out as follows: D0 - 11 = (octal) 0207 D12 - 23 = Type number (octal) in character form D24 - 29 = Status character D30 - 41 = Unit number (octal) in character form D42 - 47 = program letter if any
- 42 - P26 is used for finding a unit or units having a particular type, status and program letter. It has 3 entries and 2 exits. The first 2 entries (JS1P26, JS2P26) require in N1 a parameter comprising:- D33 - 38 - required type number D39 - 44 - required status character D45 - 47 = 4 if program letter is to be blank = 0, 1, 2, 3 if P, Q, R, S. The list is searched backwards, i.e. through decreasing unit numbers. The first entry (JS1P26) is used if the search is to start at the highest unit number, the second entry (JS2P26) if the search is to resume after the last unit found (i.e. with Q6 unaltered since the last EXIT 2). EXIT 1 is obeyed if no unit was found: the parameter in N1 will have been erased. EXIT 2 is obeyed after a successful search, when C6 and M6 will both contain the number of the required unit, with I6 = -1. After EXIT 2, N1 will contain a modified version of the original parameter, and if desired the search may immediately be resumed, without re-specifying the original parameter, by obeying JS4P26. (Compare P26 with /RPS1/ and /RPS2/ of the non-Time-Sharing Director - N5.3). 5.3 P23 and OUT 8 All transfers executed by the Director on behalf of a program (OUT 8 is the obvious example) have certain features in common. A system has therefore been evolved into which additional facilities of this type can be fitted without too much difficulty, and the framework of this system forms part of P23, the OUT 8 routine. Besides using the main (even) subprogram, the system makes use of the second (odd) subprogram of the priority instigating the transfer - i.e. for priority p, subprograms 2p + 2 and 2p + 3. The second subprogram is used because these transfers, once started, do not require the program to be held up - the transfer area being protected by ordinary lock-outs - but do require that when they end, a procedure be used which not only checks the transfer but also signals that a further transfer may now take place, For this procedure the main subprogram is not suitable, since it would hold up the program unnecessarily, but the second subprogram is ideal. All Director transfers of the OUT 8 type pass through 4 stages The first stage involves erasing the OUT number from the program's Nest and checking that the parameters provided by the program in its Nest are valid - e.g. that the addresses are reasonable. It is assumed that OUTS which perform this sort of transfer will supply all parameters in N2, and that these will implicitly or explicitly specify the relative addresses of the transfer area. This stage will end after these parameters have been copied into V45P104M5 (and possibly V49P104M5) without erasing them from the programs Nest, and the initial and final absolute addresses of the transfer area into I7 and M7. P133 (q.v.) is a useful subroutine for this purpose - it also checks that these addresses are valid. The first stage ends by obeying JSP139.
- 43 - The subroutine P139 causes the main subprogram to be suspended until the area involved in the transfer is not locked out, and the second subprogram is closed down (E1M4 = 0). When both these conditions are satisfied, the second stage can begin. In this stage the Director, still acting through the main subprogram, is able to check, and if necessary alter, the transfer area itself: and, because the second subprogram has been closed down, it may check any failure indicators (e.g. parity) left by the previous transfer of this type, which must now be over. It is a feature of the Time-Sharing Director that each priority may only carry out one transfer of this type at a time, because each transfer requires the use of the second subprogram. Causes of program failure (JP2) may be found in the second as well as in the first stage. At the end of the second stage the main subprogram is ready to initiate the second subprogram, which is going to actually perform the transfer. To do this the main subprogram must obey J97P23 with certain parameters in the nesting store. They are:- N1 - SHUP* of second subprogram. This is to contain, in D16-31 and D32-47, the initial and final relative addresses of the transfer. D0-15 may contain any other parameter. N2 - SHUL of second subprogram, defining its point of entry. N3 - a marker which is zero if the transfer is going to be queued, nonzero otherwise. On entry at reference 97, P23 transfers N1 and N2 to SHUP* and SHUL of the second subprogram (E21M4 and. E1M4), and clears SHUL* (E31M4) and SHUP (E11M4) - the latter guarantees that at the very next opportunity, i.e. as soon as the main subprogram returns control to P11, the second subprogram will be entered. The main subprogram now obeys JS3P29 to erase the parameter word (originally in N2) from the programs Nest, and returns control to P11 - it does this by obeying either EXIT 1 (thus closing down the main subprogram altogether) if the transfer is not to be queued, in which case D44 of V25P104M5 is first made non-zero, or by obeying JS4P10, if it is queued. Stage three of the process takes place in the second subprogram. This will extract the parameters from SHUP*, make the addresses absolute, and initiate the transfer, either by entering it in a queue or by using an ordinary transfer instruction. If the latter, D44 of V25P104M5 is cleared as soon as the transfer is started, since this will cause lock-outs to be set up on the transfer area, making it safe to allow the program to resume; the second subprogram is suspended until the end of the transfer, and the first subprogram is already closed down. However, if the transfer is queued there is no guarantee that it will start immediately, so it is not yet safe to return control to the program. It will not in general be possible for the second subprogram to hold up the program only until the lock-out is set up, because it will itself probably be suspended until the very end of the transfer. This is why, in this case, the main subprogram is not closed down; it remains active (thereby holding up the program) and
- 44 - only closes itself down when either the area becomes locked out, or the transfer parameters (taken from E21M4, which must not be altered by the second subprogram) are found to be absent from all the peripheral queues. The main subprogram repeatedly tests these conditions, suspending itself with JS4P10 after each test cycle, until at last it obeys EXIT 1 when it is safe to return to the program. It is possible that a TINT A or TINT I0 may close down the main subprogram before this time: in these special circumstances this does not matter, and the second subprogram is not affected. The second subprogram, continuing the third stage of the process, must remain active until the transfer is complete and checked (after repetition if need be). If it is necessary for this subprogram to hold up the program it can reset D44 of V25P104M5. The parameters in its SHUP* must not be disturbed if the transfer is queued. Even if no check on the working of the transfer is needed at its end, the ending of the third stage must be delayed until the transfer is complete; so that, if the program is terminated before the transfer ended, it will still be possible to indicate definitely when all lock-outs on the program's store area should have been removed. The fourth and final stage of the process is entered by obeying J99P23. At this point (at which P15 will restart the second subprogram if it finds the latter already closed down see 5.2.1) V29P104M5 will be examined: if it is positive, the second subprogram can be closed down, but if it is negative, indicating that the program is being terminated, a winding-up procedure for all OUT 8 type activities must first be performed, culminating in D0 of V29P104M5 being made zero again. Before the second subprogram is closed down, D44 of V25P104M5 is cleared. Also, since the main subprogram may be suspended in P139 waiting for the closing-down of the second subprogram, the subprogram parameters in Q4 are adjusted as if they referred to the last subprogram but one; in this way, when EXIT 1 is obeyed to close down the subprogram and return to P11, the latter will now try to re-enter the main subprogram. In other words the subprogram counter is effectively stepped back one place instead of forward when the second subprogram is closed down. The common features of all these OUT - instigated peripheral transfers are thus: - a first stage, leading to P139 - a second stage leading to 97P23 (these two stages carried out by the main subprogram) - a third stage, carried out by the second subprogram, which performs the transfer, and leads to - the final stage, entered at 99P23, leading to the closing down of the second subprogram (and reverting to the main subprogram) To fully appreciate the way these common features are exploited, it is worth examining and comparing the coding for the different types of OUT 8 process in P23, and for the OUT 11 - OUT 12 (drum transfer) routines P151 and P152.
- 45 - 6. Subroutine Index The table below gives against each subroutine a brief title, the number of the section (if any) of the preceding text in which the subroutine is described most fully, and, where applicable, an indication of which Q-stores it alters. A single asterisk against a subroutine indicates that it requires M5 preset with a priority number; a double asterisk, that Q4 is to be preset with subprogram parameters. P0 Long and Short. Paths (3.1) P1 Dump programs Nest, etc. (3.3) **P2 Program Failure (5.1) **P3 OUT (5) P4 FLEX (4.2) P5 EDT (4.1) P6 Enter Message words in Flexowriter queue (4.1.3) Alters Q7, C5 P7 Enter Parameters in Flexowriter queue (4.1.3) Alters Q7, C5 **P8 Flexowriter query (4.1.3) *P9 Convert cell count, used by P12 **P10 Suspend subprogram (4.1.6) P11 Re-enter subprograms in order (4.1.5) *P12 Type program's Nest, etc. (5.1) Alters Q6, Q7 *P13,P14 Set and clear "software HU" bit in V0P104 Alters C5 **P15 OUT 0 (5.2.1) **P16 OUT 1 (5.2,2) **P17 OUT 2 (5.2.1) **P18 OUT 3 (5.2.3) **P19 OUT 4 (5.2.4) **P20 OUT 5 (5.2.5) **P21 OUT 6,7(5.2.5) **P23 OUT 8 (5.3) **P24 OUT 9 (5.2.3) *P25 Check program A or B. Alters C6 P26 Find unit with given type, status and program letter (5.2.5) Alters Q6 *P27 Alter unit status on de-allocation Alters Q7 *P28 Look for P unit Alters Q6 *P29 Manipulate program's Nest, etc. (3.3) Alters Q6 *P30 Set up main subprogram parameters in Q4 (4.2.1) P31 Fetch character to 07 (4.2) Alters Q6 Q7 P32 Fetch number (4.2) Alters Q6, Q7 **P33 TINT A (4.2.1) **P34 TINT B (4.2)
- 46 - **P37 TINT E (2.5) **p39 TINT G (4.2) **P40 TINT H (4.2) **P41 TINT I (4.2.2) **P42 TINT J (4.2) **P44 TINT L (4.2) **P45 TINT M (4,2,3) **P48 TINT P (4.2) (also used in Phase 0) **P50 TINT R (4.2) **P51 TINT S (4.2) **P52 TINT T (4.2.4) **P53 TINT U (4.2) **P54 TINT V (4.2) *P55 Obtain program letter, given priority number P56 Obtain priority number given program letter in C7 (402) Alters Q5 P57 Convert time for typing **P58 Find tape with given identifier (4.1.6) P59 Update Flexowriter queue (4.1.3) Alters Q7, C5 P60 Deal with RPM (303) Alters no Q stores **P61 OUT 10 (5.2.4) *P62 Initial housekeeping for OUTS (5.2) Alters Q6 P100 Controller of W mag tape bricks (4.1.1) P101 W mag tape bricks (4.1.1) **P102 Hold up subprogram before transfer P103 Check before transfer (2.4) Alters Q6, Q7 P104 Priority parameters (204) P105 Consolidate store and swop priorities (4.1.2) P106 Set up Q7 with program parameters Alters Q7 P107 Test lock-out on programs area Alters Q7 P108 Test whether given transfer area lies within area specified in Q7 P109 Modify transfer parameters after store move P110 Alter priority number if necessary after swop P111 Set up priority swop P112 Store new BA/NOL (P106 - 112 are primarily used in P105) *P113,P114 Set or clear given bit in V25P104M5 (2.4) P115 Set priority related parameters in C6 and M6 Alters C6, M6 P116 Form table of BA/NOL words in order of decreasing BA Alters Q6, Q7 P117 Form parameters of the "Hole in the Middle" Alters Q6, Q7 *P118 Set up parameters before program input (4.2.4) Alters C5,M6
- 47 - P119 Check program name P120 Look for A input priority (4.1.4) (later entries: ** general program input) **P121 CRNP failures (2.5) P122 Check tape identifier Alters C7 *P123 Dispose of program input PTR Alters C7 *P124 Set AV0P52 or AV0P120 in M6 (2.5) Alters M6 *P125 Check validity and ownership of peripheral unit *P126 Set addresses of E0 and E7 in 17, M7 Alters 17, M7 P127 Check for parameter word in Flexowriter queue *P128 Makes absolute addresses in Q7 Alters I7, M7 P129 Checks given parameters to see if still in Flexowriter queue Alters Q6 P137 Leaves 3 times M6 in N1 P132 Check length of identifier given first word *P133 Checks transfer parameters in first stage of OUT 8 process (5.3) Alters Q7 **P134 Hold-up program input so it can be terminated by TINT A (4.2.4) P135 Dispose of program tape *P136 Store new BA/NOL, check lock-outs, clear PHU Alters Q7 P137 Compare N1 and N2, ignoring octal 36 in N1 Alters C6 *P138 Alter bit in V17P104M5 (copy of CPDAR) **P139 End of stage 1 of OUT 8 process (503) P200 "Phase 0" (N 3.1) P201 Type message in Phase 0 P202 Type query in Phase 0 Alters Q5, C6 P204 Read decimal number in Phase 0 P206 Type unit list in Phase 0 Alters Q5, Q6 P208 Read OUT 8 reel number in Phase 0 Alters Q5, Q6 (Subroutines P200 onwards are overwritten as soon as Phase 0 ends)