GENESIS Technical OverviewCONFIDENTIAL PROPERTY OF SEGA 68000 @8 MHz
VDP (Video Display Processor)
Z80 @4 MHz
VIDEO:
COLOR:
OTHER:
SOUND:
HARDWARE:
******* INDEX *******
1. MEMORY MAP § 1 MEGA DRIVE 16 BIT MODE (AS DISTINCT FROM MASTER SYSTEM COMPATIBILITY MODE) _ 68K MEMORY MAP _
_ Z80 MEMORY MAP _
_ 68000 ACCESS TO Z80 MEMORY _ _ I/O AREA _
_ CONTROL AREA _
_ VDP AREA _
2. VDP 315 - 5313 (Video Display Processor) The VDP controls screen display. VDP has graphic modes IV and V. Where Mode IV is for compatibility with the MASTER SYSTEM and V is for the new Mega drive functions. There are no advantages to using mode IV. so it is assumed that all Mega drive development will use mode V. In Mode V. the VDP display has 4 planes: SPRITE, SCROLL A/WINDOW, SCROLL B, and BACKGROUND. GRAPHIC IV MODE (COMPATIBILITY MODE)
GRAPHIC V MODE (16 BIT MODE)
_ TERMINOLOGY _ 1. A unit of Position on X Y coordinates is called a "DOT". 2. A minimum unit of display is called a "PIXEL". 3. "CELL" means an 8 (pixel) x 8 (pixel) pattern. 4. SCROLL indicated a repositionable screen-spanning play field. 5. CPU usually indicates the 68000. 6. VDP stands for Video Display Processor. 7. CTRL stands for Control. 8. VRAM stands for VDP RAM, the 64K bytes area of RAM accessible only through the VDP. 9. CRAM stands for Color RAM, 64 9 bit words inside the VDP chip. 10. VSRAM stands for vertical Scroll RAM. 40 10-bit words inside the VDP chip. 11. DMA stands for Direct Memory Access, the process by which the VDP performs high speed fills or memory copies. 12. PSG stands for Programmable sound Generator. A class of low-capability Sound chips. The Mega drive contains a Texas Instruments 76489 PSG chip. 13. FM stands for Frequency Modulation, a class of high-capability sound chip. The Mega drive contains a Yamaha 2612 FM chip. § 1 DISPLAY SPECIFICATION DISPLAY SPECIFICATION OUTLINE
For PAL (the European Television 50HZ standard), a vertical size of 30 cells (240 dots) is selectable. The VDP supports both NTSC and PAL television standards. In both cases, the screen is divided into active scan, where the picture is displayed, and vertical retrace (or vertical blanking) where the monitor prepares for the next display.
Numbers of rasters in a screen are as follows:
§2 VDP STRUCTURE The CPU controls the VDP by special I/O memory locations. _ CTRL (Control) _ This controls REGISTER, VRAM, CRAM, VSRAM, DMA DISPLAY, etc. _ VRAM (VDP RAM) _ General purpose storage area for display data. _ CRAM (COLOR RAM) _ 64 colors divided into 4 palettes of 16 colors each. _ VSRAM (Vertical scroll RAM) _ Up to 20 different vertical scroll values each for scrolling play fields A and B. _ DMA (Direct Memory Access) _ The VDP may move data at high speed from CPU memory to VRAM, CRAM, and VSRAM instead of the CPU, by taking the 68000 off the bus and doing DMA itself. The VDP can also fill the VRAM with a constant, or copy from VRAM to VRAM without disturbing the 68000.
§ 3 INTERRUPT There are three interrupts: Vertical, Horizontal, and External. You can control each interrupt by the IE0, IE1, and IE2 bits in the VDP registers. The interrupts use the AUTO-VECTOR mode of the 68000 and are at levels 6, 4, and 2 respectively. The level 6 vertical interrupt having the highest priority.
_ VERTICAL INTERRUPT (V-INT) _ The vertical interrupt occurs just after V retrace.
_ HORIZONTAL INTERRUPT (H-INT) _ The horizontal interrupt occurs just before H retrace.
The VDP loads the required display information, including all required register values, for the line in about 36 clocks, thus the CPU can control the display of the next line but not the line on which the interrupt occurs.
The horizontal interrupt is controlled by a line counter in register #10. If this line counter is changed at each interrupt, the desired spacing of interrupts may be achieved.
_ EXTERNAL INTERRUPT (EX-INT) _ The external interrupt is generated by a peripheral device (gun, modem) and stops the counter for later examination by the CPU.
Please see other sections of this manual for information about the H, V counter and the initialization of the external interrupt. § 4 VDP PORT The VDP ports are at location $C00000 in the 68000 memory space.
_ $ C00000 (DATA PORT) _ READ/WRITE: VRAM, VSRAM, CRAM
_ $ C00004 (CONTROL PORT) _ READ : STATUS REGISTER
* NO USE
WRITE1 : REGISTER SET
* You must use word or long word access to VDP ports when setting the registers. Long word access is equivalent to two word accesses, with D31-D16 written first. WRITE2 : ADDRESS SET
* You must use word or long word when performing these operations. _ $ C00008 (HV Counter) _ NON INTERLACE MODE
INTERLACE MODE
§ 4 VDP REGISTER VDP has write only register #0 through #23 and read only status register total 25 register. These are two modes for register settings. One is mode 4 and another is mode 5. We tell you about mode 5 in this section and about mode 4 see MARK section. If you change mode in one frame you can get various effects. MODE SET REGISTER No. 1
MODE SET REGISTER No. 2
PATTERN NAME TABLE BASE ADDRESS FOR SCROLL A
VRAM ADDR $XXX0_0000_0000_0000 PATTERN NAME TABLE BASE ADDRESS FOR WINDOW
WD11 should be 0 in H40 cell mode VRAM ADDR $ XXXX_X000_0000_0000 (H 32 cell mode) VRAM ADDR $ XXXX_0000_0000_0000 (H 40 cell mode) PATTERN NAME TABLE BASE ADDRESS FOR SCROLL B
VRAM ADDR $XXX0_0000_0000_0000 SPRITE ATTRIBUTE TABLE BASE ADDRESS
AT9 should be 0 in H 40 cell mode VRAM ADDR $XXXX_XXX0_0000_0000 ( 32 cell ) VRAM ADDR $XXXX_XX00_0000_0000 ( 40 cell )
BACKGROUND COLOR
CPT1,0 : COLOR PALLET COL3 ~ 0 : COLOR CODE
H INTERRUPT REGISTER
This register makes H interrupt timing by number of Raster H interrupt is enabled by IE=1 MODE SET REGISTER No. 3
IE2 1: Enable external interrupt (68000 Level 2) 0: Disable external interrupt * See INTERRUPT and SYSTEM I/O VSCR: V scroll mode HSCR, LSCR: H scroll mode
* BOTH SCROLL A AND B MODE SET REGISTER No. 4
H SCROLL DATA TABLE BASE ADDRESS
VRAM ADDR $XXXX_XX00_0000_0000
AUTO INCREMENT DATA This register controls bias number of increment data.
INC7 ~ 0: Bias number ( 0 ~ $FF ) This number is added automatically after ram access. SCROLL SIZE
* Both of scroll A and B WINDOW H POSITION
WINDOW V POSITION
DMA LENGTH COUNTER LOW
DMA LENGTH COUNTER HIGH
LG15 ~ 0: DMA LENGTH COUNTER DMA SOURCE ADDRESS LOW
DMA SOURCE ADDRESS MID
DMA SOURCE ADDRESS HIGH
SA22 ~ 1 : DMA Source address DMD1, 0 : DMA MODE
§ 6 ACCESS VDP RAM _ RAM ADDRESS SETTING _ You can access VRAM CRAM and VSRAM after writing 32 bits of control data to $C00004 or $C00006. You have to use word or long word when addressing. If you use long word D31 - D16 is 1st, D15 - D0 2nd.
CD5 ~ CD0 : ID CODE A15 ~ A0 : DESTINATION RAM ADDRESS
_ VRAM ACCESS _ VRAM address range from 0 to 0FFFFH, 64K bytes total. VRAM access addressing is as follow when writing:
A15 ~ A0 : VRAM address
D15 ~ D0 : VRAM data When you use long word D31 ~ D16 is 1st. D15 ~ D0 2nd. When you do byte writing, data is D7 ~ D0, and may be written to $C00000 or $C00001. VRAM address is increased by the value of REGISTER # 15. independent data size. VRAM address A0 is used in the calculation of the address increment, but is ignored during address decoding. VRAM addressing and decoding are as follows: the CRAM address decode uses A15 ~ A1, and A0 specifies the data write format. Write data can not cross a word boundary high and low bytes are exchanged if A0=1.
(EXAMPLE) START ADDRESS: 0 REG. #15=2
START ADDRESS: 0 REG. #15=1
START ADDRESS: 1 REG. #15=2
START ADDRESS: 1 REG. #15=1
VRAM READ
A15 ~ A0 : VRAM address
D15 ~ D0 : VRAM data The data is always read in word units. A0 is ignored during the read; no swap of bytes occurs if A0=1. Subsequent reads are from address incremented by REGISTER #15. A0 is used in calculation of the next address.
_ CRAM ACCESS _ The CRAM contains 128 bytes, addresses 0 to 7FH. For word wide writes to the CRAM, use:
A6 ~ A0 : VRAM address
D15 ~ D0 are valid when we use word for data set. If the writes are byte wide, write the high byte to $C00000 and the low byte to $C00001. A long word wide access is equivalent to two sequential word wide accesses. Place the first data in D31 - D16 and the second data in D15 - D0. The data may be written sequentially; the address is incremented by the value of REGISTER #15 after every write, independent of whether the width is byte of word. Note that A0 is used in the increment but not in address decoding, resulting in some interesting side-effects if writes are attempted at odd addresses. For word wide reads from the CRAM, use:
A6 ~ A0 : VRAM address
_ VSRAM ACCESS _ The VSRAM contains 80 bytes, addresses 0 to 4FH. For word wide writes to the VSRAM, use:
A6 ~ A0 : VSRAM address
VS10 - VS0 : V quantity of scroll If you use word for data and valid in D15 ~ D0. D15 - D0 are valid when we use word for data set. If the writes are byte wide, write the high byte to $C00000 and the low byte to $C00001. A long word wide access is equivalent to two sequential word wide accesses. Place the first data in D31 - D16 and the second data in D15 - D0. The data may be written sequentially; the address is incremented by the value of REGISTER #15 after every write, independent of whether the width is byte of word. Note that A0 is used in the increment but not in address decoding, resulting in some interesting side-effects if writes are attempted at odd addresses. For word wide reads from the VSRAM, use:
A6 ~ A0 : VSRAM address
VS10 ~ VS0 : V quantity of scroll _ ACCESS TIMING _ The CPU and CDP access CRAM, CRAM, and VSRAM using timesharing. Because the VDP is very busy during the active scan, the CPU accesses are limited. However, during vertical blanking the CPU may access the CDP continuously. The number of permitted accesses by the CPU additionally depends on whether the screen is in 32 cell mode or 40 cell mode. Additionally the access size depends on the RAM type; a VRAM access is byte wide, but CRAM and CSRAM are wor wide.
For example, in 32 cell mode, the CPU may access the VRAM 16 times during horizontal scan in a single line. Each access is a byte write, so this amounts to 2 words. However CRAM and CSRAM though sharing the 16 time limit, are word accesses so that 16 words may be written in a single line. Although there is a four-word FIFO, if writes are done in a tight loop during active scan the FIFO will fill up and the CPU will eventually end up waiting to write. The maximum wait times are:
As the CPU has unlimited access to the RAMs during vertical blanking, the wait case never arises. _ HV COUNTER _ The HV counter's function is to give the horizontal and vertical location of the television beam. If the "M3" bit of REGISTER #0 is set, the HV counter will then freeze when trigger signal HL goes high, as well as triggering a level 2 interrupt.
M3: REGISTER # 0 NON INTERLACE MODE
INTERLACE MODE
V-COUNTER : VC7 ~ VC0 H-COUNTER : HC8 ~ HC1
The counter only has eight bits each for H and V, so interlace mode and 40 cell (320 dots) modes present some problems. During interlace mode, the LSB of the vertical position is replaced by the new MSB. And the horizontal resolution problem is solved by ALWAYS dropping the LSB. CAUTION: As the HV counter's value is not valid during vertical blanking, check to be sure that it is active scan before using the value. § 7 DMA TRANSFER DMA (Direct Memory Access) is a high speed technique for memory accesses to the VRAM. CRAM and VSRAM. During DMA VRAM, CRAM and VSRAM occur at the fastest possible rate (please see the section on access timing). There are three modes of DMA access. as can be seen below. all of which may be done to VRAM or CRAM or VSRAM. The 68K is stopped during memory to VRAM/CRAM/VSRAM DMA, but the Z80 continues to run as long as it does not attempt access to the 68K memory space. The DMA is quite fast during VBLANK. about double the tightest possible 68K Top's speed, but during active scan the speed is the same as a 68K loop. Please note that after this point. VRAM is used as a generic term for VRAM/CRAM/VSRAM.
DMD1, DMD0: REG #23 * DMD0=SA23 Source address are $000000-$3FFFFF (ROM) and $FF0000--$FFFFFF (RAM) for memory to VRAM transfers. In the case of ROM to VRAM transfers, a hardware feature causes occasional failure of DMA unless the following two conditions are observed: --The destination address write (to address $C00004) must be a word write. --The final write must use the work RAM. There are two ways to accomplish this, by copying the DMA program into RAM or by doing a final "move.w ram address $C00004" _ MEMORY TO VRAM _ The function transfers data from 68K memory to VRAM, CRAM or VSRAM. During this DMA all 68K processing stops. The source address is $000000-$3FFFFF for ROM or $FF0000-$FFFFFF for RAM. The DMA reads are word wide. writes are byte wide for VRAM and word wide for CRAM and VSRAM. The destination is specified by:
Setting of DMA (A) M1 (REG. #1)=1 : DMA ENABLE (B) Increment No. set to #15 (normally 2) (C) Transfer word No. set into #19, #20. (D) Source address and DMA mode set into #21, #22, #23. (E) Set the destination address. (F)*VDP gets the CPU bus. (G)*DMA start. (H)*VDP releases the CPU bus. (I) M1 have to be 0 after confirmation of DMA finish : DMA DISABLED DMA starts after (E). You must set M1=1 only during DMA otherwise we cannot guarantee the operation. Source address were increased with +2 and destination address increased with content of register #15. Content : of register. Register #1 has another bits.
INC7 ~ INC0 : No. of increment
LG15 - LG0 : No. of move word SA23 - SA1 : Source address (in 68000) DA15 - DA0 : Destination address (in VDP) CD2 - CD0 : RAM selection _ VRAM FILL _ FILL mode fills with same data from free even VRAM address. FILL for only VRAM. How to set FILL(DMA). (A) M1 (REG. #1)=1 : DMA ENABLE (B) Increment No. set to #15 (normally 1). (C) Fill size set to #19, #20. (D) DMA mode set to #23. (E) Destination address and FILL data set. (F) *DMA start (G) M1=0 after confirmation of finishing :DMA DISABLED DMA starts at after (E). M1 should be 1 in the DMA transfer. otherwise we can't guarantee the operation. Destination address is incremented with register #15. VDP dose not asks bus open for CPU, but CPU cannot access VDP without PSG. HV counter and status. You can realize end of DMA, by DMA bit in status register. Register setting. Register #1 has another bits.
INC7 - INC0 : Increment No.
DMA : 1: DMA BUSY * : Not care
LG15 - LG0 : FILL byte No. DA15 - DA0 : Destination address FD15 - FD0 : FILL date When setting 1st and 2nd by long word. 1st will be D31 - D16 and 2nd, D15 - D0. EXAMPLE: 1 TERM: FILL data are word;register #15=1 a. V-RAM address is even. (A) First, low side of FILL data are written in V-RAM address. (B) Second, upper side of FILL data are written in V-RAM+1. (C) And, V-RAM address is added register #15, written upper side FILL data in V-RAM at next each step. b. V-RAM address is odd. (D) First, upper side of Fill data are written in V-RAM address-1. (E) Second, low side of Fill data are written in V-RAM. (F) Same as (C). •VRAM address is even: •VRAM address is odd;
* You must rewrite data (C) into ADD+1 after write data (B). 2. TERM: FILL data are word; resister #15=2 •VRAM address=even •VRAM address=odd
3. TERM: Fill data are byte. a. V-RAM address is even. (A) = (B) = (C) = BYTE * DATA b. V-RAM address is odd. (D) = (E) = (F) = BYTE * DATA _ VRAM COPY _ This function dose copy from source address to destination address by number of COPY byte. DMA setting (A) M1 (REG. #1) = 1 : DMA ENABLE (B) Number of copy bytes in #19, #20 (C) Source address and DMA mode in #23. (D) Destination address set. (E) *DMA transfer (F) After confirming DMA finish :M1=0:DMA DISABLED 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 guaranty that it will function correctly. At the time of DMA transfer, the destination address is incremented by the set value of REG. #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 REG#15=1 REG#15=2 SOURCE ADDRESSDESTINATION ADDRESS DESTINATION ADDRESS
* CAUTION In the case of VRAM COPY, "read from VRAM" and "write to VRAM" are repeated per byte. Therefore, when the SOURCE AREA and TRANSFER AREA are overlapped, the transfer may not be performed correctly. The attenuators are set for the four channels by writing the following bytes to I/O location $7F:
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 ; write them (etc.) CLTB defb $9F,$BF,$DF,$FF This code turns the four sound channels off. It's a good idea to also execute this code when the PAUSE button is pressed, so that the sound does not stay on continuously for the pause interval. REGISTER are as follows. REGISTER #1 includes bits set for purposes other than DMA. Therefore, pay careful attention in this regard.
INC7 ~ INC0 : Increment No.
DMA : 1: DMA BUSY
LG15 - LG0 : Number of copy byte SA23 - SA1 : Source address DA15 - DA0 : Destination address When setting 1st and 2nd by long word, 1st will be D31 - D16 and 2nd, D15 - D0. _ DMA TRANSFER CAPACITY _ Transfer quantity varies depending on the DISPLAY MODE as follows:
In the MEMORY TO VRAM. in the case where CRAM and VSRAM are the destinations, number of words (not byte) should apply. One line during V BLANK allows for data transfer to all the address of CRAM and VSRAM. Note that when calculating, the transfer quantity in one screen (1/60 sec) varies depending on the number of LINES during V BLANK (refer to DISPLAY MODE) in the case of NTSC (video signal) and PAL systems.
Where REGISTER #1 DISP=0, 1, e.. when on-screen display is not made, the TRANSFER quantity is the same as TRANSFER BYTES PER LINE during BLANKING. §8 SCROLLING SCREEN There are two different scroll screens, i.e. 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.
For the scrolling screen display, the following REGISTER setting and VRAM area are required. SCROLL "A" PATTERN NAME TABLE BASE ADDRESS
SCROLL "B" PATTERN NAME TABLE BASE ADDRESS
MODE SET REGISTER No. 3
MODE SET REGISTER No. 4
H SCROLL DATA TABLE BASE ADDRESS
SCROLL SIZE
_ SCROLLING SCREEN SIZE _ The screen size can be set by VSZ1, VSZ0, HSZ1, and HSZ0 (REG. #16). The following 6 kinds can be set both for SCROLL SCREEN A and B. 32*32/32*64/32*128 64*32/64*64 128*32
SCROLL SCREEN's PATTERN NAME TABLE ADDRESS exits in the VRAM and is designated by REGISTER #2 and #4. Depending VRAM and SCROLL screen correspond to each other differently. EXAMPLE
A Value shown in a frame indicates an offset from the PATTERN NAME TABLE BASE ADDRESS. _ HORIZONTAL SCROLLING _ The DISPLAY SCREEN allows for scrolling overall, or based on one cell unit, or on an 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 screen A and B.
HSCR, LSCR: REG. #11 The effective scroll quantity is equivalent to 10 bits (000H-3FFFH). Taking the DISPLAY SCREEN as standard, the SCROLL direction will be as follows:
Horizontally scrolling quantity setting area: H Scroll DATA TABLE is in VRAM. From the base address which was set by REG.#13. set the scrolling quantity of SCREEN A and B alternately. Also the scrolling quantity data setting position varies depending on the following mode (OVERALL, 1 CELL. or 1 LINE).
D15 - D10 can be greatly utilized for program software. _ V SCROLL _ The DISPLAY SCREEN allows for scrolling overall or every 2 Cells in a dot unit. The setting can be done by VSCR (REG.#11). A setting applies to both SCROLL SCREEN A and B.
VSCR: REG #11 The scrolling quantity is equivalent to 11 bits (000H--7FFH). However, it will be as shown below in the INTERLACE MODE. NON INTERLACE: The effective scrolling quantity is equivalent to 10 bits. INTERLACE 1: -ditto- INTERLACE 2: The effective scrolling quantity is equivalent to 11 bits. Taking the DISPLAY SCREEN as standard, the scrolling direction will be as follows:
Set the V SCROLL quantity by VSRAM. Alternately set the Scroll quantity of SCREEN A and B. Depending on the SCROLL MODE, the DATA setting positions differ.
D15 - D11 is indefinite. _ SCROLL PATTERN NAME _ The SCROLL SCREEN's name table is in VRAM and set by REG. #2 and #4. The PATTERN NAME requires 2 bytes (1 word) per CELL the SCROLL screen. Depending on the SCROLL screen's size. VRAM and SCROLL SCREEN correspond with each other differently. Refer to SCROLL SCREEN SIZE.
REVERSE BIT vf and hf : Allows for H and V reverse on CELL unit basis.
vf = 0 vf = 1 vf = 0 vf = 1 hf = 0 hf = 0 hf = 1 hf = 1 _ PATTERN GENERATOR _ PATTERN GENERATOR has VRAM 0000H as ,base address, and a pattern is expressed on a 8x8 dot basis. To define a pattern, 32 bytes are required. Starting from 0000H, it proceeds in the sequence of PATTERN GENERATOR O, 1, 2, ... The relationship between the display pattern and memory is as follows:
The display colors and memory relationship is as follows:
In INTERLACE MODE 2, one cell consists of 8X16 dots and therefore, 64 Bytes (16 long words) are required.
§ WINDOW For WINDOW display, the following register setting and VRAM areas are required. WINDOW PATTERN NAME TABLE AND BASE ADDRESS
MODE SET REGISTER No. 4
WINDOW H POSITION
WINDOW V POSITION
VRAM: WINDOW PATTERN NAME TABLE MAX 4K BYTES _ DISPLAY POSITION _ The WINDOW DISPLAY POSITION is designated by REG #17 and #18. Screen display can be divided on a unit basis of H 2 cells and V 1 cell. The dividing position varies depending on resolution.
RIGT: 0 Displays WINDOW from the left end 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 position. 1 Displays WINDOW from the V dividing position to the bottom end. WHP5 - WHP1 : H dividing position WVP4 - WVP0 : V dividing position
SETTING EXAMPLE REG. #17 : 00H + 01H WINDOW from the left end to the second cell REG. #18 : 00H + 10H WINDOW from the top end to the 16th cell
REG. #17 : 80H + 02H WINDOW from the left end 4th cell to the right end. REG. #18 : 80H + 01H WINDOW from the 2nd cell to the bottom end
REG. #17 : 80H + 01H WINDOW from the 4th cell to the right end. REG. #18 : 00H + 10H WINDOW from the top end to the 16th cell.
REG. #17 : 00H + 02H WINDOW to the 4th cell from the left. REG. #18 : 80H + 01H WINDOW from the 2nd cell to the bottom end.
_ 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 2 cells on the right side of the boundary between WINDOW and SCROLL A will be disfigured. There will be no malfunctioning when the WINDOW is set to the left side and SCROLL A is moved only in V direction. and also when WINDOW is set to the right side.
_ WINDOW PATTERN NAME _ WINDOW PATTERN NAME TABLE is on VRAM, and the BASE ADDRESS is designated by REG. #13. The PATTERN NAME, the same as in SCROLL SCREEN, requires 2 bytes ( 1 Word ) per cell.
PATTERN NAME and VRAM relation varies depending on H 32 cell/40 cell mode. Pay careful attention to this point.
In the H 40 cell mode, there exists the area for H 64 cells. However, there will be no display from the 41st cell in the H direction. Also in the V 28 cell mode, there will be no display from V 29th cell and in the 30th cell mode. There will be no display from 31st cell. S/TEN = 1 SPRITE COLOR PALETTE 3 COLOR CODE 14
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 operator, this will not be displayed. When SPRITE is not related to PRIORITY, the following PRIORITY applies.
SETTING EXAMPLE
The 11 SPRITEs shown in the DISPLAY PRIORITY are displayed on the screen. SPRITE No. 6, 8, 9, 12, 14, and 16 onward are not displayed because they are not linked with LINK DATA LIST. _ 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... The relationship of DISPLAY PATTERN and MEMORY is the same as in PATTERN GENERATOR. Also, SPRITE SIZE and PATTERN GENERATOR relationship is as follows:
§ 11 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.
S : SPRITE A : SCROLL A B : SCROLL B G : BACKGROUND Also, by combining S/TEN (REG. #12) and the above priority, SHADOW - HIGHLIGHT effect function can be utilized. S/TEN = 0
The above shows PRIORITY situation of SPRITE, SCROLL A. SCROLL B and BACKGROUND. The dot to which COLOR CODE 0 is designated is transparent, therefore. either one of SCROLL SCREEN A, B. or BACKGROUND, the priority of which is one step lower than the transparent one, will appear. S/TEN = 1 SPRITE COLOR PALETTE 0 - 3 COLOR CODE 0 - 15 COLOR PALETTE 3 COLOR CODE 0 - 13
Where S/TEN=1, when the PRIORITY bit of both SCROLL A and SCROLL B is 0, there will be SHADOW. For the color status, refer to the color palette. S/TEN = 1 SPRITE COLOR PALETTE 3 COLOR CODE 15
The dots of SPRITE COLOR code 15 work as a SHADOW operator on the screen, the priority of which is lower than the SPRITE. Since SPRITE dots work as an operator, this will not be displayed. § INTERLACE MODE RASTER SCAN MODE can be changed by setting LSM0 and LSM1 (REG. #12).
In the INTERLACE MODE and INTERLACE 1, one cell is defined by 8x8 dots and in INTERLACE 2, 8x16 dots. For DISPLAY, one cell consists of 8x8 dots in the NON INTERLACE MODE and in the INTERLACE MODE 8x16 dots. In any case, number of cells in one screen are the same. Depending on the type of DISPLAY, in the case of INTERLACE DISPLAY, there may occur a serious blur in the vertical direction. Therefore, when using the DISPLAY pay careful attention in this regard.
3. BACKWARD COMPATIBILITY MODEIn the case of BACKWARD COMPATIBILITY MODE. the MEGA DRIVE differs from the original Mark III & MASTER SYSTEM in the following points: _ MARK III (MS-JAPAN) _ OS-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 0C000H. START UP Sega logo is 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 is possible. Consider the MEGA DRIVE's Japanese Specifications as that of MARK III with MS-JAPAN's JOYSTICK Port, or as MS-JAPAN without FM sound source and OS-ROM. _ MASTER SYSTEM _ OS-ROM is not incorporated. 0C000H-0DFFFH RAM is not clear on POWER-UP. RAM 0C000 has no meaningful value. START UP Sega logo not displayed. FM sound source is not incorporated. FM sound source is incorporated in MS by option (OPLL). However, MEGA DRIVE has no option, although connection is possible. Please regard the MEGA DRIVE overseas version as a MASTER SYSTEM without an Operating System ROM. _ RAM BOARD _ In the MEGA DRIVE's MARK III & MASTER SYSTEM BACKWARD COMPATIBILITY MODE, the RAM BOARD for development (for which D-RAM was used) can not be used due to the problem of REFRESH. The other BOARDs for development (which utilizes S-RAM) can be used without any problem.
4. SYSTEM I/OMEGA DRIVE SYSTEM I/O area assignment starts from $A00000, with the Z80 SUB-CPU's memory area. § 1 VERSION NO. Indicates the Mega Drive's hardware version.
§ 2 I/O PORT The MEGA DRIVE has the three general purpose I/0 ports, CTRL1, CTRL2 and EXP. Although each port differs from the others in physical shape it functions in the same manner. Each port has the following S REGISTERs for CONTROL.
The relationship between REGISTERs is as follows:
Mapping is as follows.
Both BYTE and WORD access are possible. However, in the case of WORD access, only the lower byte is meaningful. DATA shows the status of each port. The I/O direction of each bit is set by CTRL and S-CTRL.
CTRL designates the I/O direction of each port and the INTERRUPT CONTROL of TH.
S-CTRL is for the status, etc. of each port's mode change, baud rate and SERIAL.
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 D8 of address $A11000 is effective and for WRITE ONLY.
ACCESS to $A11000 can be based on BYTE. § 4 Z80 CONTROL _ Z80 BUSREQ _ When accessing the Z80 memory from the 68000, first stop the Z80 by using BUSREQ. At the time of POWER ON RESET, the 68000 has access to the Z80 bus.
Access to Z80 AREA in the following manner. (1) Write $0100 in $A11100 by using a WORD access. (2) Check to see that D8 of $A11100 becomes 0. (3) Access to Z80 AREA. (4) Write $0000 in $A11100 by using a WORD access. Access to $A11100 can also be based on BYTE. _ Z80 RESET _ The 68000 may also reset the Z80. The Z80 is automatically reset during the MEGA DRIVE hardware's POWER ON RESET sequence.
Access to $A11100 can also be based on BYTE. §5 Z80 AREA Mapping is performed starting from $A00000 for Z80, a SUB-CPU. As viewed from 68000. the memory map will be as follows:
_ SOUND RAM _ This is for the Z80 program. Access from 68000 by BYTE. _ SOUND CHIP _ This is the mapping area for FM sound source (YM 2612). When accessing from 68000 use BYTE due to timing problem. _ BANK REGISTER _ Access to the 68000 side MEMORY AREA from Z80 will be based on a 32K BYTE unit. At this time, this REGISTER sets which BANK is to be accessed. Registering from 68000 can be set, however, do not access to Z80 Bank MEMORY AREA by 68000. 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 8000 (Z80 Address). The 9 bits correspond to 68000 address 15 - 23 as shown below:
5. 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 Max. 8K Byte. Base address designated by Register #2. SCROLL B PATTERN NAME TABLE Max. 8K 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 1K 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 1K Bytes for H SCROLL TABLE, however, as for display 896 Bytes in V28 cell mode and 980 bytes in V30 cell mode. There are 2K bytes for WINDOW PATTERN NAME TABLE in H32 cell mode, and 4K byte area in H 40 cell mode. For details refer to WINDOW. There are 512 bytes for SPRITE ATTRIBUTE TABLE in H32 cell and 1K byte area in H40 cell mode. However as for display, there are 640 bytes in H40 cell mode. Setting example 1 H 32 cell mode SCROLL A PATTERN NAME TABLE 8K Bytes from 0C000H : REG. #2 = $30 SCROLL B PATTERN NAME TABLE 8K Bytes from 0E000H : REG. #4 = $07 WINDOW PATTERN NAME TABLE 2K Bytes from 0B000H : REG. #3 = $2C H SCROLL DATA TABLE 1K Bytes from 0B800H : REG. #13= $2E SPRITE ATTRIBUTE TABLE 512 Bytes from 0BE00H : REG. #5 = $5F Unoccupied area is used as PATTERN GENERATOR and SPRITE GENERATOR.
2 H40 cell mode SCROLL A PATTERN NAME TABLE 8K Bytes from 0C000H : REG. #2 = $30 SCROLL B PATTERN NAME TABLE 8K Bytes from 0E000H : REG. #4 = $07 WINDOW PATTERN NAME TABLE 4K Bytes from 0B000H : REG. #3 = $2C H SCROLL DATA TABLE 2K Bytes from 0AC00H : REG. #13= $2B SPRITE ATTRIBUTE TABLE 1K Bytes from 0A800H : REG. #5 = $54 Unoccupied area is used as PATTERN GENERATOR and SPRITE GENERATOR.
PRECAUTIONS FOR MS (MASTER SYSTEM) SOFTWARE PROGRAMMING When programming the MS software, pay attention to the following: 1. The program of DMA (RAM, ROM-VRAM, CRAM, VSRAM) should be resident in RAM, or it should be as in LIST1 for example. However, in either one on the above 2 cases, a long word access is not possible as regards the last VRAM address set. 2. ID should be as in the next page. 3. Put LIST2 at your program's start. This is the U.S. security software. LIST1
LIST 2 move.b $A10001,d0 ; Get version number andi.b #$0F,d0 ; beq.b ?0 ; If not version $0 move.l $'SEGA',$A14000 ; Output ASCII ?0: ROM CARTRIDGE DATA FOR MEGA DRIVE Write in ROM's 100H-1FFH.
1: SEGA system name and TITLE in common with all ROMs. 2: Copyright notice and year/month of release (Firm name in ASCII 4 character.) 3: Game name for Domestic (JIS KANJI CODE OK) 4: Game name for overseas market (JIS KANJI CODE OK) 5: Type of CARTRIDGE and Products, No., Version No. TYPE GAME : GM EDUCATION: Al NO. PRODUCT NO. VER. Data varies depending on the type of ROM or software version. 6: Check sum 7: I/0 use support data JOYSTICK FOR MS: 0 TABLET : T JOYSTICK : J CONTROL BALL : B KEYBOARD : K PADDLE CONTROLLER : V SERIAL (RS232C): R FDD : F PRINTER : P CDROM : C 8: ROM capacity START ADDRESS, END ADDRESS 9: RAM capacity START ADDRESS, END ADDRESS 10: When no external RAM is mounted, fill the address by a space code and when it is mounted follow the following: 1 B 0 H: dc.b 'RA',%1x1yz000,%00100000 x1 for BACKUP and 0 If not BACKUP y z10 if even address only. 11 if odd address only 00 if both even and odd address 1 B 4 H: dc.l RAM start address RAM end address 11: If corresponding to MODEM, fill it by space code and if not, follow the following: 1 B C H: dc.b 'MO','xxxx','yy.z' xxxx Firm name the same as in 2 yy MODEM NO. z Version 13: Data of 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 ~ 7, 9 ~ 13 space. HOW TO OBTAIN CHECK SUM The CHECK SUM obtaining program is shown as follows. The program starts with 0FF8000H, RAM space. First. fill game capacity by -1 (0FFH) and then load all of the programs. Next, load the CHECK SUM program and run the program from 0FF8000H. 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 canceled in advance. Also, when burning to ROM, first fill the game capacity by -1 (0FFH). end_addr equ $1A4 org -$8000 start: move.l (a0),d1 addq.l #$1,d1 movea.l #$200,a0 sub.l a0,d1 amr.l s1,d1 ; counter move d1,d2 subq.w #$1,d2 swap d1 moveq #$0,d0 ?l2: add (a0)+,d0 dbra d2,?l2 dbra d1,?l2 nop nop nop nop nop nop ?le: nop nop bra.b ?le MEMORY MAPPING FOR EMULATION For the 68000 EMULATION All address should be disabled initially: 0 to 0FFFFFF Required areas should then be enabled as follows: 1. Program and Data are in 0 to 007FFFF 2. S-RAM is for Z-80 in 0A00000 to 0A01FFF 3. FM sound chip interface is in 0A04000 to 0A04FFF 4. I/O and Z-80 control port are in 0A10000 to 0A11FFF 5. VDP and sound control port are in 0C00000 to 0C00FFF 6. Scratch RAM is in 0FF0000 to 0FFFFFF RAM CARD (No. 171-5642-02) This board has two memory areas; MAIN MEMORY (D-RAM) $000000 - $0FFFFF BACK UP MEMORY (S-RAM) $200000 - $203FFF I. INITIALIZE Write 0100H into $0A11000 Write1 into $0A130F0 (Green LED light up) 2. WRITE PROTECT Write 3 into $0A130F0 (Red LED light up) 3. READ/WRITE Write 1 into $0A130F0 (Red LED turns off) 4. NOTE - Emulator access to these ports should be enabled before the writes, then disabled after words.
GENESIS SOUNDSOFTWARE MANUALINDEX I. Z80 MAPPING (1) Z80 MEMORY MAP (2) INTERRUPT II. 68K CONTROL OF Z-80 (1) Z80 START UP (2) Z80 HANDSHAKE III. FM SOUND CONTROL (1) 68K ACCESS FM CHIP (2) 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 another manual. I. Z80 MAPPING (2) Z80 MAP We show the memory at right. I/O is contained in memory map. 1) PROGRAM AREA Program, data and scratch are in 0 to 1FFFH, is S-RAM. 2) BANK From 8000H - FFFFH is window of 68K memory. Z-80 can access all of 68K memory by BANK switching. BANK select data create 68K address from A15 to A23. You must write these 9 bits one at a time into 6000H serially, byte units, using the LSB.
3)I/O 4000H FM1 register select (Channel 1-3) 4001H FM1 DATA 4002H FM2 register select (Channel 4-6) 4003H FM2 DATA PSG address is in 7F11H. (2) INTERRUPT Z-80 gets the only VIDEO vertical interrupt. This interrupt is generated 16ms period and 64ms length. II. 68K CONTROL OF Z80 (1) Z80 START UP Z-80 OPERATION SEQUENCE. (1) BUS REQ ON (2) BUS RESET OFF (3) 68K copies program into Z-80 S-RAM (4) BUS RESET ON (5) BUS REQ OFF (6) BUS RESET OFF
BUS REQUEST
BUS REQ ON DATA 100H (WORD) -> $A11100
BUS REQ OFF DATA OH (WORD) -> $A11100
RESET Z-80 • RESET ON DATA OH (Word) -> $A11200
• RESET OFF DATA 100H (Word) -> $A11200
This period requires 26ms. Also FM sound source is cleared at the same time.
CONFIRMATION OF BUS STATUS
This information is in $A11100 bit 0
0 - Z80 is using
1 - 68K can access
(2) Z80 HANDSHAKE If you access the Handshake area (A00000 - A07FFF) you must use BUS REQ. 68K has to access the Z-80 S-RAM by byte. III. FM SOUND CONTROL (1) 68K accesses the FM source. 68K needs BUS REQ when accessing the FM source, because this memory is controlled by Z-80. (2) Z80 accesses the FM source. Z80 normally controls the FM (4000H - 4003H) IV. PSG CONTROL PSG accepts access of 68K and Z80 anytime, but you have to coordinate 68K and Z80 accesses. PSG is in $C00011 from 68K and in 7F11H from Z80. OVERVIEW The Yamaha 2612 Frequency Modulation (FM) sound synthesis IC resembles the Yamaha 2151 (used in Sega's coin-op 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, with a high degree of realism, a single note in almost any instrument's voice. Chords are generally created by using multiple FM channels. The standard FM channels each have a single overall frequency and data for how to turn this frequency into the complex final wave form (the voice). This conversion process uses four dedicated channel components called 'operators', each possessing a frequency (a variant of the overall frequency), an envelope, and the capability to modulate its input using the frequency and envelope. The operator frequencies are offsets of integral multiples of the overall frequency. There are two sets of three FM channels, named channels 1 to 3 and 4 to 6 respectively. Channels 3 and 6, the last in each set, have the capability to use a totally separate frequency for each operator rather than offsets of integral multiples. This works well (I believe) for percussion instruments, which have harmonics at odd multiples such as 1.4 or 1.7 of the fundamental. The 8-bit Digitized Audio exists as a replacement of FM channel 6, meaning that turning on the DAC turns off FM channel 6. Unfortunately, all timing must be done by software -- meaning that unless the software has been very cleverly constructed, it is impossible to use any of the FH channels at the same time as the DAC. Page 2 Stereo output capability means that any of the sounds. FM or DAC, may be directed to the left, the right, or both outputs. The stereo is output only through the headphone jack. The LFO, or Low Frequency Oscillator, allows for amplitude and/or frequency distortions of the FM sounds. Each channel elects the degree to which it will be distorted by the LFO, if at all. This could be used, for example, in a guitar solo. Finally, the system has two software timers, which may be used as an alternative to the Z80 VBLANK interrupt. Unfortunately, these timers do not cause interrupts -- they must be read by the software to determine if they have finished counting. 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 envelope with. which to modify the input, and an output. -- The operators have two types, those whose outputs feed into another operator, and those that are summed to form the final wave form. The latter are called 'slots'. -- The slots may be independently enabled, though Sega's software always enables or disables them all simultaneously. -- Operator 1 may feed back into itself, resulting in a more complex wave form. These operators may be arranged in eight different configurations, called "algorithms". A diagram of the algorithms follows on the next page. Page 3
Algorithm 0 -- distortion guitar, "high hat chopper" (?) bass Algorithm 1 -- harp, PSG (programmable sound generator) sound Algorithm 2 -- bass, electric guitar, brass, piano, woods Algorithm 3 -- strings, folk guitar, chimes Algorithm 4 -- flute, bells, chorus, bass drum, snare drum, tom-tom Algorithm 5 -- brass, organ Algorithm 6 -- xylophone, tom-tom, organ, vibraphone -- snare drum, base drum Algorithm 7 -- pipe organ Page 4 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 6 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 that channel. 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 heard if headphones are used. -- the extent to which the channel is distorted by the LFO. Registers that refer to each operator make up the remainder. The four operator's connections are determined by the algorithm used, but the envelope is always specified individually for each operator. In the case of FM channels 3 and 6, the frequency may be specified individually for each operator. Page 5 ENVELOPE SPECIFICATION
The sound starts when the key is depressed, a process called 'key on'. The sound has an attack, a strong primary decay, followed by a slow secondary decay. The sound continues this secondary decay until the key is released, a process called 'key off'. The sound then begins a rapid final decay, representing for example a piano note after the key has been released and the damper has come down on the strings. The envelope is represented by the above amplitudes and angles, and a few supplementary registers. Used in the above diagram are: TL -- Total level, the highest amplitude of the wave form AR -- Attack rate, the angle of initial amplitude increase. This can be made very steep if desired. The problem with slow attack rates is that if the notes are short, the release (called 'key off') occurs before the note has reached a reasonable level. D1R -- The angle of initial amplitude decrease T1L --. The amplitude at which the slower amplitude decrease starts D2R -- The angle of secondary amplitude decrease. This will continue indefinitely unless 'key off' occurs. RR -- The final angle of amplitude decrease, after 'key off'. Page 5 1/2 Additional registers are: RS -- 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. AM -- Amplitude Modulation enable, whether or not this operator will allow itself to be modified by the LFO. Changing the amplitude of the slots (those colored gray in the diagram on page 3) 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 0. Page 6 The FM-2612 may be accessed from either the 68000 or the Z80. In both cases, however, the bus is only 8 bits wide. The FM-2612 is accessed through memory locations 4000H - 4003H in the Z80 case, or A04000H - 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;
Page 7 To units to Part I, write the 8 bit address to 4000 and the data to 4001. To write to PART II, write the 8-bit address to 4002 and the data to 4003. CAUTION: Before writing, read from any address to determine if the YM-2612 I/O is still busy from the last write. Delay until bit 7 returns to 0. CAUTION: in the case of registers that are "ganged together" to form a longer number - for example the 10-bit Timer A value or the 14-bit frequencies, write the high register first. READ DATA: Reading from any of the four locations.
BUSY - 1 if busy, 0 if ready for new data OVERFLOW - 1 if the timer has counted up and overflowed. See register 27H. Page 8
Page 9 PART I MEMORY MAP (Cont.)
Each of the above has three entries. All follow the pattern:
with the exception that A8H and ACH follow the pattern:
"PART II" is a duplication of 30H - B4H, where channels 1-3 are replaced by 4-6. Page 10 The Registers:
LFO EN - 1 is enabled, 0 is disabled. LFO FREQ.
The LFO (Low frequency Oscillator) is used to distort the FM sounds amplitude and phase. It is triple enabled, as there is: A) A global enable in Reg. 22H B) A sensitivity enable on a channel by channel basis, in Regs. 60H - 6EH. If the LFP is desired, enable it by register 22H. Next, select which channels will be affected by the LFO, to what degree, and whether their amplitude or phase ___ ___ ___. Page 11 affected, by setting registers B4 - B6H. Finally. if a channel's amplitude is affected, make sure that it is only the "slots" that are affected by setting registers 60H - 6EH.
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 A) microseconds Timer A - all 1's -> 18 µs = 0.018 ms Timer A - all 0's -> 18,400 µs = 18.4 ms Page 12
8 Bit Timer B lasts 288 * (256 - TIMER B ) microseconds TIMER B = all 1's -> 0.288 ms TIMER B = all 0's -> 73.44 ms Register 27H controls the software timers and the Channel 3 (and 6) mode, two entirely separate items.
Page 13 A normal channel's operators use offsets of integral multiples of a single frequency. In special mode, each operator has an entirely separate frequency. Channel 3 operator 1's frequency is in registers A2 and A6. Operators 2 to 4 are in Regs. A8 and AC, A9 and AD, and AA and AE respectively. No one at Sega has used the timer feature, but the Japanese manual says; LOAD - 1 starts the timer, 0 stops it. ENABLE - 1 causes timer overflow to set the read register flag. 0 means the timer keeps cycling without setting the flag. RESET - Writing a 1 clears the read register flag, writing a 0 has no effect. Page 14
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 is possible to have each operator be a separate note, so there is possible justification for turning then on and off separately. Page 15
Register 2AH contains 8 bit DAC data.
If the DAC enable is 1, the DAC data is output as a replacement for channel 6. The only Channel 6 register that affects the DAC is the stereo output portion of reg. B4H. Page 16 Registers 30H - 90H are all single - operator registers. Please see page 8 for how the twelve channel - operator combinations are arranged.
Both DT1 (Detune) and MUL (Multiple) relate the operator's frequency to the overall frequency. MUL ranges from 0 to 15, and multiples the overall frequency, with the exception that 0 results in multiplication by 1/2. That is, MUL=0 to 15 gives *1/2, *1, *2, ... *15. DT1 gives small variations from the overall frequency * MUL. The MSB of DT1 is a primitive sign bit, and the two LSB's are magnitude bits. See the next page for a diagram. Page 17
TL (total level) represents the envelopes highest amplitude, with 0 being the largest and 127 the smallest. A change of one unit is about 0.75 dB. To make a note softer, only change the TL of the slots (the output operators). Changing the other operators will affect the flavor of the note.
Register 50H contains RS (rate scaling) and AR (attack rate). AR is the steepness of the initial amplitude rise, shown on page 4. RS affects AR, D1R, D2R and RR in the same way. RS is the degree to which the envelope becomes narrower as the frequency becomes higher. 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/1) KC/N is always rounded down. As rate ranges from 0-31, this means that the RS influence ranges from small (at 0-3) to very large (at 0-31) Page 19
D1R (First Decay Rate) is the initial steep amplitude decay rate (see page 4). It is, like all rates, 0-31 in value and affected by RS. AM is the amplitude modulation enable, whether of not this operator will be subject to amplitude modulation by the LFO. This bit is not relevant unless both the LFO is enabled and register B4's AMS (Amplitude modulation sensitivity) is non-zero.
D2R (secondary decay rate) is the long tail off of the sound that continues as long as the key is depressed. Page 20
D1L is the secondary amplitude reached after the first period of rapid decay. It should be multiplied by 8 if one wishes to compare it to TL. Again as TL, the higher the number, the more attenuated the sound. RR is the release rate, the final sharp decrease in volume after the key is released. All rates are 5 bit numbers, but there are only four bits available in the register. Thus, for comparison and calculation purposes, these four bits are the MSBs and the LSB is always 1. In other words, double it and add one.
This register is proprietary and should be set to zero. The final registers relate mostly to a single channel. Each register is tripled; please see the diagram on page 9.
Channel 1's frequency is in A0 and A4H. Channel 2's frequency is in A1 and A5H. Channel 3's frequency is in normal mode (Please see page 12) is in A2 and A6H. If Channel 3 is in special mode: Operator 1's frequency is in A7 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 Page 22 The frequency is a 14-bit number that should be set high byte, low byte (e.g. A4H then A0H). The highest 3 bits called the "block", give the octave. The next 10 bits give position in the octave, and a possible 12 - tone sequence is;
This sequence should be used inside each octave. Page 23
FEEDBACK is the degree to which operator 1 feeds back into itself. In the voice library, self feedback is represented as this:
The ALGORITHM is the type of inter-operator connection used. Please see the list of the eight operators on page 3.
Register 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. Page 24 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.
a halftone Page 25 TEST PROGRAM Here's a tested power-on initialization and sample note in the "Grand Piano" voice (Page 27)
Page 26
Notes: #1 Write address then data. #2 Loop until read register D7 becomes 0 #3 Follow MSB/LSB sequence. 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 controlled through output port $7F. TONE GENERATOR FREQUENCY The frequency (pitch) of a tone generator is set by a 10-bit value. This value is counted down until it reaches zero, at which time the tone output toggles and the 10-bit value is reloaded into the counter. Thus, higher 10-bit numbers produce lower frequencies. To load a new frequency value into one of the tone generators, you write a pair of bytes to I/O-location $7F according to the following format:
The R2:R1:R0 field selects the tone channel as follows:
10-bit data is: (MSB) d9 d8 d7 d6 d5 d4 d3 d2 d1 d0 (LSB) NOISE GENERATOR CONTROL The noise generator uses three control bits to select the "character" of the noise sound. A bit called "FB" (Feedback) produces periodic noise or "white" noise:
The frequency of the noise is selected by two bits NF1:NF0 according to the following
NOTE: "Clock" is fixed in frequency. It is a crystal controlled oscillator signal connected to the PSG. When NF1:NF0 is 11, Tone Generator #3 supplies the noise clock source. This allows the noise to be "swept" in frequency. This effect might be used for a jet engine runup, for example. To load these noise generator control bits, write the following byte to I/O port $7F:
ATTENUATORS Four attenuators adjust the volume of the three tone generators and the noise channel. Four bits A3:A2:A1:A0 control the attenuation as follows:
|