Jonathan Pinnock and Associates

Jon's First Ever Program

I would be willing to bet that there are very few other programmers out there who have a listing of their first-ever program. The only reason that I've got mine is that in those days (yawn), we didn't have one of those VDU things, and we had to key the program in at a teletype. The computer was one of Digital Equipment Corporation's PDP 8/e's, which my school had - thanks to some visionary thinking on the part of some of the teachers - just acquired, back in - I think - 1972. The language was FOCAL (which I think stood for FOrmula CALculator - it was sort of BASIC without the good bits). It was fully interpreted - all you did was type the program in and tell it to run.

I remember it as if it were yesterday. For the previous day's homework, our Maths teacher (the late, much lamented, Mike Rawlinson - an educational genius if ever there was one) had told us to write a simple program. I happened to be early for school the next morning, and he asked me if I wanted to try mine out. Did I ever. So I solemnly bashed in my FOCAL code, and off it went.

As you can see, it worked first time ...

In case anyone out there's interested, this is what it all means:

The "?00.00" was what the FOCAL interpreter would print out when it had been successfully loaded. The subsequent asterisks are its prompt for more input. I've got a feeling that at some point we worked out where this character was and managed to change it. "E A" stands for "Erase All" - this is me telling the interpreter to wipe its internal memory. Somewhat redundant, but never mind. The next six lines are the program. Each one starts with a line number of the form m.n. Why not just one number? Wait and see.

Line 01.01, "SET R=1", initialises the value of variable R to 1. All variables in FOCAL were numeric, although there was a rather dodgy way of expressing strings as numbers as well.

Line 01.02, "FOR R=1,1,10: DO 2.0" is a command to do the whole of group 2 for values of R from 1 to 10 in steps of 1 (so line 01.01 was probably redundant, but never mind - we'll fix that in phase 2). Hang on, what's group 2? Group 2 simply means all the lines with numbers of the form 02.xx. So FOCAL had subroutines! Whoa.

Line 01.03, "QUIT" means what you think it means.

Line 02.01, "SET Y-\=R^3" looks peculiar until you realise that the backslash is what the delete key threw out. So what I really meant was "SET Y=R^3".  This sets the variable Y to R cubed.

Line 02.02, "SET X=(4/3)*3.14159*Y" sets the variable X to four-thirds pi times Y.

Finally, line 02.03, "Y\TYPE 6\%8.04 "V =    "X,   !", which should read "TYPE %8.04 "V =    "X,   !" prints out the value of X. %8.04 is a formatting string (looking suspiciously similar to a C printf format), and the ! at the end is an instruction to do a carriage return line feed.

And of course, the "GO" on the next line tells it to execute the program, which (in case you haven't worked it out) calculates the volumes of spheres with radii from 1 to 10. So you really can say that I started my programming career with a load of balls.

From there on, of course, things got more and more complicated, until I reached the zenith of my school programming career with my Maths 'S' level project, the notorious Binary Editor. This was written entirely in assembler (of course), and one day I may even get around to posting up the source code. In the meantime, here's the User Guide. Of particular interest is the section of the guide devoted to what happens if a tear occurs in the paper tape when loading the program. Apparently the checksum error output to the console will "enable the user to work out which bit has been lost in the tear". The joy of youthful optimism, eh?

© Jonathan M. Pinnock, 2000-6

(BTW, for more reminiscences from schooldays, try this. If you dare.)

 

 

Back to Miscellany

 

About Us | ©2004 Jonathan Pinnock and Associates