Atlas 1 Emulator Tutorial

More Development Facilities

In this section we continue using the primes program to illustrate a set of development/debugging facilities which are available in the emulator but which were absent from the real Atlas 1.

Stepping Through the Program

Returning now to the point at which execution first paused at a breakpoint we might, instead of clicking , have clicked . The emulator will react to this by obeying just one instruction and then pausing again. In this way we can follow closely the sequence of instructions and examine what the program does in very fine detail.

Stepping Through the Extracodes

In addition to its repertoire of 90 hard-wired instructions, Atlas 1 had an additional set of 272 “pseudo-instructions” known as “Extracodes”. Extracodes were not really instructions at all, but were actually subroutines stored in “Fixed Store” – an early form of read-only memory (ROM). Whenever the processor encountered an Extracode in an instruction (recognised by the presence of a 1 in bit 0) it would enter the corresponding subroutine in the fixed store.

Within the emulator there exists an area of store, not usually visible to the programmer, in which the instructions for each of the Extracodes is held. Not all of the Extracodes are executed in this way in the emulator, some are implemented as if they were “normal” instructions, but most of the Extracodes are authentically implemented.

It is possible to follow execution of authentically-implemented Extracodes in the emulator just as before, although it is optional. From the main window, select View/Supervisor Store. Six pages of the fixed store will appear together with one page of “scratch space” known as “Private Store”.

If we mark page 1: word 1 as a breakpoint as before, then click followed by two clicks of you will notice page 2049: has changed colour.

What is going on here? The 1362 Extracode has been entered. 1362 is a mechanism for entering a normal subroutine. It sets B127 to the value of the (modified) address field after having saved the return address (which, of course, it finds in B127) to B90. It can do this only because, once we are in an Extracode, the control register is B126 which (normally) leaves B127 undisturbed, ready to carry on where it left off when the Extracode is finished. This case, however, is an exception.

So clicking page 2049: and scrolling down to word 306 (which we get from the displayed value of B126) we see that the next instruction to be obeyed (marked in blue) is 0121 90 127 0.0 or “Set B90 to B127”.

The following instruction is 0521 127 119 0.0 which sets B127 to the value of B119 (which was given the value of the modified address of the 1362 instruction when Atlas 1 entered Extracode control). You will notice that the second instruction is 0521 rather than the expected 0121. The function of the otherwise unused bit 1 is to signal that the Extracode has completed its work and normal processing can be resumed starting with the instruction to which B127 points – the first instruction of the subroutine we were trying to call.

The Trace File

The next element in this description of debugging/demonstration aids is the trace file. Following execution of a program one instruction at a time might, when the program spans many millions of instructions, be regarded as a touch impractical. At any point when the emulator is waiting for the user to do something (e.g. at the start or at a breakpoint) you may click View/Trace File. You will be asked where you would like to put the trace file and then we can resume....

Here is a sample of the trace file from the primes program –

     1:1.0  = 0101,   1,   0,  1:0.0 | B1:=    1:488.0 ; 
     1:2.0  = 1362,   0,   0, 1:59.0 | B126:=2049:306.0 ; B119:= 1:59.0 ; B121:= 0.0 ; 
2049:306.0  = 0121,  90, 127,    0.0 | B90:=   1:3.0 ; 
2049:307.0  = 0521, 127, 119,    0.0 | B127:=  1:59.0 ; 
    1:59.0  = 0113,  90,   0, 1:77.4 | 1:77.4:= 1:3.0 
    1:60.0  = 0121,  10,   1,    1.0 | B10:=  1:489.0 ; 
    1:61.0  = 0121,  11,   0,   -0.1 | B11:=     -0.1 ; 
    1:62.0  = 0121,  16,   0,    0.0 | B16:=      0.0 ; 
    1:63.0  = 0113,  11,  16,  8:0.0 | 8:0.0:=   -0.1 
    1:64.0  = 0122,  10,   0,   24.0 | B10:=  1:465.0 ; 
    1:65.0  = 0124,  16,   0,    0.4 | B16:=      0.4 ; 

and so on.

Modifying the Program During Execution

Finally, you will recall that when we wanted to mark a word in store as a breakpoint, we clicked it. Double clicking a word does something different. A dialogue is opened in which the chosen word is displayed in various ways

You may recognise page 1: word 1 of the primes program. You may modify any of the values in the input fields and, as you do so, the other input fields are updated to correspond. Click OK when you're satisfied.

A similar facility is available for the B-Register display in the main window.

Taking a Checkpoint

Whenever the program comes to rest, most usually at a breakpoint which you may have set, you have the opportunity to take a checkpoint of the current state of the program. Select Action/Checkpoint and then select a file name to contain the checkpoint. The file will contain an octal display of all the non-default valued store locations in use and any non-default valued registers.

Here is a sample checkpoint taken after just one instruction of the Hello World program has been obeyed.;

04040200 00010030
43300200 00010034
44740000 00000000
00000014 50455454
57016757 62544421
B1 = 00000014
B124 = 60000000
B127 = 00010010

Although it may be useful to be able to examine the state of the program for diagnostic purposes, the information displayed is the same as that which is available in a more user-friendly style using facilities in the emulator which have already been described.

Sometimes, however, it may be useful to compare the state of the system between two runs of the same or a very similar program. This may be accomplished by checkpointing them both at the same point and comparing the checkpoint files using a suitable utility such as Notepad++.

Finally, the checkpoint file may be read back into the emulated Atlas 1 using the non-authentic compiler RESTART. Details of the restart compiler may be found using the RESTART compiler link below.

Where to go next
Back to the Primes Program RESTART compiler Home