UK101

Sample Programs and Tapes

The following sample programs and tapes are provided:

In addition this page provides some notes about the binary and ASCII tape formats used by the simulator and details of how to recover programs from cassette tapes.

Note: Where indicated (using a cassette image) some of these sample programs and tapes are recovered from original software. I do not own the copyrights for these recovered programs and so I sincerely hope no one will mind them being included in this package. If any of the original copyright owners object, please contact me at the email address at the bottom of the page and I will gladly remove anything that should not be here.


Hello World

Source Code samples/basic/hello1.basic

This is a very simple "hello world" BASIC program. This program is used in the quick start guide.

This should be loaded as a BASIC program by typing the LOAD command in BASIC and playing the tape.


Character Set

Source Code samples/basic/charset.basic

This is the program from page 38 of the manual which can be used to display most of the character set of the machine. It is not quite the same as the listing in the manual, as that listing actually contains a couple of bugs and also needed some changes to work correctly with the New Monitor.

This should be loaded as a BASIC program by typing the LOAD command in BASIC and playing the tape.


New York Taxi

Sample Tape
Source Code samples/basic/nytaxi.basic

This is a game that was provided on a sample tape that came with the original machine.

This should be loaded as a BASIC program by typing the LOAD command in BASIC and playing the tape. You should set the keyboard to raw mode to play the game.


Hectic

Sample Tape
Source Code samples/basic/hectic.basic

This is a game that was provided on a sample tape that came with the original machine.

This should be loaded as a BASIC program by typing the LOAD command in BASIC and playing the tape. You should set the keyboard to raw mode to play the game.


Extended Monitor

Sample Tape
Program Tape samples/tapes/exmon.tape

This is the Extended Monitor that was provided on a sample tape that came with the original machine. The extended monitor provided some extra function to help with writing and debugging simple machine code programs.

Details of the extended monitor can be found on its instruction sheet.

The extended monitor is a machine code program and needs to be loaded through the Monitor, not as a BASIC program. To do this first reset the machine then select M to enter the monitor, press the L key to begin loading and play the tape. The extended monitor first loads a short checksum loader routine then loads the rest of itself in checksum format.


Space Invaders

Invaders Tape
Program Tape samples/tapes/invaders.tape

This is a copy of Premier Publication's excellent Invaders space invaders game.

Invaders is a machine code program and needs to be loaded through the Monitor, not as a BASIC program. To do this first reset the machine then select M to enter the monitor, press the L key to begin loading and play the tape. Once the game is loaded you can reset the machine and perform a warm start to restart it at any time.

The game was intended to be played on a standard 1Mhz processor, if you have over-clocked the processor (see system configuration) it may run too fast. Some old notes I have suggest that location $0F69 defines the game speed with the default value being 20 - on a 2MHz machine this might be best changed to 40, it says.

To move the laser the CTRL is used to go left and the left-SHIFT key is used to go right. On a real UK101 the CTRL-key is above the SHIFT-key so CTRL-for-left and SHIFT-for-right makes sense. Unfortunately these keys are the other way up on a PC keyboard so this is not ideal! I once knew some locations to patch to change these keys, but I can no longer find those notes - sorry! You should set the keyboard to raw mode to play the game.


Binary and ASCII Tape Formats

When the UK101 wrote data to a cassette tape it was written as a series of bytes. Although most of the bytes that were written were standard ASCII characters, the tapes would include some control characters, some padding NUL (0x00) characters and possibly some bytes whose values were outside the range of the standard character set. If these tapes are saved as PC files, the resulting file is not guaranteed to be viewable on the PC and can probably not be successfully edited using standard PC editors without some data corruption.

To help overcome these problems the simulator allows tapes to be stored in one of two formats:

Binary
This the raw bytes format as would have been stored on a real cassette tape. If you recover a program or data from an old cassette tape it will be in binary format.

All the sample machine code programs are in binary format and have a file extension of .tape.

ASCII
This is a converted format that can be viewed and edited on the PC using any standard PC editor (for example Notepad on Windows) without any data loss or data corruption.

The conversion leaves any standard ASCII character unchanged, it detects line ends and stores them as standard PC style line ends and any other unrecognised byte is converted to an escaped form \nn where nn is a pair of hexadecimal digits.

All the sample BASIC programs are in ASCII format and have a file extension of .basic.

The simulator will correctly recognise and load tapes in both binary or ASCII format and can save in either format. If you are saving a BASIC program it would make sense to save in ASCII format (which is the default) as the resulting program can then be viewed and edited on the PC. If you are saving a tape to potentially load back onto a real UK101 you will need to ensure it is in binary format.

The utility programs Tape Reader and Tape Writer can be used to quickly convert between the two formats.

Recovering Programs from Old Cassette Tapes

If you have original UK101 programs on old cassette tapes it is usually possible to recover them on a PC so they can be loaded and used with the simulator, provided the tapes are still playable and provided you still have something to play them with. This is done using an excellent piece of software written by Martin Ward that can decode the tape sounds to recover the original data bytes. The process is something like this:

  1. Download and install Martin Ward's kansas city tape decoder. This is a perl script, so might require a few pre-requisites to be gathered from elsewhere if you are a Windows user (like me).
  2. Attach a cassette tape player to the sound card in your PC. I used an old (but good quality) Sony Walkman and plugged the headphone output into the line-input on the PC (it's best not to use the microphone input) and set the volume to about 7.
  3. Play the tape and record the sound to a WAV file, setting to Mono (rather than Stereo) if you can and sampling at the standard 44.1kHz. I used Audacity to do the recording and exporting as a WAV, remembering to trim off any unwanted blanks and noise at the beginning and end of the recording. Make sure you save as an uncompressed WAV file, not an MP3.
  4. Use the kansas city decoder perl script to process the WAV file and create the decoded tape. This might take a little while if the original tape was fairly long. Hopefully the data will be analysed, processed and extracted correctly - Martin's program did a fine job for all the tapes I have found and tried.
  5. The resulting file will be what I called binary format (even though it may have a .txt extension). This can be loaded directly into the simulator as either a BASIC program or as machine code in the monitor or you can use the Tape Reader utility to convert the binary form to ASCII for easy viewing or editing on the PC.

Tim Baldwin
October 2011
tjb101@tinymail.co.uk
Return to index

© Tim Baldwin 2010,2011