Sunday, December 13, 2009

Now you can program the ZX Spectrum

OK, if you just want to be nostalgic and do some BASIC programming on the ZX Spectrum, click on the image below which will run a faithful emulation of the Sinclair ZX Spectrum complete with BASIC. For more information on Sinclair BASIC you can read the manual.

but here is a very simple program to get you started, follow the instructions:

1. type "10 LET a=10" - (note that the spectrum had short-cuts on the keys so immediately you press L it will display "LET" - you might find this weird at first but after you get used to it it's a very fast way to write a program). Then press RETURN (ENTER) - the code will appear at the top of the screen, that is the first line of the program

2. type "20 PRINT a" - (again, pressing 'P' will result in PRINT being displayed). Then press RETURN (ENTER). Your second program line will be displayed at the top of the screen.

to run the program type: 'R' and 'RUN' will be displayed. Press RETURN (ENTER) and the program will run and print "10" - voila!

Here's another program from the manual that demonstrates taking input from the user and the used of FOR loops:

10 LET total=0
20 FOR c=1 TO5
30 INPUT a
40 REM c=number of times that a has been input so far
50 LET total=total+a
60 NEXT c
80 PRINT total




and here is a screenshot of a program with a background of the original Spectrum keyboard:


The ZX Spectrum - Running "The Hobbit"

Below is a ZX Spectrum Emulator (written entirely in Java) and running the game "The Hobbit" which I spent many hours playing when I was 12 years old.

To start playing, just click on the image and press a key.  You can use basic commands such as:

NORTH, SOUTH, EAST, WEST, UNLOCK/LOCK TAKE/DROP, ATTACK, OPEN DOOR etc. and here is the manual if you would like to have a real play :-)

Unweaving the Rainbow, by Richard Dawkins

We are going to die, and that makes us the lucky ones. Most people are never going to die because they are never going to be born. The potential people who could have been here in my place but who will in fact never see the light of day outnumber the sand grains of Sahara. Certainly those unborn ghosts include greater poets than Keats, scientists greater than Newton. We know this because the set of possible people allowed by our DNA so massively outnumbers the set of actual people. In the teeth of these stupefying odds it is you and I, in our ordinariness, that are here.
RichardDawkins.net

Books I am reading this book at the moment:

Atheist

The Out Campaign: Scarlet Letter of Atheism