YaVDP - "Yet Another Sega Genesis VDP Document"
But wait.......for beginers! "The cherished newbie"
By DevSter - Joseph Norman
Preface
So yeah, what the hell is a preface doing here in a document like this? Well, I've decided to be stupid for the sucessful second, third....etc time today. This text is intended for the Sega Genesis "newbie" enthusiast in technology, and engineering of the Sega Genesis Video Display Processor. It is a comprehensive treatment of the Sega Genesis VDP, covering both hardware, software, and squeezeware. The text assumed a knowledge of programming a 68k microprocessor. For those that have said "woops", another programming document on the 68k is your destiny. At the outset there is one critical question: Why program a 16-bit smoked out system when technology is dominated by 512-bit and 325942765-bit processors? You will find the true meaning in your heart, it is not that hard. But in reality, the true answer is because nobody gives a damn about no 16-bit microprocessor, and that since you and I and a couple other point-Dexters do give a damn, it will influence others into saying "whoooa dood knarly man" into thinking we're quite daring. Okay enough chit-chat, and lets get down to business =).
Table of Contents
1) Starting out
Starting out
This is the memory map for the VDP, commit this to memory for later purposes:
VDP Memory Map
|
|||
Address | Size | R/W | Function |
$C00000 | Word | R | Read data port |
W | Write data port | ||
$C00002 | Word | R/W | Mirror of the data port at $C00000 - Exists only for long 32-bit writes to $C00000 |
$C00004 | Word | R | Read status register |
Word | W | Write control port | |
$C00006 | Word | R/W | Mirror of the control port at $C00004 - Exists only for doing long 32-bit writes to $C00004 to write two registers after the other |
$C00008 | Word | R | Reads the status of the position of the verticle and horizontal counters |
Register Descriptions | ||||||||||||
Register | Bits | Function | ||||||||||
#0 - Mode Set Register No. 1 - [move.w #$80xx,($C00004)] | ||||||||||||
4 | Horizontal Interrupt Enable (0: Disable horizontal interrupts, 1: Enable horizontal interrupts) | |||||||||||
2 | Palette Select (0: Limit palette colors, 1: Full 3 bits of color will be used) | |||||||||||
1 | HV Counter Latch Enable (0: Normal operation of HV counter, 1: When an external interrupt is generated, stop the HV counter and hold the value) | |||||||||||
0 | Display Disable (0: Disable video signal, 1: Draw display) | |||||||||||
#1 - Mode Set Register No. 2 - [move.w #$81xx,($C00004)] | ||||||||||||
7 | TMS9918 Mode (0: Operate lika a Genesis display, 1: operate like a TMS9918 - SMS display) | |||||||||||
6 | Display Enable (0: Disable display + draw backdrop color only, 1: Enable display) | |||||||||||
5 | Vertical Interrupt Enable (0: Disable verticle interrupt, 1: Enable verticle interrupt) | |||||||||||
4 | DMA Enable (0: Disable DMA, 1: Enable DMA) | |||||||||||
3 | PAL/NTSC (0: NTSC mode, 1: PAL mode) | |||||||||||
2 | SMS Mode (0: Do nothing, 1: Toggle SMS/Genesis display modes) | |||||||||||
#2 - Pattern Name Table Address for Scroll A - [move.w #$82xx,($C00004)] | ||||||||||||
5-3 | This register sets the pattern name table address for scroll A. Bits 5-3 in the register correspond to bits 15-13 in the address to which you want to set the pattern name table to. | |||||||||||
#3 - Pattern Name Table Address for Window - [move.w #$83xx,($C00004)] | ||||||||||||
5-1 | This register sets the pattern name table address for the window. Bits 5-1 in the register correspond to bits 15-11 in the address to which you want to set the pattern name table to. | |||||||||||
#4 - Pattern Name Table Address for Scroll B - [move.w #$84xx,($C00004)] | ||||||||||||
2-0 | This register sets the pattern name table address for scroll B. Bits 2-0 in the register correspond to bits 15-13 in the address to which you want to set the pattern name table to. | |||||||||||
#5 - Sprite Attribute Table Base Address - [move.w #$85xx,($C00004)] | ||||||||||||
6-0 | This register sets the table base address for the sprite attribute table. Bits 6-0 in the register correspond to bits 15-9 in the address to which you want to set the attribute table to. | |||||||||||
#7 - Backdrop Color - [move.w #$87xx,($C00004)] | ||||||||||||
5-4 | Color Palette: Set the backdrop color to be inside the color palette corresponding to bits 5-4. Bits 5-4 correspond to bits 1-0 of a color palette | |||||||||||
3-0 | Color Code: Set the backdrop color to be the color number corresponding to bits 3-0. The color code refers to the color palette selected from bits 5-4 in this same register. Bits 3-0 correspond to bits 3-0 of the color palette. | |||||||||||
#10 - Horizontal Interrupt Register - [move.w #$8Axx,($C00004)] | ||||||||||||
7-0 | The number of lines it takes to generate a horizontal interupt is controlled by this register. A value of 0 means that a horizontal interrupt is generated every line. A value of 10 means the a horizontal interrupt is generated every 11th line, for which the display is drawn. Thus, increasing the value in this register increases the time in which a horizontal interrupt will occur. | |||||||||||
#11 - Mode Set Register No. 3 - [move.w #$8Bxx,($C00004)] | ||||||||||||
3 | External Interrupt Enable (0: Disable external interrupt, 1: Enable external interrupt) | |||||||||||
2 | Verticle Scroll Mode (0: Overall scroll mode - scroll the whole screen, 1: 2-cell unit scroll mode) | |||||||||||
1-0 | Horizontal Scroll Mode
|
|||||||||||
#12 - Mode Set Register No. 4 - [move.w #$8Cxx,($C00004)] | ||||||||||||
7, 0 | Cell Mode. Bits 7 and 0 HAVE to have identicle values. (0: 32 cell mode, 1: 40 cell mode) | |||||||||||
3 | Shadow/Highlighting Mode (0: Disable shadow and highlighting, 1: Enable shadow and highlighting) | |||||||||||
2-1 | Select Interlace Mode
|
|||||||||||
#13 - Horizontal Scroll Data Table Base Address - [move.w #$8Dxx,($C00004)] | ||||||||||||
5-0 | Bits 5-0 of this register correspond to bit 15-10 of the base table address for horizontal scroll data. | |||||||||||
#15 - Auto Increment Data - [move.w #$8Fxx,($C00004)] | ||||||||||||
7-0 | Bits 7-0 specify the value to be added to the VDP's address register after every read or write to the data port. Writing a 0 will not make the address register increase |