7
Once upon a time Not so very long ago An intro to hex

Once upon a time Not so very long ago An intro to hex

Embed Size (px)

Citation preview

Page 1: Once upon a time Not so very long ago An intro to hex

Once upon a time

Not so very long ago

An intro to hex

Page 2: Once upon a time Not so very long ago An intro to hex

The problem is, that even though binary is perfect for computers.. Binary is really hard for people to read• For example:• 11001011000101111101101101011101• Here is the starting address of an instruction in

memory that the computer needs to run a program 1

– Not easy to read– Not easy to copy– Not easy to work with

1 And this is only the 32 bit version, a 64 bit address would, obviously, be twice as long

Page 3: Once upon a time Not so very long ago An intro to hex

Somebody had the bright idea…

• Why not group the binary numbers into chunks to make them easier to read?

• 0100 0011 1011 0111 1011 1010• That’s better

• But there still must be a better way

Page 4: Once upon a time Not so very long ago An intro to hex

If you use groups of 4 bits, how many unique combinations of 0’s and 1’s are there?

• 1000• 1001• 1010• 1011• 1100• 1101• 1110• 1111

• 0000• 0001• 0010• 0011• 0100• 0101• 0110• 0111

• 0• 1• 2• 3• 4• 5• 6• 7

• 8• 9• 10• 11• 12• 13• 14• 15

Would it work to represent each unique combination with a unique symbol?

Page 5: Once upon a time Not so very long ago An intro to hex

Supposedly….• IBM invented the term hexadecimal • 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 = base 16• Since this system needed six extra symbols, why not just

use the first six letters of the alphabet?• The symbol for the value 10 in decimal is represented by

the symbol A in hex. Both are represented in the computer as binary 1010.

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

• There is an interesting reason why IBM named it "hexadecimal". The prefix "hex" is Greek but "decimal" is Latin. Why didn't they go with an "all Latin" name? Well, then the name would then have been "sexadecimal" and IBM just couldn't accept a name like that.

Page 6: Once upon a time Not so very long ago An intro to hex

What color is:010000111011011110111010?

• http://rogercortesi.com/athleticlog_help/html_multi/colorchart.png

Break it up0100 40011 31011 B0111 71011 B1010 A

Page 7: Once upon a time Not so very long ago An intro to hex

It’s easy to convert back and forth

• Take binary numbers in chunks of 4• Write down the corresponding hex number– 1000 0101 0010 1100 1111– 8 5 2 C F

• Write hex numbers in binary– 37ED– 0011 0111 1110 1101