|
DADDY BOB'S COMPUTER Q & A
BINARY NOTATION
To gain just a little
knowledge into the inner workings of the
computer, it is necessary to know something
about the way it handles numbers. After all,
EVERYTHING a computer does, it does
with numbers. Numbers are all it knows, and
to make matters worse, it only knows two of
them. Strange as it may seem, everything
your computer does, it does by manipulating
just the two numbers: 0 and 1. This is
referred as working to the "Base two", and
should explain why it is called binary
notation.
wo terms used frequently
when talking about computers and programs
are BIT and BYTE. BIT is short for "BInary
digiT", and just where the term Byte came
from is anyone's guess. Possibly the one who
coined it was just hungry at the time, and
couldn't spell too well. (Half a byte is
called a nibble, so who knows). The Binary
Digits referred to are the same 0 and 1
mentioned above. When eight (8) of these
BITs are in the correct combination with
each others, they make up a Byte. When set
correctly, a byte can hold any number from 0
to 255. Bytes usually contain 8 Bits, and
for the purpose of this explanation, we will
work on that basis.
This graphic representation
can be used to visualize how the bits must
be set to represent any of the numbers,
0-255.
|
BIT No. |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
|
BIT Value |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
------ |
---- |
---- |
---- |
---- |
---- |
---- |
---- |
---- |
|
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
255 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
|
34 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
|
200 |
1 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
|
139 |
1 |
0 |
0 |
0 |
1 |
0 |
1 |
1 |
|
127 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
|
219 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
The values from the chart
are written as follows:
0 = 00000000
255 = 11111111
34 = 00100010
200 = 11001000
139 = 10001011
Now, the computer is
perfectly happy using the designation of
00000000 for the decimal number zero, and
00001001 for the decimal number nine.
However, we humans have difficulty relating
to this type notation, since we are
accustomed to using decimal notation. The
decimal or even the metric systems are base
10, and not a power of two as required by
the computer, so something else had to be
devised to suit both.
The first attempt was the
"Octal" system which is base 8. Since 8 is a
power of two, it would work and, for a
while, was used. Data Point computers, like
the ones used by CE before the PCs, used
Octal numeration. Using it, the numbering
sequence would go like this. 0, 1, 2, 3, 4,
5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20,
21, etc., where the 10 actually equals 8,
and the 11 equals 9, and the 20 equals 16.
Perfectly acceptable to the computer, but,
alas, still too confusing to man.
The solution finally was the
Hexadecimal system, simply referred to as
Hex. Hex uses base 16, which again is a
power of two so acceptable to the computer.
Although it eliminates the 10 equals 8
syndrome it added the 10 equals 16 and also
posed another problem to us. Since there are
only 10 digits, 0 through 9, what could be
used as a single digit for the numbers 10
through 15 needed by the Hex system? Well,
it was decided to use the letters A through
F for these numbers. Therefore, counting in
hex goes like this. 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F,
20, etc.
Still
look confusing? Well it is until you really
start to work with hex numbers, and then
they become more convenient to use than
decimal. As an example, it is easier to use
the number FFFF than 65535 when programming.
It is immediately possible to see that FFFF
is the largest number that will fit into two
bytes. This is not so easy to see with
65535. If you are not a programmer, or don't
plan to become one, and then just take my
word for this. Now and then, a hex number is
displayed on your screen during an error
condition or while using some disk
utilities. Even if you still don't
understand Hex numeration, at least now when
you see a number like 14E6h, on your screen,
you'll know what it is. |