
                         R o c k N E S 
                         USER'S MANUAL
             NES emulator and NSF player for Windows
                     _____________________
                       1998-2014 Zepper
                       Version 5.141
                       June 1st 2014
                     _____________________

  Best viewed with Windows Notepad or Wordpad.

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

  <<======================================================================>>        
   LICENSE AGREEMENT [January 2010, last update on December 2013]

   (A) You're NOT allowed to hack/modify the RockNES.EXE binary for whatever purpose.
   (B) RockNES is freeware, targeted for home use. It can be distributed freely,
 provided that no changes are made in the original ZIP package.
   (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.141 (06/01/2014)
 -----------------------------------------
 - Fixed "Other options" menu, complete mess.
 - Cleanups.

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

   = KNOWN EMULATION PROBLEMS AND NOTES =

 - The NSF music player is always at 60hz. Different rates are NOT supported.
 - A few NSFs don't return from the INIT routine, resulting an infinity loop.
 - Famicom Disk System (FDS) support is partial and mostly incomplete. There's
 no plans for improving it.
 - Sound or frame skipping might occur due to an Allegro library limitation.
 - Games like Rad Racer 2 or Gauntlet II are glitched in the right side of the
 screen, probably due to the gfx rendering method, or even bad IRQ timing.
 - Some mapper 4 games (MMC3) might appear glitched.
 - There's a small chance of a deadlock while playing a NSF file.

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

 Index of \rocknes.txt
 
 --------------------------------
 1. Description
    First run
 --------------------------------
 2. Player controls
    Hotkeys
 --------------------------------
 3. Using the GUI
    NES memory overview
    Screen blitting (+interpolated mode) and config file
    Screen filtering
    Sound output
    NSF playback
    Triple buffering
    Palettes
 --------------------------------
 4. NES header format
 --------------------------------
 5. VS System
 --------------------------------
 6. Famicom Disk System
 --------------------------------
 7. The PRG ROM disassembler
 --------------------------------
 8. CREDITS (no special order)
 --------------------------------

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

 > This is an 32bit program for Windows, compiled and tested under Windows 7 only.
 > 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, like ZIP or GZ.
 > Compiled using Orwell Dev-C++ with GCC 4.7.2 32bit, on Windows 7.

 * FIRST RUN *
 *************

 - After extracting the ZIP contents into a folder, look for "RockNES.exe".
 - The first run always look for a file named "rocknes.ini", the configuration file. If such
 file does not exist, a new one is created with default settings, and written to the disk.
 - RockNES tries to setup a windowed mode in 32bit color mode, plus outputs sound at 44100hz 16bit.
 The file "alleg44.dll" is required, and it's included in the ZIP package for now.

 - Once the program is launched, the blue GUI bar will appear. Pick an option, usually you select
 [File]->Load ROM, and selects a file. The NES header must be present as the first 16 bytes of
 the file (.NES extension). A few checks are made before running the loaded ROM, like size
 (PRG and CHR ROM banks), checksum for possible internal fixes and the memory mapper.

 - All your settings are saved when you close the program.

 ***************************************************************************************


   > 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 support, emulated as mapper 20.
   - Supported NES 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 editing in real time.
   - Sound recording in WAV format.
   - Built-in 6502 CPU disassembler.
   - Pseudo stereo sound output.
   - Famiclone-style sound output.
   - Various screen blitters with stretched and scanlined modes.
   - Video triple buffering in full screen, avoiding screen tearing effect.
   - Almost any NES PPU/CPU memory dumping.
   - Palette 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. The config file "rocknes.ini" is auto generated every time the program is closed.
        3. Certain ascii characters on file names, like accents, are NOT supported on ROM loading.
        4. The NSF player supports savestates.
        5. You can launch a ROM by typing rocknes <filename.NES> on command prompt (without the < >).
        6. Command line switches/options are NOT supported, sorry.
        7. If you experience annoyances, delete the config file "rocknes.ini".
 
 [==========================================================================]

 2. Player controls
    Hotkeys
 ------------------

 > Default settings:

    [player 1] - Input device is KEYBOARD.
    [player 2] - Disabled.

   [KEYBOARD]
    D-pad + = 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.

 > Hotkeys:

 <ESC> - Swap to GUI. 

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

 <F5>  - soft reset, press shift+<F5> for hard reset.
 <F6>  - Disk swap (Famicom Disk System only).
 <F7>  - Disk insert/eject (Famicom Disk System only).
 <F8>  - "in$ert coin" (VS System only).

 <F9>  - movie recording.
 <F10> - movie play.
 <F11> - quit to OS.
 <F12> - screenshot (PPU output). Press shift+<F12> fot the entire Windows desktop.

 <1> - standard blitter (256x240).
 <2> - toggles between doubled (512x384) and stretched modes (640x480).
 <3> - cycles between normal, scanlined and pixelated modes. For the standard blitter, 
 toggles normal and interpolated modes.
 <4> - cycles between 3x and 4x modes.

Shortcuts:
 * ctrl+X to quit to OS.
 * ctrl+L to load a ROM.
 * alt+Enter to toggle fullscreen/windowed modes. Usually, it attempts for 640x480 mode.

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

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

 > Here's a quick overview of the GUI.

       [ ! File  CPU  Misc  Options  ? ]

 [File]
  + Load ROM...........: File dialog box, displays NES, NSF, FDS and ZIP files.
    Header info........: File header information viewer (NES, FDS or NSF).
    Take screenshot....: Screenshot saved as bitmap (BMP).
    Sound recorder.....: Record the emulation sound output into WAV files (44100hz, 16bit).
    Quit...............: Close the program.

 [CPU]
  + Reset..............: Soft reset.
    Hard reset.........: Hard reset, like a power off/on switch.
    Save state.........: Save your progress.
    Load state.........: Restore your freezed progress.
    Disassembler.......: PRG ROM disassembler and CPU state.
    Custom... .........: An alternate interface for disassembling.
    View CPU state.....: Displays the ROM vectors, CPU registers and PRG ROM banks state.
    Memory dump........: Dumps almost any emulated NES memory data.

 [Misc]
  + Screen resolution..: Changes 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 general 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..: Restore your saved progress.
    View game information.......: NES header info.
    The screen..................: Emulator video setup shortcuts.
    I wanna close this program..: Close the emulator and quit to OS.


        <<--------------------------------------------------------->>
          Quick NES memory 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) and $4016 (inputs).
          $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.
        <<--------------------------------------------------------->>

            [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.

        <<--------------------------------------------------------->>
          Screen blitting (+interpolated mode) and config file

 - The PPU screen blitting options are:

   * 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);
   * normal mode at 256x240 pixels, interpolated and scanlined.

 - All the settings are saved into "rocknes.ini" file. Use the GUI to configure the available options.
 - The interpolated mode draws even scanlines in even frames, and odd scanlines in odd frames.
 It's suggested to activate triple buffering mode.

        <<--------------------------------------------------------->>
          Screen filtering

 - Currently, an easy motion blur is implemented. You can try out at [Options]->Other options.
 Since it's in a beta stage, you might notice a few minor stains on screen. :-)

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

 - RockNES uses a sample rate of 44100hz. Currently, you cannot change it. Options are:

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

 - NSF is a piece of sound code extracted from games. It's supported as mapper #256. 
 During the playback, a frequency visualizer draws coloured circles. While playing it,
 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 (watchdog), which isn't supported.

        <<--------------------------------------------------------->>
          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 a possible reason.

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

 - RockNES uses a 16bit RGB palette taken from the PSX game "Rockman Complete Works". Some missing
 RGB indexes were filled up using a 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, so the palette has 64 of them.
 Color emphasis palettes are auto generated, there's no need of storing them into a palette file.

 - From version 5.11, you can restore the old palette. Look at [Options]->Other options, then uncheck
 "Use NESdev alternate palette".

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

 4. NES header format
 ---------------------

 > The NES header are 16 bytes before the first PRG ROM bank. Here's an easy description.

    +--------+------+------------------------------------------+
    | Offset | Size | Content(s)                               |
    +--------+------+------------------------------------------+
    |   0    |  4   | NES + $1A                                |
    +--------+------+------------------------------------------+
    |   4    |  1   | Number of 16kib PRG ROM banks.           |
    +--------+------+------------------------------------------+
    |   5    |  1   | Number of 8kib 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 System                 |
    |        |      |    |  |  +-- 1=Playchoice-10 system      |
    |        |      |    +--+----- High 4 bits of mapper number|
    +--------+------+------------------------------------------+
    |  8-15  |  8   | Reserved, must be zeroes. Dirty headers  |
    |        |      | bring garbage here, be warned!           |
    +--------+------+------------------------------------------+


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

 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 "in$ert coins". DIP Switches are not supported.
 - Only games in NES format are supported.


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

 6. Famicom Disk System
 ----------------------

 - It's a peripheral for the Nintendo Family Computer console in Japan. It was a unit that 
 used proprietary floppy disks (called "Disk Cards") for data storage. Currently, the disk
 images were poorly dumped, missing important data. At anyway, an effort is made to emulate
 these games.
 - Firstly, the Famicom Disk System emulation requires the BIOS file "disksys.rom". Find it
 by yourself and place it in the same folder of RockNES.exe binary. Supported games use the
 FDS format. In fact, the 16-byte header isn't required (FDS string).

 * Once you load a game, the BIOS initializes the system. Once the title screen appears,
 you may be prompted to switch the disk side.

 *** Press <F7> to eject the virtual disk, press <F6> to change the virtual disk side, then
 press <F7> again to insert the disk.

 * The support for FDS emulation is partial. No extra sound is generated for now.
 
 [==========================================================================]

 7. 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 base address selection.
 |(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 current 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.


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

 8. 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

 FCEUX
 http://www.fceux.com/web/home.html 

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