original
SECTION 7.1 USERCCDE (PAPER TAPE) COMPILER 1 7.1
A. IDENTIFICATION
Computer: KDF 9
Program No: KAA01PT
Title: USERCODE (PAPER TAPE) COMPILER 1
B. GENERAL DESCRIPTION
Purpose: To compile USERCODE Source Programs held on PAPER TAPE
into machine code object programs in the core store
and which may be entered immediately ("Load and Go"}
if required.
The object program may optionally also be punched to
PAPER TAPE,
Input: A PAPER TAPE containing a USERCODE Source Program
written in the notation described in the KDF 9
Programming Manual, and preceded by the data shown in
the Standard Heading Sheet.
Output: 1. Messages on the MONITOR TYPEWRITER to indicate the
progress of the Compiler,
2. A list of errors (failure reports) if any located
in the source program, output to PAPER TAPE, (The
form and content of failure reports are specified in
detail in Appendix 1)
3. Optionally, a table of the references in the source
program and their corresponding machine addresses,
either to PAPER TaPE, or an ON−LINE PRINTER. An
example of reference tables is included in Appendix
2s
4. Optionally, a copy of the object program in BINARY
FORMAT (see Section 22,4) may be punched to PAPER
TAPE.
Note: If any output occurs under heading 2; then output
4, even if requested, will automatically be
inhibited.
C. METHOD OF USE
Selection of Selection of various output options and the types of
Options: peripheral devices to be used, is controlled by the
compiler itself. The necessary information is insertec
at run time via the MONITOR TYPEWRITER.
The queries made end the possible responses appropriate
%o cach are showm in Division G.
original
7 − 2 − 0
Section 7.1 (cont. } 7.1
However, prior to run time the user should have
decided:-
1. Whether the object program is to be punched out.
2. Whether reference tables are required.
3. The type of output device for reference tables,
4. Whether "Load and Go" is required. This option is
not available if the "START" option is being exercised.
D. OWN CODE OPTIONS AND REQUIREMENTS
None available or required,
E. PROGRAM CHARACTERISTICS
General: This is an autonomous, non−segmented program.
Method: The source program is read from paper tape in two
parts, each to an EM character, The first part
consists of the heading sheet up to and including the
program title. The second part consists of the
remainder of the heading sheet and the source program
proper, terminated by "FINISH;°", Thus any extra or
omitted "+! will cause an immediate failure. Also,
all the program, including library subroutines, must
be included before the "FINISH;→",
Processing The compiler first processes the heading sheet and if
Heading Sheet: it finds eny error or inconsistency at all in this
part of the program, the compilation is terminated and
the Compiler re−entered at the beginning to process
the next program.
Processing In processing the source program proper, the Compiler
Text: checks every Usercode instruction for validity and
consistency. If an instruction passes the checks it
is translated into machine code (as far as possible)
and stored in the next location in the core store.
If a check fails then the instruction is ignored, a
failure report is output, and the Compiler moves on to
the next instructicn. Having processed all the
instructions in this way (up to "FINISH") a process
called "UPDATE" is performed, This completes the
compilation by entering absolute machine addresses in
place of the Usercode references (the former may not
have been available on the Compiler's first pass).
This updating process is also carried out whenever the
label LiVy or Pp¥v is encountered in the source program,
since a new set of reference tables is started at these
points. Again, if inconsistencies are found, failure
reports are output. Thus, at the end of the run a
complete list of invalid instructions, if any, is
original
7 − 3 − 0
Section 7.1 E (cont. )
aveileble. Whether failures have occurred or not the
Y0 specification will be given (on either the Line
Printer or the Paper Tape Punch),
If there were no invalid instructions, the compiled
program and reference tables, if required, will be
output on the specified device.
Output of The compiled program will be laid out in the standard
Compiled A, B, C blocks form, with the Y0 specification
Program: preceding the A−block unless reference tables are
requested on the printer in which case it will
accompany these. The C−block is in fact punched 32
words atatime, but in a form which will be read in
a single transfer. If the user did not specify Y0,
then the Y0 specification output here is the true one,
However, if the user did specify Y0, then although
this value is used to derive the data addresses, (i.e,
YA−YZ and W stores addresses, which are evaluated by
working backwards from this point), the Y0 specification
output here indicates the earliest position in which
it could have been placed, had the user wished,
When the specified output has been completed, one of
two courses of action is taken. If the "Load and Go"
option is being exercised, the compiled program is
moved in the store to the position it would have
occupied if it had been read by Director, and the
Compiler oveys OUT 2, If "Load and Go" is not required,
the Compiler is re−entered at the beginning to process
the next progran,
F. COMPUTER REQUIREMENTS AND CONDITIONS
Core Store: This Compiler exists in different versions for sizes
of store from 2 modules (8K) up to 8 modules (32K). No
advantage in speed is gained but the larger the store.
available, the larger the source programs which can be
compiled,
The Compiler itself occupies 2880 words. (This figure
is valid at 1.5.65 but is subject to slight increase).
It uses all the remaining space to the end of the store,
whatever size this happens to be, for storing the source
program, the compiled program and the Compiler's own
internal tables.
Peripherals: This Compiler requires 1 PAPER TAPE RSADER and 1 PAPER
TAPE PUNCH. Optionally a LINE PRINTER may also be used.
G. NORMAL OPERATING PROCEDURES
1. Load Compiler,
2. "02A0<d>" is typed. Load the source program on device <d>,
original
7 − 4 − 0
Section 7.1 G (cont.) 7.1
3. TINT; B<d0><d1><d2>.→
where d0 = 0 if the object program is required {on paper tape).
≠0 if the object program is not required.
d1 = device type for reference tables.
(d=1 for PTP, d=3 for ON−LINE PRINTER).
d2 = NZ if load and go required, otherwise zero.
4. 01A0<d>" is typed. Check that the punch <d> is ready.
5. Wind up the source program.
6. "01N0<d>" is typed. Wiud up the output tape and collect together
MONITOR and (if any) the ON−LINE PRINTER output.
7.. If d1, = 3 then the pair of monitor messages
O3A0<d>
O3N0<d>
will be typed.
8. "02N0<d>" is typed. No action required.
9. If "Load and Go" has been specified and the program has compiled
successfully it will now be entered, otherwise to step 10 below.
10. When compilation has been successfully completed the message
<identifier> OK RAN/EL/mmmMssS/ummMsss
will be typed. If the compilation is unsuccessful
<identifier> FAILS RAN/EL/nmolissS/mmlssS
will be typed.
11. If there are no more programs to be compiled, terminate the run
by "TINT;A.→", otherwise return to step 2 above.
H. NORMAL CORXECTION PROCEDURES
If an invalid instruction occurs in the source program, then a failure
report is output and compilation continues. If the heading sheet is
found to be in error, one of the messages listed in Appendix 1 is punched
and the compilation is terminated. In either case, on completion of the
compilation process the message given in step 10 of Division G is typed.
The next program should then be processed.
J−K. Not relevant.
L. TIMING DATA
The time tuken to compile a Userecode program depends on the size and
construction of the progran. As a very rough guide, the time taken to
original
Section 7.1 L (cont, ) 7.1
the paper tape, The time for output depends on its volume.
M. EXTENSIBILITY
The Usercode text as provided on the NINEMASTER is the text as
required for both 3 and 4 module versions.
The required store limits are
12K − director size or 16K − director size
The time limit is 999 for all sections,
To produce a 2K version (KAAOIPT) requires the following amendment
(via Post).
BEFORE LINE
YB→
REPLACE 1 LINE BY
YB300;→
→
This section should then be comniled with
original
SECTION 7.1 APPENDIX l 7.1
USERCODE COMPILER FAILURE REPORTS
Purpose: This appendix specifies for Programmers’ use the form and
content of the Failure Reports whicn may be output by the
Compiler on ating violation of usercode rules and
other failures.
Format of While a source program is being compiled any errors in
Failure it are punched out on paper tape in the following forn.
Reports:
PAILURE REPORT
P
progran identifier
message
message
Each message gives information about one error.
The possible messages may be grouped under 5 headings.
1. Heading Sheet Errors
Any error occurring up to and including the word PROGRAM
(or PROG or PROGRAMME) 1s catastrophic to tue compilation.
It is net always possible for tne compiler to give the
exact fault, garticularly if the items are incorrectly
sequenced
The possible messages are:
NO P/T The first letter on the tape is
neither P nor T.
TITLE A non standard case normal
character appears in the title.
STORE LT }
TIME LT } In its test for the specification
V SPECN } stated, the compiler either does
W SPECN ) not recognise the set of letters,
MTPR } or does not accept the integer as
START } valid, or finds the specification
YA SPECN ) inmcerrectly terminated. The first
YI USED } condition may hold if the correct
Y0 USED ) sequence (as defined in Appendix 4}
RESTART } is not followed,
PROGRAM )
The failure report PROGRAM can occur after several other failures, This
can only occur when RESTART: has been used and when the word PROGRAM has
been omitted.
2. Instruction Errors
When an instruction is invalid the messuge consists of
two parts, a pointer anda cuaracter string.
original
7 − 7 − 0
Section 7.1 (cont. ) 7.1
The POINTER
This is of the form
Pddddd Rddddd + ddddd or Iddddd Radddd + ddddd
where Pddddd or Lddddd is the number of the
current subroutine (P00000 is the main program),
Radddd is the last valid reference processed
and
+ddddd is the number of valid instructions
processed since the last valid reference.
The CHARACTER STRING
This consists of the set of characters comprising the
invalid instruction i.e. from the last valid
instruction terminator up to and including the next
terminator (';' or CR/LF in the case of all instructions
and constant declarations except for a Vv=P constant in
which case the only valid terminator is ';' or a comment
in which case ');' is the terminator), and is terminated
by an end message. In the case of a string consisting
of more than 72 characters (most probable in the case of
a Vv/v=P constant or in an unclosed comment) the first
64 characters and the last 8 characters make up the
string.
3. Referencing Errors
If a reference appears twice in the same subroutine or
in the main program, the message is exactly as under
heading 2.
i.e. Pddddd Rddddd + ddddd
dddd;
where dddd is the reference and the pointer relates to
the second occurrence of the reference.
If a reference is omitted the message is of the form
AT dddad/s Padddd Rddddd NOT IN
dddda@/s is the octal address/syllable number of the
instruction in which reference Rddddd of subroutine
Pddddd is included. When this type of failure message
is produced then reference tables will be punched or
printed, if these have been requested by the interrupt.
Main program reference labels mst be in the range
0−1011. This limit applies irrespective of module size.
4. Other Programming Errors
Y0 SPECN
OUT BY − dddd. Y0 has been incorrectly specified.
dddd is the number of words by which
the program and W0 overlap.
Y OFF ST The store limit specified is smaller
than either the declared specification
or that derived from the program.
KDF 9 (Revised 9.6.65)
original
7−8−0
Section 7.1 (cont.) 7.1
EM POUND An end message nas been found in
the program, This is normally
caused by an unclosed coment or
by the word FINISH: being omitted.
The failure report immediately
previous to this message relates
to the context in which the end
message was found.
5. Machine Fault Reports and Failures due to Machine Size
MACHINE Machine failure report which can
be caused by a variety of faults,
e.g failure in arithmetic
operations, internal tables being
faulty etc.
UPDATE This is normally a machine error, due to
the incorrect formation of an updating
list. It can, however, occur i1 a V−
constant declaration, of a form stated
below is declared more than once,
V−constant form:- if the declaration
consists only of constants or addresses
of W,YA to YZ, or Y stores. This does
not apply 1f the option Y0 = Ee is used.
e.g If the 4 constants
V2 = AY0;
V4 = Q0/ AY0/0;
V2 = AY0:
V4 = QO /AY0/0;
occur in the same program, the compilation
will fail "UPDATE".
XFUNWY A machine failure eccuring when an internal
table camot be interpreted.
PARITY A parity failure has occured.
BIT LIST This occurs when the YB specification
of the Paper Tape compiler is too small.
NO SPACE This occurs when the compiler used is too
small to allow space for the program being
compiled.
If an overlength failure report is punched out, containing mainly
referencing failures, often with Pg RG NOT IN, or otherwise with
very large references, this is a machine failure of the type XFUNNY.
Warning Messages
S/R LIST SHIFTED UP These are messases that do not interfere
S/R LIST SHIFTED DOWN with the compilation but state that the
compiler has been forced to move its sets
of tables.
KDF9 (Revised 20.1.67.)
original
7 − 8 − 1
SECTION 7.1 APPENDIX 2
USERCODE COMPILER REFERENCE TABLES
The following is an example of reference tables us produced by the Usercode
Compiler.
The program consists of subroutines L1, L63 and P999 and the main program
PO. Within each cf these the reference labels are listed in numerical
order. In each column the reference number (decimal) is followed by its
octal address, relative to EO, in two parts − the word address of 5 octal
digits and the syllable number of 1 digit.
Thus the main program,PO, contains references 1,2,3,4 and 40. The first
instruction of PO is in E109 (octal 155). Reference label number 1 is on
the first syllable of E115, reference 2 is on the last syllable (number 5)
of E117, and so on,
The address shown against the subroutine number is the address of the first
instruction of the subroutine, Thus the subroutines V stored immediately
precede this address. (e.g. if L63 has 5 V stores, V0 to V4, then the address
of V0 is E245).
08/10/64 PROGRAMIDENT REFERENCE TABLES (rest of page invalid)
PO 00155 0 1 00163 0 2 votes 5 3 00187 9D
40 00170 2
P 999 00206 0
L 63 00252 0 1 00252 0 2 00253 0 oO
5 00266 3 6 UG267 0 7 00256 1 °
10 00361 3 11 00341 12 00352 3 4
15 00321 1 16 00330 3 V7 00335 1 5
20 06321 4 =21: 00324 2 22 UOeT2 2 5
25 00276 1 27 00300 5 28 OuZoOu 2 u
31 00350 5 = 32 vus51 3 35 v0346 0
36 00355 4
L 4 00514 0 100651 4 2 00521 0
5 00537 4 6 01251 2 7 91251 2
10 UOT35 4 11 00747 5 12 00742 2
15 01065 0 16 00742 5 Vy 01044 4
20 01065 0 = 2101104 1 22 01107 4
25 01031 2 26 01020 5 27 01013 1
30 00755 5 = 31:01047 3 32 00523 3
36 01126 4 = 337: 01130 1 38 01160 0
4701140 2 42 01161 4 = 43 −O1744 4 ,
46 01162 4 = 4701153 5 = 48 01066 2 ?
51 00553 5 52 00556 5 53 00557 4 3
56 00604 2 57 00576 2 58 00577 2 3
64 00647 2 65 00650 4 66 00611 2 3
69 01076 1 70 01170 3−71 −01164 2 3
74 01236 1 75 01241 1 76 01207 0 TT o12il
79 01156 3 = 80 01222 3−81 01223 0 62 C107) 4
84 01072 1 85 01021 2 = 86 00663 5 87 00666 1
89 010275 90 OU7I2 2 91 00705 2 92 00770 3
94 01044 0 95 00637 4 96 OU660 0 97 00722 2
99 01044 0 100 01034 2 101 01206 3 102 01011 2
104 00776 4 105 01000 3 106 00775 3 107 O10C2 3
109 01005 0 110 01007 1. 414:01056 3 112 01033 1
11401057 4
KOF 9
original
SECTION 7.1 APPENDIX 3
The contents of this Appendix deal with extra facilities and instructions,
the information being included here pending issue in the KDF 9 Usercode
Programming Manual.
SPECIFICATION OF PRINTER CODE CONSTANTS
Sections 1 to 7 relate to 8−hole usage, Section 8 relates to 5−hole usage,
1. Form of specification in Userscode
There are 2 forms:
(a) Wf/w = P <character string>;
(b) Vv = P <character strings;
Form (a) denotes 2 character string which is to occupy V stores v to w
inclusive, w must be greater than or equal to v.
Form (b) is an abbreviated form of Vv/w when v=w.
The character string must not fill more character positions than 8x(w−v+1).
The character string will be LEFT JUSTIFIED in the V store area specified.
Any unfilled positions will be filled by the space symbol (00), 3
2, The character string
This consists of a combination of editing symbols, expressed in a formal
notation; and elements of the following character set,
0 thru 9
A thru Z
/ + − . 10 ( ) = *
( *is the formal. symbol for a single space)
The formal notation for editing or format symbols
Editing symbols which are required to be gompileu into the machine code
program constants (exeept for the single space i.e. *) must be enclosed in
string quotes ice. [ ]
The symbols provided for are:
Symbol Meaning Octal Form after_compilation
S space 00
C CR−LF 02
P page change 03
T tab 04
N case normal 07
Q semi colon 34
EM end message 75
D dummy 77
original
7 − 8 − 3
Section 7.1 {eont. ) 7.1
Any number of such sy:.bols may be included in a single pair of string
quotes and any such symbol may be preceded by an unsigned decimal
integer to denote multiple symbols.
String quotes may not be nested e.g. [C [EM]] is invalid
Examples
[N 2T]
[29D C EM]
3. Editing symbols and characters on the original text tape
All editing symbols (space, tab, and CR/LF) occurring from the P until
the specification terminator (sce 4) are ignored on the original text
tape. Also letters A thru Z can be written in lower shift but are
compiled as though they were in case normal. Thue the following two
specifications will result in the same constants:-
V0/1 = P [NC] EXAMPLE*1 [4SEM];
V0/1 = P
[n c] Example * 1 [4d em];
The octal forms of the compiled constants are:
V0 = B 0702457041556054;
V1 = B 4500217777777775;
The Specification Terminator
CR−LF is not a vulid terminator. Otherwise the normal instruction
terminators are valid.
i.e. for the Paper Tape Compilers ;
for Post ; or ,
5. Warnings as to use
a) Transfers to the line printer should not contain more than one
line of output. Thus C or FP aliould be the last character
of the text output. This can be achieved by the use of multiple
dumay characters which are ignored by the printer.
P is a plugboard functicn.
b) OUT 8 or OUT 1
Care should be taken to use only those editing symbols permitted
by the Director.
In OUT 8 flexowriter queries the semi−colon must occupy the
last character position of a word.
original
7 − 8 − 4
Section 7.1 (cont. ) 7.1
6. Failures due to incorrect use
a) w is less than v (see 1)
b) There are too many characters in the character string.
c) The area Vv to Vw already has a non−zero entry.
It should be noted that, as unfilled words within the Vv to Vw area
are made equal to zero, the compiler will not report a subsequent
entry to the declared area unless there is a non zero entry in it.
i.e. V0/10 = P TITLE;
V6 = B735; will not cause a failure.
7. Examples of P−Constants
V0/1 = P [nc] M [c] PROGRAMIDENT;
V7/23 =P
[16S] HERE*IS*tHE*TITLE [ce em] 5
V26/29 = P [no]
M*TAPE WANTED [q] ;
V31/38 = P
[6S] 1ST*COLUMN [12S] 2ND*COLUMM [125] 3RD*COLUMN [3D C]
8. 5 hole usage
The specification differs only in the hardware representation of
the symbols. These are as follows:
8 hole 5 hole
* £
[ *Q
] *U
; *,
Thus the second example in 7 would be written.
V7/23 = P
*Q16S*UHERE£IS£THE£TITLE*QC EM*U*,
original
7 − 8 − 5
SECTION 7.1 APPENDIX 4 7.1
THE USERCODE HEADING SHEET
The following is a list of items that either can or must appear on the
heading sheet. It is written in 4 colums. The first 2 colums consist
of the symbols M, 0, N, to show whether the item is Mandatory, Opticnal,
or Not required. The order of the items in the list is never optional.
The iteus wnich follow the end message symbol are separated by the usual
program separators. Column 1 relates to the Paper Tape Compilers, Colum
2 to the POST compilers. If <unsigned integer> is left unfilled in any
of the optional items, it is equivalent to omitting this item (but it
must have appeared in the correct list order.) Editing symbols may appear
in any position except for CR−LF which may not break up an item.
P.T.Comp. POST Item Comment
M N P or T )
M N 12 non editing symbols) See Note 1 to this Appendix
O N Any set of characters )
M N End Message )
M O ST <unsigned integer> or Number of words of storage
ST required. ST0; and ST; are
alternative forms and have
the effect of allowing the
machine code program to use
the run time store limit of
the machine, Under POST
this item is ignored if it
occurs.
M O TL<unsigned integer> Time limit for the machine
code program, given in
seconds. Under POST this
item ie ignored if it
occurs. TL; will cause a
failure report in the P.f,
compiler),
O O MIPR Allocates the program tape
to the program, Gee NOTE 3)
O O START<unsigned integer> Program origin relocated at
thie address in place of zero
(further details in NOTE 2),
O O Y0=<unsigned integer> The address of Y0 is to be
that stated (rounded up to
a multiple of 32 if necessary).
O O V Sunsigned integex> The highest main program V
store which is to be used.
O O W <unsigned integer> The highest W store which
is to be used,
original
7 − 8 − 6
Section 7.1 Tol
P.T.Comp. POST Item Comment
O O YA <unsigned integer>) The highest of these stores which
YB " " ) is to be used. YI and Y0 are
YC " " ) not included in the list and
. . ) may not be used. Items within
. . ) this group may appear in any
. . ) order.
YZ <unsigned integer>)
O O RESTART; 0 to a max. of Any instructions occurring in
6 syllables of this item will be stored in
usercode instructions E4 of the 'B!' block of the
machine code program.
M M PROG or PROGRAM or This item marks the end of the
PROGRAMME heading sheet and the
beginning of the program
proper.
NOTE 1 The Identifier and Title of a Paper Tape Program.
(a) The identifier is formed from the first 13 printing characters.
Up to the 13th of these characters, the symbols for space,
CR−LF, case shift, case normal, are completely ignored in
reading the paper tape. This is to ensure that a valid
identifier is obtained. Note that case shift is ignored and
thus unless all 13 characters are in case normal an altered
identifier may be obtained.
(b) Characters subsequent to the 13th printing character are
inserted into the 6 words allocated to the title. This
includes both editing and non−editing symbols. Any excess
over 6 words is lost and does not cause a failure. The
end message is moved (it necessary) to be the last character
of the 6 words. Any unused character positions are filled
with the space symbol (octal 00).
(c) Only Standard Case Normal (S.C.N.) characters, spaces, and
CR−LF, should be used before the first end message of a
paper tape. The use of other symbols may well cause the
contents to be corrupted when used in other programs
(e.g. Updater).
The S.C.N. characters are:-
O − 9 A − Z . + −/ 10
original
7 − 8 − 7
Section 7.1 (cont.) 7.1
NOTE 2 START unsigned integer
Its function is best illustrated by an example. If
START 1600;
is specified, tae machine code program at run time is placed in
the store as follows:~
WORDS 0 − 7 (The 'B! block) in E0−E7
Subsequent words (The 'C' blocks) in E1608 onwards
NOTE 3 MIPR
This allocates the program tape to the program (see section 10.1
section C, program input procedure). The compiler sets D0 of ES
to 1.
Actually NOTE 2 is not true, though the same statement
appears elsewhere in other internal EE documentation.
Actual use of KAA01PT reveals that the code starts
at 1600 in the above example.