Our first program will compute the average of two
numbers. First, let's go through the steps on
a hand-held calculator:
A computer program goes through the exact same steps.
Before we can write our first program we introduce
the concepts of registers, the program counter, and
computer instructions; these topics are discussed in
the sections that follow.
Registers
Almost all computers have special memory cells called
registers. For our computer, the first 10 memory
cells in memory are the registers. The registers are
given the uninspiring names of register 0 through
register 9. In addition, the first three registers
in our computer are special and are given the names
`Program Counter', `Stack Pointer', and `Carry'.
Thus, register 0 and the program counter both refer
to the same memory cell.