1.10. 8-Bit/64-bit Computer Architecture

Now you may have even heard these phrases like this system is 32-bit architecture or a 64-bit architecture. That refers to the number of bits that the CPU is most happy in dealing with and moving around. The larger the better. Typically, no modern CPU just wants to deal with one measly bit at a time. It's just not that useful.

But here's the thing: 64-bits can represent a huge number but I don't have to use it just to represent a number. I could also take the same 64 bits and decide I will use its values (a collection of information) to represent an 8 by 8 pixel area of the computer screen. For example, I can use the 0’s and 1’s to turn 64 specific pixels of an image on or off.

Image

Fig 1.10.1: An 8 by 8-pixel image produced by turning on some pixels (1’s) and turning off some (0’s)

Fig 1.10.1 shows how we can take a few on off switches and use them to represent a picture such as an alien spaceship.

Now back to the machine code. Why is it not 1's and 0's? Well it kind of is. Let me explain it with bananas.

If I'm a grocer and at the start of each day I count the bananas I have for sell. Whatever that amount is, I could write it down with words, say twenty-seven. I could instead use decimal digits (a two and a seven – 27) or Roman numerals, XXVII, or I could use marks on a chalkboard. I could also use my hands or little pictures of bananas. Whichever one I use, they all mean the same thing.

Image

Fig 1.10.2: Various ways to count 27 bananas

None of these values are approximate. They're all exactly 27. They’re just different methods to convey the same information. We will use whatever method that is most useful at the time, usually the that is most concise and compact way to do it. That's what's happening here.

Machine code can be shown in binary, but it's more common to use a format called hexadecimal or Hex.

We can view more information in a smaller area using Hex than using binary. If I have any of these groups of eight bits and I need to describe those arrangements with binary, I need eight 1’s and 0’s, but using Hex, I just need two digits. That is because each digit of Hex can have 16 different values: 0 through 9 and A through F instead of just the two different values 0 and 1 that we get with each binary digit.

So, a shown in Fig 1.10.3, the binary numbers on the left become the hexadecimal values on the right.

Image

Fig 1.10.3: Binary numbers converted to Hexadecimal numbers

So, when we see machine code, it is not the specific details of exactly which bits are 0 and which bits are 1. It's just using a more concise way to display it. Now, right now we do not need to get into the details of writing binary or hacks or translating from one to the other.

It is not necessary when you're beginning, but do know that in the rare occasion where a programer needs to look at information so specific, it is usually more convenient to view it in hex than view it in binary.

That is absolutely as deep as we need to get into this right now.