Instructing Baby (Digital 60)
Please note, this is archived content and is no longer being updated. Please update your bookmarks and links to point to this permanent URL: http://curation.cs.manchester.ac.uk/d60/www.d60.org.uk/babyInstructions.html.

# 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
• 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 Skip some number of instructions JRP 1 001 Load LDN 2 010 Store STO 3 011 Subtract SUB 4 100 Subtract (same as above) 5 101 Skip if last result <0 CMP 6 110 Stop STP 7 111

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.