GENESIS SOFTWARE AL -0 SEGA ENTEMR• ES CopyrAght 1989 Sega of Japan - This manual may not, in whole or part, be copied, photocopied, reproduced, or translated without prior written consent from Sega Enterprises. CONFIDENTIAL #229 PROPERTY OF SEGA e -0 CONFIDENTIAL #229 PROPERTY OF SEGA Genesis Technical Overview February 28, 1990 GENESIS: 68000 @8mHz Main CPU 1 MByte (8 Mbit) ROM Area 64 KByte RAM Area VDP (Video Display Processor) Dedicated video display processor - Controls playfield and sprites - Capable of DMA - Horizontal and vertical interrupts Z80 @4mHz Controls PSG (Programmable Sound Generator) & FM Chips 8 KBytes of dedicated Sound RAM VIDEO: NOTE: Playfield and Sprites are chara Display Area (visual) - 40 Chars wide x 28 chars high Each char is 8 x 8 pixels Pixel resolution = 320 x 224 - 3 Planes 2 Scrolling playfields 1 Sprite plane Definable priorities between planes - Playfields: 6 Different sizes 1 Playtteld can have a fixed" window Playfield rnap -Iach char position takes 2 bytes, that includes: Char name-(1 0 bits); points to char definition Horizontal flip vertical flip ,,Color palette (2 bits); index into CRAM Priority S-W\GENESIS MANUAL Rev. 02/19/92 CONFIDENTIAL #229 PROPERTY OF SEGA Scrolling: - 1 Pixel scrolling resolution - Horizontal: Whole playfield as unit Each character line Each scan line - Vertical Whole playfield as unit 2 Char wide columns - Sprites: 1 x 1 Char up to 4 x 4 chars Up to 80 sprites can be defined Up to 20 sprites displayed on a scan line Sprite priorities - Character Definitions 4 bits/pixel; points to color register 4 bytes/scanline of char 32 bytes for complete char definition Playfield and sprite chars are the same COLOR: Uses CRAM (part of the VDP) - 64 9-bit wide color registers 64 colors out of 512 possibl - 3 bits of Red - 3 bits of Green - 3 bits of Blue -4 palettes of 16 colors 0th color (of each palette) is alwa sparent OTHER: DMA - Removes the 8000 from the Bus - Can move bytes during VBLANK T re are 36 scan Ines during VBLANK A can m 7380 bytes during VBLANK Horizon & Vertical upts SOUND 780 Controls: - PSG ( l 76489 chip) (Yamaha YM 2612) 6-Channel stereo - Z80 can access ROM data 8 KBytes RAM S-NAGENESIS MANUAL Rev. 02/19/92 CONFIDENTIAL #229 PROPERTY OF SEGA HARDWARE: 2 Controllers - Joypad - 3 Buttons - Start button 1 External port 2 Video-outs (RF & RGB) Audio jack (stereo) Volume control (for audio jack) • S-1/V\GENESIS MANUAL Rev. 02/19/92 CONFIDENTIAL #229 PROPERTY OF SEGA • • CONFIDENTIAL #229 PROPERTY OF SEGA TABLE OF CONTENTS I. MEMORY MAP 1 A. Mega Drive 16 Bit Mode 1 _68K MEMORY MAP Z80 MEMORY MAP 68000 ACCESS TO Z80 MEMORY I/O AREA CONTROL AREA VDP AREA II. VDP 315-5313 TERMINOLOGY DISPLAY SPECIFICATION VDP STRUCTURE 8 CTRL 8 VRAM A. 8 CRAM 8 VSRAM 8 DMA 8 D. INTERRUPT 9 VERTICAL INTERRUPT (V-INT) 9 HORIZONTAL INTERRU,PT (H-INT) 9 EXTERNAL INTERRUP X-IN i 10 E. VDP PORT 10 $C000 , ATA PORT) 10 $ C 0 0 id4 (CONTROL PORT) 11 $ C 0 0 0 8 (HV C NTER) 12 F. VDP REGISTER 13 ,.4;113 S TER NO.1 13 MODE REGISTER NO.2 13 PATTER AME TABLE BASE ADDRESS FOR SCROLL A 13 PATTERN NAME TABLE BASE ADDRESS FOR WINDOW . 13 PATTERN NAME TABLE BASE ADDRESS FOR SCROLL B 14 SPRITE ATTRIBUTE TABLE BASE ADDRESS 14 BACI&ROUND COLOR 14 H INTERRUPT REGISTER 14 9 MODE SET REGISTER NO. 3 15 110. MODE SET REGISTER NO. 4 15 H SCROLL DATA TABLE BASE ADDRESS 16 • AUTO INCREMENT DATA 16 SCROLL SIZE 16 WINDOW H POSITION 16 WINDOW V POSITION 17 DMA LENGTH COUNTER LOW 17 DMA LENGTH COUNTER HIGH 17 S-NAGENESIS MANUAL Rev. 02/21/92 CONFIDENTIAL #229 PROPERTY OF SEGA DMA SOURCE ADDRESS LOW 17 DMA SOURCE ADDRESS MID 17 DMA SOURCE ADDRESS HIGH 17 G. ACCESS VDP RAM 18 RAM ADDRESS SETTING 18 VRAM ACCESS 19 CRAM ACCESS VSRAM ACCESS 2' ACCESS TIMING 24 HV COUNTER 25 H. DMA TRANSFER 26 MEMORY TO VRAM 26' VRAM FILL 28 VRAM COPY 31 DMA TRANSFER CAPACITY 34 I. SCROLLING SCREEN 35 SCROLLING SCREEN SIZE 37 HORIZONTAL SCROLLING ........ 39 3. VERTICAL SCROLLING 41 SCROLL PATTERN NAME 42 PATTERN GENERATO 44 .., ,,, J. WINDOW 46 DISPLAY POSITIO 46 WINDOW PRIORITY , i 50 WINDOW PATTERN ME 51 K. SPRITE 52 DISPLAY P ,TION 53 SPRIT TE 55 SPRI SIZE . 56 SPRI E's DISP APACITY 57 ‘PRIORITY BE N SPRITES 58 ..00GPRITE sv;Ak- GENERATOR 60 L. 61 67 RD COMPATIBILITY MODE 71 A. MARK III (MS-Japan) 71 MASTER SYSTEM 71 C. RAM BOARD 71 S-NAGENESIS MANUAL Rev. 02121/92 CONFIDENTIAL #229 PROPERTY OF SEGA IV. SYSTEM I/O 72 A. VERSION NUMBER 72 B. I/O PORT 72 C. MEMORY MODE 76 D. Z80 CONTROL Z80 BusReq f 76 Z80 Reset 76 E. Z80 AREA V. VRAM MAPPING 79 VI. SOUND SOFTWARE MANUAL 280 MAPPING 68K CONTROL OF Z80 FM SOUND CONTROL PSG CONTROL D/A CONTROL VII. APPENDIX S-W \GENESIS MANUAL Rev. 02/24/92 CONFIDENTIAL #229 PROPERTY OF SEGA • CONFIDENTIAL #229 PROPERTY OF SEGA I. MEMORY MAP A. Mega Drive 16 Bit Mode (as distinct from Master System Compatibility Mode) 1. 68K MEMORY MAP $000000 ROM $200000 CARTRIDGE $400000 SEGA $A00000 $600000 RESERVED Z80 $ A 'ITO 0 0 $800000 I/O - $A11000 $900000 SEGA RESERVED $A00000 $ A 12 0 0 SYSTEM I/O SE GM $B00000 RESER SEGA $C00000 RESERVED VDP $D00000 $E00000 $E00000 WORK RAM ACCESS $F00000 PROHIBITED $FF0000 WORK RAM $FFFFFF S-VAGENESIS MANUAL R. 02/1W92 1 CONFIDENTIAL #229 PROPERTY OF SEGA 2. Z80 MEMORY MAP 0000H SOUND RAM YM2612 AO 04000H • 2000H 04001H SEGA DO 04002H RESERVED Al 04003H 4000H D1 04004H SOUND CHIP ACCESS 6000H (YM2612) PROHIBITED 06000H MISCELLANEOUS BANK REGISTER 06 4-1 ACCESS 8000H PROHIBITED 40 7 F 1 1 H 68000 BANK '* +k 0 7 F 1 2 H PSG 76489ci de ; r FFFFH 3. 68000 ACCESS TO Z80 M MORY $A00000 SOUND RAM $A04000 $ A 0 2 0 OA YM2612 AO DO $A04002 Al D1 $A04004 ACCESS PROHIBITED $A06000 BANK BANK 0 REGISTER $A06002 ACCESS ACCESS PROHIBITED PROHIBITED $AOFFFF S-NAGENESIS MANUAL Rev. 02/19/92 2 CONFIDENTIAL #229 PROPERTY OF SEGA • 4. I/O AREA $A10000 $A10002 Version No. DATA (CTRL 1) DATA (CTRL 2) $A10008 DATA (EXP) CONTROL (1) CONTROL (2) $A1000E CONTROL (E) T x DATA R x DATA (1) $A10014 S - MODE T x DATA R x DATA (2) $A1001A S - MODE T x DATA R x DATA (E) $A10020 S - MODE — ACCESS PROHIBITED' ' $A1FFFF 5. CONTROL AREA $A11000 MEMgRY $A11002 Mobt, P' ACCESS $A11100 PROHIBITED $A11102 .480 BVSREP '$ A 1 1 2 00 PR. ' BITED $ A 1 1 2 02 Z80 RESET ACCCESS PROHIBITED S-NAGENESIS MANUAL Rev. 02/19/92 3 CONFIDENTIAL #229 PROPERTY OF SEGA 6. VDP AREA $C00000 $C00004 $C00008 DATA CONTROL • $C 0000 A HV COUNTER ACCESS $C00010 PROHIBITED ACCESS PSG $C00012 PROHIBITED 76489 ACCESS PROHIBITED $DFFFFF • S-W\GENESIS MANUAL Rev. 02/20/92 4 • CONFIDENTIAL #229 PROPERTY OF SEGA II. 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, SCROLLA/WINDOW, SCROLLB, and BACKGROUND. GRAPHIC IV MODE (COMPATIBILITY MODE) BACKGROUND - - SCROLL SPRITE GRAPHIC V MODE (16 BIT MODE) • SCROLL B SCROLL A WINDOW SPRITE S-W\GENESIS MANUAL Rev. 02/20/92 5 CONFIDENTIAL #229 PROPERTY OF SEGA A. TERMINOLOGY A unit of position on X. Y coordinates is called a DOT. A minimum unit of display is called a PIXEL. CELL means an 8 (pixel) x 8 (pixel) pattern. • SCROLL indicates a repositionable screen-spanning play field. CPU usually indicates the 68000. VDP stands for Video Display Processor. • CTRL stands for Control. VRAM stands for VDP RAM, the 64K bytes area of RAM accessible on the VDP. CRAM stands for Color RAM, 64 9 bit words inside the VDP chip. VSRAM stands for Vertical Scroll RAM, 40 10 bit words inside the VDP chip DMA stands for Direct Memory Access, the process by which the AMP,perfor high speed fills or memory copies. PSG stands for Programmable Sound Generator, a class of lovd-oapability sound chips. The Mega drive contains a Texas Instruments 76489 PSG chip. FM stands for Frequency Modulation, a class of, high-c illy tgund The Mega drive contains a Yamaha 2612 FM B. DISPLAY SPECIFICATION DISPLAY SIZE THERE ARE b MODES: 32 ' 28 CELL56• 224 PIXEL) 40 ' 28 CELL ' 0 • 224 PIXEL) CHARACTER GENERATOR 8 * 8 CELLS 1 00 depe n general system configuration. SCROLL PLAYFIELDS Two scrolling play fiel s, se size in cells is selectable from: 3 32 ' 64, 32 ' 128 64 • 64 . 128 ' 3 SPRITE Sprite size tgrammable on a sprite by sprite basis, with the following choices: ., 84 * 16, 8 * 24, 8 • 32 , 16 ' 16, 16 • 24, 16 ' 32 24 • 8, 24 ' 16, 24 ' 24, 24 * 32 32 • 8, 32 ' 16, 32 ' 24, 32 ' 32 jeie are 64 sprites available when the screen is in 32 cell wide mode, or 80 the screen is in 40 cell wide mode. ff ANINDor 1 window associated with the Scroll A play field. 64 co1ors/512 possibilities. he European television 50 Hz standard), a vertical size of 30 cells (240 dots) is table. S-W\GENESIS MANUAL • Rev. 02/19/92 6 CONFIDENTIAL #229 PROPERTY OF SEGA The VDP supports both NTCS 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. VDP FETCHES DISPLAY TYPE GENERATE HORIZONTAL INTERR V V HORIZONTAL HORIZONT DISPLAY RETRACE RETRACE VERTICAL RETRACE DISPLAY GENERATE VERTICAL INTERRUPT VERTICAL RETRACE Numbers of rasters in,-a scrett are as follows: , LINES/SCREEN CELL NO. LINE NO. LINE NO. (DISPLAY) (RETRACE) 28 . 224 RASTER 38 RASTER '312 28 224 RASTER 98 RASTER 1 f 30 240 RASTER 82 RASTER S-W\GENESIS MANUAL Rev. 02/20192 7 CONFIDENTIAL #229 PROPERTY OF SEGA C. VDP STRUCTURE The CPU controls the VDP by special I/O memory locations. 1. 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 VAM, CR • SRAM 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 oVRA o,. RAM without disturbing the 68000. S-W\GENESIS MANUAL Rev. 02/19/92 8 CONFIDENTIAL #229 PROPERTY OF SEGA • D. INTERRUPT There are three interrupts, Vertical, Horizontal, and External. You can control each interrupt by the 1E0, 1E1, and 1E2 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. 1E0 V Interrupt (LEVEL 6) 1E1 H Interrupt (LEVEL 4) 1E2 External Interrupt (LEVEL 2) 1: Enable 0: Disable VERTICAL INTERRUPT (V-INT) The vertical interrupt occurs just after V retrace. DISPLAY PERIOD V RETRACE INTERRUPT POINT HORIZONTAL INTERRUPT (H-INT) The Horizontal Interrupt occurs just befor DISPLAY PERIOD —>A INTERRUPT POINT FETCHES INFORMATION FOR THE LINE The VDP loads the required y information, including all required register values, for the line in about 36 clocks CPU can control the display of the next line but not the line on which the interrupt occurs. ;4 H SYNC. *MODIFIED H DISPLAY RETRACE &MODIFIED H DISPLAY CHANGE SETTINGS • *CHANGE 'NT SETTINGS The horizontal interrupt is controlled by a line counter in register #10. tatsggfinounter is changed at each interrupt, the desired spacing of interrupts may be hieved. • T us: If register #10 equals 00h, then the interrupt occurs every line. If register #10 equals 01h, then the interrupt occurs every other line. If register #10 equals 02h, then the interrupt occurs every third line. S-MGENESIS MANUAL Rev. 02/19/92 9 CONFIDENTIAL #229 PROPERTY OF SEGA 3. EXTERNAL INTERRUPT (EX-INT) The external interrupt is generated by a peripheral device (gun, modem) and stops the H, V counter for later examination by the CPU. HL INPUT PIN • INTERRUPT HAPPEN (COUNTER RATCHED) Please see other sections of this manual for information about the H, V counter and thp initialization of the external interrupt. E. VDP PORT The VDP ports are at location 68000 in the 68000 memory 6 UPPER BYTE LOWER BYTE $C00000 DATA PORT $C00002 $C00004 CONTROL $C00006 IT $C00008 HV COUNT $C0000A P IHIBITED $C0000C $C0000E PROHIBI*D $C00010 PSG DT14 I DT13 DTI 2 DT11 DT10 DT9 DT8 (D15-D8) DT6 DT5 DT4 DT3 DT2 DT1 DTO (D7-DO) 00 and $C00002 are functionally equivalent. S-VV \GENESIS MANUAL Rev. 02/19/92 10 CONFIDENTIAL #229 PROPERTY OF SEGA 2. $ C 0 0 0 0 4 (CONTROL PORT) READ: STATUS REGISTER $ C 00004 EMPT FULL (D15-D8) SOVR ODD VB HB DMA PAL (D7-DO) NO USE EMPT.. 1: WRITE FIFO EMPTY 0: FULL.. 1: WRITE FIFO FULL 0: 1: V interrupt happened SOVR.. 1: Sprites overflow occurred, too many in one line. Over 17 in 32 cell mode. Over 21 in 40 cell mode. 1: Collision happened between non-zero pixejn two 0: ODD .. 1: Odd frame in interlace mode. 0: Even frame in interlace mode. VB 1: During V blanking 0: HB 1: During H blanking 0: DMA....1: DMA BUSY 0: PAL....1: PAL MODE 0: NTSC MODE WRITE1: REGI $ C 00004 RS3 RS2 RS1 RSO (D15-D8) D7 D5, D4 D3 D2 D1 DO (D7-DO) $C00004 and, $C00006 ionally equivalent. RS4 - Register No. D7 - Data rd access to the VDP ports when setting the registers. ent to two word accesses, with D31 - D16 written first. • S-NAGENESIS MANUAL Rev. 02/19/92 11 CONFIDENTIAL #229 PROPERTY OF SEGA- WRITE2: ADDRESS SET 410 1st CD1 CDO A13 Al2 All A10 A9 A8 (D15-D8) $C00004 A7 A6 A5 A4 A3 A2 Al AO (D7-DO) 2st $ C00004 CD5 CD4 CD3 CD2 A15 C05 CDO: ID CODE A15 - AO: DESTINATION RAM ADDRESS ACCESS MODE CD5 CD4 CD3 CD2 CD1 cD0 VRAM WRITE 0 0 0 0 1 4 ' CRAM WRITE 0 0- 0 .... 1 VSRAM WRITE 0 0 9 1 ,0 1 VRAM READ ' 0 0 0 'i) 0 CRAM READ 0 0 0 0 0 VSRAM READ 0 0 0 * ,, 0 0 * You must use word or Ion when performing these operations. 3. $ C 0 0 0 0 8 (HV COUNTER) NON INTERIME„MODE $C00008 VC7 VC6 VCS VG4 VC3 VC2 VC1 VCO (D15-D8) HC6 HC5 HC4 HC3 HC2 HC1 (D7-DO) I TERLACE MODE C7 VC6 VC5 VC4 VC3 VC2 VC1 VC8 (D15-08 HC8 HC7 HC6 HC5 HC4 HC3 HC2 HC1 (07-DO) HC8 HC1: H COUNTER VC8 VCO V COUNTER S-VV \GENESIS MANUAL Rev. 02/19/92 12 CONFIDENTIAL #229 PROPERTY OF SEGA F. VDP REGISTER VDP has write only register No. 0-No. 23 and read only status register totalling 25 register. There are two modes for register setting; one is mode 4, the other mode 5. We tell you about mode 5 in this section and about mode 4 in MARK III section. If you change mode in one frame you can get various effects. 1. MODE SET REGISTER NO.1 MSB LSB REG. #0 0 0 1E1 0 1 M3 0 1E1... 1: Enable H interrupt (68000 LEVEL 4) 0: Disable H interrupt (REG #10) M3 1: H, V counter stop 0: Enable read, H, V counter 2. MODE SET REGISTER NO.2 MSB REG. #1 • 0 DISP 1E0 M1 DISP .... 1: Enable Display 0: Disable Display , 1E0.. 1: Enable V inter( 6) 0: Disable V interr M1 1: DMA Enable 0: DMA Di able M2 1: V 30 ode (PAL mode) 0: V 2 e (PAL mode; always 0 in NTSC mode) 3. PATTERN NAME TABLE BASE ADD SS FOR SCROLL A MS LSB REG. #2 0 ''SA15 SA14 SA13 0 0 0 VigatM 0000-0000-0000 PATTERN NAME BASE ADDRESS FOR WINDOW LSB REG.i #3 0 0 WD15 WD14 WD13 WD12 WD11 0 • WDII should be 0 in H40 cell mode VRAM ADDR %XXXX_X000_0000_0000 (H32 cell mode) VRAM ADDR %XXXX_0000_0000_0000 (H40 cell mode) S-NAGENESIS MANUAL Rev. 02/19/92 13 CONFIDENTIAL #229 PROPERTY OF SEGA 5. PATTERN NAME TABLE BASE ADDRESS FOR SCROLL B REG. #4 MSB 0 0 0 0 0 SB15 SB14 SB13 LSB • VRAM ADDR %XXX0_0000_0000_0000 6. SPRITE ATTRIBUTE TABLE BASE ADDRESS MSB REG. #5 0 AT15 AT14 AT13 AT12 AT11 AT10 AT9 should be 0 in H40 cell mode VRAM ADDR %XXXX_XXX0_0000_0000 (32 cell) VRAM ADDR %XXXX_XX00_0000_0000 (40 cell) MSB REG. #6 0 0 0 0 0 0 7. BACKGROUND COLOR MSB LSB REG. #7 0 0 CPT1 0I COL COL2 COL1 COLO CPT 1,0: COLOR COL 3-0: COL MSB LSB 'fflrAr- H INTERRUPT REGISTER MSB LSB HI17 HIT6 HIT5 HIT4 HIT3 HIT2 H1T1 HITO This register makes H interrupt timing by number of laster. H interrupt is enabled by IE = 1. S-VVNGENESIS MANUAL Rev. 0019/92 14 CONFIDENTIAL #229 PROPERTY OF SEGA 9. MODE SET REGISTER NO. 3 MSB LSB REG. #11 0 0 0 0 1E2 VSCR HSCR _ LSCR 1E2.. .. 1: Enable external interrupt (68000 LEVEL 2) 2: Disable external interrupt See INTERRUPT and SYSTEM I/O VSCR: V scroll mode HSCR, LSCR: H scroll mode VSCR FUNCTION HSCR LSCR FUNCTION 0 FULL SCROLL 0 0 FULL SCROLL , 1 EACH 2CELL SCROLL 0 1 PROHIBITED . 1 0 , EACH 1 GITT SC 1 1 EACH 1LINE SChOLL BOTH SCROLL A and B • 10. MODE SET REGISTER NO. 4 MSB LSB REG. #12 RSO 0 0 0 I SITE t SM1 LSMO RS1 RSO.. 0: HORIZONTAL 32 1: HORIZ NTAL 40 CEL DE RS1...... 0: HORI TAL 32 CELL MODE 1: Hf AL 40 CELL MODE You should set same No'xin RSO, RS1. V cell OO i. '40 cell 1 00_XXX1 &I-Ea 1 Enable SHADOW and HILIGHT 0. Disable SHADOW and HILIGHT LSM1 LSMO: literlace ode setting LSM'1* LS FUNCTION , 0 0 NO INTERLACE • 0 1 INTERLACE , 1 0 PROHIBITED 1 1 INTERLACE (DOUBLE RESOLUTION) S-NAGENESIS MANUAL Rev. 02/19/92 15 CONFIDENTIAL #229 PROPERTY OF SEGA• 11. H SCROLL DATA TABLE BASE ADDRESS REG. #13 MSB 0 0 HS15 HS14 HS13 HS12 HS11 HS10 LSB • VRAM ADDR 0/0XXXX_XX00_0000_0000 MSB REG. #14 0 0 0 0 0 0 0 0 12. AUTO INCREMENT DATA This register controls bias number of increment data. MSB LSB REG. #15 INC7 INC6 INC5 INC4 INC3 -4INC2 _ INC1 NO INC7-0: Bias number (0-$FF) This number is added automatically after RAAccess. 13. SCROLL SIZE MSB LSB REG. #16 0 0 VSZ1 VSZ2I 0 0 HSZ1 HSZO VSZ1, 0: VSIZE HSZ i: HSIZ VSZ1 VSZO FUNCTI ''' HSZ1 HSZO FUNCTION _ 0 0 V 32 ce I 0 0 H 32 cell 0 1 k64 cell 0 1 H 64 cell 1 „ HIBITE-D 1 0 PROHIBITED 1 V 12Aell 1 1 H 128 cell B 447,54,r roil A and B 1kI WINDOW H PO ON MSB LSB REG. #17 RIGT 0 0 WHP5 WHP4 WHP3 WHP2 WHP1 RIGT.. 0: Window is in left side from base point. 1: Window is in right side from base point. WHP5-1 Base pointer 0 = Left side 1 = 1 cell right 2... S-$AAGENES1S MANUAL Rev. 0019/92 16 CONFIDENTIAL #229 PROPERTY OF SEGA 15. WINDOW V POSITION MSB LSB REG. #18 DOWN 0 0 WVP4 WVP3 WVP2 WVP1 WVPO DOWN .. 0: Window is in upper side from base point. 1: Window is in ,lower side from base point. WPV4-0 Base pointer 0 = Upper side 1 = 1 cell down 2... 16. DMA LENGTH COUNTER LOW MSB REG. #19 LG7 LG6 LG5 LG4 LG3 LG2 LG1 17. DMA LENGTH COUNTER HIGH MSB REG. #20 LG15 LG14 LG13 LG12 LG11 LG8 LG15-0: DMA LENGTH COUNTER 18. DMA SOURCE ADDRESS LOW MSB LSB REG. #21 19. DMA SOURCE ADDRESS MID. MSB LSB REG. #22 SA16 SA , SA13 SA12 SAll SA10 SA9 20. DMA SOURCE ADDRESS HIGH M. LSB REG. #23 '4MD1 DM SA22 ' SA21 SA20 SA19 SA18 SA17 A22 DMA SOURCE ADDRESS DM01, 0: DMA MODE ' DMD1 DMDO FUNCTION 0 SA23 MEMORY TO VRAM • 1 0 VRAM FILL 1 1 VRAM COPY S-NAGENESIS MANUAL Rev. 02/19/92 17 CONFIDENTIAL #229 PROPERTY OF SEGA G. ACCESS VDP RAM 1. 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 031-D1ftis 1s q, D15-DO 2nd. 1st CD1 CDO Al3 Al2 All A10 A9 AS (D15-D8) $C00004 A7 AS A5 A4 A3 A2 Al .tID7-DO) 2nd 0 0 0 0 0 0 (D15-D8) $C00004 CD5 CD4 CD3 CD2 0 0 (D7-DO) CD5-CDO: ID CODE A15-AO: DESTINATION RAM ADDRESS CD5 CD4 CD? CD1 CDO VRAM WRITE 0 0 0 0 0 1 CRAM WRITE 0 0 0 0 1 1 VSRAM WRITE 0 0 0 1 0 1 VRAM READ 0 0 0 0 0 CRAM READ 0 0 1 0 0 0 VSRAM READ 0 0 1 0 0 S-W\GENESIS MANUAL Rev. 02/20/92 18 CONFIDENTIAL #229 PROPERTY OF SEGA • 2. VRAM ACCESS VRAM address range from 0 to OFFFFH, 64K bytes total. VRAM access addressing is as follows when writing: 1st 0 1 Al 3 Al 2 All A10 A9 A8 $C00004 A7 A6 A5 A4 A3 A2 Al AO 2nd 0 0 0 0 0 0 0 $C00004 0 0 0 0 0 0 A15 A15-AO: VRAM address Data D15 D14 D13 D12 D1 1 DO $C00000 D7 D6 D5 D4 D3 2 DO (D7-DO) D15-DO: VRAM data When you use long word D31-016 is 1 nd. When yku do byte writing, data is D7-DO, and may be written to $C000 V VRAM address is increased by the v 5, independent data size. VRAM address AO is used in the calc ss increment, but is ignored during address decoding. VRAM addressing and deco are as follows: the VRAM address decode uses Al 5-Al, and AO specifies the dat mat. Write data cannot cross a word boundary, high and low bytes are exchanged, i AO= AO =0 LONG WORD ADDRESS: EVEN D31-D24 oD D23-D16 D15-D8 D7-DO BYTE WORD LONG WORD ADDRESS: EVEN D7-DO D7-DO D23-D16 • ODD D15-D8 D31-D24 -or EVEN D7-DO ODD D15-D8 S-W\GENESIS MANUAL Rev. 02/20/92 19 CONFIDENTIAL #229 PROPERTY OF SEGA (EXAMPLE) START ADDRESS: 0 REG. #15.2 BYTE WORD LONG WORD ADDRESS: 0 1st D15-08 1st 031-024 1 1st D7-DO 07-DO D23-016 2 2nd D15-08 1st 015-D8 3 2nd 07-DO 07-DO 07-DO 4 3rd D15-08 2nd 031-024 5 3rd 07-DO D7-DO D23-D16 6 4th D15-08 2nd 7 4th 07-DO 07-DO 7-DO 8 5th D15-08 3rd 031-D24 9 5th 07-DO 07-DO -r D23-D16 START ADDRESS: 0 REG. #15=1 BYTE ADDRESS: 0 2nd D7-DO D7-DO 1st 07-DO 1 1st 07-DO D15- 015-D8 2 4th 07-DO 2nd 07-DO 3 3rd D7-DO D15-08 015-D8 4 6th D7- 6th 07-DO 3rd 07-DO 5 5th D7!-00 D15-D8 015-D8 6 8th D7-DO Eith 07-DO 4th D7-DO 7 <4 7th D7-00 D15-D8 015-D8 8 10th D7-DO 5th 07-DO 9th D15-D8 015-D8 S-MAGENESIS MANUAL Rev. 02/19/92 20 CONFIDENTIAL #229 PROPERTY OF SEGA START ADDRESS: 1 REG. #15.2 BYTE WORD LONG WORD ADDRESS: 0 1st D7-DO 1st 07-DO 1st 023-D16 1 015-08 D31-D24 2 2nd D7-DO 2nd 07-DO 1st D23-016 3 D15-08 D31-D24 4 3rd D7-DO 3rd D7-DO 2nd D23-016 5 D15-08 D31-D24 6 4th D7-DO 4th D7-DO 2nd 023-D16 7 D15-08 , D31-D24 8 5th D7-DO 5th D7-DO 3rd D23- 9 D15-D8 D31 24 START ADDRESS: 1 REG. #15.1 • BYTE WORD ADDRESS: 0 St D23-016 1 D31-D24 2 2nd 023-D16 3 D31-D24 4 5th 3rd 023-D16 5 D15-08 D31-D24 6 7th D7-DO 4th 023-016 7 015-D8 D31-D24 8 9th D7-DO 5th 023-D16 9 D15-138 D31-024 S-W\GENESIS MANUAL Rev. 02/20/92 21 CONFIDENTIAL #229 PROPERTY OF SEGA 1st $ C 00004 VRAM READ 0 0 Al3 Al2 All A10 A9 A8 (015-08) • A7 A6 A5 A4 A3 A2 Al AO (D7-DO) 2nd 0 0 0 0 0 0 0 0 #D15-D8) $ C 00004 0 0 0 0 0 0 Al5 Al 4 A15-AO: VRAM ADDRESS Data D15 014 D13 D12 D1 1 D10 D9 08 $c00000 D7 D6 D5 D4 D3 (D7-DO) D15-DO: VRAM DATA The data is always read in word units. AO is ign ng; no swap of bytes occurs if A0=1. Subsequent reads are from addr ER #15. AO is used in calculation of the next address. 3. CRAM ACCESS The CRAM contains 128 bytes, addre For word wide writes to the CRAM, use: 1st 1 1 0 0 0 0 0 (015-D8) $C00004 NA, 0 A A5 A4 A3 A2 Al AO (D7-DO) 2nd 0 0 0 0 0 0 (D15-08) $C00004 0 0 0 0 0 0 (07-DO) 0 0 0 B2 B1 BO 0 (D15-08) G2 G1 GO 0 R2 R1 RO 0 (07-00) D15-DO 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. S-VAGENESIS MANUAL Rev. 02/20/92 22 CONFIDENTIAL #229 PROPERTY OF SEGA A long word wide access is equivalent to two sequential word wide accesses. Place the first data in 031 - D16, and the second data in D15 - DO. 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 or word. Note that AO 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: 1st $C00004 A6 A5 A4 A3 A2 Al AO 2nd (015-D8) $ C00004 0 (D7-DO) A6-AO: CRAM ADDRESS Data • • B2 BO (015-08) $C00000 G2 G1 GO R2 R1 RO (07-DO) 4. VSRAM ACCESS The VSRAM contains 8 resses 0 to 4FH. For word wide writes to the VSRAM, use: 1st (D15-08) $C00004 A6 A5 A4 A3 A2 Al AO (D7-00) 2rid, (D15-08) 0004 (D7-DO) A6-A0: V M ADDRESS VS10 VS9 VS8 (D15-08) $C00 00 VS7 VS6 VSS VS4 VS3 VS2 VS1 VSO (07-DO) VS10-VSO: V quantity of scroll S-WGENESIS MANUAL Rev. 02/20/92 23 CONFIDENTIAL #229 PROPERTY OF SEGA 5. ACCESS TIMING The CPU and VDP access VRAM, 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 VDP 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 RAIC type; a VRAM access is byte wide, but CRAM and VSRAM are word wide. ACTIVE SCAN CYCLE H RETRACE H DISPLAY CYCLE H RETRACE CYCLE CYCLE >< 1 SCAN > H32 CELL 167 TIMES H40 CELL 205 TIMES V BLANKING CYCLE H RETRACE H DISPLAY CYCLE CYCLE LE >< 1 -> < H32 CE.L 167 TIMES H40 C L 205 TIMES For example, in 32 Cell mode, the CPU s the VRAM 16 times during horizontal scan in a single Ii Each acceess is a byte write, so this amounts to 8 • words. However, CRAM, AM, though sharing the 16 time limit, are word accesses so that 16 wards may written in a single line. Although there is, a four-word FIF i(writes are done in a tight loop during active scan, the FIFO will finp and the cI wiii eventually end up waiting to write. The maxithum wait tirus are: Displa de N'taxitta. m Waiting Time imateIy 5.96 p sec H46. cell Approximately 4.77 p sec _1 —I s the CPU has unlimited access to the RAMs during vertical blanking, the wait case ver arises. S-W\GENESIS MANUAL Rev. 02/20/92 24 CONFIDENTIAL #229 PROPERTY OF SEGA 6. HV COUNTER The HV Counters 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 Counter Latch Mode Counter is not latched by trigger signal Counter is latched by trigger signal M3: Register #0 Non-Interlace Mode $C00008 IH/C7 VC6 VC5 VC4 VC3 VC2 VC1 HC8 HC7 HC6 HC5 HC4 HC3 14581 Interlace Mode $C00008 LL/C7 VC6 VC5 VC4 VC3 4 1; iVG1 (D15 - D8) • V-Counter: VC7 VCO Display Mode 1 HC8 Counter Data HC7 HC6 H-Co 10' 14,11;40 Display Mode HC er: HC8 HC1 Counter Data HC1 (D7 - DO) V 28 Cell 0 - DFH H 32 Cell 0 - 7FH V 30 Cell 0 - EFH H 40 Cell 0 - 9FH The counter only has eight for H and V, so Interlace Mode and 40 Cell (320 dot) modes ppesent som4roblems. During Interlace Mode, the LSB of the vertical position is replaced by theritew MSB. The horizontal resolution problem is solved by always drop* the LSB. - C4Ition: As the 1-IV Ccfjnters value is not valid during vertical blanking, check to be sure that it is active sc before using the value. S-VV \GENESIS MANUAL Rev. 02/20/92 25 CONFIDENTIAL #229 PROPERTY OF SEGA H. DMA TRANSFER DMA (Direct Memory Access) is a high-speed technique for memory access to the VRAM, CRAM, and VSRAM. During DMA, VRAM, CRAM and VSRAM occur at the fastest possible rate (refer to 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 spacia, The DMA is quite fast during VBLANK (about double the tightest possible 68K I 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 DMDO DMA Mode Size 0 SA23 Memory to V-RAM Word to Byte (H) 8414 1 0 VRAM Fill Byte to kite _ 1 1 VRAM Copy Byte to Byte DMD1, DMDO: Reg. #23 DMDO SA23 Source address are $000000-$3FFFFF FFF (RAM) for memory to VRAM transfers. In the sfers, a hardware feature causes occasional failure of two conditions are observed: The destination address write (to 4) must be a word write. The final write must use e work RAM. There are two ways to accomplish this: (1) by copying the D ram into RAM, or (2) by doing a final i'move W RAM address, $C00004*" 1. MEMORY "It VR This Mf1 tion tra data from 68K memory to VRAM, CRAM or VSRAM. During this DMA all 68K ssing stops. The source address is $000000-$3FFFFF for ROM $FF0000-$F FFF for RAM. The DMA reads are word-wide, writes are -wi r AM word-wide for CRAM and VSRAM. The destination is spetithd by: Memory Type VSRAM S-NAGENESIS MANUAL Rev. 02/20/92 26 CONFIDENTIAL #229 PROPERTY OF SEGA • Setting of DMA M1 (Register #1) = 1 : DMA ENABLE. Increment number set to Register #15 (normally #2). Transfer word number set to Registers #19, #20. Source address and DMA mode set into Registers #21, #22 and #23. Set the destination address. *VDP gets the CPU bus. *DMA start. *VDP releases the CPU bus. M1 has to be 0 after confirmation of DMA finish : DM4gSE1'ABLE. DMA starts after Step E. You must set M1=1 only during DMA; otherwise, we capot guarant tie operation. • Source addresses were increased with +2 and destir1ion address incitased with content of Register #15. Content of Register. Register #1 has another bit. Register #15 INC7 INC6 INC5 IN INC1 INCO ROW INCO : Number of increment Register #1 0 1E0 M1 M2 Register #19 LG LG4 LG3 LG2 LG1 LGO Register #20 r LG15 LG13 LG12 LG11 LG10_I LG9 LG8 " SA8 SA7 SA6 SA5 SA4 SA3 SA2 SA1 • SA14 SA13 SA12 SAll SA10 SA9 SA23 SA22 SA21 SA20 SA19 SA18 SA17 • S-W \GENESIS MANUAL Rev. 02/20/92 27 CONFIDENTIAL #229 PROPERTY OF SEGA 1st $C00004 2nd $C00004 [_.r 1 DA7 L0 CDO DA6 DA13 DA5 DA12 DA11 DA4 CD2 DA3 DA10 DA2 DA9 DA1 DA15 DA8 DAO (D15 - D8) (D7 - DO) (015-D8) DA14 (D7 - DO) • i LG15 LGO: Number of move word SA23 - SAl: Source address (in 68000) DA15 DAO: Destination address (in VDP) CD2 CDO: RAM selection 2. VRAM FILL FILL mode fills with same data from free even VRAM address. _FILL if or only VRA How to set FILL (DMA): M1 (Register #1) = 1 : DMA ENABLE Increment number set to #15 (norm Fill size set to #19, #20. DMA mode set to #23. Destination address and FILL *DMA start. M1=0 after ccinfirmation olgishing : DMA DISENABLE DMA start ter Ste M1 stmuld be 1 in DMA transfer; otherwise, we cannot guarantee the operation. ttnat4W ss is Incremented with Register #15. VDP does not ask but open Pym t i ahnot access VDP without PSG, HV counter, and status. You reblize end arb M A by DMA bit in status register. SAMGENESIS MANUAL R. 02/20/92 28 CONFIDENTIAL #229 PROPERTY OF SEGA Register Setting. Register #1 has another bit. Register #15 INC7 INC6 INC5 INC4 IN C3 INC2 INC1 INCO INC7 INCO: Increment number Status EMPT FULL SOVR ODD VB HB DMA PAL DMA: 1: DMA Busy *: Not care Register #1 0 DISP 1E0 M1 M2 1 0 0 Register #19 LG7 LG6 LG5 LG4 LG3 LG2 LG1 Register #20 LG15 LG14 LG13 LG12 LG11 LG10 L LG8 • Register #23 0 0 0 0 0 ' 1st $C00004 0 DA13 DA DA11 DAV DA8 (D15 - D8) DA7 DA6 DA5 DA4 DA3 DA1 DAO (D7 - DO) 2nd $C00004 0 0 0 0 0 (D15 - D8) 0 0 0 0 DAIS DA14 (D7 - DO) $C00000 FD15 FD.i FD11 FD10 FD9 FD8 (D 5 - D8) FD7 PD6 FD.5 FD4 FD3 FD2 FD1 FDO (D7 - DO) 15 - LGdlx. Fill byte number A15 - DAO.ADestination address F015 - Fob: FILL data When sdlting firs g word, first will be D31-D16 and second will be 015-DO. • SAM.GENESIS MANUAL Rev. 220/92 29 CONFIDENTIAL #229 PROPERTY OF SEGA Example 1 Fill data are word. Register #15 = 1. 1. V-RAM address is even. First, low side of Fill data are written in V-RAM address. Second, upper side of Fill data are written in V-RAM+1. • V-RAM address is added register #15, written upper side Fill data in V-RAM at nqt1 each step. 2. V-RAM address is odd. First, upper side of FILL data are written in V-RAM address -1. Second, low side of FILL data are written in V-RAM. Same as (C.) VRAM address is even VRAM address is odd ADD (A) Even ADD -1 (D): ADD + 1 (B) (C) Odd ADD (E) ADD + 2 (C) ADD + 1 ADD + 3 (e) (F) ADD +4 (o) ADD +5 (C) ADD +6 (C) AD + (F) ADD + 7 ADD +6 (F) ADD + 7 4- data (C) into ADD + 1 after write data (B). S-VAGENESIS MANUAL R. 02/20/92 30 • CONFIDENTIAL #229 PROPERTY OF SEGA Example 2 Fill data are word. Register #15 = 2. VRAM address = even VRAM address = odd ADD lower Even ADD -1 upper Even ADD + 1 upper Odd ADD lower Odd ADD + 2 lower ADD + 1 ADD +3 upper ADD + 2 upper ADD + 4 (C) lower ADD +3 lower ADD +5 upper ADD +4 (F) upper ADD +6 (C) lower ADD + 5 lower ADD + 7 upper ADD +6 (F) upper ADD + 7 Example 3 Fill data are byte. V-RAM address is even (A) = (B) = (C) = BYTE DATA V-RAM address is odd (D) = (E) = (F) = BYTE WA Ns 3. VRAM COMO This function, copies from s6urce address to destination address by number of Copy , byte. DMA SO) A dv11 (R ter #1) = 1 : DMA ENABLE. 8.fiF,r- of copy bytes in #19, #20 C Source address and DMA mode in #23. D 'Destination address set. *DMA transfer. F. After confirming DMA finish: M1 = 0 : DMA DISENABLE S-NAGENESIS MANUAL Rev. 02/20/92 31 CONFIDENTIAL #229 PROPERTY OF SEGA DMA starts when (D) above is finished. Apply M1=1 only during DMA transfer. In other cases, if M1 = 1 is set, there is no guarantee that it will function correctly. At the time of DMA transfer, the destination address is incremented by the set value of Register #15. During DMA transfer, although the VDP does not require CPU to make a bus available, no access is possible from CPU to VDP except for PSG, HV counter, Status Read. DMA transfer finish can be recognized by referring to the Status Register's DMA bit. Example With Transfer byte = 3 at the time of VRAM Copy Source Register #15 = 1 Register #15 = 2 Address Destination Address Destination Address DATA 1 DATA 1 DATA 1 DATA 2 DATA 2 DATA 3 DATA 3 DAt4 2 DATA 4 DATA 5 DAtA 3 DATA 6 DATA 7 Caution In the case of VRAM Copy, 'read from VRAM" and "Write to VRAM" are repeated per byte. The re wne - urce Area and Transfer Area are overlapped, the transfer may, not perfor correctly. Pi S-W\GENESIS MANUAL Rev. 02/20/92 32 CONFIDENTIAL #229 PROPERTY OF SEGA Registers are as follows. Register #1 includes bits set for purposes other than DMA. Therefore, pay careful attention in this regard. Register #15 INC7 INC6 INC5 INC4 INC3 . INC2 INC1 INGO INC7 INCO: Increment number Status EMPT FULL SOVR ODD VB HB DMA PAL DMA: 1: DMA Busy Register #1: DISP 1E0 M1 M2 Register #19 Register #20 LG15 LG14 LG13 LG12 LG11 • Register #21 SA7 SA6 SAS SA4 SA3 V5A2 SA1 Register #22 SA15 SA14 SA13 447 SA8 Register #23 1st $C00004 D13 DA12 D11 DA10 DA9 DA8 L(D15 - D8) DA7 DA4 DA3 DA2 DA1 A0 (07 - DO) Di 2nd $C00004 (D15 - 08) DA15 DA14 (D7 - DO) LG15 LGO1 Number of copy byte SA15TSAO: Source address A, DA15 D Destination address When setting.first and second by long word, first will be D31-D16 and second will be D15-D • S-NAGENESIS MANUAL Rev. 02/20/92 33 CONFIDENTIAL #229 PROPERTY OF SEGA 4. DMA TRANSFER CAPACITY Transfer quantity varies, depending on the Display Mode as follows: DMA Mode Display Mode Screen Scanning Transfer bytes per line • H32 Cell During effective screen 16 bytes MEMORY During V Blank 167 bytes TO VRAM H40 Cell During effective screen 18 bytes During V Blank 205 bytes H32 Cell During effective screen 15 bytes During V Blank 166 bytes VRAM FILL ft H40 Cell During effective screen 17 bytes During V Blank 204 bytes H32 Cell During effective screen A 8 byi3F- During V Blank :f83 bytes , VRAM COPY H40 Cell During effective screen 9 'yes During V Blank 102 bytOS, 4t, ., In the Memory to VRAM, in the case d VSRAM1re the destinations, number of words (not bytes) should Blank allows for data transfer to all the addresses of CR Note that when calculating, the trans e screen (1/60 sec) varies depending on the number of lines durin efer to Display Mode) in the case of NTSC (video signal) and P systems. Display Mode , No. otthrizontal Unes V28 Cell (NTSC) es V2.13 Ceti OW 87 V0 Cell (PAL) 71 her R9isté?4i DjSP=0, i.e., when on-screen display is not made, the Transfer quaraity e same as Transfer Bytes Per Line during Blanking. S-W\GENESIS MANUAL Rev. 02/20/92 34 • CONFIDENTIAL #229 PROPERTY OF SEGA • I. SCROLLING SCREEN There are two different scroll screens, A and B, which separately can scroll vertically and horizontally on a basis of a one-dot unit. In the horizontal direction, scrolling overall or based on a one cell unit or one line unit can be selected, and in the vertical direction, scrolling overall or in a two cell unit can be selected. Also, the scroll screen. size can be changed on a basis of a 32 cell unit. SCROLL SCREEN EFFECTIVE DISPLAY --I SCREEN • SAAAGENESIS MANUAL Rev. 02/24/92 35 CONFIDENTIAL #229 PROPERTY OF SEGA For the scrolling screen display, the following register setting and VRAM are required: Scroll 'A" Pattern Name Table Base Address Register #2 SA15 SA14 SA13 • Scroll •B' Pattern Name Table Base Address Register #4 SB15 SB14 SB13 Mode Set Register #3 Register #11 1E2 VscR HS26 LScR J Mode Set Register #4 Register #12 RSO S/TE , A LSM-1 LSMO RS1 H Scroll Data Table Base Address Register #13 HS15 -4-1S14 HS13 0-1S12 HS11 HS10 Scroll Size Register #16 VS HSZ1 HSZO VRAM A' o4 Pa ame Table Max 8 Kbyte Scroll •Bik Pattern Name Table Max 8 Kbyte H Scroll Da able Max 960 byte VSRA able . Max 80 byte VAAGENESIS MANUAL Rev. 02/20/92 36 • CONFIDENTIAL #229 PROPERTY OF SEGA 1. SCROLLING SCREEN SIZE The screen size can be set by VSZ1, VSZO, HSZ1, and HSZO (Register #16). The following six kinds can be set for both Scroll Screens -A and B. 32*32/32*64/32*128 64'32/64'64 128*32 VSZ1 VSZO Function HSZ1 HSZO Function 0 0 V 32 cell 0 0 H 32 cell , 0 1 V 64 cell 0 1 H 64 cell ;,,' A 1 0 Prohibited 1 0 Prohibited 4 < Ow 1 1 V 128 cell 1 H12ceII i, i,,, Scroll Screen's Pattern Name Table Address exits esignated by Registers #2 and #4. Depending VRAM and Sc nd to each other differently. Example Register #16 = 00H: 32'32 cell 1 31 0000 0002 003c 003e 0040 0042 007c 007e 30 08() 0782 07bc 07be 07c2 07fc 07fe • S-NAGENESIS MANUAL Rev. 02/20/92 37 CONFIDENTIAL #229 PROPERTY OF SEGA Example Register #16 = 11H: 6464 cell 1 64 CELL 62 63 0000 0002 007c 007e 0080 0082 00fc 00fe 64 cell 62 1f00 1f02 1f7c 1f7e 63 1fc0 1fc2 1ffc life Example Register #16 = 03H: 32'128 cell 128 C 127 0000 0002 0100 0102 32 cell 30 1e00 1e02 lefc 1efe 31 1f00 1f02 4t 1ffc life A value sho icates an offset from the Pattern Name Table Base Address. S-WGENESIS MANUAL Rev. 02/20/92 38 • CONFIDENTIAL #229 PROPERTY OF SEGA 2. HORIZONTAL SCROLLING The Display Screen allows for scrolling overall or based on one cell unit, or on a dot by dot basis in one line unit. Either one of the above scrolling can be selected by HSCR and LSCR (Register #11). A setting applies to both Scroll Screens A and B. HSCR LSCR FUNCTION o o Overall Scrolling 0 1 Prohibited 1 0 Scroll in one cell unit 1 1 Scroll in one line unit HSCR, LCSR: Register #11 The effective scroll quantity is equivalent to 10 bits (000H 3F Taking the Display Screen as standard, the scroll direction Wit be St follows: DISPLAY SCREEN <— Moving Direction —> Scroll Quantity + Horizontally scrolling qu etting area: H Scroll Data Table is in VRAM m the base address which was set by Register #13, set the scrolling quantity of Screens A and B alternately. Also, the scrolling quantity da NttIng po'sition vanes depending on the following mode (overall, 1 cell or 1 line). de Setfflig Posi3In . , Ov'era U 'r 1 Every 81ki line starting from line 0 , 4le All lines S-NAGENESIS MANUAL. Rev. 02/20/92 39 CONFIDENTIAL #229 PROPERTY OF SEGA 00 02 04 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 A- Scrolling Quantity of Screen A B - Scrolling Quantity of Screen B A - Scrolling Quantity of Screen A Overall, Cell, Line Overall, Cell, Line Line • 06 B - Scrolling Quantity of Screen B 08 A - Scrolling Quantity of Screen A OA .13 - Scrolling Quantity of Screen B 1C A - Scrolling Quantity of Screen A 1E B - Scrolling Quantity of Screen B 20 A - Scrolling Quantity of Screen A N 22 B - Scrolling Quantity of Screen B 3FC A - Scrolling tity of Screen A Line 3FE B - Scrolling Qu f Scree Line 1315-010 can be fre *zed for program software. S-VIAGENESIS MANUAL R. 02/20/92 40 CONFIDENTIAL #229 PROPERTY OF SEGA • CONFIDENTIAL #229 PROPERTY OF SEGA • • CONFIDENTIAL #229 PROPERTY OF SEGA 3. VERTICAL SCROLLING The Display Screen allows for scrolling overall or every 2 cells in a dot unit. The setting can be done by VSCR (Register #11). A setting applies to both Scroll Screens A and B. VSCR Function Overall Scroll 2-Cell Unit Scroll VSCR: Register #11 The scrolling quantity is equivalent to 11 bits (000H - 7FFH). However - shown below in the Interlace Mode. Non-Interlace: The effective scrolling quantity is equivalent to Interlace 1: Same as above. Interlace 2: The effective scrolling quantity is nt to 11 bits. Taking the Display Screen as stand 4 direction Witt be as follows: Display Screen Moving Scroll Direction fluantity Set the V Scrikquan`l AM. Alternatfy set the s'e*oll quantity of Screens A and B. Depending on the Scroll Mode, the Data setting positions differ. S S-NAGENESIS MANUAL Rev. 02/20/92 41 CONFIDENTIAL #229 PROPERTY OF SEGA 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 00 A - Scrolling Quantity of Screen A 0, 1 Cell, Overall 02 B - Scrolling Quantity of Screen B 0, 1 Cell, Overall 04 A - Scrolling Quantity of Screen A 2, 3 Cell 06 B- Scrolling Quantity of Screen B 2, 3 Cell a 4. 08 A - Scrolling Quantity of Screen A 4,5 OA B - Scrolling Quantity of Screen B 4, 5 CriO OC A - Scrolling Quantity of Screen A 6, 7 Cell Ae OE B - Scrolling Quantity of Screen B , 4C 1 A - Scrolling Quantity of Screen A 38, 39 Cell i* 4E B - Scrolling Quantity of SurrriB 38, 39 Cell I D15-D11 is indefir) 4. SCROLL PATTERN NAME The Scroll Screen's na table is in VRAM and set by Registers #2 and #4. The Pattern Name requir:zy, es (1 word) per cell the Scroll Screen. Depending on the Scroll Screen'esize, V k4 and Scroll Screen correspond with each other differently. Refer!to Scroll Sc el.Size. vf hf pt10 Pt9 (D15 - D8) pt4 Pt3 Pt2 pt1 pt0 (D7 - DO) Pt5 pri: to Priolity cp1: olor palette selection bit (see Color Palette) cp0: Color palette selection bit (see Color Palette) vf: V Reverse Bit 1: Reverse hf: H Reverse Bit 1: Reverse 4 pt10 pt0: Pattern Generator Number S-W \GENESIS MANUAL Rev. 02/24/92 42 • CONFIDENTIAL #229 PROPERTY OF SEGA • Reverse bits vf and hf allow for H and V reverse on cell unit basis. • a vf = 0 vf = 1 hf = 0 hf = 0 S 1- S-VAGENESIS MANUAL Rev. 02/20/92 43 CONFIDENTIAL #229 PROPERTY OF SEGA 5. PATTERN GENERATOR Pattern Generator has VRAM 0000H as base address, and a pattern is expressed on an 8 x 8 dot basis. To define a pattern, 32 bytes are required. Starting from 0000H, it proceeds in the sequence of Pattern Generator 0, 1, 2, etc. The relationship between the display pattern and memory is as follows: 1 2 3 4 5 6 7 8 acianaciao0 boopacioao cool:101:1000 do 0000000 el:10000000 f00000ncia goci0000no hoocioacioa 0 1 2 3 07 DO 07 DO D7 DO D7 DO 00 al a2 a3 a4 a5 a6 04 bl b2 b3 b4 b5 b7 b8 08 cl c2 c3 c4 c5 it 6 c7 c8 OC dl d2 d3 d4 d5 d7 d8 10 el e2 e3 e4 e5 14 11 f2 f3 f5 f6 f7 f8 18 gl g2 g6 97 g8 1C hl h2 h3 h4 6 h7 h8 memory relationship is as follows: COLO COL3 COL2 COL1 COLO SAMGENESIS MANUAL Rev. 02/20/92 44 • CONFIDENTIAL #229 PROPERTY OF SEGA In Interlace Mode 2, one cell consists of 8 x 16 dots and therefore 64 bytes (16 long words) are required. 1 2 3 4 5 6 7 8 a 0 0 0 0 0 0 0 0 b 0 0 0 0 0 0 0 0 CD 0 0 0 0 0 0 0 do o 0 0 0 0 0 0 e00000000 f 0 0 0 0 0 0 0 0 go 0 0 0 0 0 0 0 ho 13 0 0 0 0 0 0 10 0 0 0 0 0 0 0 j0 0 0 0 0 0 0 0 k 0 0 0 0 0 0 0 0 100000000 moo 0 0 0 0 0 0 n00000000 00 0 0 0 0 0 0 0 p0 0 0 0 0 0 0 0 1 2 • D7 D007 DO D7 00 al a2 a3 a4 a5 aEx a7 a8 04 bl b2 b3 b4 b5 b7 b8 08 cl c2 c3 c4 c5 06' : c8 OC dl d2 d3 d4 d5 d6 d7 d8 10 el e2 e3 .4 , e6 e7 e8 14 fl f2 f3 f4 f5 f7 f8 18 gl g2 g3 g4 g5 g6 g7 g8 1C hl h3 x h6 h7 h8 , 12 1 , 14 15 16 i7 18 -61111,b. 2 j2 j3 14 j5 j6 j7 j8 kl ',.:...1 k3 1.(,i k5 k6 k7 k8 1 12 14 15 16 17 18 , 1 m m2 m3 m4 m5 m6 m7 m8 1 n2 n3 n4 n5 n6 n7 n8 1 01 o2 03 o4 o5 o6 o7 o8 ; 131 P2 P3 P4 P5 P6 P7 P8 SNAGENESIS MANUAL Rev. 02/20/92 45 CONFIDENTIAL #229 PROPERTY OF SEGA J. WINDOW For Window display, the following register setting and VRAM areas are required. Window Pattern Name Table and Base Address • Register #3 WD15 VVD14 WD13 VVD12 WD11 Mode Set Register Number 4 Register #12 RSO S/TE LSM1 LSMO RS1 Window H Position Register #17 WHP5 WHP4 WHP2 RIGT 4003 Window V Position Register #18 DOWN VVVPO VRAM: Window Pattern Name Ta Maximum 4 Kbytes. 1. DISPLAY POSITION The Window Displa is designated by Registers #17 and #18. Screen display can be dMs d on a basis of H2 cells and V1 cell. The dividing position varies depending (on resolution 0 1 34 35 36 37 38 39 27 H 40 cells 1 V 28 cells mode S-NAGENESIS MANUAL Rev. 02/20192 46 CONFIDENTIAL #229 PROPERTY OF SEGA Register #17 RIGT WHP5 VVHP4 VVHP3 VVHP2 1NHP1 Register #18 DOWN VVVP4 VVVP3 VVVP2 VVVP1 WVPO RIGT: 0 Displays Window from the left to H dividing position 1 Displays Window from the H dividing position to the right end DOWN: 0 Displays Window from the top end to the V dividing positip9. 1 Displays Window from the V dividing position to the botteim end. WHP5 WHP1: H dividing position WVP4 WVPO: V dividing position H Resolution Dividing Position (WHP) V Resolution Dividing Posi 32 cell 0 - 16 (0 - 32 cell) 28 cell 40 cell 0 - 20 (0 - 40 cell) 30 cell • S-W1GENESIS MANUAL Rev. 02/20/92 47 CONFIDENTIAL #229 PROPERTY OF SEGA Setting Example Register #17: 000H+01H Register #18: 00011+10H Window from the left end to the second cell Window from the top end to the 16th cell • 0 1 2 a 4 39 15 27 Register #17: 80H+02H Register #18: 80H+01H Window fro Window fro II t e right end bottom end • 1 4 39 DISPLAY SCREEN: 40 X 28 CELL MODE S-1MGENESIS MANUAL Rev. 02(21/92 48 CONFIDENTIAL #229 PROPERTY OF SEGA Register #17: 80H+01H Window from the 4th cell to the right end Register #18: 00H+10H Window from the top end to the 16th cell 0 1 2 3 4 39 15 27 DISPLAY SCR: 40 X 28 CEti, MODE • Register #17: 00H+02H Window to the left Register #18: 80H+01H Window from end 0 1 2 4 39 SCROLL A WINDOW DISPLAY SCREEN: 40 X 28 CELL MODE • S-VAGENESIS MANUAL Rev. 02/21/92 . 49 CONFIDENTIAL #229 PROPERTY OF SEGA 2. WINDOW PRIORITY Window Priority is handled in the same way as in Scroll A. Scroll A is not displayed in the area where Window is displayed. Also, only when Window is set to the left and Scroll A is moved in H direction, the character corresponding to two cells on the right side of the boundary between Window and Scroll A will be disfigured. There will be no malfunctioning when Window is set to the left side and Scroll A Lsv- moved only in the V direction; also when Window is set to the right side. WINDOW SCROLL A A A Display of this portion will be d ured. Thereforeirnask Scroll A by using high priority. S-W\GENESIS MANUAL Rev. 02/20/92 50 • CONFIDENTIAL #229 PROPERTY OF SEGA • 3. WINDOW PATTERN NAME Window Pattern Name Table is on VRAM, and the base address is designated by Register #13. The Pattern Name, the same as in Scroll Screen, requires 2 bytes (1 word) per cell. Pattern Name Lir' cp1 cP0 vr hf pt10 Pt9 Pt8 (D15 - D8) pt7 Pt8 P15 pt4 P13 Pt2 pt1 pri: Refer to Priority cp1: Color palette selection bit cp0: Color palette selection bit vf: V reverse Bit 1: Reverse hf: H Reverse Bit 1: Reverse pt10-pt0: Pattern Generator Number Pattern Name and VRAM relation varies depending on H 32 ce11/40 tkivmo careful attention to this point. H 32 Cell Mode 32 cell 0000 0002 S 1 32 cell 0040 0042 0780 0782 07bc 07be 07c0 07c2 07fc 07fe S-W \GENESIS MANUAL Rev. 02/24/92 51 CONFIDENTIAL #229 PROPERTY OF SEGA 0000 0080 1 0002 0082 H 40 Cell Mode 39 V 004e 00dc 40 0050 00e0 62 007c 00fc 63 007e 00fe • 32 cell 30 0100 0102 014e 0150 31 Ofc0 Ofc2 Ofde 01e0 Values shown are offset from the Base Address In the H40 Cell Mode, there exists the area for H64 c Ils. H display from the 41st cell in the H direction. In the V28 Cell Mode, there will be no display from tit V 2.cell pin the 30th Cell Mode, there will be no display from the 31st,Wt_ K. SPRITE For Sprite Display, the following regis AM area are required. Sprite Attribute Table and Ba e Address Register #5 AT 15 AT 1 AT13 AT12 AT11 All 0 AT9 Mode Set Register #12 S/TE LSM1 LSMO RS1 iiONVV vi. Sprite Attn ute- Table Maximum 640 Bytes S-W \GENESIS MANUAL Rev. 2,20192 52 • CONFIDENTIAL #229 PROPERTY OF SEGA 1. DISPLAY POSITION Sprite Position and Display Screen are as follows: When Sprite H position is 0, this is in a special mode. Therefore, pay careful attention to this point. Resolution H Position Display Area H32 Cell 080 - 17FH 001- 1FFH H40 Cell 080- 1BFH Non-interlace 000- 1FFH V28 Cell Interlace 1 Interlace 2 000 - 3FFH 100 - 2E)FH -rr"- Non-interlace 000- 1F V30 Cell Interlace 1 Interlace 2 • • S-NAGENESIS MANUAL Rev. 02/20/92 53 CONFIDENTIAL #229 PROPERTY OF SEGA 000 001 SPRITE POSITION 1ff • 080 1bf DISPLAY SCREEN 080 15f H4OCELUV28CELLJNONINTERLACE VODE 1ff When 0 is set to the SPRITE rity sprite on the same line will not be displayed. 000 1ff SPRITE POSITION 000 ITION OF SPRITE A:0 DISPLAY SCREEN D MASKED MASKED 1, SPRITE PRIORITY : B> A > C > D 1ff S-W\GENESIS MANUAL Rev. 02/20/92 54 CONFIDENTIAL #229 PROPERTY OF SEGA 2. SPRITE ATTRIBUTE Sprite Attribute Table is on VRAM and the Base Address is designated by Register #5. Attribute requires 8 bytes (4 words) per Sprite, and indicates Display Position, Priority, Sprite Generator Number, and Attribute. Starting from the beginning of the Attribute Table, numbers are given in the sequence of Sprite 0, Sprite 1, Sprite 2, Sprite 3, etc. Priority between Sprites is not, determined by the sequence of Sprite number, but by each Sprite's Link Data, and thus becomes programmable. 1st vi39 vP8 vP7 ,vP6 vP5 vP4 vP3 vp2 vp1• 2nd hs1 hs0 vsi vs0 1d6 1d5 1d4 1d3 1 d2 1 dl 3rd Hid cP1 cp0 vf hf sn10 sn7 sn6 sn5 sn4 sn3 (D7 - DO) • 41h hp7 hp6 hp5 Blank portions can be utiliz freely for softWare. vp9 vp0: V position hp8 hp0: H position hs1, hs0: Sprt H Size hp3 t: 1 (D7 - DO) vs1, v50: Size 1d6 1d0: Link Data pri: , 'Priority Bit e Priority) cp1, cp0: Color palett selection bit (see Color Palette) vf: VRever Bit 1: Reverse se Bit 1: Reverse sp10 snO: prite Pattern Generator Number ay us rleverse Bit vf, hf, V and H Reverse per Sprite is possible. • S-NAGENESIS MANUAL R. 02/20/92 55 CONFIDENTIAL #229 PROPERTY OF SEGA T/ • \ T / \T vf=0 vf=1 hf=0 hf=0 3. SPRITE SIZE Per Sprite dot number can be set on a cell unit basis, V vs1 vs0 Number of cell Number of cell 0 0 1 (8 dots) 1 (8 dots) 0 1 2 (16 dots) 2 (16 dots) 1 0 3 (24 dots) 3 (24 dots) 1 1 4 (32 dots) , 4 (32 dots) However, in one cell is comprised of 8 x 16 dots, therefore, the number of as compared to Interlace Mode 1). S-VAGENESIS MANUAL Rev. 02/20/92 56 CONFIDENTIAL #229 PROPERTY OF SEGA 4. SPRITE's DISPLAY CAPACITY The number of Sprite's maximum display varies depending on H resolution setting. Resolution No. of Display No. of Display per Une Display Dot per Une H32 cell Max. 64 Sprites Max. 16 Sprites Max. 256 dots H40 cell Max. 80 Sprites Max. 20 Sprites Max. 320 dots Sprite is displayed in the sequential order of Priority. Example With H size 1 cell, when 30 Sprites are intended to be displayed on the up to 16 Sprites counting from the one having highest priority (in the H and 20 Sprites in the H40 cell mode can be displayed, due to the ita display per line. With H size 4 cells, when 16 Sprites are intended to be dis me line, up to 8 Sprites, counting from the one having the highee r10 cell mode) and 10 Sprites in the H40 cell mode can be disp imitation of Display dots. • With H size 3 cells, when 16 Sprites intende e di in the same line, 11 Sprites, counting from the one h ng the highest friorityP. s for 11th one, however, only for 16 dots from the due to the limitation of the display end) in the H40: cell mode can be displayed, S. • S-W\GENESIS MANUAL Red. 02/20/92 57 CONFIDENTIAL #229 PROPERTY OF SEGA 5. PRIORITY BETWEEN SPRITES Priority between Sprites is designated by each Sprite's Link Data. With Sprite 0 being Priority No. 1, the Sprite No. 2 written in the Link Data there will be Priority No. 2. Priority No. 2 Sprite's Link Data shows Priority No. 3 Sprite. Priority No. 3 Sprite's Link Data shows Priority No. 4 Sprite. • In this way, Priority is sequentially designated by each Sprite's Link Data and thus it is in List form. The value that can be set in the Link Data is 0- (number of maxim Display on one screen minus one). Be sure to set 0 to the lowest priority Sp ' Link Data. When 0 is given to the Sprite Link Data, List ends at that Sprite and th become the lowest. Even in the case that the number of Sprites linked to List is less than the maximum display quantity (64 or 80), the remaining Sprites not linked to Sprite will not be displayed. When value other than those specified is set to Link 1Ha, or 0 is lowest Priority Sprite Link Data, ordinary functioning is not gu Sprite 0 LD a I Sprite a Lowest No. 3 Hereafter, contmfalk No. 2 up to LD 0. Priority No. 1 S-MAGENESIS MANUAL R. 02/20/92 58 • CONFIDENTIAL #229 PROPERTY OF SEGA Setting Example Link Data Sprite 0 2 Sprite 1 10 Sprite 0 Sprite 2 1 Sprite 2 Sprite 3 4 Sprite 1 Sprite 4 5 Sprite 10 Sprite 5 15 Sprite 11 Sprite 6 — Sprite 13 / Sprite 7 0 Sprite 3 Sprite 8 — 4 Sprite 9 k — • Sprite 10 11 ri e, Sprite 11 13 S 7 Sprite 12 — Sprite 13 3 if Sprite 14 — Sprite 15 7 Sprite 16 The 11 S,pt:ites shown in the Display Priority are displayed on the screen. Sprites , 9, 1214, and 16 onward are not displayed because they are not linked with Link Data S-VAGENESIS MANUAL Rev. 02/20/92 59 CONFIDENTIAL #229 PROPERTY OF SEGA 6. SPRITE PATTERN GENERATOR The Sprite Pattern Generator with VRAM 0000H as Base Address expresses one pattern on a basis of 8x8 dots. 32 bytes are required to define one pattern. Every 32 bytes, one pattern is expressed in the sequence of Pattern Generator 0, 1, 2, etc. The relationship of Display Pattern and Memory is the same as in Pattern Generator. Also, Sprite Size and Pattern Generator relationship is as follows: • V1 cell V1 cell V1 cell H1 cell H2 cell H3 cell 2 V2 cell V2 cell V2 cell V2 cell H1 cell H2 cell H3 cell H4 cell o 2 2 4 14 3 3 3 5 7 V3 cell V3 cell V3 cell H1 cell H2 cell H4 cell 3 0 3 6 9 4 1 4 7 A 2 2 5 2 5 8 8 V4 cell 4 cell V4 cell H II H3 cell H4 cell 0 4 8 0 4 8 C 5 9 1 5 9 D 2 6 2 6 A 2 6 A E 3 7 3 7 B F SAMGENESIS MANUAL Rev. 02/24/92 60 • CONFIDENTIAL #229 PROPERTY OF SEGA L. PRIORITY Priority between Sprite, Scroll A, and Scroll B can be designated. Priority can be designated by each Pattern Name and Attribute Priority bit. It will be set for the Scroll Screen on a cell unit basis and for each Sprite. By combining each priority bit, Priority will be as follows, however, the Background Priority is always the lowest. Spit A pri B pri Priority 0 0 0 S>A>B>G 1 0 0 S>A>B>G 0 1 0 A>S>B>G 1 1 0 S>A>B>G 0 0 1 IEI>S>A>G 1 0 1 S>B>A>G 0 1 1 A>I3>S>G 1 1 1 S>A>B>G 4 S: Sprite Scroll A Scroll B G: Background Also, by combining Siren (Register #12) the priority, Shadow-Highlight effect function can be utilized. , S S-MAGENESIS MANUAL Rev. 02/20/92 61 CONFIDENTIAL #229 PROPERTY OF SEGA S/TEN = 0 • A A=0 A=0 A=0 B=0 B=0 B=1 S=0 s=1 S=0 A A= 1 A=1 B =0 B=0 S=0 S=1 The above sho ty situa1 of Sprite, Scroll A, Scroll B and Background. The dot to which Color C e 0 is dej. ted is transparent. Therefore, either one of Scroll Screen A, Scroll Screen f or Backgr. (the priority of which is one step lower than the transparent one) will appe S-MGENESIS MANUAL Rev. 02/20/92 62 • CONFIDENTIAL #229 PROPERTY OF SEGA S/TEN = 1 Sprite Color Palette 0 - 3 , Color Code 0 - 15 Color Palette 3 , Color Code 0 - 13 • STATUS OF SHADOW Where S/TEN = 1when the Priority bit of both Scroll A and Scroll B is 0, there will be Shadow. ForAhe color,status, refer to the color palette. S-NAGENESIS MANUAL Rev. 02/20/92 63 CONFIDENTIAL #229 PROPERTY OF SEGA S/TEN = 1 Sprite Color Palette 3 , Color Code 15 • S: S: A=O A=O A=O B=O B=O B=1 S=o S= 1 S .= 0 S: A=1 A=1 B=O B=1 S=o S.1 STATUS OF SHADOW s\'‘ The dots for t Sprite ColonV de 15 work as a Shadow operator on the screen, the Priority of whi lower than tre Sprite. perator; this will not be displayed. S-W \GENESIS MANUAL • Rem. 02/20/92 64 CONFIDENTIAL #229 PROPERTY OF SEGA S/TEN = 1 Sprite Color Palette 3 , Color Code 14 • A=1 B=O S=o A F HIGHRIGHT die The dots of Sprite Color Code 15 work as an operator on the screen, the priority of which is lower than Sprite. Since sprite dots work as an om rator:this will not be displayed. S-W \GENESIS MANUAL Rev. 02/20/92 65 CONFIDENTIAL #229 PROPERTY OF SEGA When SPRITE is not related to PRIORITY, the following PRIORITY applies: S/TEN =0 • A.0 A=0 A=1 B=0 B=1 B=0 S/TEN = 1 A=0 A=0 B=0 B=1 STATUS OF SHADOW S-NAGENESIS MANUAL Rev. 02/20/92 66 CONFIDENTIAL #229 PROPERTY OF SEGA M. COLOR PALETTE One dot is comprised of 4 bits and can designate the 0-15 colors. Also, 0-3 color palette can be designated by Scroll screen on a cell basis and by each Sprite. CRAM data are as follows. Since each of R, G and B has 3 bits, colors can be freely selected out of 512 colors. DATA B2 B1 BO G2 G1 GO R2 R1 RO The relationships between CRAM address, palette, and color code are as fol However, in the case of each palette's color code 0, the color for the Scroll Scroll Window, and Sprite is See Through irrespective of RBG designation. ADDRESS BLUE GREEN RED PALETTE 00H 02H 04H The OI,5 colors • • des19ntd by RGB • will* displayed • lAH 1CH lEH 20H Same as Palette 0 3EH 15 40H 2 Same as Palette 0 5EH 15 60H 62H Same as Palette 0 • 3 7AH 13 For 14 and 15, 7CH 14 refer to Priority 7EH 15 • VAAGENESIS MANUAL Rev. 02/24/92 67 CONFIDENTIAL #229 PROPERTY OF SEGA RGB bit and display are as follows: Max • VEL R OUTPUT (G&B are the same as R) R2 - RO 0 1 234 Max STATUS OF SHADOW R OUTPUT (G&B are the same as Min 0 1 2 3 4 5 6 7 Max A IGHRIGHT R OUTPUT (G&B are the same as R) Min R2 - RO 0 1 2 G 4 5 6 7 S-NAGENESIS MANUAL Rev. 0020/92 68 CONFIDENTIAL #229 PROPERTY OF SEGA N. INTERLACE MODE Raster Scan Mode can be changed by setting LSMO and LSM1 (RGB #12). LSM1 LSMO Raster Scan Mode 0 0 Non-interlace mode 0 1 In the non-interface mode, the same pattern is displayed on the rasters of even and odd numbered files. (Interlace 1) 1 1 In the interlace mode, the different pattern is displayed on the rasters of even and odd numbered files. (Interlace 2) In the interlace mode and Interlace 1, one cell is defined by 8x8 dotOicl irr 8x16 dots. For Display, one cell consists of 8x8 dots in th on-interlace the interlace mode, 8x16 dots. In any case, number of cells in one screen are the sarna. Depending on the type of display, in the cas lay, there May occur a serious blur in the vertical direction. Ther ing the d' y, pay careful attention in this regard. S-NAGENESIS MANUAL Rev. 02/20192 69 CONFIDENTIAL #229 PROPERTY OF SEGA NON-INTERLACE INTERLACE 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 INTERLACE 2 1 2 3 Flirt NO. 1 4 FIELD NO. 2 5 6 7 S-W\GENESIS MANUAL Rev. 02/20/92 70 CONFIDENTIAL #229 PROPERTY OF SEGA III. BACKWARD COMPATIBILITY MODE In the case of Backward Compatibility Mode, the Mega Drive differs from the original Mark III and Master System in the following points: MARK III (MS-Japan) 0S-ROM is not incorporated ROM cartridge/card selections are made by hardware in the same manner as in the case of Mark III. Start-up slot number is not written in OCOOOH. Start-up SEGA lo not displayed. FM sound source is not incorporated FM sound is incorporated in MS-Japan (standard) and Mark III (optional) (OPLL), however, Mega Drive has no option for that, although connection ispOSible. Consider the Mega Drive's Japanese specifications as that of -Japan's Joystick Port, or as MS-Japan without FM sound source arid0 MASTER SYSTEM OS-ROM is not incorporated 0C000H-ODFFFH RAM is not clear on 000 has no meaningful value. Start-up Sega logo is not displayed. FM sound source is not incorporated FM sound source is incorpTrh MS by option (OPLL). However, Mega Drive has no option, although con ion is po ible. Please regard the Mega Drive overseas version as a Master System without a.çperating System ROM. RAM BOARD In the Mega Drive's Mark #and Master System backward compatibility mode, the RAM , board for de4opment (for which D-RAM was used) cannot be used due to the problem Of . .The trtler boards for development (which utilize S-RAM) can be used wtthout any problem. S-W\GENESIS MANUAL Rev. 02./20/92 71 CONFIDENTIAL #229 PROPERTY OF SEGA IV. SYSTEM I/O Mega Drive System I/O area assignment starts from $A00000, with the Z80 sub-CPU's memory area. VERSION NUMBER • Indicates the Mega Drive's hardware version. $A10001 MODE VMOD DISK RSV VER3 VER2 VER1 VERO Mode (R ) 0: Domestic Model 1: Overseas Model VMOD (R ) 0: NTSC CPU clock 7.67 MHz 1: PAL CPU clock 7.60 MHz Disk (R ) 0: FDD unit connected 1: FDD unit not connected RSV (R ) Currently not used VER 3-0 (R ) Mega Drive version is idi $F. The present hardware, vfkion is indicated by $0. I/O PORT The Mega Drive has the three general p 2, and Exp. Although each port differs from the ot ctions in the same manner. Each port has the following Data (Parallel data) : R/ Ctrl (Parallel control) : R/W S-Ctrl (Serial control) : R/W TxData (Txd data) : R/W RxData (Rxd data) , Ix* SAAAGENESIS MANUAL Rev. 02/20/92 72 • CONFIDENTIAL #229 PROPERTY OF SEGA The relationship between REGISTERs is as follows: DATA DO I/O D1 I/O D2 I/O D3 I/O D4 D5 I/O TR • D6 TH CTRL JS CON (CTRL 1) HL TERMINAL (CTRL 2) (EXP) S-CTRL RxDATA TxDATA 1,0 P/S PARALI FIIAL MODE change INT 11TERR CONTROL SAD SERIAL-PARALLEL CONVERSION P: PARALLEL-SERIAL CONVERSION • S-114AGENESIS MANUAL Rev. 02/20/92 73 CONFIDENTIAL #229 PROPERTY OF SEGA Mapping is as follows: $A10003 : Data 1 $A10005 : Data 2 $A10007 : Data 3 $A10009 : Ctrl 1 (Ctrl 1) (Ctrl 2) (Exp) • $A1000B : Ctrl 2 $A1000D : Ctrl 3 $A1000F : TxData 1 $A10011 : RxData 1 $A10013 : S-Ctrl 1 $A10015 : TxData 2 $A10017 : RxData 2 $A10019 : S-Ctrl 2 $A1001B : TxData 3 $A10010 : RxData 3 $A1001F : S-Ctrl 3 Both Byte and Word access are possible. HoWever, in the 46e of Word access, the lower byte is meaningful. Data shows the status of each port. The I/O direction of e4 bit is eke t b and S-Ctrl. , DATA PD7 PD6 PD5 I P PD2 P PDO PD7 (RW) RW) 1GHT PD6 (RW) RW) LEFT P D5 (RW) RW) DOWN PO4 (RW) TL RW) UP S-1N\GENESIS MANUAL Rev. 02/20/92 74 • CONFIDENTIAL #229 PROPERTY OF SEGA • Ctrl designates the I/O direction of each port and the Interrupt Control of TH. CTRL INT INT PC6 PC5 PC4 (RW) 0: TH-INT Prohibited PC3 PC2 PC1 PCO 1: TH-INT Allowed PC6 (RW) 0: PD6 Input Mode 1: PD6 Output Mode PC5 (RW) 0: PD5 Input Mode 1: P05 Output Mode PC4 (RW) 0: PO4 Input Mode 1: PD4 Output Mode PC3 (RW) 0: PD3 Input Mode 1: P03 Output Mode PC2 (RW) 0: P02 Input Mode 1: PD2 Output Mode PC1 (RW) 0: P01 Input Mode 1: PD1 Output Mode PCO (RW) 0: PDO Input -Mode 1: PDO Output Mode S-Ctrl is for the status, etc. of each port's mode change, b Ctrl designates the I/O direction of each port a S-CTRL BPS1 BPSO SIN RRDY TFUL SIN (RW) 0: TR - 1: TA - Se SOUT (RW) 0- TL - Paralle e L - Serial Out RINT (R xq Ready - Interrupt Prohibited 1: Rxd eady - Interrupt Allowed REAR (R) 0: 1: Rx)4Error 1: RxdReady TFUL (A) 0: 1: TxdFull Ira- B PS1 . bps 0 0 4800 , 0 1 2400 1 0 1200 ...b- 1 1 300 • S-NAGENESIS MANUAL Rev. 02/20/92 75 CONFIDENTIAL #229 PROPERTY OF SEGA C. MEMORY MODE The Mega Drive is able to generate internally the Refresh signal for the D-RAM development cartridge. When using the development cartridge, set to D-RAM mode. In the case of a production cartridge, set to ROM mode. • Only 08 of address $A11000 is effective and for Write only. $A11000 D8 ( W) 0: ROM mode 1: 0-RAM mode Access to $A11000 can be based on byte. D. Z80 CONTROL 1. Z80 BusReq When accessing the Z80 memory from the 68000, first theZ80by using At the time of power on reset, the 68000 has access to the,c80 bus. $A11100 08 ( W) 0: BusReq cancel 1: BusReq request (R ) 0: CPU function 1: Functionin Access to Z80 area in the following Write $0100 in $A11100 by usin Check to see that 08 of $A11100 Access to Z80 area. Write $0000 in $A1110 using a Word access. Access to $A11100 also be Led on byte. • 2. Z80 Reset The 6800 may also the Z80. The Z80 is automatically reset during the Mega Drive har ware's power reset sequence. Reset request Reset 'cancel SA11100 can also be based on byte. S-NAGENESIS MANUAL Rev. 02/20/92 76 • CONFIDENTIAL #229 PROPERTY OF SEGA • E. Z80 AREA Mapping is performed starting from $A00000 for Z80, a sub-CPU. As viewed from 68000, the memory map will be as follows: $A00000 Sound RAM $A02000 Prohibited $A04000 Sound Chip $A04004 Prohibited $A06000 Bank Register $A06002 Prohibited $A08000 Prohibited 1. Sound RAM This is for the Z80 program. Ac Sound Chip This is the mappin for FM sound source (YM2612). When accessing from 68000, use timing problem. Bank Register Access toItle 68 0 side Mdmory Area from Z80 will be based on a 32 K byte unit ' bine, ter sets which bank is to be accessed. Registering fro 000 can be set, however, do not access to Z80 Bank Memory Area by 680 • S-W\GENESIS MANUAL Rev. 02/20/92 77 CONFIDENTIAL #229 PROPERTY OF SEGA Setting Method When accessing to the 68000 side addresses from Z80 side, all the addresses can be classified into Banks. Bank can be set by writing 9 times in 0 bit of 6000 (Z80 address). The 9 bits correspond to 68000 address 15-23 as shown below: • 0000 S_RAM 68000 ADDRESS A23 6000 4000 BANK SOUND OTHERS 8000 1 T- A23 BANK A22 68000 A21 7FF0 4 A20 VDP 5 Tim A19 6 Tim A18 7 Tim Al 7 8 Ti A16 9 s A15 S-VV \GENESIS MANUAL Rev. 02/20/92 78 CONFIDENTIAL #229 PROPERTY OF SEGA V. VRAM MAPPING In VRAM, there are various tables and pattern generators as stated below. Among those, the base address of Pattern Generator Table and Sprite Generator Table are 0000H and fixed. However, the other base addresses can be freely assigned in VRAM by setting VDP Register. Also, Area can be overlapped, therefore, Table can be commonly used by Scroll screen and Window, for example. Scroll A Pattern Name Table, maximum 8 K byte Base address designated by Register #2. Scroll B Pattern Name Table, maximum 8 K byte Base address designated by Register #4. Window Pattern Name Table, varies by H resolution Base address designated by Register #3. H Scroll Data Table, 1 K byte Base address designated by Register #13. Sprite Attribute Table, varies by H resolution Base address designated by Register #5. • Pattern Generator Table Base address is 0000H (fixed). Sprite Generator Table Base address is 0000H (fixed There are 1 K bytes for H Scroll Table, ever, asj display 896 bytes in V28 Cell Mode and 960 bytes in V30 Cell Mode. bytes for Window Pattern Name Table in H32 Cell Mode, and 4 byte area in H40 Cell Mode. For details, refer to Window. There are 512 bytgSprite Attribute Table in H32 Cell and 1 K byte area in H40 Cell Mode. How isplay, there are 640 bytes in H40 Cell Mode. Setting examples_ H32 Cell Mode Scroll A Pattern e Table 8 K bytes from 000001-1: Register #2 = $30 Scroll B Patter Name Table 8 K bytes fr E000H: Register #4 = $07 W. ow Pattern Name Table bytes from OBOOOH: Register #3 = $2C H Scroll Data Table 1 K byte from OB800H: Register #13 = $2E Sprite Attribute Table 512 bytes from OBEOOH: Register #5 = $5F S-W \GENESIS MANUAL Rev. 02120/92 79 CONFIDENTIAL #229 PROPERTY OF SEGA Unoccupied area is used as Pattern Generator and Sprite Generator. • 00000H OBOOOH WINDOW OB800H H SCROLL OBE0OH SPRITE ATTRIBUTE OCOOOH SCROLL A 0E000H SCROLL B S-W\GENESIS MANUAL Rev. 02/20/92 80 CONFIDENTIAL #229 PROPERTY OF SEGA • H40 Cell Mode Scroll A Pattern Name Table 8 K bytes from OCOOOH: Register #2 = $30 Scroll B Pattern Name Table 8 K bytes from 0E000H: Register #4 = $07 Window Pattern Name Table 4 K bytes from OBOOOH: Register #3 = $2C H Scroll Data Table 2 K bytes from OACOOH: Register #13 = $2B Sprite Attribute Table 1 K byte from 0A800H: Register #5 = $54 Unoccupied area is used as Pattern Generator and Sprite Generate • 0A800H OACOOH OBOOOH OCOOOH 0E000H S-W \GENESIS MANUAL Rev. 02/20/92 81 CONFIDENTIAL #229 PROPERTY OF SEGA Precautions for M5 Software Programming When programming the M5 software, pay attention to the following: The program od DMA (RAM, ROM—+VRAM, CRAM, VSRAM) should be resident in RAM or it should be as in LIST1 for example. However, in either one of the • above two cases, a long word access is not possible as regards the last VRAM address set. ID should be as in the next page. Put LIST2 at your program's start. This is the U.S. security software. LIST 1 DMA-RAM: lea , vdp_cmd = $c00000 ; An = Address Regi ter ; Set source Address to VDP Register ; Set Data Length to VDP Register move.1 xx,ram0 ; xx: Destination Ad res• ; ram0: Work R move.w ram°, (An) , move.w ram0+2, (An) ; Pa tfentIonlv to the quential order of word an d word estination Ad ess d be set by Word and not by Long WOrd. LIST 2 move.b $a10001 ,d0 ; Get v n number andi.b #$Of,d0 beq.b ?0 ; If not version #0 move.1 # 'SEGA', ,Sa14000 • Output ASCII ?0: S-W\GENESIS MANUAL Rev. 02/24/92 82 • CONFIDENTIAL #229 PROPERTY OF SEGA ROM Cartridge Data For Mega Drive Write in ROM's 100H-1FFH 100H: 'SEGA MEGA DRIVE' 1 110H: '(C) SEGA 1988.JUL' 2 120H: Game Name (domestic) 3 150H: Game Name (overseas) 4 180H: 'GM XXXXXXXX-XX' 5 18EH: $XXXX 6 190H: Control Data 7 1AOH: $000000, $XXXXXX 8 1A8H: $FF0000, $FFFFFF 9 1BOH: External RAM Data 10 1BCH: Modem Data 11 1C8H: Memo 12 1F0H: Country in which the product 13 can be released 1: SEGA, system name and Title in common with all ROM. 2: Copyright notice and year/month of release (firm na ter). 3: Game name for domestic (JIS KANJI Co 4: Game name for overseas market ( .k.) 5: Type of cartridge and products, n Jj ber, version ni ber: Type Game: GM Education: Al Number Product No. Version Data varies d nding on the type of ROM or software version Check Sum I/O use support data Joystick for Joystick Keyboar, :K Serial (RS232C) :R Printer :P :T Controf Ball : 13 . Paddle Oontrotierb- :V FDD f : F ZE9JVI :C ROM Capacity Start Address, End Address RAM Capacity Start Address, End Address S-W\GENESIS MANUAL Rev. 02/20/92 83 CONFIDENTIAL #229 PROPERTY OF SEGA When no external RAM is mounted, fill the address by a space code; when it is mounted, do the following: 1BOH: dc.b 'RA' ,%1x1yz000,°/000100000 1 for Backup and 0 if not Backup yz 10 if even address only, 11 if odd address only 1B4H: dc.1 RAM start address, RAM end address If corresponding to modem, fill it by space code; if not, do the following 1BCH: dc.b 'MO' ,'xxxx' ,'yy.z' xxxx Firm name, the same as in 2 yy Modem number Version 13. Data on the countries in which the product can be released Japan :J USA :U Europe :E Be sure to input a space code in the unoccupied 1-4k9713 S-VAGENESIS MANUAL Rev. 02/20/92 84 CONFIDENTIAL #229 PROPERTY OF SEGA How to Obtain a Check Sum The Check Sum obtaining program is shown as follows. The program starts with OFF8000H, RAM space. First, fill game capacity by -1 (OFFH) and then load all of the programs. Next, load the Check Sum program and run the program from OFF8000H. After a while, stop running the program. At this time, the lower Word of Data Register 0 (d0), is the Check Sum value. Note that Break in Memory should be cancelled in advance. Also, when burn-ins to ROM, first fill the game capacity by -1 (OFFH). end_addr equ $1a4 org -$8000 start: move.1 (a0) ,d1 addq.1 #$1,d1 movea.1 #$200,a0 sub.1 a0,d1 asr.1 #1,d1 ; counter move dl ,d2 subq.w #$1,d2 swap dl • moveq #$0,d0 e?12: add (a0)+,d0 dbra d2,?12 dbra dl,?12 flop flop flop flop flop flop flop ?1 e: flop flop bra.b • • S-W\GENESIS MANUAL REN. 02/20/92 85 CONFIDENTIAL #229 PROPERTY OF SEGA Memory Mapping for Emulation For the 68000 Emulation All address should be disabled initially: 0 to OFFFFFF • Required areas should then be enabled as follows: Program and Data are in 0 to 007FFFF S-RAM is for Z80 in 0A00000 to 0A01FFF . FM sound chip interface is in 0A04000 to 0A04FFF I/O and Z80 control port are in 0A10000 to 0A11FFF VDP and sound control port are in 0000000 to OCOOFFF Scratch RAM isin OFF0000 to OFFFFFF RAM Card (No. 171-5642-02) This board has two memory areas: Main Memory (D-RAM) $000000 - $OFFFFF Backup Memory (S-RAM) $200000 - $203FFF Initialize Write 0100H into $0A11000 Write 1 into $0A130F0 (Green LED light up) Write Protect Write 3 into $0A130F0 (Red LED light up) Read/Write Write 1 into $0A130F0 (Red LED turns off) Note: Emulator, s should be enabled before the writes, then disabled after wdrqs. S-IAAGENESIS MANUAL Rev. 02/20/92 86 CONFIDENTIAL #229 PROPERTY OF SEGA • Mega Drive Registers Fixed Bits (40 Cell and NTSC Mode) RO 1 2 '1 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 DMA cannot be performed emt!lattOROM or RAM on most ICEs. • S-NAGENESIS MANUAL Rev. 02/20/92 87 CONFIDENTIAL #229 PROPERTY OF SEGA • CONFIDENTIAL #229 PROPERTY OF SEGA • • CONFIDENTIAL #229 PROPERTY OF SEGA • CONFIDENTIAL #229 PROPERTY OF SEGA INDEX I. Z80 MAPPING Z80 Memory Map Interrupt II. 68K CONTROL OF Z-80 Z80 Start-up Z80 Handshake III. FM SOUND CONTROL 68K Access FM Chip Z80 Access FM Chip IV. PSG CONTROL V. D/A CONTROL • This manual explains memory mapping and way of accessing especially. FM sound generation and PSG are explained in another manual. CONFIDENTIAL #229 PROPERTY OF SEGA • ;ORM' • CONFIDENTIAL #229 PROPERTY OF SEGA I. Z80 MAPPING A. Z80 Map We show the memory at right. I/O is contained in memory map. Program Area Z80 ADDRESS Program, data and scratch are in 0 to 1FFFH, in S-RAM. S.RAM BANK 1FFF From 8000H-FFFFH is window of 68K memory. Z-80 can access 4000 all of 68K memory by BANK switching. BANK select data create 68K address from Al 5 to A23. You must write these 9 bits one at a time into 6000H serially, byte units, 7F11 using the LSB. NK AREA • 1st 2nd 07 Ds D5 D4 03 D2 D 9th A23 Al 5 3. I/O 4000H FM1 register select (Channel 1-3) 0041 15,01/4 4042H FM2 r er select (Channel 4-6) 4003H FM2 DATA address is in 7F11H. B. lerrupt -80 gets the only VIDEO vertical interrupt. This interrupt is generated 16ms period and 64m5 length. Genesis Sound Software Manual February 21, 1992 Page 1 CONFIDENTIAL #229 PROPERTY OF SEGA IL 68K CONTROL OF Z-80 A. Z80 Start-Up Z-80 Operation Sequence: BUS REQ ON • BUS RESET OFF 68K copies program into Z-80 S-RAM BUS RESET ON BUS REQ OFF BUS RESET OFF BUS REQ ON DATA 100H (WORD) —* $A11100 RESET Z-80 RESET ON DATA OH (WORD) $A1120 RESET OFF DATA 100H ( $A11200 This period requires 26m Also FO, sou1ck source is cleared at the same time. GN BUS STATUS This information is in $A11100, bit 0. -80 is using - 68K can access Genesis Sound Software Manual February 21, 1992 Page 2 CONFIDENTIAL #229 PROPERTY OF SEGA B. Z80 Handshake If you access the HANDSHAKE area (A00000 - AO7FFF) you must use BUS REQ. 68K has to access the Z-80 S-RAM by byte. III. FM SOUND CONTROL 68K Accesses the FM Source 68K needs BUS REQ when accessing the FM source, because this memory is cont by Z-80. Z80 Accesses the FM Source Z-80 normally controls the FM (4000H - 4003H). IV. PSG CONTROL PSG accepts access of 68K and Z-80 any time, but you haV co#;inat -80 accesses. PSG is in $C00011 from 68K and in 7F11H from Z-80. • • Genesis Sound Software Manual February 21, 1992 Page 3 CONFIDENTIAL #229 PROPERTY OF SEGA OVERVIEW The Yamaha 2612 Frequency Modulation (FM) sound synthesis IC resembles the Yamaha 2151 (used in SEGA's coin-operated machines) and the chips used in Yamaha's synthesizers. • • Its capabilities include: 6 channels of FM sound An 8-bit Digitized Audio channel (as replacement for one of the FM channels) Stereo output capability One LFO (low frequency oscillator) to distort the FM sounds 2 timers, for use by software. To define these terms more carefully, an FM channel is capable of expressing, w-th a high degree of realism, a single note in almost any instrument's voice. Chords are generally rated by log multiple FM channels. The standard FM channels each have a single overall frequency'' arid at.''w to turn this frequency into the complex final waveform (the voice). This conversion proc ss uses four dedicated channel components called "operators," each posse g a frequeña variant of the overall frequency), an envelope, and the capability to modu e its input ustflg. the frequency and envelope. The operator frequencies are offsets of • multiplas of th overall frequency. There are two sets of three FM channels, med channe nd 4 to 6, respectively. Channels 3 and 6, the last in each set, have e capability to ally separate frequency for each operator rather than offsets of integral ltiples. This w s well (we believe) for percussion instruments, which have harmonics at odd m 'pies such a 4 o 1.7 of the fundamental. The 8-bit Digitized Audio Channel (DAC) exists a ement of FM channel 6, meaning that turning on the DAC turns off FM cha I 6. Unfortunately, all timing must be done by software— meaning that unless the softwar n very cleverly constructed, it is impossible to use any of the FM channels at the sank time as DAC. Stereo output capability means that any of e sounds, FM or DAC, may be directed to the left, the right, or both outputs stereo is • only through the headphone jack. The LFO, or Low quency I lator, allows for amplitude and/or frequency distortions of the FM sounds. Each c nel electskthe degree to which it will be distorted by the LFO, if at all. This could be used, fo ampleyIn a guitar solo. Final! PI has are timers which may be used as an alternative to the Z80 VB rrupt, Unfor taly, these two timers do not cause interrupts — they must be read y th are t determine if they have finished counting. Genesis Sound Software Manual February 21, 1992 Page 4 • CONFIDENTIAL #229 PROPERTY OF SEGA A LITTLE BIT ABOUT OPERATORS There are four dedicated operators assigned to every channel, with the following properties: An operator has an input, a frequency and an envelope (with which to modify the input), and an output. The operators have two types: those whose outputs feed into another operator, and itliosev that are summed to form the final waveform. The latter are called 'slots." The slots may be independently enabled, although Sega's software always enables o disables them all simultaneously. 1:5 *604„ Operator one may feed back into itself, resulting in a more complex wave4 These operators may be arranged in eight different configurations, called 1a4g5Pthms is a diagram of the algorithms. • Genesis Sound Software Manual February 21, 1992 Page 5 CONFIDENTIAL #229 PROPERTY OF SEGA ALGORITHM #0 #1 #2 #3 • 2 2 2 3 3 3 #4 #5 3 SLOTS ARE INDICATED BY SHADI Algorithm 0 - distortion • • h hat chopper" (?) bass Algorithm 1 - harp, P• (Progr- • able Sound Generator) sound Algorithm 2 - Bass, e3ectric guitar br3ss, piano, woods Algorithm 3 - str•ngs, folk guitar, .chimes Algorithm 4 - 1., berl, or dass drum, snare drum, tom-tom Algorithm Algorith tom-tom, organ, vibraphone, snare drum, base drum Algorith Genesis Sound Software Manual February 21, 1992 Page 6 CONFIDENTIAL #229 PROPERTY OF SEGA REGISTER OVERVIEW The system is controlled by means of a large number of registers. General system registers are: timer values and status, software use LFO enable and frequency, to distort the FM channels DAC enable and amplitude output enables for each of the six FM channels number of frequencies to be used in FM channels 3 and 6. Usually, an FM channel has only one overall frequency, but if so elected, FM channels 3 and 6 use four separate frequencies, one for each operator. The remainder of the registers apply to a single FM channel, or ,to an operator in Registers that refer to the channel as a whole are: frequency number (in the standard case) algorithm number extent of self-feedback in operator 1 output type, to L, R, or both speakers. This can only be are used. the extent to which the channel is distorted by the LF • Registers that refer to each operator make up the ainder four ipe ors connections are determined by the algorithm used, but the e0 ope is always speci6 individually for each operator. In the case of FM channels 3 and 6, the frequency maybe specified individually for each operator. Genesis Sound Software Manual February 21, 1992 Page 7 CONFIDENTIAL #229 PROPERTY OF SEGA ENVELOPE SPECIFICATION • TL D2R T1L AR KEY ON (DEPRESSED) KEY 04 RELEASED) .01 The sound starts when the key is depresse a process n.' The sound has an attack, a strong primary decay, followed by slow seconda The sound continues this secondary decay until the key is released, rocess called y off? The sound then begins a rapid final decay, representing, for example, •iano note, aft he key has been released and the , damper has come down on the strings. The envelope is represented by t above amplitu es and angles, and a few supplementary registers. Used in the above dia re: TL — Total level, the ghest am de of waveform. AR — Attack ratthe.le of ipAial amplitude increase. This can be made very steep if desiedZ pro h slow attack rates is that if the notes are short, the release 'key dftw) occurs before the note has reached a reasonable level. DIR — Th ,angle of initial'Amplitude decrease. ich the slower amplitude decrease starts. +55, The angle of secondary amplitude decrease. This will continue indefinitely unless off' occurs. — The final angle of amplitude decrease, after 'key off." al registers are: AS — Rate scaling, the degree to which envelopes become shorter as frequencies become higher. For example, high notes on a piano fade much more quickly than low notes. Genesis Sound Software Manual February 21, 1992 Page 8 • CONFIDENTIAL #229 PROPERTY OF SEGA AM — Amplitude Modulation enable, whether or not this operator will allow itself to be modified by the LFO. Changing the amplitude of the slots changes the loudness of the note; changing the amplitude of the other operators changes its flavor. SSG-EG — A proprietary register whose usage is unknown. It should be set to zero. The FM-2612 may be accessed from either the 68000 or the Z-80. In both cases, however, t bus is only 8 bits wide. The FM-2612 is accessed through memory locations 4000H - 4003H in the Z80 case, or A0400tH - A04003H in the 68000 case. These will be referred to as 4000 to 4003. The internal registers of the FM-2612 are divided as follows: PART I PART II 21H LF0 TIMERS KEY ON/OFF 2CH DAC 30H FM CHANNELS • 1-3 B6H To write to Part I, write the 8-bit address to 4000 and the data toI4001. To write to Part II, write the 8-bit address to 4002 and the data to 4003. Caution: Before writing, read from any address if the YM-2612 I/O is still busy from the last write. Delay until Bit 7 returns to Caution: In the case of regist `ganged together" to form a longer number — for example the 10-bit Tier A valu r the 14-bit frequencies — write the high register first. ( READ DATA: Readin y o%edlocations. D7 DO OVERFLOW BUSY A l B BWSY 1 if bu4r0 if ready for new data. OVERFLOW — 1 if the timer has counted up and overflowed. See Register 27H. Genesis Sound Software Manual Febtuary 21, 1992 Page 9 CONFIDENTIAL #229 PROPERTY OF SEGA 22H X X X X LFO EN PART I MEMORY MAP LFO FREQ • 24H TIMER A 25H X X X X X X TIMERA 26H TIMER B CH3 RESET ENABLE LOAD 27H MODE B AB A B A 28H OPERATOR X CHANNEL 2AH DAC DAC 30H CH1, OPT 2BH X X X X X X X EN 31 2, 01 32H 30H+ X DT1 MUL 'pH1, 0 40H+ X TL OP2 36H OP2 50H+ 60H+ C P3 70H+ C ,0P3 CH3, OP3 80H+ 90H+ X X X X CH OP4 3DH OP4 3EH OP4 Each of 30H-90H has twelve ntries, thr channels x four operators. Channels 1-3 become har,nets 4 - 6 in Part II. 'ART I MEMORY MAP (cont.) OH+ FREQ. NUM 41 A4H+ X X BLOCK FREQ. NUM CH 3 SUPPLEMENTARY FREQ. NUM CH3 SUPP X X CH 3 SUPP BLOCK FREQ NUM F30H+ X X FEEDBACK ALGORITHM B4H+ L R AlvIS X FMS Genesis Sound Software Manual February 21, 1992 Page 10 CONFIDENTIAL #229 PROPERTY OF SEGA Each of the above has three entries. All follow the pattern AOH CHI Al H CH2 A2H CH3 with the exception that ASH and ACH follow the pattern ASH CH3, OP2 A9H CH3, OP3 AAH CH3, OP4 'PART II' is a duplication of 30H-B4H, where channels 1-3 are replaced b The Registers: 22H • LEO FREQ LEO EN — 1 is enabled, 0 disabled., 0 1 2 6 7 Hz 3.98 5.56 46.624, 6.37 6.88 9.63 48.1 72.2 4-; The LEO (Low Frequency Oscillatqr) is used tistort the FM sounds' amplitude and phase. It is triply enabled, as there is: a global ena egister 22 a sensitivity able on a chenel by channel basis, in Registers B4H-B6H an amplitud enable on an Vperator by operator basis in Registers 60H-6EH. If the LFO;is dsirq, enable-it by gister 22H. Next, select which channels will be affected by the LEO, TO whatifegree, anti, er their amplitude or frequency is affected, by setting Registers -B6H. finally, if a channel's amplitude is affected, make sure that it is only the 'slots" that are affected b4Ong Registers 60H-6EH. 24H TIMER A MSBs TIMER 25H A LSBs Genesis Sound Software Manual February 21, 1992 Page 11 CONFIDENTIAL #229 PROPERTY OF SEGA Registers 24H and 25H are ganged together to form 10-bit TIMER A, with Register 25H containing the least significant bits. They should be set in the order 24H, 25H. The timer lasts 18* (1024 - TIMER) microseconds • TIMER A = all l's —181J5 = 0.108 ms TIMER A = all O's 8,400ps = 18.4 ms 26H TIMER B 8-bit TIMER B lasts 288 * (256 - TIMER B) microseconds TIMER B = all l's —0.288 ms TIMER B = all O's —)73.44 ms r- CH3 RESET ENABLE LOAD , 27H MODE B A w„, B • , Register 27H controls the software timers an e Channel 3 d 6 7ode, two entirely separate items. CH3 MODE D7 D6 NORMAL Channel 3 is the same as the others. SPECIAL Channel 3 has four separate frequencies. ILLEGAL A normal channel's Clq use o.ls of integral multiples of a single frequency. In SPECIAL mode, each oper has an 'rely separate frequency. Channel 3 operator l's frequency is in Registers A2 and a. Operato and 4 are in Registers A8 and AC, A9 and AD, and AA and AE, respectively. e imer feature, but the Japanese manual says: rts the timer, 0 stops it. 1 causes timer overflow to set the read register flag. 0 means the timer keeps cycling without setting the flag. writing a 1 clears the read register flag, writing a 0 has no effect. 28H OPERATOR Genesis Sound Software Manual February 21, 1992 CHANNEL Page 12 • CONFIDENTIAL #229 PROPERTY OF SEGA This register is used for `key on' and 'key off." 'Key on" is the depression of the synthesizer key. 'Key off' is its release. The sequence of operations is: set parameters, key on, wait, key off. When key off occurs, the FM channel stops its slow decline and starts the rapid decline specified by 'RR", the release rate. In a single write to Register 28H, one sets the status of all operators for a single channel. Sega always sets them to the same value, on (1) or off (0). Using a special channel 3, I believe it possible to have each operator be a separate note, so there is possible justification for turning them on and off separately. OPERATOR CHANNEL 4 1 3 1 2 1 1 D2 DI DO 0 0 0 Channel 1 0 0 1 2 0 1 0 3 1 0 0 Channel 4 1 0 1 5 1 1 0 6 • 2AH DAC DATA Register 2AH contains 8 bit DAC data. DAC 2BH X X X EN If the DAC enable is 1, the DAC data is outpu%s a replacement for channel 6. The only channel 6 register that affects the4411/4 C s t`-ie stereo output portion of Register B4H. A- Registers 30H-90H ,e4ePall single-operator registers. Please see page 8 for how the twelve channel- operator combinations are arranged. MUL th D1-14Detune aft MUL (multiple) relate the operator's frequency to the overall frequency. 0 to 15,0, and multiplies the overall frequency, with the exception that 0 results n multiplication by 1/2. That is, MUL = 0 to 15 gives x 1/2, x 1, x 2, ... x 15. De, s small variations from the overall frequency x MUL. The MSB of DT1 is a primitive sign bit, and the two LSBs are magnitude bits. See the next page for a diagram. Genesis Sound Software Manual February 21, 1992 Page 13 CONFIDENTIAL #229 PROPERTY OF SEGA D6 0 0 D5 0 0 D4 0 1 MULTIPLICATIVE EFFECT No change x (1 + E) • 0 1 0 x (1 + 2E) where E is a small number 0 1 1 x (1 + E) 1 0 0 No change 1 0 1 x (1 - E) 1 1 0 x (1 - 2E) 1 1 1 x (1 - 3E) 40H+ TL TL (total level) represents the envelope's highest amplitude, with 0 6ettig the largest and 12710 the smallest. A change of one unit is about 0.75 dB. To make a note softer, only change the TL of the Output ). Changing the other operators will affect the flavor of the note. 50H+ RS AR Register 50H contains RS (rate scaling) and attack 9). AR is the steepness of the initial amplitude rise, shown on page 4. AS affects AR, D1R, D2R an same way. RS is the degree to which the envelope becomes narrower as the fre ncy bec s high. 45/C1 Genesis Sound Software Manual February 21, 1992 Page 14 CONFIDENTIAL #229 PROPERTY OF SEGA • The frequency's top five bits (3 octave bits and 2 note bits) are called KC (key code) in the following rate formulas: RS=0 Final Rate = 2 Rate + (KC/8) RS=1 Final Rate = 2 Rate + (KC/4) RS=2 Final Rate = 2 Rate + (KC/2) RS=3 Final Rate = 2 * Rate + KC" " Always rounded down. As rate ranges from 0-31, this means that the RS influence ranges from small (at 0-3) to (at 0-31). 60H+ AM X X D1R D1R (first decay rate) is the initial step amplitude decay rate (see pa in value and affected by AS. AM is the amplitude modulation enable, whether or not iliaoprator will be Uect to amplitude modulation by the LFO. This bit is not relevant unles e LFO is enabled and Register B4 's S AMS (amplitude modulation sensitivity) is non-ze 70H+ X X X D2R D2R (secondary decay rate) is the Ion tailoff of the that continues as long as the key is depressed. This register is proprietar The final registers ate mostly a single channel. Each register is tripled; please see the diagram on page 9. A4H+ BLOCK FREQ NUM , A8H+ CH 3 SUPP FREQ NUM 'Or • ACH+ X X CH 3 SUPP BLOCK CH 3 SUPP FREQ NUM Genesis Sound Software Manual February 21, 1992 Page 15 CONFIDENTIAL #229 PROPERTY OF SEGA Channel l's frequency is in AO and A4H. Channel 2's frequency is in Al and A5H. Channel 3, if it is in normal mode (please see page 12) is in A2 and A6H. • If channel 3 is in special mode: Operator l's frequency is in A2 and A6H Operator 2's frequency is in A8 and ACH Operator 3's frequency is in A9 and ADH Operator 4's frequency is in AA and AEH. The frequency is a 14-bit number that should be set high byte, low byte (e.g., A4H th highest 3 bits, called the 'block," give the octave. The next 10 bits give position in the o and a possible 12-tone sequence is: 1 Low 617 653 692 733 777a11 in base 10 823 872 924 979 1037 1099 High 1164 This sequence should be used h octave. BOH+ X X FEEDBAC-f* ALGORITHM Feedback is the -rator 1 feeds back into itself. In the voice library, self feedback is repr The ALGO Aot is the e of inter-operator connection used. Please see the list of the eight opera n page 3.. - Os- B4H+ AMX FMS r B4H contains stereo output control and LFO sensitivity control. L — Left output, 1 is on, 0 is off R — Right output, 1 is on 0 is off Note: The stereo may only be heard by headphones. Genesis Sound Software Manual February 21, 1992 Page 16 CONFIDENTIAL #229 PROPERTY OF SEGA AMS (amplitude modulation sensitivity) and FMS (frequency modulation sensitivity) are the degree to which the channel is affected by the LFO. If the LFO is disabled, this register need not be set. Additionally, amplitude modulation is also enabled on an operator-by-operator level. AMS 0 1 2 3 dB 0 1.4 5.9 11.8 FMS 0 1 2 3 4 5 6 7 % of 0 13.4 ±6.7 ±10 ±14 ±20 ±40 ±80 a halftone TEST PROGRAM Here a tested power-on initialization and sample note in the °Grand Pianos Register Value Comments Register Value Comments 22H 0 LFO off 80H 11H 27H 0 Channel 3 mode normal 84H 11H rr Di uR '\ 28H 0 Off 88H 1401 28H 1 Off 8 6H 28H 2 Off , /. "90H 28H 28H 28H 4 5 6 Off Off Off r 94H 98H 9CH 0 0 0 , • oprietary 2BH 0 DAC off BOH 3 Feedback/Algorithm 30H 71H Both speakers on 34H ODH DT1/MUL 00H Key off 38H 33H i A4H 22H I Set frequency 3CH 01H 1 AOH 69H 1 40H 23H r 28H FOH Key on 44H 2DH 1 Total Level 48H 26H 28H 00H Key off 4CH 00H _ 50H 5FH , AL. Notes: 54H 99H RS/AR Write address then data. 58H 5FH Loop until read register D7 becomes 0. 5CH 94H ' Follow MSB/LSB sequence. 60H 64H • AM/D1R 68H .J 5 A*-- , 6CH 7 70H 2 74H M'''''— D2R 751-1 2 7CH 2 S Genesis Sound Software Manual February 21, 1992 Page 17 CONFIDENTIAL #229 PROPERTY OF SEGA Programmable Sound Generator (PSG) • The PSG contains four sound channels, consisting of three tone generators and a noise generator. Each of the four channels has an independent volume control (attenuator). The PSG is controll d through output port $7F. Tone Generator Frequency The frequency (pitch) of a tone generator is set by a 10-bit value. This value is cou it reaches zero, at which time the tone output toggles and the 10-bit value is reloaded intohe counter. Thus, higher 10-bit numbers produce lower frequencies. To load a new frequency value into one of the tone generators, u wriie a pair o I/0 location $7F according to the following format: First Byte: 1 R2 Al RO d3 d2 ._. T fiidO Second Byte: 0 0 d9 d• • d6 d v The R2:R1:RO field selects the tone channel R2 Al RO Tone Channel 0 0 0 #1 0 1 0 #2 1 0 0 #3 10-bit data is: (msb) d9 d7 d6 d3 d2 dl dO (Isb) Noise Generator The noise generator uses thrkl control bits to select the 'character* of the noise sound. A bit called °F13" Feed ) produces tiodic noises or `white' noise: f Ndise pe erio (like low-frequency tone) iss) Genesis Sound Software Manual February 21, 1992 Page 18 CONFIDENTIAL #229 PROPERTY OF SEGA The frequency of the noise is selected by two bits NFl:NFO according to the following table: NF1 NFO Noise Generator Clock Source 0 0 Clock/2 (higher pitch, "less coarse') 0 1 Clock/4 1 0 Clock/8 (lower pitch, 'more coarse') 1 1 Tone Generator #3 Note: 'Clock' is fixed in frequency. It is a crystal controlled oscillator signal connec the PSG. When NFl:NFO is 11, Tone Generator #3 supplies the noise clock source. This all to be 'swept' in frequency. This effect might be used for a jet engine runup, for e To load these noise generator control bits, write the following byte to I/O p Out ($7P): 1 1 1 0 0 FB NF1 • Attenuators Four noise attenuators adjust the volume of the ee tone gene 4tprs rYhe noise channel. Four bits A3:A2:A1 :AO control the attenutation as fG4ows: A3 A2 Al AO Attenuation 0 0 0 0 0 db (maximum vo 0 0 0 1 2 db Note: a higher attenuation results in a quieter sound 0 0 1 0 4d 0 0 1 1 6 0 1 0 0 8b 0 1 0 1 10db 0 1 1 12d 0 1 1 • 1 1 0 0 0 1 1 0 0 1 113 db 1 9 20 db 1 01 1 lb 1 1 0 0 4 db 1 1 0 1 26 db 20' 0 28 db 1 1 -Off- Genesis Sound Software Manual Febniary 21, 1992 Page 19 CONFIDENTIAL #229 PROPERTY OF SEGA The attenuators are set for the four channels by writing the following bytes to I/O location $7F: Tone Generator #1: 1 0 0 1 A3 A2 Al AO Tone Generator #2: 1 0 1 1 A3 A2 Al AO Tone Generator #3: 1 1 0 1 A3 A2 Al AO Noise Generator: 1 1 1 1 A3 A2 Al AO EXAMPLE When the Mk3 is powered on, the following code is executed: LD HL,CLRTB ; clear table LD C,PSG_PRT ; psg port is $7F LD B,4 ; load four bytes OTIR (etc.) CLRTB defb $9F, $BF, $DF, $FF This code turns the four sound channels off. PAUSE button is pressed, so that the sound also execute this code when the ntinuously for the pause interval. • Genesis Sound Software Manual S February 21, 1992 Page 20 CONFIDENTIAL #229 PROPERTY OF SEGA GENESIS SOFT DEVELOP • 9. JUL 1991 REVISION SEGA ENTERPRISES. LTD. VER2.0 CONFIDENTIAL #229 PROPERTY OF SEGA • • CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* CONTENTS 1 . REQUIRED ITEMS TO SET UP THE GENESIS § 1 CARTRIDGE 1 § 2 INITIAL PROGRAM 2 § 3 INDICATION OF EXTERNAL RAM INFORMATION § 4 INDICATION OF ID MODEM INFORMATION § 5 CHECK SUM VDP SETUP DATA 6 SETTINGS TO PRESERVE COMPATIBILITY DURING GENESIS DEVELOPMENT , •• 68000 COMMANDS AND PERIPHERAL DEVICES § 1 VDP AND 68000 COMMANDS § 2 JOYSTICK AND PERIPHERAL DEVICES 0 ID codes 0 9 Periphral devices 0 9 0 JOY PAD 0 • 10 12 5. PRECAUTIONS FOR SOFTWARE DEVELOP 14 § 1 Z80 CANNOT PROPERLY ACCES E BUS 0 14 § 2 H_INT AND V_INT ARE USED GENESIS PROGRAMS' 15 § 3 TROUBLES DUE TO INTERRUP URING C ICATION ••• 16 § 4 PRECAUTIONS WHEN THE CONTRO SCREENS ARE USED 17 § 5 OTHER PRECAUTIONS 40Precautions for tI1.rprogra. and Z80 bus requests 17 410Precautions for øund ac s ••• 17 40When the reset !button is p sed repeatedly 18 ()Notes on the control pad and read-programs 18 •• 19 6. NOTES ON 'DRIVE VERSION ••• 20 §1 PAL OPAL 20 20 4110ifferen es in development of MEGA DRIVE software and precautions.•• • 20 § 2 -CELL MODE. 21 / NOTES ON tHE BA6KW RAMs ••• 22 VER2.0 1991/07/10 CONFIDENTIAL #229 PROPERTY OF SEGA • CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* OUIREDITERST. .GENESIS §1 CARTRIDGE The following data (hereafter ID) must always be entered from the address 100H. 10011 'SEGA MEGA DRIVE' : 1 110H '(C)SEGA 1991.MAR' : 2 120H 'GAME NAME FOR DOMESTIC USE' : 3 15011 'GAME NAME FOR OVERSEAS USE' : 4 180H 'GM XXXXXXXX-XX' : 5 18EH $XXXX : 6 19011 CONTROL DATA : 7 1AOH $800000,$XXXXXX : 8 1A8H $FF0000.$FFFFFF : 9 1B0H EXTERNAL RAM INFORMATION :10 1BCH MODEM INFORMATION :11 1C8H INHIBITED TO BE USED :12 1FOH COUNTRY NAME :13 OlDescriptions on the above items Hardware name : 'SEGA MEGA DRIVE' or 'SEGA GENESIS* A company name of four characters long mpan (C) SEGA when made or ordered by ed after (C). (C) T-XX(company code) when made a third party. 3. A domestic game name is entered (shifter JIS kanji however, the name should be entered wit s many racter codes can be used; I characters as possible). A overseas game name is entered (shifted JI nji character codes can be used; however, the name should be entOked with as many ASCII charact ers as possible). 5.Type of the cartridge, produo, numbe nd version number. Cartridge type : GM for game Al for education Product number : ique‘'umber-f or each game Version nu ould be increased when the product is upgraded. Check sum (see cteck sum') Information on sub MARK, y S1 : o GENE S Joy Stick 7 J KeY4dard : K Serial (RS232) : R Printer : P Tablet -11.` " :T Track, ball :8 Paddt controller : V FDD. : F : C Analog Joy Stick : A [ 1 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA 'GENESIS MANUAL' 8. ROM capacity : Start address,End address **Example Start address End address 2M : $000000 $03FFFF 4M : $000000 $07FFFF 8M : $000000 $0FFFFF RAM capacity (fixed) from $FF0000 to $FFFFFF External RAM information (see below) Modem information (see below) Inhibited to be used ( filled with spaces) Country name Japan : J USA : U Europe : E *Note* Blank addresses must always be filled with Spaces . 0 The data must be entered carefully, since the product is checked. be used when the 0 The ID data and the initial progra process (see *2 Initial program' during the check sample §2 INITIAL PROGRAM - - The initial program (see ICD B 4.PRG, in tTisample progra m disc) must always be stored in every product, in order to s every product to the same status powered on, and to execute t when the GENESIS is are security process and other required processes which must be performed at t reset 9. This program must always b lliput as, is. starting with program start. _Bemenber that aUY Product cannot be r leaked. if its Initial Program is moditj starting with program ed or if it is not input A [ 2 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUALS • 18011 : dc.b 164N : dc.1 41 x 3 INDICATION OF EXTERNAL RAM INFORMATION 'RA',I1x1yz000.Xabcdefgh Start address,End address : Data preservation 1 ... Non-volatile Backup. EEPROM, etc. where data will not b destroyed even if the power is turned off. 0 ... Volatile Data will be lost when the power is tur yz : Data size 10 .... Even byte (015 to 08) 11 .... Odd byte ( 07 to 09) 00 .... Word 01 .... Others (EEPROMs which are serially accessed, data bus, etc.) (1) abc : Device type 900 001 ... SRAM 010 ... EEPROM 911 190 191 119 • 111 defgh : Spare which is filled vitt *Start addrss,End address Addresses where RAMs are installed or ar OIndication examples0 () 8k byte backup RAM cartr SRAM backup memory Odd bytes only 8k byte capacity, Addresses $20 $203FfF- dc.b 'RA' ,%11111008,180000 dc.1 $200001.$203FFF Jr-1 0 EEPROM cartridge (for ea) . Since the EEPROM formodeJscccessed serially, the data I,jta preservation!fits into '1' since data in EEPROMs size fits into 'others.' will not be destroyed when the et " s turned off. The address is set to $200001 for the control ports. + tEPROM memory i°'-+ Serial access lk bit capacity (128 x 8) ;A4dresses$2000013200001 dc.b 'RA' .%11101000,%01000000 dc.1 $2000013200001 3 1 VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* § INDICATION OF ID MODEM INFORMATION 16CH: 'MO' ,'company name'.'xx,y','zz' 40 Company name : Same as the company name or code which is entered from 110H. xx : Game number (if this number is the same, communicat ion can be *for d) 80 TELTEL stadium 01 TELTEL majong 02 MEGA answer 83 SEGA NET GAME Y : Version No. - zz : Modem information 88 Japan only : No microphone installed 18 Japan only : Microphone installed 20 Overseas only : No microphone inttall 30 Overseas only : Microphone installed. 48 Common to Japan and overseas : No. miçrophone 58 installed Common to Japan and overseas :$jcropbore i 4led 60 No microphone installed for J microphone installed for ov 70 Microphone installed no microphone ins 88 90 40Indication examples* 0) If SEGA released a base ball a microphone, then the modem information is like this. 0 After that, TOTO (third rty with company code of 1-81) released the software with a microphone for 'xyz' onl which can communicate with '0 abcde'. Then the modem infor s: -01','08,1'.'18' xx is common. but ber in y is changed. Since xx, i ion indicates that 0) and 0 can communicate each other. that ie mber and the version number are managed by SEGA of JAPAN. [4] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* • f.5 CHECK SUM The program to examine the check sum is given below. The the RAM space. First fill the space to be used for this game with -1 program starts at OFF8000H in (OFFH), and then load all the programs. After this, load this program (including the check sum program), and start it at OFF8000H. Wait a while and stop the program. The check sum value is stored inte lower word of data register 0 (d0). It is a good idea to release the break poi ts memory. The space to be used for the game must also be filled with -1 (OFFH) before t are stored in the ROM. end_addr equ $1a4 org -$8000 start: lea end_addr,a0 move.1 (a0),d1 addq.1 $$1,d1 movea.1 0$200.a0 sub.1 a0,d1 asr.1 $1,d1 move d1,d2 subq.w $$1,d2 swap d1 moveq 1$0.0 ?12: add (a0)+,d0 dbra d2.?12 dbra d1,?12 , flop flop flop .flop flop flop flop [ 51 VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA R 0 0 0 0 0 1 0 0 1 0 0 1 0 2 0 0 0 0 0 3 0 0 0 4 0 0 0 0 0 5 0 6 0 0 0 0 0 0 0 0 A 7 0 0 4 8 0 0 0 0 0 0 0 " 9 0 0 0 0 0 10 1 0 0 0 0 0 12 1 0 0 0 1 13 0 0 14 0 0 0 0 0 0 0 15 16 0 0 0 17 0 0 18 19 I•••••• ( 6 ) CONFIDENTIAL #229 PROPERffl& 6`)R" *GENESIS MANUAL* . fr . TTIH&SQPRESERVEC HPATIBILITY D•URING GEI4ESIS. . I1 mode on the 68000 side (also applies to ER-ICE, 178 and 378) 0) Cartridge in use MA 0000000,OFFFFFF=NO (No Memory is assigned for all areas) MA 0000000.007FFFF=US (Only required portion of the DRAM area is MA 0A00000.0A01FFF=US (180 S-RAM area) assigne MA 0A04000,0A04FFF=US (FM sound source area) MA 0A10000.0A11FFF=US (I/O and 180 control) MA 0C00000,000OFFF=US (VDP and sound control) MA OFF0000,OFFFFFF=US (work RAM area) (Note] When the write protect function is used on the DRAM board, need to be conducted. following steps STEP 1. HA 0A13000,0A13FFF=US E 0A130F0=XXXX ( Setting up or r easing MA 0A13000,0A13FFF=NO It is easier to defined a macro by conducting the abov -12 mode on the Z80 side (also applies to 178, 278 • MA 00000,0FFFF=NO (No memory is as MA 00000,01FFF=US (180 SRAM area MA 04000,043FF=US (Ym2612 area) MA 06000,063FF=US (bank registe MA 07C00,07FFF=US (PSG on the V MA 08009,OFFFF=US (68000 memory • [ 7 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* oo0ø COMMANDS. AN13 PERIPItERAL OEVtCt • §1 VDP AND 68000 COMMANDS The TAS command is not supported on the GENESIS. The TAS comman up the byte operands which are assigned by the effective addres d serves to tes and set is issued, the test is executed and completed, but the settin s fields. If th o nd written. g will be ignored an. be When VRAM access is made, reading in the write mode or writin be executed. g in the read cannot If and attempt is made to read in the write mode when VRAM acces VDP suspends the 68000 (the VDP will not return ()TACK to the 68 ) If an attempt is made to write in the read mode when VRAM address for the VRAM access is only increased, but no da ces s perfo d, the e VRAM. For these reasons, the following commands cannot be usekto WRAC Example: CLR command The CLR command attempts to write 0 after reading the 68900, since the read access occurs when the wr ry. The VDP suspends e to the VRAM. ** otheres ** CLR. NBCD, MEG, NEGX, NOT, Scc, TAS, ( BUG. BSET, BCLR. )bit handling comman ASR, ASL, LSR, LSL, ROR, ROL, ROXR, RD CNPI, EORI, ORI, SUBI, SUBQ (immediate tate commands), ADDI. ADDO, ANDI, ( The above commands cannot be used to a s the are made to a single destination in these , since read and write operations ( 8 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS, MANUAL* • 2 JOYSTICK AND PERIPHERAL DEVICES In addition to the joy stick, various peripheral port. Since such devices have their own ID codes devices can be connected to the I/O connected to the I/O port by examining their ID , the CPU can judge which devices are codes. However, remember that some peripheral devices of the MARK III & MS cannot be known by this method. <> ID codes <> • The ID code is expressed by the OR sum logic of DATA 1, 2 and 3, P03, P02, PO which correspond to the external pins, CTRL1. CTRL2 and EXT in the I/O port. -value is expressed in the following way by data output, provided that the TH pin is set in the when 1 is output and by data output mode. ID3 = (P06 = 1) AND (P03 OR P02) IO2 = (P06 = 1) AND (P01 OR PDO) I01 = (PD6 = 0) AND (P03 OR P02) IDO = (P06 = 0) AND (P01 OR POO) The relationships between the ID code and the peripheral device Jn below. Device name ID3 I Old joy stick (2TRIG) ID1 , 0 • 1 1 ($F) Not defined - 1 1 1 0 New joy stick (3TRIG) •• ($E) SEGA RESERVED 1 ($D) • Not defined 0 ($C) SEGA RESERVED ,1 1 ($a) Not defined 1 0 ($A) Not defined 0 1 ($9) Not defined 0 0 ($8) Not defined 1 1 1 ($7) SEGA RESERVED 1 1 0 ($6) Not defined 1 0 1 ($6) Not defined 0 1 0 0 ($4) Not defined 0 0 1 1 ($3) Not defined 0 0 1 0 ($2) SEGA RESERVED 0 0 0 1 ($1) 0 0 0 e ($0) [ 9) VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* Periphral devices 0 41 ID = SF : Old joy stick The standard joy stick of MARK III & MS contains the 4-dire ction switch and A and B triggers. Each switch is configured as shown below, which is set to 0 when it is pressed. CTRL1 CTRL2 EXT. • CTRL $A10009 $A1000B $A1000D DATA $A10003 $A10005 $A10007 P07 P06 PDS PO4 P03 PO2 P01 POO CTRL 0 0 0 0 0 0 0 k0 DATA TB TA CONFIDENTIAL #229 [ lo PROPERTypfosfgt/09 *GENESIS MANUAL* • 0 ID = $0 : New joy stick The joy stick of the GENESIS contains the 4-directio Start. The mode can be changed by setting 0 or 1 after the n switch. A. B and C triggers and Each switch is configured as shown below, which is TB pin is set in the output mode. set to o when it is pressed. CTRL1 CTRL2 EXT. CTRL $A10009 $A1000B $A1000D DATA $A10003 $A10005 $A10007 P07 P06 P05 PO4 P03 P02 P01 PO CTRL TH=1 DATA 1 TC TB TH=0 DATA 0 ST TA (TN) • TC It takes about lgsec febm th# time t TN is (corresponding to the changed until the data is fixed se tin o NOP commands). Example: The time difference from the time when value appears at 1314 of DATA. the TH is changed until the switch TH .wa DATA (P.4) TB' TA —TB-- A A 1 psec lusec ( 11 ) VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA - *GENESIS MANUAL* 0 JOY PAD 0 Player's button operations are recognized by reading data I/O addresses via CONTROL1 and CONTROL2. 7 bits of 05 CONTROL1 and CONTROL2. but there are eight buttons. So, bit, and the button operation is read in two steps. in $A10003 and $A10005 of the to DO in the I/O are sent to the 05 bit is used as the select • * * SAMPLE PROGRAM * * MOVE.8 11$40,$A10009 Enter 05 to DO of CONTROL1. 06 is set to output (select bit). , MOVE.13 #$40,$A10003 1 is output to 06 (C. 8, right, left4Hipwn or up is selected). HOP HOP MOVE.B $A10083,DO D5 to DO values are read into register DO. MOVE.6 11$00,$A10003 8 is output to 06 (start, A. down or up is selected). HOP 'VP HOP MOVE.B SA10003.01 1 _ tkoteg 05 to- DO values aq reemvI ver ister Dl. X Each button outputs when it is p 4sed. i Register values after the program is exec DATA REG NC 157 logic 7 6 5 4 Input Output 0 1 REGISTER bu bu DO SG Yx tt tt X 1 - - 0 0 Ax 0 0 REGISTER bu 0 D1 1 0 Bx A t • [ 12 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* Joy Pad and GENESIS • PULL UP D6 AO S YO PULL UP Al Y1 A2 Y2 A3 Y3 HC157 1_ BO 81 82 83 - SW SW SW SW SW SW SW SW START A B C RIGHT LEFT DOWN UP ad,i rcuilv III III! Y-PAD MEM MN WU 13 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA T, *GENESIS MANUAL* CAUTIONS VELOPM §1 Z80 CANNOT PROPERLY ACCESS THE BUS ON THE 68000. When the 180 tries to enter the bus cycles of the 68000 on the 68000, and when the access to $A100xx is made in to read/write a specifig address the 68099's bus cycle isoleataftly before the bus cycle which the 180 tries to enter, the become too short to read/write data properly. cylce of the 180's en may, 68900's Other bus 180's bus Comman Measure...When the 68000 accesses SA100x ®Send BUSREQ to the 180 (suspend the ®Access $A100xx. 11100 = 019011) ®Release the BUSREQ of the 180 (the access....$A11100 = 000011). Modify the program to execute the above Note: it will be no problem if °gram is designed to be synchronized with V_INT, etc. to eliminate a bad timing for the i. access. 180s bus [ 14 ] VER 2.0 1951L07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* • 2 H_INT AND V_INT ARE USED IN GENESIS PROGRAMS II When 1E1 = 1 and 110 = 00H are set for VDP timings below. Care is required for the timing register SO. H_INT and V_INT occur at the next V_INT occurs in only 14.7Aisec. If the receiof H_INT at No.224. in which case, the the opportunity of the V_INT occurrence is misse pt of H_INT at No.224 is prolonged and d. that V_INT is canceled. Once the V_INT is caceled. H_INT occurs at No.225 instead of V_INT. 0 1 2 3 222H(DEH) 223H(DFH) 224H PEI 1H -INT 1H-INT H-INT , 14= 63.7s 14.7ps Measure A . ®Before H_INT at No 223 is completed, setIE0 suppress the next occurrence at No.224. = 0 for rests r 11 to , 4D8efore the receipt of V_INT is complet k make H_INT effective (No.224 also be E0 = 1 fi register Si to ©Receive H_INT at No.224. Measure 8 OBefore H_INT at No.223 is receive No.224. for the 68000 not to (Before the receipt of .V I I is compl tpd. r rn SR of the 68008 to the previous value (so that o.224 can be teceived). ©Receive H_INT at No.224. *Don't give damages to the flag when you are j dling SR. 41The case which was known to cause troubles ultiplication) TPT.i NO.224 IPL2 ® 6 MAIN PROGRAM NO.225 M 1M I N Mult lication H H -INT is processed. 0 0 U is#iecuted 0 1V V 4 V IR E E S E H-INT is effective 11=1NT is effective After he multiplication, the 68000 decides to The 680 receive H_INT by means of MOVE. nerates VPA (INT-ACK). (No.224 is received.) The VI)13 cannot find the VPA after the H_INT occur treated as 'un-processed.* The VPA is received rence, and so the H INT is This receipt is assumed that V_INT has been receiafter the occurrence Of V_INT. • e H_INT at No.224 was received in ®,the proce ved and the H_INT is preserved. ®The 68000 decides to receive H_INT again after ssing is executed. occurrence of RTE. the H_INT is proccessed at the The 68000 generates VPA (t nT=A-Ci(). The VOP assumes that the VPA is the H_INT, and proccesses it (at No.225). preserved ©H_INT (at No.225) is received in CO, and the process is executed again. [ 15 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* 3 TROUBLES DUE TO INTERRUPTS DURING COMMUNICATION The similar troubles to 'H_INT and V_INT are used' (see section 2) occur in: 'H_INT and INT during data communication', and 'V_INT and INT during data communication'. • Since 'INT during data communication occurs asynchrono the measures differ from those described in secti usly with V_INT and H_INT, on 2. Measure for a) 0 INT and the receive flag are simultaneously set when The receive flag is cleared when received data is read data communication sti receipt' which does not overlap with H_INT. If it by means of 'INT duni overl treated as the second 'INT during data receipt', the aps ,with H_INT and this T is Hence, the proper measure should be selected by usingrecei ve flag rema• d. judge whether it is treated as 'INT during data recei the status of receive flag o pt' or 'data re9e1ve INT'. Measure for b) Set the mode in which V_INT does not occur and execu V_INT by detecting the V timing using the V_1311 bit the 1 e treat that of for ()Others() The timing for H_INT or V_INT can be judged by us' The receive flag can be used to judge whethe HV_counter, etc. data receipt as which H or V is treated' ipt* or 'INT during • judged by combing IEO, TEl and 1E2 in th measures should be • [ 16 ] VER 2,_019.91/Q7/ CONFIDENTIAL #229 PROPERTY OF SEGA (19 *GENESIS MANUAL* • 4. PRECAUTIONS WHEN THE CONTROL A AND B SCREENS ARE When vertical 2-cell-unit scroll and horizontal USED up to 15 dots at the left otpe screen cannot be scroll are used together, remember that verti not a multiple of 16 (i.e., 1 to 15. 17 to 31, etc.) cally scrolled if a number which is quantity. is assigned for the horizontal scroll 4- Horizontal scroll quantity : 16n+m *When the horizontal scroll qu ni(1--15dot) (16-1) (11;m-S15) is set, the vertical quantity becomes unkown in the -> m-columns. -> •••• XReason - When the horizontal scroll quanti = 16n+m(1gici 15) ' set on the A or B screen, 21 words d to d in the RAM ftw- the ert setting. But the actoal the RAH is only 20 wQrds. 2ce11 2cell 2ce11'r Unkown vertical scroll qu ntity 41 , S OTHER PRECAUTIONS 40Precautions for the main fograa Care is required for the following items(Z80 bus requests area is aacessed. the main routine on the 68008 when the Z80 equelt is sent to the Z80. gement signal is checked. interr s achieved. bu requt is released within INT. (for example, for reading the control pad, etc.) ST11 us request is released within INT. . peration returns to the main routine. !The data is written in the Z80 area. m However, the me is usually locked with a bus reque / released in (5). st, but it has been • Hence, the following troubles may occur. RAMs of the Z80 may be broken. Wrong data may be read when a Z80 bank is accessed. )19leasure)K The interrupt is set to be disabled befor_ e step (1) is executed. [ 17 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS. MANUAL* *Precautions for sound access ®Sound stops during game play. *Cause and measure When the busy flag of status data of the FM sound source (YM2612) is read. (CS,RO,WR,A1,A8)=(0,8,1.0,1) • has been set (the address 488111 of the MEGA drive However, no provisions are given to the output is accessed). of the YM2612 under t conditions. It happens that not busy' is set and adta is successfu XMeasure When the busy flag of the FM sound is read, any address other 408811 address in the MEGA drive must not be acces sed. *When the reset button is pressed repeatedly 0Software runs away when the reset button is p *Cause and measure Pressing the reset button resets the CPU, When the reset button is pressed while DM DMA. ,e VDP continues the If the VDP is performing DMA w resetting, this access is ign immediately after *Measure* Before accessing the VDP after the status register. If DMA is ram (ICD_BLK4), check 'DMA busy' in ccess is made. ®The software still runs way in some cases even if the above measure is taken. *Cause and measure Such troubles can occur, if re tting is made from for executing DMA by the CPU is terminated until the time when the parametter set the first DMA starts. •••••••=mmo• Comma WR VDP Comm WR YtIP Comm WR VDP Comm nd _121 a.WR DMA Comma WR DMA nd.1- 122f nd 123 nd ADD(L) nd ADD(H) *Mea reX Although it is very rare for such troub to occur, ta e the measure of 0 and les BR anotr ap. priate measure of, for example DMA immediately after reset. BGACK Trouble occurs if the system is reset during this interval. [ 18 ] VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* *Notes on the control pad and read-programs The control pad\is designed and manufactured in such a way that the up and down signals or the left and right signals are entered simultaneo usly. However, they can rarely be entered simultaneously, when the internalrubber is aged too much or strong forces exceeding the designed tolerance level are appli ed. So, design the software not to accept such simultaneous signals. a revision of the Manual Regarding the access to VRAM. SRAM, VSRAM, please disregard the statement in t that you can implement byte access. You can only implement word access and lo access. [ 19 ) VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* T • •. R0PEVERS'I § 1 PAL OPAL ()The vertical size is increased by two cells. ()Intervals between interrupts are increased (16ms ec to 20msec). 11Differences in development of MEGA DRIVE software ()The vertical 30-cell mode can be used. and precautions. ()Since the color change appears at the bottom of the entering the V-interrupt, and then change the color screen, wait ()Since every operation goes slow when synchronized . . in and rates so that motions on the screen appear naturinterrupts, adjust movements ()When sounds are produced in synchronization with ally. increased. The PAL data table is required. interrup.he ds to be ()When sounds are produced by the FM timer, no modif required. ications far %C or PAL are [ 20 ] CONFIDENTIAL #229 PROPERW bst IMA09 *GENESIS MANUAL* 2 VERTICAL 30-CELL MODE 1.When the vertical 28-cell mode is changed to the vertic al 30-cell mode on PAL, the 30-cell mode displays all the cells which have been displa yed in the 28-cell mode and the two cells at the bottom which have not been displa yed in the 28-cell modes. 2.The 28-cell mode does not display one cell each at the top and the bottom; the 30-cell mode displays the entire screen. 3.The V-blank period is about 5.6 msec in the 28-cell mode; it is about 4.6 mse (shorter) in the 30-cell mode 'approximately same as that on RISC). 4.By developing software in awareness given to the PAL 30-cel l mode, the soft which is common to NTSC and PAL and has minimized border part can easily be developed. even in the PAL 28-cell mode 30-cell m Un-displayed area • ....• @Scroll size 64 x 64 (V-scroll quan 0 in e horizontal 40-cell mode) 4 0 Cell unit 30 28 When the 28-cell mode is changed to the 30-cell mode, characters written in this 32 table are displayed as they are. 32 When vertical scrolling is performed continuously (e.g.,, games played with vertical scr 410 oiling), it is delieved that there will be no problem even to the 30-cell mode. if the 28-cell mode is changed [ 21) VER 2.0 1991/07/09 CONFIDENTIAL #229 PROPERTY OF SEGA *GENESIS MANUAL* 1HEBAC1(UP There are two types of backp RAMs: 0 Odd addresses in 280000H--203FFFH- -64k bits C) Odd addresses in 200000H--2OFFFFH- -256k bits The same access methods as those for the work RAMs are used. + However, care is required for the following points. fr 0 Data (initial values) in the backup RAM is not known when the is shipped. The initialization must always be executed when cartridge (product) on. (In many cases, they are cleared to $FF when shipped the power is ed butithis-cannot-apply for-all (cases.) from the,jactory, 0 Data in the backup RAMs may rarely be destroyed. For this reaspn, the da must always be check and reproduced. Any important data must word (in the first address) and last word (in the last a n be tored in r e first' high possibility that data in these word may destiyed. e is a • ( 22 CONFIDENTIAL #229 PROPERff b*tVge