
                         R o c k N E S
             NES emulator and NSF player for Windows
                     _____________________
                       1998-2013 Zepper
                       Version 5.09
                       May 18th 2013
                     _____________________

  Best viewed with Windows Notepad or Wordpad.

  - Message board: http://rocknes.phpbbnow.com
  - Web site.....: http://rocknes.web.fc2.com
  - E-mail.......: fx3rnes@hotmail.com

  <<======================================================================>>        
   LICENSE AGREEMENT [January 2010, updated on May 2013]

   (A) RockNES is freeware, for home use license. It can be used freely, provided
 that you don't make any changes in the original ZIP package.
   (B) Do NOT modify the original RockNES.EXE binary for whatever purpose.
   (C) Be aware that popular NES games are copyrighted with all rights reserved.
 In most cases, distributing ROM images of these games infringes copyright. 
 Do not distribute the RockNES software along with infringing ROMs. 
   (D) It comes "as is", meaning no warranties. Use it at your own risk! I'm not
 responsible for the misuse of this software.
   
   * If you disagree with these terms, DELETE THIS SOFTWARE NOW!
  <<======================================================================>>

 What's new for version 5.09 (05/18/2013)
 -----------------------------------------
 - Fixed PPU timing.
 - Fixed PPU open bus emulation.
 - Fixed APU reset, uninitialized flags.
 - Fixed APU sweep unit.
 - Fixed joypad i/o code, added 4016h/4017h extra reads.
 - Fixed mapper 1 (MMC1) startup bank values, and MMC3 PPU IRQ timing.
 - Fixed a potential crash when blitter 0 (256x240) was set on startup.
 - Fixed base address selection on disassembler.
 - Fixed gameplay joypad data logging driver, also known as NES movies.
 - Fixed a bug when resetting the video context.
 - Added a GUI option to see the current video context.
 - Added mapper 89 (Tenka no Goikenban: Mito Koumon).
 - Added a new screen blitter, stretched to 640x480 pixelated.
 - Added five choices of RGB palettes for VS System mapper.
 - Added option for printing the FPS (frames per second) value on screenshots.
 - Added option for resetting the savestate slot number on ROM loading.
 - Added a check for mapper 20, reserved for Famicom Disk System only.
 - Added message errors if sound startup fails.
 - Joypad data block on savestate now includes the number of reads, up to 8.
 - The graphics mode settings are reset to defaults and saved on gfx errors.
 - Disabled keys F6 and F7 when the FDS driver isn't active.
 - Removed the option of disabling register $4011.
 - Other minor fixes, various changes in the GUI, usual code cleanups.
 - Software documentation updated.

   * Read "oldnews.txt" for the full history of updates.
 
[==========================================================================]

   KNOWN EMULATION PROBLEMS

 - The NSF player uses playback rate at 60hz. Custom rates are NOT supported.
 - A few NSFs don't return from the INIT routine, so there's no generated sound.
 - Famicom Disk System (FDS) support is partial.
 - The game Battletoads freezes randomly during stage 2.
 - Sound skipping due to the way Allegro library handles it.
 - Games like Rad Racer 2 and Gauntlet II are glitched in the right side of the
 screen, probably due to the gfx rendering method, or PPU IRQ timing related.
 - A few MMC3 games triggering PPU IRQs may display a slightly waving image,
 like Kick Master.
 - There's a small chance of a dead lock while playing a NSF file.

 [==========================================================================]

 Index of rocknes.txt
 
 --------------------------------
 1. Description
 --------------------------------
 2. Player controls
    Shortcuts
 --------------------------------
 3. Using the GUI
    NES memory overview
    Additional notes
    Sound output
    NSF playback
    Triple buffering
    Palettes
 --------------------------------
 4. iNES header format
 --------------------------------
 5. VS System
 --------------------------------
 6. The PRG ROM data disassembler
 --------------------------------
 7. CREDITS (no special order)
 --------------------------------
 8. About the RockNES forum & 
 website *MUST READ*
 --------------------------------

 1. Description
 --------------

 > This is a 32bit application for Windows. RockNES is a Nintendo Entertainment System (NES) videogame emulator.
 It's fully coded in C and uses the Allegro library for audio, video and input devices, plus the zLib library for
 compressed files ZIP or GZ. Other ports are not available.
 > Compiled with Orwell Dev-C++ with gcc (GCC) 4.7.2 32bit, under Windows 7.
 > RockNES uses a 32bit color mode, plus sound output at 44100hz 16bit. File "alleg44.dll" is required!


   > Emulated stuff
   ----------------
   - 6502 CPU and APU emulation.
   - NTSC PPU emulation.
   - Joypads 1 and 2.
   - Konami VRC6 sound expansion (Akumajou Densetsu / Madara).
   - Partial VS System support.
   - Backed battery / PRG RAM.
   - Partial Famicom Disk System, emulated as mapper 20.
   - Supported iNES mappers: 
     0,1,2,3,4,5,7,9,10,11,13,15,16,18,19,20,21,22,23,24,25,26,32,33,34,40,41,42,43,
     44,46,48,57,58,64,65,66,67,68,69,70,71,72,73,75,76,78,79,83,85,86,88,89,90,91,92,
     93,94,97,99,101,110,113,117,118,119,151,160,180,184,187,189,211,225,226,227,228,
     229,230,231,232,233,234,235,240,243,246 and 255.

   > Available features
   --------------------
   - PPU color emphasis and monochrome mode.
   - Gameplay joypad data logging, also known as NES movies.
   - Save states, at any time.
   - GUI and configuration file auto generated.
   - ROM edit in real time.
   - Sound recording, WAV format.
   - Built-in 6502 CPU disassembler.
   - Pseudo stereo sound generator.
   - Famiclone-style sound output.
   - Various screen blitters within stretched modes.
   - Video triple buffering in full screen, avoiding screen tearing.
   - Almost any NES PPU/CPU memory dumping.
   - Color RAM viewer.

   > Unemulated hardware/features
   ------------------------------
   - All the unofficial CPU opcodes.
   - Famicom hardware (japanese NES) or european (PAL 50hz).
   - Input devices like Zapper, Power Pad and others.
   - Joypads 3 and 4.
   - VS Dualsystem.
   - Playchoice-10 upper monitor, requires z80 CPU emulation.
   - Other sound expansions like MMC5, VRCVII or Namco.

   > NOTES
   -------
        1. ZIP files are supported. Any file, including savestates, can be ZIPped.
        2. A configuration file named "rocknes.ini" is auto generated when you close the program.
        3. Certain ascii characters on file names, like accents, are NOT supported on ROM loading.
        4. The NSF player supports savestates.
        5. The Famicom Disk System emulation requires the BIOS file "disksys.rom".
        6. You can launch a ROM by typing rocknes <filename.NES> on command prompt.
        7. Command line switches/options are not supported, sorry.
        8. If you have any problems/annoyances, please, delete the configuration file "rocknes.ini"
 and start the emulator again.
 
 [==========================================================================]

 2. Player controls
    Hot keys
 ------------------

 > Default settings:

    [player 1] - PC input device assigned is KEYBOARD.
    [player 2] - No PC input device assigned.

   [KEYBOARD]
    D-pad + = PC keyboard arrows.
    B       = Z key.
    A       = X key.
    SELECT  = Tab key.
    START   = Enter key.


   [JOYSTICK SETUP]
    D-pad + = joystick D-pad.
    B       = button 2.
    A       = button 1.
    SELECT  = button 3.
    START   = button 4.

 > Hot keys:

 <ESC> - Swap to GUI/gameplay.
 Please, press ENTER if it looks "blind" or unresponsive.

 <F1>  - toggles FPS (Frames Per Second) visibility.
 <F2>  - save state.
 <F3>  - slot select, up to 15.
 <F4>  - load state.

 <F5>  - soft reset.
 shift+<F5>  - hard reset.
 <F6>  - FDS disk swap.
 <F7>  - FDS disk insert/eject.
 <F8>  - "in$ert coin" (VS System).

 <F9>  - gameplay recording.
 <F10> - gameplay replay.
 <F11> - quit to OS.
 <F12> - screenshot (PPU output + filtering).
 <shift+F12> - screenshot (includes Windows desktop).

 <1> - reset to normal blitter (256x240).
 <2> - switch between doubled (512x384) and stretched (640x480) modes.
 <3> - switch between normal, scanlined and pixelated modes.
 NOTE: these keys can be disabled. Go to the GUI [Options]->Other options.

 * Hold <Atl> and press <ENTER> to switch between windowed and fullscreen modes.
 * With the GUI active, press Ctrl+X to quit to OS, and Ctrl+L to load ROM.

 [==========================================================================]

 3. Using the GUI
    NES memory quick overview
    Additional notes
    NSF playback
    Triple buffering
    Palettes
 -----------------------------

 > Here's a quick summary of the GUI.

       [ ! File  CPU  Misc  Options  ? ]

 [File]
  - Load ROM...........: File selector, displays NES, NSF, FDS and ZIP files.
  - Header info........: iNES, FDS or NSF header information viewer.
  - Take screenshot....: Screenshot saved in BMP (bitmap) format.
  - Sound recorder.....: Record WAV files.
  - Quit...............: Close the emulator.

 [CPU]
  - Reset..............: Soft reset.
  - Hard reset.........: Hard reset (like a power off/on).
  - Save state.........: Save your progress.
  - Load state.........: Load your previous save.
  - Disassembler.......: PRG ROM disassembler.
  - Custom... .........: Custom disassembler.
  - Dump... ...........: Dumps any NES memory you want.

 [Misc]
  - Screen resolution..: Change the video resolution.
  - Movies.............: Record/play your gameplay.
  - Palette............: Changes the current RGB palette.
  - ROM patch..........: Patch PRG ROM data.
  - ROM corruptor......: Fill up a ROM area with a chosen byte.

 [Options]
  - Inputs.............: Select the input device, like keyboard or joystick.
  - Sound..............: Enable/disable sound output, choose stereo/mono, famiclone mode.
  - Directories........: Paths for loading movies, savestates and more.
  - Screen blitter.....: Stretched and scanlined PPU output blitting.
  - Triple buffering...: Select double or triple buffering modes.
  - Other options......: A couple of extra options.

 [?] HELP MENU
  - System info........: Displays video, audio, mouse and joystick drivers info.
  - About..............: Emulator version and copyright info.
  - Video info.........: Displays the video context, such as screen resolution, blitting position etc.

 [!] QUICK MENU
  - Play another game...........: Access the ROM file selector.
  - Restart the game............: Soft reset.
  - Save my gameplay............: Save your progress.
  - Continue my saved gameplay..: Load your saved progress.
  - View game information.......: iNES header info.
  - The screen..................: Emulator video setup shortcuts.
  - I wanna close this program..: Close the emulator and quit to OS.


        <<--------------------------------------------------------->>
          NES memory quick overview

          [CPU] 
          $0000-$07FF: RAM.
          $0800-$1FFF: Mirrors of $0000-$07FF.
          $2000-$2007: PPU registers.
          $2008-$3FFF: Mirrors of $2000-$2007.
          $4000-$4017: APU registers, except $4014 (OAM DMA).
          $4018-$5FFF: Usually assigned by the cartridge, mapper controlled.
          $6000-$7FFF: PRG RAM or backed battery data.
          $8000-$FFFF: PRG ROM banks.

          [PPU]
          $0000-$1FFF: CHR RAM or CHR ROM pages.
          $2000-$2FFF: Nametable data.
          $3000-$3E1F: Nametable mirrors.
          $3F00-$3F1F: Color lookup table.
          $3F20-$3FFF: Mirrors of $3F00-$3F1F.
        <<--------------------------------------------------------->>

 # menubar->[CPU]->Dump... ->  " RAM            "  NES system RAM ($0000-$07FF).
                               " $6000-$7FFF    "  PRG RAM or backed battery.
                               " $8000-$FFFF    "  Usually PRG ROM data.
                               ------------------ 
                               " PRG ROM banks  "  Program ROM data.
                               " CHR ROM banks  "  Character ROM data, when available.
                               " PPU CHR RAM    "  Pattern table data (PPU $0000-$1FFF).
                               ------------------ 
                               " color lockup   "  Color lookup table at $3F00-$3F1F.
                               " nametables     "  Tile and attribute color tables.
                               " primary OAM    "  Sprite RAM.
                               " secondary OAM  "  Last PPU sprite evaluation.
                               ------------------ 
                               " CPU registers  "  Saves a text file within relevant CPU info.

        <<--------------------------------------------------------->>
          Additional notes

 - All the GUI settings are saved into "rocknes.ini" file.
 - Game screen blitting options:

   * normal mode at 256x240 pixels;
   * double mode at 512x480 pixels;
   * double mode with scanlines (brightness is 50% lower);
   * double mode pixelated (brightness is 75% lower);
   * stretch mode at 640x480 pixels;
   * stretch mode with scanlines (brightness is 50% lower).
   * stretch mode pixelated (brightness is 75% lower).

        <<--------------------------------------------------------->>
          Sound output

 - RockNES uses a fixed PC sample rate of 44100hz.

 [x] Sound output...........: enables sound output.
 [ ] Use stereo mode........: enables a pseudo-stereo mode.
 [ ] Use famiclone style....: swaps square waves duty cycles.
 
        <<--------------------------------------------------------->>
          NSF music playback

 - NSF is a music file format, the sound code extracted from games. NSFs are supported as
 mapper #256. During the playback, a nice frequencies visualizer is displayed. While playing,
 you can identify a sound channel by its color:

 * dark blue..: square wave #1
 * light blue.: square wave #2
 * red........: triangle wave
 * white......: noise
 * green......: DMC ($4011 raw unsupported)
 * dark pink..: VRC6 square #1
 * light pink.: VRC6 square #2
 * orange.....: VRC6 sawtooth

 - Controls are pretty easy. Use the keyboard arrows left/right to change tracks,
 hit ENTER to play the current track. Info is displayed in the program bar title.
 - You can even use savestates! :)

 * Notice that some homebrew NSFs use a non-standard setup, like playing in a lower
 rate. Such files are not supported.
 * Other NSFs won't play due to a 6502 software infinite loop, which isn't supported for now.

        <<--------------------------------------------------------->>
          Triple buffering

 - It eliminates the screen tearing effect, making your gameplay smoother. It works only in 
 full screen mode. Enable it by accessing GUI [Options]->Triple buffering. A restart is required.
 You can edit the "rocknes.ini" file and set the -triple_buffer flag to 1.

 * There's an option to use the desktop resolution on triple buffering mode.
 Look at [Options]->Other options. 

 NOTICE: a few users report that such mode seems to be unsupported by a few video graphics driver.
 If the emulation is out of sync at 60hz, that's the reason.

        <<--------------------------------------------------------->>
          Palettes

 - The default RGB palette is a replica from the PSX game Rockman Complete Works. A few holes were
 filled up using another palette provided by Chris Covell.

     " Load palette     " -> Select a palette file (.pal extension).
     " Save palette     " -> Saves the current palette file to the disk, RGB format, 192 bytes long.
     " Restore default  " -> Restore the default built-in palette.
     "__________________"             
     " VS color tables  " -> Select a VS System color lockup table, uses the current palette.
     " VS RGB palettes  " -> Select a VS System RGB palette.
     "__________________"
     " View palette RAM " -> Displays the color lockup table and each color.

 - RGB palette files _must be_ 192 bytes long. Three bytes compose a RGB value, 64 
 entries compose the palette. There are a couple of custom palettes available.
 The color emphasis table is build up once the emulator is launched, so there's no
 need of storing such values into a palette file.

 [==========================================================================]

 4. iNES header format
 ---------------------

 > iNES is a NES emulator developed by Marat Fayzullin. Its most lasting 
 contribution to the NES scene was the iNES header, bringing a ROM file format 
 and mapper numbering system. Here's a quick iNES 1.xx header description.

    +--------+------+------------------------------------------+
    | Offset | Size | Content(s)                               |
    +--------+------+------------------------------------------+
    |   0    |  3   | NES                                      |
    +--------+------+------------------------------------------+
    |   3    |  1   | $1A                                      |
    +--------+------+------------------------------------------+
    |   4    |  1   | Number of 16k PRG ROM banks.             |
    +--------+------+------------------------------------------+
    |   5    |  1   | Number of 8k CHR ROM banks.              |
    +--------+------+------------------------------------------+
    |   6    |  1   | Control [lower byte]                     |
    |        |      |   %mmmmvTsM                              |
    |        |      |    |  ||||+- 0=Horizontal Mirroring      |
    |        |      |    |  ||||   1=Vertical Mirroring        |
    |        |      |    |  |||+-- 1=Backed battery            |
    |        |      |    |  ||+--- 1=Trainer data (512 bytes)  |
    |        |      |    |  |+---- 1=Four screen mirroring     |
    |        |      |    |  |   (overrides H/V mirroring flag) |
    |        |      |    +--+----- Low 4 bits of mapper number |
    +--------+------+------------------------------------------+
    |   7    |  1   | Control [upper byte]                     |
    |        |      |   %MMMM00PU                              |
    |        |      |    |  |  |+- 1=VS Unisystem arcade       |
    |        |      |    |  |  +-- 1=Playchoice-10 arcade      |
    |        |      |    +--+----- High 4 bits of mapper number|
    +--------+------+------------------------------------------+
    |  8-15  |  8   | Reserved, should be zeroes.              |
    +--------+------+------------------------------------------+

 > A couple of old dumps might bring the "DiskDude" string starting around offset 6h.
 As consequence, the mapper number and possibly other flags might be corrupted.
 > Be clear that RockNES does NOT support dirty headers. If you notice anything
 wrong/weird, please, look for an header cleaner/fixer tool.


 [==========================================================================]

 5. VS System
 ------------

 > Quote from the wikipedia (http://en.wikipedia.org/wiki/Nintendo_Vs._Series):
 
 "The Nintendo VS Series was a series of arcade video games designed for two-player
 competitive play using the VS. UniSystem or VS. DualSystem, arcade system boards 
 based on the Nintendo Entertainment System. Many of these stand-up or sit-down arcade
 machines had two screens and controls joined at an angle.These games were arcade ports
 of home video games for the Nintendo Entertainment System, thus they could be sold
 cheaply to arcades in the late 1980s".

 GENERAL NOTES:
 - Once you load a game, choose a new RGB palette OR a color lockup table. Just select
 [Misc]->Palette and pick an option. Game titles are used for reference.
 - Press <F8> to "insert coins". DIP Switches are not supported.
 - Only games in iNES format are supported.


 [==========================================================================]
 
 6. The PRG ROM data disassemblers
 ---------------------------------

 ##################################
 # [1] Disassembler overview      #
 ##################################

 +------------------------------------+
 |$8000 *A=90, X=05, Y=00, S=FF, P=A5 |  -> CPU registers: PC, A, X, Y, S, P.
 |PRG bank 08 [$1C000]                |  -> PRG ROM bank number and file offset.
 |+----------------------------------+| 
 ||8000 78       SEI                 || 
 ||8001 D8       CLD                 ||
 ||8002 A9 10    LDA #$10            || 
 ||8004 8D 00 20 STA $2000           ||
 ||8007 A2 FF    LDX #$FF            ||
 ||8009 9A       TXS                 ||
 ||800A AD 02 20 LDA $2002           ||  -> 6502 program code.
 ||800D 10 FB    BPL $800A           ||
 ||800F AD 02 20 LDA $2002           ||
 ||8012 10 FB    BPL $800F           ||
 ||8014 A0 FE    LDY #$FE            ||
 ||8016 A2 05    LDX #$05            ||
 ||8018 BD D7 07 LDA $07D7, X        ||
 ||801B C9 0A    CMP #$0A            ||
 ||801D B0 0C    BCS $802B           ||
 ||801F CA       DEX                 ||
 |+----------------------------------+|
 | BASE ADDRESS SELECT:               |
 |( )$4000 ( )$5000 ( )$6000 ( )$7000 |  -> CPU addresses.
 |(o)$8000 ( )$9000 ( )$A000 ( )$B000 |
 |( )$C000 ( )$D000 ( )$E000 ( )$F000 |
 +------------------------------------+

 > If you select $8000, the entire PRG ROM bank at $8000-$8FFF is disassembled.
 > Click "Refresh" to disassemble the new selected CPU region.
 > This feature is read-only, so you cannot modify anything from here.

 ##################################
 # [2] Custom disassembler mode   #
 ##################################

 +---------------------------------------------------+
 |+-------------------------------------------------+|
 || Disassembler                                 [X]||
 |+-------------------------------------------------+|
 |                                                   |
 |  Base address:                                          |
 |   8000___ [Refresh] [o]CPU  [ ]ROM     [Save]     |
 |                                                   |
 |+---------------------------------+ +------------+ |
 ||8000 78       SEI                | |PC=$8057    | |
 ||8001 D8       CLD                | | A=$90      | |
 ||8002 A9 10    LDA #$10           | | X=$05      | |
 ||8004 8D 00 20 STA $2000          | | Y=$00      | |
 ||8007 A2 FF    LDX #$FF           | | S=$FF      | |
 ||8009 9A       TXS                | | P=$A5      | |
 ||800A AD 02 20 LDA $2002          | |            | |
 ||800D 10 FB    BPL $800A          | |$6000 = $FF | |
 ||800F AD 02 20 LDA $2002          | |$8000 = $00 | |
 ||8012 10 FB    BPL $800F          | |$A000 = $01 | |
 ||8014 A0 FE    LDY #$FE           | |$C000 = $02 | |
 ||8016 A2 05    LDX #$05           | |$E000 = $03 | |
 ||8018 BD D7 07 LDA $07D7, X       | |            | |
 ||801B C9 0A    CMP #$0A           | |            | |
 ||801D B0 0C    BCS $802B          | |            | |
 ||801F CA       DEX                | |            | |
 |+---------------------------------+ +------------+ |
 +---------------------------------------------------+

 > It's much like the previous one with a different layout. The PRG bank
 numbers are displayed. Usually, a value of $FF indicates open bus.
   * Switch to CPU for disassembling data from any CPU space.
   * Switch to PRG for disassembling using ROM data address.
   * Click [Save] to write the disassembled data into a text file.

 > NOTE: PRG ROM banks are disassembled within 4096 bytes ($1000).
 Since the disassembler cannot cross the page, the output will always start at
 base address $8000, $9000, $A000 etc., ignoring the offset.


 [==========================================================================]

 7. CREDITS (no special order)
 -----------------------------

 NesDev community
 http://forums.nesdev.com
 http://wiki.nesdev.com/w/index.php/Nesdev_Wiki

 gcc (GCC) 4.7.2
 Copyright 2012 Free Software Foundation, Inc.

 The Dev-C++ resource site
 http://www.bloodshed.net/dev

 Orwell Dev-C++
 The main site of the 2011 Dev-C++ fork
 http://orwelldevcpp.blogspot.com.br/

 Allegro library, by Shawn Hargreaves
 http://alleg.sourceforge.net/

 Alastair Bridgewater - Darcnes
 http://www.dridus.com/~nyef/darcnes

 Home page of Jeremy Chadwick
 http://jdc.koitsu.org/

 unzip.c -- IO for uncompress .zip files using zlib
 Version 1.01h, December 28th, 2009
 Copyright 1998-2009 Gilles Vollant

 quietust
 http://www.qmtpro.com/~nes/nintendulator/

 Marat Fayzullin
 http://fms.komkon.org

 [=========================================================================]

 8. About the RockNES forum & website
 ------------------------------------

 > Your feedback is much appreciated, but if you want to be a regular user on
 RockNES forum, I had to take some precautions on vandalism, so here's the briefing.

 * Create a new account, the same way that you always do.
 * Once it's done, you must send me an e-mail telling me something about you.
 * Later, your account should be activated, and you're free to use the forum.

 > Without sending me an e-mail, you're not able to use the forum to disclose spamming.

 > OK, now about the website. As you can see, the Parodius networking has closed last
 year. The new hosting FC2.com _now has_ advertising on the web page header. While a
 free hosting service is subject to show advertising (banners), I'm not confortable
 with it. That means I'm always looking for a new host. 
 > Please, use the RockNES forum as your first stop for news & downloads:
   http://rocknes.phpbbnow.com

 [=========================================================================] 
 
EOF
