User:Shadowboxer2005/Genesis Homebrew Development

The Sega Genesis, known internationally as the Sega Mega Drive and the Super Gam*Boy/Super Aladdin Boy in Korea is a 16-bit fourth generation home console released in 1988 in Japan, 1989 in North America and 1990 elsewhere; it is Sega's third console acting as the successor to the SG-1000 and Master System, alongside being the rival to the Super Nintendo Entertainment System, which was released the following year.

In Japan, the system performed poorly against the Super Nintendo and the PC Engine (TurboGrafx-16), but was a large success internationally selling 30 million units and lasting until 1997.

Memory locations
Table was copied from Sega Mega Drive/Memory map at Sega Retro, which is released under a Creative Commons Attribution 4.0 International license.

TradeMark Security System
The TradeMark Security System (TMSS) is a feature not present in earlier models of the Genesis, that essentially prevents both piracy and unlicensed games playing on the system; despite this, Sega chose not to enforce it after losing a 1993 court case with Accolade, meaning any developer could make a game for the system without Sega's knowledge.

Due to $A14000 being reserved on earlier models, using the address could potentially crash the system, so the following code must be used (note that the 'SEGA' portion needs to be at address $100 in the ROM): move.b $A10001,d0 andi.b #$0F,d0 beq.b  version_0 move.l #'SEGA',$A14000 version_0:

Video Display Processor (VDP)
The Video Display Processor (VDP) is exactly what it sounds like (well, it's actually a chip, not a processor); it processes the graphics, sprites and plane mappings on screen.

Resolution
Japanese and North American model machines support three resolutions; the first one is 320x224, which is utilized the most and is the default, the second one is 256x224, which is often used for when more complex graphics are involved, and the final is 320x448, an interlaced display that essentially doubles the screen's y-resolution (although many monitors would just squish it back to 224 pixels; several games would use this for two-player mode).

The European model also supports these resolutions, however due to monitors in Europe having a higher resolution, this means that it is capable of displaying 8 more pixels on the top and bottom, resulting in a full 240p resolution (or 320x480 when interlaced); despite this, very few games took advantage of this higher resolution, which essentially made unoptimised games look "stretched" on a European analog TV.

Colors
The Genesis uses a 9-bit RGB (red, green, blue) color palette, meaning that 9-bits are allocated to each specific pixel, and could theoretically allow up to 512 colors (1500 with shadow/highlight mode); however, since the Genesis only allows for 4 color palettes at once (each containing 16 colors), and since the first color for each 'palette line' is transparent, this only allows for 61 colors on screen.

With these limitations in mind, the following image would be possible by using several layering affects, and the color table below shows all the possible colors to be chosen:

The 32X, on the other hand, allows for 15 bits per pixel (15-bit RGB, also known as "High-Color"), with all 32,768 colors being able to be display at once; this results in the image/color table below.



That's not all though; several games on the Genesis managed to display beyond 61 colors at once; this is done by swapping the colors on the vertical interrupts (several games also do this on the horizontal interrupts); as a side effect, this results in some minor VRAM dots appearing where the palette changes occur, alongside some slightly imperfections in the V.I. swap.

Video Random Access Memory (VRAM)
Video Random Access Memory (VRAM) is the area in memory graphics and plane mappings are stored; it is only capable of storing 8x8 tiles; although it could technically allow up to $FFFF (65535) tiles at once, $C000 and $E000 are generally reserved for plane mappings.

Graphics Planes
The Sega Genesis has three graphics planes:


 * Sprite layer - This is where all the in-game sprites (movable graphics/objects) are displayed; unless programmed, this will be displayed on top of everything, and has 8 possible layers; 0 will cause it to display above all objects, and 7 will cause it to display behind all objects.
 * Plane A layer - Most often used for platforming games for level layouts, and/or text.
 * Plane B layer - Most often used for backgrounds, displays behind everything; although normally static, they can be programmed to scroll at different speeds, thus giving the illusion of depth.

Sprites
The Genesis is able to display up to 80 sprites at once, although only a maximum of 20 can be displayed on any given scanline without causing sprite flickering; very few games end up reaching this limit to preserve the framerate.