1# smsgg-core
2
3Sega Master System / Game Gear / SG-1000 emulation core.
4
5The Sega Master System contains the following components:
6* Z80 CPU clocked at 3.58 MHz
7* VDP (video display processor) that is derived from the Texas Instruments TMS9918 but sports an additional advanced graphics mode (which nearly every game on the console uses)
8  * Renders at 256x192
9  * Supports 6-bit RGB color with up to 32 colors onscreen simultaneously
10  * Contains a single background layer
11  * Supports up to 64 sprites per frame and up to 8 sprites per scanline, with sprites being 8x8 pixels
12* SN76489, a PSG (programmable sound generator)
13  * Contains 3 square wave generators and a noise generator
14* 8KB of working RAM
15* 16KB of VRAM
16* 32 bytes of CRAM (color RAM for storing palettes)
17* Support for an optional FM sound unit expansion, which adds a YM2413 FM synthesis chip
18
19The Game Gear is nearly identical to the Master System hardware-wise, with a few key differences:
20* The VDP still renders 256x192 frames, but only the center 160x144 pixels are displayed
21* The VDP color format is changed from 6-bit RGB to 12-bit RGB, and color RAM is doubled in size to accommodate this
22* The Start/Pause button flips a bit in a register instead of generating an NMI
23* There is a new stereo sound control register that enables hard panning each of the 4 audio channels
24
25SG-1000 is the Master System's predecessor, and it differs in the following ways:
26* 1KB of working RAM instead of 8KB
27* Video processor is an actual TMS9918A, not Sega's customized version used in SMS/GG (and a later version in Genesis)
28* SN76489's noise channel has slightly different behavior in white noise mode, since it's a stock SN76489 rather than a Sega-customized chip
29* Cartridge memory mapping is much simpler; no games used memory-banking mappers
30
31This crate contains code for:
32* SMS/GG VDP
33* SMS/GG PSG
34* SMS/GG memory map
35* SMS FM sound unit expansion
36* SMS/GG main loop