what is inside a computer. Every part is made out of NAND gates. That wasn’t very difficult was it?
There is one problem here, and that is that 256 bytes is a very small size for a computer’s RAM. We may be able to get away with it in this book, but if you want a real computer, it’s going to need a RAM with many more bytes to choose from.
A larger RAM can be built by providing two registers that are used to select a memory storage location. This allows the use of 8X256 decoders, and results in a grid with 65,536 intersections, and thus a RAM with 65,536 different locations in which to store something.
Here’s an idea of what it would look like: (Don’t bother trying to count the grid lines, it was only possible to fit about half of them on the printed page.)
A bus carries one byte at a time, so selecting one of the 65,536 memory locations of this RAM would be a two-step process. First, one byte would have to be placed on the ‘a’ bus and set into R0, then the second byte would have to be placed onto the ‘a’ bus and set into R1. Now you could access the desired memory location with the bus and the ‘s’ and ‘e’ bits at the bottom of the drawing.
Simplifying again, we have something that looks very much like our 256 byte RAM, it just has one more input bit.
For the rest of this book, we will be using the 256 byte RAM just to keep things simple. If you want to imagine a computer with a larger RAM, every time we send a byte to the Memory Address Register, all you have to do is imagine sending two bytes instead.
Numbers
We are going to return to the subject of codes for a moment. Previously we looked at a code called ASCII that is used to represent written language. Well, numbers are used in written language too, so there are ASCII codes for the digits zero through nine. Earlier we saw 20 of the ASCII codes for part of the alphabet, here are 10 more, the codes for numbers in written language:
0
0011 0000
1
0011 0001
2
0011 0010
3
0011 0011
4
0011 0100
5
0011 0101
6
0011 0110
7
0011 0111
8
0011 1000
9
0011 1001
This is a very useful code, but not everything that computers do has to do with written language. For other tasks, there are other codes that are suited better to those tasks. When it comes to numbers, if you use ASCII, one byte can be any of the 10 digits from 0 to 9. But sometimes there is a byte that is always used to store a number, and that number will never be printed or displayed on the screen. In this case, we can use a different code that doesn’t waste any of its possible states on letters of the alphabet or anything other than numbers. Since a byte has 256 possible states, you can have this code represent 256 different numbers. Since we want to include zero, this code starts at zero and goes up to 255.
Now how is this code arranged? The ASCII above is not used at all; this is a completely different code. This code did not require any committee meetings to invent because it is the simplest and most obvious code that computers use. It is the closest thing there is to a ‘natural’ computer code.
Since this is a long chapter, here is a preview of this code. It consists of assigning a numeric value to each bit in the byte. To use this code, just turn on the bits that add up to the number you want to represent.
To see how this code works, why it is used in computers, and how those bit values were chosen, we will examine the subject of numbers outside of computers.
There are three number systems that you are probably familiar with that we can analyze. As I see it, these three systems are each made up of two ideas or elements – first, a list of symbols, and second, a method for using those symbols.
Probably the oldest number system around is a simple thing called Tally Marks. It has two symbols, “|” and “/.”
Jessica Anya Blau
Barbara Ann Wright
Carmen Cross
Niall Griffiths
Hazel Kelly
Karen Duvall
Jill Santopolo
Kayla Knight
Allan Cho
Augusten Burroughs