# FCE Ultra General Documentation

Last updated November 12, 2003
Valid as of FCE Ultra 0.97

Table of Contents:

Introduction

History of FCE Ultra

Core Features

CPU
PPU

Palettes

Sound
Input

Zapper

File Formats/Expansion Hardware

iNES Format
UNIF
Famicom Disk System
Game Genie
VS Unisystem

Automatic IPS Patching

Using FCE Ultra

Key Assignments

VS Unisystem
Famicom Disk System
Game Pad
Power Pad
Family Keyboard

Command-line Ports

SDL
DOS
Linux SVGAlib

MS Windows Port

Cheat Guide
Network Play
Credits

## Introduction

FCE Ultra is an NTSC and PAL Famicom/NES emulator for various platforms. It is based upon Bero's original FCE source code. Current features include good PPU, CPU, pAPU, expansion chip, and joystick emulation. Also a feature unique to this emulator(at the current time) is authentic Game Genie emulation. Save states and snapshot features also have been implemented.

This document has been arranged to keep user interface details and emulation details as separate as possible, though this has not been accomplished entirely.

In several places references are made to the "base directory". If you are running a port on a UN*X-like system(Linux/*BSD/Mac OSX/SunOS/etc.), the base directory is "~/.fceultra", or in other words, "your home directory plus .fceultra". For all other ports(including DOS and MS Windows), the base directory is the directory that the executable is in.

### History of FCE Ultra

This section is a work-in-progress. Some details may be incorrect.
Bero originally wrote a NES emulator that was referred to as FCE. This name was apparently meant only to serve as a temporary name, but its usage remained. Xodnizel originally ported it to Linux SVGAlib, and made a few improvements. This code base was abandoned, and work began anew, under DOS, with the original FCE source code. At the end of November, 1998, FCE Ultra Beta 1 was released.

FCE Ultra remained DOS-only until version 0.18, when it was ported to Linux SVGAlib, and released as a staticly-linked executable. The first MS Windows port was released as version 0.25.

The source code of 0.40 was released on November 12, 2000. It retained the simple license of FCE for a long time, which stated that " This software is freeware.you can use it non-commercially." Almost two years later, in June 2002, 0.80 was released, and FCE Ultra was relicensed under the GNU GPL.

## Core Features

### CPU

All official instructions of the NES' CPU, the 2A03, which is compatible(mostly) with the 6502, are emulated. "Unofficial" instructions are also emulated, though probably not as accurately as the more well-defined official instructions.

### PPU

#### Palettes

FCE Ultra has many palette features, including loading a custom palette to replace the default NES palette. The palette from an NTSC NES can also be generated on-the-fly.

First, a note on on the format of external palettes; Palette files are expected to contain 64 8-bit RGB triplets(each in that order; red comes first in the triplet in the file, then green, then blue). Each 8-bit value represents brightness for that particular color. 0 is minimum, 255 is maximum.

Palettes can be set on a per-game basis. To do this, put a palette file in the "gameinfo" directory with the same base filename as the game you wish to associate with and add the extension "pal". Examples:

                    File name:              Palette file name:
                     BigBad.nes              BigBad.pal
                     BigBad.zip              BigBad.pal
                     BigBad.Better.nes       BigBad.Better.pal

With so many ways to choose a palette, figuring out which one will be active may be difficult. Here's a list of what palettes will be used, in order from highest priority to least priority(if a condition doesn't exist for a higher priority palette, the emulator will continue down its list of palettes).

NSF Palette(for NSFs only)
Palette loaded from the "gameinfo" directory.
NTSC Color Emulation(only for NTSC NES games).
VS Unisystem palette(if the game is a VS Unisystem game and a palette is available).
Custom global palette.
Default NES palette.

### Sound

All 5 internal sound channels are supported(2x rectangle, triangle, noise, and DMC/PCM). Sound channels are emulated with CPU instruction granularity. There are two sound quality options. Low-quality sound, the default sound quality option, generates sound data at 16x the playback rate and averages those samples together to 1 sample. This method works fairly well and is reasonably fast, but there is still some aliasing and sound distortion. All sample rates between 8192Hz and 96000Hz are supported.

The high-quality sound emulation is much more CPU intensive, but the quality is worth it, if your machine is fast enough. Sound data is generated at the NES' CPU clock rate(about 1.8MHz for the NTSC NES), and then resampled to the output sample rate. Custom-designed 483rd order Parks-McClellan algorithm filter coefficients are used. Supported playback rates are 44100Hz, 48000Hz, and 96000Hz. The following filter statistics apply for NTSC emulation.

Rate: | Passband Upper Bound(Hz): | Passband ripple(dB): | Transition bandwidth(Hz): | Stopband attenuation(dB):
--- | --- | --- | --- | ---
44100 | 11982.5 | 0.20 | 10067.5 | 66.4
48000 | 13932.5 | 0.10 | 10067.5 | 60.0
96000 | 30000.0 | 0.01 | 18000.0 | 103.0

In addition to improved tonal quality, the high-quality sound emulation also simulates deficiencies present in the NES' D/A converter, which causes the sound output to be non-linear(for example, 16+16 might create an output equivalent to 25). Emulation of this is necessary for the DMC/PCM sound channel to sound correct. For example, without this feature, the drums in "Crystalis" are excessively fuzzy.

The "highest" sound quality mode is similar to the normal high-quality mode, but the filters are of a higher order(1024 coefficients). Ripple is reduced, the upper bound of the passband is higher, and the stopband attenuation is slightly higher. The highest-quality mode filter coefficients were created using "gmeteor". The parameters used to create these filters can be found in the source code distribution.

Besides the 5 internal NES sound channels, FCE Ultra emulates the extra sound capabilities of the Konami VRCVI, Konami VRCVII, Namco 106, Nintendo MMC5, and the Sunsoft FME-07 chips. The extra sound channel in the Famicom Disk System is also emulated, but the support for its FM capabilities is limited.

### Input

FCE Ultra emulates the standard NES gamepad, the Four-Score multiplayer adapter, the Zapper, the Power Pad, and the Arkanoid controller. The Famicom version of the Arkanoid controller, the "Space Shadow" gun, the Famicom 4-player adapter, and the Family Keyboard are also emulated.

#### Zapper

Most Zapper NES games expect the Zapper to be plugged into port 2. and most VS Unisystem games expect the Zapper to be plugged into port 1.

The left mouse button is the emulated trigger button for the Zapper. The right mouse button is also emulated as the trigger, but as long as you have the right mouse button held down, no color detection will take place, which is effectively like pulling the trigger while the Zapper is pointed away from the television screen. Note that you must hold the right button down for a short time to have the desired effect.

### File Formats/Expansion Hardware

FCE Ultra supports the iNES, FDS(raw and with a header), UNIF, and NSF file formats. FDS ROM images in the iNES format are not supported; it would be silly to do so and storing them in that format is nonsensical.

FCE Ultra supports loading ROM/disk images from some types of compressed files. FCE Ultra can load data from both PKZIP-format files and gzip-format files. Only the "deflate" algorithm is supported, but this is the most widely used algorithm for these formats. A compressed FDS disk image will only be saved back to disk if it uses the gzip format.

All files in a PKZIP format archive will be scanned for the followings extensions: .nes, .fds, .nsf, .unf, .nez, .unif The first compressed file to have one of these extensions will be loaded. If no compressed file has one of these extensions, the first compressed file will be loaded.

#### iNES Format

The battery-backed RAM, vertical/horizontal mirroring, four-screen name table layout, and 8-bit mapper number capabilities of the iNES format are supported. The 512-byte trainer capability is also supported, but it is deprecated. Common header corruption conditions are cleaned(let's go on a DiskDude hunt), though not all conditions can be automatically detected and fixed. In addition, a few common header inaccuracies for games are also corrected(detected by CRC32 value). Note that these fixes are not written back to the storage medium.

Support for the recent VS System bit and "number of 8kB RAM banks" is not implemented. Too many iNES headers are corrupt where this new data is stored, causing problems for those games.

The following table lists iNES-format "mappers" supported well in FCE Ultra.

Number: | Description: | Game Examples:
--- | --- | ---
0 | No bankswitching | Donkey Kong, Mario Bros
1 | Nintendo MMC1 | MegaMan 2, Final Fantasy
2 | Simple 16KB PROM Switch(UNROM) | MegaMan, Archon, 1944
3 | Simple 8KB VROM Switch(CNROM) | Spy Hunter, Gradius
4 | Nintendo MMC3 | Super Mario Bros. 3, Recca, Final Fantasy 3
5 | Nintendo MMC5 | Castlevania 3, Just Breed, Bandit Kings of Ancient China
6 | FFE F4 Series(hacked, bootleg) |
7 | AOROM | Battle Toads, Time Lord
8 | FFE F3 Series(hacked, bootleg) |
9 | Nintendo MMC2 | Punchout!
10 | Nintendo MMC4 | Fire Emblem, Fire Emblem Gaiden
11 | Color Dreams | Crystal Mines, Bible Adventures
12 | ?? | Dragon Ball Z 5 ("bootleg" original)
13 | CPROM | Videomation
15 | Multi-cart(bootleg) | 100-in-1: Contra Function 16
16 | Bandai ?? | Dragon Ball Z, SD Gundam Gaiden
17 | FFE F8 Series(hacked, bootleg) |
18 | Jaleco SS806 | Pizza Pop, Plasma Ball
19 | Namco 106 | Splatter House, Mappy Kids
21 | Konami VRC4 2A | WaiWai World 2, Ganbare Goemon Gaiden 2
22 | Konami VRC4 1B | Twinbee 3
23 | Konami VRC2B | WaiWai World, Crisis Force
24 | Konami VRC6 | Akumajou Densetsu
25 | Konami VRC4 | Gradius 2, Bio Miracle:Boku tte Upa
26 | Konami VRC6 A0-A1 Swap | Esper Dream 2, Madara
32 | IREM G-101 | Image Fight 2, Perman
33 | Taito TC0190/TC0350 | Don Doko Don
34 | NINA-001 and BNROM | Impossible Mission 2, Deadly Towers, Bug Honey
40 | (bootleg) | Super Mario Bros. 2
41 | Caltron 6-in-1 | Caltron 6-in-1
42 | (bootleg) | Mario Baby
44 | Multi-cart(bootleg) | Super HiK 7 in 1
45 | Multi-cart(bootleg) | Super 1000000 in 1
46 | Game Station | Rumble Station
47 | NES-QJ | Nintendo World Cup/Super Spike V-Ball
48 | Taito TC190V | Flintstones
49 | Multi-cart(bootleg) | Super HiK 4 in 1
50 | (bootleg) | Super Mario Bros. 2
51 | Multi-cart(bootleg) | 11 in 1 Ball Games
52 | Multi-cart(bootleg) | Mario Party 7 in 1
57 | Multi-cart(bootleg) | Game Star GK-54
60 | Multi-cart(bootleg) | 4 in 1(Reset-selected)
61 | Multi-cart(bootleg) | 20 in 1
62 | Multi-cart(bootleg) | Super 700 in 1
64 | Tengen RAMBO 1 | Klax, Rolling Thunder, Skull and Crossbones
65 | IREM H-3001 | Daiku no Gensan 2
66 | GNROM | SMB/Duck Hunt
67 | Sunsoft ?? | Fantasy Zone 2
68 | Sunsoft ?? | After Burner 2, Nantetta Baseball
69 | Sunsoft FME-7 | Batman: Return of the Joker, Hebereke
70 | ?? | Kamen Rider Club
71 | Camerica | Fire Hawk, Linus Spacehead
72 | Jaleco ?? | Pinball Quest
73 | Konami VRC3 | Salamander
74 | Taiwanese MMC3 CHR ROM w/ VRAM | Super Robot Wars 2
75 | Jaleco SS8805/Konami VRC1 | Tetsuwan Atom, King Kong 2
76 | Namco 109 | Megami Tensei
77 | IREM ?? | Napoleon Senki
78 | Irem 74HC161/32 | Holy Diver
79 | NINA-06/NINA-03 | F15 City War, Krazy Kreatures, Tiles of Fate
80 | Taito X-005 | Minelvation Saga
82 | Taito ?? | Kyuukyoku Harikiri Stadium - Heisei Gannen Ban
83 | Multi-cart(bootleg) | Dragon Ball Party
85 | Konami VRC7 | Lagrange Point
86 | Jaleco ?? | More Pro Baseball
87 | ?? | Argus
88 | Namco 118 | Dragon Spirit
89 | Sunsoft ?? | Mito Koumon
90 | ?? | Super Mario World
91 | ?? | Mari Street Fighter 3 Turbo
92 | Jaleco ?? | MOERO Pro Soccer
93 | ?? | Fantasy Zone
94 | ?? | Senjou no Ookami
95 | Namco ?? | Dragon Buster
96 | Bandai ?? | Oeka Kids
97 | ?? | Kaiketsu Yanchamaru
99 | VS System 8KB VROM Switch | VS SMB, VS Excite Bike
105 | NES-EVENT | Nintendo World Championships
107 | ?? | Magic Dragon
112 | Asder | Sango Fighter, Hwang Di
113 | MB-91 | Deathbots
114 | ?? | The Lion King
115 | ?? | Yuu Yuu Hakusho Final
117 | ?? | San Guo Zhi 4
118 | MMC3-TLSROM/TKSROM Board | Ys 3, Goal! 2, NES Play Action Football
119 | MMC3-TQROM Board | High Speed, Pin*Bot
140 | Jaleco ?? | Bio Senshi Dan
144 | ?? | Death Race
151 | Konami VS System Expansion | VS The Goonies, VS Gradius
152 | ?? | Arkanoid 2, Saint Seiya Ougon Densetsu
153 | Bandai ?? | Famicom Jump 2
154 | Namco ?? | Devil Man
155 | MMC1 w/o normal WRAM disable | The Money Game, Tatakae!! Rahmen Man
156 | ?? | (TBA)
158 | RAMBO 1 Derivative | Alien Syndrome
180 | ?? | Crazy Climber
182 | ?? | Super Donkey Kong
184 | ?? | Wing of Madoola, The
189 | ?? | Thunder Warrior, Street Fighter 2 (Yoko)
193 | Mega Soft | Fighting Hero
200 | Multi-cart(bootleg) | 1200-in-1
201 | Multi-cart(bootleg) | 21-in-1
202 | Multi-cart(bootleg) | 150 in 1
203 | Multi-cart(bootleg) | 35 in 1
225 | Multi-cart(bootleg) | 58-in-1/110-in-1/52 Games
226 | Multi-cart(bootleg) | 76-in-1
227 | Multi-cart(bootleg) | 1200-in-1
228 | Action 52 | Action 52, Cheetahmen 2
229 | Multi-cart(bootleg) | 31-in-1
230 | Multi-cart(bootleg) | 22 Games
231 | Multi-cart(bootleg) | 20-in-1
232 | BIC-48 | Quattro Arcade, Quattro Sports
234 | Multi-cart ?? | Maxi-15
235 | Multi-cart(bootleg) | Golden Game 150 in 1
240 | ?? | Gen Ke Le Zhuan, Shen Huo Le Zhuan
242 | ?? | Wai Xing Zhan Shi
244 | ?? | Decathalon
246 | ?? | Fong Shen Ban
248 | ?? | Bao Qing Tian
249 | Waixing ?? | ??
250 | ?? | Time Diver Avenger

#### UNIF

FCE Ultra supports the following UNIF boards. The prefixes HVC-, NES-, BTL-, and BMC- are omitted, since they are currently ignored in FCE Ultra's UNIF loader.

Group:
Name: | Game Examples:
--- | ---
Bootleg:
MARIO1-MALEE2 | Super Mario Bros. Malee 2
NovelDiamond9999999in1 | Novel Diamond 999999 in 1
Super24in1SC03 | Super 24 in 1
Supervision16in1 | Supervision 16-in-1
Unlicensed:
Sachen-8259A | Super Cartridge Version 1
Sachen-8259B | Silver Eagle
Sachen-74LS374N | Auto Upturn
SA-016-1M | Master Chu and the Drunkard Hu
SA-72007 | Sidewinder
SA-72008 | Jovial Race
SA-0036 | Mahjong 16
SA-0037 | Mahjong Trap
TC-U01-1.5M | Challenge of the Dragon
8237 | Pocahontas Part 2
MMC1:
SAROM | Dragon Warrior
SBROM | Dance Aerobics
SCROM | Orb 3D
SEROM | Boulderdash
SGROM | Defender of the Crown
SKROM | Dungeon Magic
SLROM | Castlevania 2
SL1ROM | Sky Shark
SNROM | Shingen the Ruler
SOROM | Nobunaga's Ambition
MMC3:
TFROM | Legacy of the Wizard
TGROM | Megaman 4
TKROM | Kirby's Adventure
TKSROM | Ys 3
TLROM | Super Spike V'Ball
TLSROM | Goal! 2
TR1ROM | Gauntlet
TQROM | Pinbot
TSROM | Super Mario Bros. 3
TVROM | Rad Racer 2
MMC5:
EKROM | Gemfire
ELROM | Castlevania 3
ETROM | Nobunaga's Ambition 2
EWROM | Romance of the Three Kingdoms 2
MMC6:
HKROM | Star Tropics
Nintendo Discrete Logic:
CNROM | Gotcha
CPROM | Videomation
GNROM | Super Mario Bros./Duck Hunt
MHROM |
NROM-128 | Mario Bros.
NROM-256 | Super Mario Bros.
RROM-128 |
UNROM | Megaman

#### Famicom Disk System

You will need the FDS BIOS ROM image in the base FCE Ultra directory. It must be named "disksys.rom". FCE Ultra will not load FDS games without this file.

Two types of FDS disk images are supported: disk images with the FWNES-style header, and disk images with no header. The number of sides on headerless disk images is calculated by the total file size, so don't put extraneous data at the end of the file.

You should make backups of all of your FDS games you use with FCE Ultra. This is because FCE Ultra will write the disk image back to the storage medium, and the disk image in RAM might have been corrupted because of inaccurate emulation(this case is not likely to occur, but it could occur).

#### Game Genie

The Game Genie ROM image is loaded from the file "gg.rom" in the base directory the first time Game Genie emulation is enabled and a ROM image is loaded since the time FCE Ultra has run.

The ROM image may either be the 24592 byte iNES-format image, or the 4352 raw ROM image.

Remember that enabling/disabling Game Genie emulation will not take effect until a new game is loaded(this statement shouldn't concern any of the "run once" command-line driven ports).

#### VS Unisystem

FCE Ultra currently only supports VS Unisystem ROM images in the iNES format. DIP switches and coin insertion are both emulated. The following games are supported, and have palettes provided(though not necessarily 100% accurate or complete):

Dr. Mario
VS Castlevania
VS Duck Hunt
VS Excitebike
VS Gradius
VS Golf
VS Hogan's Alley
VS Ice Climber
VS Pinball
VS Platoon
VS RBI Baseball
VS Sky Kid
VS Slalom
VS Star Luster
VS Stroke and Match Golf
VS Super Mario Bros
VS Tetris
VS The Goonies

### Automatic IPS Patching

Place the IPS file in the same directory as the file to load, and name it filename.ips.

            Examples:       Boat.nes - Boat.nes.ips
                            Boat.zip - Boat.zip.ips
                            Boat.nes.gz - Boat.nes.gz.ips
                            Boat     - Boat.ips

Some operating systems and environments will hide file extensions. Keep this in mind if you are having trouble.

Patching is supported for all supported formats(iNES, FDS, UNIF, and NSF), but it will probably only be useful for the iNES format. It can be used with the FDS format, but be warned that it will permanently patch your disk image, as the disk image is written back to disk when the game is unloaded(unless the disk image is in a zip file, in which case it isn't written back to disk). UNIF files can't be patched well with the IPS format because they are chunk-based with no fixed offsets.

## Using FCE Ultra

### Key Assignments

Key: | Action:
--- | ---
F5 | Save state.
F7 | Load state.
0-9 | Select save state slot.
F9 | Save screen snapshot.
F10 | Reset.
F11 | Hard reset(toggle power switch).
F12 | Exit.

#### VS Unisystem

Key: | Action:
--- | ---
F8 | Insert coin.
F6 | Show/Hide dip switches.
1-8 | Toggle dip switches(when dip switches are shown).

#### Famicom Disk System

Key: | Action:
--- | ---
F6 | Select disk and disk side.
F8 | Eject or Insert disk.

#### Game Pad

Key: | Button on Emulated Gamepad:
--- | ---
Left Control | B
Left Alt | A
Enter/Return | Start
Tab | Select
Cursor Down | Down
Cursor Up | Up
Cursor Left | Left
Cursor Right | Right

#### Power Pad

Side B
O | P | [ | ]
K | L | ; | '
M | , | . | /

Side A
| P | [ |
K | L | ; | '
| , | . |

#### Family Keyboard

All emulated keys are mapped to the closest open key on the PC keyboard, with a few exceptions. The emulated "@" key is mapped to the "`"(grave) key, and the emulated "kana" key is mapped to the "Insert" key(in the 3x2 key block above the cursor keys).

To enable or disable Family Keyboard input, press the "Scroll Lock" key. When Family Keyboard input is enabled, FCE Ultra will also attempt to prevent any key presses from being passed to the GUI or system.

### Command-line

FCE Ultra supports arguments passed on the command line. The MS Windows port only allows for a file name to be specified, however. Arguments are taken in the form of "-parameter value". Some arguments are valueless. Arguments that have both a parameter and a value will be saved in the configuration file, with the exception being the network-play arguments. All ports other than the MS Windows one recognize the following parameters:

Argument: | Value Type: | Default value: | Description:
--- | --- | --- | ---
-cpalette x | string | 0 | Load a custom global palette from file "x". Specifying "0" will cause FCE Ultra to stop using the custom global palette.
-ntsccol x | boolean | 0 | If value is true, enable automatic generation and use of an NTSC NES' colors.
-pal x | boolean | 0 | If value is true, emulate a PAL NES. Otherwise emulate an NTSC NES.
-sound x | integer | 48000(44100 for DOS) | Sets the playback rate. If it is zero, sound emulation(and output) is disabled.
-soundvol x | integer | 100 | Sound volume.
-soundq x | boolean | 0 | If value is true, enable high-quality sound emulation.
-input1 x and -input2 x | string | gamepad | Select input device for input port 1 or 2. Valid strings are "none", "gamepad", "zapper", "powerpada", and "powerpadb".
-fcexp x | string | none | Select Famicom expansion port device. Valid strings are "none", "shadow", "arkanoid", "4player", and "fkb".
-nofs x | boolean | 0 | If value is true, disable four-score emulation.
-gg | boolean | 0 | Enable Game Genie emulation.
-subase x | boolean | 0 | If value is true, Save extra game data files under the base directory.
-snapname x | boolean | 0 | If value is true, use an alternate naming scheme(file base and numeric) for screen snapshots.
-nothrottle x | boolean | 0 | If value is true, disable the speed throttling that is used when sound emulation is disabled.
-clipsides x | boolean | 0 | If value is true, clip leftmost and rightmost 8 columns of pixels of the video output.
-slstart x | integer | 8 | First scanline to be rendered in NTSC emulation mode(when PAL emulation is disabled).
-slend x | integer | 231 | Last scanline to be rendered in NTSC emulation mode.
-slstartp x | integer | 0 | First scanline to be rendered in PAL emulation mode.
-slendp x | integer | 239 | Last scanline to be rendered in PAL emulation mode.

#### SDL

Argument: | Value Type: | Default value: | Description:
--- | --- | --- | ---
-joyx y | integer,integer | 0 | Enable joystick #y for virtual joystick #x(both starting at "1").
-stretchx/-stretchy x | boolean | 0/0 | Stretch to fill surface on x or y axis(fullscreen, only with OpenGL).
-fs | boolean | 0 | Full screen mode.

#### DOS

#### Linux SVGAlib

## Credits

Name: | Contribution(s):
--- | ---
\Firebug\ | High-level mapper information.
Bero | Original FCE source code.
Brad Taylor | NES sound information.
Chris Hickman | Archaic Ruins.
Donald Moore | DC PasoFami NES packs.
Fredrik Olson | NES four-player adapter information.
Gilles Vollant | PKZIP file loading functions.
goroh | Various documents.
Info-ZIP | ZLIB
Jeremy Chadwick | General NES information.
Justin Smith | Good stuff.
Kevin Horton | Low-level NES information and sound information.
Ki | Various technical information.
Mark Knibbs | Various NES information.
Marat Fayzullin | General NES information.
Matthew Conte | Sound information.
nori | FDS sound information.
Quietust | VRC7 sound translation code by The Quietust (quietust at ircN dort org).
R. Hoelscher | Famicom four-player adapter information.
Rob Mocca | DC PasoFami NES packs, testing.
Sean Whalen | Node 99
Tatsuyuki Satoh | OPL2 emulator used for the VRCVII sound emulation.
TheRedEye | ROM images, testing.