Actions

SCHG

Number Systems

From Sonic Retro

Number Bases

Basics

Number Bases are a core mathematical concept in the place-value number representation system. Put simply, a number base is the number of values that one place-value can represent. If one goes over this value, the next place-value must be used. Humans typically count in base 10, or decimal. Computers count (and "think") in binary. Binary numbers are the most basic command that a computer can be given — they act like small on/off switches working in tandem. However, to even issue a basic command (such as typing the letter "a"), many binary commands are used, so humans use base 16, or hexadecimal, to shorten long binary numbers (which are quite common).

A binary number looks like this:

0001 0001 1101 0111

The same number in hexadecimal is:

11D7

And in decimal:

4,567

-One thing to note is that sometimes people refer to "Decimal" format as "Denary" format.

Binary

Notice that our binary number was grouped into fours. We do this for the same reason that we group decimal numbers into threes - to make them more readable. Look at it without the digit grouping:

0001000111010111

Obviously, it's far more readable with the grouping. Those groups of fours are also called nybbles.

This brings up another part of the binary system - terminology. A bit is simply a digit - the word is a shortening of "binary digit". The term "bit" takes the place of "place value" when speaking of binary numbers. A nybble is a collection of four bits, or half of a byte. A word is two bytes, and a longword is two words. There are terms for longer strings of binary numbers, but these are the only ones really relevant to the Genesis.

Hexadecimal

Binary numbers can get quite long. That's why we use hexadecimal. The main advantage with this is that it's really easy to convert hex numbers to binary and vice versa. A quick reference chart is below.

Hex Bin Dec
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15
Sonic Community Hacking Guide
General
Sonic Music Hacking Guide | SonED2 Manual
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic Eraser | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic 2 (Nick Arcade prototype) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (8-bit) | Sonic 2 & Knuckles | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Sonic 3 | Sonic & Knuckles | Sonic 3 & Knuckles | Sonic & Knuckles Collection | Sonic Crackers | Sonic 3D: Flickies' Island | Chaotix | Sonic R PC | Sonic Jam 6 | Sonic Advance | Sonic Advance 2 | Sonic Advance 3 | Sonic Battle | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Shadow the Hedgehog | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Generations
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | Subroutine Equivalency List | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | VDP Documentation | Official Sega 32X Documentation | Official Mega-CD Documentation | Official Sega Mega Drive Documentation