Snes9x: The Portable Super Nintendo Entertainment System Emulator ================================================================= v1.18d 24-FEB-1999 ================== Home page: www.snes9x.com Contents ======== Changes Since Last Release Introduction What's Emulated What's Not What You Will Need Getting Started/Command Line Options Keyboard Controls Joystick Support Netplay Support Super FX Problems With ROMs Sound Problems Converting ROM Images Speeding up the Emulation Credits Changes Since Last Release ========================== 1.18 - Implemented a sync-sound mode where sound data gets generated in sync with SPC700 instructions being executed. Finally the sound Williams Arcade classics can be heard. Also helps slight sound timing problems in many other games but doesn't fix Mortal Kombat 2 like I thought it would - its sound routine programmers must have been on drugs or something! - Added interpolated sound - gives low frequency sounds much more bass similar to a real SNES especially with the playback rate ramped up to 44KHz. - Added on-screen messages as various emulation options are toggled on and off using the in-game keys. - Fixed a PPU register read bug with the sprite register write position. Thanks to Takehiro TOMINAGA for the bug report. - Altered the auto-frame skip timing code to only wait and re-sync to the end of frame when frames haven't been skipped. Again thanks to Takehiro. - Speeded up the colour addition and subtraction code using ideas from Takehiro. 1.17 - Linux and UNIX sound code now driven directly from signal timer handler rather than the timer handler just setting a flag which had to be polled in the main emulation code. Slightly faster execution. - Fixed the crash bug in the ZSNES Super FX asm code with Vortex - the game's polygons still aren't visible though. - Implemented bent-line increase and exponential decay and sustain volume envelopes - they should match, or at least be very similar to the real SNES sound DSP chip now. - It would seem ROMs can key on sound channels even if the channel hasn't been keyed-off, Pac-In-Time requires it. Changed code to allow it. - Quick mod to ZSNES Super FX code to get Winter Gold working - it was already working with the C Super FX code. - Added emulation of the extra 1/2 scan-line per frame on PAL and NTSC - should help improve music speed emulation. - Worked around the click sound heard when ROMs use 0 volume envelope attack rate. - Removed the 'check for IRQ already happened' H-IRQ position register setting code - it was causing problems for Ninja Warriors and was not required by F1 Grand Prix. - Fixed a bug in the new sound code - the sustain part of the attack-decay-sustain-release volume envelope was being skipped if the sustain level wasn't at 100%. The fix has helped some music notes from being cut off early in a few games. - Added fix to Pro Action Reply support (again). Thanks to Paul Shoener III for the original fix and Gil Pedersen for reminding me to apply it! - Finally fixed the Tales of Phantasia 'bum note' problem! The ROM set its sample directory to the upper-most page and I forget to code for the hidden 64 bytes of RAM, that appear when the boot ROM is switched off, when fetching sample addresses. - Adjusted the relative cycle length between the 65c816 and the SPC700 slightly to get Terranigma working again. - Oops, the emulated joypads 3 and 4 via the emulated Multi-player 5 interface weren't working. Thanks to Steffen Schwenke for the bug report. - Optimised the echo sound code - by-passed the the FIR filter code if only a pass-through FIR filter was defined by the ROM. - Modified V and H-IRQ register changing code to trigger an IRQ immediately if V-IRQ is enabled and the scan-lines match and either H-IRQ is not enabled or the electron beam position has already gone past the trigger point. Fixes the screen flicker in F1 Grand Prix. - Modified the priority-per-pixel mode 7 code to use BG#1's clipping data if the top bit of the mode 7 pixel is set. Fixes initial track drive-through display in F1 Grand Prix. - Modified the sprite priority levels for the priority-per-pixel mode 7 display. Now the car can be seen in F1 Grand Prix. - Wrote a sound DSP register recording scheme which 'plays back' the register changes in sync with the sound generation code. I'm bit disappointed, it only improves the sound in a very few games... Scrapped the code, it actually causes more problems than it fixes. Oh, well, another 3 weeks work wasted... - Fixed a SPC700 wake up problem for Lufia I - made the SPC700 also wake up when the 65c816 read from one of the four comm ports. - Included lots of sound code speed ups and sound quality improvements from Takehiro TOMINAGA - many thanks go to him. 1.16 - Fixed a case where the -forcelorom option didn't work - the case was required for Formation Soccer which claims in its ROM header to use the same memory map as Super FX ROM, it doesn't. - Pulled apart a real SNES using a crowbar (great fun), just to look at what speed the SPC700 is actually clocked at for more acturate relative emulation speed. - Implemented SPC700 cycle counting in the hope the improved timing would fix Tales'; no such luck but at least the -ratio option is obsolete now. - Implemented executing SPC700 instructions during DMA, fixes BS Zelda, Goal and Smurfs 2 lock up at start and music pausing briefly when ROMs do lots of DMA, usually between game screens. - Scrapped the i386 asm SPC700 code - it was the cause of the music not restarting after a battle in Chrono Trigger and FF3 and I didn't realise because the bug had already occurred in the test freeze-file I had. Thanks to John Stiles for pointing out that the Mac port didn't have the missing music problem in the first place. - Fixed RGB subtraction bug on displays with only 5 bits for green, e.g. RGB555 displays. The GREEN_HI_BIT variable was always set to a value for 6 bit green displays. - Added the SA-1 memory map, still a long way to go before any SA-1 game will run. 1.15 - Jumped versions to keep in sync with the DOS port release. 1.14 - Improved 8-bit sound generation slightly, but it still sounds very poor compared to 16-bit sound. 1.13 - Implemented the Tales of Phantasia memory map using the information supplied by zsKnight. Had to also implement a de-interleave routine to work around a ROM feature and Snes9x CPU instruction fetching implementation detail. - Added a frames-per-second on-screen display option. - Fixed the final glitch bug with the Mario Kart track display - the byte code for the termination of the DSP1 raster command wasn't been recognised. - Disabled a NMI/DMA hack for Rise of the Robots, was causing problems for Mario Kart and 'Robots wasn't working correctly anyway. - Optimised the mode 7 rendering a little. - Changed tile rendering code to use offsets into screen buffer rather than direct pointers ready for z-buffer implementation. 1.12 - Changed V-blank NMI to occur immediately after a WAI instruction, Toy Story required this. - Fixed reading of H-DMA line counter register, Top Gear 3000 needed this. - Ripped off large parts of ZSNES's DSP1 code (with _Demo_'s and zsKnight's approval). Now Mario Kart works almost 100%. - Added a check to see if a vertical scanline IRQ register change will cause a H-IRQ later on the current scanline. Pilot Wings needed this. - Fixed possible crash bug in clip window code when both windows had two spans. Could actually cause Chrono Trigger to crash the emulator. - Fixed a lock-up problem with the C Super FX code, Star Fox and executing a few 'FX instructions per scan-line (required for Winter Gold). Introduction ============ Snes9x is a portable, freeware Super Nintendo Entertainment System (SNES) emulator. It basically allows you to play most games designed for the SNES and Super Famicom Nintendo game systems on your PC or Workstation; which includes some real gems that were only ever released in Japan. Snes9x is the result of well over two years worth of part-time hacking, coding, recoding, debugging, divorce, etc. (just kidding about the divorce bit). Snes9x is coded in C++, with three assembler CPU emulation cores on the i386 Linux and Windows ports. Snes9x is better than a real SNES: o Freeze a game at any position, then restore the game to that exact spot at a later date - ideal for saving a game just before a difficult bit. o Built-in cheat cartridge. o Built-in peripheral emulation. The SNES mouse, Multi-player 5 and SuperScope external add-ons are all emulated, they cost extra money with a real SNES. o Stereo sound - yes I know the SNES produced stereo sound, but who actually paid the inflated price for the special lead just so you could hear it? o No more cartridge contact cleaning! o Some SNES hardware features that be turned on and off during game play, games might be using one of these features to deliberately make a section of the game more difficult. Easy, just turn the feature off. o Networked game play. Snes9x is worse than a real SNES: o Unless your computer is very fast (Pentium II+), some games just can't hit every frame being rendered and the emulator starts to omit rendering some frames to keep the emulator running at a constant speed - to you it appears as if the graphics aren't moving as smoothly as they should. o Not all games work; bugs and missing features cause some games to fail to work or renders them un-playable. o You have to wait for your computer to boot before you can play games, no waiting on the real SNES! o The SNES has an analog low-pass sound filter that give a nice bass to all the sounds and music - Snes9x doesn't emulate this. If you have a posh sound card, you could try fiddling with it mixer controls to produce a similar effect. Turning on interpolated sound helps a lot. What's Emulated =============== - The 65c816 main CPU. - The Sony SPC700 sound CPU. - SNES variable length cycles. - 8 channel DMA and H-DMA (raster effects). - All background modes, 0 to 7. - Sound DSP, with eight 16-bit stereo channels, compressed samples, hardware attack-decay-sustain-release volume processing, echo, pitch modulation and digital FIR sound filter. - 8x8, 16x8 and 16x16 tile sizes, flipped in either direction. - 32x32, 32x64, 64x32 and 64x64 screen tile sizes. - H-IRQ, V-IRQ and NMI. - Mode 7 screen rotation, scaling and screen flipping. - Vertical offset-per-tile in modes 2, and 4. - 256x224, 256x239, 512x224, 512x239, 512x448 and 512x478 SNES screen resolutions. - Sub-screen and fixed colour transparency effects. - Mosaic effect. - Single and dual graphic clip windows, with all four logic combination modes. - Colour effects only inside a window. - 128 8x8, 16x16, 32x32 or 64x64 sprites, flipped in either direction. - SNES palette changes during frame (15/16-bit internal rendering only). - Super FX, a 21/10MHz RISC CPU found in the cartridge of several games. - SNES mouse. - SuperScope (light gun) emulated using computer mouse. - Multi-player 5 - allowing up to five people to play games simultaneously on games that support that many players. - Game-Genie, Action Replay and Gold Finger cheat codes. - Multiple ROM image formats, with or without a 512 byte copier header. - Single or split images, compressed using gzip, and interleaved in one of two ways. - Auto S-RAM (battery backed RAM) loading and saving. - Freeze-game support, now portable between different Snes9x ports. - Interpolated sound. What's Not ========== - Only partial DSP1 support, enough to play Mario Kart but no more. The DSP1 is a math co-processor chip that was inside the cartridge of some games, notably Mario Kart and Pilot Wings. - Any other odd chips that manufactures sometimes placed inside the cartridge to enhance games and as a nice side-effect, also act as an anti-piracy measure, e.g. SA-1, S-DD1, C4, etc. - Direct colour mode - uses tile and palette-group data directly as RGB value. - Pseudo hi-res. mode - SNES hardware uses interpolation to give apparent increase in horizontal resolution, use the TV mode to get the same effect. - Mosaic effect on mode 7. - A couple of SPC700 instructions that I can't work exactly out what they should do. - Fixed colour and mosaic effects in SNES hi-res. (512x448) modes. - Offset-per-tile in mode 6. Luckily I haven't found a game that uses it, yet. - Horizontal offset-per-tile in modes 2, 4 and 6. Just noticed that Chrono Trigger uses that. - Various pixel priority problems with sprites and transparency effects. What You Will Need ================== CPU --- Faster the better, but 486DX4 100 minimum when using 8-bit graphics and minimal or no sound, Pentium 166 or higher for transparency effects and Pentium 200 or higher for Super FX games. Memory ------ 16Mb or more for Linux. Sun workstations shouldn't have a problem. Screen ------ X Window System ports needs an 8, 15, 16, 24 or 32 bit X server running; transparency effects are available at all depths, but don't look good with only an 8-bit display. For maximum emulation speed, have the X server switched to 8-bit and don't enable transparency effects, or 15 or 16-bit with transparency effects enabled. The Linux SVGA port is very limited at the moment due to no 16-bit screen modes being supported on my main development machine. However, the Linux X Window System version now has a full-screen mode, so there's hopefully no need to use the SVGA version. Disk Space ---------- 1Mb for the emulator. Software -------- Access to SNES ROM images in *.smc, *.sfc, *.fig or *.1, *.2, or sf32xxxa, sf32xxxb, etc., format otherwise you will have nothing to run! Please note, it is illegal in most countries to have commercial ROM images without also owning the actual SNES ROM cartridge. Getting Started =============== From a shell just type: snes9x to start the X Window System port or ssnes9x to start the Linux SVGA port. ROM images are normally loaded from the directory ./roms. This can be changed by specifying a pathname with the image name or setting the environment variable SNES96_ROM_DIR to point to a different directory. Freeze game files and S-RAM save files are normally read from and written to the directory $HOME/.snes96_snapshots. This can be changed by setting the environment variable SNES96_SNAPSHOT_DIR to point to a different directory. To enable full-screen mode on the Linux X Window System and SVGA ports, Snes9x needs special system access permissions to allow it to write directly to video RAM and alter video chipset register values. In the directory where Snes9x is located, typing: su root chown root snes9x ssnes9x chmod 4755 snes9x ssnes9x will give the binaries the required access. Lots of command line flags are available: Graphics options: -tr or transparency (default: off) Enable transparency effects, also enables 16-bit screen mode selection. Transparency effects are automatically enabled if the depth of your X server is 15 or greater. -16 or -sixteen (default: off) Enable 16-bit internal screen rendering, allows palette changes but no transparency effects. -hires or -hi (default: lo-res.) Enable support for SNES hi-res. and interlace modes. USE ONLY IF GAME REQUIRES IT (FEW DO) BECAUSE IT REALLY SLOWS DOWN THE EMULATOR. -y or -interpolate (default: off) Enables 'TV mode', hires support, 16-bit internal rendering and transparency effects. TV mode scales the SNES image by x2 by inserting an extra blended pixel between each SNES pixel and 80% brightness 'scan-lines' between each horizontal line. The result looks very nice but needs a fast machine. Use with the full-screen X mode and a 15 or 16 depth X server, or the SVGA port for fastest operation. -nms or -nomodeswitch (default: switch modes) The Linux X Windows System port can change the screen resolution when switching to full-screen mode so the SNES display fills the whole screen. Specify this option to stop it if causes you problems. -scale or -sc (default: off) Stretch the SNES display to fit the whole of the computer display. Linux X Window System full-screen mode or SVGA port only. Use only if you have a very fast machine. -displayframerate or -dfr Display a frame rate counter superimposed over the bottom, left-hand corner of the SNES display. The value before the slash (/) indicates how many frames per second are being rendered compared to a real SNES, the value of which is displayed after the slash. Sound options: -ns or -nosound Disable sound CPU emulation and sound output, useful for the few ROMs where sound emulation causes them to lock up due to timing errors. -sk 0-3 or -soundskip 0-3 (default: 0) ONLY USED IF SOUND IS DISABLED. -stereo or -st (default: stereo) Enable stereo sound output. -mono (default: stereo) Enable mono sound output. Faster, but doesn't sound as nice. -r 0-7 or -soundquality or -sq 0-7 (default: 4) Sound playback rate/quality: 0 - disable sound, 1 - 8192, 2 - 11025, 3 - 16500, 4 - 22050 (default), 5 - 29300, 6 - 36600, 7 - 44000. -envx or -ex (default: off) Enable volume envelope height reading by the sound CPU. Can cure sound repeat problems with some games (e.g. Mortal Kombat series), while causing others to lock if enabled (eg. Bomberman series). Use with -sy option below to fix the problems this option can otherwise create. -sy or -soundsync Turns on sound-sync code where sound data is generated in sync with the emulation of the SNES sound CPU instructions. Slighty slower emulation speed but helps reduce note and sound effects timing problems and one or two games actually require this mode, notably Williams Arcade Classics. Also turns on interpolated sound and envelope height reading. Pressing the ']' key during gameplay toggles sound-sync only on and off. -is or -interpolatedsound (default: off) Turns on interpolated sound. Any samples played at a lower frequency than the current playback rate (-r option) have additional sample points computed and played where previously the same sample data was played repeatedly. Lower frequency sounds have improved bass and sound much less harsh - I suspect the real SNES does this. Pressing '[' during gameplay toggles the feature on and off. -b size or -buffersize size or -bs size (default: auto-select) Sound playback buffer size in bytes 128-4096. -nosamplecaching or -nsc or -nc (default: on) Disable decompressed sound sample caching. Decompressing samples takes time, slowing down the emulator. Normally the decompressed samples are saved just in case they need to be played again, but the way samples are stored and played on the SNES, it can result in a click sound or distortion when caching samples with loops in them. -noecho or -ne (default: on) Turn off sound echo and FIR filter effects. Processing these effects can really slow down a non-MMX Pentium machine due to the number of calculations required to implement these features. -ratio 1+ or -ra 1+ (default: 2) (OBSOLETE) Ratio of 65c816 to SPC700 instructions. The value is no longer used because SPC700 cycle counting is now implemented giving much more acturate timing. -nomastervolume or -nmv (default: on) Disable emulation of the sound DSP master volume control. Some ROMs set the volume level very low requiring you to turn up the volume level of your speakers introducing more background noise. Use this option to always have the master volume set on full and to by-pass a bug which prevents the music and sound effects being heard on Turrican. Cheat options: -gg or -gamegenie Supply a Game Genie code for the current ROM. Up to 10 codes can be in affect at once. Game Genie codes for many SNES games are available from: http://game-genie.nvc.cc.ca.us -ar or -actionreplay Supply a Pro-Action Reply code for the current ROM. Up to 10 codes can be in affect at once. At the moment, codes which alter RAM do not work. -gf or -goldfinger Supply a Gold Finger code for the current ROM. Up to 10 codes can be in affect at once. Speed up/slow down options: (See "Speeding Up The Emulation") -f or -frameskip (default: auto-adjust) Set this value to deliberately fix the frame skip rate and disable auto- speed regulation. Use a larger value faster emulation but more jerky movement and a smaller value for smooth but slower screen updates. Use '+' and '-' keys to modify the value during a game. Ideal for some Super FX games that confuse the auto-adjust code or for games that deliberately flash the screen every alternate frame. -frametime