4 http://fceultra.sourceforge.net/
9 * Screen snapshots can now be taken while playing an NSF.
10 * Saving screen snapshots will no longer corrupt the frame buffer.
11 * Added many more games to the list of games that usually are found
12 with bad iNES headers.
13 * Fixed more network play bugs. It should now work correctly(how
14 many times have I said or implied that...).
15 * The NSF player will now disable the FDS sound channel on song
16 initialization(fixes a problem with the Zelda no Densetsu
18 * Reads from $4090 and $4092 while emulating the FDS will now return
19 the current envelope settings. Affects "Ai Senshi Nicole"
20 and "Bio Miracle Bokutte Upa", at least.
21 * Merged a lot of pirate MMC3 multicart emulation code with the main
23 * Added support for the MMC5's split-screen mode. This fixes the
24 introduction in "Uchuu Keibitai SDF".
25 * Writes to $8000-$FFFF with D7 set during MMC1 emulation will
26 cause the MMC1 mode register to be OR'd with $C. This fixes
28 * Replaced an MMC1 hack that I used to get "Bill and Ted's Excellent
29 Video Game Adventure" to work with something more accurate.
30 * Fixed the MMC5 read handler to return the data last on the data
31 bus instead of $FF when a read occured to an unmapped address.
32 This fixes the lockup problem in "Bandit Kings of Ancient China"
33 and possibly other games.
34 * Added support for the game "Ishin no Arashi" in the iNES format
35 (I added an entry with its CRC32 value and the number of 8KB
36 WRAM banks it needs into the MMC5 WRAM size table).
37 * Added support for MMC1 games in the iNES format with 16KB of RAM
38 via CRC32 comparisons(currently only Genghis Khan(USA), Romance
39 of the 3 Kingdoms(USA), and Nobunaga's Ambition(USA and Japan) are
41 * iNES mapper 1 now supports pageable CHR RAM if CHR ROM is not
42 present. Fixes "Family School".
43 * Added support for iNES mappers 51 and 52. Thanks to Kevin Horton
45 * Modified MMC3(iNES mapper 4/118/119) IRQ counter emulation. Fixes
46 problems in "MegaMan 3", "Gun Nac", and the Japanese version of
47 "Klax", but it *might* cause problems with other games.
48 * Fixed an iNES mapper 32 emulation bug. "Ai Sensei no Oshiete"
50 * Fixed iNES mapper 33/48 IRQ emulation.
51 * Fixed iNES mapper 16 IRQ emulation.
52 * Added support for "Famicom Jump 2" as iNES mapper 153.
53 If a good(as far as I can tell) dump is loaded, FCE Ultra will
54 automatically fix the mapper number.
55 * The VS Unisystem bit in iNES headers is no longer recognized.
56 Too many games have this bit set when it shouldn't be set.
57 Now VS Unisystem games are recognized by CRC32 value.
58 * Reads from $4015 no longer reset DMC IRQ. This fixes the
59 title screen of "Romancia".
60 * PPU NMI now occurs a few cycles later. Fixes the "BattleToads"
62 * BRK emulation now sets the I flag.
63 * Changed a few zero-page address mode functions to read directly
65 * Added a new video mode(256x224 at a refresh rate of 103 Hz).
66 * Increased the refresh rate of video mode 2 to 65 Hz.
67 * Increased the refresh rate of video mode 3 to 120 Hz.
68 * Added speed throttling used when sound is disabled, and a
69 command-line switch to control it.
76 1.0 What FCE Ultra is.
77 1.1 System requirements.
79 2.0 Starting FCE Ultra
82 3.0 Platform Specific Notes
83 3.1 Network Play Notes
84 3.2 VS Unisystem Notes
85 3.3 Famicom Disk System Notes
88 3.6 Compressed File Notes
91 4.0 Contacting the author
94 /******************************************************************************/
95 /* 1.0) What FCE Ultra is: */
96 /******************************************************************************/
98 FCE Ultra is an NTSC and PAL Famicom/NES emulator for various
99 platforms. It is based upon Bero's original FCE source code. Current
100 features include good PPU, CPU, pAPU, expansion chip, and joystick
101 emulation. Also a feature unique to this emulator(at the current
102 time) is authentic Game Genie emulation. Save states and snapshot
103 features also have been implemented. The VS Unisystem is emulated
104 as well. FCE Ultra supports iNES format ROM images, UNIF format ROM
105 images, headerless and FWNES style FDS disk images, and NSF files.
107 FCE Ultra currently supports the following iNES mappers(many partially):
109 Number: Description: Game Examples:
110 --------------------------------------------------------------------------------
111 0 No Mapper Donkey Kong, Mario Bros
112 1 Nintendo MMC1 MegaMan 2, Final Fantasy
113 2 Simple 16KB PRG Switch MegaMan 1, Archon, 1944
114 3 Simple 8KB CHR Switch Spy Hunter, Gradius
115 4 Nintendo MMC3 Recca, TMNT 2, Final Fantasy 3
116 5 Nintendo MMC5 Castlevania 3, Just Breed, Uchuu Keibitai SDF
117 6 FFE F4 Series(hacked) Saint Seiya, Ganbare Goemon
118 7 AOROM Battle Toads, Lion King
119 8 FFE F3 Series(hacked) Doraemon Kaitakuhen
120 9 Nintendo MMC2 Punchout!
121 10 Nintendo MMC4 Fire Emblem, Fire Emblem Gaiden
122 11 Color Dreams Crystal Mines, Bible Adventures
124 15 Multi-cart(pirate) 100-in-1: Contra Function 16
125 16 Bandai Dragon Ball Z, Gundam Knight
126 17 FFE F8 Series(hacked) Parodius, Last Armageddon
127 18 Jaleco SS806 Pizza Pop, Plazma Ball
128 19 Namco 106 Splatter House, Mappy Kids
129 21 Konami VRC4 2A WaiWai World 2, Ganbare Goemon Gaiden 2
130 22 Konami VRC4 1B Twinbee 3
131 23 Konami VRC2B WaiWai World, Getsufuu Maden
132 24 Konami VRC6 Akumajo Densetsu(Dracula 3)
133 25 Konami VRC4 Gradius 2, Bio Miracle: Boku tte Upa
134 26 Konami VRC6 A0-A1 Inverse Esper Dream 2, Madara
135 32 Irem G-101 Image Fight 2, Perman
136 33 Taito TC0190/TC0350 Don Doko Don 1&2
137 34 NINA-001 and BNROM Impossible Mission 2, Deadly Towers, Bug Honey
138 40 (pirate) Super Mario Bros. 2
139 41 Caltron 6-in-1 Caltron 6-in-1
140 42 (pirate) "Mario Baby"
141 43 Multi-cart(pirate) Golden Game 150 in 1
142 44 Multi-cart(pirate) Super HiK 7 in 1
143 45 Multi-cart(pirate) Super 1000000 in 1
144 46 Game Station Rumble Station
145 47 NES-QJ Nintendo World Cup/Super Spike V.B.
146 48 Taito TC190V Flintstones
147 49 Multi-cart(pirate) Super HiK 4 in 1
148 51 Multi-cart(pirate) 11 in 1 Ball Games
149 52 Multi-cart(pirate) Mario Party 7 in 1
150 64 Tengen RAMBO-1 Shinobi, Klax
151 65 Irem H-3001 Daiku no Gensan 2
152 66 GNROM SMB + Duck Hunt
153 67 Sunsoft Mapper "3" Fantasy Zone 2
154 68 Sunsoft Mapper "4" After Burner 2, Nantetta Baseball
155 69 Sunsoft FME-7 Batman: ROTJ, Gimmick!
156 70 ?? Kamen Rider Club
157 71 Camerica Fire Hawk, Linus Spacehead
158 72 Jaleco ?? Pinball Quest
159 73 Konami VRC3 Salamander
160 75 Jaleco SS8805/Konami VRC1 Tetsuwan Atom, King Kong 2
161 76 Namco 109 Megami Tenshi 1
162 77 Irem ?? Napoleon Senki
163 78 Irem 74HC161/32 Holy Diver
164 79 NINA-06 F15 City War, Krazy Kreatures
165 80 Taito X-005 Minelvation Saga
166 82 Taito ?? Kyuukyoku Harikiri Stadium - Heisei Gannen Ban
167 83 Multi-cart(pirate) Dragon Ball Party
168 85 Konami VRC7 Lagrange Point
169 86 Jaleco ?? More Pro Baseball
171 89 Sunsoft ?? Mito Koumon
172 90 Pirate Super Mario World, Mortal Kombat
173 92 Jaleco ?? MOERO Pro Soccer, MOERO Pro Yakyuu '88
175 94 ?? Senjou no Ookami
176 95 Namco ?? Dragon Buster
177 97 ?? Kaiketsu Yanchamaru
178 99 VS System 8KB CHR Switch VS SMB, VS Excite Bike
179 105 NES-EVENT Nintendo World Championships
180 112 Asder Sango Fighter, Hwang Di
182 118 MMC3-TLSROM/TKSROM Board Ys 3, Goal! 2, NES Play Action Football
183 119 MMC3-TQROM Board High Speed, Pin*Bot
184 140 Jaleco ?? Bio Senshi Dan
185 151 Konami VS System Expansion VS The Goonies, VS Gradius
186 152 ?? Arkanoid 2, Saint Seiya Ougon Densetsu
187 153 Bandai ?? Famicom Jump 2
189 182 ?? Super Donkey Kong
190 184 ?? Wing of Madoola, The
191 189 Micro Genius TXC ?? Thunder Warrior
192 225 Multi-cart(pirate) 58-in-1/110-in-1/52 Games
193 226 Multi-cart(pirate) 76-in-1
194 227 Multi-cart(pirate) 1200-in-1
195 228 Action 52 Action 52, Cheetahmen 2
196 229 Multi-cart(pirate) 31-in-1
197 232 BIC-48 Quattro Arcade, Quattro Sports
198 234 Multi-cart ?? Maxi-15
199 240 ?? Gen Ke Le Zhuan, Shen Huo Le Zhuan
200 242 ?? Wai Xing Zhan Shi
203 250 ?? Time Diver Avenger
205 FCE Ultra currently supports the following UNIF boards(minus the
206 prefixes HVC-, NES-, BTL-, and BMC-, as they are currently ignored):
208 Group: Name: Game Examples:
209 --------------------------------------------------------------------------------
211 MARIO1-MALEE2 Super Mario Bros. Malee 2
212 NovelDiamond9999999in1 Novel Diamond 999999 in 1
213 Super24in1SC03 Super 24 in 1
214 Supervision16in1 Supervision 16-in-1
217 Sachen-8259A Super Cartridge Version 1
218 Sachen-8259B Silver Eagle
219 Sachen-74LS374N Auto Upturn
220 SA-016-1M Master Chu and the Drunkard Hu
225 TC-U01-1.5M Challenge of the Dragon
232 SGROM Defender of the Crown
236 SNROM Shingen the Ruler
237 SOROM Nobunaga's Ambition
240 TFROM Legacy of the Wizard
242 TKROM Kirby's Adventure
244 TLROM Super Spike V'Ball
248 TSROM Super Mario Bros. 3
254 ETROM Nobunaga's Ambition 2
255 EWROM Romance of the Three Kingdoms 2
267 NROM-256 Super Mario Bros.
272 /******************************************************************************/
273 /* 1.1) System requirements: */
274 /******************************************************************************/
276 Minimum system requirements:
280 400 KB free disk space
284 Recommended system specifications(at least):
290 SVGA adapter with 512 KB of RAM
291 Sound device capable of handling a sample rate of about 44100 hz.
294 /******************************************************************************/
295 /* 2.0) Starting FCE Ultra */
296 /******************************************************************************/
298 Start FCE Ultra using the following format:
300 ./fceu <arguments> romimage.nes
302 <arguments> can be one or more of the following:
304 -vmode x Select video mode(all are 8 bpp).
305 1 = 256x240 @ 72 hz <Default>
307 3 = 256x256(with scanlines) @ 120 hz
308 4 = 640x480(with scanlines)
309 5 = 640x480("1 per 4")
310 6 = 256x224(with scanlines) @ 120 hz
313 -vsync x Wait for the screen's vertical retrace before updating
314 the screen. If you have sound enabled and enable this,
315 you may have to increase the number of sound fragments
316 from the default of 8, to reduce buffer underruns.
317 Buffer underruns will not be preventable if the
318 current video refresh rate is < ~60 hz (or < ~50 hz
319 if PAL emulation is enabled).
320 0 = Disabled. <Default>
322 -cpalette x Load a custom global palette from file x.
323 The filename x is saved in the configuration file,
324 not the data from the file. Note that you should
325 probably use an absolute("/home/jp/test.pal") filename
326 rather than a relative("test.pal") filename. If x is 0,
327 the default (built in) global palette will be used.
328 -ntsccol Emulate an NTSC's TV's colors based on user-supplied
330 0 = Disabled. <Default>
332 -sound x Sound. <Default=48000>
334 Otherwise, x = playback rate in samples per second.
335 -soundvol x Sound volume. x is an integral percentage value.
336 The default value is, obviously, 100.
337 Setting it higher will increase the likelihood that
338 sound clipping will occur. This shouldn't be noticeable
339 if the volume is reasonable(200% or lower; perhaps even
340 higher for many games).
341 -sfragsize x Set sound fragment size to 2^x(2 to the power of x)
342 SAMPLES. The default value is 7.
343 -snfrags x Set number of sound fragments to x. The default value
345 -f8bit x Force 8-bit sound. Enabling this will decrease
346 sound quality noticeably without increasing
347 performance noticeably. Only use when 16-bit sound
349 0 = Disabled. <Default>
351 -nothrottle x Disables speed throttling used when sound is disabled
352 if x is non-zero. The default value of x is 0.
353 -joyx y Joystick mapped to virtual joystick x(1-4).
354 0 = Disabled, reset configuration. <Default>
355 Otherwise, y(1-inf) = joystick number.
356 -inputx str Select device mapped to virtual NES-style input port
358 The default for both virtual input ports is "gamepad".
359 str may be: none, gamepad, zapper, powerpada,
361 -fcexp str Select Famicom expansion port device. If you select
362 a device other than "none", you should enable the
363 "gamepad" on both NES-style virtual input ports.
364 The default is "none".
365 str may be: none, shadow, arkanoid, 4player, fkb
366 -nofs x Disables Four-Score emulation if x is 1. Default is 0.
367 Note that Four-Score emulation will only be active
368 if "gamepad" is mapped to one or both virtual input
370 -gg Enable Game Genie emulation.
371 -pal Emulate a PAL NES.
372 -no8lim x Disables the 8 sprites per scanline limitation.
373 0 = Limitation enabled. <Default>
374 1 = Limitation disabled.
375 -subase x Save extra game data files(such as battery-backed RAM)
376 under the base directory if enabled.
377 0 = Disabled. <Default>
379 -snapname x Selects what type of file name screen snapshots will
381 0 = Numeric(0.png) <Default>
382 1 = File base and numeric(mario-0.png)
383 -clipsides x Clip leftmost and rightmost 8 columns of pixels of
385 0 = Disabled. <Default>
387 -slstart x Set the first drawn emulated scanline for NTSC emulation
388 mode. Valid values for x are 0 through 239.
389 The default value is 8.
390 -slend x Set the last drawn emulated scanline for NTSC emulation
391 mode. Valid values for x are 0 through 239.
392 The default value is 239.
393 -slstartp x Set the first drawn emulated scanline for PAL emulation
394 mode. Valid values for x are 0 through 239.
395 The default value is 0.
396 -slendp x Set the last drawn emulated scanline for PAL emulation
397 mode. Valid values for x are 0 through 239.
398 The default value is 239.
399 -connect s Connect to server 's' for TCP/IP network play.
400 -server Be a host/server for TCP/IP network play.
401 -netport x Use TCP/IP port x for network play. The default
403 /******************************************************************************/
404 /* 2.1) General Keyoard Key Mapping: */
405 /******************************************************************************/
409 For emulated Family BASIC Keyboard:
410 Enable/Disable Keyboard Input Scroll Lock
411 (enabling emulated keyboard input will disable
413 All emulated keys are mapped to the closest open key on the PC
414 keyboard, with a few exceptions. The emulated "@" key is
415 mapped to the "`"(grave) key, and the emulated "kana" key
416 is mapped to the "Insert" key(in the 3x2 key block above the
419 For emulated game pads:
429 For emulated power pads(keys correspond to button locations on
438 S Select disk/disk side.
440 For VS Unisystem games:
442 V Show/Hide dip switches.
443 1-8 Toggle dip switches(when dip switches
446 T Select tint to adjust.
447 H Select hue to adjust.
448 +/- Increase/decrease tint or hue.
450 0-9 Select save state.
451 Caps Lock Select virtual joystick.
453 F2 Activate cheat interface.
455 F3 Lock virtual console.
456 F4 Unlock virtual console.
458 F5/F7 Save/Load state.
459 F9 Save screen snapshot.
465 /******************************************************************************/
466 /* 3.0) Platform Specific Notes */
467 /******************************************************************************/
469 1. FCE Ultra uses SVGAlib, so you'll obviously need to have it
472 2. Be careful when using the non-VGA video modes(such as 640x480).
473 SVGAlib doesn't always handle virtual terminal switching well when
474 one of these modes is being used. Also, since FCE Ultra enables a
475 a linear frame buffer for these modes, heed this warning from
476 the SVGAlib documentation:
478 Furthermore, some cards (Cirrus) just enable this buffer
479 at a fixed hardware address. For Cirrus it is mapped at
480 14MB so you should never used it if you have more than
481 14MB of memory (But how does an application know?). The
482 Mach32 support for this is smarter. It makes this feature
483 only available when it is safe to be used.
485 3. FCE Ultra must be run as root in order to get access to the
486 VGA hardware. SVGAlib will drop root privileges if you are running
487 the program as a normal user and the suid root bit is set and the
488 executable is owned by root. Example:
489 chown root fceu ; chmod 4755 fceu
490 Make sure you have the latest stable release of SVGAlib, though.
492 4. FCE Ultra will save all data(state saves/screen snapshots) in
493 ~/.fceultra, so make sure your "HOME" environment variable is set
496 If you believe FCE Ultra is too slow, you can try the following:
497 * Kill some of the other processes.
498 * Disable sound emulation.
499 * Raise the priority of FCE Ultra with the 'nice' command.
500 Ex: nice -n -20 ./fceu
502 /******************************************************************************/
503 /* 3.1) Network Play Notes */
504 /******************************************************************************/
506 In TCP/IP network play, the server will be player one, and the
507 client will be player 2.
509 Zapper emulation and power pad emulation currently do not work with
512 Having Game Genie or PAL emulation enabled on only one side
515 Both players MUST use the same ROM/disk image and SRAM
518 When using FDS or VS Unisystem games with network play, only player
519 1 will be able to insert disk, eject disk, insert coins, toggle dip
522 /******************************************************************************/
523 /* 3.2) VS Unisystem Notes */
524 /******************************************************************************/
526 FCE Ultra currently only supports VS Unisystem ROM images in the
531 * VS Unisystem games that are about 49,000 bytes in size most likely
533 * Other VS Unisystem games will use other mappers. Here is a short
534 list of games and the mappers they use:
545 * The colors in many VS Unisystem games may be incorrect. This
546 is due to each game having its own PPU, and thus using a
547 different palette than games that use a different PPU.
550 /******************************************************************************/
551 /* 3.3) Famicom Disk System Notes */
552 /******************************************************************************/
554 You will need the FDS BIOS ROM image in the base FCE Ultra directory.
555 It must be named "disksys.rom". I will not give this file to you, so
558 Two types of FDS disk images are supported: disk images with the
559 FWNES-style header, and disk images with no header.
561 You should make backups of all of your FDS games you use with FCE
562 Ultra. This is because FCE Ultra will write the disk image back to
563 the storage medium, and the disk image in RAM might have been corrupted
564 because of inaccurate emulation(this case is not likely to occur, but
568 /******************************************************************************/
569 /* 3.4) Light Gun Notes */
570 /******************************************************************************/
572 Currently, the NES Zapper and the light gun used with the VS
573 Unisystem(I will call both the same name, Zapper) are supported.
574 Most(all?) NES games expect the Zapper to be plugged into port 2.
575 and most(all?) VS Unisystem games expect the Zapper to be plugged
578 The LEFT mouse button is the emulated trigger button for the
579 Zapper. The RIGHT mouse button is also emulated as the trigger,
580 but as long as you have the RIGHT mouse button held down, no color
581 detection will take place, which is effectively like pulling the
582 trigger while the Zapper is pointed away from the television screen.
583 Note that you must hold the RIGHT button down for a short
584 time(greater than just a fast click, shorter than a second).
586 Zapper emulation currently does NOT work with network play, so
587 don't even try it. I may add support in the future if enough
588 people want it or if I want it.
591 /******************************************************************************/
592 /* 3.5) Palette Notes */
593 /******************************************************************************/
595 Palettes files are expected to contain 64 8-bit RGB triplets(each in
596 that order; red comes first in the triplet in the file, then green,
597 then blue). Each 8-bit value represents brightness for that particular
598 color. 0 is minimum, 255 is maximum.
600 Palettes can be set on a per-game basis. To do this, put a palette
601 file in the "gameinfo" directory with the same base filename
602 as the game you wish to associate with and the extension "pal".
605 File name: Palette file name:
606 BigBad.nes BigBad.pal
607 BigBad.zip BigBad.pal
608 BigBad.Better.nes BigBad.Better.pal
611 With so many ways to choose a palette, figuring out which one will
612 be active may be difficult. Here's a list of what palettes will
613 be used, in order from highest priority to least priority(if a condition
614 doesn't exist for a higher priority palette, the emulator will
615 continue down its list of palettes).
617 NSF Palette(for NSFs only)
618 Palette loaded from the "gameinfo" directory.
619 NTSC Color Emulation(only for NTSC NES games).
620 VS Unisystem palette(if the game is a VS Unisystem game and a palette
622 Custom global palette.
626 /******************************************************************************/
627 /* 3.6) Compressed File Notes */
628 /******************************************************************************/
630 FCE Ultra can load data from both PKZIP-format files and
631 gzip-format files. Only one type of (de)compression algorithm is
632 supported: "deflate"; this seems to be the most popular compression
635 A compressed FDS disk image will only be saved back to disk if it
636 uses the gzip format.
638 All files in a PKZIP format file will be scanned for the
639 followings extensions: .nes, .fds, .nsf, .unf, .nez, .unif
640 The first compressed file to have one of these extensions will be
641 loaded. If no compressed file has one of these extensions, the
642 first compressed file will be loaded.
645 /******************************************************************************/
646 /* 3.7) Game Genie Notes */
647 /******************************************************************************/
649 The Game Genie ROM image is loaded from the file "gg.rom" in the
650 base directory the first time Game Genie emulation is enabled and
651 a ROM image is loaded since the time FCE Ultra has run.
653 The ROM image may either be the 24592 byte iNES-format image, or
654 the 4352 raw ROM image.
656 Remember that enabling/disabling Game Genie emulation will not take
657 effect until a new game is loaded(this statement shouldn't concern
658 any of the "run once" command-line driven ports).
660 /******************************************************************************/
661 /* 4.0) Contacting the author */
662 /******************************************************************************/
664 I can be reached via email at xodnizel@users.sourceforge.net.
665 Bero can be reached via email at 9bero9@geocities.co.jp
666 (Note that Bero can not and will not answer any questions
667 regarding the operation of FCE Ultra, so please don't ask him.
668 If you understand this, remove the 9's from the email address
669 provided to get his real email address.)
672 /******************************************************************************/
674 /******************************************************************************/
676 \Firebug\ - High-level mapper information.
677 Bero - Original FCE source code.
678 Brad Taylor - NES sound channel guide.
679 Chris Hickman - Archaic Ruins.
680 Donald Moore - DC PasoFami NES packs.
681 Fredrik Olson - NES four-player adapter information.
682 Gilles Vollant - PKZIP file loading functions.
683 goroh - Various documents.
684 Jeff Tamer - Insaniacal fun.
685 Jeremy Chadwick - General NES information.
686 Justin Smith - Giving me obscure ROM images in the "dark ages of
688 Kevin Horton - Low level NES information and sound information.
689 Ki - Various technical information.
690 Mark Knibbs - Various NES information.
691 Marat Fayzullin - General NES information.
692 Matthew Conte - Sound information.
693 N. Andou - Awesome NES/SNES emulators, at the time...
694 nori - FDS sound information.
695 Quietust - VRC7 sound translation code by The Quietust
697 Ideas and corrections.
698 R. Hoelscher - Famicom four-player adapter information.
699 Rob Mocca - DC PasoFami NES packs, testing.
700 Sean Whalen - Node99.
701 Tatsuyuki Satoh - OPL2 emulator
702 TheRedEye - ROM images, testing.
707 ...and everyone else who has helped me.