Hexadecimal and How to Use It

08/31/2001


To start with, "Hexadecimal" simply means "hex (6) above decimal (10)", or "6 more than decimal".

Hexadecimal is one of a number of binary codes, and it would be well to look closely at this aspect in the right way, to keep from getting unnecessarily lost. There are some key terms that we should also have in mind as we go.

Weighted Values
Each binary bit has an assigned value, depending on its placement or position.
Positional Weights
Where that binary bit is placed determines its weighted value.

Note that the 421 or the 8421 does represent a simple "weighted value" for any bit that happens to be in that "position", hence the term "Positional Weight".

# Octal BCD Hexadecimal Excess-3 Self-Compl Auto-Round
4 2 1 8 4 2 1 8 4 2 1 8 4 2 1 2'4 2 1 5'4 2 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0
1 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1
2 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
3 0 1 1 0 0 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 1 1
4 1 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 0 0
5 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 1 0 1 1 1 0 0 0
6 1 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 1 0 0 1 0 0 1
7 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0
8 1 0 0 0 1 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1
9 1 0 0 1 1 0 0 1 1 1 0 0 1 1 1 1 1 1 0 0
A 1 0 1 0
B 1 0 1 1
C 1 1 0 0
D 1 1 0 1
E 1 1 1 0
F 1 1 1 1

Note that A-F represent 6 numerical values beyond the 0-9 decimal values.

Octal is simply a binary code that goes from 0 to 7, which are 8 possible states.

Binary Coded Decimal is simply a binary code that goes from 0 to 9, which are 10 possible states.

"Excess-3" is actually a special BCD code that is "Self-Complimenting and "Automatic-Rounding"

The 2'421 is actually a special BCD code that is "Self-Complimenting" (more about this later).

The 5'421 is another special BCD code that is for "Automatic Rounding" (more about this later).

Return to Principles of Assembly Language