# Difference between revisions of "Hexadecimal"

(→Converting between Hex and Binary: wikification, grammar) |
|||

(2 intermediate revisions by 2 users not shown) | |||

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 [[Binary#Nybble|nibbles]] (groups of four bits) then simply change each nibble to its respective hex digit. To convert from hex to binary just change each hex digit to its 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]] |

## Latest revision as of 00:33, 2 January 2006

**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 bits) then simply change each nibble to its respective hex digit. To convert from hex to binary just change each hex digit to its 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 |