Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ PrefaceContentsNote on certain Supervisor features1. Presenting an Algol Program to Atlas2. Variations on Algol 603. Monitor printing and fault diagnosis4. Code procedures5. Input and Output6. Miscellaneous programming notes □ Appendices and indices □ A1. ICT 7-track punched tape codeA2. Hardware representationA3. Fault tableA4. Standard functions and system proceduresIndex to Supervisor and compiler printingsGeneral index
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLLiteratureAtlas manualsAlgol :: ATLAS 1 COMPUTER ALGOL REFERENCE MANUAL
ACLLiteratureAtlas manualsAlgol :: ATLAS 1 COMPUTER ALGOL REFERENCE MANUAL
ACL ACD C&A INF CCD CISD Archives
Further reading

Preface
Contents
Note on certain Supervisor features
1. Presenting an Algol Program to Atlas
2. Variations on Algol 60
3. Monitor printing and fault diagnosis
4. Code procedures
5. Input and Output
6. Miscellaneous programming notes
Appendices and indices
A1. ICT 7-track punched tape code
A2. Hardware representation
A3. Fault table
A4. Standard functions and system procedures
Index to Supervisor and compiler printings
General index

4 Code Procedures

The compiler will accept a procedure whose body is written in a form of machine code. This chapter gives details of the syntax and semantics of such procedures. A knowledge of Atlas machine code is assumed.

4.1 Code procedure bodies

4.1.1 Syntax (c.f. (5.4.1))
<binary digit>::=0 | 1 
<octal digit>::=0|1|2|3|4|5|6|7 
<octal number>::= <octal digit> | <octal digit> <octal number>
<address primary>::= <unsigned integer> |<unsigned integer>.<octal digit> | *<octal number> | (<code label>)
<address>::= <address primary> | <adding operator> <address primary> |<address> <adding operator> <address primary>
<code label>::=<unsigned integer> 
<unlabelled halfword>::= <address>
<halfword>::= <unlabelled halfword> | <code label> <halfword>
<function digits>::= <binary digit> <octal digit> <octal digit> <octal digit> |<octal digit> <octal digit> <octal digit>
<machine instruction::= <function digits>,<unsigned integer>,<unsigned integer>,<address>
<code instructions>::= <function digits>,<unsigned integer>,-,<identifier>
<halfword pair>::= <unlabelled halfword> / <halfword> 
<fullword number>::= <adding operator> <unsigned number> 
<array instruction>::= B79 = ADDRESS OF <subscripted variable> 
<dummy item>::= <empty>
<unlabelled item>::=<machine instruction> | <code instruction> | <halfword pair> | < fullword number> | < array instruection> | <dummy item>
<item>::= <unlabelled item> | < code label>:<item> 
<code tail>::= <item> end | < item>;<code tail> 
<code>::= begin code <code tail>

Spaces and newlines are ignored, as elsewhere in an Algol program.

4.1.2 Examples
addresses:
39.4
-0.1+*4-(l8)+3 
items:
    101, 10, 11, (3) 
 1: 121, 12, -, V17a 
 2: *77+(3)/3:4:0.2
    +9.34α +10
55: B79 = ADDRESS OF x[sin(n*pi/2),Q[3,n,3]] 
procedure declaration:
integer procedure sign (E);
value E; real E;
begin code  324, 0, -, E;
            234, 127, 0, (1); 
            237, 127, 0, (2);
            324, 0, 0, (3); 
            121, 127, 0, (1);
        3: +1;
        2:  325, 0, 0, (3); 
        1:  356, 0, -, sign 
 end
         

The last example is the procedure declaration for the procedure sign, which forms part of the permanent material.

4.1.3 Semantics
4.1.3.1 Machine Instructions

These have the form F, Ba, Bm, S and compile into straightforward machine instructions. Any assigned instruction or extracode is allowed as F. Ba and Bm are taken modulo 128.

The address S is a linear sum of 24-bit elements; each element can be a 21-bit unsigned integer with or without a 3-bit octal fraction, an octal number of up to 8 digits, or a full-word or half-word address within the procedure body, given by a code label.

4.1.3.2 Code instructions

These have the form P, Ba, -, <identifier>. F and Ba are as for machine instructions. An instruction of this form compiles into a machine instruction with suitable Bm and address, and gives access to the stack position or operand area of global variables, and to the formal parameters of the procedure. This is useful only for simple variables of real and integer types which are either global to the procedure or are formal parameters called by value, and for type procedures (including the procedure itself if it is a type procedure) of real and integer types. The information obtained from the access is insufficient to handle labels, procedures other than type procedures, formal parameters called by name, or subscripted variables.

The representation of numerical values of quantities in Atlas 1 is described in section 6.1.

4.1.3.3 Half word pairs

These have the basic form S/S, and compile into 24-bit half words forming one 48-bit word. Anything allowable as an address S in a machine instruction can be written as a half word, and is compiled in the same way.

4.1.3.4 Fullword numbers

These have the form ±K, where K is an unsigned Algol number as defined in (2.5.1). They compile into standardised Atlas floating point numbers, see CS 348A, section 3.1, and section 6.1 of this manual.

4.1.3.5 Array instructions

The array instruction compiles to a variable number of machine instructions, depending on the subscript list. It sets in B79 the address of the subscripted variable, and a subsequent 334, 0, 79, 0 will pick up the value of the subscripted variable. The values of array elements are stored consecutively with the last subscript varying fastest, so that e.g. if q is declared as q[O:9,0:9,O:9] then after an array instruction

            B79 = ADDRESS OF q [0, 0, 0] 

has been obeyed the address of q[i, j, k] is b79+i+10j+100k.

The value of the elements of an array are represented in the same way as simple variables (see 4.1.3.2 above).

4.1.3.6 Dummy items

A dummy item is not compiled.

4,1.3.7 Code labels

A code label is an unsigned integer L in the range 0≤L≤127. It is represented in Atlas as the 24-bit fullword or halfword address of the item (machine instruction, code instruction or fullword number), of the halfword (either of a halfword pair), of the first instruction of the item (array instruction), or of the next non-dummy item to the item (dummy item) to which it is prefixed. If a label is prefixed to a dummy item and no non-dummy item follows, then a jump to that label is an exit from the procedure. Code labels are local to the surrounding procedure body.

4.1.3.8 Entry and exit

The procedure is entered at the item immediately following the symbol code, and the last (possibly dummy) item obeyed before exit is that immediately preceding tbe symbol end.

4.2 Code procedure calls (c.f. (4.7.8))

All restrictions imposed on a procedure statement or function designator calling a procedure with an Algol body apply to a call of a procedure with a code body.

⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site