Instructing Baby (Digital 60)

Instructing Baby

A computer program is list of very simple instructions, which is stored and obeyed in sequence. The computer will start at the beginning and continue through the list unless told to go to another instruction, known as a jump. Jumps may be to forward and backward, or conditional on the result of a calculation. These simple instructions can be used to create loops and other structures.

As well as instructions there is also data – the information the computer works with. In the case of the Baby, this was usually stored after the last instruction of the program.

The are just seven different instructions used when programming the Baby

  • Load a number from memory
  • Store a number in memory
  • Subtract a number in memory
  • Skip the next instruction if the last result was negative
  • Skip some number of instructions
  • Jump to an instruction
  • Stop

*Addition was performed by subtracting a minus number e.g. 1+3 = 1- (-3)

Instruction Abbreviation number binary dot pattern
Jump to an instruction JMP 0 000 000
Skip some number of instructions JRP 1 001 001
Load LDN 2 010 010
Store STO 3 011 011
Subtract SUB 4 100 100
Subtract (same as above)   5 101 101
Skip if last result <0 CMP 6 110 110
Stop STP 7 111 111

line from baby's memory showing first 5 dots as data and 13th to 15 as instruction type

Each row in the Baby's memory contains just one instruction in the program. The 13th to 15th bits code the type of instruction (subtract, store etc.) with the first five bits coding additional information for that instruction (e.g. which line of memory that instruction should use). The remaining bits of the line can be used for any other purpose (e.g. storing data). If a line is not used to hold an instruction it can be used to store a 32-bit binary number (i.e. data to be used in the program).

The principle in programming modern computers is just the same, the only difference an increase in the number of different types of instructions. Multiplication, and division are examples of instructions now present in modern computers, as although the Baby could perform them by repeated subtraction (see first program below) it was a slow process.

The series of instructions had to be entered line by line, dot by dot. You can learn more about controlling the baby.


\