- [Document History](#document-history)
- [Introduction](#introduction)
- [Manual Configuration](#manual-configuration)
- [Chapter 1: Introduction to the 32X](#chapter-1-introduction-to-the-32x)
- [Chapter 2: Configuration](#chapter-2-configuration)
- [Chapter 3: Functions](#chapter-3-functions)
- [Mapping](#mapping)
- [Registers](#registers)
- [VDP](#vdp)
- [PWM](#pwm)
- [SH2](#sh2)
- [Chapter 4: Accessing the 32X Block](#chapter-4-accessing-the-32x-block)
- [Chapter 5: Other](#chapter-5-other)
- [Boot ROM](#boot-rom)
- [Security](#security)
- [Restrictions](#restrictions)
- [Terminology](#terminology)
- [RISC (Reduced Instruction Set Computer)](#risc-reduced-instruction-set-computer)
- [SH2 (SH7095)](#sh2-sh7095)
- [Cache](#cache)
- [SDRAM (Synchronous Dynamic Random Access Memory)](#sdram-synchronous-dynamic-random-access-memory)
- [DSP (Digital Signal Processor)](#dsp-digital-signal-processor)
- [DMA (Direct Memory Access)](#dma-direct-memory-access)
- [FIFO (First-In First-Out)](#fifo-first-in-first-out)
- [Master/Slave](#masterslave)
- [Chapter 1: Introduction to 32X](#chapter-1-introduction-to-32x)
- [1.1 Introduction to 32X](#11-introduction-to-32x)
- [New Screen Offered](#new-screen-offered)
- [New Sounds Offered](#new-sounds-offered)
- [High-Speed Microprocessor](#high-speed-microprocessor)
- [Memory](#memory)
- [Development Language](#development-language)
- [Chapter 2: Configuration](#chapter-2-configuration-1)
- [2.1 32X Block Diagram](#21-32x-block-diagram)
- [2.2 About the 32X Block](#22-about-the-32x-block)
- [MEGA Drive I/F Component](#mega-drive-if-component)
- [32X Cartridge Component](#32x-cartridge-component)
- [SH2 Component](#sh2-component)
- [SDRAM Component](#sdram-component)
- [Frame Buffer Component](#frame-buffer-component)
- [VDP Component](#vdp-component)
- [Direct Color Mode](#direct-color-mode)
- [Packed Pixel Mode](#packed-pixel-mode)
- [Run Length Mode](#run-length-mode)
- [Color Palette Component](#color-palette-component)
- [PWM Component](#pwm-component)
- [Chapter 3: Functions](#chapter-3-functions-1)
- [3.1 Mapping](#31-mapping)
- [MEGA Drive Memory Map](#mega-drive-memory-map)
- [When Power is On (ADEN = 0)](#when-power-is-on-aden--0)
- [When Using Super 32X (ADEN = 1)](#when-using-super-32x-aden--1)
- [ROM Access When Using the 32X](#rom-access-when-using-the-32x)
- [Access to the 32X VDP](#access-to-the-32x-vdp)
- [SH2 Memory Map](#sh2-memory-map)
- [Cache Address Mapping](#cache-address-mapping)
- [Cache Area Access](#cache-area-access)
- [Cartridge ROM Access](#cartridge-rom-access)
- [32X VDP Access](#32x-vdp-access)
- [3.2 Registers](#32-registers)
- [32X System Register \[MEGA Drive\]](#32x-system-register-mega-drive)
- [32X System Register \[SH2\]](#32x-system-register-sh2)
- [VDP Register](#vdp-register)
- [3.2.1 System Registers \[MEGA Drive side\]](#321-system-registers-mega-drive-side)
- [Adapter Control Register (Access: Byte/Word)](#adapter-control-register-access-byteword)
- [Interrupt Control Register (Access: Byte/Word)](#interrupt-control-register-access-byteword)
- [Bank Set Register (Access: Byte/Word)](#bank-set-register-access-byteword)
- [DREQ Control Register (Access: Byte/Word)](#dreq-control-register-access-byteword)
- [68K to SH DREQ Source Address Register (Access: Word)](#68k-to-sh-dreq-source-address-register-access-word)
- [68K to SH DREQ Destination Address Register (Access: Word)](#68k-to-sh-dreq-destination-address-register-access-word)
- [68K to SH DREQ Length Register (Access: Word)](#68k-to-sh-dreq-length-register-access-word)
- [FIFO Register (Access: Word)](#fifo-register-access-word)
- [SEGA TV Register (Access: Byte/Word)](#sega-tv-register-access-byteword)
- [Communication Port (Access: Byte/Word)](#communication-port-access-byteword)
- [PWM Control Register (Access: Byte/Word)](#pwm-control-register-access-byteword)
- [Cycle Register (Access: Byte/Word)](#cycle-register-access-byteword)
- [L ch Pulse Width Register (Access: Byte/Word)](#l-ch-pulse-width-register-access-byteword)
- [R ch Pulse Width Register (Access: Byte/Word)](#r-ch-pulse-width-register-access-byteword)
- [Mono Pulse Width Register (Access: Byte/Word)](#mono-pulse-width-register-access-byteword)
- [3.2.2 System Registers \[SH2 side\]](#322-system-registers-sh2-side)
- [Interrupt Mask Register (Access: Byte/Word)](#interrupt-mask-register-access-byteword)
- [H Count Register (Access: Byte/Word)](#h-count-register-access-byteword)
- [VRES Interrupt Clear Register (Access: Word)](#vres-interrupt-clear-register-access-word)
- [V Interrupt Clear Register (Access: Word)](#v-interrupt-clear-register-access-word)
- [H Interrupt Clear Register (Access: Word)](#h-interrupt-clear-register-access-word)
- [CMD Interrupt Clear Register (Access: Word)](#cmd-interrupt-clear-register-access-word)
- [PWM Interrupt Clear Register (Access: Word)](#pwm-interrupt-clear-register-access-word)
- [Points to Be Aware of Concerning Interrupts](#points-to-be-aware-of-concerning-interrupts)
- [Interrupt Sources and Priority Levels](#interrupt-sources-and-priority-levels)
- [3.3 68000-SH2 Communication](#33-68000-sh2-communication)
- [Communication Architecture](#communication-architecture)
- [Communication Port](#communication-port)
- [CMD Interrupt](#cmd-interrupt)
- [DMA (DREQ Transfer)](#dma-dreq-transfer)
- [3.4 32X Block Access by SH2](#34-32x-block-access-by-sh2)
- [Cache-through Access](#cache-through-access)
- [VDP Access Competition](#vdp-access-competition)
- [ROM Access Competition](#rom-access-competition)
- [32X Buffer Register Access Table](#32x-buffer-register-access-table)
- [3.5 32X Block Access by 68000](#35-32x-block-access-by-68000)
- [Blocks that can be directly accessed](#blocks-that-can-be-directly-accessed)
- [Cartridge ROM Access When Using the 32X](#cartridge-rom-access-when-using-the-32x)
- [3.6 32X Block Access by Z80](#36-32x-block-access-by-z80)
- [Blocks that can be directly accessed](#blocks-that-can-be-directly-accessed-1)
- [Competition with other CPUs](#competition-with-other-cpus)
- [Frame Buffer Access](#frame-buffer-access)
- [4.1 Access Timing of each CPU to 32X Block](#41-access-timing-of-each-cpu-to-32x-block)
- [32X Mode and Cartridge ROM](#32x-mode-and-cartridge-rom)
- [Frame Buffer](#frame-buffer)
- [Palette](#palette)
- [VDP Register](#vdp-register-1)
- [System Register](#system-register)
- [Boot ROM](#boot-rom-1)
- [SDRAM Access Time](#sdram-access-time)
- [StandBy Changer Register (Access: Word)](#standby-changer-register-access-word)
- [DREQ Control Register (Access: Byte/Word)](#dreq-control-register-access-byteword-1)
- [68K to SH DREQ Source Address Register (Access: Word)](#68k-to-sh-dreq-source-address-register-access-word-1)
- [68K to SH DREQ Destination Address Register (Access: Word)](#68k-to-sh-dreq-destination-address-register-access-word-1)
- [68K to SH DREQ Length Register (Access: Word)](#68k-to-sh-dreq-length-register-access-word-1)
- [FIFO Register (Access: Word)](#fifo-register-access-word-1)
- [Communication Port Register (Access: Byte/Word)](#communication-port-register-access-byteword)
- [PWM Control Register (Access: Byte/Word)](#pwm-control-register-access-byteword-1)
- [Cycle Register (Access: Byte/Word)](#cycle-register-access-byteword-1)
- [L ch Pulse Width Register (Access: Byte/Word)](#l-ch-pulse-width-register-access-byteword-1)
- [R ch Pulse Width Register (Access: Byte/Word)](#r-ch-pulse-width-register-access-byteword-1)
- [Mono Pulse Width Register (Access: Byte/Word)](#mono-pulse-width-register-access-byteword-1)
- [3.2.3 VDP Registers (Both MEGA Drive and SH2 Common)](#323-vdp-registers-both-mega-drive-and-sh2-common)
- [Bitmap Mode Register (Access: Byte/Word)](#bitmap-mode-register-access-byteword)
- [Frame Buffer Control Register (Access: Byte/Word)](#frame-buffer-control-register-access-byteword)
- [Screen Shift Control Register (Access: Byte/Word)](#screen-shift-control-register-access-byteword)
- [Auto Fill Length Register (Access: Byte/Word)](#auto-fill-length-register-access-byteword)
- [Auto Fill Start Address Register (Access: Word)](#auto-fill-start-address-register-access-word)
- [Auto Fill Data Register (Access: Word)](#auto-fill-data-register-access-word)
- [3.3 VDP](#33-vdp)
- [Display Mode](#display-mode)
- [Display Mode Possible Combinations](#display-mode-possible-combinations)
- [VDP Configuration](#vdp-configuration)
- [VDP Memory Map](#vdp-memory-map)
- [VDP Register](#vdp-register-2)
- [Color Palette](#color-palette)
- [DRAM](#dram)
- [Over Write Image](#over-write-image)
- [Switching Frame Buffers](#switching-frame-buffers)
- [Color Palette](#color-palette-1)
- [Over Write Image](#over-write-image-1)
- [Overview of Display Specifications](#overview-of-display-specifications)
- [Line Table Format](#line-table-format)
- [Priority](#priority)
- [Direct Color Mode](#direct-color-mode-1)
- [Packed Pixel Mode](#packed-pixel-mode-1)
- [Screen Shift Control](#screen-shift-control)
- [Run Length Mode](#run-length-mode-1)
- [FILL Function](#fill-function)
- [Clock Used by the 32X](#clock-used-by-the-32x)
- [HBlank and Display Periods](#hblank-and-display-periods)
- [VBlank and Display Periods](#vblank-and-display-periods)
- [VDP Register Latch Timing](#vdp-register-latch-timing)
- [3.4 PWM](#34-pwm)
- [PWM Sound Source](#pwm-sound-source)
- [Functions of 32X PWM](#functions-of-32x-pwm)
- [Chapter 5: Other](#chapter-5-other-1)
- [5.1. Boot ROM](#51-boot-rom)
- [Initial Data Load](#initial-data-load)
- [Mega Drive and SH2 Synchronization](#mega-drive-and-sh2-synchronization)
- [5.2. Security](#52-security)
- [Initial Program](#initial-program)
- [Security](#security-1)
- [Included in the Initial Program](#included-in-the-initial-program)
- [5.3. Restrictions](#53-restrictions)
- [DMA Restrictions](#dma-restrictions)
- [Precautions when using 32X SH2 (SH7095)](#precautions-when-using-32x-sh2-sh7095)
- [DMA Controller Settings](#dma-controller-settings)
- [Restrictions Concerning SH2 Interrupt](#restrictions-concerning-sh2-interrupt)
Sega 32X Hardware Manual
**Document Number:** MAR-32-R4-072294
# Document History
- **Provisional Version 1** (May 11, 1994): Introduction, Section 1-3.4, 6.2, 6.3 (64 pages)
- **Provisional Version 2** (May 23, 1994): Sections 3.5, 4.1-4.4, 6.1, additions (99 pages)
- **Revision 1** (May 25, 1994): Introduction, Chapters 1 and 2, terminology updates
- **Revision 2** (May 30, 1994): Improved structure of Chapter 4
- **Provisional Version 3** (June 1, 1994): SH2 Memory Map updates (84 pages)
# Introduction
This manual applies to the development of game software and explains the power-up booster "32X" hardware functions for the MEGA Drive.
# Manual Configuration
# Chapter 1: Introduction to the 32X
Introduces the main functions of the 32X.
# Chapter 2: Configuration
Explains the hardware configuration and purpose of each part.
# Chapter 3: Functions
## Mapping
Explains the layout on CPU address space of each hardware part.
## Registers
Explains the meaning of register and buffer function, sequence and address, and set values.
## VDP
Explains functions such as image data formatting, screen shift, character overwrite, and Fill.
## PWM
Explains the PWM sound source and the PCM data play method.
## SH2
Explains the main CPU features and its communication with the MEGA Drive.
# Chapter 4: Accessing the 32X Block
Explains registers and buffers that can be accessed from each CPU, the method of taking access authority, and access time.
# Chapter 5: Other
## Boot ROM
Explains operations from when the power is turned on until executing the application.
## Security
Explains areas decided by previous uses of the cartridge ROM.
## Restrictions
Explains cautionary points in creating applications.
---
# Terminology
# RISC (Reduced Instruction Set Computer)
Computer architecture that improves performance by simplifying instruction specifications and has simplified hardware achieving high-efficiency pipeline (parallel process of instructions within the computer).
# SH2 (SH7095)
At the core of the RISC-type CPU is the Hitachi original microcomputer, a 32-bit divider and cache memory.
# Cache
Comparatively small, high-speed memory placed between large, low-speed memory and the CPU. When data of the address to be accessed by the CPU is stored in cache memory, it is referred to as a "cache hit" and the CPU can operate at high speeds. When address data to be accessed is not stored in cache memory, it is referred to as a "cache miss." The contents of the cache memory are replaced by data in the main memory.
# SDRAM (Synchronous Dynamic Random Access Memory)
Differs from typical DRAM in that data of a two-line address is held internally once. This is independently synchronized to the clock and transfers continuously separate from internal DRAM operation speed.
# DSP (Digital Signal Processor)
Signal processor containing a high-speed divider.
## DMA (Direct Memory Access)
Transfers data directly between memory and peripheral units (I/O) or between memories without going through the CPU, usually achieved by the DMA controller (DMAC).
## FIFO (First-In First-Out)
Method of outputting in the same order as inputting in the input/output operation of a buffer register or buffer memory.
## Master/Slave
Refers to the priority order of user authorization of a bus to which more than one processor is connected. Master takes normal bus authorization; slave obtains permission of the master and takes bus authorization when slave bus access occurs.
---
# Chapter 1: Introduction to 32X
# 1.1 Introduction to 32X
The 32X is a power-up booster installed in the MEGA Drive cartridge slot. This adds a bitmap screen of up to 32,768 simultaneous colors and stereo sound source that plays PCM data to the graphics and sound of the existing MEGA Drive. Two 32-bit RISC CPUs are mounted for screen graphics processing.
## New Screen Offered
- **Frame Buffer:** 1 Mbit DRAM × 2 (alternating draw/display)
- **Maximum 32,768 colors**, bitmap format
- **3 mode data formats:**
- Direct Color
- Packed Pixel
- Run Length
- Scroll by hardware, no sprites exist
## New Sounds Offered
- Stereo sound source that plays PCM data
- D/A conversion by PWM modulation (11-bit resolution)
## High-Speed Microprocessor
- Two SH2 chips for the main CPU
- 32-bit RISC chip with built-in process similar to DSP
## Memory
- 4KByte Cache memory (built into the CPU)
- 2Mbit SDRAM (main memory)
## Development Language
- C Language
- Assembly Language
---
# Chapter 2: Configuration
# 2.1 32X Block Diagram
The 32X is made up of the following parts:
- **MEGA Drive I/F Component** (I/F chip built-in)
- **32X Cartridge**
- **SH2 Component**
- **SDRAM (2 Mbit)**
- **Frame Buffer (1 Mbit × 2)**
- **VDP Component**
- **Color Palette Component** (VDP chip built-in)
- **PWM Component** (I/F chip built-in)
These hardware resources (excluding the SH2 and SDRAM components) contained by 32X are directly controlled by the MEGA Drive 68000 CPU. The ROM cartridge can be read from both the MEGA Drive and 32X. Images and sound made by 32X are combined with images and sound made by the MEGA Drive.
# 2.2 About the 32X Block
## MEGA Drive I/F Component
Interface connecting the 32X to the MEGA Drive. The 32X hardware resources (graphics, sound, and communication with SH2) and cartridge ROM are mapped through the MEGA Drive I/F in the MEGA Drive main CPU (68000) address space.
## 32X Cartridge Component
The ROM cartridge installed in the 32X cartridge slot can be read from both the 32X CPU SH2 side and the MEGA Drive side 68000 (and Z80). Nevertheless, SH2 has priority when conflict between the two exists.
## SH2 Component
Two SH2 chips as main CPUs mounted in the 32X. The cartridge ROM is connected with the 32X hardware resources (graphics, sound, and communication to 68000) on a common bus. The 2 SH2 units are fixed to master and slave by packaged conditions; the master gets bus authorization normally and slave gets bus authorization after obtaining permission of the master at the time of bus access.
MEGA Drive hardware cannot map in SH2 address space. Consequently, MEGA Drive information is indirectly received by communication with the 68000. The 32X has:
- A control register that issues interrupts from 68000 to SH2
- A FIFO register that can send data written from the 68000 to the DMA built into the SH2
- A register that can be read and written from both the 68000 and SH2
## SDRAM Component
The 32X has 2Mbits of SDRAM (synchronous DRAM) as main memory for the SH2 chips. The SH2 program on the cartridge ROM is loaded into SDRAM, then executed. The SDRAM arranges 16 bytes and reads to the buffer inside the chip; after which, in order to synchronize to the SH2 clock and transfer sequentially, all data after the second data set can be transferred without restrictions incurred by operation within the memory. The SH2 can rapidly execute data replacement by combining with the SDRAM when cache miss occurs.
## Frame Buffer Component
Memory that saves the display contents of one part of the color display is called a frame buffer. For one screen, the display flickers when rewrite does not finish in V Blank (vertical retrace line interval). Therefore, the memory is arranged as two screens in 32X and a method is used to alternatively switch between the update screen and display screen. The frame buffer performs the switching operations with each Mbit and program.
## VDP Component
32X VDP holds the frame buffer as a control screen and controls the display of the color display. This screen combines MEGA Drive scroll A, scroll B, and sprite as one screen in the front or back. The following three modes can be selected from data formats in the frame buffer:
### Direct Color Mode
Allocates each of 16 bits to 1 pixel on the screen, of which 15 bits are used to indicate any color from 32,768 colors.
### Packed Pixel Mode
Allocates each of 8 bits to 1 pixel on the screen and colors indicated on the color palette are indirectly indicated.
### Run Length Mode
Allocates 16 bits as a collection of identically colored pixels that continue with more than 1 pixel in the direction of the scan line. Pixel numbers that are continuous with 8 of the 16 bits and colors indicated on the color palette with the remaining 8 bits are indirectly indicated.
## Color Palette Component
The color palette is a 256-word RAM block. When in the packed pixel mode or run length mode, pixel data in the frame buffer select colors (256 colors from among 32,768 colors) indirectly selected in advance.
The color selection format is the same whether selecting per frame buffer in the direct color mode, or per color palette in the run-length mode. One color is 16 bits, of which 15 bits are used, and any color can be selected from 32,768 colors. The remaining 1 bit is called a priority-bit (through-bit); pixels indicated by this bit's color are displayed opposite to the MEGA Drive screen.
## PWM Component
PWM (Pulse Width Modulation) replaces sampling data with the pulse width and outputs the pulse width. If output is through an integrated circuit, the amplitude can be controlled by the pulse width. The 32X can regenerate in stereo PCM wave data converted in advance for PWM.
---
# Chapter 3: Functions
# 3.1 Mapping
The 32X hardware can be controlled from both the main CPU SH2 and MEGA Drive 68000.
## MEGA Drive Memory Map
In using the 32X, the exclusive initial program provided by SEGA is laid out in cartridge ROM at 3FAh or more and jumped by the reset vector. To map the 32X in 68000 address space, this program sets the ADEN (address enable) bit to 1, initializes the hardware, and executes the application.
### When Power is On (ADEN = 0)
| Address Range | Contents |
|--------------|----------|
| 000000h | Custom internal ROM Vector ROM |
| 00h-FCh | (various vectors) |
| 40 0000h | See MD Manual |
| A0 0000h | - |
| A1 30ECh | Super 32X ID |
| 100 0000h | - |
### When Using Super 32X (ADEN = 1)
| Address Range | Contents |
|--------------|----------|
| 00 0000h | ROM Cartridge (vectors at 88 0200h + offset) |
| 40 0000h | See MD Manual |
| 84 0000h | Frame Buffer |
| 86 0000h | Overwrite Image |
| 88 0000h | ROM Cartridge (00 0000h-0007 FFFFh, 4 bank) |
| 90 0000h | ROM Cartridge (4 Bank Switch) |
| A0 0000h | - |
| A1 30ECh | Super 32X ID "MARS" |
| A1 30F0h | Bank Set Register |
| A1 5100h | Super 32X SYS REG |
| A1 5180h | VDP REG |
| A1 5200h | Color Palette |
| A1 5400h | - |
| 100 0000h | See MD Manual |
## ROM Access When Using the 32X
- The 68000 vector area (00 0000h - 00 00FFh) is assigned by the custom built-in ROM
- ROM contents are at 88 0200h, 88 0206h, 88 020Ch... (6-byte JUMP commands arranged into a jump table)
- Only when the RV (ROM to VRAM DMA) bit is 1 is 100h - 3F FFFFh assigned by the cartridge ROM
- When RV bit is 0, access from 88 0000h - 9F FFFFh goes to the cartridge ROM
- 88 0000h - 8F FFFFh is allocated by fixing 00 0000h - 7F FFFFh (4Mbit) of the cartridge ROM
- In 90 0000h - 9F FFFFh, a cartridge area of 32Mbits is divided into 4 banks and accessed by the bank set register
- When the 68000 and SH2 access the same area at the same time, the SH2 has priority
## Access to the 32X VDP
The FM (VDP access authorization) bit must be 0 before the MEGA Drive can access the Mars frame buffer, overwrite images, VDP register, or color palette. When the bit is 1, reads are undefined and writes are ignored. Color palette access is words only, not bytes.
## SH2 Memory Map
The 32X has two SH2 chips mounted to a common bus. Memory maps of the two chips are the same. The SH2 has built-in cache memory for increasing the speed of command and data accessing.
### Cache Address Mapping
| Cache Address | Cache Through Address | Contents |
|--------------|----------------------|----------|
| 0000 0000h | 2000 0000h | Boot ROM |
| 0000 4000h | 2000 4000h | Super 32X SYS REG |
| 0000 4100h | 2000 4100h | VDP REG |
| 0000 4200h | 2000 4200h | Color Palette |
| 0000 4400h | 2000 4400h | - |
| 0200 0000h | 2200 0000h | ROM Cartridge |
| 0240 0000h | 2240 0000h | - |
| 0400 0000h | 2400 0000h | Frame Buffer |
| 0402 0000h | 2402 0000h | Overwrite Image |
| 0404 0000h | 2404 0000h | - |
| 0600 0000h | 2600 0000h | SDRAM |
| 0604 0000h | 2604 0000h | - |
| 0800 0000h | 2800 0000h | - |
**Notes:**
- Cannot be accessed when FM = 0 (Frame Buffer and Overwrite Image)
- Color palette can access only in words
- Cannot be accessed when RV = 1 (ROM Cartridge)
- 4-word write FIFO available for Frame Buffer and Overwrite Image
## Cache Area Access
Cache memory is used for rapidly supplying commands, operands, and data to the CPU. In 32X, after commands and data are loaded into SDRAM, cache access is performed. The 32X system register and VDP register must be cache-through accessed because values can be replaced through the VDP or other CPU and the contents of the cache can no longer be guaranteed.
## Cartridge ROM Access
Only when the RV (ROM to VRAM DMA) bit is 0 can SH2 access the cartridge ROM. When the RV bit is 1 and SH2 accesses the cartridge ROM, a wait occurs until 68000 replaces the RV bit with 0. The RV bit from SH2 can only be read.
## 32X VDP Access
Only when the FM (VDP access authorization) bit is 1 can the frame buffer, overwrite images, VDP register, and color palette be accessed from the SH2 side. When the FM bit is 0, read is undefined and write is ignored. The color palette can access only in words but not in bytes.
The frame buffer and overwrite image have 4-word write FIFO and can write in 3 clock cycles. Five clock cycles are required when continuously writing 4 words or more.
---
# 3.2 Registers
32X registers are classified as shown below.
## 32X System Register [MEGA Drive]
- **Adapter control register** - Able to use 32X
- **Interrupt control register** - Issues interrupt for SH2
- **Bank set register** - ROM cartridge bank switching
- **DREQ control register** - Transfers data to SH2 DMAC
- **68 to SH DREQ Source Address register**
- **68 to SH DREQ Destination Address register**
- **68 to SH DREQ Length register**
- **FIFO register**
- **SEGA TV register** - Register signal output to cartridge register
- **Communication port register** - Communication in both directions with SH2
- **PWM Control register** - Control of PWM Sound Source
- **Cycle register**
- **L ch pulse width register**
- **R ch pulse width register**
- **Mono pulse width register**
## 32X System Register [SH2]
- **Interrupt mask register** - Interrupt control for SH2
- **H Count register**
- **VRES interrupt clear register**
- **V interrupt clear register**
- **H interrupt clear register**
- **CMD interrupt clear register**
- **PWM interrupt clear register**
- **Standby changer register** - 32X custom component activation
- **DREQ control register** - MEGA Drive data received by DMAC of SH2
- **68 to SH DREQ Source Address register**
- **68 to SH DREQ Destination Address register**
- **68 to SH DREQ Length register**
- **FIFO register**
- **SEGA TV register**
- **Communication port register**
- **PWM Control register**
- **Cycle register**
- **L ch pulse width register**
- **R ch pulse width register**
- **Mono pulse width register**
## VDP Register
- **Bitmap Mode register** - Display mode selection, Frame buffer switch
- **Frame buffer control register**
- **Screen shift control register** - Screen shift
- **Auto Fill Length register** - Data fill for frame buffer
- **Auto Fill Start Address register**
- **Auto Fill Data register**
---
# 3.2.1 System Registers [MEGA Drive side]
## Adapter Control Register (Access: Byte/Word)
**Address:** A1 5100h
| Bit | 15 | 14-8 | 7 | 6-2 | 1 | 0 |
|-----|-----|------|---|-----|---|---|
| Field | FM | - | REN | - | RES | ADEN |
| R/W | R/W | Read only | R/W | - | R/W | R/W |
**FM: VDP Access Authorization**
- 0: MD (Initial value)
- 1: SH2
**REN: SH2 Reset Enable**
- 0: Disable
- 1: Enable
**RES: Resets SH2**
- 0: Reset
- 1: Cancel reset (initialization by initial program, change not allowed)
**ADEN: Adapter Enable Bit**
- 0: Prohibits use of 32X
- 1: Permits use of 32X (initialization by initial program, change not allowed)
**Important:** Switching access authorization is done while writing to the FM bit. Be aware that if writing to the FM bit is done by MEGA Drive while SH2 accesses VDP, access authorization is forced to switch to MEGA Drive.
## Interrupt Control Register (Access: Byte/Word)
**Address:** A1 5102h
| Bit | 15-2 | 1 | 0 |
|-----|------|---|---|
| Field | - | INTS | INTM |
| R/W | - | R/W | R/W |
**INTS: Slave SH2 Interrupt command**
- 0: NO OPERATION (initial value)
- 1: Interrupt command
**INTM: Master SH2 interrupt command**
- 0: NO OPERATION (initial value)
- 1: Interrupt command
Both are automatically cleared if SH2 does not interrupt clear.
## Bank Set Register (Access: Byte/Word)
**Address:** A1 5104h
| Bit | 15-2 | 1 | 0 |
|-----|------|---|---|
| Field | - | BK1 | BK0 |
| R/W | - | R/W | R/W |
**Bank Selection:**
| BK1 | BK0 | Data seen in 90 0000h - 9F FFFFh |
|-----|-----|----------------------------------|
| 0 | 0 | 00 0000h - 0F FFFFh (initial value) |
| 0 | 1 | 10 0000h - 1F FFFFh |
| 1 | 0 | 20 0000h - 2F FFFFh |
| 1 | 1 | 30 0000h - 3F FFFFh |
## DREQ Control Register (Access: Byte/Word)
**Address:** A1 5106h
| Bit | 15-8 | 7 | 6-3 | 2 | 1 | 0 |
|-----|------|---|-----|---|---|---|
| Field | - | FULL | - | 68S | 0 | RV |
| R/W | - | Read only | - | R/W | - | R/W |
**FULL: DMA FIFO Full**
- 0: Can write
- 1: Cannot write
**68S: Mode**
- 0: No Operation
- 1: CPU Write (68K writes data in FIFO)
The internal system starts operation when 68S is 1. Writing 0 force-ends the operation. It is automatically set to 0 after DMA ends.
**RV: ROM to VRAM DMA**
- 0: NO OPERATION (initial value)
- 1: DMA Start Allowed
The SH2 side cannot access the ROM when RV = 1. Waits until value becomes 0 (RV = 0) before accessing.
## 68K to SH DREQ Source Address Register (Access: Word)
**Address:** A1 5108h (High Order), A1 510Ah (Low Order, bit 0)
Because the DREQ circuit does not use this data, nothing needs to be set at the time of CPU WRITE.
## 68K to SH DREQ Destination Address Register (Access: Word)
**Address:** A1 510Ch (High Order), A1 510Eh (Low Order, bit 0)
Sets the SH2 side (SDRAM) address. The DREQ circuit does not use this data. When the destination address is known beforehand by SH2, or when SH2 doesn't need to know, no settings are needed.
## 68K to SH DREQ Length Register (Access: Word)
**Address:** A1 5110h
| Bit | 15-2 | 1-0 |
|-----|------|-----|
| Field | Length | 0 |
| R/W | R/W | - |
Sets the number of data items (unit: word) to be sent to SH2 side. The value to be set is in 4-word units. Low order 2 bits write is ignored (00 fixed). Be sure to set this register for CPU WRITE. At each transfer, this register is decremented and when it becomes 0, the DREQ operation ends. Transfer is done 65,536 times when 0 is set. Read time reads the actual count value.
## FIFO Register (Access: Word)
**Address:** A1 5112h
Data is written to this register when DREQ is used by CPU WRITE.
## SEGA TV Register (Access: Byte/Word)
**Address:** A1 511Ah
| Bit | 15-1 | 0 |
|-----|------|---|
| Field | - | CM |
| R/W | - | R/W |
**CM: Cartridge Mode**
- 0: ROM (initial value)
- 1: DRAM
This is a SEGA TV exclusive register; use of this bit with other applications is prohibited.
## Communication Port (Access: Byte/Word)
**Addresses:** A1 5120h, A1 5122h, A1 5124h, A1 5126h, A1 5128h, A1 512Ah, A1 512Ch, A1 512Eh
This is an 8-word bi-directional register. Read/write is possible from the MEGA Drive and SH2 directions, but when writing the same register from both at the same time, the value of that register becomes undefined. Caution is advised.
## PWM Control Register (Access: Byte/Word)
**Address:** A1 5130h
| Bit | 15-12 | 11-8 | 7 | 6-4 | 3-0 |
|-----|-------|------|---|-----|-----|
| Field | - | TM3-0 | RTP | - | RMD0, RMD1, LMD0, LMD1 |
| R/W | - | Read only | Read only | - | R/W |
**TM3-0: PWM timer interrupt interval** (Read only from MD side; set from SH2 side)
**RTP: DREQ1 occurrence enable (SH2 side only)** (Read only from MD side)
- 0: OFF (initial value)
- 1: ON
**Output Configuration:**
| RMD0 | RMD1 | OUT | LMD0 | LMD1 | OUT |
|------|------|-----|------|------|-----|
| 0 | 0 | OFF | 0 | 0 | OFF |
| 0 | 1 | R | 0 | 1 | L |
| 1 | 0 | L | 1 | 0 | R |
| 1 | 1 | Not allowed | 1 | 1 | Not allowed |
Both cannot be set to L ch or R ch.
## Cycle Register (Access: Byte/Word)
**Address:** A1 5132h
The base clock frequency of the cycle registers are fixed respectively:
- **NTSC:** 23.01MHz (set value × Scyc becomes the cycle)
- Scyc = 1/23.01 [MHz]
- **PAL:** 22.8MHz (set value × Scyc becomes the cycle)
- Scyc = 1/22.8 [MHz]
The cycle counter does not operate when both L ch and R ch are off.
## L ch Pulse Width Register (Access: Byte/Word)
**Address:** A1 5134h
| Bit | 15 | 14 | 13-12 | 11-0 |
|-----|-----|-----|-------|------|
| Field | FULL | EMPTY | - | Pulse Width |
| R/W | Read only | Read only | - | Write only |
The value set by bit 11-0 × Scyc becomes the pulse width.
**FULL: Conditions of pulse width FIFO**
- 0: Space available
- 1: No space available
**EMPTY: Conditions of pulse width FIFO**
- 0: Data per FIFO
- 1: No data per FIFO
## R ch Pulse Width Register (Access: Byte/Word)
**Address:** A1 5136h
See explanation of L ch pulse width register.
## Mono Pulse Width Register (Access: Byte/Word)
**Address:** A1 5138h
See explanation of L ch pulse width register. If writing to this register, the same value is written to both L ch and R ch.
**Note:** Bits D0-D11 of all L ch, R ch, and MONO pulse width registers are write only. When read is performed, undefined data is read. Each PWM of L ch and R ch have three separate FIFO steps. When both L and R channels are off, because the cycle counter does not operate, once the FULL bit is set to 1, it will not become 0 as long as the channels are not turned on. When either L or R channel is on, because the OFF side FIFO is also operating, no sound will be output; however, data within FIFO will disappear. If writing when FIFO is FULL, the oldest data is discarded and shift occurs one item at a time.
---
# 3.2.2 System Registers [SH2 side]
## Interrupt Mask Register (Access: Byte/Word)
**Address:** 2000 4000h
| Bit | 15 | 14-10 | 9 | 8 | 7 | 6-4 | 3 | 2 | 1 | 0 |
|-----|-----|-------|---|---|---|-----|---|---|---|---|
| Field | FM | - | ADEN | CART | HEN | - | V | H | CMD | PWM |
| R/W | R/W | - | R/W | Read only | R/W | - | R/W | R/W | R/W | R/W |
**FM: VDP Access Authorization**
- 0: MEGA DRIVE (initial value)
- 1: SH2
**ADEN: Adapter enable bit**
- 0: The 32X use prohibited
- 1: The 32X use allowed
**CART: Cartridge insert condition**
- 0: Inserted
- 1: Not inserted
**HEN: H INT approval within V Blank**
- 0: H INT not approved (initial value)
- 1: H INT approved
**V: V INT Mask**
- 0: Mask (initial value)
- 1: Valid
**H: H INT Mask**
- 0: Mask (initial value)
- 1: Valid
**CMD: Command Interrupt Mask**
- 0: Mask (initial value)
- 1: Valid
**PWM: PWM timer interrupt mask**
- 0: Mask (initial value)
- 1: Valid
This register is mapped to the same address for both SH2 master and slave. However, V, H, CMD, and PWM each possess exclusive addresses on the master side and the slave side. Other bits are common to both master and slave. **Important:** If a 1 is written to the FM bit, access authorization is forced to switch to the SH2 side, even if access of VDP is in progress on the MEGA Drive side.
## H Count Register (Access: Byte/Word)
**Address:** 2000 4004h
Sets H Int occurrence interval. Designates by the number of lines. 0 = each line (initial value).
## VRES Interrupt Clear Register (Access: Word)
**Address:** 2000 4014h
Clears VRES interrupt (interrupt caused by pressing the MEGA Drive reset button). If not cleared, interrupt will no longer occur.
## V Interrupt Clear Register (Access: Word)
**Address:** 2000 4016h
Clears V interrupt. If not cleared, interrupt will no longer occur.
## H Interrupt Clear Register (Access: Word)
**Address:** 2000 4018h
Clears H interrupt. If not cleared, interrupt will no longer occur.
## CMD Interrupt Clear Register (Access: Word)
**Address:** 2000 401Ah
Clears CMD interrupt (command interrupt). If not cleared, interrupt will no longer occur.
## PWM Interrupt Clear Register (Access: Word)
**Address:** 2000 401Ch
Clears PWM interrupt (command interrupt). If not cleared, interrupt will no longer occur.
## Points to Be Aware of Concerning Interrupts
1. **32X Interrupt Types:** VRESINT, VINT, HINT, CMDINT, and PWMINT
- **CMDINT differs from other interrupts:**
- **VRES INT, VINT, HINT, PWMINT:** INT continues to occur until each INT is cleared
- **CMDINT:** INT is negated. But when CMDINT is enabled after CMDINT is not received, CMDINT is again asserted.
2. **HEN (HINT authorization bit during V Blank)** inside the interrupt mask register of SH2 is common in both Master and Slave. The HINT occurrence interval is affected by this HEN bit.
3. The value set in the H Count register is enabled as the next H Blank occurs, after being loaded in the internal counter when H Blank is negated. The internal counter generates HINT as a result of the count, but when H Blank is negated the H Count register value is reloaded. Therefore, when the H Count register is set when H Blank does not occur (because it is not loaded in the internal counter until the next H Blank occurs), HINT may occur according to the value prior to setting the H Count.
**Examples:**
1. When H Count register = 0, 1 is set in the H Count register during H Blank. When HEN = 0, HINT occurs within the second H Blank after the existing H Blank is negated.
2. H Count register = 0 and H Count is set to 1 when H Blank does not occur. When HEN = 0, HINT occurs during the next H Blank. HINT occurs during the 2nd H Blank after the H Blank is negated because the H Count register setting (value) is loaded in the internal counter when this H Blank is negated.
## Interrupt Sources and Priority Levels
There are five ways an interrupt can be created on the SH2:
1. Pressing the MEGA Drive reset button (VRES)
2. During vertical feedback (V Blank)
3. During horizontal feedback (H Blank)
4. Interrupt control register write from MEGA Drive (CMD)
5. PWM cycle timer
Each interrupt is cleared when written to an interrupt clear register by a different factor. Interrupt continues indefinitely until cleared.
Mask/enable is allowed separately by setting the interrupt mask register V, H, CMD, and PWM bits except for the reset button. These four bits have separate registers for master/slave.
**Interrupt Priority Order (SH2 IRL auto vector):**
(Reset button) > (V Blank) > (H Blank) > (Command interrupt) > (PWM cycle timer)
| Name | Mask Bit | Level | Interrupt Factor |
|------|----------|-------|------------------|
| VRES Interrupt | none | 14 | Reset button |
| V Interrupt | V | 12 | V Blank |
| H Interrupt | H | 10 | H Blank |
| Command Interrupt | CMD | 8 | Interrupt control register write from MD |
| PWM Interrupt | PWM | 6 | PWM cycle timer |
**Note:** HEN (HINT enable bit inside V Blank) in the interrupt mask register is common master/slave.
**Cross-Reference:** See [32x-hardware-manual-supplement-2.md](32x-hardware-manual-supplement-2.md) for the SH2 interrupt hardware bug and required corrective action (FRT TOCR toggle).
---
# 3.3 68000-SH2 Communication
## Communication Architecture
```
INTM
┌────────────────────┐
│ INTS │
│ │
│ 8 Word │ SH2
MEGA ◄──────►│ Communication │◄──────► Master
Drive │ Port │
│ │
○───────┤ │
○───┤ │ SH2
│ 4 Word FIFO │◄──────► Slave
○───────┤ │
○───┤ │
│ 4 Word FIFO │
└────────────────────┘
Figure 3.28 68000 and SH2 Communication
```
## Communication Port
The 32X has an 8 word register that can read and write from both "communication ports" used in 68000 and SH2 communication. After the power is turned on, the boot ROM program, following its completion of the initialization and security, notifies the 68000, and as a result, the SH2 master writes "M_OK" (ASCII code 4 bytes) to the start of the communication port, and the slave writes "S_OK" to the 2nd and 3rd words.
Communication ports from here after are opened in the application. If simultaneously writing the same register from both the 68000 and SH2, or if either the 68000 or SH2 is writing while the other is reading, the value of that register becomes undefined. As a result, dividing the register to be used as SH2 → 68000 and 68000 → SH2 must be avoided.
## CMD Interrupt
When timing by both 68000 and SH2, not only can communication ports be polled together but interrupt can occur from 68000 to SH2. INTM and INTS bits of the interrupt control register correspond to the master side SH2 and the slave side SH2. CMD interrupt occurs if 68000 is set to 1. Interrupt can be cleared if SH2 writes the CMD interrupt clear register. Mask/mask cancel (0/1) can be done by the CMD bit of the interrupt mask register. The CMD interrupt clear register and CMD bit are held separately by the master and slave (addresses are the same). There are no interrupts from SH2 to 68000.
## DMA (DREQ Transfer)
SH2 has a 2 channel DMA built-in to it. When the 32X uses channel 0 from among the two channels, data can be transferred from the MEGA Drive side to the SH2 side. The 32X has a DREQ circuit for issuing transfer requests to channel 0 and a FIFO for continuously transferring data. FIFO can be directly written to by the 68000.
---
# 3.4 32X Block Access by SH2
## Cache-through Access
System and VDP registers must be accessed by cache-through. Although system design also allows access by cache, because there is no guarantee that data of an external device or register which could be re-written by other processors would agree with cache data, cache purge becomes necessary each time. Therefore, cache cannot be used.
## VDP Access Competition
When accessing from the SH2 to the VDP register, frame buffer and color palette, access waits until the FM bit (interrupt mask register bit 15) is 1. After an access series has ended, the FM bit becomes 0 and access authorization changes to 68000. This being the case, SH2 and 68000 wait together until access authorization returns and accesses. When finished, competition can be avoided by returning access authorization to the opponent.
When the FM bit from SH2 is "1", access from 68000 is interrupted by force and the operation that follows is not guaranteed.
## ROM Access Competition
SH2 has priority when 68000 and SH2 access the cartridge ROM at the same time. When this happens, the second CPU to be accessed waits until access of the first CPU is finished.
When the 68000 directly accesses contents of the cartridge ROM by the CPU, SH2 can restore high speeds by accessing after the contents of the ROM cartridge is once loaded to the SDRAM. As a result, SH2 access ROM data sporadically in certain amounts, whereas ROM access by 68000 occurs regularly. When there is a problem in executing 68000 program interrupted by ROM access wait, the RV bit (DREQ control register bit 0) is set to 1. Here, ROM access from SH2 is in a wait status until 68000 RV = 0. The bit from SH2 is read only.
## 32X Buffer Register Access Table
| Object | Use | Z80 | Buffer Register | Description |
|--------|-----|-----|-----------------|-------------|
| **SH2 dedicated** | SH2 built-in IO, DMA, main memory | | SDRAM | Read operation internal 16 byte fixed |
| | 32X standby | | Standby change | Boot time custom component |
| | Interrupt (mask clear) | | H Count | H interrupt interval |
| | | | Interrupt mask | Use here without mask by SH2 internal |
| | | | VRES interrupt clear | Clear interrupt by MEGA Drive reset button |
| | | | V interrupt clear | |
| | | | H interrupt clear | |
| | | | CMD interrupt clear | Clear interrupt from 68000 |
| | | | PWM interrupt clear | Sampling data write timing |
| | DMA transfer (receive) | | DREQ control Reg | Set "Capture" (See dedication) |
| | | | 68 to SH DREQ Source Address | |
| | | | 68 to SH DREQ Destination Address | |
| | | | 68 to SH DREQ Length | |
| | | | FIFO | Transfer request execute to SH2 DMA (read) |
| **68000 Dedicated** | 32X Use | V | Adapter Control Reg | 32X is mapped by address space |
| | Cartridge ROM access | V | Bank Set Reg | Mapping differs for the single MD |
| | DRAM cartridge | | SEGA TV Reg | Refresh signal output to cartridge |
| | Interrupt Execute | V | Interrupt Control Reg | Interrupt execute in SH2 |
| | DMA transfer (send) | V | DREQ Control Reg | Set "Capture" |
| | | | 68 to SH DREQ Source Address | |
| | | | 68 to SH DREQ Destination Address | |
| | | | 68 to SH DREQ Length | |
| | Write by DMA/CPU | | FIFO | Transfer request execute to SH2 DMA (write) |
| **SH2/68000 Common** | Communication | V | Communication Port | Read/Write is possible from both |
| | Sound | V | PWM Control | Timer interrupt set for SH2 |
| | | V | Cycle Register | Sound source sampling cycle |
| | | V | L ch Pulse Width register | Sampling data write |
| | | V | R ch Pulse Width register | |
| | | V | Mono Pulse Width register | |
| | Graphics | V | Bitmap Mode | Packed pixel / Direct color / Run length |
| | | V | Frame Buffer Control | Draw / Display Switch, see VDP operate status |
| | | V | Screen Shift Control | Horizontal scroll of packed pixel mode |
| | | V | Frame Buffer | Draw memory |
| | | | Color Palette | Use when indirectly indicating colors on draw memory |
| | | | Auto Fill Length | Frame buffer data Fill |
| | | | Auto Fill Start Address | |
| | | | Auto Fill Data | |
**Note:** V mark means access from Z80 is possible.
---
# 3.5 32X Block Access by 68000
## Blocks that can be directly accessed
After the power is turned on, address space of 68000 is mapped the same as the MEGA Drive unit. If the 32X initial program provided by SEGA is installed following the POWER ON reset vector address, 32X is mapped at the time the execution is transferred to the application program, and is initialized in an access-enabled status.
See Table 4.1 "32X Buffer Register List" in section 4.1 for individual buffer registers.
## Cartridge ROM Access When Using the 32X
ROM cartridge 00 0000h – 40 0000h is mapped unchanged in 68000 address space 00 0000h – 40 0000h when using the MEGA Drive unit. But when using the 32X, mapping is done on and after 88 0000h when execution is handled by application program.
| 68000 Address | Cartridge ROM |
|---------------|---------------|
| 88 0000h ~ 8F FFFFh | 00 0000h ~ 07 FFFFh |
| 90 0000h ~ 9F FFFFh | 00 0000h ~ 0F FFFFh (initial condition) |
| (4 bank switching) | 10 0000h ~ 1F FFFFh |
| | 20 0000h ~ 2F FFFFh |
| | 30 0000h ~ 3F FFFFh |
---
# 3.6 32X Block Access by Z80
## Blocks that can be directly accessed
Z80 is loaded as the MEGA Drive sound CPU. Even when 32X is mapping in the 68000 address space, 68000 memory area can access each 8000h by switching banks similar to when using the Mega Drive unit. See Table 4.1 "32X Buffer Register List" in section 4.1 for individual buffer registers.
## Competition with other CPUs
Access competition to the 32X block of 68000 and SH2 applies to both Z80 and SH2. See section 4.2 for more information.
## Frame Buffer Access
Frame buffer can be written in bytes but data 0 byte write is ignored (Same for write from both 68000 and SH2).
---
# 4.1 Access Timing of each CPU to 32X Block
The timing sequence when the CPU accesses the peripheral is called a bus cycle, and takes a minimum of 4 Clock with 68000 and 2 Clock with SH2*. In addition, wait time is created on the CPU side due to the difference of the peripheral and operating speeds. 1 Wait means that the minimum bus cycle + 1 Clock is necessary in the access. A wait is required for all 32X blocks (as shown below) to access from 68000 and SH2 in response to the process contents and operation status.
**\* Note:** Besides inputting a Wait signal from the outside, SH2 can input Wait by setting the built-in bus state controller, but after implementing boot ROM only external Wait is set.
## 32X Mode and Cartridge ROM
| CPU | Wait States |
|-----|-------------|
| SH2 (Read/Write) | 6 wait (min) ~ 15 wait (max) |
| 68K (Read/Write) | 0 wait (min) ~ 5 wait (max) |
## Frame Buffer
| CPU | Operation | Wait States |
|-----|-----------|-------------|
| SH2 | Read | 5 wait (min) ~ 12 wait (max) |
| SH2 | Write | 1 wait (min) ~ 3 wait (max) |
| 68K | Read | 2 wait (min) ~ 4 wait (max) |
| 68K | Write | 0 wait (const) |
Write access to the SH2 frame buffer assumes continuous accessing without an Idle Cycle. When the Idle Cycle is inserted between accesses, the next access time is shortened only by the number entered by the Idle Cycle. (The next access time cannot be shorter than a minimum cycle of 3 clock)
**Frame Buffer Write FIFO:** A 4 word component of FIFO is held for frame buffer writing. Thus, **5 Clock is required if FIFO is FULL** and **3 Clock is required if FIFO is not FULL**.
## Palette
| CPU | Operation | Wait States |
|-----|-----------|-------------|
| SH2 | Read/Write | 5 wait (min) ~ 64µsec |
| 68K | Read | 2 wait (min) ~ 64µsec |
| 68K | Write | 3 wait (min) ~ 64µsec |
Wait number 64µsec means that a wait of a 1 line component display is required. (If access to the palette competes with the CPU and VDP, a wait of a 1 line component is required on the CPU side.)
## VDP Register
| CPU | Operation | Wait States |
|-----|-----------|-------------|
| SH2 | Read/Write | 5 wait (const) |
| 68K | Read | 2 wait (const) |
| 68K | Write | 0 wait (const) |
## System Register
| CPU | Operation | Wait States |
|-----|-----------|-------------|
| SH2 | Read/Write | 1 wait (const) |
| 68K | Read/Write | 0 wait (const) |
## Boot ROM
| CPU | Operation | Wait States |
|-----|-----------|-------------|
| SH2 | Read | 1 wait (const) |
## SDRAM Access Time
The 32X SDRAM is specialized for the "replace" in the case of the SH2 cache miss, and read transfers in the 8 word burst mode* while write transfers in the 1 word single mode. Access time is fixed at the following values:
| Operation | Timing |
|-----------|--------|
| Read | 12 Clock / 8 Word |
| Write | 2 Clock / 1 Word |
**\* 8-Word burst mode:** A read operation that takes data in batches of 8 word components from the first address specified by the word address. Because 8 word corresponds to a single line cache, there will be conformity when a cache miss occurs and line data is replaced. But when the SDRAM is read using cache-through, even if the data to be read is only a single word, the access operation to the SH2 SDRAM is 8-word-burst-read-fixed, and action time is required by that amount.
---
## StandBy Changer Register (Access: Word)
**Address:** 2000 4002h
Use with system (Boot ROM). Access to this register from the application is prohibited.
## DREQ Control Register (Access: Byte/Word)
**Address:** 2000 4006h
| Bit | 15 | 14 | 13-3 | 2 | 1 | 0 |
|-----|-----|-----|------|---|---|---|
| Field | FULL | EMPTY | - | 68S | 0 | RV |
| R/W | Read only | Read only | - | Read only | - | Read only |
**FULL: Frame Buffer, Write Cache Full**
- 0: Space
- 1: No Space
**EMPTY: Frame Buffer, Write Cache Empty**
- 0: Data
- 1: No Data
See explanation of MEGA Drive register for more.
## 68K to SH DREQ Source Address Register (Access: Word)
**Address:** 2000 4008h (High Order), 2000 400Ah (Low Order, bit 0)
See explanation of MEGA Drive register.
## 68K to SH DREQ Destination Address Register (Access: Word)
**Address:** 2000 400Ch (High Order), 2000 400Eh (Low Order, bit 0)
See explanation of MEGA Drive register.
## 68K to SH DREQ Length Register (Access: Word)
**Address:** 2000 4010h
See explanation of MEGA Drive register.
## FIFO Register (Access: Word)
**Address:** 2000 4012h
See explanation of MEGA Drive register.
## Communication Port Register (Access: Byte/Word)
**Addresses:** 2000 4020h, 2000 4022h, 2000 4024h, 2000 4026h, 2000 4028h, 2000 402Ah, 2000 402Ch, 2000 402Eh
See explanation of MEGA Drive register.
## PWM Control Register (Access: Byte/Word)
**Address:** 2000 4030h
See explanation of MEGA Drive register.
TM0-3 set the PWM timer interrupt interval and ROM to PWM transfer cycle. Interrupt occurs by cycle register set value × TM cycle. When TM = 1, the interval is the same as the cycle register. When TM = 0, the interval is 16 times the cycle register.
## Cycle Register (Access: Byte/Word)
**Address:** 2000 4032h
See explanation of MEGA Drive register.
## L ch Pulse Width Register (Access: Byte/Word)
**Address:** 2000 4034h
See explanation of MEGA Drive register.
## R ch Pulse Width Register (Access: Byte/Word)
**Address:** 2000 4036h
See explanation of MEGA Drive register.
## Mono Pulse Width Register (Access: Byte/Word)
**Address:** 2000 4038h
See explanation of MEGA Drive register.
---
# 3.2.3 VDP Registers (Both MEGA Drive and SH2 Common)
## Bitmap Mode Register (Access: Byte/Word)
**MD Side:** A1 5180h
**SH Side:** 2000 4100h
| Bit | 15 | 14 | 13 | 12-8 | 7 | 6-2 | 1 | 0 |
|-----|-----|-----|-----|------|---|-----|---|---|
| Field | PAL | - | PRI | - | 240 | - | M1 | M0 |
| R/W | Read only | - | R/W | - | R/W | - | R/W | R/W |
**PAL: TV format**
- 0: PAL
- 1: NTSC
Switching is possible only during V Blank.
**PRI: Screen priority**
- 0: MEGA Drive has priority (initial value)
- 1: 32X has priority
Switching is always allowed, but is valid from the next line.
**240: 240 Line Mode** (Valid only when PAL)
- 0: 224 Line (initial value)
- 1: 240 Line
**Mode Selection:**
| M1 | M0 | Mode |
|----|-----|------|
| 0 | 0 | Blank Mode (initial value) |
| 0 | 1 | Packed Pixel Mode |
| 1 | 0 | Direct Color Mode |
| 1 | 1 | Run Length Mode |
Switching is always allowed, but is valid from the next line.
## Frame Buffer Control Register (Access: Byte/Word)
**MD Side:** A1 518Ah
**SH Side:** 2000 410Ah
| Bit | 15 | 14 | 13 | 12-2 | 1 | 0 |
|-----|-----|-----|-----|------|---|---|
| Field | VBLK | HBLK | PEN | - | FEN | FS |
| R/W | Read only | Read only | Read only | - | Read only | R/W |
**VBLK: V Blank**
- 0: During display period
- 1: During V Blank
**HBLK: H Blank**
- 0: During display period
- 1: During H Blank
**PEN: Palette Access Approval**
- 0: Access denied
- 1: Access approved
**FEN: Frame Buffer Authorization**
- 0: Access approved
- 1: Access denied (FILL in progress)
**FS: Frame Buffer Swap**
- 0: Transfers DRAM0 to VDP side (initial value)
- 1: Transfers DRAM1 to VDP side
Swapping the Frame Buffer is allowed during V Blank (VBLK = 1) or when in blank mode. However, writing the FS bit is always allowed, and when written during display, swapping is done at the next V Blank. With respect to read, the value which indicates DRAM during display until the next V Blank is returned.
When having swapped the Frame Buffer, be sure to access the Frame Buffer after confirming that VBLK = 1 or FS bit has changed.
When having performed FILL, be sure to access the Frame Buffer after confirming that FEN is equal to 0.
Palette access is possible only during H and V blank.
Palette can access whenever the bitmap mode is in the direct color mode, as well as during Blank.
## Screen Shift Control Register (Access: Byte/Word)
**MD Side:** A1 5182h
**SH Side:** 2000 4102h
| Bit | 15-1 | 0 |
|-----|------|---|
| Field | - | SFT |
| R/W | - | R/W |
**SFT: Screen 1 dot left shift**
- 0: OFF
- 1: ON
Switching is allowed at any time, but is valid from the next line.
## Auto Fill Length Register (Access: Byte/Word)
**MD Side:** A1 5184h
**SH Side:** 2000 4104h
Word length when filling DRAM (frame buffer). To set this value, set the value for the to-be-filled word length - 1 (0-255).
**Note:** The Auto Fill function will be explained later.
## Auto Fill Start Address Register (Access: Word)
**MD Side:** A1 5186h
**SH Side:** 2000 4106h
| Bit | 15 | 14-8 | 7-0 |
|-----|-----|------|-----|
| Field | A16 | A15-A9 | A8-A1 |
| R/W | R/W | R/W | R/W |
Sets the start address of the area to be filled. A16-A9 remain as fixed, but A8-A1 are incremented at each Fill.
## Auto Fill Data Register (Access: Word)
**MD Side:** A1 5188h
**SH Side:** 2000 4108h
Sets data to be filled. The Fill operation begins when setting this register.
---
# 3.3 VDP
32X VDP controls the color display and has two 1 Mbit frame buffer surfaces for control display screens. Display (to the display screen) is synthesized and composed contextually of a single screen (plane) from these screens and the existing MEGA Drive screen.
## Display Mode
Enables output of images that correspond to the NTSC format (Japan, USA) and the PAL format (Western Europe). When the 32X image output is not blank, the MEGA Drive display mode should select a resolution that is equal to the 32X resolution.
### Display Mode Possible Combinations
| 32X | MD |
|-----|-----|
| **Non-blank Graphic V**
320 × 224 pixels | 40 × 28 cells (320 × 224 pixels) |
| **Non-blank Graphic V**
320 × 240 pixels | 40 × 30 cells (320 × 240 pixels) |
| **Blank** | Graphics IV 32 × 28 (256 × 192 pixels)
Graphics V 32 × 28 cells (256 × 224 pixels)
40 × 28 cells (320 × 224 pixels)
32 × 30 cells (256 × 240 pixels)
40 × 30 cells (320 × 240 pixels) |
## VDP Configuration
VDP is mapped from SH2 address 2000 4100h and 2400 0000h. These exist as I/O devices for the CPU. As a result, accessing without the color palette is only a cache-through address.
### VDP Memory Map
| SH (cache-through) | Component |
|-------------------|-----------|
| 2000 4100h | VDP Register - Bitmap mode |
| 2000 4102h | Screen Shift Control |
| 2000 4104h | Auto Fill Length |
| 2000 4106h | Auto Fill Start Address |
| 2000 4108h | Auto Fill Data |
| 2000 410Ah | Frame Buffer Control |
| 2000 410Ch | Reserve |
| 2000 4200h | Color Palette |
| 2000 4400h | - |
| 2400 0000h | DRAM (1Mbit) |
| 2402 0000h | Over Write Image |
| 2404 0000h | - |
## VDP Register
The VDP register controls RAM block access, the VDP mode, priority, etc. The VDP register is read to the VDP display circuit when a horizontal return line is complete. Consequently, after the register is set, the settings from the next line become valid for the bitmap mode and screen shift control.
## Color Palette
The color palette is a RAM block that designates display colors. A cache address is possible. This block must always be word accessed.
## DRAM
Also called a frame buffer, DRAM stores line tables and bit pattern data for each line. Mapping is done for either DRAM0 or DRAM1. This block can write 8-bit or 16-bit widths. Write speeds are all the same, but 0 cannot be written in byte access.
## Over Write Image
Data write can also be done from this area to the frame buffer. Because there is specialization in character overwrite, if the significant or insignificant byte of data is 0 when accessing by word, only that part ignores overwrite and holds the original value. This block can write in 8-bit or 16-bit widths. Write speeds are all the same, but 0 cannot be written in byte access.
## Switching Frame Buffers
By switching the FS bit, the DRAM drawn previously by the CPU is transferred to the VDP and the contents are displayed. In addition, DRAM that has been displayed is mapped instead in the address space, allowing the draw. For instance, animation can be displayed repeatedly per each single frame (1/60 sec), and for the period equivalent to a single frame (1/60 sec), write process can continue. Frame buffer can be switched only in VBlank. During display, even when writing to the FS bit, the buffer does not switch until VBlank occurs. The FS bit, when read, returns the buffer selected on the current display side. DRAM access should take place after confirming that VBLK=1, or the FS bit has been switched.
## Color Palette
There is one DRAM0 and DRAM1 common color palette in the 32X, and 0-255 palette code can be specified per each pixel. The color data format is 16-bit:
**Color Format:**
- **Bit 15:** Through bit (priority)
- **Bits 14-10:** Blue (5 bits, 32 tones, 1Fh max to 00h min)
- **Bits 9-5:** Green (5 bits, 32 tones, 1Fh max to 00h min)
- **Bits 4-0:** Red (5 bits, 32 tones, 1Fh max to 00h min)
- **Total:** 32 × 32 × 32 = 32,768 colors
The color for each pixel can be directly selected (when in direct color mode), but data size can be kept down by indirect-selecting using the 8-bit palette code.
**Note:** Palette access is possible when PEN = 1 (Frame Buffer Control Register). If accessing when PEN = 0, wait is held until PEN = 1. Also, when PEN goes from 1 to 0, the written value is not guaranteed. When the color is directly selected, color palette can always be accessed.
## Over Write Image
Allows RAM block that is physically identical to the DRAM area to be accessed from this area. When writing data from this area, data on the frame buffer is not changed and remains in its original state when 00h is written in 1 byte units.
## Overview of Display Specifications
| Feature | Specification |
|---------|--------------|
| **Display Size** | 320 pixels × 224 pixels or 320 pixels × 240 pixels (non-interlace mode only) |
| **Display Colors** | 32,768 color direct or 256 colors from 32,768 colors (color palette) |
| **Frame Buffer** | 1Mbit DRAM × 2 (Line Table Format) |
| **Draw Modes** | Direct Color Mode (16 bit/1 pixel, 32K color direct)
Packed Pixel Mode (8 bits/1 pixel, 256 of 32K colors)
Run Length Mode (16 bits/continuous same color pixels, 256 of 32K colors) |
| **Priority** | Combine with MEGA Drive screen
32X screen is synthesized in front or back of MD scroll A, B, and sprites |
| **Other** | Supports DRAM FILL at VDP side |
## Line Table Format
There are 256 words in the line table in the frame buffer lead. When writing an address in which pixel data for each line is entered, that line is displayed. The data format following that address can select three modes. Mode selection is set by combining VDP register bits M1 and M0.
**Mode Selection:**
- (M1, M0) = (0, 0): Blank display
- (M1, M0) = (0, 1): Packed pixel mode
- (M1, M0) = (1, 0): Direct color mode
- (M1, M0) = (1, 1): Run length mode
**Display Precautions:** VDP mechanically displays 320 pixels worth of data from the address specified per the line table. Consequently, caution is required since the overwrite image area data is displayed as is when there is no DRAM area for 320 pixels worth of data after the specified address.
## Priority
Select whether or not to use the PRI bit of the VDP register, and whether the 32X is to be displayed in front of or behind the MD screen. Also, each through-bit (1-bit) is added to the color data. If the PRI bit is used, the pixel that designated the color is displayed in the side opposite of the MD screen. When the MD color code is 0, and when the 32X designates blank by the VDP register, each becomes transparent and the MD background is displayed.
## Direct Color Mode
This mode directly expresses data of each line from the pixel in the left corner of the screen by each through bit B, G, R (16-bit). From the size of the frame buffer at 320 words per 1 line:
1 Mbit = 65,536 words = 256 words + 320 × 204 words
Only 204 lines can be displayed. The number of lines can be increased by making identical line data to be common.
## Packed Pixel Mode
This mode indirectly expresses data of each line by individual color palette codes (8-bit) from pixels in the left corner of the screen.
Since two pixels are expressed by 1 word, and 1 line contains 160 words:
1 Mbit = 65,536 words = 256 words + 160 × 408 words
It is possible to have 408 lines of display data.
## Screen Shift Control
Because of word units, address data that can be set in the line table can change the table only in 2-dot units when in the packed pixel mode. As a result, use the screen shift control bit (SFT) to change the display position by 1-dot units for horizontal scrolling.
## Run Length Mode
In this mode, pixel data is handled in units as the same colors that continue horizontally, and is represented in palette code (8-bit) and continuing number of pixels = run length data (8-bit). Through-bits are valid in this mode as well. When the run length exceeds 320 pixels for one line of data, the 320 pixels are displayed from the left, and all pixels thereafter are ignored.
## FILL Function
Auto Fill uses three registers: the start address, word length, and fill data. VDP begins the fill operation when writing to the fill data register. The portion that exceeds the page border is filled from the start of the page. Because VDP and SH2 DRAM accesses conflict while executing Auto Fill, do not access from SH2.
**Fill execution time** = 7 + 3 × length (cycle)
After executing Auto Fill, DRAM should be accessed after confirming that VDP register FEN = 0 (completion of frame buffer access via VDP).
## Clock Used by the 32X
The master clocks for NTSC and PAL used by the MEGA Drive and 32X are different.
**Mega Drive Master Clock Cycle:**
- Mck = 1/fosc [sec]
- **NTSC:** fosc = 53.693175 [MHz]
- **PAL:** fosc = 53.203424 [MHz]
**68000 Clock Cycle:**
- Vclk = 7Mck (where Mck is the value above)
**SH2 Clock Cycle:**
- Sclk = Vclk/3 (where Vclk is the value above)
## HBlank and Display Periods
- **A: Blank Period** - 100 dot (860 Mck)
- **B: Display Period** - 320 dot (2560 Mck)
- **C: HBLANK - VBLANK** - 27 dot (224 Mck)
- **D: HBLANK - XHDISP** - 3 dot (24 Mck)
## VBlank and Display Periods
| | NTSC | PAL (224) | PAL (240) |
|---|------|-----------|-----------|
| **A: Blank Period** | 38h | 89h | 73h |
| **B: Display Period** | 224h | 224h | 240h |
## VDP Register Latch Timing
- **A: H Blank - PEN** - 3 dot (24 Mck)
- **B: FEN Width** - 40 Sclk (VDP side refresh)
- **C: H Blank - latch** - 76 dot (668 Mck)
The register set within interval C is valid at line n (the nth line), and for interval D is valid at line n+1. Please avoid the type of phenomenon in which the VDP register latch and CPU register access overlap. When the DRAM is being refreshed FEN is 1, but access of the DRAM is possible. Be aware that if 1 is set in 240 bits when in the NTSC mode VDP will have operating errors.
---
# 3.4 PWM
## PWM Sound Source
32X outputs a 2 ch pulse wave as a sound source. The integrated wave form converts the pulse width to wave height. A variety of sounds can be produced by continuously changing the pulse width.
## Functions of 32X PWM
There are five registers within the SYS REG for controlling PWM of the 32X (see section 3.2). It is possible to access from both the SH2 and the MEGA Drive. Since any register can be accessed in bytes, the MEGA Drive side can switch banks and be accessed from the 68000 or Z80.
**Register Addresses:**
| MD side | SH side | Register |
|---------|---------|----------|
| A1 5130h | 2000 4030h | PWM Control |
| A1 5132h | 2000 4032h | Cycle Register |
| A1 5134h | 2000 4034h | L ch Pulse Width |
| A1 5136h | 2000 4036h | R ch Pulse Width |
| A1 5138h | 2000 4038h | Mono Pulse Width |
---
*[Document continues but was truncated in the original message]*
# Chapter 5: Other
## 5.1. Boot ROM
The Boot ROM is an SH2 execution object that is loaded in 32X as ROM, and is different in content with respect to the master CPU and slave CPU. SH2 itself sleeps until activated by the Mega Drive side initial program. After the Boot ROM is reactivated, security (see 5.2 Security) is executed by the master CPU; and if OK, the Initial program is executed after the initial data (application program) is loaded from the cartridge to SDRAM.
### Initial Data Load
Address 3C0h to 3EDh of the ROM cartridge is called the user header. The user header contains parameters of the initial data load given by the format shown below:
**MARS User Header ($00 03C0)**
```asm
MARSInitHeader:
dc.b 'MARS CHECK MODE ' ; module name
dc.l $0 ; version
dc.l $0000c000 ; source address
dc.l $0 ; destination address
dc.l $00004000 ; size
dc.l $06000120 ; SH2 (Master) start address
dc.l $06002000 ; SH2 (Slave) start address
dc.l $06000000 ; SH2 (Master) vector base address
dc.l $06002000 ; SH2 (Slave) vector base address
```
The source address is the byte address in which the ROM cartridge load is 0. The destination address is the byte address in which the DRAM load is 0. Size is indicated by number of bytes. Because the boot ROM loads the initial data in long word units, an address error will occur if the address is not set by the long word boundaries. Size must be treated in multiples of four. An address error will also occur if the start address and vector base address are not set within the long word boundaries.
### Mega Drive and SH2 Synchronization
The Boot ROM flow chart shows the boot process for both Master and Slave SH2. The "comm 0, 4, 8" reference refers to communication ports on the 32X. Immediately before an application starts, SH2 master writes "M_OK" (ASCII code 4 bytes) and SH2 slave writes "S_OK" to the communication port. The Mega Drive side executes the initial program (See 5.2 Security) at this time. To be able to synchronize the Mega Drive and SH2 with the application, these must be cleared when moving the Mega Drive side to the application. The SH2 side waits until it is cleared.
**Boot ROM Flow (Master):**
1. General Purpose Register Initialization
2. Bus State Controller Initialization
3. SDRAM Mode
4. 32X usable
5. wait
6. Custom Standby
7. sleep
8. Custom Active
9. Cache Clear
10. Cache ON
11. SDRAM Test
- If NG: "SDER" → comm0
- If OK: SDRAM Clear
12. Cartridge exists check
13. Security
- If NG: "SQER" → comm0
- If OK: Check SUM → comm8
14. If comm0 = "CD_*": Check SUM → comm8
15. Initial data load ROM → SDRAM
16. "M_OK" → comm0
17. Application Start
**Boot ROM Flow (Slave):**
1. General Purpose Register Initialization
2. Bus State Controller Initialization
3. sleep
4. Cache Clear
5. Cache ON
6. Wait for cartridge exists
7. Wait for comm0 = "CD_*" OR comm0 = "M_OK"
8. If Y: Check SUM → comm8
9. Wait for comm0 = "M_OK"
10. "S_OK" → comm4
11. Application Start
## 5.2. Security
### Initial Program
The Initial program performs hardware security and everything required upon resetting in order to equalize all hardware conditions when the Mega Drive and 32X are powered on. In the application program for 32X, the initial program (ICD_MARS.PRG) that replaces the one used by the current Mega Drive must be included. This program is executed immediately after the power is turned on or reset by the Mega Drive side. After activating SH2 from the sleep, the Mega Drive and 32X hardware are initialized and their applications executed.
### Security
The Initial program must begin from the start of the program (address 3F0h) without change. The Boot ROM built into 32X confirms that the Initial program is provided here. When contents do not match, 32X becomes locked and access cannot be done from the Mega Drive side.
**WARNING:** Be aware that release cannot be done if the initial program has been changed or if the initial program is not entered from the start.
### Included in the Initial Program
A list of the Mega Drive side sample program is shown below. The initial program (ICD_MARS.PRG) appears in the application structure.
**MAINPROG.ASM Sample:**
```asm
*******************************************************************************
* MARS Sample Program
* Mega Drive Main Routine
* Copyright SEGA ENTREPRISES, LTD 1994
*
* CS Hardware R&D Dept.
*
*******************************************************************************
* global define
xref colordata,colorbarcg ; add.asm
xref cramdma,vramdma,vdpinit ; vdp.h
* include file
.include md.i ; Mega Drive Map
.include mainwk.ass ; WorkRAM Assign
.include m_const.ass ; Constant or Macro
.symbols
.list on
*
* Vector / Mega Drive ID / Mars Initial Program
.include header.prg ; Mega Drive & 32X Header
.include icd_mars.prg ; Sega Designation - Initial Program & Security
*
bcs _error() ; if cs=1 then ID error or Self check error
_init:
lea marsreg,a5
```
The initial program (icd_mars.prg) provides the necessary initialization sequence including the security check that validates the cartridge and enables the 32X hardware. This is a mandatory component that cannot be modified or omitted.
---
## 5.3. Restrictions
### DMA Restrictions
1. **Master/Slave DMA Conflict**: When performing SH2 auto request DMA, both master interrupt and slave interrupt must be masked. If DMA is performed by both master and slave at the same time, one side of DMA will perform very slow until the other side of DMA is finished.
2. **VDP Access During DMA**: Since starting the interrupt process may take longer while executing auto request, VDP cannot be accessed within H interrupt while DMA is occurring. When PWM is used, data write may not happen in time. As a result, when either master or slave controls PWM, or when VDP is accessed in H interrupt, auto request DMA cannot be used.
3. **Interrupt Priority Timing**: Because the time required for the SH2 interrupt to be received depends on the status of the execution, when a high level interrupt is applied following a low level interrupt, the high level interrupt may be received first regardless of the interrupt sequence. Therefore, care is required regarding H interrupt immediately prior to V interrupt and PWM interrupt.
4. **CPU Write DMA Full Bit**: When performing CPU write DMA, full bit should be checked for every four words written. This is because the response to the SH2 side DMA may be longer than the 68K access cycle, depending on the access status.
5. **Palette Access Timing**: When accessing the palette in the packed pixel and run length modes, access needs to be done before 1μs in which the PEN bit changes "1" to "0". Because VDP ignores this access interval, data can not be ensured for both write and read.
### Precautions when using 32X SH2 (SH7095)
If the following operations are performed, the operation that follows can not be guaranteed:
1. Do not use the TAS command with the 32X.
2. Do not use the sleep command in an application.
3. Do not access the bus state controller (FFFF FFE0h ~ FFFF FFFFh) in an application.
4. Internal reset should not be done by "watch dog timer" in an application.
5. Do not access the standby control register (FFFF FE91h) in an application.
In addition, the following conditions exist:
1. Do not manually reset the 32X.
2. NMI is fixed to "H" in the 32X. (Items that can be used depending on the development tool also exist.)
3. Serial communication is connected between the master and slave. Because the serial clock is also connected, it can be used in clock synchronization if one side outputs and the other side inputs.
### DMA Controller Settings
**Transfer from DREQ FIFO to memory (channel 0, external request):**
- DMA Source Address Register 0 (FFFF FF80h) → 2000 4012h fixed
- DMA Destination Address Register 0 (FFFF FF84h) → optional
- DMA Transfer Count Register 0 (FFFF FF88h) → same value as DREQ Length Register (2000 4010h)
- DMA Channel Control Register 0 (FFFF FF8Ch) → 0100 0100 1110 0XXXb (fixed except for X)
- DMA Request / Response Select Control Register 0 (FFFF FE71h) → 00h fixed
- DMA Operation Register (FFFF FFB0h) → optional
**Transfer from memory to PWM FIFO (channel 1, external request):**
- DMA Source Address Register 1 (FFFF FF90h) → optional
- DMA Destination Address Register 1 (FFFF FF94h) → 2000 4034h ~ 2000 4038h
- DMA Transfer Count Register 1 (FFFF FF98h) → optional
- DMA Channel Control Register 1 (FFFF FF9Ch) → 00XX 0100 1110 0XXXb (fixed except for X) or 00XX 1000 1110 0XXXb (fixed except for X)
- DMA Request / Response Select Control Register 1 (FFFF FE72h) → 00h fixed
- DMA Operation Register (FFFF FFB0h) → optional
**Transfer from memory to memory (channels 0, 1):**
- DMA Channel Control Register 0/1 (FFFF FF8Ch /FFFF FF9Ch) → XXXX XX10 1110 0XXXB (fixed except for X)
Other registers are optional.
### Restrictions Concerning SH2 Interrupt
The 32X SH2 has five types of interrupt:
- **Level 14**: VRES interrupt
- **Level 12**: V interrupt
- **Level 10**: H interrupt
- **Level 8**: Command interrupt
- **Level 6**: PWM interrupt
The following restrictions occur when using two or more of the following interrupts along with interrupts through the SH2 internal peripheral module at the same time:
1. **Interrupt Mask Levels**: There should always be 1 or more interrupt masks. Don't use interrupts of level 15, level 13, level 11, level 9, level 7 and level 1.
2. **FRT Restrictions**: The SH2 internal free-run-time (FRT) cannot be used with programs. Use the following values in the initial settings:
| Register | Value |
|----------|-------|
| Timer interrupt enable register (TIER) | 01h |
| Output compare register A (OCRA) | 0002h |
| Free run timer control/status register (FTCSR) | 01h |
| Timer control register (TOCR) | E2h |
3. **Shared Interrupt Vectors**: External interrupts and the built-in peripheral module interrupt jump destination vector may be mis-recognized. Except for the Non-Maskable Interrupt (NMI) and user brake, interrupt vectors should be set so that they all call the same process routine. At the beginning of this process routine, individual process routines should be called by deciding and branching the SH2 status register values. When the internal peripheral module is assigned the same level as the external interrupt, check the individual interrupt factor flags by the software and find which interrupt occurred.
4. **Invalid Interrupt Levels**: Return from interrupt without doing anything when interrupt levels 15, 13, 11, 9, 7, and 1 occur.
5. **RTE Timing**: Until the RTE command is executed after the external interrupt has been cleared, two or more cycles should be opened. Clearing external interrupt is done by writing to the clear register. When the RTE command is executed, 2 or more commands should be done afterward.
**IMPORTANT**: These restrictions are in addition to the SH2 interrupt hardware bug documented in [32x-hardware-manual-supplement-2.md](32x-hardware-manual-supplement-2.md). The FRT TOCR toggle workaround must still be applied in all external interrupt handlers.
---