# Difference between revisions of "Hexadecimal"

Customfiber (talk | contribs) |
|||

Line 4: | Line 4: | ||

== Working with Hexadecimal Numbers == | == Working with Hexadecimal Numbers == | ||

+ | |||

+ | === Converting between Hex and Binary === | ||

+ | |||

+ | To convert from Binary to Hex simply start from the right and seperate the Binary number into nibbles(groups of four) then simply change each nibble to its respective Hex digit. To convert from Hex to Binary just change each Hex digit to it's respective nibble. Anyone who plans to spend a lot of time working with machine code or Assembly should dedicate the below table to memory. | ||

+ | {| border="1" cellpadding="1" | ||

+ | !Hex!! Binary | ||

+ | |- | ||

+ | |0 || 0000 | ||

+ | |- | ||

+ | |1 || 0001 | ||

+ | |- | ||

+ | |2 || 0010 | ||

+ | |- | ||

+ | |3 || 0011 | ||

+ | |- | ||

+ | |4 || 0100 | ||

+ | |- | ||

+ | |5 || 0101 | ||

+ | |- | ||

+ | |6 || 0110 | ||

+ | |- | ||

+ | |7 || 0111 | ||

+ | |- | ||

+ | |8 || 1000 | ||

+ | |- | ||

+ | |9 || 1001 | ||

+ | |- | ||

+ | |A || 1010 | ||

+ | |- | ||

+ | |B || 1011 | ||

+ | |- | ||

+ | |C || 1100 | ||

+ | |- | ||

+ | |D || 1101 | ||

+ | |- | ||

+ | |E || 1110 | ||

+ | |- | ||

+ | |F || 1111 | ||

+ | |- | ||

+ | |} | ||

=== Converting Decimal values to Hexadecimal values === | === Converting Decimal values to Hexadecimal values === | ||

+ | === Converting Hexadecimal values to Decimal Values === | ||

{{stub}} | {{stub}} | ||

[[de:Hexadezimal]] | [[de:Hexadezimal]] |

## Revision as of 06:33, 31 December 2005

**Hexadecimal** or **base 16** is a number system which uses the numerals 0-9 and letters A-F or a-f to represent digits. It is commonly used in ROM hacking, since it provides an easy way to write the binary numbers used by computers. Often representing numbers as decimal is either unwieldy and meaningless in the case of pointers or obscures the meaning of data stored in bits. For example, a byte could be used as eight true/false flags, but reading the same byte as a decimal number would be meaningless.

*More non-ROM hacking specific information can be found at Wikipedia's hexadecimal article.*

## Contents

## Working with Hexadecimal Numbers

### Converting between Hex and Binary

To convert from Binary to Hex simply start from the right and seperate the Binary number into nibbles(groups of four) then simply change each nibble to its respective Hex digit. To convert from Hex to Binary just change each Hex digit to it's respective nibble. Anyone who plans to spend a lot of time working with machine code or Assembly should dedicate the below table to memory.

Hex | Binary |
---|---|

0 | 0000 |

1 | 0001 |

2 | 0010 |

3 | 0011 |

4 | 0100 |

5 | 0101 |

6 | 0110 |

7 | 0111 |

8 | 1000 |

9 | 1001 |

A | 1010 |

B | 1011 |

C | 1100 |

D | 1101 |

E | 1110 |

F | 1111 |