Snes96: Linux 0.7 Released 21th May 1997 ---------------------------------------- Gary Henderson (gary@daniver.demon.co.uk) This is a Super Nintendo Entertainment System (SNES) emulator for Linux i386, MS-DOS and Sun Solaris Sparc. Snes96: Linux is a port/rewrite of the SNES emulator for Windows 95 originally written by Jerremy Koot (jkoot@euronet.nl) and with considerable amounts of new features, speed ups and bug fixes added by myself. Snes96 is coded in C++ with an assembler CPU emulation core on the Linux and MS-DOS ports. About 85% of the ROMs that people have tested so far seem to work OK; these include Donkey Kong County 1, 2 and 3, Chrono Trigger, Secret Of the Evermore, The Final Fantasy series, Metroid 3, F-Zero, Puzzle Bobble, etc, etc. Key features ------------ o Speed, with a 100% assembler CPU emulation core on Linux and MS-DOS ports - it is the fastest SNES emulator around and getting faster (slowly). o Lots of ROMs work, the numbers are increasing with each release. o Simultaneous two SNES joy-pad emulation allowing two player games to be played. o Support for one 2, 4 or 6 button joystick or two 2-button joysticks - Linux and MS-DOS ports only. o Snapshot a game in progress and restore the game to that exact point at a later time. o Complete, fast mode 7 emulation (screen rotation and scaling) - all except one rarely used feature. o Complete H-DMA emulation for those split screen and wavy background effects. o Background clip windows for those H-DMA zoom effects. o Variable CPU cycles length as on the real SNES, for fast and slow ROM emulation. o Mosaic effect. o Linux S-VGA and MS-DOS ports support various screen modes. o Compressed ROM image support (use gzip). o SNES image scaling. o 8-bit, 16-bit and 24-bit X11 server support. o An uncrackable binary - mainly because it has no protection to crack such as time limits, limited palette, etc., etc. and never will. It terms of what SNES hardware is actually emulated, most graphics registers are emulated. There is no sound emulation at all and the lack of this is the major cause of ROM failures. The background colour addition and subtraction are also not implemented. A few other odd features that no ROMs seem to use are also not emulated: direct colour output, interlaced display, pseudo horizontal 512 pixel mode. Some ROM cartridges contained additional hardware such as the SuperFX chip (a 16Mhz RISC processor) or DSP chip, neither of these chips are emulated at the moment so games like Mario Kart, DOOM, Yoshi's Island, etc. don't work. Work on sound emulation has begun but, due to lack of accurate documentation, is proceeding a more slowly than expected. I'm hopeful that version 0.8 will have sound support in some limited form. What's New Since Last Release ----------------------------- - SPEED: Rewrote CPU core in assembler for Intel platforms - gives a very noticeable speed increase. - Changed default frame skip rate from 1 to 2 - its seems most people don't bother to read the docs, so I thought I'll help them out a bit! - Speeded up Mode 7 graphics on games like F-Zero that rewrite the matrix registers on each scan line using H-DMA. - Fixed joystick detection on MS-DOS port - a single 2 or 4 button joystick in port 1 was being ignored if a second joystick was not present in port 2. - More graphics speed ups - the code to render background tiles with their priority bits set is only called if there are actual priority-bit tiles. - Fixed palette in mode 0. - Whoops, accidently left some test code in which was causing the V-BLANK flag, bit 8 in register $4212, to be miss-calculated - now Sensible Soccer works again. - Fixed bug that caused 1 byte of S-RAM to be emulated when ROM didn't expect any - it was enough to stop Street Fighter 2 and others from working - thanks Lord ESNES. - Reorganised the graphics code and did a slight speed up - graphics code will be the next thing to rewrite in assembler. - Joysticks now scanned every 3rd frame (joystick scanning is slow in the PC). - Double-whoops, Metriod 3 had stopped working in v0.6 - fixed it (memory map bug). - Made bit 6 of $4211 set if v-counter == v-timer-position. - Made reading of $4200 read $4212 instead. - Adjusted DMA timing to always access ROM memory at slow speed - this seems to fix Battle Toads: Double Dragon. - Added code to automatically clear pending IRQs when the horizontal line is no longer equal to the horizontal timer line - this fixes Seiken 3, it now just gets stuck in the sound CPU wait code - oh well. - Moved NMI back to its original pre-0.65 behaviour, now Puzzle Bobble works. - Fixed several problems with the APU sound CPU emulation - its now getting stable enough to try and implement sound. - The TXS and TCS instructions shouldn't set the Z and N flags. - Looks like MVP/MVN instructions should ignore accumulator size - change code to always use all 16 bits and exit with accumulator set to 0xffff. What you will need ------------------ You will need a Pentium-class PC running Linux, MS-DOS or Windows 95 with at least 8Mb of RAM. Interleaved format ROM images also required an additional 4Mb temp buffer while the image format is converted; this will push up the required RAM to 16Mb. I am unable to test the MS-DOS port under Windows 3.11 but I see no reason why it shouldn't work. The Linux port requires a recent, stable kernel version; I'm using 2.0.27. The Sun Solaris Sparc port requires a fast Sun Sparc workstation running Solaris 5.x. Both the UNIX ports are dynamically linked and will require access to various shared libraries. Use ldd snes96 to make sure you have all the required libraries on your system. The Solaris port and the Linux X11 version will also need an X server running. Access to SNES ROM images in *.smc or *.sfc format will also help otherwise you will have nothing to run! Several public domain images are available from: http://www.rollanet.org/~khigh/emulator.htm Some commercial ROM images are available via the Internet, try following links from: http://members.aol.com/zorkwiz/snesrom.htm Please note it is illegal in most countries to have commercial ROM images without also owning the actual SNES ROM cartridge. PLEASE DO NOT ASK JERREMY OR MYSELF FOR ROM IMAGES OR FOR INFORMATION ON WHERE TO GET MORE, WE DO NOT KNOW AND WILL IGNORE ALL SUCH E-MAILS OR, IF WE ARE HAVING A PARTICULARLY BAD DAY, FORWARD THE E-MAIL TO THE EMULATOR ABUSE DATABASE. Starting the emulator --------------------- From a shell or DOS session just type: snes96 Some command line flags are available: -i Inform emulator ROM image is in interleaved format. -f (2) See "Speeding up the Emulation" below -h <0-100> Percentage of cpu cycles to execute per scan line (100) -m <0-4> (Linux S-VGA) or <0-8> (MS-DOS) Select screen mode (0), try -m 2 to see if its compatible with your system, it gives an noticeable emulation speed increase. -ss <0-3> SPC-700 skip wait method (0), use 1 for Metroid 3 and Animatics. -S Enable a very buggy SPC700 sound CPU emulation - no actual sound yet but might allow some more ROMs to run. -l Load snapshot file and required ROM image and restart game from saved position. -s Swap emulated joy-pad 1 and 2 around. -F Force Hi-ROM memory map for ROMs where the Hi-ROM header test fails. -FL Force Lo-ROM memory map for ROMs where the Hi-ROM header test fails. -o Enable old-style joy-pad emulation (required by a few ROMs) -p Fool ROM into thinking this is a PAL SNES system. (not usually -n Fool ROM into thinking this is a NTSC SNES system. required) -d Start in debug mode. -I Disable IRQ emulation (for debugging). -H Turn off the H-DMA emulation (on) -t Enable CPU tracing to trace.log file (warning: this file gets very large very quickly !) Linux and DOS ports only: -4 Joystick connected to computer has 4 buttons. -6 Joystick connected to computer has 6 buttons. While the emulator is running: 'Escape' quit the emulator Joy-pad 1: 'up' or 'u' Up direction 'down', 'j' or 'n' Down direction 'left' or 'h' Left direction 'right' or 'k' Right direction 'a' TL button 'z' TR button 's' X button 'x' Y button 'd' A button 'c' B button 'Left Control' or 'Left Meta' Start button 'Left Shift' Select button Joy-pad 2: 'Keypad 8' Up direction 'Keypad 2' Down direction 'Keypad 6' Left direction 'Keypad 4' Right direction 'Insert' TL button 'Delete' TR button 'Home' X button 'End' Y button 'Page Up' A button 'Page Down' B button 'Right Control' or 'Right Meta' Start button 'Right Shift' Select button '0' Toggle H-DMA emulation on/off. '1' Toggle background 1 on/off (useful for speeding up the '2' Toggle background 2 on/off emulation and for ROMs '3' Toggle background 3 on/off that use colour addition in '4' Toggle background 4 on/off a certain way, e.g. zelda) '5' Toggle sprites (OBJs) on/off '6' Toggle swapping of joy-pad one and two around 'F2' Load snapshot of game in progress 'F3' Save snapshot of game in progress 'F4' Toggle joystick support off and on. 'F10' Start debugger. Under UNIX, typing 'Control-C' in the shell where you started the emulator from or just pressing F10 on all ports, enters the SNES debugger. In the debugger type '?' for a complete list of all available functions. ROM images are normally loaded from the directory ./roms. This can be changed by specifying a pathname with the image name or settings the environment variable SNES96_ROM_DIR to point to a different directory. Snapshot files and S-RAM save files are normally read from and written to the directory $HOME/.snes96_snapshots for the UNIX ports or .\SNESNAPS for the MS-DOS port. This can be changed by setting the environment variable SNES96_SNAPSHOT_DIR to point to a different directory. Joystick Support ---------------- The Linux and MS-DOS ports of Snes96 supports one or two 2-button joysticks, or one 4-button or 6-button joystick - this limitation is imposed by PC hardware. The Linux port requires the kernel to have the joystick driver compiled in or loaded as a module to enable Snes96 to access the joystick(s). The driver source code is available from: http://sunsite.unc.edu/pub/Linux/kernel/patches/console/joystick-0.8.0.tar.gz Don't forget to also make the two devices in /dev - /dev/js0 and /dev/js1 and make them readable by everyone; documentation supplied with the driver gives details of this. On a 2-button joystick only the A and B SNES buttons are available, the remaining 4 can still be accessed via the keyboard. The following diagram showing you the button layout for 6-button PC joy-pads that look similar to real SNES joy-pads: ---TL--- ---TR--- ^ X | <- -> Y A | / / v B Make sure the joystick is centred or no buttons pressed for joy-pads when the emulator is first started to enable auto-calibration to work. Linux S-VGA Full-Screen Mode ---------------------------- The Linux port of Snes96 is supplied as two binaries: snes96 for the X Window System version and ssnes96 for the S-VGA 256x256 full-screen version. The S-VGA version needs root permissions so it can write to the PC video registers to change screen modes (the X server has the same problem). You can either run as root (not recommended) or set the binary to run set-uid root as follows: Log on as root or su to root. Change to the directory where the ssnes96 binary is stored. Type: chown root ssnes96 chmod 4555 ssnes96 Now the binary can be run by an ordinary user in much the same way the X server can. The default VGA screen mode is 320x240x256 mode-X, which should work on any system. However, mode-X slows down the emulator a little so you might what to try using the -m 2 command line flag to see if the slightly faster 256x256x256 screen mode is compatible with your system. Problems With ROMs ------------------ If the emulator just displays a black screen for over 10 seconds then one of the following could be true: 1) The ROM image is corrupt or in the wrong format. A few ROM images floating around the 'net are named *.smc but are not in that format. There is a DOS utility, ucon, which can convert between some image formats, try using it. More likely is the ROM image is in interleaved format; use the -i command line flag to tell the emulator it is in this format. 2) Some ROMs have a bad ROM header, mostly home-brewed SNES games or hacked commercial games. Snes96 cannot then detect if it is a Lo-ROM or Hi-ROM game and just guesses. You might have to use the -F to force Hi-ROM or -FL to force Lo-ROM to help it out. 3) The ROM is in a loop waiting for the Sound CPU to respond with a particular value and the sound wait skip code in the emulator hasn't spotted the fact. Try using a different -ss command line option value in the range 0 to 3. The SNES debugger could also be used to step out of the loop with the 's' command. You can use this trick with Cannon Fodder and a few others but requires some assembler knowledge. Finally, you could also try the -S command line flag which enables the very buggy SPC700 emulation. The allows several ROMs to continue that previously were stuck in sound down load code. 4) The ROMs FAST ROM protection check has failed and the ROM has deliberately crashed itself. The only thing you could try is one of the utilities on the 'net that remove such protection. 5) You have set the -h command line value too low. 6) The original SNES ROM cartridge had additional hardware inside that is not emulated yet - this is true for all SuperFX games (DOOM, etc.) and DSP games (Mario Kart, Yoshi's Island, etc.). Some of the later ROMs (1994+) had additional hardware as a form of protection (Williams Arcade Classics, Clay Fighters II, etc.). There is nothing you can do about this games except disassemble and patch the ROM or wait until I emulate the missing hardware, but this must be done individually for each game. (Williams Arcade Classics is already supported). 7) The ROM image has found a CPU emulator instruction or memory map bug - please e-mail with name of ROM images that do this. Unfortunately, it is difficult to tell this problem from the protection failure problem described above without disassembling the ROM. If the game starts normally but refuses to go beyond the title screen try using the -o command line flag to enable old-style SNES joy-pad emulation or try pressing '6' in the emulator to swap joy-pads around; Mario All Stars swaps joy-pads around with old-style SNES joy-pad emulation enabled. If the ROM says "This game is not for your system" or something similar, use the -p flag to force PAL mode or -n to force NTSC mode. Also, some ROMs use background colour addition (which isn't emulated yet) in such a way that is hides the character you are trying to control; try toggling the background layers on and off with the keys 1 to 4 to see if you can find the background layer causing the problem and leave it switched off. Converting ROM Images --------------------- Sometimes you will come across ROM images split into several pieces; these can usually converted to a ROM image format that snes96 can read by simply joining the pieces together. However, some formats put a 512 byte header on each piece and this must be removed before the pieces are joined together. If each piece is 524288 or 1048576 bytes in length then there is no header. If each piece is 524800 or 1049088 bytes in length then there is a 512 byte header which must be removed. Under UNIX this is easy: ( for i in rom_filename_base* do dd if=$i bs=512 skip=1 done ) >new_rom_filename Sometimes only the first piece has a header, in this case it is OK just to join the pieces together. Speeding up the Emulation ------------------------- Try the following command line flags: -f (default 2: only every 3rd frame is rendered and displayed) Increasing this value will speed up the emulator but make screen updates more jerky. -h (default 100) Lowering this value will also speed up the emulator but setting the value too low can cause problems from some ROMs because not enough CPU instructions are being executed per frame as the ROM expects and can actually slow down a game! -m Some screen modes allow faster screen update than others, try -m 2 to see if the faster, non-mode X VGA mode is compatible with your system. MS-DOS users could try -m 3 or higher to try one of the VESA screen modes. Turning off some of the background layers by pressing '1' to '4' also speeds up the emulator. As always, you could try running the emulator on a faster machine! Credits ------- Many thanks must go to Jerremy Koot (jkoot@euronet.nl) because without all his hard work on the original Snes96 Windows 95 and continuing hard work on the Snes97 version the Linux, MS-DOS and Solaris ports would not exist. Thanks also to Lord ESNES for his many discoveries and for a person who shall remain nameless, for his continuing quest for SNES information on my behalf. I also would like to thank Shawn Hargreaves (shawn@talula.demon.co.uk) for the excellent Allegro library with made porting Snes96 relatively easy and my two beta testers, Dave Baugh and Zorkwiz@aol.com. SNES is a trademark of Nintendo. Sun, Solaris and Sparc are trademarks of Sun Microsystems, Inc. MS-DOS and Windows 95 are trademarks of the Microsoft Corporation. ------------------------------------------------------------------------------ Gary Henderson (gary@daniver.demon.co.uk)