GENESIS Technical OverviewCONFIDENTIAL PROPERTY OF SEGA 68000 @8 MHz
VDP (Video Display Processor)
Z80 @4 MHz
VIDEO:
COLOR:
OTHER:
SOUND:
HARDWARE:
******* INDEX *******
1. MEMORY MAP § 1 MEGA DRIVE 16 BIT MODE (AS DISTINCT FROM MASTER SYSTEM COMPATIBILITY MODE) _ 68K MEMORY MAP _
_ Z80 MEMORY MAP _
_ 68000 ACCESS TO Z80 MEMORY _ _ I/O AREA _
_ CONTROL AREA _
_ VDP AREA _
2. VDP 315 - 5313 (Video Display Processor) The VDP controls screen display. VDP has graphic modes IV and V. Where Mode IV is for compatibility with the MASTER SYSTEM and V is for the new Mega drive functions. There are no advantages to using mode IV. so it is assumed that all Mega drive development will use mode V. In Mode V. the VDP display has 4 planes: SPRITE, SCROLL A/WINDOW, SCROLL B, and BACKGROUND. GRAPHIC IV MODE (COMPATIBILITY MODE)
GRAPHIC V MODE (16 BIT MODE)
_ TERMINOLOGY _ 1. A unit of Position on X Y coordinates is called a "DOT". 2. A minimum unit of display is called a "PIXEL". 3. "CELL" means an 8 (pixel) x 8 (pixel) pattern. 4. SCROLL indicated a repositionable screen-spanning play field. 5. CPU usually indicates the 68000. 6. VDP stands for Video Display Processor. 7. CTRL stands for Control. 8. VRAM stands for VDP RAM, the 64K bytes area of RAM accessible only through the VDP. 9. CRAM stands for Color RAM, 64 9 bit words inside the VDP chip. 10. VSRAM stands for vertical Scroll RAM. 40 10-bit words inside the VDP chip. 11. DMA stands for Direct Memory Access, the process by which the VDP performs high speed fills or memory copies. 12. PSG stands for Programmable sound Generator. A class of low-capability Sound chips. The Mega drive contains a Texas Instruments 76489 PSG chip. 13. FM stands for Frequency Modulation, a class of high-capability sound chip. The Mega drive contains a Yamaha 2612 FM chip. § 1 DISPLAY SPECIFICATION DISPLAY SPECIFICATION OUTLINE
For PAL (the European Television 50HZ standard), a vertical size of 30 cells (240 dots) is selectable. The VDP supports both NTSC and PAL television standards. In both cases, the screen is divided into active scan, where the picture is displayed, and vertical retrace (or vertical blanking) where the monitor prepares for the next display.
Numbers of rasters in a screen are as follows:
§2 VDP STRUCTURE The CPU controls the VDP by special I/O memory locations. _ CTRL (Control) _ This controls REGISTER, VRAM, CRAM, VSRAM, DMA DISPLAY, etc. _ VRAM (VDP RAM) _ General purpose storage area for display data. _ CRAM (COLOR RAM) _ 64 colors divided into 4 palettes of 16 colors each. _ VSRAM (Vertical scroll RAM) _ Up to 20 different vertical scroll values each for scrolling play fields A and B. _ DMA (Direct Memory Access) _ The VDP may move data at high speed from CPU memory to VRAM, CRAM, and VSRAM instead of the CPU, by taking the 68000 off the bus and doing DMA itself. The VDP can also fill the VRAM with a constant, or copy from VRAM to VRAM without disturbing the 68000.
§ 3 INTERRUPT There are three interrupts: Vertical, Horizontal, and External. You can control each interrupt by the IE0, IE1, and IE2 bits in the VDP registers. The interrupts use the AUTO-VECTOR mode of the 68000 and are at levels 6, 4, and 2 respectively. The level 6 vertical interrupt having the highest priority.
_ VERTICAL INTERRUPT (V-INT) _ The vertical interrupt occurs just after V retrace.
_ HORIZONTAL INTERRUPT (H-INT) _ The horizontal interrupt occurs just before H retrace.
The VDP loads the required display information, including all required register values, for the line in about 36 clocks, thus the CPU can control the display of the next line but not the line on which the interrupt occurs.
The horizontal interrupt is controlled by a line counter in register #10. If this line counter is changed at each interrupt, the desired spacing of interrupts may be achieved.
_ EXTERNAL INTERRUPT (EX-INT) _ The external interrupt is generated by a peripheral device (gun, modem) and stops the counter for later examination by the CPU.
Please see other sections of this manual for information about the H, V counter and the initialization of the external interrupt. § 4 VDP PORT The VDP ports are at location $C00000 in the 68000 memory space.
_ $ C00000 (DATA PORT) _ READ/WRITE: VRAM, VSRAM, CRAM
_ $ C00004 (CONTROL PORT) _ READ : STATUS REGISTER
* NO USE
WRITE1 : REGISTER SET
* You must use word or long word access to VDP ports when setting the registers. Long word access is equivalent to two word accesses, with D31-D16 written first. WRITE2 : ADDRESS SET
* You must use word or long word when performing these operations. _ $ C00008 (HV Counter) _ NON INTERLACE MODE
INTERLACE MODE
§ 4 VDP REGISTER VDP has write only register #0 through #23 and read only status register total 25 register. These are two modes for register settings. One is mode 4 and another is mode 5. We tell you about mode 5 in this section and about mode 4 see MARK section. If you change mode in one frame you can get various effects. MODE SET REGISTER No. 1
MODE SET REGISTER No. 2
PATTERN NAME TABLE BASE ADDRESS FOR SCROLL A
VRAM ADDR $XXX0_0000_0000_0000 PATTERN NAME TABLE BASE ADDRESS FOR WINDOW
WD11 should be 0 in H40 cell mode VRAM ADDR $ XXXX_X000_0000_0000 (H 32 cell mode) VRAM ADDR $ XXXX_0000_0000_0000 (H 40 cell mode) PATTERN NAME TABLE BASE ADDRESS FOR SCROLL B
VRAM ADDR $XXX0_0000_0000_0000 SPRITE ATTRIBUTE TABLE BASE ADDRESS
AT9 should be 0 in H 40 cell mode VRAM ADDR $XXXX_XXX0_0000_0000 ( 32 cell ) VRAM ADDR $XXXX_XX00_0000_0000 ( 40 cell )
BACKGROUND COLOR
CPT1,0 : COLOR PALLET COL3 ~ 0 : COLOR CODE
H INTERRUPT REGISTER
This register makes H interrupt timing by number of Raster H interrupt is enabled by IE=1 MODE SET REGISTER No. 3
IE2 1: Enable external interrupt (68000 Level 2) 0: Disable external interrupt * See INTERRUPT and SYSTEM I/O VSCR: V scroll mode HSCR, LSCR: H scroll mode
* BOTH SCROLL A AND B MODE SET REGISTER No. 4
H SCROLL DATA TABLE BASE ADDRESS
VRAM ADDR $XXXX_XX00_0000_0000
AUTO INCREMENT DATA This register controls bias number of increment data.
INC7 ~ 0: Bias number ( 0 ~ $FF ) This number is added automatically after ram access. SCROLL SIZE
* Both of scroll A and B WINDOW H POSITION
WINDOW V POSITION
DMA LENGTH COUNTER LOW
DMA LENGTH COUNTER HIGH
LG15 ~ 0: DMA LENGTH COUNTER DMA SOURCE ADDRESS LOW
DMA SOURCE ADDRESS MID
DMA SOURCE ADDRESS HIGH
SA22 ~ 1 : DMA Source address DMD1, 0 : DMA MODE
§ 6 ACCESS VDP RAM _ RAM ADDRESS SETTING _ You can access VRAM CRAM and VSRAM after writing 32 bits of control data to $C00004 or $C00006. You have to use word or long word when addressing. If you use long word D31 - D16 is 1st, D15 - D0 2nd.
CD5 ~ CD0 : ID CODE A15 ~ A0 : DESTINATION RAM ADDRESS
_ VRAM ACCESS _ VRAM address range from 0 to 0FFFFH, 64K bytes total. VRAM access addressing is as follow when writing:
A15 ~ A0 : VRAM address
D15 ~ D0 : VRAM data When you use long word D31 ~ D16 is 1st. D15 ~ D0 2nd. When you do byte writing, data is D7 ~ D0, and may be written to $C00000 or $C00001. VRAM address is increased by the value of REGISTER # 15. independent data size. VRAM address A0 is used in the calculation of the address increment, but is ignored during address decoding. VRAM addressing and decoding are as follows: the CRAM address decode uses A15 ~ A1, and A0 specifies the data write format. Write data can not cross a word boundary high and low bytes are exchanged if A0=1.
(EXAMPLE) START ADDRESS: 0 REG. #15=2
START ADDRESS: 0 REG. #15=1
START ADDRESS: 1 REG. #15=2
START ADDRESS: 1 REG. #15=1
VRAM READ
A15 ~ A0 : VRAM address
D15 ~ D0 : VRAM data The data is always read in word units. A0 is ignored during the read; no swap of bytes occurs if A0=1. Subsequent reads are from address incremented by REGISTER #15. A0 is used in calculation of the next address.
_ CRAM ACCESS _ The CRAM contains 128 bytes, addresses 0 to 7FH. For word wide writes to the CRAM, use:
A6 ~ A0 : VRAM address
D15 ~ D0 are valid when we use word for data set. If the writes are byte wide, write the high byte to $C00000 and the low byte to $C00001. A long word wide access is equivalent to two sequential word wide accesses. Place the first data in D31 - D16 and the second data in D15 - D0. The data may be written sequentially; the address is incremented by the value of REGISTER #15 after every write, independent of whether the width is byte of word. Note that A0 is used in the increment but not in address decoding, resulting in some interesting side-effects if writes are attempted at odd addresses. For word wide reads from the CRAM, use:
A6 ~ A0 : VRAM address
_ VSRAM ACCESS _ The VSRAM contains 80 bytes, addresses 0 to 4FH. For word wide writes to the VSRAM, use:
A6 ~ A0 : VSRAM address
VS10 - VS0 : V quantity of scroll If you use word for data and valid in D15 ~ D0. D15 - D0 are valid when we use word for data set. If the writes are byte wide, write the high byte to $C00000 and the low byte to $C00001. A long word wide access is equivalent to two sequential word wide accesses. Place the first data in D31 - D16 and the second data in D15 - D0. The data may be written sequentially; the address is incremented by the value of REGISTER #15 after every write, independent of whether the width is byte of word. Note that A0 is used in the increment but not in address decoding, resulting in some interesting side-effects if writes are attempted at odd addresses. For word wide reads from the VSRAM, use:
A6 ~ A0 : VSRAM address
VS10 ~ VS0 : V quantity of scroll _ ACCESS TIMING _ The CPU and CDP access CRAM, CRAM, and VSRAM using timesharing. Because the VDP is very busy during the active scan, the CPU accesses are limited. However, during vertical blanking the CPU may access the CDP continuously. The number of permitted accesses by the CPU additionally depends on whether the screen is in 32 cell mode or 40 cell mode. Additionally the access size depends on the RAM type; a VRAM access is byte wide, but CRAM and CSRAM are wor wide.
For example, in 32 cell mode, the CPU may access the VRAM 16 times during horizontal scan in a single line. Each access is a byte write, so this amounts to 2 words. However CRAM and CSRAM though sharing the 16 time limit, are word accesses so that 16 words may be written in a single line. Although there is a four-word FIFO, if writes are done in a tight loop during active scan the FIFO will fill up and the CPU will eventually end up waiting to write. The maximum wait times are:
As the CPU has unlimited access to the RAMs during vertical blanking, the wait case never arises. _ HV COUNTER _ The HV counter's function is to give the horizontal and vertical location of the television beam. If the "M3" bit of REGISTER #0 is set, the HV counter will then freeze when trigger signal HL goes high, as well as triggering a level 2 interrupt.
M3: REGISTER # 0 NON INTERLACE MODE
INTERLACE MODE
V-COUNTER : VC7 ~ VC0 H-COUNTER : HC8 ~ HC1
The counter only has eight bits each for H and V, so interlace mode and 40 cell (320 dots) modes present some problems. During interlace mode, the LSB of the vertical position is replaced by the new MSB. And the horizontal resolution problem is solved by ALWAYS dropping the LSB. CAUTION: As the HV counter's value is not valid during vertical blanking, check to be sure that it is active scan before using the value. § 7 DMA TRANSFER DMA (Direct Memory Access) is a high speed technique for memory accesses to the VRAM. CRAM and VSRAM. During DMA VRAM, CRAM and VSRAM occur at the fastest possible rate (please see the section on access timing). There are three modes of DMA access. as can be seen below. all of which may be done to VRAM or CRAM or VSRAM. The 68K is stopped during memory to VRAM/CRAM/VSRAM DMA, but the Z80 continues to run as long as it does not attempt access to the 68K memory space. The DMA is quite fast during VBLANK. about double the tightest possible 68K Top's speed, but during active scan the speed is the same as a 68K loop. Please note that after this point. VRAM is used as a generic term for VRAM/CRAM/VSRAM.
DMD1, DMD0: REG #23 * DMD0=SA23 Source address are $000000-$3FFFFF (ROM) and $FF0000--$FFFFFF (RAM) for memory to VRAM transfers. In the case of ROM to VRAM transfers, a hardware feature causes occasional failure of DMA unless the following two conditions are observed: --The destination address write (to address $C00004) must be a word write. --The final write must use the work RAM. There are two ways to accomplish this, by copying the DMA program into RAM or by doing a final "move.w ram address $C00004" _ MEMORY TO VRAM _ The function transfers data from 68K memory to VRAM, CRAM or VSRAM. During this DMA all 68K processing stops. The source address is $000000-$3FFFFF for ROM or $FF0000-$FFFFFF for RAM. The DMA reads are word wide. writes are byte wide for VRAM and word wide for CRAM and VSRAM. The destination is specified by:
Setting of DMA (A) M1 (REG. #1)=1 : DMA ENABLE (B) Increment No. set to #15 (normally 2) (C) Transfer word No. set into #19, #20. (D) Source address and DMA mode set into #21, #22, #23. (E) Set the destination address. (F)*VDP gets the CPU bus. (G)*DMA start. (H)*VDP releases the CPU bus. (I) M1 have to be 0 after confirmation of DMA finish : DMA DISABLED DMA starts after (E). You must set M1=1 only during DMA otherwise we cannot guarantee the operation. Source address were increased with +2 and destination address increased with content of register #15. Content : of register. Register #1 has another bits.
INC7 ~ INC0 : No. of increment
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||