1. leht 1-st

What are hex files?

Postitatud: 21:04, 14 Jaan 2003
Postitas urmas
Thanks to Bo6017

Hex files are a computer programmer's shorthand - in essence, a way to write what would be very large streams of data in binary format within a very much smaller amount of space.
Counting to 20 in hex, looks like this: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14. And this is the reason, all the op keys you program onto your cards and look at in editors contain a mixture of letters and numbers. The difference in hex is that the letters are actually numbers. Coverting them to the decimal system we are used to A = 10, B=11 . . . F=15. Including 0, this gives 16 possibilities rather than 10 (as in decimal) to write numbers as a single digit. And the bigger the numbers would get in binary or decimal, the greater the amount of space that is saved writing code in the hex format.
To count in hex, you first have to appreciate what you do when you look at a number in everyday decimal use. The decimal system uses a base of ten (ten possible single digit numbers), so what you are actually doing when you look at a number like 1,111 is this:
1 X 10 to power of zero = 1
plus 1 X 10 to the power of 1 = 10
plus 1 X 10 to the power of 2 = 100
plus 1 X 10 to the power of 3 = 1000

Because the hex or hexadecimal system has 16 possible single digit numbers ( 0 to F), the same number written in hex would be very much larger. Instead of ten, you have to look at all numbers in terms of base 16.

So 1,111 in hex, converted to decimal, would look like this:-

1 X 16 to the power of zero = 1 plus
1 X 16 to the power of one = 16 plus
1 X 16 to the power of two = 256 plus
1 X 16 to the power of three = 4,096

in other words, 4,369 in decimal. It's easiest to see how much space is saved for programmers in using hex in the case, where the programmer gets to use his letters A to F as extra single digit numbers.

The number 1111 1111 in binary could be written in decimal as 255, but in hex it can be written in an even smaller amount of space as FF - just two digits to say what binary would have to write in eight, or dec in three.
FF, of course, is like writing 15 15 or:
15 X 16 to the power of zero = 15
plus 15 X 16 to the power of one = 240

and, of course, 15 + 240 = 255.