NES Emulation On N64 (Neon64) v1.1
(c) 2001-2003 Halley's Comet Software (http://here.is/halleyscomet)
Developed from 7/4/02 to 12/29/03

1. Introduction

Neon64 is a Nintendo Entertainment System emulator for
the Nintendo 64 video game system. It has been written
by Halley's Comet Software at the lowest possible level,
with direct access to all possible hardware features,
without any sort of development kit, official or
otherwise.

What is supported:
* 6502 CPU
* PPU (Picture Processing Unit)
* pAPU (pseudo Audio Processing Unit)
* Mappers 1,2,3,4,7,9,11,34~,66~,71~ (~ indicates incomplete support)
* Controllers 1 and 2 and Arkanoid paddle
* NTSC and PAL video mode (in emulated NES)
* SRAM/WRAM data saving with three slots in one N64 controller pack
* Screenshots (with a v64jr and PC)

Known Bugs:
* DMC timing isn't perfect (Tank Demo)
* Occasionally there is a crash. I have observed it twice in
  Castlevania 2, twice in Zelda, and once in Final Fantasy 3.
  Note that I have played these games for hours on end without
  a problem, just be aware that there is an unknown instability,
  so save often just as if you were using an NES and the slightest
  breeze could cause it to crash.
* Occasionally it freezes upon starting the game.
* Changes that take place in the middle of a scanline are not
  handled properly/at all. This causes minor graphics
  inaccuracies with Punch Out, SMB3, Monster in My Pocket, and
  a number of others. In no situation that I know of does this
  render a game unplayable.
* Aladdin crashes, and probably some others I can't recall.
* Frame skipping isn't perfect, it keeps games up to speed but a
  significant jumpiness is visible when scrolling quickly.
* Wrong mirroring (?) in the Battletoads Double Dragon introduction,
  and also possibly during the 3D scrolling parts (watch the ceiling
  jump when moving to a new screen).
* Misc. others that I don't remember...

----

2. What's in this archive

readme.txt: this doc
neon64hist.txt: the version history
neon64bu.rom: The main version of Neon64, for use with backup unit and
              the emulation standard method of sending a ROM (offset
              0x200000). It is not byteswapped, but it is properly
              CRCd and extended to 2 MB.
neon64gs.bin: The Gameshark version.
torom\: A directory containing utilities for converting NES ROMs to
              N64 ROMs.
torom\neon64cd.rom: An unextended version of Neon64, NES ROMs can be
              directly appended to it.
torom\chksum64.exe: Andreas Sterbenz's checksumming program
torom\extend.exe: Extends a ROM to 2 MB
torom\makerom.bat: Makes a single N64 ROM from an NES ROM
torom\makeall.bat: Make all NES ROMs in the current directory into N64
              ROMs.

----

3. Using Neon64

3a. Loading Neon64 and an NES ROM

Note: Neon64 cannot run compressed NES ROMs (ending with .ZIP, .RAR,
      etc.) or ROMs in the UNIF format (.UNF, etc.)

* With any backup device that has a PC connection
Send neon64bu.rom as you would any N64 ROM, then send the NES ROM to
offset 200000.

* With a Dr. V64jr
Use "elim neon64bu.rom -e mario.nes" to send Neon64 to the v64jr,
assuming Neon64 and the NES ROM are both in the same directory as
elim (and that the NES ROM is called "mario.nes"). If you can't run
elim follow the instructions for "any backup device".

* With a Dr. V64
You should be able to put NES roms on a CD and then just rename
neon64bu.rom to nes.emu and put it on the same CD. I have not
personally tested this, though.

* With a CD64 or Z64
Put the NES ROMs you want to use in the torom directory, then run
makeall.bat. Put all the .ROM files onto a CD or ZIP disk and it should
work! The downside is that each ROM is 2 MB. It should not be necessary
to use this for a Dr. V64, see above.

* With a Gameshark
First, you will need the following supplies:

N64
N64 expansion pack (GS Pro needs this)
Super Mario 64 (may be able to use other games in the future)
Gameshark Pro for N64, with a parallel port on the back
Parallel port cable (straight-through, male to female)
GSCC 2002 (http://www.cmgsccc.com/dl/index.php?item=1)
A computer running a Windows operating system

Set Up Gameshark:
1. Connect the Gameshark to the Super Mario 64 cartridge, the N64, and
   the computer (via the cable).
2. Turn on N64.
2a. If Gameshark does not boot, remove all things connected to GS,
   reconnect, and try again. I have found that the Gameshark is often
   more tempermental than the black market device I ususally test with,
   oddly enough.
3. Select "Start Game"
4. Select "Code Generator Off", which will then change to "Code
   Generator On"
5. Select "Start game without codes"

Set Up Super Mario 64:
1. Press start to get to the select game screen

Set up GSCC 2002 (only needs to be done once):
1. In the File menu, select Configuration.
2. In the System drop down box, select Nintendo 64.
3. Click the Auto Detect Settings box.
3a. If your Gameshark is not detected you did something wrong...
4. Click the Save button. Yes, you want to save settings.

Patch Neon64 into Super Mario 64:
1. In the Ram Edit menu option, select Open Window.
1a. Occasionally this does not open the window, properly, press
   Alt-Minus and then X to make the windows appear.
2. Click the Goto Address button (or press Alt-G) and enter the address
   0x80263844 (when you open GSCC 2002 in the future this location
   should be saved).
3. Click inside the edit window at the highlighted location.
3a. The values at this location should be: 85 CF 00 AE
   If you do not see these values let me know, you have a different
   version of Super Mario 64 than I do but it may still be possible
   to get it to work.
4. Enter 08 0C 00 00
5. Click the Upload File To Memory button (or press Alt-U)
6. Locate the Neon64 file (neon64gs.bin)
7. In the Address To Upload To box, enter 0x80300000 (five zeroes at
   the end)
8. Send the file (click the Open button)
9. Select a game in Super Mario 64 (one that's already started)
9a. The Neon64 title screen should appear.

Send the NES ROM:
1. Click the Upload File To Memory button again (or press Alt-U)
2. Locate the NES ROM you want to run.
3. Send the file (click the Open button)
4. Press a button on the N64 controller.
5. Your game should begin running.

Once your game is running communication between the PC and the
Gameshark will be cut off, so you will be unable to load a new ROM.
To load a new ROM select the "load new ROM" option from the menu, the
program will be returned to the title screen and communication will be
restored. You can then redo the "Send the NES ROM" steps to send a new
game.

3b. Controls

The controls on controller 1 and 2 have been mapped as follows:

+------------------------+
|NES      |N64           |
|---------|--------------|
| A       | A            |
| B       | B            |
|Start    |Start         |
|Select   | Z            |
|Direction|Analog stick  |
|         |or directional|
|         |pad           |
+------------------------+

I find that using the analog stick is best for isometric games such as
Battletoads or Deadly Towers, whereas the directional pad is better for
everything else, but that's just me.

3c. Menu

Neon64 has a menu which can be accessed by pressing the L and R buttons
on controller 1 at the same time. Choose an option with the directional
pad, select an option with the A button or leave the menu without
choosing by pressing L, R, or B.
The menu has the following options:

* Reset NES
Reloads the current game (or whatever game is in the N64's cartidge if
you have loaded a new one)

* Load new ROM
Returns to the title screen and waits for a new game to be loaded.
You must use this to load a new ROM in the Gameshark version, as it
reestablishes the PC<->GS connection. It is not necessary to use this
with the backup unit version, you can just load a new ROM at any time
and select Reset NES.

* Save SRAM
If the current game has SRAM this will save it to one of three slots in
the controller pack. Follow the prompts to erase a previous save if
there is not enough space on the controller pack. You can select a name
for the save, so that when you need to erase a save you know what each
of them is.
Selecting this option is the only way to save your progress in a game.
Make sure that after you do whatever you need to save in the game
(sleep at an Inn in Final Fantasy, select Save at the continue screen
in Zelda, have your deeds recorded in the Imperial Scrolls of Honor in
Dragon Warrior, etc.) you select Save SRAM from the menu. If you don't
your progress will be lost!
Neon64 is not compatible with the official Nintendo controller pack
access protocol, so when you format your controller pack for Neon64 it
will destroy any data from real N64 games that you might have.
Likewise, if you format your controller pack for an N64 game it will
erase any data for Neon64.
The controller pack should be in controller 1, and it should be
inserted before the N64 is turned on or it may not be detected. It may
in some cases be possible to reset the emulated NES and have a newly
inserted controller pack detected.
When you start a game that has SRAM Neon64 will check the controller
pack for a save for that game, and if one is found it will be loaded.

* PAL Mode On/Off
Selecting this option toggles the video mode of the emulated NES
between NTSC and PAL mode. This emulation is not perfect, all that it
changes is the length of the vertical retrace period and the dimensions
of the screen. It is enough for some European games like Elite and
Asterix to work correctly, but others may not.

* Take Screenshot
Copy the current frame to the cartridge where it can be read by the
Cap64 screen capture program (available, with source, at
http://here.is/halleyscomet).
I do not know what kind of effect this might have when used with any
system other than a v64jr.

* Frame-by-frame On/Off
When you activate this option the menu will be activated once per
frame, allowing you to advance the game one frame at a time (tapping
B is a good way to do this). This is useful when trying to take a
screenshot of something that happens quickly.

* FPS On/Off
Enable or disable the display of the current emulation speed in Frames
Per Second. The displayed value is in hexadecimal. Note that enabling
this slows things down slightly.

* Arkanoid paddle On/Off
Enables emulation of the analog paddle controller for Arkanoid. This is
controlled by moving the analog stick on controller 1 left and right.
The Arkanoid paddle is assumed to be plugged into controller port 2,
and this works fine with the only game that uses it (namely Arkanoid).

* DMC On/Off
This option is included specifically for Final Fantasy 3, which uses
for a drum effect a very rapid change of value in the DMC channel. With
all of the NES's hardware sound filters this sounds reasonably good,
but Neon64 does not emulate this filtering, nor will it ever. As a
result, all throughout a battle in FF3 there is a popping sound which
becomes very annoying. Setting this option to Off (it is set to On by
default) disables the audio output of this channel, though the channel
still behaves normally from the emulated NES's point of view.
Come to think of it, Castlevania 2's DMC is pretty annoying, too.

* Error trapping On/Off
Some games do things that Neon64 is unprepared to emulate, such as use
undocumented opcodes or accessing unknown parts of memory. It is
usually best to ignore these operations, because some games that use
them (Wizards & Warriors, Capcom OST) work fine if nothing is done.
When you set error trapping to "on", the game will stop running and
display debug information. There is no way to exit this information
screen without resetting the N64. If you are not me you should leave
this off, so that even when a game crashes you will be able to access
the menu to reset it or load another ROM.

* Debug info
Displays some information about the emulation. Exit this screen by
pressing any button.

Note that options that you choose will remain set even when you reset
the NES or load a new ROM. Only resetting the N64 will reload the
default settings.

----

CONTACT:

If you have any questions or comments, or would like to see what else
Halley's Comet Software is up to, contact me or check out the web site!

WWW: http://here.is/halleyscomet or http://hcs.freeshell.org
EMAIL: halleyscometsoftware@hotmail.com
AIM: maskedtomato

THANKS:

Firstly, I thank God for all those of you who helped me
with this project, directly or through your work.

Thanks to:

LaC, for an infinite supply of wisdom and documentation
Lemmy, for most of Nemu
Destop, for Heavy 64, through which I learned to use the RSP
Code Master, for making the GS version possible
SHIEK, for inspiring the GS version
CZN, for the various intros which taught me N64 programming
anarko, for N64OPS, for a long time my only source of info
Andreas Sterbenz, for CHKSUM64
Icarus, for a Propack unpacker for the R4000.
Bung, for low-cost development hardware
Gavin Hausermann, president of the HCS fan club!
Chris Covell, for some interesting demos and documentation
Brad Taylor, for everything I know about NES sound
blargg, for insight into the linear counter
Jsr, for help with controller access
Marat Fayzullin, for a solid background in emulation
y0shi, for nestech
loopy!
Memblers, for NESDev and more
Xodnizel, for FCEU, whose source helped me fix a lot of bugs
Nintendo, Square, Capcom, etc., for the games that made this whole
project worthwhile!

et al!

Thanks to you, for keeping a little corner of the N64 scene alive!

Greets to my S&E and Humanities friends, and to Mike, Ross, and Chris.
Thanks to my family for their tolerance and support.

LEGAL:

Neon64 was written entirely by themind (a.k.a. hcs) of Halley's
Comet Software in edit.com, assembled entirely by U64ASM (also
written by themind), built with DOS copy functions and Andreas
Sterbenz's CHKSUM64, and compressed with RNC Propack.

The program is copyright 2001-2003 by Halley's Comet Software and is
licensed for unlimited distribution, so long as it retains all
copyright noticies, includes this readme, and is not used for
commercial gain (or loss, for that matter). If you think you can make
any money from it I want a cut :)

Source code is freely available, ask for it if I don't have it posted
publicly.

This program may cause your N64 to explode. Prolonged use may result in
severe mental trauma. Therefore any damage resulting from its usage is
not the responsibility of its author.

Please do not distribute Neon64 with any NES ROMs, as there is a small
possibility that it would be illegal.

All trademarks are property of their respective owners.

-EOF-