# The Workings of Hexadecimal Code

Tutorial 2, "Understanding Electronic Communication," introduced the concept of binary notation. This is how computers count-by setting the value of a two-position switch to either 0 (off) or 1 (on). Ones and zeroes work well when machines are conversing, but that language can be somewhat confusing for computer designers and programmers. To simplify the representation of numbers and notations, designers and programmers use a numbering system called hexadecimal notation (also known simply as hex). This is a numbering system based on 16 instead of 10. Fortunately, computer technicians do not have to be experts in hexadecimal notation. You do, however, need to know how to use the numbering system as it relates to computer memory.

Hexadecimal is used to simplify notation of binary code in much the same way that we sometimes count in 5s or 10s when it is more convenient than working our way through a problem by 1s. You might ask how anyone would find it simpler to count in hex. Well, in dealing with a system that uses 8 bits, addressing counting locations in hex (a system based on eight positions) makes perfect sense.

All address buses and wires within a computer come in some multiple of 4 (8, 16, 20, 24, 32). Because there are 16 different combinations, the 16 unique characters of the base-16 numbering system are a natural choice for computer shorthand when referring to memory locations or a bus address. The following table contrasts binary notation with hex shorthand.

Binary Number Hex Shorthand Binary Number Hex Shorthand
0000 0 1010 A
0001 1 1011 B
0010 2 1100 C
0011 3 1101 D
0100 4 1110 E
0101 5 1111 F
0110 6
0111 7
1000 8
1001 9

There is no need to say:

``` 10110110011000101101
```

To use hex shorthand:

• Break the 20 digits into 5 sets:
``` 1011     0110     0110     0010     1101
```
• Give each 4-character set its hex shorthand:
``` 1011      0110      0110      0010      1101
B         6         6         2         D
```

Hex shorthand = B662D

To represent all the possible addresses for the 20-bit address bus, we use 5 hex values (0 to F) that map to their binary equivalents, from all 0s:

``` 0000     0000     0000     0000     0000
0        0        0        0        0
```

to all 1s.

``` 1111     1111     1111     1111     1111
F        F        F        F        F
```

Each of the possible memory locations for the Intel 8088 can be represented by 5-digit hexadecimal values, starting at 00000 and ending at FFFFF.