The Elemental Commands

Section: Manipulation
...Subsection: The Elemental Commands

Just as the simple on/off choices of a switch can be combined to make nearly any kind of information, the seemingly endless variation of things a computer can do really boil down to a small number of tasks that can be combined in very complex ways. These codes are stored in the computer just like everything else as ones and zeroes. A certain set of the most basic commands are built into a computer chip. Each of these commands is represented by a command number. When a computer is expecting a command, it looks at the number it is given and does something based on what that number is. This set of very basic, machine-specific commands is sometimes referred to as a machine language.

load
The load command means "Go to a spot in memory, and look at the value in that spot. Copy that value to the register."

store
The store command is the opposite of the load command. It says "Take the value of the register, and copy it to a particular spot in memory."

add
The add command tells the computer to take the values of two registers, and add them up. All this addition happens in binary. All the other arithmetic operations (subtraction, multiplication, and division) can be derived from addition.

test
The test command simply compares to values. It notes whether the two values are the same or different. It is almost always used in conjunction with the jump command below.

jump
The jump command tells the computer "Move to another command in the list of instructions" This is useful if the computer's behavior should change based on circumstances. For example, different parts of a quiz program should activate based on whether an answer is correct or not.

halt
This command tells the computer that the list of commands is finished. Without such a command, the computer will keep trying to execute commands until it reaches the end of the memory.


Andy Harris, aharris@klingon.cs.iupui.edu