|Pegasus, courtesy Wikipedia|
Back in 1958 I wrote a little program in Pegasus Autocode.
The Ferranti Pegasus was an early (and very successful) UK computer, and as an 11-year old I was lucky enough to borrow a manual and have my program run.
The kind person who ran my program fixed a couple of problems for me, but I've never been quite sure what they were.
Today I found out, and finally got to fix the program myself.
PEGEM to the rescueI've known for a while about Chris Burton's wonderful PEGEM Pegasus Emulator. This is a DOS program which provides a pretty complete simulation of the Pegasus.
You control the program via the switches on the operator's console. The drum is loaded with the Initial Orders (the Pegasus Operating System), and you can create your own five-track punched paper tapes which you use to program the computer and provide data.
A missed excursion and a loose end tidiedYesterday I had hoped to join a group of enthusiasts on a Computer Conservation Society outing to IBM Hursley Park, but a tummy bug meant that I was unable to travel.
I decided to install PEGEM on my workstation and have a nostalgic play with Pegasus.
I hadn't realised until yesterday that PEGEM's virtual storage cabinet of paper tapes included the master tape for Pegasus Autocode. This meant that I could try to recreate my program and run it again - after a lapse of over 50 years!
Calculating eThe program attempted to calculate the value of e using a power series. Pegasus Autocode had a perfectly good EXP function available, but back in 1958 I thought I would learn more by doing it the hard way.
I still have my own copy of the Autocode manual, so I decided to have another go.
I recreated the program (from memory) as a text file and converted it to paper tape format.
I managed to reproduce the original bug but this time I was able to fix it.
The problem was due to a well-documented restriction in the Autocode language. I'd attempted to mix floating-point and integer calculations in a way that Autocode does not support; once I fixed that the program ran and printed out a reasonable approximation of e.
The working version - after 55 yearsHere's the final working version. The format looks a bit strange, as the paper tape had its own specialised character set. The ^ is actually a right arrow, representing a jump (goto) in autocode, and the | is a figure shift character used as a spacer.
||||||||||||||| D N CALCULATION OF E |||||||||| J1.0 v1 = 1.0 v2 = 1.0 v3 = 0.00001 v4 = 1.0 1) ^2, v3 > v2 v2 = v2 / v4 v1 = v1 + v2 v4 = v4 + 1.0 ^1 2) PRINT v1, 3026 STOP (^0) ||||||||||| @@@@@@@ ||||||||
and the result when you run it is: +2.71828