Hexadecimal

Since it is rather annoying to write out many ones and zeroes, there is a shorthand way of writing binary, called hexadecimal. Each four binary bits are encoded by a single hexadecimal digit. Here is a table showing what each hexadecimal digit stands for.

HexadecimalBinaryHexadecimalBinary
0000081000
1000191001
20010A1010
30011B1011
40100C1100
50101D1101
60110E1110
70111F1111

To write hexadecimal numbers in assembly language, we append the number with an h and prepend it with a 0. So now we have a third way of writing the number 214 in assembly language. It is 0D6h.

We can also specify numbers to be moved into registers, in hexadecimal.

MOV CH,0D6h

Of course hexadecimal is base 16, where there are 16 different possibilities for each digit (0-F), and where each place corresponds to a power of 16.

E.g. 045C3h corresponds to the decimal number 4x16^3 + 5x16^2 + 12x16^1 + 3x16^0 = 16384 + 1280 + 192 + 3 = 17859.