How DMA and HDMA Shaped SNES Scrolling Effects

SNES DMA HDMA explained shows how eight channels, VBlank bursts and per-scanline tables produced Mode 7 roads and wavy 1990s backgrounds cheaply.
The Super Nintendo shipped in Japan as the Super Famicom in 1990 and reached North America as the SNES in 1991, and its most distinctive visual tricks came from two small pieces of hardware logic rather than from raw speed. It runs a Ricoh 5A22, a 65816-derived CPU at about 3.58 MHz, feeding two video chips, S-PPU1 and S-PPU2, with 64 KB of VRAM, 512 bytes of palette RAM and 544 bytes of sprite OAM. DMA and HDMA move data into those chips without wasting the processor’s time, and they are why a 1990 console could draw a receding ground plane and a rippling sky while the game logic kept running.
The bandwidth problem the 5A22 had to solve
Everything the PPU draws comes from VRAM, CGRAM and OAM, and those blocks are tiny. A scrolling screen needs new tile data, new tilemaps and new palettes as the camera moves. On NTSC the vertical blank lasts roughly 37 scanlines, the only window when the PPU is not reading VRAM and it is safe to rewrite it. A 65816 copy loop at 3.58 MHz pushes only a few hundred bytes into that window, nowhere near enough. Writing VRAM during active display corrupts the picture because the PPU is fetching the same bytes, which is why $2100 has a forced-blank bit and why serious DMA is scheduled for VBlank.
General DMA and the $420B trigger
The 5A22 contains eight DMA channels, each set up through a sixteen-byte register block at $4300 plus $10 per channel. You write DMAPx at $43×0 for direction and transfer pattern, BBADx at $43×1 for the low byte of the destination, a 24-bit source address at $43×2 through $43×4, and a byte count at $43×5 and $43×6. Then a write to $420B, called MDMAEN, starts every channel whose bit you set. The CPU halts and the controller moves one byte every eight master-clock cycles, about 2.68 MB per second, into a $21xx register such as $2118 for VRAM, $2122 for palettes or $2104 for OAM. A few kilobytes now fit into VBlank: a fast burst instead of a slow loop.
HDMA, the per-scanline table
HDMA reuses the same eight channels but fires them at the start of each scanline, during horizontal blank, with no code running. A write to $420C, HDMAEN, arms the selected channels. Each reads a table in RAM whose entries are a count byte plus one to four data bytes, and the transfer mode in DMAPx decides whether those bytes go to one register or a run of adjacent ones. The count byte says how many lines to use that entry, with a repeat bit for holding a single value, and an indirect mode lets the table hold pointers. A gradient needs only a handful of bytes: hold this colour for twenty lines, then step to the next.
| Register | Name | Role |
|---|---|---|
| $420B | MDMAEN | Bitmask that starts a general DMA burst on channels 0 to 7 |
| $420C | HDMAEN | Bitmask that enables per-scanline HDMA |
| $43×1 | BBADx | Low byte of the $21xx destination, so $18 targets $2118 |
| $43×2 to $43×4 | A1Tx | 24-bit source address inside the 16 MB CPU space |
| $210D | BG1HOFS | BG1 horizontal scroll, a common HDMA target |
Mode 7 perspective, one line at a time
Mode 7 applies an affine transform to one 128 by 128 tilemap, controlled by matrix and centre registers $211B through $2120. One set of those values rotates the whole plane uniformly, which looks flat. Change them every scanline and the transform becomes a perspective projection: distant lines compress, near lines stretch. That is what F-Zero (1990), Pilotwings (1990) and Super Mario Kart (1992) do, with HDMA writing the new matrix values each line. The CPU only builds a table of coefficients in RAM; the controller does the per-line work while the 5A22 handles the race. It is a convincing 3D floor drawn by a chip with no 3D hardware.
Wavy scroll, gradients, and window tricks
The same idea applies to ordinary background modes. $210D and its partners hold BG scroll offsets, and HDMA can write a different horizontal offset on every line, turning a flat layer into a wavy heat haze or rippling water. Point a channel at $2122 and you get a sky that fades from blue to orange down the screen; point one at the window and colour-math registers and you can cut the screen into regions. Games from Super Mario World (1990) onward used HDMA for wavy background bands, and Super Metroid (1994) and Chrono Trigger (1995) leaned on it for gradients and distortion. Each effect is a short table of bytes replayed 224 times a frame.
HDMA against the H-timer IRQ
There is another way: the H and V timer IRQ, set up through $4207 to $420A and enabled by $4200, interrupts the CPU at a chosen scanline so code can write registers manually. That is more flexible, because the CPU can compute a value instead of reading a fixed one, but it costs cycles on every line and it is easy to miss the timing window. HDMA is the cheaper, table-driven route: no interrupt, no jitter, and the CPU does nothing. The cost is that anything computed, such as a sine wave for a wobble, must be precomputed into the table before the frame. There are only eight channels shared between general DMA and HDMA, so a game with OAM updates, a Mode 7 matrix and a gradient has to budget them.
A clever hack, not a fast chip
I think HDMA is the more elegant of the two ideas, and more interesting than Mode 7 itself. General DMA is brute force: halt the CPU, shovel bytes, resume. HDMA is a small trick that makes a modest machine look far more capable by moving a handful of bytes at exactly the right moment, over and over, for free. It adds no polygons or extra colours, it just changes a register between one line and the next. The trade-off is real: HDMA cannot compute, it can only replay, so the programmer does the thinking in advance. That constraint is why the effects feel so deliberate. When a 1994 game shows a sunset shifting through sixteen colours, someone wrote those sixteen values into a table.
If you want to see this for yourself, open a debugger on a personal backup of a cartridge you own and look at $420C and the $43xx blocks first; a game’s whole raster vocabulary is usually sitting in a few HDMA tables in RAM. Watch one scanline at a time and the perspective stops looking like magic and starts looking like bookkeeping.
Related reading
If you want to keep digging into this corner of the library, these two posts on Roms Get go a little further:
