Datasheet
17
Chapter 1: What Is a Program?
The computer will not do anything that it hasn’t already been programmed
for. The creation of a Tire Changing Language was not enough to replace
my flat tire — someone had to write the program instructions to map out
step by step what the computer will do. And writing a real-world program
designed to handle all of the special conditions that can arise is not an easy
task. Writing an industrial-strength program is probably the most challenging
enterprise you can undertake.
So the question becomes: “Why bother?” Because once the computer is prop-
erly programmed, it can perform the required function repeatedly, tirelessly,
and usually at a greater rate than is possible under human control.
Computer Languages
The Tire Changing Language isn’t a real computer language, of course. Real
computers don’t have machine instructions like “grab” or “turn.” Worse yet,
computers “think” using a series of ones and zeros. Each internal command
is nothing more than a sequence of binary numbers. Real computers have
instructions like 01011101, which might add 1 to a number contained in a spe-
cial purpose register. As difficult as programming in TCL might be, program-
ming by writing long strings of numbers is even harder.
The native language of the computer is known as machine language and is usu-
ally represented as a sequence of numbers written either in binary (base 2)
or hexadecimal (base 16). The following represents the first 64 bytes from the
Conversion program in Chapter 3.
<main+0>: 01010101 10001001 11100101 10000011 11100100 11110000 10000011 11101100
<main+8>: 00100000 11101000 00011010 01000000 00000000 00000000 11000111 01000100
<main+16>:00100100 00000100 00100100 01110000 01000111 00000000 11000111 00000100
<main+24>:00100100 10000000 01011111 01000111 00000000 11101000 10100110 10001100
<main+32>:00000110 00000000 10001101 01000100 00100100 00010100 10001001 01000100
Fortunately, no one writes programs in machine language anymore. Very
early on, someone figured out that it is much easier for a human to under-
stand ADD 1,REG1 as “add 1 to the value contained in register 1,” rather than
01011101. In the “post-machine language era,” the programmer wrote her
programs in this so-called assembly language and then submitted it to a pro-
gram called an assembler that converted each of these instructions into their
machine-language equivalent.
05_617977-ch01.indd 1705_617977-ch01.indd 17 7/6/10 11:38 PM7/6/10 11:38 PM