
              ===========================================
              TNES - The 32 bit Nintendo Emulator for DOS
              ===========================================

              Written by Paul Robson (autismuk@aol.com)

This is a freeware application. Please report bugs to the above email
address.

Supports :

 - All the usual hardware of the NES.
 - Multiple VGA Screen Resolutions [including a better 'shrunk' screen]
 - Can support 2 Players (with redefinable keys)
 - Sound via an Adlib card. (Ensoniq ? Pah !)
 - Good support for Mappers 0,1,2,3,4,7,9 and 11
 - Easy to add new mappers to program - nice modular design.
 - 4 Button Joystick support (1 player only)
 - Simple but useful Debugger
 - Game Genie Codes
 - Game Snapshots (up to 8 per cartridge)
 - Autofire.

What doesn't work at the moment :

 - the Timing isn't perfect - still working on this (all assistance welcome)
 - 1Mb Mapper 1 Carts aren't supported (e.g. DW4, see above)
 - some of the less common mappers aren't implemented (see above)
 - the DMA sound channel isn't implemented. Who cares ?
 - sprite priorities on Mapper 4 (e.g. SMB3) (see above)
 - snapshots have problems on Zelda 1 for some reason & can be generally off.
 - sound can be ropey on some carts, great on others, not really attacked
   this problem much.

This is something I've wanted to do for ages - despite its popularity at the
time NESA never was that great a piece of programming - except for compactness.
I always thought I could do something better given the appropriate (Y0shi's !)
documentation, and here it is. The 32 bit version does most of the things
the original NESA didn't. (you know, like run NES games :) )

When I've researched and fixed it a bit more, (and parodius.com is back
online) I'll feed what I've learned back to y0shi... there's a fair bit
that I think is wrong. The source code will be released for those who are
interested - there's enough information for those who don't understand
how MMC2 works for example.

Special thanks go to the following people :-

 - Marat Fayzullin, for the original NES document.
 - Jeremy Chadwick (aka y0shi) for the improved NES document.
 - The long list of people who contributed to the above documents.
 - Jonathon Turner for the (currently unavailable :( ) EPR.
 - Jim Pragit of Emunews.
 - Michael Tippich (crazy name, crazy DOS extender)

This is written using the inestimable WDOSX (0.94) as used in all my other
32 bit emulators. A truly excellent piece of work from Michael Tippich -
the only problem is the emulators don't currently work on Windows NT. Still
if you have an NT machine you are probably supposed to be doing some work
on it, and shouldn't be playing Super Mario anyway.

It's still fairly compact (but not as small as NESA) and still fairly
quick (but not as quick as NESA). It does however, do things like mapping
properly. (NESA bodged it). You can speed it up with all the usual hacks
beloved of emulator authors, cutting out frames, reducing the cycles/scan
line, all that sort of thing.

It will need more memory than NESA though, probably about 4Mb. It is
compatible with Windows 95. It doesn't contain any references to
Satan either, or blooded hands or anything like that, for those
that worry about such things. It doesn't have a GUI either. Unless you
are still using DOS I'd recommend associating file type .NES with
TNES.EXE in Windows, and setting the working directory to the
directory with TNES.INI in it.

Internally, its tidy rather than clever - it doesn't use registers for
optimisation, or cache anything. I cache tiles later if I feel so inclined.
Or I may not.

Setup can be done by editing TNES.INI - this file is not required
however. It allows you to set various emulation parameters and game
controls either globally or for individual games. Further details are
given in the systems TNES.INI

Please do NOT email me asking where to find ROM images for the emulator.

Files
=====

TNES.EXE        Executable file
TNES.TXT        This file
KEYS.INC        List of scan codes for keys (note: this is from my
                source so 4Ch needs to become $4C for TNES.INI)
TNES.INI        Optional configuration file
*.NES           iNes format NES cartridges
*.SAV           Battery backup files for NES cartridges that have them.
*.NSx           Saved Game States (x = 0 thru 7)

Keys (the game keys are redefinable in TNES.INI)
================================================

        Cursor Keys     Direction Keys, Player 1
        Ctrl            A
        Alt             B
        Tab             Select  [Joystick button C]
        Return          Start   [Joystick button D]

Player 2 keys are not defined by default. To play 2 players you will need
to change TNES.INI.

Most of the following keys only operate in run-mode,not debug mode,
(indicated by a small 'D' at the top left of the screen). You shouldn't
really be playing about with the Debugger anyway....
                
        ESC             Exit
        F1              Reset
        F2              Switch VBI Scanline between 232,240,0 and 8
                        (sometimes helps with timing problems - e.g.
                         neatens Castlevania and Zelda 2 (press twice))
        F3              Toggle Autofire On/Off
        F4              Turn Sound Channels on or off individually.
        F5              Save Snapshots (followed by 0..7)
        F6              Enter Game Genie Codes
        F7              Load Snapshots (followed by 0..7)
        F10             Debugger
        /               Switch between Screen Modes
        Keypad +        Accelerator

The Joystick is emulated through the same code as Gameboy 97. This means
it won't work on some Joysticks. For those of you with more esoteric
Sticks, disable the Joystick support in TNES and use Simone Zanella's
JoyEmu instead. This is also recommended if you want to remap the buttons,
or anything complex. Note that the Joystick also slows things down, thanks
to its 20p design. "No,just a resistor and a capacitor will do".

The Joystick is enabled by pressing the any of the buttons A B C or D
on the Joystick, when it is centred (for a quick calibration).

Additional Information
======================

Generally - the timing could be better - some of the split screens
don't work that well. I'm working on it... There are a few things which
are hopeless - Ys1 & 2, and Chrystalis for example. I suspect this is
also to do with unknown information about the Mappers.

The sound is all Adlib (OPL2) which means it sounds different to the
standard NES - the tunes are the same but the instruments have changed -
gives the NES a whole new sound. This is still in development, but on most
games it sounds fine.

I have a 'Bomberman' cartridge which is very wierd - the title screen
looks corrupted & if you press START it crashes.  To run it, press up then
START. I presume this is corrupt, as this behaviour is also produced by
Nesticle, except that unmapped memory locations in Nesticle contain 00 which
generates a BRK which restarts the cartridge. TNES contain FF which
causes the Debugger to be entered.

The following mappers are implemented : 0,1,2,3,4,7,9 and 11.

1:      (e.g. Zelda,Zelda2) Work Ok, but Scrolling can be a bit dodgy,
        especially Zelda 1 which has wierd vertical scrolling - still working
        on this one. Because of timing problems there's a hack in Mapper 1
        which delays NMI if a register write is incomplete. (e.g. the
        bit-write to register is incomplete).  512k carts (e.g. Dragon
        Warrior 3) are supported, 1Mb carts (DW4) are not, at present,
        not unconnected with the fact that I don't know how they work
        & haven't done any research yet. The only game that crashed was
        "Bart vs. Space Mutants" which may be due to a corrupt image -
        it looks bad on Nesticle. On TNES it stops at the start of the
        game proper.

4:      (e.g. SMB2 & 3) working reasonably well. SMB3 is a bit scruffy in
        places but perfectly playable. SMB2 seems perfect. The emulation
        of the IRQ handling is not 100% accurate, which I suspect causes
        the SMB3 problems.

7:      Marble Madness works - it requires the Interrupt to take place at
        Scanline 0. Some of the graphics are still slightly corrupted, but
        it looks much better with the NMI moved. [You'll need to set this
        in TNES.INI]

9:      (e.g. Punch-out) - this now works perfectly. If you want to know
        how it's done you'll need the source code.... be prepared to laugh
        at the incredible design decision. Is it really worth the effort, I
        ask myself. Just for a few extra tiles with crap no-one reads.

11:     (e.g. Mission Cobra) - works but I think the ROM may be corrupt, it's
        fudged. This was the only cart of this type I could find.

The Debugger
------------
The debugger is simple but functional. There are 3 windows - machine status
disassembled program and data. The machine status is a bit incomprehensible
unless you are familiar with the PPU.

The Alphanumeric keys change the address. To set the breakpoint address, use
the Alt key. To set the Data Address, use the Ctrl Key. Changing the
address in the 'disassembly' area does NOT change the program counter. At
present it isn't possible to change the CPU registers.
 
0-9,A-F                 Rotate address right,insert digit (Try it !)
Up/Down/PUp/PDn         Move Up or Down by 1 or 16 bytes
Home                    Set equal to PC

Debugger Function Keys
----------------------
F1              Break = Disassembly Address
F5              Display Current Screen
F7              Run to current displayed program line.
F8              Single Step
F9              Run until Breakpoint
ESC             Run normally (no Breakpoint)

Paul Robson, January 1998.
