
                         R o c k N E S
                    A NES videogame emulator
                        1998-2010 Fx3
                      Win32 version 5.03
                      January 30th 2010

  Freeware, for home use.
  - Website......: http://rocknes.kinox.org
  - Message board: http://rocknes.phpbbnow.com
  - Micro blog...: http://twitter.com/rocknes
  - E-mail.......: fx3rnes@hotmail.com
  <<======================================================================>>

   LICENSE AGREEMENT [January 2010]:

   (A) RockNES is FREE software. It can be distributed freely, as long as 
 you do not change the original ZIP package.
   (B) Do not modify the original binary/executable.
   (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 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.
  <<======================================================================>>

   REQUIRED PC HARDWARE:
   - Modern PCs won't be a problem. ^_^;;
   - For older PCs, you'll need a 1GHz processor and a system within 128mb of RAM.
 Any video board with built-in 3D hardware improves the blitting/speed.
  --------------------------------------------------------------------------
    ----------------------------------------------------------------------  

 What's new for version 5.03 (01/30/2010)
 ----------------------------------------
 - Reworked iNES mapper I/O handler.
 - Reworked PPU color code and event scheduler.
 - Fixed sprite 0 strikes.
 - Fixed triangle channel output.
 - Fixed triple buffering setup.
 - Fixed graphics reset and triple buffering set.
 - Fixed PPU timing and DMC IRQ clocking.
 - Improved Allegro sound support.
 - Changed APU sound queue/dequeue method.
 - Removed timeslice from double buffering, increases CPU usage though.
 - Mappers added: 46, 58.
 - Mappers fixed: 0,1,16,34,43,64,68,69,72,79,83,88,90,92,97,113,184,187.
 - Removed NESticle savestate support for good.
 - Optimizations and some speed up.
 - Other minor things fixed.

 [==========================================================================]
   Read 'oldnews.txt' for a complete history of updates.
 [==========================================================================]

 1. Description
 --------------
 2. Player controls
    Shortcuts
 ------------------
 3. Using the GUI
    NES memory overview
    Additional notes
    NSF playback
    Triple buffering
    Palettes
 ----------------------
 4. iNES header format
 ---------------------
 5. VS Unisystem
 ---------------
 6. The PRG data disassembler
 ----------------------------
 7. CREDITS (no special order)
 -----------------------------

 [==========================================================================]
   KNOWN EMULATION PROBLEMS

 - Mappers 9 and 10 are glitched in the right side of the screen.
 - The game Battletoads (mapper 7) may freeze during the stage 2.
 - Sound lag and/or skipping due to the way Allegro handles it.
 - The mapper 5, known as MMC5, is used by a couple of japanese strategy games.
 Currently, only 2 games work: CastleVania 3 and Laser Invasion (USA). Well,
 it's good enough for both, but tell me if you find something wrong. The setup
 is 64k of RAM for all games.
 - Mapper 4 has two IRQ "modes"; only mode B is supported. If a game looks
 glitched or with flickering, it's that. "Mode" means a different cartridge
 board and setup.
 - With NO hacks, RockNES passes OK through all test suites, *except* by that 
 PPU warm up time latency for I/O.

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

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

 > RockNES emulates the Nintendo Entertainment System videogame, also known
 as NES 8-bit. It's fully coded in C and uses the Allegro library for audio, video
 and inputs such as gamepads.

 * Emulated hardware features *

   - RP2AO3 chip, CPU and APU, based on the 6502 processor.
   - NTSC NES PPU, or Picture Processing Unit.
   - Controller ports 1 and 2.
   - Konami's VRC6 sound chip, used in Akumajou Densetsu / Madara.
   - VS-Unisystem is partially emulated, iNES format only.
   - Backed battery.
   - Famicom Disk System as mapper 20 (partial).
   - Supported 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,88,90,91,92,94,97,99,101,110,113,117,118,119,151,160,180,184,187,189,
    225,226,227,228,229,230,231,232,233,234,235,240,243,246 and 255.

 NOTES: 1. Famicom Disk System emulation (mapper 20) requires the BIOS file
        named disksys.bin in the same directory of RockNES.
        2. The default palette was taken from Rockman Complete Works (PSX). A few
 missing palette entries were filled up with an old palette provided by Chris Covell.

   > Other features available:
   ---------------------------
    - PPU color emphasis and monochrome mode.
    - Joypad data logging, known as "movies" for replay purposes.
    - Save states.
    - NESticle savestate loading (.STA files).
    - Trainer data.
    - GUI and config file.
    - PRG data patching.
    - Sound recording in WAV format.
    - Program data disassembler.
    - Pseudo stereo sound.
    - Various image blitters.

 * Unemulated hardware *

 - Unofficial CPU opcodes.
 - The Famicom Computer system and the european PAL NES.
 - Other inputs like Zapper (light gun), Power Pad and others.
 - Joypads 3 and 4.
 - VS-Dualsystem.
 - Full Playchoice-10 (upper monitor, z80 emulation).
 - MMC5 sound support, among others.

 NOTES: 1. There is ZIP file support. Any file can be zipped.
        2. For the first run, RockNES creates a config file "rocknes.ini".
        3. Special characters, like accents, are NOT supported.
        4. You can use savestates while playing a NSF file.
 
 [==========================================================================]

 2. Player controls
    Shortcuts
 ------------------

 > Player controls:

    [player 1] - device is KEYBOARD setup 1.
    UP, DOWN, LEFT, RIGHT  = keyboard arrows
    A      = X key.
    B      = Z key.
    SELECT = Tab key.
    START  = Enter key.

    [player 2] - no device assigned. You may use KEYBOARD setup 2.
    UP     = U key.
    DOWN   = J key.
    LEFT   = H key.
    RIGHT  = K key.
    A      = S key.
    B      = A key.
    SELECT = Q key.
    START  = W key.

    > Joystick/gamepads:

    UP,DOWN,LEFT,RIGHT = D-pad
    A      - button 1.
    B      - button 2.
    SELECT - button 3.
    START  - button 4.
    Quit   - button 5.

 > Shortcuts:

 <ESC> - GUI access.

 <F1>  - Frames-Per-Second (FPS) display.
 <F2>  - save state.
 <F3>  - file slot select.
 <F4>  - load state.

 <F5>  - soft reset.
 <F6>  - FDS disk change.
 <F7>  - FDS disk insert/eject.
 <F8>  - "insert coin", for VS unisystem games.

 <F9>  - gameplay recording.
 <F10> - plays the recorded gameplay.
 <F11> - unused.
 <F12> - take screenshot.
 <Q>   - Quit to OS.

 - While in the GUI, ctrl+L access the load file dialog, ctrl+X closes the program.
 - Click in the X (right corner of the window) to close the program.

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

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

 > Here's a quick summary of the GUI.
 > This is the menubar, composed by the items:

       [ File  CPU  Misc  Options  Help ]

 [File]
  - Load...............: File selector, valid extensions are NES,NSF,FDS,ZIP.
  - Game info..........: Displays iNES header information + CRCs.
  - Take screenshot....: The gameplay picture is saved as bitmap (BMP).
  - Sound recorder.....: Record WAV files.
  - Quit...............: Close the emulator program.

 [CPU]
  - Reset..............: Performs a reset.
  - Hard reset.........: Same of powering off, then power on and reset.
  - Save state.........: Savestates, can freeze your gameplay progress.
  - Load state.........: Loads savestates, up to 16 slots are available.
  - Load NESticle state: Loads a NESticle emulator savestate.
  - Dump...............: NES memory dumping, already explained.
  - View ASM source....: The 6502 program code disassembled.
  - Manual disassembler: You can disassemble any CPU address.

 [Misc]
  - Video resolution...: You can change the video driver and the resolution.
  - Movies.............: Your gameplay can be reproduced later.
  - Palette............: Changes the current palette.
  - PRG patch..........: You can patch a certain address.
  - PRG corruptor......: Corrupts CPU memory data.

 [Options]
  - Input setup........: Select the input device, as keyboard or joypads.
  - Sound config.......: Changes the sound quality and stereo/mono modes.
  - Directories........: You can configure the paths for dumps and more.
  - Blitter............: Choose a blitter, it enhances your game image.
  - Video buffering....: Select between double or triple buffering.

 [Help]
  - System.............: Display some important system information.
  - About..............: Software version.

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

          [CPU] 
          $0000-$1FFF: system RAM, main block at $0000-$07FF, mirrored 8 times.
          $2000-$2007: PPU registers, mirrored through $2008-$3FFF.
          $4000-$4017: APU registers.
          $4018-$5FFF: Used by memory mappers.
          $6000-$7FFF: Usually Work RAM data appears here.
          $8000-$FFFF: PRG data banks of 8kb each.

          [PPU]
          $0000-$1FFF: CHR RAM, divided into 2 pattern tables of 4kb each.
          $2000-$3EFF: Name tables, divided into 4 x 1kb banks.
          $3F00-$3F1F: Color RAM indexes.
          $3F20-$3FFF: Mirrors of $3F00-$3F1F.
        <<--------------------------------------------------------->>

 > For debugging purposes, you can analyse the NES emulation context using the
 dump option in the CPU menu:


 # [menubar] CPU -> Dump... -> " $0000-$07FF    "  -> system RAM
                               " $6000-$7FFF    "  -> Work RAM
                               " $8000-$FFFF    "  -> PRG banks
                               ------------------ 
                               " PRG data       "  -> Dump all PRG banks
                               " CHR data       "  -> Dump all CHR banks
                               ------------------ 
                               " Palette RAM    "  -> PPU $3F00-$3F1F color indexes
                               " Pattern tables "  -> PPU $0000-$1FFF CHR RAM data
                               " Name tables    "  -> PPU $2000-$3E1F nametables
                               " Sprite RAM     "  -> OAM objects data
                               ------------------ 
                               " CPU registers  "  -> Text file

    * RAM at $0000-$07FF is mirrored 8 times through $0800-$1FFF.
    * Usually, the games use $6000-$7FFF for backed battery data.
    # The PRG banks at $8000-$FFFF are dumped.
    # The CPU registers saved are:
      - Interrupt vectors (NMI/RESET/IRQ).
      - Registers A, X, Y, S, P.
      - Program counter (PC).
      - IRQ and NMI pending flags.
      - $6000-$7FFF state, as PRG, Work RAM or openbus.
      - $8000-$FFFF state, as PRG or open bus.

 > Most of dumped files use the game filename as base. The filename is displayed
 once written to the disk.

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

 - The selectable inputs are: keyboard (setup 1 or 2), joystick or mouse.
 - The mouse support is very poor and must be used only as curiosity, so don't 
 expect superb gameplay.
 - All the changes are saved to rocknes.ini file when you close the emulator.
 - The NES movies do NOT represent a multimedia file, like an AVI, MPEG or other
 kind of video. What's called "movie" here is the ability to replay a game by
 reading all your keypresses saved during a gameplay. Files .rm0, .rm1, .rm2 ...
 are saved gameplays, known here as "NES movies".

        <<--------------------------------------------------------->>
          NSF music playback

 - NSF files are now supported! The driver includes a nice visualizer on playback.
 Why don't you try out and send me some feedback? ;)

 > It draws the circles in this order. You can identify the sound channels by 
 the color of each circle:

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

 - To load a NSF file, go to [menubar] File -> Load.
 - There's no way to display the NSF info during a playback in fullscreen. Basic info
 is displayed in windowed modes only.
 - Only the VRC6 extra sound is supported.
 - PAL region files are not supported, as the playback stays always at 60Hz.
 - Sometimes, the circles overlap themselves.

 > NSF controls:

 - keyboard arrows left/right: changes the track.
 - ENTER key.................: replays the current track.

 * NOTICE! Joystick inputs cannot control the NSF tracks. You must assign 
 KEYBOARD for player 1 *or* 2.

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

 - By request, triple buffering is available now! It eliminates the screen
 tearing effect, making your gameplay smooth during the screen scrolling.
 - However, triple buffering only works on full screen modes, as far as I
 know.
 - To enable it, you select in the GUI "Options" -> "Frame blitter", and pay
 attention to the 2 new options after the blitters. Select "Triple buffering"
 and hit the "X" buttom. Changes will take effect on next launch.
 - You can edit the rocknes.ini config file and change -triple_buffering to 1.

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

 - From [Menubar] Misc -> Palette, you have the following submenu:

     " load .PAL file " -> You can load palette files (.pal)
     " reset default  " -> Restore the default built-in palette
     "________________"             
     " set VS palette " -> Select a VS unisystem color table

 - PAL files must be 192 bytes long. Three bytes (a triplet) compose a RGB value. 
 We take 64 triplets to build the palette. There are a couple of available custom
 NES palettes around.


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

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

 > RockNES supports only files within the iNES header, created by Marat
 Fayzullin. They must have the .NES extension.
 > Here's the format description actually supported:

    +--------+------+------------------------------------------+
    | Offset | Size | Content(s)                               |
    +--------+------+------------------------------------------+
    |   0    |  3   | NES                                      |
    +--------+------+------------------------------------------+
    |   3    |  1   | $1A                                      |
    +--------+------+------------------------------------------+
    |   4    |  1   | 16K PRG data banks                       |
    +--------+------+------------------------------------------+
    |   5    |  1   | 8K CHR data 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, "must be" zeroes.              |
    +--------+------+------------------------------------------+

 > Mappers greater than 255 are not supported.
 > The file size must match the size specified in the header.

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

 5. VS Unisystem
 ---------------

 - Only the iNES format is supported. Special mappers are 99 and 151. Once you load
 a game, the palette will be probably wrong. Please, choose a new set using the GUI:
 Misc->Palette->set VS palette. A few game titles are used as quick reference. Even
 if a specific game isn't listed, well, it doesn't mean it's not supported. Try some
 palette and see how it looks. ^_^;;
 - Once loaded, use key F8 to "insert coin". DIP Switches are not supported.

 - Here's a bit of history:
 > 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.

 Source: WikiPedia
  http://en.wikipedia.org/wiki/Nintendo_Vs._Series

 [==========================================================================]
 
 6. The PRG data disassembler
 ---------------------------

 > RockNES has a good PRG disassembler. You have two great options, selectable from 
 [Menubar]-> CPU-> View ASM source, or [Menubar]-> CPU-> Manual disassembler.

 [1] "View ASM source" - overview

 +-----------------------------------+
 |$8057 *A=90, X=05, Y=00, S=FF, P=A5|  -> PC value, registers A,X,Y,S,P.
 |PRG bank 00 [$00057]               |  -> PRG bank paged at $x000
 |+---------------------------------+|    (x = 5,6,7,8,9,A,b,C,D,E or F)
 ||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          ||  -> Program code, 65O2.
 ||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                ||
 |+---------------------------------+|
 |( )$5000( )$6000 ( )$7000          |  -> CPU address select
 |(o)$8000( )$9000 ( )$A000 ( )$B000 |
 |( )$C000( )$D000 ( )$E000 ( )$F000 |
 +-----------------------------------+

 > You can choose a CPU address. If you select $8000, the entire PRG bank
 at $8000-$8FFF is disassembled. Click in the "REFRESH" button.
 > This is for "read-only", as you're unable to modify any value from here.
 It's good to detect bankswitch errors (invalid banks) or CPU hangs.
 > The code above is a sample of Super Mario Bros. code.

 [2] "Manual disassembler" - overview

 +---------------------------------------------------+
 | Manual disassembler                             X |
 | Please, input a proper address:                   |
 |                                                   |
 |  8000___ [Refresh] (o)CPU  ( )PRG    [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           | |Notice:     | |
 ||801D B0 0C    BCS $802B          | |FF = Open   | |
 ||801F CA       DEX                | |or normal.  | |
 |+---------------------------------+ +------------+ |
 +---------------------------------------------------+

 > It's much like the previous one, with a different layout. the PRG bank
 numbers are disaplyed for all "valid" pages, and FF indicates a possible
 open bus state. You can input any valid address.
 > You're able to specify a CPU offset, from $4020 to $FFFF, or a PRG offset.
 When you click "Refresh", the address specified is disassembled.

 > For *both*, click [SAVE] button to save the disassembled data into a file.
 The ASM code format is: PC value, mnemonics (up to 3 bytes, first one is the
 instruction code, the last 2 are the arguments) and the instruction label and
 address.

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

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

 NesDev - NES info, programs and demos
 http://nesdev.parodius.com
 http://wiki.nesdev.com/w/index.php/Nesdev_Wiki

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

 Allegro library, by Shawn Hargreaves
 http://www.talula.demon.co.uk/allegro

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

 Parodius Networking - website hosting
 http://www.parodius.com

 unzip -- IO for uncompress .zip files using zlib
 Version 1.00, September 10th, 2003
 1998-2003 Gilles Vollant

 blargg
 http://www.slack.net/~ant

 Marat Fayzullin
 http://fms.komkon.org

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