original
10−1−0 SECTION 10.1 PAPER TAPE GENERATOR 10.1 A. IDENTIFICATION Computer: KDF9 Program No: KKAO1 Title: PAPER TAPE GENERATOR B. GENERAL DESCRIPTION Purpose: Although designed to have additional uses, the Paper Tape Generator is published in this Manual only as a means of compiling Directors, (and Call Programs) written in the Tape Generator Code, into machine code. It will not be maintained for any other purpose. Input: An 8−hole PAPER TAPE containing a Director written in the Tape Generator Code. This tape is referred to below, as the 'input tape' and its contents as 'items'. Full details of the Tape Generator Code are contained in Appendix 1. It will be seen that it corresponds closely to Usercode. Output: An 8−hole PAPER TAPE containing a selection of the following:- (1) The title of the generated program. This is merely a copy of the heading block of the input tape (see Appendix 1). (2) On a successful run, the 'label list' (corresponding to the reference tables of Usercode). This is followed by a 3−foot run out. (3) On a successful run, the binary version of the Director. This is referred to below as the 'Generated tape'. (4) On an unsuccessful run the failure report. This comprises a list of the errors in the input tape which led to the failure of the run. Accuracy The program makes many checks on the contents of the input Checks: tape and these are notified in the failure report described above. However, certain errors may not be detected until punching of the generated tape has actually started. Errors of this type are noted on the monitor typewriter (using OUT 8, stream 0) and punching of the generated tape: is continued. C. METHOD OF USE layout of The items on the input paper tape are preceded by a 'heading! Input Tape: block consisting of up to 64 characters terminated by → (EM). The contents of the heading block are immaterial to. the Tape Generator, unless they comprise the single character → (EM). KDF9 (Revised 12.12.65).
original
10−2−0 Section 10.10 (cont.) 10 1 The latter interpreted as a signal to terminate (OUT 0); otherwise the heading block is copied exactly as it stands to the output tape. After the heading block are the items constituting the Director instructions and directives, in the Tape Generator Code, as described in Appendix 1. The input tape is terminated by the item 'FINISH:’ followed by → layout of This is as follows:- Output Tape: 12" gap Heading block (as on input tape) Label list 36" gap Director in machine code 12" gap If a failure report results from the run, then this replaces all items in the above list from the label list onwards. D. Not relevant. E. PROGRAM CHARACTERISTICS General: Paper Tape Generator is an autonomous, non−segmented program written in Usercode. Method: The program converts items from the input tape to an intermediate form which it writes onto a work (magnetic ) tape. The label list is assembled in the core store. The input tape is read in blocks of 32 words, double−buffered. Output to, and the subsequent input from the work tape, is also in blocks of 32 words, double buffered. If no failures have been detected, the work tape. is rewound while the label list is punched out. Finally the work tape is read again and from its contents, and the label list, the generated tape is produced. The final output to the generated tape is one word at a time, not double−buffered. Note that the contents of the generated tape are not left in the core store. The (zero) identifier of the work tape is not altered. Every run of the Tape Generator (successful or otherwise ) leads to the execution of OUT 2, causing the run to be fully logged by Director, and the Generator re−entered for another run. KDF9 (Revised 12.12.65).
original
10−3−0 Section 10.1 10.1 F, COMPUTER REQUIREMENTS Peripherals: 1 Paper Tape Reader {o−hole} 1 Paper Tape Punch (8−hole) 1 Work tape (ZERO identifier) Core store: The generator requires altogether 1216 words for instructions and input/output areas plus 1 extra word for each label on the input tape. Subject to this, it will work without modification in any size of store. G. NORMAL OPERATING PROCEDURES 1. Mount a work tape. 2. Read in Paper Tape Generator. 3. Read in Input Tape on PTR indicated by monitor typewriter− 4. 'SUCCESS→' is typed, indicating successful compilation. 5. The compiled Director will have been output on a PTP, 6. The program is re−entrant and can be terminated either by supplying a heading block consisting of a single EM, or by an even restart (leading to OUT 0), TINT A can be used but should be avoided. H. NORMAL CORRECTION PROCEDURES One or more of the following messages will be typed (by OUT 8, stream 0) in the case of failure:- 1. 'FAILURE → i indicating that the output on the PIP consists of a failure report. Details of failure reports are described in Appendix 2. 2. 'RESTART →', after a parity failure has been detected on paper or magnetic tape or after an operator instigated odd restart. The last input tape should be re−spooled and re−input− 3. ' EM READ', after a spurious end message character on the input tape. 4. '/ABCD+/", during punching of the output tape, when the value associated with the label exceeds the permitted limit. In the generated tape the value minus the excess is inserted. If a wrong input tape is used in error, the operator should perform an odd restart. J. Not relevant. K. Not relevant. KDF9 (Revised 12.12.65).
original
10−4−0 Section 10.1 L. TIMING DATA The time taken per run will be the time to read the input tape plus time to punch the label list (16 characters per label) plus time to punch the generated tape. M. Not relevant. KDF9 (Revised 12.12.65)
original
10−5−0 SECTION 10.1 APPENDIX 1 10.1 The Tape Generator Code and input Tape General Characteristics (1) Tapes are generated, effectively, in units of eight bits (one syllable), and the total number of syllables generated is always a multiple of six− i.e. the generated tape contains an integral number of KDF9 words. (2) The input tape is punched in the Printer/PI Common Character Set (see Section 22.5.3), items being separated by semi−colons. The generated tape contains only the 'generated' versions of these items, adjacent to one another, and strictly in the order that they occur on the input tape. Individual input tape items may generate one or more syllables (e.g. 3 syllable instructions), and sometimes strings of 'dummy' syllables (binary 00001111). (3) The Tape Generator reads the input tape using a routine which (a) ignores redundant characters, including Space, CR−LF, Tab, and spurious case changes. This means, for example, that items may be split between two or more lines. (b) ignores 'comments'. Comments, as in Usercode, are enclosed in round brackets, but may be inserted anywhere − they do not count as 'items' and so do not have to be followed by semi−colons. Comments may be nested: i.e. after reading an opening round bracket, the Tape Generator will take note of further brackets occurring in the comment, and will ignore other characters until the number of 'close brackets' read has cancelled out all the 'open brackets'. Any character may be included in a comment except '→" (octal 75). (c) Fails if, outside a comment, it meets any non−redundant characters other than those common to the Printer and PTP, i.e. A to Z 0−9 / : ; + − . , * £ &subten; Round brackets ( ) are permitted but only as comment delimiters, and it is convenient to regard them as belonging to the comments they enclose. '→' (EM) is permitted only as the last character on an input tape, following the item 'FINISH;': and to terminate the obligatory 'heading' block (see below) which starts any input tape. (4) Each word and syllable on the generated tape has an 'address' automatically associated with it. The first word has address 0, the second 1, etc., and the syllables within each word are numbered 0−5. However, a special type of item on the input tape may be used to give the next word generated a specified address, thus starting a new sequence of addresses. Thus each word on the generated tape has an 'address' one greater than its predecessor, unless it has been given a new address by the type of item mentioned above. KDF9 (Revised 12.12.65).
original
10−6−0 Section 10.1 10.1 Appendix 1 (5) Any item on the input tape can be 'labelled', a 'label' being any string of up to 4 letters or digits. A label, which counts as an item, associates with itself the current word and syllable address on the generated tape. In particular, instruction−type items may use labels to refer to the addresses of other items, rather than having to specify the actual values of the addresses. There is only this one type of label, used to refer both to 'constants! and 'instructions'. Input Tape Items Input tape items fall into two classes, 'Instructions' and 'Directives'. (1) Instructions These cover all items which generate an explicit number of syllables, and include KDF9 binary instructions (1−3 syllables), constants, and 'messages' (any integral numbers of words). (2) Directives These cover items which may or may not generate syllables (if they do, the syllables are 'dummies', i.e. binary 00001111) and whose function is to give directions to the Tape Generator. Some Instructions contain an implied Directive. Items are terminated by semi−colons. Redundant semi−colons are ignored. The Tape Generator Code 1. Numbers All numbers specified explicitly on the input tape are integers. In what follows, 'd' indicates an integer which must be specified in decimal. 'n' indicates an integer which may be specified either in decimal or octal − if in octal, the integer is to be immediately preceded by the letter B. E.g. twenty−nine could be written as 29 or B35. Non−significant zeros are ignored. Labels and references A label is a special type of Directive, and is written as (up to) 4 alphanumeric symbols between oblique strokes, e.g. /2B9/;/7/;/PQ7C/; In labels like this, numeric digits are not treated as numbers but purely as symbols. In what follows, /ABCD/; is used as a typical label. A label causes no syllables to be generated. It may not have an associated word address exceeding 8191, unless the corresponding syllable number is KDF9 (Revised 12.12.65).
original
10−7−0 Section 10.1 10.1 Appendix 1 zero, when the limit is 32767. Labels must be unique. A label list, giving the word and syllable address corresponding to each label, is punched out by the Tape Generator. Many types of instruction which naturally include addresses, either of instructions or of 'constants', use references (to the labels with which those addresses, or relative addresses, are associated). Any reference to label /ABCD/ is written (in the instruction making the reference) as /ABCD + n/ ( + n omitted if n = 0) where n (see 1 above) is an integer which is permitted, in certain contexts, to modify the address of the label. Examples of references are given below, with the instructions permitted to use them. 3. Other Directives (See also 'Sum−checking facilities', below) 3.1 'REn;' If there are not already an integral number of words on the generated tape, complete the current word with a suitable number of dummy syllables, then give to the next generated word the address n. (0<n<32767) 'RE/ABCD + n/;' has the same meaning as 'REn;' except that the address given to the next generated word is the value of the reference /ABCD+n/. This value must again be in the range 0−32767. There are two restrictions:- (a) the item (label) '/ABCD/;' must already have occurred on the input tape. (b) its associated syllable number must be zero. 3.2 'Rd';(0<d<31) Complete the word currently being generated with dummy syllables, if necessary, and then generate the minimum number (0) of dummy words (= 6 dummy syllables) needed to make the next generated word's address congruent to d (module 32). 3.3 'Sd'; (0<d<5) Generate the minimum number of dummy syllables necessary to ensure that the next syllable will be syllable d. As in Usercode, an asterisk* may be written immediately in front of any input tape item, and will be interpreted as if that item were preceded by the Directive 'S0;'. 3.4 'BLANK;' causes the current generated word, if incomplete, to be filled up with dumy syllables, and then causes a one foot (120 character) length of blank tape to be run out before the next generated word. 3.5 'FINISH;' ends the program, completing the current generated word, if need be, with dummy syllables. This directive MUST be followed by a single '→', Directives may of course be juxtaposed − they take effect in the order they are written. KDF9 (Revised 12.12.65).
original
10−8−0 Section 10.1 1061 Appendix 1 4. KDF9 instructions 4.1 One−syllable instructions − These are written exactly as in the Line Printer version of Usercode, e.g. 'MULT;' instead of '×;', *DIV;' instead of '÷;' 4.2 Two-syllable instructions − Again these are as in line Printer Usercode (e.g. MULT + + d) with one exception. The short loop jump instruction refers to no label, and is written: SJCdNZ; (d = Q store number). The forms PIAQd; etc. must be used for peripheral instructions. The letter U written after a peripheral instruction causes the least significant, i.e. the 16th, bit in the instruction to be set equal to 1. 4.3 Three-syllable instructions 4.3.1 SET These forms are permitted: SEIn; (0<n<65535) SET+n; (−32768<+n<32767) SET +/ABCD + n/; SET +/ABCD + n/U; SEL +/ABCD + n/L; In the last three forms the sign before the reference may be omitted if positive. The address associated with the label is treated as a sixteen bit integer, with syllable number in the first three bits. The integer n inside the reference is simply added or subtracted, as appropriate. L and U have the same significance as in Usercode, i.e. half−word addresses are set. E.g. SET B140000; SET − B12; SET 397; SET −/P7Q − B7777/3 SET/XYZ = 2/0; 4.3.2 Direct fetch and store These forms are permitted En; E/ABCD + n/; = En; = E/ABCD + n/; En Md; E/ABCD + n/Md; etc. (a = Q store number) The address must be in the range 0 − 32767, and the syllable number associated with the label must be zero. E.g. = EB177M6Q;E/Y + 39/;
original
10−9−0 Section 10.1 10.1 Appendix 1 4.3.3 Jumps (except short loop). Jumps to subroutine are written:- JSEn; or JS/ABCD/; otherwise any jump instruction starts:- JEn or J/ABCD/ (i.e. a reference must always be to an unmodified label). fhe condition, if any, follows, in the Line Printer Usercode form, e.g.:- J/H19/C14NZ; JEB27LEZ; The word address must be less than 8192. 4.3.4 EXITs (using references) The permitted forms, where a reference is involved, are:- EXIT/ABCD + n/; and EXITA4/ABCD + n/; (a = number of half words to be added) The address associated with the label used in the reference must have a zero syllable, and the word must be less than 8192. E.g. EXIT 1/TREE − B41/; 4.3.5 Other three−syllable instructions which do not use references, e.g. EXIT 3;, EXITD;;, OUT; etc., are exactly as in Usercode (no references to Usercode−type labels are permitted). 4.4 Constants Every 'constant' starts: SYLd (1<d<6). This means that the next d syllables of the generated tape will. contain a value which is specified next as the sum of one or more positive or negative contributions. Each contribution is written in one of these forms: , + n L|R d ' L|R d' ................or , + /ABCD + n/ L|R d ' L|R D' ............... i.e. a comma, followed by the sign, indicating whether the contribution is to be added to or subtracted from the value (the sign may be omitted if positive); then either a number or a reference (16 bit address, + n); followed, if required, by any number of terms Ld' or Rd' KDF9 (Revised 12.12.65).
original
10 − 10 − 0 Section 10.1 10.1 Appendix 1 (d'<47). The effect is to place the positive number, or the (signed) value of the modified reference, at the least significant end of a 48−bit register and perform successive logical shifts on it by amounts d', Left positive) or Right, according to whether the letter L or R precedes the amount of shift. Shifting ends when the next comma or semi−colon is read, and the resulting quantity (the least significant d syllables of the register) is added to, or subtracted from, the value. There may be any number of contributions, the last being followed by the semi−colon terminating the item. If the value required is zero, it is only necessary to write 'SYLd;'. E.g. to make the next 3 generated syllables contain a SET instruction, the quantity set to be the address of the syllable three syllables before /PQR/ (this might be required if an 'EXIT 1;' instruction is to transfer control to /PQR/;):- SYL1, B304 (first syllable of SET); SYL2 (reserving space for value) , + /PQR − B60000/(address /PQR/ with 3 subtracted from syllable position) , − /PQR − B60000/R47 (decrement word address if syllable /PQR/<3) , − /PQR − B60000/R47L14 (subtract 2 more from syllable position if syllable /PQR/<3); (this also illustrates the way comments may be inserted anywhere in an item, and also how one item may occupy more than one line). 4.5 Messages For specifying, e.g., an output message, or a magnetic tape identifier, a special form of item is permitted. This consists of:- WORDS followed either by one or more 'octal characters' (each comprising 2 octal digits) preceded by colon (:), or by one or more 'symbols' preceded by '='. The symbols permitted are * (representing Space) and the Printer/PT Common Set (see 22.5.3) Symbols and octal characters may alternate. The whole item is terminated as usual by ';' and the Tape Generator treats it as follows:- ; The word currently being generated is completed, if necessary, with dummy syllables, and then the next word(s) are generated from the characters represented after 'WORDS' (the last word being completed with octal 77's if needed). Thus:- WORDS: 020407 = TYPICAL * MESSAGE: 75; would generate the following words (in octal):- KDF9 (Revised 12.12.65).
original
10−11 −0 Section 10.1 10.1 Appendix 1 02 04 07 64 71 60 51 43 41 54 00 55 45 63 63 41 47 45 75 77 77 17.77 77 Sum Checking Facilities 3 additional Directives, CLEAR SUM; START SUM; STOP SUM; and 1 Instruction, PUNCH SUM; are available to facilitate the inclusion of Sum−checks on generated tapes. All these items start by completing the word currently being generated with dummy syllables, if necessary. CLEAR SUM; and START SUM; cause words subsequently generated, to be added, after punching, to a 48−bit checksum (overflow is ignored). CLEAR SUM; zeros the checksum before summation starts. STOP SUM; similarly inhibits summation, starting with the next word generated, until it is restarted by one or other of the two Directives above. At the start of reading the input tape, the Generator behaves as if CIEAR SUM; had just been specified. PUNCH SUM; causes the current value of the check sum to be punched next on the generated tape, updating the address in the normal way, and, if summation is not inhibited, added to the checksum after punching, thus doubling it. KDF9 (Revised 12.12.65).
original
10 − 12 − 0 SECTION 10.1 APPENDIX 2. FAILURE REPORTS. General: The failure report punched on paper tape comprises one line for each failure. Wrong Character: When a wrong character is detected in an item the line takes the form /ABCD/m/n X where /ABCD/ is the last label on the input tape prior to the error (if no label has yet occurred, the field is left blank) 'm' and 'n' (which are 7−digit decimal integers) are, respectively, the counts of items from the label, and of characters from the start of the offending item. X is the wrong character. e.g. the sequence /POR/; E/A/; E/B/; +F; ABF; leads to the failure message /PQR/0000004/0000003 F The offending character in the item is the first which cannot be interpreted in relation to its predecessors. Misuse of label: When a label is misused one of the following types of failure occurs :- /ABCD/NOT UNIQUE → /SBCD/UNSET → /ABCD/ > 32767 → /ABCD/ >8191 → /ABCD/SYL NZ → (all self−explanatory) and 2 others associated with the directive RE/ABCD+n/: /ABCD/NOT PRESET → /ABCD+/OUT OF RANGE →