Every earlier console drew its backgrounds as a grid of tiles that could slide up, down and sideways, and nothing more. The Super Famicom, launched in Japan in November 1990, added a background mode whose picture could turn and zoom. Mode 7 gives the machine one flat layer, a map 1024 dots square, and a 2×2 matrix that decides which point of the map lands on each pixel of the screen. On its own that rotates and scales a flat picture seen from straight above. What made F-Zero’s track run away to the horizon, and let Pilotwings’ parachutist fall towards the ground, was the programmers changing the matrix on every line of the picture.
Fast facts
- Where: background mode 7 of the Super NES picture processor, one of eight background modes. One layer, 256 colours per dot, 256 tiles of 8×8 dots on a fixed map of 128×128 tiles (1024×1024 dots), filling the first half of video memory.
- EXTBG: a second version of the layer with 128 colours and a priority bit per dot, switched on in SETINI (
$2133). - Matrix: M7A–M7D at
$211B–$211E, 16-bit signed numbers with 8 fractional bits, each written as two bytes. - Centre: M7X and M7Y at
$211F–$2120, 13-bit signed; scroll through$210D–$210E. - Beyond the map: M7SEL (
$211A) chooses between repeating the map, the backdrop colour or tile 0 repeated, and can flip the layer. - Bonus: M7A and M7B double as a signed 16×8-bit multiplier, result at
$2134–$2136. - Per-line change: HDMA rewrites the matrix each scanline, which turns a flat rotating map into a floor seen in perspective.
- Cannot do: scale or rotate sprites, or show an independent second background layer (EXTBG’s second layer is a copy of the first).
The matrix
The four parameters say how far to step through the map for each step across the screen. The SNESdev wiki puts it plainly: “When you move one pixel to the right on the screen: M7A is how many texels to move to the right on the background. M7C is how many texels to move down. When you move one pixel down on the screen: M7B is how many texels to move right. M7D is how many texels to move down.” (A texel is one dot of the map.) With A and D at 1 and B and C at 0, the map appears as an ordinary background. Set A to 2 and the hardware steps two dots of the map for every pixel of the screen, so the picture shrinks to half its width. Fill the four values with the sine and cosine of an angle and the map turns.
Nintendo’s manual for licensed developers, the Super NES Development Manual, gives the same recipe as a formula: A is the cosine of the rotation angle divided by the horizontal reduction rate, B the sine divided by the same rate, C the negative sine divided by the vertical rate, and D the cosine divided by the vertical rate. Each value is written low byte first, with the fraction in the low byte and the sign in the top bit of the high byte. M7X and M7Y set the centre that the map turns and zooms around, which the manual notes can lie “either outside or inside of the display area”. The wiki’s comparison with modern graphics is apt: mode 7 is like “texture mapping a single quad on a modern GPU”, or “selecting a parallelogram region from the tilemap, and stretching its four corners to the rectangle of the screen”.
One flat layer
The price of all this is everything else the screen could have had. In mode 7 there is a single background, not the two to four of the other modes, so a status display, a sky or a second scrolling layer has to come from somewhere else. The SNESdev wiki lists the usual answers: draw such things with sprites, or use HDMA to switch the chip to another background mode partway down the screen. Some games turned the layer into a single giant enemy instead, “large rotating boss characters” drawn as the mode 7 background.
The matrix also leaves sprites alone. The manual gives rotation, enlargement and reduction to background modes 7 and EXTBG only, and the sprite layer has no scaling function in any mode (see Sprite Scaling). Nintendo Power’s 1993 pitch for the Super FX chip rested on that gap: with it, “not only can large backgrounds be rotated, as with the Super NES’s Mode 7, but even sprites can be manipulated individually”. Super Play Gold’s F-Zero review put the limit more bluntly: mode 7 can “only spin, scroll” and “manipulate flat objects”.
The free multiplier
“The 65c816 does not have a multiplication instruction,” the SNESdev wiki notes, “but the SNES includes multiplication hardware that can be accessed with registers.” One of the two multipliers lives in the picture processor and shares the mode 7 registers: write a 16-bit value to M7A and an 8-bit value to M7B and a signed 24-bit product appears at $2134–$2136, ready to read at once. Nintendo’s manual gives the reason it is there: “to calculate the rotation parameter in mode 7, it will lighten the burden of the CPU processing”. The catch, as the wiki notes, is that it “can not be used while rendering Mode 7”, because the chip is using the same registers to draw the picture.
Per scanline: the perspective trick
A single matrix rotates and zooms a flat plane; it cannot tilt it. Every line of the screen is scaled by the same amount, so a road never narrows into the distance. The answer was HDMA, a DMA mode that the manual describes as transferring data in step with horizontal blanking, so that the picture processor’s settings can change on every line. A game builds a table of matrix values, one set per line: the lines at the top of the floor shrink the map a lot, the lines at the bottom hardly at all, and the eye reads the result as a ground plane stretching away. In the SNESdev wiki’s words, the transform “can be changed every scanline via HDMA, allowing versatile perspective and distortion effects”.
Working out those tables in real time is heavy arithmetic for a slow processor. Two of the best-known mode 7 games carried help in the cartridge. The emulator author byuu, writing for Ars Technica in 2011, described Nintendo’s DSP-1 chip as there “for 3D math (used in Pilotwings and Mario Kart.)”. Super Play Gold credited the same chip with making Super Mario Kart’s two-player mode work, handling “the smooth operation of two Mode 7 gameplay windows” as well as keeping track of where everything was.
“Mode Seven” in the press
The first games arrived with the Super Famicom, and the British import press reached for the word 3D. Mean Machines reviewed an imported Pilotwings in February 1991, “using the same 3D programming technology as F-Zero”, and said of the skydiving event that the ground “rushes towards you in a horribly realistic way”. The name mode 7 reached American players through Nintendo Power in the months before the American launch. In June 1991 a preview said Asmik’s Dimension Force “utilizes the Super NES ‘Mode Seven,’ which allows for realistic three dimensional scrolling”. The next issue explained the two halves. Rotation: “One of the programs that most effectively uses Mode Seven Rotation is F-Zero, a futuristic driving game. The effect is nothing short of dramatic when the player-controlled car crashes and the ‘camera’ view moves forward briefly, then rotates 180 degrees to show the burning wreckage.” Scaling, set against the old way of drawing an object “at several different sizes” and flicking between them: “With Mode Seven Scaling, though, an object is drawn only once and then manipulated by the Super NES to grow or shrink as it moves in relation to the ‘camera’ view.”
By October the magazine was pointing it out level by level. In Super Ghouls ’n Ghosts’ cave, “the entire background rotates when you jump on the platforms … You may very well forget which way is up!” When Super Mario Kart made its list of the best games of 1992, the magazine’s point was that mode 7 now worked twice at once: “Since we first played F-Zero, we wondered how much fun a two-player simultaneous version of the game would be. We got our answer in Super Mario Kart. Not only does the game feature split-screen Mode 7 that gives both players their own views on the action”. Because the matrix can change on any line, the top half of the screen can follow one kart and the bottom half the other.
Programmers who used the mode liked it more than the rest of the machine. Neil Jackson of Argonaut, the company behind the Super FX, told Super Play and its Super Play Gold special in 1993 that mode 7 was “brilliant” and “a joy to use”, and that it “makes all the speed problems worth putting up with”. The speed problems were real: in his words, “underneath it all it’s slower than a Spectrum”. Super Play Gold’s F-Zero review explained why a racing game could still run so smoothly. On other machines, it said, drawing the road left “precious little memory left for anything else”. With mode 7, “all the programmer has to do is tell the machine what the road looks like, and what direction it should be moving in, and the console’s custom hardware does the rest”.
Sources
- Nintendo, Super NES Development Manual, Book I, a manual for licensed developers: chapter 3 (the eight background modes), chapter 5 (Rotation/Enlargement/Reduction), chapter 10 (Complementary Multiplication), chapter 17 (H-DMA), chapter 22 (the work of PPU1 and PPU2), the PPU register pages for M7SEL and M7A–M7Y, and appendix A (the 1024-dot mode 7 map and the rotation formula).
- SNESdev Wiki, “Mode 7”, “Mode 7 transform”, “PPU registers” and “Multiplication” (web, secondary): https://snes.nesdev.org/wiki/Mode_7 and https://snes.nesdev.org/wiki/Mode_7_transform
- The Games Machine issue 34, September 1990: the Super Famicom’s 21 November launch.
- Mean Machines issue 5, February 1991: Pilotwings review.
- Nintendo Power issue 25, June 1991 (Dimension Force preview); issue 26, July 1991, pp. 48–49 (Super NES features: F-Zero and Pilotwings); issue 29, October 1991, p. 75 (Super Ghouls ’N Ghosts); issue 44, January 1993 (Super Mario Kart in the top games of 1992; the Super FX feature).
- Super Play issue 8, June 1993: Neil Jackson of Argonaut on the Super NES.
- Super Play Gold (Future Publishing, 1993): Neil Jackson on mode 7; the DSP chip in Pilotwings and Super Mario Kart; F-Zero review.
- Byuu, “Accuracy takes power: one man’s 3GHz quest to build a perfect SNES emulator”, Ars Technica, 9 August 2011, page 3 (web, secondary): the DSP-1 in Pilotwings and Mario Kart.
See also
- Sprite Scaling — the same effect for objects, done differently
- Sprites
- Super FX Chip — rotating and scaling sprites and polygons, not just a background
- Raster Effects — per-scanline register changes on other machines
- Parallax Scrolling
- Super Nintendo
- Super Ghouls ’n Ghosts