SNES Architecture
The Super Nintendo or Super Famicom in Japan, released on 21/11/1990 in Japan and 11/04/1992 in Europe
SNES Architecture
The Super Nintendo, released on 13/08/1991
Showing model 'SNS-RGB-CPU-01', earlier revisions had the Sound Subsystem connected as a daughterboard, later ones unified both PPUs
SNES Architecture
Bus 'A' and 'B' are address buses, the data bus follows the trail of bus 'B' and it's 8 bits wide

A quick introduction

Nintendo managed to bring the next generation of graphics and sounds without using expensive off-the-shelf components, the reason is simple: The Super Nintendo was designed with expandability in mind, in a world where CPUs are evolving faster than the speed of light, Nintendo depended on game cartridges to make its console shine.


CPU

The main processor is a Ricoh 5A22 running at ~2.86 MHz. It’s based on the Western 65C816, a 16-bit upgrade of the classic MOS Technology 6502. Since we have the same foundation of the NES’ CPU, there’s a slight possibility that the SNES was originally planed to be compatible with NES games.

The 5A22 features:

Ricoh’s additions

Apart from the extra registers, Ricoh customised the core design to include two exclusive DMAs (Direct Memory Access) that enables to move memory around without the intervention of the CPU (resulting in faster speeds).

For this design to work, regions of memory are referenced using two different address buses:

When a DMA is being set up, the origin must come from a different bus than the destination.

There are two DMAs to choose from depending on the needs:

The system provides eight channels to set up DMA transfers, thus enabling to dispatch eight independent transfers at once.

Segmentation Fault

This console also features a special ‘anomaly’ called Open Bus: If there is an instruction trying to read from an unmapped/invalid address, the last value read is supplied instead (the CPU stores this value in a register called Memory Data Register or ‘MDR’).


Graphics

Before we go in-depth I strongly recommend reading the NES article first since it introduces useful concepts that will be revisited here.

Design

Nintendo improved their previous architecture by using two different PPU chips to build the graphics sub-system, both combined are known as Super PPU or ‘S-PPU’.

The system outputs a standard resolution of 256x224, PAL systems output 256×240 however most games don’t use the extra pixels and show a letterbox (black lines) instead.

Overall, both PPU packages are designed to serve different functionality:

This separation, from the programming point of view, is unnecessary since both chips are virtually treated as one.

Organising the content

S-PPU Diagram
Memory architecture of the S-PPU

Graphics data is distributed across three regions of memory:

Constructing the frame

For demonstration purposes, Super Mario World will be used to show how graphics are rendered.

Tiles

Tiles
Some 16x16 Tiles found in VRAM

Just like its predecessor, the S-PPU uses tiles to build sophisticated graphics, however there are significant improvements compared to the original PPU:

  • Game cartridges no longer connect directly with the PPU so tiles will have to be copied to VRAM first (just like Sega’s Mega Drive). DMA comes very handy for these occasions.
  • Tiles are no longer restricted to their traditional dimension (8x8 pixels), from now on they can also be 16x16 pixels wide.
  • When tiles are stored in memory, these will be compressed depending on how much colours per pixel they need to use. The unit of size is bpp (bits per pixel), the minimum is 2bpp (each pixel only occupies two bits in memory and has only 4 colours available) while the maximum is 8bpp, which allows to use 256 colours at the expense of requiring a whole byte.

Background

Background maps in VRAM
Rendered Background layers after selection and transparency are applied

The Super Nintendo can generate up to four different background planes. Using either 8x8 or 16x16 tiles, blocks will take up to 32x32 pixels (2x2 tiles). That being said, the size of each background layer can be up to 1024x1024 pixels wide (32x32 tiles). The region in VRAM where these layers are configured is called Tilemap and is structured as a table (continuous values in memory).

Each entry in the Tilemap contains the following attributes:

  • Vertical & Horizontal Flip values.
  • Priority (either ‘0’ or ‘1’).
  • Palette reference from CRAM.
  • Tile reference.

As always, these planes are scrollable, however the amount of features available (colour, number of layers, independent scrolling region and size of selection) will depend on the Background mode selected.

Modes

This system features eight background modes to choose from, each one provides a different set of features:

  • Mode 0: 4 layers with 4 colours each.
    • This is very limited in colours since it’s the only one allowing the most number of layers.
  • Mode 1: 2 layers with 16 colours each + 1 layer with 4 colours.
    • One layer can be split into foreground and background.
    • This is the most common one.
  • Mode 2: 2 layers with 16 colours each.
    • This mode has an extra effect: Layers can have each of its columns scrolled independently (Similar to the GameBoy).
  • Mode 3: 1 Background layer with 128 colours + 1 Background with 16 colours.
    • Colours can be set as RGB values instead of using CGRAM references.
  • Mode 4: Mode 2 and 3 combined (Column scroll + RGB colour mapping).
    • The first layer has 128 colours and the second one only has 4.
  • Mode 5: 1 layer with 16 colours + 1 layer with 4 colours.
    • The selected area has a resolution of 224 x 512 pixels which will be squashed to fit in the screen (interlacing).
    • This is very useful when the screen has to be split (during multiplayer, for instance).
  • Mode 6: Combination of Mode 2 and 5 (High resolution + column scrolling).
    • Only one layer is allowed with 32 colours.

As you can see, programmers now have the choice to prioritize between number of colours, layers, effects and resolution of selected area.

Sprites

Sprites
Rendered Sprite layer

An area on memory called Object Attribute Memory (OAM) stores a table with references of up to 128 sprites with these properties:

  • Size: The PPU can combine up to 16 small Tiles in the form of 4x4 to build a sprite.
  • Tile References.
  • Screen Position: Only sprites positioned inside the visible area will be rendered.
  • Priority: Since multiple layers overlap each other, the graphic with highest priority will be shown, this is also determined by the background mode in use.
  • Colour palette slot: 9 slots to choose from CGRAM.
  • X/Y Flip.

The S-PPU can draw up to 32 sprites per scan-line (overflowing this will only make it discard the ones with lowest priority).

Result

Result
Tada!

One of the main constraints of NES games was the fact that they could only update their graphics during V-Blank, the moment from which the CRT’s beam was returning to the starting point provided with a reasonable time-frame to reshuffle some tiles without breaking the image.

Well, thanks to the new capabilities of the SNES, this limitation gained a different meaning.

You see, because DMA/HDMA allows to perform memory transfers without waiting for V-Scan, games can now update tiles, colours and registers without waiting for the whole frame to be drawn. This is good news, but we can think beyond that: Since games can now change the S-PPU settings during mid-frame, this means that it’s possible to activate different backgrounds modes at different stages of the same frame, opening the door to new and original game designs!


Unique features

Truth to be told, I still haven’t mentioned the most important characteristic of this console…

F-Zero (1990)
First quarter of scan-lines use another Mode to simulate distance, Mode 7 starts at the second quarter (this is possible thanks to HDMA)

Introducing Mode 7, yet another background mode, but this time, with a completely different way of working. While it can only render a single 8bpp Background layer, it provides the exclusive ability of applying the following affine transformations:

  • Translation
  • Scaling
  • Rotation
  • Reflection
  • Shearing

These effects don’t include perspective, although by altering the rotation matrix at each HDMA call, a pseudo 3D effect can be achieved!

Due to the high number of calculations needed, the memory map is changed to optimise the pipeline of the two PPUs, the first one processes the Tilemap (where tiles are referenced) while the other fetches the Tileset (where tiles are stored).


Audio

The audio capabilities are concentrated in a single chip called S-SMP made by Sony. It’s composed of:

This sub-system functions independently: When the console is turned on, the SPC700 boots a 64 byte internal ROM and becomes idle until the main CPU starts sending commands.

Drums are discriminated for demonstration purposes
StarFox (1993)

The S-SMP works by grabbing digital samples and modulating them to obtain the desired pitch (think of it as a hybrid between a MIDI and a sample player). These samples are called modules and have up to 16-bit resolution and a sampling rate of 32 kHz.

While the size of a module is usually larger than the data needed to program an FM or PSG, composers can now construct their sound more easily (for example, by using the same samples from their keyboards), thus you may notice that some games have similar sounds to popular keyboards from that era.

The system can process up to 8 channels where each one can have a module assigned to it.

Evolution from the NES

In order to demonstrate the evolution of sounds from the NES to the Super NES, here are two music scores, one from a NES game and another from its Super NES sequel. Both used the same composition:

Mother (1989)
Mother 2/Earthbound (1994)

Advanced usage

Drums are discriminated for demonstration purposes
Kirby's Dream Land 3 (1997)

Here’s a more instrument-rich composition that takes advantage of the ability to swap modules on a single channel.

This technique allows the music to only require five channels in total, leaving to other three for effects.


Games

Overall, games are written in 65816 assembly and when it comes to designing the cartridge, there are two ways of electrically connecting the address pins between the ROM and the CPU:

Expansion

The modular architecture of the Super Nintendo allows for numerous type of Enhancement chips that are included on cartridges and provide extra features such as the ‘SuperFX’ for 3D polygon composition or the ‘SA-1’ for co-processing, some of these chips complemented already complex functions like Mode 7 (which allowed to transform the background but not the sprites).

Recognisable behaviour

Have you ever wondered what causes games to lag? When the V-Blank interrupt is called to allow graphics update, sometimes the game is still executing some heavy code and skips the V-Blank window, graphics can’t be updated until the next V-Blank call and since the frame wasn’t updated, this is manifested as a drop in frame-rate. It can also happen the other way around, extensive processing during a V-Blank won’t allow the PPU send video signal since the bus is blocked. Then black lines during a scan will be shown, although this is barely noticeable since the frames update 50 or 60 times per second.


Anti-piracy / Region Lock

Cartridges are physically different between regions, so they won’t fit on consoles from a different region. This was addressed by using third-party adapters.

This console, like the NES, still incorporates the 10NES system, which locks any non-authorised distributors. This was cracked when the CIC chip was successfully cloned.

To protect against bootleg cartridges, games also included a chain of piracy checks:

  1. Comparing the SRAM size (bootlegs normally include a bigger size to fit any game).
  2. A series of checksums on the code that check if the previous check was removed. These checks would be dispersed at different stages of the game, so they’d be difficult to find.

This could be defeated by manually removing these routines but would take a long time to find all them, after all they would be scattered around the game only to upset the player (and hopefully make them buy a legitimate copy…). Truth to be told, you’ll notice that most ROMs surfing the internet had all their piracy checks removed.


That’s all folks

My SNES with Earthbound
My modded SNES with an american cartridge
That game was only released in the states, luckily there was a lad selling it in Glasgow!

Sources / Keep Reading

General

CPU

Graphics

Audio

Games

Photography


Contributing

This article is part of the Architecture of Consoles series. If you found it interesting please consider donating, your contribution will be used to get more tools and resources that will help to improve the quality of current articles and upcoming ones.

Paypal

Changelog

## 2019-10-28

- Some corrections and improvements.

## 2019-09-17

- Added a quick introduction

## 2019-09-01

- Added my SNES 🧐

## 2019-08-29

- Better wording

## 2019-06-28

- Ready for publication

Rodrigo Copetti

Rodrigo Copetti

Hope you enjoyed the article! If you want to know more about the author tap here and if you'd like to support him tap here instead

rss facebook twitter reddit