# INMC 80 News

## June/July/August 1980 · Issue 1

 1000 (8 in Decimal) 100 (4 in Decimal) 10 (2 in Decimal) 1 (1 in Decimal) ==== 1111 (= 15 in Decimal)

Don’t forget when adding Binary numbers that 1+ 1 = 0, carry 1, and not 2, as it would in Decimal.

Now what has all this got to do with HEX ? Well, that answer is managability. If we take a Decimal number, say ten, then we write ‘10’, If want to express the same amount in Binary, then it becomes the cumbersome ‘1010’, worse, if we write one thousand three hundred and twelve, we write 1312 in Decimal, in Binary this becomes the forbidding figure ‘1010010000’. You can see that even with fairly modest Decimal figures, the Binary equivalents are getting unmanagable. The Z80 Processor has an addressing capactity of 65535 bytes, which in Binary becomes the incredible ‘1111111111111111’, which is difficult to read yet alone assimilate the actual number. To answer the question at the beginning of the paragraph, we’ve got to find some more convenient way of expressing the Binary digits, or the whole thing becomes Impossible from the start. Thats where HEX comes in, but to understand that, we’ve got to go through the knotty business of Binary to HEX and Decimal to HEX conversions.

Having established that other ‘bases’ may be used apart from ‘base 10’, 16 could be used as a base, in fact that is what HEXadecimal means, counting in sixteens. A second thing to realise is that when counting to ‘base 2’ we only need two characters. 0 and 1; counting in ‘base 10’ requires ten characters, 0 1 2 3 5 4 5 6 7 8 9; it therefore follows if we are to count in sixteens, sixteen characters are required. These are:

0 1 2 3 4 5 6 7 8 9 A B C D E F

The third thing to notice is that 16 is the fourth power of 2, and we can make use of that to make simple conversions. We do it by mentally converting a Binary number to Decimal then converting the Decimal to HEX. A messy process, and one that is soon forgotten when you get familiar with HEX. So think of a Binary number, say 11101101110, now split it into groups of four, starting with the right hand end, thus, 111 0110 1110, add a ‘0’ to the left hand end to complete the last group of four, and we get 0111 0110 1110. Now notice that the maximum Decimal number in any group is 15, and with a little practice, the convertion becomes dead easy, like this:

 0111 0110 1110 7 6 14

Now cheat and look at the first (right hand) column in the next Paragraph. Look up the Decimal number, and write down the equivalents. So:

 0111 0110 1110 7 6 14 7 6 E