CODE
The Hidden Language of Computer Hardware and Software

Code Code: The Hidden Language of Computer Hardware and Software is a unique exploration into bits, bytes, and the inner workings of computers. The following reviewers have particularly kind comments about the book:

ISBN: 0-7356-0505-X; Microsoft Press; September 29, 1999; 400 pages (hardcover).
ISBN: 0-7356-1131-9; Microsoft Press; October 11, 2000; 400 pages (softcover).

Information

Interview with Charles Petzold regarding Code on the Amazon.com web site.

The table of contents of Code, a sample chapter, and the index from the Microsoft Press web site.

Availability - Hardcover

The hardcover edition of this book is out of print. You may be able to obtain copies of the hardcover edition from online booksellers listed on my Books page. But remember: Authors receive royalties only when you buy new books!

Availability - Softcover

The softcover edition is available from: as well as many other real and virtual bookstores.

Annotated Bibliography

The annotated bibliography for Code includes notes, references, and suggestions for further reading.

Technical Addendum

For those readers who can't get enough of logic gates and timing diagrams, this technical addendum for Code provides some additional technical information.

Errata - Hardcover Edition

Page 28: The inventor of the battery was Count Alessandro Volta, not Volto. Thanks to Larry Smith for reporting this error.

Page 53: The second sentence should read "Follow down and across to get the sum." Thanks to Noor-Allah Noorani for reporting this error.

Page 63: The last plus sign on the page should not be there. Thanks to Noël Verhoeven for reporting this error.

Page 146: Under the line that begins with "Step 1," the first number in the subtraction should be all 1's like this:

            11111111
          - 10110000
          ----------
            01001111
Thanks to Michael Broschat for reporting this error.

Page 167: The Q-bar in the function table should be Q. The table should be identical to the one on 191, like this:

InputsOutput
D Clk Q
0 1 0
1 1 1
X 0 Q

Thanks to Jonathan Gold for reporting this error.

Pages 167 and 191: Actually, the function tables on pages 167 and 191 should probably show both outputs:

InputsOutputs
D Clk Q Q-bar
0 1 0 1
1 1 1 0
X 0 Q Q-bar

Page 171: Just below the center of the page, the sentence "The outputs of the second stage are inputs to the first stage." should read "The outputs of the first stage are inputs to the second stage." Thanks to Jonathan Gold for reporting this error.

Page 197: In the bottom paragraph, S1 should actually have a bar over the S. Thanks to Jonathan Gold for reporting this error.

Page 264: In the third paragraph, last sentence, the statement "aaaa indicates a 32-bit memory address" should read "aaaa indicates a 16-bit memory address." Thanks to Luis Alonso Ramos for reporting this error.

Page 271: The two lines of code towards the bottom of the page that use MOV instructions should instead use MVI instructions:

          MVI A,27h
          MVI B,94h
          ADD A,B

Page 272: The last full paragraph on the page should read "The shift instructions come in handy when you're multiplying a number by 2 (that's a shift left) or dividing a number by 2 (a shift right). Thanks to Thomas Schaefer for reporting this error.

Page 279: In the first two lines of code, the MOV instructions should be MVI instructions:

          MVI A,25h
          MVI B,12h
          CALL Multiply
Thanks to Erik Larismaa for reporting this error.

Page 291: The headings in the second table should be ASCII Figure rather than Baudot Figure. Thanks to Thomas Schaefer for reporting this error.

Page 308: In third full paragraph below the diagram, the sentence "The data output signal of the 2102 chip goes into this third state when the CS-bar input is 0." should be "when the CS-bar input is 1. Thanks to Erik Larismaa for reporting this error.

Page 322: In the code examples, the CMP instruction should be CPI. The two ADD instructions should be ADI. The AND instruction should be ANI. That ANI instruction should actually be the first instruction of the NibbleToAscii subroutine. Thanks to Erik Larismaa for reporting these errors.

Page 331: In the code examples, the three MOV instructions should be MVI. Thanks to Erik Larismaa for reporting this error.

Page 343: In the formula in the second bulleted item, the exponent of the 2 should be -126 rather than -127:

Thanks to Erik Larismaa for reporting this error.

Page 347: In the third paragraph, first sentence, the phrase "uses many of the same signals as the 8086 and 8087 chips" should read "uses many of the same signals as the 8086 and 8088 chips." Thanks to Demian Johnston for reporting this error.

Page 356: In the last full paragraph on the page, the statement "While ALGOL uses a slash (/) for mulitplication" should, of course, read "While ALGOL uses a slash (/) for division." Thanks to Larry Smith for reporting this error.

Ambiguities and Clarifications

Page 6: In the second full paragraph, the last sentence is: "The receiver sees the short blink and the long blink and knows it's an A." Actually, the receiver doesn't know what letter is being sent until the pause that indicates the end of the letter. Thanks to Larry Smith for reporting this flaw.

Page 7: In the first paragraph I state: "SOS isn't an abbreviation for anything -- it's simply an easy-to-remember Morse code sequence." Many people are under the mistaken impression that SOS stands for "Save Our Ship" or "Save Our Souls." However, this meaning appears to be spurious; I can find no evidence that the letters SOS were chosen to stand for anything. For example, the Oxford English Dictionary, 2nd edition, volume XVI, page 34 says of SOS: "The letters s, o, and s, chosen because easily transmitted in Morse code."

Chapter 3: The discussion of Braille was not meant to be exhaustive. In particular, Grade 2 Braille also includes 76 short-form words, such as "imm" for "immediate". These include "ab" for "about" (so it would require only two symbols rather than the 4 shown on page 19) and "Brl" for "Braille," implicitly including a capital. The example of Louis Braille's name in Braille would thus require only 3 symbols for the last name rather than the 8 shown on page 20. Thanks to Ed Godfrey for this information.

Page 26: The first paragraph indicates that the negative terminal of a battery is called an anode and the positive terminal is called the cathode. Some readers have questioned whether this is correct, since it seems opposite from other uses of the words anode and cathode. The terminology used in Code was taken from:

Linden, David, ed. Handbook of Batteries, 2nd edition. New York, NY: McGraw-Hill, Inc., 1995, page 1.3.

The perspective inside the battery corresponds more closely to other uses of the words.

Page 29: The penultimate paragraph contains the statement "the current (I) is 1.5 divided by a large number." The current is not 1.5. The voltage is. The statement might be better written as: "the current (I) equals 1.5 volts divided by a large number." Thanks to Habib Heydarian for reporting this ambiguity.

Page 49: In the last paragraph the statement occurs: "when adding two Roman numerals, you simply combine all the symbols from both numbers and then simplify the result using just a few rules." The passage should have mentioned that this only works well when Roman numerals are written without using the subtraction principle, for example, without using IV to mean 4. The subtraction principle was a comparatively modern enhancement to Roman numeration. Thanks to Larry Smith for reporting this omission.

Page 284: The last paragraph states: "The x86 family continued in 1985 with the 32-bit 386 chip, in 1989 with the 486, and beginning in 1993, with the Intel Pentium line..." Somehow the 186 and 286 were omitted. The sentence should begin: "The x86 family continued in 1982 with the 186 and 286 chips, in 1985 with the 32-bit 386 chip..." Thanks to Luis Alonso Ramos and Larry Smith for reporting these omissions.

Page 343: About a third of the way down the page appears the statement "If e equals 255 and f equals 0, the number is positive or negative infinity, depending on the sign s." This statement implies that infinity is a number, which it is not. The statement might be better phrased "If e equals 255 and f equals 0, the value is positive or negative infinity, depending on the sign s." Thanks to Jonathan Gold for pointing this out.

Page 355: In the last full paragraph, the sentence occurs: "The print statement -- like many ALGOL statements (but not begin or end) -- must be followed by a semicolon." Actually, a semicolon is not required before the end statement, although it doesn't hurt to have one. Thanks to Larry Smith for clarifying this.

Page 382: The first paragraph contains the sentence: "Java programs must be compiled, but the result of the compilation isn't machine code. It's instead Java byte codes." That's the usual case. However, Java source code can be compiled into machine code if a platform-independent binary is not required. Thanks to Larry Smith for clarifying this.

© Charles Petzold, 2004
cp@charlespetzold.com
This page last updated May, 2004