Atlas 1 Emulator Tutorial

HELLO WORLD in Depth

Atlas Instruction Format

Atlas instructions were written in the form –

     function  Ba  Bm  Address
    

Function is a 10-bit octal field which defines to the computer the operation to be carried out.

Ba and Bm are 7-bit decimal fields each specifying which of 128 B-registers is to be used in the instruction (B0 is always 0).

Address is a 24-bit field specifying an integer or an address to be used in the instruction (see below for more detail).

In some instructions (mainly floating point operations) the values contained in both Ba and Bm are used to modify the address. In most other instructions (commonly integer operations) Ba is used as an operand and Bm as an address modifier. In a few types of instruction, both Ba and Bm are operands.

The HELLO WORLD program explained

Here is the source code file again –

     JOB
     HELLO WORLD
     OUTPUT
     0 ANY 100 LINES
     COMPILER ABL
         0101  1  0  A9
         1066  1  0  A9+0.4
         1117  0  0  0
     9)  CT2.1
     HELLO WORLD
         EA0
     ***Z
    

The Job Description

The first five lines comprise the Job Description. The first two lines tell us that we are dealing with a job and give it an identifying name. In this example the 3rd and 4th lines tell us that there is to be some output on logical channel 0 (the default channel) which is not to exceed 100 lines and which (in the real Atlas 1) could appear on ANY output peripheral. In the emulator we have taken the peripheral type ANY to mean that the output should appear in a host system window but will otherwise have the characteristics of output to an 80-column card punch.

The 5th line COMPILER ABL tells the system that the programming language employed here is ABL – Atlas Basic Language – the standard assembler for Atlas 1.

The last line ***Z is a terminator which indicates to the Supervisor that the input document is complete. The Supervisor removes both the job description and the terminator so that only the program source code and/or any data remain.

The Program

This leaves us with the text of the program itself.

The line which reads 9) CT2.1 tells the ABL compiler what to do with the following line. The 9) is a label. The T tells the ABL compiler that the following line is to be interpreted as a text string. The 2.1 is a carriage control character to be added onto the end and means one new line. Lastly, the C instructs the compiler to precede the string with a halfword containing a character count.

Looking now at the line 0101 1 0 A9, this is an instruction which reads the contents of the halfword at the label 9) into 24-bit register B1. This, it will be remembered is a character count = 12 characters (11 for the text + 1 for the carriage control character), but it is stored as a 24-bit integer.

The next instruction 1066 1 0 A9+0.4 is a print instruction which tells us to print the number of characters held in the B1 register (=12) starting from the next halfword in the store (the 0.4 adds 1 halfword address to the value of the label). The last character is not to be printed but is interpreted as a carriage control character.

The 1117 0 0 0 instruction tells Atlas 1 that the job is finished and that its resources can be released

Finally, the purpose of the EA0 is to tell the ABL compiler that the end of the source program has been reached and that the translated program should be entered at label 0) which doesn’t actually appear in the source text, but is implied to mean the first line of the program.

Some Thoughts on Number Format

Atlas store was based on 48-bit words grouped into 512 word pages. A word could hold and instruction or a floating point number but could also be divided into two 24-bit halfwords or eight 6-bit characters. A halfword commonly held an integer or an address (the 128 “B-Registers” were all of halfword length).

When we write integers in Atlas Basic Language (ABL) we have a wealth of formats available to express a halfword value. The full repertoire can be studied at http://www.chilton-computing.org.uk/acl/literature/manuals/atlas/p010.htm but here we will confine ourselves to the forms which the emulator employs in its displays.

Consider the number 1028.6. The 1028 is a decimal integer which is held in the leading 21 bits of a halfword. The .6 is an “octal fraction” held in the bottom 3 bits.

When we use this value as an address, what we mean is character 6 (starting from 0) in word 1028. Or, to put it another way character 2 of halfword 1 in word 1028.

But we can also express this as 2:4.6 meaning character 2 of halfword 1 in word 4 of page 2. All these forms are equivalent and amount to the same value.

The final form we will consider here is the left-justified octal form. The left octal form is always recognised by being preceded by a “J”. Expressing 1028.6 in this form gives us J00020046. It is not necessary to employ the full 8 octal digits, but zero right padding will be understood if not.

When we refer to page numbers we sometimes use the form 2: to mean page 2.

Where to go next
Back to “Hello World” Home