Actions

SCHG

Number Systems

From Sonic Retro

Revision as of 08:05, 3 October 2020 by Ccawley2011 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Retrocdn-round.svg
This file or page has been flagged for relocation to Retro CDN, the Wikimedia Commons-esque service for all Retro wikis. This message is for the benefit of Sonic Retro wiki staff.

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 Mega Drive.

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

References


Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | 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 | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
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 | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information