
                PEGEM Mk 1 - The Pegasus Simulator
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      Issue 13, 16 January 1995 

         Chris P. Burton, Llansilin, Oswestry, SY10 9BN, UK
                       Tel +44 (0)1691 791274
                     chris@envex.demon.co.uk

This is the manual for the Mk 1 simulator of the Ferranti Pegasus 
Computer. The simulator runs under MS-DOS on industry standard PCs.
The manual explains how to operate the simulator software, but for
the most part does not say very much about the way Pegasus works or
is operated. For that information see Pegasus' own documentation,
in particular "The Pegasus Programming Manual" by George E. Felton
and published by Ferranti Ltd. in 1962.

The Mk 1 simulator is controlled by using the PC keyboard, and has 
been in development since May 1991. There are still many places 
needing enhancement or improvement, but most of these improvements 
have been deferred to the Mk 2 simulator, which is mouse-driven, and 
therefore smoother to operate. The Mk 2 simulator is not yet ready 
for issue.

CONTENTS                                              Page

1   WHAT IS PEGASUS?                                    2

2   OVERVIEW OF PEGEM                                   4

3   INSTALLATION                                        5

4   OPERATION OF THE SIMULATOR                          6

5   CONFIGURATION SET-UP                               13

6   SIMULATOR REFERENCE GUIDE                          16

7   PREPARATION OF PAPER TAPES                         19

8   HISTORY AND ACKNOWLEDGEMENTS                       20

9   REFERENCES                                         21

APPENDIX 1  - NOTES ON THE DEMONSTRATION PROGRAMS      22

APPENDIX 2  - PEGASUS PAPER TAPE CODE                  24

APPENDIX 3  - PEGASUS ORDER CODE                       25

APPENDIX 4  - PEGASUS LIBRARY PROGRAMS                 28

APPENDIX 5  - PEGASUS UTILITY PROGRAMS                 30


                 Copyright  (c)  1995    Chris P. Burton

===========================================================================
     
                                1

                         WHAT IS PEGASUS?

Ferranti Ltd was one of the first manufacturers in the United Kingdom 
to build computers, forming a relationship with the pioneering work at 
the University of Manchester as early as 1949. One of the other 
companies in the field, Elliott Brothers of Boreham Wood, had National 
Research and Development Corporation support to build a prototype 
machine, the Elliott 401, to prove some circuit designs and packaged 
construction techniques. The lessons learned from that prototype led 
Christopher Strachey, William Elliott and others to specify a much 
improved design, and the NRDC asked Ferranti to build and sell ten of 
these, originally called Ferranti Packaged Computer No. 1 (FPC1) and 
soon afterwards renamed Pegasus. Ultimately, forty machines were built 
and delivered between March 1956 and October 1962. Machine number 25 
is still working and in the possession of the Science Museum, London, 
as is the Elliott 401. Another early Pegasus is in the collection of 
the Museum of Science and Industry in Manchester.

Pegasus had two major characteristics: a brilliant, economic, 
engineering construction, and a "programmer-friendly" functional 
design, ahead of anything else of its period. Without exception, 
former Pegasus programmers comment on how clean the design was, 
leading to quick programming with few errors. It must be remembered 
that there were few aids to productivity in those days, not even a 
mnemonic assembler. Programmers very often punched-up their own 
programs, in a mixed octal and decimal notation, and then would 
probably debug them by hands-on operation at the control desk.

The earlier Pegasus machines only had paper-tape input and output. 
Later, magnetic tape was available and  Pegasus 2 was developed to 
handle punched cards. PEGEM, this simulator of Pegasus, represents a 
Pegasus 1 with some minor exceptions.

A Pegasus 1 has three cabinets in line, each 30 inches wide and about 
6 feet 6 inches high, with open-circuit air-cooling, although closed-
circuit refrigerated air-cooling was available, and was standard on
the later four-cabinet machines. Forming a tee across the end of the 
row of cabinets is the control desk, with two 200-characters per second 
paper-tape readers on the left side, and a paper-tape punch on the 
right. The output tape from the punch, at 33 characters per second, is
led to a tape-reader which is directly connected to a teleprinter which
in turn operates at 7 characters per second. Thus there was effectively
an output buffer, namely the loop of paper tape between the punch and
the teleprinter. In front of the operator is a Monitor Panel with two
cathode ray tubes displaying selectable data in binary, and a number of
neon lamps and switches. Below the monitor panel is a sloping Control
Panel with key-switches for entering data, and for controlling the
operation of the machine. Lastly, under a flap in the desk top is an
Engineer's Panel, with meters and control switches for use by the
maintenance engineer. Power supplies for the system are provided in a
further two cabinets, in turn supplied from a 15kVA motor alternator
set which provides some stabilisation and isolation from noise spikes
on the mains supply.
Inside, at the bottom of the first computer cabinet is a magnetic drum 
store, and the remaining space in the cabinets is occupied by a total 
of 24 shelves each containing 20 plug-in electronic packages. A 
package is an insulating panel about 6 inches by 5 inches holding 
electronic components, with an aluminium panel attached carrying up to 
three valves (vacuum tubes). The packages plug into sockets in the 
shelf, and are easily removed and replaced. This method of 
construction led to a greatly improved availability of the machine 
compared with its contemporaries, as faulty packages could be quickly 
replaced, and more important, scheduled cycling and testing of batches 
of packages could assist off-line location of incipient faults. 
Substantial parity and other checks internally also helped assure 
reliable working. 

The electronic circuits were based on the excellent designs of Charles 
Owen for the Elliott 401. They enabled logic designers to forget the 
technical details and specify logic networks of elements which worked 
predictably without tweaking. Typically for their era, these were 
serial machines, operating at 3 microseconds pulse period, with pulses 
on a baseline of about -10V and rising to about +13V. Logic gates were 
germanium diodes, followed by amplitude and time standardising 
amplifiers. Storage was either in acoustic delay-lines using magneto-
strictive nickel, or else on the magnetic drum. The word length was 
39 bits plus 3 inaccessible bits in the gap between words. 

The order-code of Pegasus is one and a half address, with most 
instructions specifying both a storage location and one of seven 
internal registers, or accumulators. There are only 55 words in the 
computing store, using delay lines. The main store, on the drum, held 
initially 4096, later 7168, words available to the user, plus 1024 
words of Initial Orders or Engineer's Tests. Efficient instructions 
allow blocks of words to be transferred between the main store and the 
computing store. Each instruction is 19 bits long, and two are held in 
one word, the a-instruction and the b-instruction. Thus substantial 
program loops can be executed in the computing store without recourse 
to transfers from the drum main store. 

One further item of equipment to note is the Tape Editing Set. A 
typical Pegasus installation would have had at least two of these. It 
was a desk supporting a keyboard teleprinter, a paper-tape re-
transmitter (a mechanical tape-reader) and a control box. The tele-
printer was fitted with a re-perforator (punch) and paper tapes 
could be prepared, duplicated and edited using combinations of the 
equipment. So for example, programs would be punched-up at this 
equipment, and Pegasus output results could be printed out off-line 
from the computer. It was common also to find a simple keyboard-
perforator, without any printing facilities, situated near the Pegasus 
where an operator could punch short lengths of tape for patching 
programs, inputting steering data and so on.

===========================================================================
         
                              2

                       OVERVIEW OF PEGEM

This simulator is intended to give the user the look and feel of 
sitting at the control desk of a real Pegasus. The graphic 
capabilities of the VGA screen are exploited to give a reasonably good 
rendering of the appearance and colouring of the real thing. This Mk I 
version is provided with the essential components, but refined 
features such as panning to view the Ferranti electric clock on the 
cabinet end-panel have been deferred to a later issue. 

Within the limitations of the 640 x 480 VGA screen resolution, the 
following are represented. In the centre is the Monitor Panel, with 
the Control Panel below it. To the left are the two paper-tape 
readers, and above them is a metal cabinet with drawers containing 
paper-tapes. On the right of the display screen is a waste bin in 
which to put unwanted output tapes, and the paper-tape punch. The 
output tape from the punch runs down to the teleprinter placed at the 
bottom of the screen. Unfortunately, due to the 2-dimensional nature 
of the screen, the teleprinter cannot be positioned well to the right 
where it is in real life. On the screen it is located where the 
Engineer's Panel would be, and the latter is not implemented. 

Also on the screen is an image of a human hand with outstretched 
finger ready to point at, or to operate, objects on the screen. The 
finger can be moved about on the screen by manipulating cursor control 
keys on the PC keyboard. ALL INTERACTION WITH THE SIMULATED PEGASUS IS 
DONE BY MOVING THE FINGER TO AN OBJECT AND MANIPULATING THE OBJECT. 
The user of the simulator soon gets the feeling that the finger is an 
extension of his or her own hand, and that he or she is operating 
Pegasus, not the PC. There are some trivial exceptions to this 
principle for expediency; for example to write a tape name on a tape, 
we don't actually grab a pencil and move that on the tape, but type 
the name on the keyboard.

Almost anything that a programmer can do to operate a Pegasus can be 
done on the simulator. For example, any location in the Computing 
Store may be examined on the monitor CRT, instructions may be obeyed 
manually from the hand-switches, the machine may be single-stepped and 
so on. Some engineering facilities are currently omitted. Behind the 
graphic representation of the physical Pegasus, the full functionality 
is emulated. In a typical session, a paper tape may be selected from a 
drawer, placed in a tape-reader, the built-in Initial Orders of 
Pegasus invoked to read the tape and assemble the program on the drum, 
the program may be run, and output results punched, then printed out 
on the teleprinter. Output tapes may be torn-off, labelled and put in 
a drawer. The speed of the simulator is comparable with the speed of 
the original machine when hosted on a moderately fast '386 PC.

It is possible to re-direct output from the simulated machine to a 
real printer attached to the PC, in addition to or alternative to the 
simulated tape-punch. This is a very convenient facility for debugging 
Pegasus programs, compared with the delayed printing available on a 
real Pegasus.
Pegasus has a good-quality loudspeaker, the hooter, which may be 
connected to any waveform in the machine by means of a "noise probe". 
In PEGEM, the PC loudspeaker is "connected" to the K waveform in the 
multiplier logic, the waveform which is most often used in practice. 
Additionally, a click is sent to the PC loudspeaker whenever a 
simulated mechanism moves, to represent the sound of that mechanism in 
real life.

===========================================================================

                               3

                          INSTALLATION

The simulator requires an IBM PC/AT or compatible, and a 33MHz 386 or 
better is recommended. A 16-colour VGA graphics adapter is essential, 
and about 500kB of hard disc space. PEGEM is supplied as a set of 
files on a diskette, and it will run, though with very reduced 
performance, from the diskette. You are recommended to copy everything 
to the hard disc. The steps are:

1.  Insert disc in drive A:.  Log to the A: drive by typing  a:  followed
    by the Enter key.

2.  Type the command    install    followed by the Enter key.

3.  When the files have been copied, remove the diskette and store 
    away safely.

Directory Structure
~~~~~~~~~~~~~~~~~~~
All the program and text files are kept in the directory \PEGEM. There
are several sub-directories to \PEGEM each of which may contain up to
twenty files, each of which represents one Pegasus paper tape. As 
supplied, there are five named sub-directories, but the user may 
remove, create or rename them, providing there are no more than five 
sub-directories. The files representing paper tapes have the filename 
extension .TAP.

One of the program files PEGTH.EXE, and its associated data table 
PEGCON.ARR, is used for creating simulated Pegasus paper tapes, as 
described later. The two files may conveniently be copied to one of 
the tape sub-directories, for example PROGRAMS\, where the user is 
likely to want to create .TAP files. 

This manual, PEGEM.TXT, in plain ASCII, is also in the \PEGEM 
directory. It can be sent directly to any printer with a monospaced 
font which offers up to 80 characters per line, and at least 55 lines 
per page. There is a Form Feed character at the end of each page. A 
formatted version of this manual, PEGEM.RTF, is also present, in 
Microsoft Rich Text Format. A Postscript version will be available 
later.

Look to check if there is a READ.ME file containing late information 
which may not be included in the manual.

===========================================================================

                                  4

                      OPERATION OF THE SIMULATOR

Starting the Program
~~~~~~~~~~~~~~~~~~~~
Change to the PEGEM\ directory by the command "cd \pegem"  followed by 
the Enter key. Then type the command "pegem"  followed by Enter. After the
introductory graphics you are presented with the start-up menu screen.
Please observe any restrictions as to usage or copying which may appear
on that screen. There are five choices:

          E)  Setup environment   to set the simulation environment
          S)  Simulate            to start simulation
          H)  Help                to obtain quick help
          M)  Online manual       to obtain this manual
          Q)  Quit                to return to MS-DOS.

Type the appropriate item letter, followed by Enter.

Simulation starts when "s" is selected from the start-up menu. The 
user is presented with an image of Pegasus, and a moveable finger 
ready to operate controls. At this stage, the computing store and 
accumulators are empty, and the drum contains whatever was left on it 
last time the simulator was used. As supplied, the Initial Orders are 
installed on the drum.

Use of the keyboard to move the finger
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Mk I simulator uses the PC keyboard to manipulate objects on the 
screen, using the finger cursor. An attempt has been made to be 
consistent in the use of the keys, and exceptions will be mentioned 
where appropriate. 

The objects on the screen are regarded as being in groups, for our 
purposes called "ranks". Initially, the finger is on the "home rank" 
of hand-switches extending across the bottom of the Control Panel. 
Another rank of hand-switches is above the home rank, then above that 
is the rotary units-switch rank, the block-switch rank, the CRT 
controls rank and the tape-punch rank. "Below" the home rank is the 
top drawer of the tape cabinet, then the other drawers, the tape-
reader 1 (TR1), TR0, then back to the home rank. Thus the finger can 
be moved around the ranks in each of the two loops of a figure-of-
eight, always returning via the home rank. One loop is the Control and 
Monitor Panels, punch and teleprinter, the other is the tape-readers 
and tape cabinet.

When the finger is on a rank, it may be moved to left or right to rest 
on a specific object. If the finger is moved sideways off the end 
object in a rank, it moves to the next rank. Where it does not make 
sense to move sideways off an object, for example when the finger is 
on a tape-reader, then moving sideways may cause a special action.
While the finger is on an object, the object may be manipulated; for 
example a knob rotated, a switch pushed upwards, a button pressed 
down, a tape picked-up.

The essential keys are:

  Page Up, Down        Move finger from rank to rank
  Left, Right arrow    Move finger along a rank
  Up, Down arrow       Operate object under the finger
  Enter key            Complete or confirm certain actions

Subsidiary keys are:

  Esc         Exit from the simulator
  E           Environment actions
  R, S, P, L  Script actions
  H, M        Online help
  F1 to F10   Direct movement hot keys

In addition, the keyboard is used in the usual way when a tape name 
has to be typed.

Try some easy examples
~~~~~~~~~~~~~~~~~~~~~~
1.    The finger is on the home rank, on the RUN-STOP-SINGLE key.

 1.1    PgUp, PgUp brings the finger to a rotary switch.
        UpArrow moves the knob one position clockwise, DownArrow 
        moves it anti-clockwise. The left hand monitor CRT displays
        the data selected by that switch.

 1.2    A further PgUp, PgUp brings the finger to the CRT controls.
        UpArrow, DownArrow on a Brightness knob changes the brightness
        of the CRT trace.

 1.3    Yet another PgUp takes the finger to the Run-out button on 
        the tape punch.
        DownArrow ejects one row of blank tape from the punch.

 1.4    PgUp, PgUp (or five PgDowns) takes the finger back to the home 
        rank.


2     From the home rank, PgUp takes the finger to the hand-switches.
      LeftArrow and RightArrow moves the finger to select a particular
      switch. DownArrow sets the switch "On", UpArrow sets the switch
      "Off".

 2.1    Set the following numbered handswitches "On"

                  7, 8, 9, 11, 16

        This pattern represents a machine instruction to add the 
        literal value 1 to the number in accumulator 6

 2.2    PgUp to the larger rotary switch. Set it to "X6" on the upper
        left side. The left CRT will now show the contents of 
        accumulator 6.

 2.3    PgDn to the home rank. LeftArrow to the START-NORMAL-MANUAL 
        switch.
        UpArrow once. The Start switch is spring-loaded and operates 
        then returns to NORMAL. (This effectively resets the machine).
        DownArrow and the switch stays down at MANUAL.

 2.4    RightArrow to the RUN-STOP-SINGLE switch. Repeatedly press the
        key to SINGLE, (it is spring-loaded and returns by itself). On 
        every alternate press, you should see the accumulator being 
        incremented on the CRT. 

 2.5    UpArrow on the RUN-STOP-SINGLE switch. The accumulator 
        continually increments and you see the familiar binary
        counting pattern.

 2.6    Return all the switches to normal, and finish on the home 
        rank. 


Run a simple program
~~~~~~~~~~~~~~~~~~~~
3.    Start at the home rank.

 3.1    PgDown until the finger is on the tape cabinet drawer 
        labelled "DEMOS". Press the Enter key. The drawer opens. Use
        the Up and Down arrows to place the finger on the tape
        labelled "BIGCHARS". Use the Enter key to pick up the tape
        and close the drawer.

 3.2    PgDown to the lower paper-tape reader, TR0. If you 
        accidentally overshoot to the home rank, just start again and
        get the tape out of the drawer, and down to TR0. Press Enter
        and the tape is loaded into the reader.  

        Observe that you are given a top view of the tape
        just as though you are looking down on to the tape path.

 3.3    PgDown to the home rank. Make sure the handswitches are all 
        clear, i.e."Off" or up. Use the arrow keys to go to START,
        then RUN. Don't forget that START is spring-return to NORMAL.

        The program tape now is read-in by the Initial Orders 
        permanently stored on the isolated tracks of the drum. You
        will see the track indicator neons glowing. The program is
        assembled into machine instructions on the drum, ready for
        execution, and when the Initial Orders have done that, the
        "77-STOP" neon glows, and the machine stops. If you had
        switched on the "HOOT ON STOPS" key (near the left of the
        home rank), then the machine hoots to attract the operator's
        attention. Switch from RUN to STOP.
        The program is going to read characters from the paper tape 
        in TR0 and punch out a graphical representation of the
        character on the output tape. Although the program has been
        read in, the data is on the tail of the tape still in the
        reader.

 3.3    Go to RUN. The program reads characters from the tape-reader,
        and for each character read the representation appears on the 
        output tape. Incline your head to the side to see them on the
        tape. Of course the sequence of hole-punchings is meaningless
        to the teleprinter, which just prints garbage when the tape
        reaches it.

 3.4    At the 77-STOP, return the RUN switch to STOP.

Copy a tape from reader to punch (and thus to teleprinter)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4.    Start at the home rank. PgUp to the handswitches rank.

 4.1    Set the following numbered handswitches "On"

               3, 13,  16

        This pattern represents a machine instruction to add zero to 
        the Special Register numbered 16. Special Register 16 is the
        selected tape-reader for read operations, but the tape-punch
        for write operations. Therefore adding zero to it merely
        copies whatever is the current character in the tape-reader
        to the punch.

 4.2    Get a paper-tape out of the cabinet, and put it into TR0. 
        Go to START, then MANUAL (leave MANUAL set), then RUN.  

 4.3    The tape is copied to the punch. When it runs out of the 
        reader, the BUSY neon lights. and the machine stops.  Go to
        STOP. Clear the BUSY light as described in chapter 6 below.

 4.4    You can use the above procedure to print-out the contents of 
        a paper-tape on your printer by choosing appropriate
        configuration options as described in chapter 5 below.

Keeping output tapes
~~~~~~~~~~~~~~~~~~~~
Usually, any output tapes are discarded after the data has been 
printed on the teleprinter. Sometimes however it is necessary to keep 
the tape, for example when duplicating a tape, or when data is needed 
for input to a subsequent program. To keep an output tape, perform the 
following steps.

The output tape is assumed to have been punched and is hanging out of 
the punch. Some of it has passed through the teleprinter and is hidden 
in the tape bin under the desk.

1.   PgUp until the finger is on the green run-out button. Press 
     the button to get an inch or two of blank tape at the end of
     the data.

2.   RightArrow to get to the tape. Use the Enter key to tear-off 
     the tape and hold it in the hand, ready to write a label on it.

3.   Type in any name for the data tape, finishing with Enter. Most
     of the keyboard symbols may be used, but there is a restriction 
     to a maximum of eight characters to conform with MSDOS filename 
     conventions. The tape will be stored with a .TAP extension in
     one of the subdirectories corresponding to a tape cabinet drawer.
     (See the section on directory structures above).

4.   When you have labelled the tape, carry it to a drawer using the
     PgUp and PgDown keys. Put it in the drawer using Enter.

5.   If you don't want to keep the tape but just want to tear it off
     in order to start with clean tape from the punch, then when you 
     are invited to write the tape label, just PgUp to the waste bin,
     and drop the old tape using Enter.

6.   If you change your mind about the label and you want to rename
     the tape, use the UpArrow key BEFORE putting the tape in the 
     drawer. The Backspace key works to correct the label.


Setup Environment
~~~~~~~~~~~~~~~~~
At any time the E key will take the user to the Setup screen. Return 
to the simulator using Escape, or else E. The facilities are described 
in chapter 5 below.

Online Help and Manual
~~~~~~~~~~~~~~~~~~~~~~
At any time, the H key may be pressed to access the single-page help 
screen. The screen provides a few reminders and hints. It is not 
context-sensitive. Return to the simulator using Escape, or else H.

Similarly, at any time, the M key may be pressed to access this 
manual. Again, it is not context-sensitive, but the user may scroll 
through the manual to find information. Return to the simulator using 
Escape, or else M.  The manual remains "open at the page" when it is 
left, so that repeated use of the M key conveniently allows switching 
between the manual and the simulation.

Script facilities
~~~~~~~~~~~~~~~~~
The R and S keys are used to Record and Stop capturing a script of a 
simulation session. The script can be re-played using the P or L keys.
The facilities are intended for demonstration purposes, but may be of
use for repeated setting-up during a programming debugging session,
for example. Use with care - it is easy to get in a muddle using these 
facilities, which are aimed at advanced users.

At any time there can be one operable script file, named PEGEM.SCR. 
However, a demonstration script named EXAMPLE.SCR is provided; this 
should be copied to PEGEM.SCR for use. The use of this particular 
script for playback will be described first.

Copy EXAMPLE.SCR to PEGEM.SCR. Then start PEGEM, and enter the 
simulator. The simulator will be in a reset state because it has just 
been started, with the finger on the home rank. Now press the P key. 
The script will execute and cause Pegasus to count in an accumulator,
and will alter the monitor tube settings. It will invoke Initial Orders
to punch the date, press runout to print it, then put a data tape in a
tape-reader and input that to display some messages. Next it will tear
off and discard the output tape, and tear off and discard the printout,
having restored everything and returning to the home rank. The script
does not know about the order of tapes in a drawer, so it may not select
the correct tape if many tape files have been deleted or added since the
simulator was issued. In this event, it is a good exercise for the
reader to create a new script.

To record a new PEGEM.SCR, the R key is used, whereupon all subsequent 
key operations affecting the simulator (not subsidiary key operations) 
are captured, together with the relevant delays between operations. 
Recording is stopped when the S key is pressed. If the recorded script
is to be kept for later use, it is best to copy it to another file - in
case PEGEM.SCR gets recorded again at some stage - and then copy it
back to PEGEM.SCR when it is required for use.

As mentioned above, a script is re-played by pressing the P key. While
a script is re-playing, the Margins lamp on the monitor panel is very
slightly dimmed. At any time a re-playing script can be exited by
typing the Escape key, the only key which is effective during re-play.
Note that the simulator and hand must be in the correct starting
position when re-play is started, otherwise the script operations will
be meaningless, though harmless.

A script will be re-played repeatedly, or loop, if the script is
started with the L key instead of the P key. For a looping script, it
is essential that the script brings the hand and important switches
back to the starting point, because there is no reset facility in a
script. The looping facility is useful for exhibition purposes.


Direct movement hot keys
~~~~~~~~~~~~~~~~~~~~~~~~
The function keys on the keyboard may be used instead of PgUp, PgDown,
to move the finger directly to a rank. The keys are allocated as follows:

     F1    Move directly to TR0
     F2    Move directly to TR1
     F3    Move directly to the tape cabinet
     F4    (unused)

     F5    Move directly to STOP-RUN switch
     F6    Move directly to handswitch 10
     F7    Move directly to Units rotary switch
     F8    Move directly to left monitor Brilliance knob

     F9    Move directly to tape-punch run-out button
     F10   Move directly to teleprinter
     
Although the operator has the burden of remembering the key assignments,
the hot keys do speed up many operations. For example, to run the
PRIMESDM program, do the following:

   1   F3 to cabinet. PgDn to DEMOS drawer
   2   Enter to open drawer, Up to find PRIMESDM, Enter to select
   3   F1 to TR0, Enter to put tape in the reader
   4   F5 to home rank, Left, Up, Right, Up to load the program
   5   At the 77-stop, Down to STOP, F3 to cabinet, select PLUS1000
   6   F1 to TR0, Enter to put in the tape and displace old tape
   7   F5, Up, Down, Up, to read tape and run program
   8   At any time, F1, Up, to send tape back into the drawer
   9   F9, Right, Enter, PgUp, Enter, to scrap the output tape
  10   F10, Enter, to clear the teleprinter and return to home rank.      
     

Quit from the Simulator
~~~~~~~~~~~~~~~~~~~~~~~
At any time, the Escape key will leave the simulator and return to the 
main menu. If the operator chooses S at this point, then the simulator 
is re-entered at the point it was left. If the operator chooses to 
quit, the state of the machine will be lost, except for the contents 
of the drum. This corresponds with what happens with the real Pegasus. 
It does mean that, as in Pegasus, a program on the drum need not be 
re-loaded when the machine is switched-on again later, but can be re-
entered if its entry point is known. 

===========================================================================

                              5

                      CONFIGURATION SET-UP

The purpose of the Set-up facilities is to make changes to the 
environment in which the simulator operates. These represent user 
preferences and also "backdoor" short-cuts to simplify normal Pegasus 
operating procedures which might become tedious. All the selected 
options are stored in a configuration file, and remain in force 
between runs of the simulator until altered again. If the simulator 
does not behave as you expect, consider whether it could be due to a 
set-up option which you have forgotten. It is possible to set most 
configuration options during a simulation session.

Set-up is reached by typing "E", either at the start-up screen, or in 
a simulation session. The user is presented with a text screen with 
various options. The normal method of operation is to choose an option 
using the cursor keys, and then select or de-select the option using 
the Enter key. In some cases, actual data has to be typed-in. In that 
case the option is selected using the Enter key, then the data is 
typed and Enter pressed again. The various options are explained in 
the paragraphs below. In the following, the "LST device" is whatever 
printer is connected to the PC as the MSDOS device named LST. It is 
typically the first available printer, but MSDOS can assign any 
available printer to be LST.

1  Punch on Block Transfers destination
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This Pegasus hardware facility normally sends information to the tape-
punch. In the simulator, the data can be sent either to the simulated 
punch, or to the LST device, or to both, or to neither. Note that the 
data sent to the punch is not easily interpretable when it gets to the 
teleprinter, as it is in binary, not character form. In real use, a 
special program was used to read the Punch on Block Transfers tape and 
punch a readable tape. However, advantage is taken of the LST device 
to produce output directly in readable form.   

2  Punched Tape Output destination
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Normal output of data from Pegasus to the punch may be directed to any 
combination of the simulated teleprinter and the LST device. If the 
simulated teleprinter is not selected, then the output tape is shown 
going into a tape bin. The tape can be torn-off in the usual way if 
the data on it needs to be kept or thrown away.

3  Run-out on LST Device
   ~~~~~~~~~~~~~~~~~~~~~
If the LST device is selected through either of the above options, then 
the tape-punch run-out button will send either a line feed to the 
printer or else a form feed, dependent on this selection. Page-by-page
printers such as laser printers will benefit from the latter choice.
The user may switch between the options in mid-session.

NOTE: When the simulator is finally left through the quitting procedure,
      a form feed is always sent to the printer if the last character
      already sent was not itself a form feed.

4  Tape Reader 0
   ~~~~~~~~~~~~~
Either the simulated tape-reader 0 or else a real tape-reader 
connected to a PC serial port may be selected. This issue of the 
simulator always uses the simulated tape-reader, and the option 
setting is actually ignored.

5  Tape reader tape visibility
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
In normal operation of the simulator, a 'plan view' of the paper-tape 
loaded in a tape-reader is shown, and this moves as the tape moves 
through the reader. The option to disable the display of the moving 
tape makes the simulator run significantly faster, but with less 
realism. However the facility is useful where the simulator is being 
used more for program development than for demonstration.

6  Top level tapes directory
   ~~~~~~~~~~~~~~~~~~~~~~~~~
This option is not currently used, and it is not alterable. The 
directory shown is actually the home directory of the simulator.

7  Host options
   ~~~~~~~~~~~~
Currently two host options are provided on an experimental basis.

Reader Shade permits selection of different colours for the paper-tape 
readers, by using Enter to cycle through the selections. Several 
models of the tape-readers appeared in practice, with differing paint 
finishes and cleanliness.

Delay Count is an initial attempt to slow down fast PCs so the 
simulated speed is near authentic Pegasus speed, particularly to make 
the music program sound better. The facility is not very good, but you 
may like to try it. Choose the Delay Count item, press Enter to select 
it, and then type a number such as 30 for a 486/25. Press Enter to 
accept the count.

8  Clear Pegasus Drum
   ~~~~~~~~~~~~~~~~~~
Selection of this option clears all information, including the 
isolated tracks with Initial Orders, to zero. It is useful when 
testing bootstrap operations. All 1023 blocks are cleared.

9  Copy to PEGASUS.DRM
   ~~~~~~~~~~~~~~~~~~~
The file PEGASUS.DRM is the simulated Pegasus drum. It was mentioned 
earlier that no Engineer's Switch has been provided. It is possible to 
circumvent this, i.e choose whether the Initial Orders or the 
Engineer's test Programs are addressable, by copying the appropriate 
tracks using this set-up facility. Blocks 896 to 1023 are copied.

10  Plant Bootstrap in U0
    ~~~~~~~~~~~~~~~~~~~~~
On Pegasus the way to load anything on to an empty drum is a well-
documented bootstrapping procedure. Though instructive, it is rather 
tedious when you have done it for the Nth time. This facility puts the 
complete bootstrap program directly in to the computing store to save 
time.

11  Reset simulator
    ~~~~~~~~~~~~~~~
This reconstructs the simulated Pegasus to the state as when the PEGEM 
program is first started.

12  Set Date and Serial Number
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
Two conventional locations just before the Initial Orders (Block 895, 
words 6 and 7) on the drum hold today's date, and a serial number. The 
D directive was usually punched near the beginning of program tapes, 
and caused the Initial Orders to increment the serial number, then 
punch the date and serial number. It was one of the duties of the 
maintenance engineer to set these two locations every morning before 
handing the machine over for productive work. This operation required 
loading a utility program, which read the date and current number of a 
short steering tape.

To short-cut this procedure, the set-up facility copies the MSDOS date 
and serial number 0 to the said locations. 

13  Exit from setup
    ~~~~~~~~~~~~~~~
The Escape key or 'E' key return to the main menu or the simulator, 
depending on where it was entered from.

===========================================================================

                              6

                   SIMULATOR REFERENCE GUIDE

This chapter refers to each simulated feature of Pegasus, and provides 
instructions or hints for using it. Unless stated, operation of a 
control switch or knob is effected with the UpArrow, DownArrow keys on 
the keyboard. The word "machine" is used throughout to mean the 
simulated Pegasus. The word "PC" is used to mean the host on which the 
simulator runs.

1  Neon lights
   ~~~~~~~~~~~
All visible neon light are functional, including the External 
Conditions and Selected Track lights. The machine is deemed to be 
always switched on when it is visible, so the various mains supply 
lights at top right are always on.

2  Monitor Cathode Ray Tubes
   ~~~~~~~~~~~~~~~~~~~~~~~~~
Both tubes function as expected within the limits of the relevant 
functional switches. 
The following CRT controls are effective:

BRILLIANCE, FOCUS - adjust to one of two positions.

SCALE -  no scaling, order scaling and character scaling are selectable.

Y-PLATE - not available.

BLOCK and UNIT switches - functional.

TIMEBASE controls, Y-SHIFT - not available.

3  Control Panel
   ~~~~~~~~~~~~~
All handswitches in the upper rank, and all control switches in the 
lower rank are functional with the exception of the DRUM TRIGGER 
switches.

The MONITOR SELECTOR switch has a Down position not present on Pegasus 
and without a legend. This is an artifice to suppress updating of the 
right hand monitor tube and so reduce modulation of sounds when the 
Music program is playing. In the Down position, the right-hand monitor 
displays zero when the machine is running, and the Order Register when 
the machine is stopped.

4  Tape-readers
   ~~~~~~~~~~~~
If a tape is in hand while the finger cursor is on a tape-reader, then 
the tape is loaded into the reader by pressing the Enter key. Any tape 
already in the reader is automatically removed and replaced in the 
tape drawer.

Should an attempt be made to read from a tape-reader when there is no 
tape in it, then the INPUT/OUTPUT BUSY condition occurs, which stops 
the machine, and lights the BUSY neon lamp. As in the real machine, 
the condition can be cleared either by loading a tape in the 
appropriate reader, or else moving an object such as a finger or a 
pencil to intercept the light beam in the reader. This latter action 
is simulated by either LeftArrow or UpArrow on the reader.

To unload a tape which is currently in a tape-reader, use the 
LeftArrow or UpArrow keys as for clearing a tape-reader busy 
condition.

Choice of which tape-reader is to be used is made by means of the 
External Conditioning order in the correct way.

5  Paper-Tape Names
   ~~~~~~~~~~~~~~~~
The name of a paper-tape appears on the tape while is is carried. When
the tape is in a tape-reader, the name will disappear as the tape runs
through, but will reappear as a reminder on the background. If the
setup option to not display tapes has been chosen, then the name just
appears on the background.

6  Tape Cabinet
   ~~~~~~~~~~~~
While the finger is on the cabinet, any drawer can be chosen using the 
PgUp and PgDown keys. 

Open a drawer using the Enter key.

Select a tape using UpArrow, DownArrow.

Pick up a tape using the Enter key. The drawer closes automatically.

While the tape is in hand, either go to another drawer or else go to 
one of the tape-readers using PgUp and PgDown. The Enter key puts the 
tape in the drawer or the reader respectively. If you attempt to carry 
the tape away from the cabinet or tape-readers, it is automatically 
replaced in its drawer.

While the tape is in hand near the cabinet, the Uparrow key enables
the tape name to be edited, or the tape discarded in the bin. This
action permanently affects the underlying tape file.

7  Tape Punch
   ~~~~~~~~~~
The green Run-out button on top of the punch will cause one row of 
blank tape to be run-out. The DownArrow key may be held down to run-
out a length of blank tape, but the keyboard buffer quickly fills up 
because the punch cannot keep up. Let go the key and allow the buffer 
to partially clear.

To tear-off the output tape, use RightArrow from the Run-out button to 
get the finger onto the tape. Press Enter to tear the tape and hold in 
the hand. The end of the tape is then positioned to make visible where 
it must have a tape label written on it. Type in any name with a 
maximum of eight characters, and using normal MSDOS naming 
conventions. Complete the name using the Enter key. The hand then 
carries the tape to the cabinet, where a drawer can be chosen, and the 
tape deposited using the Enter key. Alternatively, instead of 
depositing the tape, the UpArrow key will take the tape back to the 
labelling position where the name can be edited. At the labelling 
position, the tape can be discarded at any time by PgUp, which takes 
the tape to the waste bin. Use Enter to drop the tape, PgDn to go back 
to the labelling position.  

8  Teleprinter
   ~~~~~~~~~~~
PgUp from the tape-punch to reach the teleprinter. The Enter key 
tears-off and discards the printout.

The teleprinter is functional, even to the extent of over-typing as in 
the real machine should no CR or LF characters be sent to it. It does 
differ from the real teleprinter where the carriage with the paper 
roll moves past a fixed print-head; the simulation shows a fixed 
carriage and moving print-head similar to a Teletype. Only about five 
lines of characters can be shown; lines scrolled off the top of the 
page are lost. Of course, the information is still on the output tape, 
which can be torn-off, labelled and printed again either on the 
simulated teleprinter or on the real printer.

The teleprinter is currently synchronous with the punch, so appears to 
work much faster than the real machine, where it is completely 
independent of Pegasus operations.

9  Drum
   ~~~~
The drum is implemented as a "7168-word" drum, i.e twice the size of 
the original Pegasus drum. The Science Museum machine has this larger 
size. Unlike Pegasus, PEGEM provides no write-protection on the 
"Isolated Tracks" where the Initial Orders and Engineer's test 
Programs are located. If a faulty program writes to this area the 
Initial Orders must be restored using the configuration set-up 
facilities.

10  Engineer's Control Panel
    ~~~~~~~~~~~~~~~~~~~~~~~~
This is not directly simulated at all. Power control monitoring and 
switching is not needed because the machine is considered to be fully 
switched-on. Alarm conditions and lamps are not relevant because the 
simulated machine is "perfect". Certain over-ride keys to inhibit 
special conditions are not included in this issue of the simulator. 

The Pegasus drum has more tracks than are addressable by program. The 
extra tracks are brought into the address space, and substitute for 
existing tracks, by use of an Engineer's switch. These tracks carry 
the Engineer's Test Programs, where normally the Initial Orders are 
located. Because the Engineer's Panel is not represented, there is no 
Engineer's Switch, so the effect is realised outside the simulator in 
the setup functions.

===========================================================================

                             7

                 PREPARATION OF PAPER TAPES

It is planned to produce a simulated Tape Editing Set, as used in 
Pegasus installations, consisting of a keyboard teleprinter with 
reperforator, a paper tape reader and a control box. Until this is 
ready, an indirect preparation route for paper tape has been provided, 
described in the following paragraphs. 

Programs and data for PEGEM can be created using a simple text editor 
such as Windows Notepad or by saving as  "text only"  from a word 
processor. The ASCII codes used to represent each Pegasus character 
are shown in Appendix 2. The text file should be saved in the PEGEM 
directory with a .TXT suffix and converted to PEGEM format using the 
PEGTH utility. The output file will have the same name as the text 
file but with the suffix .TAP. Before use the file must be copied to 
an appropriate PEGEM sub directory. (It may be convenient to copy 
PEGTH.EXE and PEGCON.ARR to the sub-directory where tapes are being 
prepared, to avoid having to copy .TAP files from one directory to 
another. However, the examples below assume they are in \PEGEM).

For example the demonstration program PRIMESDM requires a short data 
tape. To evaluate primes up to 500 the following ASCII text should be 
typed:

+500  E2.4      

followed by the Enter key.

There must be a space or newline after "500" and a newline after 
"2.4".  This text should be saved in a file such as PLUS500.TXT

If necessary, type  "cd \pegem"  followed by the Enter key.
Then type  "pegth"  followed by Enter.
PEGTH will then display a menu of 8 options
Type  "1"  to select   Convert text file (.txt) to Pegasus code file 
(.tap)
PEGTH will respond "Name of File Please (.txt assumed)"
Type  "plus500"  followed by Enter
PEGTH will then convert the file and report the number of errors
Type any character to return to the PEGTH menu
Type  "8"  to return to MSDOS
Type  "copy  plus500.tap  data"  This puts the data tape in the "DATA"
drawer ready for use in PEGEM

If PEGTH reports errors the text file should be checked for codes not 
listed in Appendix 2, such as lower case letters. Each error will be 
converted to an Erase code in the .tap file; these codes will be 
visible if PEGEM is used to print the subsequent .tap file as 
described on page 10. PEGTH has other capabilities but these depend 
on the availability of a paper tape reader and punch.

The example above shows the minimum text necessary to create a data 
tape for PEGEM. A real Pegasus tape would have to start with a run 
of some 60 figure shifts (blank tape) followed by CR LF (Newline).   
Blank tape is essential to end a Pegasus name sequence and was usually 
used between sections of program or data to make the tape easier to 
scan by eye. The end of the tape would be denoted by a string of 
Erase codes. The ASCII representation for PEGTH might then be as 
follows:-

||||||||||||||||||||||||||||||||||||||||||||||||||||
N
PRIMES UP TO 500
|||||
+500
E 2.4
|||||@@@@@|||||

Note that many plain text editors do terminate texts with control 
characters such as Ctrl-Z. These will be recognised as an error by 
PEGTH, so the .TAP tape may have a spurious character at the end. This 
is harmless, if unsightly.

Pending the provision of the Pegasus Programmers Manual, and a more 
authentic Tape Editing Equipment, there is an elementary guide for new
Pegasus programmers, which introduces some of the facilities of the
Initial Orders, and how a small program can be written and punched.
The guide is in the form of a tutorial in the accompanying document
TUTORIAL.TXT. 


===========================================================================

                                8

                   HISTORY AND ACKNOWLEDGEMENTS

The development of simulators and emulators of historic machines has 
been one of the interests of the Computer Conservation Society since 
the Society's inception in 1989. This simulator was started in May 
1991, and within a couple of weeks the main graphical interface had 
been developed. Using this interface, the functional emulation was 
progressively built-in behind, analogous to gradually adding and 
checking the logic of the real machine, where the control desk is used 
for monitoring what is working and what is faulty. A paper-tape reader 
attached to a PC was used to transcribe real Pegasus paper tapes to 
MSDOS files and named with a .TAP extension. The Initial Orders and 
the Engineer's Test Programs in the isolated tracks of the simulated 
drum were loaded using the authentic Pegasus boot-strap procedures.  
The program is written in Pascal with one routine (moving image of 
paper tape) written in inline assembler.

Development has continued spasmodically since the bulk of the work was 
completed in December 1991.

The author is particularly grateful to Derek Milledge who has borne the
brunt of checking the accuracy of the simulator and giving advice, and 
has provided chapter 7 and appendices 4 and 5 of this manual. The late 
John Cooper created PEGTH, the Pegasus Tape Handling  system. The author 
is also indebted to ICL for permission to use copyright material, and to 
the Curator of Computing, Science Museum, London, for access to Pegasus 
and its documentation and tapes. Tony Sale and other members of the 
Computer Conservation Society have provided an enthusiastic and 
stimulating forum to encourage continuing development.

===========================================================================

                               9

                           REFERENCES

The descriptions of hardware given here are in publicly accessible 
journals. There are numerous volumes of original Pegasus documentation 
containing logic diagrams, circuit descriptions, lists of waveforms, 
spare parts etc. in the Science Museum archive, and which are used for 
maintaining the Pegasus there.  Similarly, there is a large amount of 
manuals, papers, descriptions and so on of the software aspects of 
Pegasus. To effectively use the Pegasus simulator, the user needs to 
have knowledge of the design and functionality of Pegasus. The best 
comprehensive manual is the 1962 George Felton book, generally 
regarded as a classic introduction to the art of programming in the 
1950s and '60s, and with plenty of lessons to teach in clarity of 
expression today. It is of course long out of print. Its forerunner, 
the 1955 book, is possibly rarer, and is in mimeograph form rather 
than printed. Negotiations are in hand to reproduce this book in 
machine-readable form. Other relevant documents such as the Pegasus 
Library Specifications and the Operating Manual may also be considered 
for transcription to machine-readable form
 

W.S.Elliott, C.E.Owen, C.H.Devonald and B.G.Maudsley: "The design 
  philosophy of Pegasus, a quantity-production computer", Proc. IEE, 
  1956, vol 103B, supp 1-3, p188.

I.W.Merry and B.G.Maudsley: "The magnetic drum store of the computer 
  Pegasus", ibid p197.

J.W.Fairclough: "A sonic delay-line storage unit for a digital 
  computer", ibid p491.

G.E.Felton, P.M.Hunt et al: "A programming manual for the Ferranti 
  Pegasus computer", Ferranti Ltd CS50, Issue 1, September 1955.

G.E.Felton: "The Pegasus programming manual", Ferranti Ltd CS333, 
  1962. 

===========================================================================

                          APPENDIX 1

     NOTES ON RUNNING SOME PEGASUS DEMONSTRATION PROGRAMS

For many of the programs there is contemporary documentation which 
should be referred to. These notes are just a summary of what the 
program does and how to run it. Remember that the Pegasus operating 
environment did not require any special naming conventions for 
programs. However, until we implement the  proposal for a standard for 
emulated paper tapes, the simulation environment refers to programs by 
their host file name, limited to eight characters. These names are 
what is used below, and are not relevant to native Pegasus operation.  
It is assumed below that you know how to load a tape in a paper-tape 
reader, and know that START and then RUN calls in the Initial Orders 
to load the program etc.


1. BIGCHARS    Author Derek Milledge. This reads characters from the
               TR and punches legible representations on the output
               tape. Load program; at the end of the tape is a J-
               sequence so the program reads the next bit of tape and
               outputs it (the author's name). At the stop, RUN again
               to read the alphabet off the tape. A data tape is
               terminated with exactly 2 Erase characters.

2. DADD        Author Richard Dadd. This computes and punches prime 
               numbers. Put DADD in TR0 and FXDLIBRY in TR1. START and
               RUN loads the program, incidentally fetching an output
               routine from the library. At any stops, just RUN. The
               program outputs unity as the first prime number.

3. PRIMESDM    Author Derek Milledge. Compute and print prime numbers
               by Sieve of Eratosthenes. Requires a steering tape as 
               described in the N-sequence. Three steering tapes are
               provided: PLUS100, PLUS1000 and PLUS10K.  Load the
               program. At the stop, put in the steering tape and RUN.
               At the next stop, RUN.

4. MUSIC       Author not known, but hacked by Chris Burton. Plays
               melodies on the hooter. There are twelve original
               Pegasus tunes and a thirteenth which I converted from
               Perseus music, but which is faulty on the currently
               distributed tape, and I haven't had time to fix yet.
               Load tape and START and RUN. Program and data are put
               on the drum.  At the stop, clear the handswitches and
               RUN. Select a tune by pressing and restoring the
               appropriate numbered handswitch. It is helpful to set
               the monitor switch for the right-hand monitor down to
               suppress updating the screen, though this is not an
               authentic Pegasus technique. Also make sure the left-
               hand monitor is switched to something quiescent.

5. SIMPAR      Author Colin Merton. This is the Simple Arithmetic
               Package, which makes Pegasus behave similarly to a
               scientific calculator. Arithmetic expressions or
               formulae are presented on an input data tape (use
               SIMPDAT2) and results then punched.  SIMPAR in TR0,
               START and RUN. At the stop, SIMPDAT2 in TRO, START
               and RUN. (NOT just RUN). There is an Optional Stop at
               the end (beginning?) of each statement. You can do
               each one separately or Inhibit Optional Stops, but it
               will then run off the end of the tape.

6. ACTAB       Source, Autocode manual. This is the autocode data 
               tabulation program in the Autocode manual. AUTOCODE in
               TR0, START and RUN. At the stop, ACTAB in TR0, then RUN.
               At any stops, RUN. The data tabulation punched is the
               evaluation of a formula. 

7. FFACTORS    Author John Davison. The program takes an integer 
               keyed in on the handswitches and resolves it into
               prime factors which are punched. Load the program in
               TR0, then START and RUN. At the stop, RUN.  There is a
               stop before each try. Clear the handswitches, then RUN.
               The digits of the input number are then tapped on
               handswitches 0..9, and the number is terminated by
               tapping handswitch 10. (Tap a switch by pressing it
               down then up.)

8. CELPARAM    Author Dave Walley (?). Crystallography unit cell 
               parameters from experimental data. Load CELPARAM until
               77-stop. Put in CELLDATA and RUN. Optional stop at end
               of each set of experiment data.

9. ENGINEERS' TEST PROGRAMS

   To run the Engineers' Tests, the alternative isolated tracks on the
   drum are required. To effect this, enter the Setup Environment screen,
   and copy ENGRSTPS.DRM to the Pegasus drum. Reset the simulator and 
   exit from the Setup Environment screen. 
   Set the handswitches to load the first block of code from the drum
   by putting the four leftmost switches on, and a 72 instruction on the
   function keys. Go to START, then MANUAL, NORMAL, then SINGLE-SHOT.
   Clear the handswitches except for handswitch 1 and a 60 order on the 
   function keys. MANUAL, NORMAL, SINGLE-SHOT, which jumps to location
   0.0. Clear the handswitches and RUN. The test programs will run, with
   the familiar rhythm from the loudspeaker.
   Remember to put the Initial Orders back on the drum when finished.
    
===========================================================================

                          APPENDIX 2

                  THE PEGASUS PAPER TAPE CODE


                          Pegasus          PEGTH
             N-addr     PRINTED char.     ASCII char.              
 TAPE       17   16      FIGS. LETS.      FIGS. LETS.   Notes
---------------------------------------------------------------
|   .  |    0    16      FIG.SHIFT        |     |     Blank tape
|   . o|    1     1       1    A          1     A
|   .o |    2     2       2    B          2     B
|   .oo|    3    19       *    C          *     C
|  o.  |    4     4       4    D          4     D
|  o. o|    5    21       (    E          (     E
|  o.o |    6    22       )    F          )     F
|  o.oo|    7     7       7    G          7     G
|      |
| o .  |    8     8       8    H          8     H
| o . o|    9    25      =/=   I          #     I    Not-equal symbol
| o .o |   10    26       =    J          =     J
| o .oo|   11    11       -    K          -     K
| oo.  |   12    28       v    L          v     L
| oo. o|   13    13     L.F.   M        Enter   M     Enter = CR LF
| oo.o |   14    14      Sp.   N        Space   N
| oo.oo|   15    31       ,    O          ,     O
|      |
|o  .  |   16     0       0    P          0     P
|o  . o|   17    17       >    Q          >     Q
|o  .o |   18    18      >=    R          }     R     Greater-or-equal
|o  .oo|   19     3       3    S          3     S
|o o.  |   20    20      ->    T          ^     T     Right arrow symbol
|o o. o|   21     5       5    U          5     U
|o o.o |   22     6       6    V          6     V
|o o.oo|   23    23       /    W          /     W
|      |
|oo .  |   24    24       x    X          x     X
|oo . o|   25     9       9    Y          9     Y
|oo .o |   26    10       +    Z          +     Z
|oo .oo|   27    27     LET.SHIFT                     Implied in ASCII
|ooo.  |   28    12       .    .          .     .
|ooo. o|   29    29       n    ?          n     ?
|ooo.o |   30    30     C.R.           Enter        Pound symbol
|ooo.oo|   31    15     >|<   >|<         @     @     Erase symbol



Text files for PEGTH should be typed using the ASCII characters shown.
The letter shifts, figure shifts, carriage returns and line feeds are 
taken care of in the PEGTH conversion. Use | only to obtain additional 
figure shift codes needed for a run out of blank tape, and @ for 
erases to mark the end of the tape. In letter shift use only upper case
A to Z. Unassigned ASCII codes will be replaced by Erase to mark errors
in the text. The file must be simple ASCII text, and must not include 
word-processor formatting codes.

===========================================================================

                        APPENDIX 3

                  THE PEGASUS ORDER CODE

In this appendix, some information is omitted, particularly that 
relevant to cards and magnetic tape, and some orders mentioned may not 
have been implemented in the Mk 1 simulator.

NOTATION
~~~~~~~~
N            First Address in Order (Register Address)
X            Accumulator Specified in Order
n            Word in N
x            Word in X
p,           Words in 6 & 7
n',x',p',q'  Values after Obeying Order
(pq)         = p + 2^-38q, with  q >= 0 
B            Block in Main Store
U            Block in Computing Store
P            Position-Number of Word in Block
OVR          Overflow  Indicator
xm           Modifier in X, i.e. Integer Represented by
                                  Digits 1 to 13 of x
xc           Counter in X, i.e. Integer Represented by
                                  Digits 14 to 38 of x
mu           Greek letter
=/=          Not-equivalent symbol
^            Exponent symbol (just the number or the single letter)

Group 0 -  transfer to accumulator
~~~~~~~
00  x'  =  n
01  x'  =  x + n
02  x'  =  -n
03  x'  =  x - n
04  x'  =  n - x
05  x'  =  x & n
06  x'  =  x =/= n
07

Group 1 -  transfer to computing store
~~~~~~~
10  n'  =  x
11  n'  =  n + x
12  n'  =  -x 
13  n'  =  n - x
14  n'  =  x - n
15  n'  =  n  & x
16  n'  =  n =/= x
17  

Group 2 - multiply, divide, justify
~~~~~~~
20  (pq)'  =  n.x
21  (pq)'  =  n.x + 2^-39
22  (pq)'  =  p + 2^-38q + n.x
23  (nq)'  =  n + 2^-38q  (Justify)*
24 } q' + 2^-38p'/n  = (x+2^-38q)/n   {  0 <= p'/n < 1
25 }                                  { -1/2 <= p'/n < 1/2
26   q' + 2^-38p'/n  =  x/n             -1/2 <= p'/n < 1/2
27   p' = 2X.p + n,    q' = 0*  {Pegasus 2 only}

Group 3 - unassigned orders in Pegasus 1
~~~~~~~
30
 :
 :
36
37  q' + 2^-38p'/n  = 2^6.q + 2^-38.2X.p/n   [Pegasus 2 only]

Group 4 - set counter with literal value
~~~~~~~
40  x'  =  c       }
41  x'  =  x + c   }
42  x'  =  -c      }
43  x'  =  x - c   }  c = N.2^-38
44  x'  =  c - x   }
45  x'  =  x & c   }
46  x'  =  x =/= c }
47 

Group 5 - shifts
~~~~~~~
50  x'  = 2^Nx            } SINGLE-LENGTH        }
51  x'  = 2^-Nx (ROUNDED) } ARITHMETICAL SHIFTS  }  x'= x
52 SHIFT x UP N PLACES *  } SINGLE-LENGTH        }  if N = 0
53 SHIFT x DOWN N PLACES  } LOGICAL SHIFTS       }
54 (pq)' =  2^N(pq)             } DOUBLE-LENGTH       }p'= p, q'= q
55 (pq)' =  2^-N(pq)(UNROUNDED) } ARITHMETICAL SHIFTS } if N = 0
56 (pq)' =  2^mu(pq); x'= x-2^-38mu (NORMALIZE)*
57 SHIFT x UP l, THEN DOWN r 6-BIT CHARACTERS.  N = l.r [Pegasus 2 only]


Group 6 - jumps
~~~~~~~
60  JUMP TO N  IF x = 0
61  JUMP TO N  IF x =/= 0
62  JUMP TO N  IF x >= 0
63  JUMP TO N  IF x < 0
64  JUMP TO N  IF OVR CLEAR }  AND CLEAR
65  JUMP TO N  IF OVR SET   }     OVR
66  x'm  =  xm + 1.  JUMP TO N IF x'm =/= 0 (mod 8). (UNIT MODIFY)
67  x'c  =  xc - 1.  JUMP TO N IF x'c =/- 0.         (UNIT COUNT)*

Group 7 - block transfer and miscellaneous
~~~~~~~
70  SINGLE-WORD READ TO ACCUMULATOR 1.     x'1 = s
71  SINGLE-WORD WRITE FROM ACCUMULATOR 1.  s'  = x1
72  BLOCK READ FROM MAIN STORE             u'  = b
73  BLOCK WRITE TO MAIN STORE              b'  = u
74  EXTERNAL CONDITIONING *
75
76
77  STOP (WAIT)

*         NOTES ON THE ORDER-CODE
          ~~~~~~~~~~~~~~~~~~~~~~~
23  Assumes that any overflow is due to operations in 7.  Clears OVR 
      unless n' overflows.  q' >= 0.
27  If N=7, p'=2X.p + q.2^-30, q'=2^6.q  (logical shift) [Not Pegasus 1]
52  Fast shift for N >= 25.     [Not Pegasus 1 nor PEGEM]
56  Either   (i)   1/4 <= (pq)' <   1/2  and  -1 <= mu <= N-1. 
       or   (ii) - 1/2 <= (pq)' <  -1/4  and  -1 <= mu <= N-1. 
       or  (iii) - 1/2 <= (pq)' <   1/4  and   mu  =   N-1.
67  There is no carry from xc to xm
74  If N even, main tape reader selected.
    If N odd, second tape reader selected.

SPECIAL REGISTERS
~~~~~~~~~~~~~~~~~
15  Handswitches  H0, H1,..........H19
16  Checked Input/Output
     Tape Reader -> 16c -> Xc
     xc -> 16c -> Output Punch
17  Direct Input/Output
     Tape Reader -> 17m -> Xm
     xc -> 17c -> Output Punch
24  External Conditioning Setting in 24c   [Not Pegasus 1]
32  -1.0
33   1/2  = (512.0, 0)
34  2^-10 = (1.0, 0)
35  2^-13 = (0.1, 0)
36  2^-16 = (0.0, 1)
37   7/8  = (896.0, 0)


HOW VARIOUS ORDERS ARE MODIFIED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      {       N     X     F    M 
Order being modified  {     U   P
                      {   .... ... ... ...... ...

Function F:             B       P
  00 - 27           .......... ***         Modifier:
                             B      P       Asterisks show bits
  72, 73               ******* *** ...      added to the part of
                             B      P       the order under which  
  70, 71, 74           ******* *** ***      they are aligned 

                       <   10    >
  40 - 67           ...******* ***         (Addition modulo 1024)

===========================================================================
 
                         APPENDIX 4

                 PEGASUS LIBRARY PROGRAMS

The programs stored in the PEGEM Library Drawer include Pegasus 
standard subroutines in three libraries, some simplified programming 
schemes and a few standard applications.   Use of these will require 
reference to Pegasus Library Specifications or other documents.   The 
initial "7" in a reference such as R7500 indicates that it is the 
version for the 7168 word store - the specification will be filed as 
R500 and will refer to the 4096 version R2500.   The following notes
only give an outline of what is available.


LIBRARY    Programs needing a Pegasus subroutine have to include a
           call for that routine number. When the program is read the
           appropriate Library tape is placed in TR1 and the required
           subroutines are read to store with the program.

FXDLIBRY   The Fixed Point Library is the main Pegasus Library for 
           technical work not requiring floating point working. It
           includes subroutines for input, output, functions such as
           square root and operations such as interpolation.

FLTLIBRY   The Floating Point Library includes a smaller range of 
           subroutines working with floating point numbers. These
           include input, output, arithmetic operations, elementary
           functions and some other processes.

COMLIBRY   The Commercial Library includes data processing subroutines
           such as sorting, PAYE calculation and input and output in
           Pounds, Shillings and Pence. Routines requiring magnetic
           tape or punched cards cannot be run on PEGEM.

AUTOCODE   The Pegasus Autocode (R600) allows programming steps to be 
           written in a simple form such as  v1 = v2 + v3  . There is
           range of elementary functions and index operations are
           provided.

R7500FLT   The Matrix Interpretive Scheme provides instructions which 
R7500FXD   specify operations on matrices whose elements are floating
           point numbers. Two versions of matrix printing are provided:
           in R7500FLT each element of the matrix is printed with its
           own decimal exponent but in R7500FXD there is one exponent
           which applies to all elements of the matrix printed.

R650DBL    The Double Length Floating Point Interpretive Scheme 
           provides instructions for input, output, arithmetic and
           matrix operations on floating point numbers with a 76-bit
           argument.

R630CPLX   The Complex Arithmetic Interpretive Scheme provides 
           instructions for input, output, arithmetic and matrix
           operations. The real and imaginary parts of the complex
           numbers are held in floating point form with a common
           exponent.

R7510EQN   Solution of Simultaneous Linear Equations with multiple 
           right hand sides. The calculation is in fixed point
           arithmetic with scaling factors applied to each solution.
           Specification references CS132, 133, 134.

R7534RTS   Latent Roots of a Matrix by an iterative process controlled
           from the handswitches. The matrix is held in the same form
           as the Matrix Scheme R7500.

R7538RTS   Latent Roots of a Matrix.  [ The title on the R7538 tape is
           General Eigenvalues up to order 72 (QR Transformation) ].

R7811REG   Multiple Regression for up to 38 variables.

R7591LP    Linear Programming. Specifications CS186, 187.

R7350POL   Roots of Polynomials by Bairstow's Method, using double 
           length floating point arithmetic.

R7365FUR   Fourier Series. Calculates Fourier coefficients from values
           of a function read at equally spaced points. Specifications
           CS165, 166a.

R7810REG   Multiple Regression for up to 26 variables with significance
           testing. Specification CS273.

CURVFIT2   Curve Fitting Mk2. Evaluates the best fitting polynomial 
           through a set of data by the method of least squares. This
           tape includes R7500 and matrix program. At the end there
           is a short sample data tape for fitting a polynomial of
           order 2, with 4 ordinates y followed by the corresponding
           4 abscissae t.


===========================================================================

                         APPENDIX 5

                  PEGASUS UTILITY PROGRAMS

Many Pegasus utilities were designed to help in program development by
setting initial conditions or printing the contents of store 
locations. As with Library Programs the initial "7" or "2" should be 
ignored when seeking the Pegasus Library specification. The following 
notes give a brief description for simple use, ignoring special case 
complications:


COMPTAPE    Compares two paper tapes, stopping when they differ. Read 
            COMPTAPE, put the tapes in TR0 & TR1 then RUN. COMPTAPE
            ignores initial blank tape then compares. [COMPTAPE is
            R7910, not R7900 which is unsuitable for PEGEM because it
            requires manual tape handling].

R7901CLR    Clear Store. When the tape is read it writes zero to main
            store locations 0 to 7165 before Pegasus pauses on a 77
            stop. Specification R2901, filed as 901, refers to the
            4096-word version which zeroises 0 to 4093.

R7902_ID    Identification. Writes 0 to 7165 to main store locations 0
            to 7165. Sometimes helps to identify what is in the
            Computing Store when a program fails.

R7903FPR    Print floating point numbers from store, like F Directive
            Use E 500.2 to set an address on the handswitches or, for
            addresses 16.2 to 17.4, read a steering tape of the form:
                  J500.0
                  16.2 - 17.4

R7905AID    Testaid Break-point. Breaks into a program at specified 
            points to print intermediate results.
            See specification R2905, filed as 905.

R7906_QQ    Fast Block Transfer Translation. Translates an output tape
            produced by the Punch on Block Transfers facility, showing
            block numbers spread across the page.

R7907USE    Store Use. Prints one character for each block of main
            store showing the number of negative words in the block,
            "-" if all words in the blocks are zero and "." for B0.
            Read in R7901CLR, then the program to be checked, then 
            R7907.
            Used to determine A4 binary punch requirements or, after 
            running the program, what store areas it has written to.

R7910COM    Pegasus 2 Compare Tapes (R7910). See COMPTAPE above.

R7915DLP    Double Length Fraction Print. Prints the contents of pairs
            of words as double length fractions. Controls as for R7903
            but the addresses must be even.

R7921BIN    Initial Orders to Binary Translation. Reads Initial Orders
            program tape and outputs a binary-coded equivalent.
            Intended for relocatable library routines. Complete
            programs are best punched from store using A4 Directives
            or R7059BPP.

R7923B_I    Binary to Initial Orders Translation. Reads Binary tape
            and outputs an equivalent Initial Orders program tape.

R7924CON    7168 Conversion. Reads a tape produced using A4 binary 
            punching on a 4096-word store and outputs an equivalent
            tape for use on a 7168-word store. Suppress optional stops
            and RUN at 77 stop to punch the output tape. If this fails
            see the specification.

R7925CN4    Conversion to 4096. Converse of R7924 above. 

R7054BWA    Binary Punch Without Address. Binary punch from store like
            the A4 Directive but omits the address so that the
            information can be fed back to a different location.
            Instead of A4 type J508.0 followed by Enter.

R7059BPP    Binary Punch Program. Produces a binary coded tape of all
            non-zero locations in main store, preceded by a clear
            store routine. R7901CLR should be read first, then the
            program to be punched and finally R7059BPP.

R7501TRC    Error Tracer to be read in after R7500. Provides an
            optional stop before each Matrix program instruction. With
            handswitch 18 down this routine will print a coded form of
            each Matrix instruction before obeying it:

               Instruction No. Function No. m1 n1 N1 N2 N3 m2 n2

            where Ni are addresses and mi,ni are dimensions.

===========================================================================
