Virtual ICT 1301

Tutorial 1: your first instructions and program

By the end of this tutorial you will have given Flossie single instructions by hand, then typed in and run a small program that plays tones through her speaker. No previous knowledge of computers is needed.

Getting started

First, start Virtual Flossie by visiting ict1301.virtualcolossus.co.uk/flossie/ (it opens in a new window, so you can keep these instructions open alongside it).

The website will open on a phone or tablet, but to use it properly you need a larger screen, a keyboard and a mouse. This tutorial assumes you are using a PC or Mac.

Moving around: view mode and use mode

The simulation has two modes. The bottom left of the screen shows which one you are in:

  • View mode (eye icon): moving the mouse turns your head to look around. Use the W, A, S and D keys to walk forward, left, back and right. Try walking around to look at the computer.
  • Use mode (pointing finger icon): a cursor appears on screen, and you can click on switches, knobs and buttons to control the computer.

To switch from view mode to use mode, click the mouse button. To switch back to view mode, click anywhere that is not a control; the background is a good choice.

Go to the console

When you have finished looking around, press C to go to the console. If you cannot see the controls on the far left, press A once to move your view to the left. For the rest of this tutorial you will be in use mode, clicking on the console controls.

Warming up: the sound and the lamps

Flossie has a small loudspeaker. Programmers used it to hear what the machine was doing, and later in this tutorial you will use it to make tones.

  1. At the bottom right of the grey section is a switch labelled Alarm. Press it down and you should hear a sound.
  2. If it is too loud, find the volume knob just above that switch. Click it and turn it left (anticlockwise) to make it quieter, or right to make it louder. If you hear nothing at all, check your computer’s own volume control too.
  3. Now move the same switch past its middle position, up to Monitor. Leave it there; you will need it later.
  4. Look at the switch to its left, labelled Lamp Test. Push it down and every lamp on Flossie lights up. Push it up and they all go out. It is spring-loaded, so it returns to the middle when you let go.

Four ideas you need first

Every number you type in this tutorial is either an instruction or data. These four ideas explain what the digits mean, so read this section before you start turning knobs.

1. The store. Flossie keeps numbers in her store, which has 2000 numbered boxes called locations, from 0000 to 1999. The number of a location is its address. Think of a long row of numbered lockers, like those at a gym or station. Each locker holds exactly one thing, you find it by its number, and putting something new in replaces whatever was there before.

2. Words. Each location holds one word: 12 decimal digits, such as 294000284000. A word can be a number to calculate with, or it can be two instructions side by side.

3. Instructions. An instruction is 6 digits long, so two fit in a word. Flossie obeys the left-hand instruction first, then the right-hand one, then moves on to the next location. Every instruction has two parts:

DigitsNameWhat it meansExample: 660000
First 2Function codeWhat to do66 = add one
Last 4AddressWhich location to do it to0000 = location 0000

So 660000 reads as “add one to location 0000” and 410001 reads as “store Register A in location 0001”. Once you can split an instruction into these two parts, you can read every instruction in this tutorial.

4. Registers. A register is a working space inside the machine, separate from the store. Two matter here:

  • Control Register 1 holds the instruction Flossie is about to obey. Normally Flossie fills it herself from the store. In this tutorial you will often set it by hand, which lets you give Flossie one instruction at a time.
  • Register A (the windows labelled Arithmetic Register) is the register that numbers pass through on their way into and out of the store. Whatever Flossie has just read or written usually shows up here, which is why it is such a useful thing to watch.

How the knobs and lamps show a digit

Each knob sets one digit. It has 16 positions, like a compass with 16 points: straight up is 0, the next point clockwise is 1, pointing right (East) is 4, straight down (South) is 8, and so on up to 15. Only 0 to 9 are used for ordinary decimal numbers.

There are 16 positions because Flossie stores each digit as four on/off bits worth 1, 2, 4 and 8. The lamps above the knobs show these four bits. To read a digit, add up the bars that are lit: 6 lights the 2 and 4 bars, and 9 lights the 1 and 8 bars. This is called binary coded decimal.

Turning the knobs does not change the register on its own. Each register has a white Set button that copies the knob settings into it, and the lamps then change to match.

Your first instruction: count up

You will give Flossie the instruction 660000, “add one to location 0000”, and make her obey it again and again.

Step 1: stop Flossie moving on

Above the Lamp Test switch is another switch. Move it to Hold CR (Hold Control Registers).

Normally, after obeying an instruction Flossie fetches the next one from the store. Hold CR stops that: the instruction you put in Control Register 1 stays there, so every time you press Start she obeys the same one again.

Step 2: put 660000 into Control Register 1

On the left of the console is a long horizontal row labelled Control Register. Just above it are seven knobs.

  1. Ignore the leftmost knob, marked 1 2 3, for now. The other six knobs set the six digits of the instruction, left to right.
  2. Click the second knob and drag down and to the right, towards South East. The number in the tiny round window above the knob changes as you go. Set it to 6 and let go.
  3. Set the knob to its right to 6 as well.
  4. Leave the remaining four knobs at 0.

The knobs now read 66 0000: function code 66 (add one) and address 0000 (location 0000).

Now press the white Set button, up and to the left of the knobs.

The lamps above the knobs now show 66 in binary coded decimal: in each of the first two digits, the 2 and 4 bars are lit, and 2 + 4 = 6. Control Register 1 now holds 660000.

Step 3: obey it one step at a time

  1. Find the knob marked Auto Manual, down and to the right. It works like the other knobs and starts pointing straight up, at Auto. Drag it one position to the left, to Manual. In Manual, Flossie obeys one instruction each time you press Start.
  2. Find the green Start button, further down and to the right.
  3. Look at the windows labelled Arithmetic Register (Register A), up to the right.
  4. Press Start a few times while watching those windows. The number goes up by one each press.

What is happening: each time, Flossie reads location 0000 into Register A, adds one, and writes the answer back to location 0000. Because the number passes through Register A, you can watch the count there.

Step 4: let it run on its own

Turn Auto Manual one more position left, to Repeat Manual.

Flossie now obeys the instruction about three times a second. Watch the digits: like a person counting, she goes from 0 to 9 and then carries one into the digit to the left. She can also work in base 16, and even in old pounds, shillings and pence, but almost everything in this tutorial uses ordinary decimal.

Count down instead

While Flossie is still counting, set the Control Register knobs to 670000 and press the Control Register’s white Set button.

The count now goes down. Function code 67 means “subtract one”, and the address is still 0000, so Flossie now takes one away from location 0000 each time.

When the count passes zero it looks odd: minus one appears as 999999999999. This is called ten’s complement, and it is how Flossie stores negative numbers. Minus a thousand, for example, is 999999999000.

Writing a program into the store

So far Flossie has obeyed one instruction you held in front of her. A program is a list of instructions stored in the store, which Flossie works through by herself. You are going to store this two-word program, which plays a tone:

LocationWordLeft instructionRight instruction
0000000000000000000000: do nothing000000: do nothing
0001294000284000294000: if switch 29 is down, jump to 0000284000: if switch 28 is down, jump to 0000

The instructions in location 0001 are jumps, a different kind of instruction. You can tell them apart by the 4 in the third digit. They are explained fully after you have heard the program run.

There is no knob for typing straight into the store. Instead you use single instructions, as before, to make Flossie put each word there herself.

Step 1: write location 0000

  1. Turn Auto Manual back to Manual. Leave the other switch on Hold CR.
  2. Set Control Register 1 to 400000 and press its Set button.
  3. Press Start.

Function code 40 means “fill this location with zeros”, and the address is 0000. Location 0000 still held the count from earlier, so this clears it. A word of all zeros is also two “do nothing” instructions, so you have just written the first line of the program.

Step 2: put the second word into Register A

  1. Find the 12 knobs under the windows labelled Arithmetic Register. Set them so the tiny round windows read 294000284000.
  2. Press the white Set button to their left. This one belongs to Register A, not to the Control Register.

The lamps above now show the same number in binary coded decimal. Look at a 9: the 1 bar and the 8 bar are lit, and 1 + 8 = 9.

Step 3: copy Register A into location 0001

  1. Set Control Register 1 to 410001 and press its Set button.
  2. Press Start.

Function code 41 means “store Register A in this location”, and the address is 0001. Location 0001 now holds 294000284000, and the program is complete.

Running the program

  1. In the middle of the console are ten switches numbered 20 to 29, the manual indicators. Push each one down.
  2. Near the bottom right of the grey section, move the switch from Hold CR back to its middle position, Circ + 1. This is the normal setting: Flossie moves on to the next instruction after each one, instead of repeating the same one.
  3. Turn Auto Manual straight up to Auto, the normal setting for running programs. Flossie now keeps going after Start instead of stopping after one instruction.
  4. Set Control Register 1 to 004000 and press its Set button. This is “jump to location 0000”, so it sends Flossie to the start of your program.
  5. Press Start.

You should hear a high-pitched tone, as long as the Alarm/Monitor switch is still on Monitor and the volume is up. Now flick switch 29 up and down: you get two different tones. Leave switch 28 down.

You have just run a real program on Flossie.

How the program works

Jump instructions

Normally Flossie obeys the left instruction in a location, then the right one, then moves to the next location. A jump changes that order. A 4 in the third digit marks an instruction as a jump, and the digits work differently:

DigitsIn 294000Meaning
First 229The condition to test: here, “is switch 29 down?”
Third4Marks this as a jump
Last 3000Where to jump to: location 0000

If the condition is true, Flossie jumps to that location. If it is false, she ignores the jump and carries on with the next instruction. Condition 00 is always true, so 004000 always jumps to location 0000; it is called an unconditional jump. That is why you used it to start the program.

When most jump conditions are true, Flossie also sends a click to her loudspeaker. Lots of clicks in quick succession make a tone.

Following the program

Switch 29 down:

  1. Location 0000: two “do nothing” instructions. They just use up a little time.
  2. Location 0001, left: 294000. Switch 29 is down, so Flossie clicks the speaker and jumps back to location 0000.

The loop is short, so the clicks come quickly and the tone is high.

Switch 29 up:

  1. Location 0000: two “do nothing” instructions, as before.
  2. Location 0001, left: 294000. Switch 29 is up, so the condition is false. No jump and no click, but it still takes a little time.
  3. Location 0001, right: 284000. Switch 28 is down, so Flossie clicks and jumps back to location 0000.

This loop takes a little longer, so the clicks are further apart and the tone is lower.

Why leave switch 28 alone? If 28 and 29 are both up, neither jump happens. Flossie carries on to location 0002 and beyond, obeying whatever happens to be stored there.

Going further: four notes

Adding two more notes takes one more word in location 0002, using exactly the same method as before.

  1. Turn Auto Manual to Manual and the other switch to Hold CR.
  2. Set Register A to 274000264000 and press its Set button.
  3. Set Control Register 1 to 410002 and press its Set button.
  4. Press Start. This stores Register A in location 0002.
  5. Turn the switch back to Circ + 1 and Auto Manual to Auto.
  6. Set Control Register 1 to 004000, press its Set button, then press Start.

The new word adds two more chances to jump back, each a little further along the program, so each gives a lower note:

Switches upJump takenTone
None294000Highest
29284000Second
28, 29274000Third
27, 28, 29264000Lowest

Leave switch 26 down, for the same reason you left 28 down before.

Going further still: nine notes

If you want more, store these three words in the same way:

LocationWordInstruction to store it
0003254000244000410003
0004234000224000410004
0005214000004000410005

You now have nine notes, from switches 29 down to 21, plus silence. The final 004000 is an unconditional jump, which makes no click, so with switches 21 to 29 all up you hear nothing. Switch 20 cannot be used for a note: unlike the others, a jump on condition 20 does not click the speaker.

If you were very clever, you could pad the program with extra 000000 “do nothing” instructions to tune the tones into proper musical notes. There are better ways of doing that, and people wrote music programs for Flossie and similar computers long before digital synthesisers were practical.

Quick reference: instructions in this tutorial

In each instruction, the first two digits say what to do and the last four say which location. In a jump, a 4 in the third digit marks it as a jump and the first two digits name the condition.

InstructionMeaning
000000Do nothing (just uses a little time)
40nnnnFill location nnnn with zeros
41nnnnStore Register A in location nnnn
66nnnnAdd one to location nnnn
67nnnnSubtract one from location nnnn
004nnnAlways jump to location nnn (unconditional jump)
2x4nnnIf switch 2x is down, click the speaker and jump to location nnn

That’s it for now. Come back for the next tutorial and have more advanced fun with Flossie now that you know the basics.

Next: programming the ICT 1301 with punched cards, or look up any unfamiliar terms in the glossary.