Hexadecimal: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
m (Using new {{moreinfo wikipedia}} template.)
 
(4 intermediate revisions by 4 users not shown)
Line 3: Line 3:
{{moreinfo wikipedia|page=hexadecimal}}
{{moreinfo wikipedia|page=hexadecimal}}


== 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.
{| class="wikitable"
!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 ===
{| class="wikitable"
|-
! Decimal !! Hexadecimal
|-
| 0 || 0
|-
| 1 || 1
|-
| 2 || 2
|-
| 3 || 3
|-
| 4 || 4
|-
| 5 || 5
|-
| 6 || 6
|-
| 7 || 7
|-
| 8 || 8
|-
| 9 || 9
|-
| 10 || A
|-
| 11 || B
|-
| 12 || C
|-
| 13 || D
|-
| 14 || E
|-
| 15 || F
|}
=== Converting Hexadecimal values to Decimal Values ===
{{stub}}
{{stub}}
[[de:Hexadezimal]]

Latest revision as of 14:51, 25 October 2024

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.

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

Converting Decimal values to Hexadecimal values

Decimal Hexadecimal
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F

Converting Hexadecimal values to Decimal Values

So very stubbly.
This page is rather stubbly and could use some expansion.
Are you a bad enough dude to rescue this article?