Page 2: programming
This second page shows how computer programs transform a number
crunching machine into a versatile tool that seems to think.
The earliest computer operators performed a desired calculation by
wiring up the circuits appropriately, which was time consuming and
inefficient. A Princeton University mathematician, John von Neumann
described the concept of a stored program:
One byte (eight bits) represents an instruction. For example, for IBM-PC
- 10110000 00000111
- Means move the number 7 into position A (note that binary 00000111 =
- 00000011 11000011 (a two-byte long instruction)
- Add the bits in location A to those in location B, placing the result
When a computer program is run, machine language instructions are placed
in memory with an instruction pointer set to that location. After each
byte is executed the instruction pointer is advanced to the next step, and
Consider the things a machine instruction can call for:
- Move the number that follows this instruction to location A.
- Add location A and B, placing the result in A.
- Jump to the instruction found at memory location so-and-so.
- Send the number 65 (which stands for capital A) to the printer, which
causes the printer to print an "A".
- Move the number 66 (capital B) to memory location 47104 (or whatever
memory location corresponds to the value of the upper left corner of the
computer screen) to print a "B" to the screen.
- Decrement the value in location C by one.
- Jump to memory location so-and-so if the value in location
C is zero.
Sounds exciting, huh? Well, it is. In particular, look at that last
In IBM-PC language this is number 11100011, called JCXZ, or "Jump
if CX is zero." The emphasis is on if!
The principle that the flow of instructions can branch conditionally is
at the heart of the magic of computing. Now see what concepts can be
represented in machine language code:
- If the person presses "Y" or "y" then write the
word "Yes" on the screen. Otherwise, write "No."
- If the person presses "Y" or "y" then write "Oh,
I'm sorry you're feeling badly." Otherwise, write "Well,
that's good. Have you told someone you loved them today?"
- If the car fuel mix is too rich, make it leaner (electronic ignition
in modern cars)
- If the bouncing ball hits the right wall, change its horizontal
motion to the opposite direction
- If the new checking balance is less than $0, then write, "Sorry
your account is overdrawn."
- For each of the 9 possible moves in tic-tac-toe, go through this
list: If it gives us three-in-a-row, make it. Otherwise, if it blocks
their three-in-a-row, make it. Otherwise, look at the next move, etc.
The point is, a programmer can write code (computer programming) to
specify in advance what it should do, including writing to the screen,
printing on paper, calculating numbers and saving them in memory. What is
more, it can accept input from the user and react according to how it is
programmed. That is how a computer ticks.
Back to index page|Back
to page 1