Note

We used the City & Guilds Mnemonic Code assembly language briefly during ‘A’-level to allow us to write programs when learning about addressing modes but we didn’t actually have any of them run on the local college’s computer.

# City & Guilds Mnemonic Code¶

## 1. Introduction¶

A program written in the City and Guilds mnemonic code may be run on any ICL computer in the 1900 range which is provided with at least 8K core store and the appropriate peripherals (see 2.5 below).

A C & G program is run in two stages, an assembly stage and an interpreter stage. In the assembly stage the C & G program is read and stored in the C & G store (an area of 1900 core store). In the interpreter stage the stored C & G instructions are examined in turn and the operation called for by each is carried out.

Any number of City and guilds programs may be run consecutively without reloading the assembler/interpreter, since the latter will not be damaged during the processing of a C & G program.

## 2. The City and Guilds ‘COMPUTER’¶

### 2.1 The Basic Machine¶

The basic C & G ‘machine’ consists of a central processing unit, 1000 words of storage and a floating point accumulator. The input and output devices are described in 2.5 below.

### 2.2 The C & G Store¶

The C & G store consists of 1000 words and is addressed consecutively from 0 to 999. With the exception of word 0, each location can hold one instruction, 1 character, or one number. Locations 0 to 9 have special uses.

### 2.3 Special Store Locations¶

Locations 0 to 9 (only) may be used as modifiers. The following locations have special uses:

 0 Contains a “permanent” zero. This is, zero is obtained when reading from location 0, and writing to location 0 has no effect (although it is legal to do so. 1 The address of the floating point accumulator A. 4 Holds the return link after a subroutine entry instruction JSR has been obeyed. 5 Holds the count for use with the LOP instruction 6,7 Specify the format of the number produced as the result of a CNC instruction.

### 2.4 Order of Execution¶

The address of the first instruction to be obeyed is specified by the EXECUTE directive. Subsequently instructions are obeyed one after the other in increasing order of their addresses. Breaks in this sequence are caused only by jump instructions. Execution of the program normally ends when a STOP instruction is obeyed, at which point the console message HALTED HH is given. (See section 10 for a summary of all program stops.)

### 2.5 Input and Output¶

Input and output of data at the interpreter stage can be on any of the following media:

• cards,
• paper tape,
• line printer,
• magnetic tape,
• exchangeable disc store

The peripherals required at this stage are specified by ARD and AWD instructions.

In addition to the above, the compiler requires one input peripheral during the assembly stage, and one output peripheral which will be retained for the whole run. The input peripheral may be either a card reader or a paper tape reader and is used for reading the City and Guilds program into store. The output peripheral may be either a line printer or a paper tape punch and is used for the following:

1. An optional listing of the City and Guilds program during the assembler stage
2. Titles output during the assembler stage as the result of (TITLE) directives (see section 2.8).
3. An optional trace listing during the interpreter stage (see section 11).
4. Any console HALTED messages output during the compilation and running of the program are duplicated on the assembly time output peripheral.

The assembly time input and output peripherals are selected by switch settings before entering the compiler. The same peripherals may be used for this purpose and for reading or writing data during the interpreter stage.

### 2.6 Character Set¶

The characters available in a City and Guilds program or in its data, and the values given to these characters when read into the City and Guilds store, are as follows. Characters are punched onto paper tape in standard 1900 eight-track code, and on cards in the 1900 card code.

Character C & G value Character C & G value
0 to 9 0 to 9 ; 50
A to Z 10 to 35 < 51
+ 36 > 52
- 37 ? 53
. 38 ! 54
, 39 55
( 40 # 56
) 41 % 57
New line 42 & 58
?? 43 59
, 44 * 60
space 45 / 61
46 @ 62
= 47 ?? 63
£ 48 (EOB mark) \$ 64
: 49

### 2.7 Instructions¶

C & G instructions are written, one to a line (or card), in the form:

F   n,m

 F The function part consists of 3 or 4 letters and specifies the operation to be performed by the instructions. n The address part is an integer in the range 0 to 999. The significance of n depends upon the instruction. m The modifier digit usually specifies the address of one of the locations 0 to 9. (exception: the WNA instruction).

If a Q is written before the function part certain information is output after the instruction is performed. For details of this tracing facility see section 11.

For most instructions n and m specify the C & G store address n+(m), where (m)=contents of word m. Thus, if word 2 contains 40, the address specified by 60,2 is 60 + (2) = 60 + 40 = 100.

Full details of the instruction code are in section 7.

### 2.8 Directives¶

 (TITLE) Output to the assembly time peripheral the line following the title directive. (STORE n) Commence storing program at location n. A STORE directive must precede any program to be stored. A program can contain any number of STORE directives. If no STORE directive is given assembly will not flag it as an error, but the results of executing the assembled program are unpredictable. (EXECUTE n) Begin execution of the program with the instruction stored at location n. Exactly one EXECUTE directive is required and it must be input as the last line of the program. If there is no EXECUTE directive, assembly will continue to search for one, with varying results (e.g. tape reader FIX). (WAIT) Stop assembly of the program for insertion of another tape in the tape reader(or another pack of cards in the card reader). Continue assembly on GO when the tape (or pack of cards) has been inserted.

### 2.9 Numbers¶

All numbers are held in floating point form to an accuracy of six significant decimal digits (in some cases seven). Numbers in the approximate range -1076 to 1076 can be dealt with.

## 3. Program Preparation¶

Blank lines or cards in the program or lines containing only spaces are ignored, unless one occurs immediately after a TITLE directive.

### 3.1 Directives¶

Each directive must be enclosed in brackets and must appear on a separate line or card.

Any number of spaces may appear before the left bracket or after the right bracket, although none are required.

No spaces are allowed before the directive word or within the directive word.

No spaces are allowed in the WAIT or TITLE directives between the directive word and the right bracket.

At least one space (any number is permitted) must appear in STORE and EXECUTE directives between the directive word and the integer n.

The integer n in the STORE and EXECUTE directives must consist of from 1 to 3 characters. Leading zeros are permitted. No spaces are permitted between the digits of n. n must lie in the range 0 to 999.

The single line following the TITLE directive is output (when it is read by the assembly program) on a line to itself.

### 3.2 Instructions¶

In general, instructions take the form:

NAME n, m


For example:

LDA 198,3


Each instruction must appear on a separate line or card.

Any number of spaces may appear before or after the instruction, although none are required.

No spaces are permitted

• between the letters of the function name
• between the function name and the query symbol Q, if the latter is present.

At least one space is required between the function name and the address n, although any number is permitted.

No spaces may appear between n and the comma or between the comma and m.

No spaces are permitted between the digits of n. n must consist of 1 to 3 digits. Leading zeros are accepted.

n must be in the range 0 to 999 and m must be in the range 0 to 9, and consist of a single digit.

If n and m are both omitted, the instruction is assembles as if n=m=0.

If m is omitted, the comma must be omitted as well.

If m is present, n must be specified even if it is zero.

### 3.3 Examples of Directives and Instructions¶

     (STORE 062)
(STORE 800)
(TITLE)
THIS LINE IS OUTPUT DURING ASSEMBLY
(EXECUTE 037)
(WAIT)
LDA
QLDA
QLDA 041
QLDA   003,6
QLDAN 999
SIN
RNA   4,6
STA  0,7


### 3.4 Numbers and Characters¶

Numbers and characters ma be input with the program to be stored in floating point form in the City and Guilds store.

Numbers to be stored with the program are punched as a sign (required) followed by a string of digits optionally containing a decimal point. Characters are punched as an = sign followed by the characters

Numbers and characters may not appear on a line (or card) that contains a directive or an instruction.

Numbers are terminated by one or more spaces or by the end of a line.

One or more numbers and/or characters may appear on a line.

Numbers and characters are stored in consecutive locations of the C & G store, each number or character occupying one location. If they are ‘executed’ as part of the program, the results are undefined.

### 3.5 Examples of Numbers and Characters Appearing With Program¶

(STORE 40)
=A =3 =4
+0 -01 -436.3
-.00000001234567
+123123123123123 -47 =?
LDA  40


## 4. Program Listing¶

If a listing of the City and Guilds program is desired, it may be obtained by starting assembly of the program with the console directive:

GO #XMS4 22


The listing is output at assembly time.

If a listing is not wanted, either of the console directives:

GO #XMS4 20
GO #XMS4 21


must be used.

### 4.1 Errors Detected During Assembly¶

Incorrectly punched lines of program detected at assembly-time are listed, regardless of whether listing has been requested.

Incorrect lines are listed with a row of asterisks underneath terminated by a question mark. The question mark will normally be directly beneath the next character to be read after the error was detected.

After detecting an error assembly continues to read the program for further errors and lists any it finds.

If errors have been detected when the EXECUTE directive that must end the program is found, assembly halts with the console message:

HALTED ZZ


and the program must be removed and corrected.

If the terminating EXECUTE directive is itself faulty (e.g. (EXECUTE 20)) or is missing altogether, assembly will continue to search for a correct EXECUTE directive.

### 4.2 Examples of Error Listing¶

Listing of program fault detected
STA598
***?
space missing
(EXICUTE 300)
*****?
mis-spelt directive word

### 4.3 Errors Detected During Execution¶

If the City and Guilds program computed a number that is too large in absolute value (approximately 1076 ) the program is halted and a console message is given. Similar action is taken if an attempt is made to refer to a non-existent City and Guilds store address. The details of these and other execution-time stops are summarized in section 10.

## 5. Data Preparation and Formats¶

The peripherals available for input and output of data during the interpretive stage are as follows:-

Input Output
Paper tape reader Paper tape punch
Magnetic tape Line printer
Exchangeable disc store Magnetic tape
Exchangeable disc store

Any character listed in 2.6 may appear in data. When a ‘£’ is found on reading a block, it will indicate the end of the block.

On all media except cards, blocks of data are variable length terminated by either a new line character or an end of block marker, and have a maximum length of 121 characters including the terminator.

Data being read from cards using the ‘RCH’ instruction will be treated as 80 characters followed by a new line. Data read from cards using ‘RNS’ instruction can be up to 80 characters followed by an end of block marker.

If the number of characters is less than 80, the end of block marker will appear on the card. If exactly 80 characters, the end of block marker will be supplied in the 81st position.

A block of data output to cards by ‘WNB’ will consist of a number of characters followed by the end of block marker. If the No. of characters is exactly 80, the end of block marker is not output.

A block of data can be output by a ‘WNL’ instruction; the new line will not be output and if there are fewer than 80 characters in the block, spaces will be added to make it up to 80 characters.

Data being read in from PT by ‘RNB’ should be terminated by an end of block character followed by a ‘crlf. Data being output by ‘WNB’ will terminate similarly.

Data being read in frm PT by ‘RCH’ or output by ‘WCH’ is terminated by ‘crlf’.

The compiler does not check the width of the line printer, so if a 96 print-position printer us used it is up to the user to ensure that blocks of data do not exceed this size.

Files on magnetic tape and exchangeable disc store are opened as scratch files. They may be used only for storing away data temporarily during the running of a program, and then reading it back in again later on in the same program. If an attempt is made to allocate one of these peripherals for reading, the compiler checks that it has previously been written to in the same run, ans if not, it treats the allocation instruction as being illegal. Similarly, any attempt to read more block of data than were written is illegal.

Data output to magnetic tape and exchangeable disc will be terminated by either , a N/L character or an end of block character, depending on whether ‘WNL’ or ‘WNB’, respectively, caused the data to be output.

A block may consist of numbers and/or strings of characters. Each number in the input data consists of a sign (optional) followed by a string of digits optionally containing a decimal point, and must be terminated by either a space character or the end of the block.

## 6. Input of Data¶

Input peripherals during the interpreter stage are selected by means of the ARD instruction. At least one such instruction must be obeyed before the first read instruction. More than one ARD instruction may be obeyed in a program, and the effect of all but the first is to release the current input peripheral and then allocate the one specified in the parameter.

If an ARD instruction reference a magnetic tape or an exchangeable disc store file which is currently allocated to the program as a write device, the compiler allocated it for reading, sets it to start reading at the first block, and leaves the program with no write device allocated.

If an ARD is used to change the read device, the next read instruction will start to read from the new device, so any data left in the input buffer from the previous device will be lost.

Once a read device has been allocated to a program, there are three instructions,RNA, RCH and RNB, for reading data from it. RNA and RCH both check whether there is a block in the input buffer, and if not, read the next block into it. If there is a block, they continue processing the same buffer.

RNA reads the first or next number from the buffer (provided numbers are punched as described in section 5), converts it to floating point form and stores it in the floating point accumulator A. If there is an impermissible character in the number, action is taken as described in section 7. Space characters before the number are ignored. If the new line character at the end of the input buffer is reached without finding the start of a number, the next block is read into the buffer and the first number is read from it. Exactly one terminating space or new line character is read after the number.

RCH reads the first or next character from the buffer, converts the value of the character (see section 2.6) to floating point form and stores it in the location n + (m). A new line is treated in the same way as any other character, except that the next read instruction will cause a new block to be read. An end-of-block character read by a ‘RCH’ will be treated as any other character.

RNB always reads a new block into the input buffer, so if it is used after an RNA or RCH instruction, it will overwrite any data remaining in the buffer. All the characters in the block, including the end of block character, are converted to floating point form and stored in one word each, starting at location n+(m).

There are three instructions, ACB, BSP, and RWD, which reposition the input data without reading any information into store. After obeying any one of these instructions, the next read instruction will always read a new block of data into the input buffer, so any data left in the buffer from a previous read instruction will be lost.

BSP and RWD are available on magnetic tape only, and will be treated as illegal if used when the current read device is not magnetic tape.

BSP causes the magnetic tape to be moved backwards over n+(m) blocks of data. Thus BSP 1,0 would cause the tape to be backspaced over one block, so the next read instruction would read in the same block as the previous read instruction.

RWD causes the magnetic tape to be rewound and positioned ready to re-read the first block of data.

The ACB instruction works in two different ways depending on the read device currently allocated. If the read device is exchangeable disc store, ACB specifies that the next read instruction is to access block n+(m). For any other read device, ACB causes blocks to be skipped in the input data, so that the block accessed by the next read instruction will be n+(m) blocks away from the previous block read. An ACB instruction with n+(m) equal to zero will be treated as illegal, whatever read device is allocated. If n+(m) equals 1, the block accessed will be the first block of data on exchangeable disc store, or the block following the one previously read on any other input device.

### 6.1 Output of Results¶

#### General¶

Output peripherals during the interpreter stage are selected by means of the AWD instruction. Any attempt to obey a write instruction when no write device is allocated will be treated as illegal.

The instructions available for outputting data are WNA, WCH, and WNB. WNA and WCH respectively put one number or one character into the output but do not cause the contents of the buffer to be output unless it becomes full. WNB moves a string of characters into the output buffer and immediately outputs it, followed by the end of block character. If PT, a ‘crlf’ is added.

The maximum number of characters which can be put into the output buffer is 121 including the terminating character unless the current output device is a curd punch in which case the maximum is 81 including the terminating character. If a 96 print position line printer is used, the number of characters output to a line should be kept to 96 or fewer. If more than 96 characters are output on one line, the first 96 will be printed and the remaining ones will be lost.

Spaces can be inserted in the output buffer using the WSS instruction. This instruction should be used in conjunction with the WNA and WCH instruction, and it causes n + (m) space characters to be put in the buffer (unless n+(m) equals zero, in which case, one space character is inserted).

Lines of data built up in the output buffer may be output either by using a WCH instruction to output a new line character or by using a WNL instruction which outputs n+(m) new line characters (unless n+(m) equals zero, in which case one new line character is output).

If a WNA, WCH or WSS instruction is obeyed an there is not room in the current output buffer for the number, character or spaces, the contents of the buffer will be output and a new buffer started. This is the only condition which can cause a buffer built up by WNA, WCH and WSS instructions to be output automatically.

None of the following combinations cause the present contents of the buffer to be output and in all cases, any information left in the buffer will be lost.

1. An AWD instruction is obeyed
2. A WNB instruction is obeyed
3. The write device of magnetic tape or exchangeable disc store is allocated as the read device, thus leaving the program with no write device
4. A JST or STOP is obeyed.

#### Character Output¶

The WCH instruction moves one character from location n+(m) into the output buffer. Location n+(m) must contain an integer in the range 0 to 64 and this will be output as the corresponding character (see section 2.6). If the contents of n+(m) are not within the required range, the instruction will be treated as illegal. If the character in n+(m) is the new line character, the effect of the instruction will be to output the existing contents of the buffer. If the character is not a new line but the buffer already contains 120 characters (or 80 if outputting to cards), the present contents of the buffer will be output and the character will be put into the buffer as the start of a new block.

The WNB instruction moves a string of characters, starting at location n+(m) and terminated by a new line character, into the buffer and writes it to the current output peripheral. If no new line character is found, 120 characters will be output (or 80 if outputting to cards), followed by a new line. If any location in the string does not contain an integer in the range 0 to 64, the instruction will be treated as illegal.

WSS puts n+(m) space characters into the output buffer except that if n+(m) is zero, one space character is inserted. If there is not room in the buffer for the specified number of spaces, the present buffer will be filled and output, and the excess spaces will then be put into the buffer as the start of the next block.

#### Number Output¶

The WNA instruction puts the contents of the accumulator A into the output buffer according to the format specified by n and m. Before the number is output it is rounded to the nearest decimal that will allow it to fit into the number of places specified by the format parameters n and m.

If the number to be output requires more character positions than remain in the current line, the current line is output with as much of the number as it will contain, and the excess characters are put into the buffer to form the start of the next block.

#### Formats for Number Output¶

Three types of output are available. In all cases a sign is output. Leading zeros are suppressed unless the integer part of the number is zero in which case one zero is output. A single space is output before each number as shown below.

1. Integer format: n ≥ 1, m = 0
Output the n+2 characters:
(space) ± (n-place integer)
2. Mixed number format: n ≥ 1, 1 ≤ m ≤ 9
Output the n+m+3 characters
(space) ± (n-place integer) . (n-place fraction)
3. Floating point number format: n = 0, 1 ≤ m ≤ 9
Output the m + 7 characters
(space) ± . (m-place fraction) E ± (2-place decimal exponent)

If n and m are both zero, a question mark is output, preceded and followed by one space.

If n is not large enough to accommodate the integer part of the number in the integer or mixed number formats, a space followed by a row of asterisks is output, occupying the same number of character positions as the number would have.

### 6.2 Examples of Number Output¶

The following table shows, for various values in the accumulator, the output produced by giving various different values to n and m

Value in A Instruction Output
0
WNA 1,0
WNA 2,1
WNA
_ + 0
_ _ + 0 . 0
_ ? _
-1.9
WNA 1,0
WNA 1,1
WNA 4,2
_ - 2
_ - 1 . 9
_ _ _ _ - 1 . 9 0
369
WNA 3,1
WNA 2
WNA 0,3
_ + 3 6 9 . 0
_ * * *
_ + . 3 6 9 E + 0 3
99.99
WNA 2,2
WNA 3,1
WNA 2, 1
_ + 9 9 . 9 9
_ + 1 0 0 . 0
_ * * * * *

## 7. Definitions of Instructions¶

### Notation¶

Small letters are used to denote a main store address and bracketed letters to denote the contents of an address. Thus n and m denote main store addresses and (n) and (m) respectively denote their contents. Similarly (A) denotes the contents of the accumulator A. C denotes the control register.

Instruction Operation Remarks
LDA n,m (n+(m)) → A Load operand into cleared accumulator
SUB n,m (A) - (n+(m)) → A Subtract operand
MUL n,m (A) × (n+(m)) → A Multiply by operand
DIV n,m (A) / (n+(m)) → A Divide by operand
LDAN n n+(m) → A Load integer into cleared accumulator
SUBN n,m (A) - (n+(m)) → A Subtract integer
MLTN n,m (A) × (n+(m)) → A Multiply by integer
DIVN n,m (A) / (n+(m)) → A Divide by integer
JUN n,m n+(m) → C Jump unconditionally
JEQ n,m if (A) = 0, n+(m) → C Jump if (A) = 0
JNE n,m if (A) ≠ 0, n+(m) → C Jump if (A) ≠ 0
JLE n,m if (A) ≤ n+(m) → C Jump if (A) ≤ 0
JGE n,m if (A) ≥ 0, n+(m) → C Jump if (A) ≥ 0
JLT n,m if (A) < 0, n+(m) → C Jump if (A) < 0
JGR n,m if (A) > 0, n+(m) → C Jump if (A) > 0
JSR n,m Link → 4; n+(m) → C Set link and jump. (Link is the address of the next instruction to be obeyed on return i.e. that immediately following the JST instruction).
JST n,m Wait: n+(m) → C Wait; jump to n+(m) on GO.
LOP n,m (5) - 1 → 5; if (5) > 0, n + (m) → C Jump if, after subtracting 1 from location 5, (5) > 0.
SQT n,m √ (A) → A If (A) < 0 and n+(m) = 0 stop program with console message HALTED OV. If (A) < 0 and n+(m) ≠ 0, jump to n+(m). In the latter case A is unchanged.
EXP n,m exp (A) → A If exp (A) > approx 1076 and n+(m) = 0, stop program with console message HALTED OV. If (A) < 0 and n+(m) ≠ 0 jump to n+(m). In the latter case, A is unchanged.
LGN n,m loge (A) → A If (A) ≤ 0 jump to n+(m) with A unchanged. If n+(m) = 0, however, stop program with console message HALTED OV.
SIN sin (A) → A
COS cos (A) → A
ARC arctangent (A) → A The result is between - π / 2 and + π / 2
ENT Integer part (A) → A e.g. ENT(3.4)=3, ENT(-3.4)=-3
ARD n,m

Allocate input device n+(m) to program. n+(m) must take one of the following values.

50 - magnetic tape
60 - exchangeable disc store

AWD n,m

Allocate output device n+(m) to program. n+(m) must take one of the following values.

20 - paper tape punch
40 - card punch
50 - magnetic tape
60 - exchangeable disc store
80 - line printer

RNA n,m Read number into A If an incorrect character is found in the number and n+(m) ≠ 0, jump to n+(m) with A unchanged. If an incorrect character is found and n+(m) = 0, halt with console message DF (data fault)
WNA n,m Output number from A The floating point number in A is converted to character form according to the format specified by n & m (see section 6.1). If n = m = 0, full precision floating point will be the format used. If the output buffer fills up, it is output and the remaining characters will appear in the next line.
RCH n,m Read one character into location n+(m) For set of permissible characters see section 2.6
WCH n,m Output one character from location n+(m) If n+(m) contains a new line character the current line is output. If the current output buffer is already full, it is output and the character will appear on the next line.
RNB n,m Read next block of characters into store beginning at location n+(m) A new block is read and all characters are transferred to store up to and including the end of block character.
WNB n,m Write a block of characters from store beginning at location n+(m) A new block is formed in the output buffer and characters are transferred until either an end of block character is encountered of the buffer becomes full. The block is then output automatically.
WNL n,m Output n+(m) new line characters If n+(m) = 0, one new line character is output.
WSS n,m Output n+(m) space characters If n+(m) = 0, one space character is output. If the output buffer becomes full, it is output and the remaining spaces will appear on the next line.
CNN n,m Convert character string beginning at location n+(m) to a number in A. The character string to be converted must consist of a sign (optional), followed by a string of digits optionally containing a decimal point. The number must be terminated by either a space or a new line character If any invalid character is found, the program will halt with the console message IL.
CNC n,m Convert number in A to character string beginning at location n+(m) The format of the number to be produced is specified in the same way as for number output (see section 6.1) except that the format parameters are contained in location 6 & 7. e.g. if (6)=x and (7)=y and both these values are non-zero, the character string produced will consist of the x+y+3 characters (space) ± (x-place integer) . (y-place fraction). If location 6 = location 7 = 0, a full precision floating number will be output.
ACB n,m Access block n+(m) on current input device If the current input device is exchangeable disc store, position it ready to read block number n+(m). For any out input device, skip forward over n+(m)-1 blocks. Illegal on any device in n+(m) = 0.
BSP n,m Backspace input device by n+(m) blocks Illegal if input device is not magnetic tape.
RWD Rewind input device and stop ready to read first block. Illegal if input device is not magnetic tape.
STOP Stop execution of program. Halts with console message HH. The program being executed is not restartable after obeying a STOP.

## 8. Arithmetic Underflow and Overflow¶

If a number smaller in absolute value than (approximately) 10-76 is generated by any of the arithmetic instructions, it is replaced by zero and the program continues. If a number is generated whose absolute value exceeds 1076 (approximately), the program is stopped and the console message HALTED OV is given. The program cannot then be continued.

## 9. Summary of Assembly-time Stops¶

Console Message Meaning Action
EA End of assembly, no errors in format. GO to execute C&G program.
ZZ End of assembly, format error(s) detected. Correct program and reassemble.
WT WAIT directive in program. Insert further program tape and GO to continue reading program.
OV Absolute value of number appearing with program exceeds 1076 (approx). Correct program and reassemble.
NS No (STORE N) parameter before first C & G instruction. Correct input and reassemble.
CR)
TR)
TP)
LP)
The compiler has tried unsuccessfully to pick up the assembly stage input or output peripheral. Make the requested peripheral available and GO.

## 10. Summary of Execution-time Stops¶

Console Message Meaning Action
HH End of execution. None.
ST JST instruction executed. GO to continue execution.
DP Error in number read by RNA instruction. Correct data and rerun.
OV Floating point overflow. Correct program and rerun.
AD Attempt to refer to a C & G store address not in the range 0 to 999. Correct program and rerun.
IL Illegal C & G instruction Correct program and rerun.
CR)
TR)
CP)
TP)
LP)
ED)
The compiler has tried to unsuccessfully to pick up a peripheral requested by an ARD or AWD instruction. Make the requested peripheral available and GO.

All the above HALTED messages at both assembly-time and execution time are output to the assembly state output peripheral as well as to the console typewriter. All the execution messages except HH are output in the form:

HALT XX NNN


where XX is the two-character message as output to the console typewriter and NNN is the address within the City & Guilds store of the instruction which was being obeyed and which caused the message to be produced.

If a line printer is being used as the output peripheral for either the assembly stage or interpreter stage, and the paper runs out, the message:

DISPLAY:- PL


is output to the console typewriter, and the printer is disengaged. The console message is not duplicated on the assembly-time output peripheral.

## 11. Program Tracing¶

The course of execution of a City & Guilds program may be traced by arranging that information be output to the assembly stage output peripheral each time certain instructions in the program are executed.

The instructions to be traced in this way are identified by writing the letter Q immediately before the first letter of the instruction name (e.g. QLDA 129).

The trace information is output provided that the program is assembled using entries 21 or 22. If entry 20 is used, the queried instructions are executed but no tracing is obtained.

Any City and Guilds instruction may be ‘queried’ in this way.

The information is output after the queried instruction has been executed.

The trace printing is the same for all instructions and consists of the letter Q followed by the address of the queried instruction followed by the contents of the accumulator A printed in floating point form to 6 significant figures.

Example: If location 190 contains the instruction ‘QLDA 300’ and location 300 contains the number -329.46, the trace information output after the instruction is performed will be:

Q190 -.329460E+03


## 12. Summary of Entries to Assembly¶

The listing of the City and Guilds program during the assembler stage, and the program tracing during the interpreter stage are both optional and depend on the entry point used as follows:

Listing Program tracing
GO #XMS4 20 No No
GO #XMS4 21 No Yes
GO #XMS4 22 Yes Yes

The input and output peripherals to be used during the assembler state are specified by means of switch settings in the compiler.

If no switches are on, a card reader will be used for input and a line printer will be used for output.

ON #XMS4 20


To use a tape punch instead of a line printer for output, type:

ON #XMS4 21


## 13. Operating Instructions¶

2. Type:

LOAD #XMS4 n


where n is the absolute device number of the appropriate reader.

3. If paper tape input and/or output is required during the assembly stage, type:

ON #XMS4 20 and/or 21

4. Load the City and Guilds program in the paper tape or card reader.

5. Type:

GO #XMS4 n


(see section 12)

6. Await:

HALTED EA


(see section 9)

7. Load any input data and peripherals required for the execution of the program.

8. Type:

GO #XMS4

9. Await:

HALTED:- HH


(see section 10)

To run any further programs, repeat steps 3 to 9.

Note

Originals: C&G Mnemonic Code contains page images of the original document from which the above information was extracted.