NES9500 - NES emulator for the Nokia 9500 / 9300 (Series 80 v2.0)
Version 1.0, 2026-11-22. Package UID 0x01000A1D.

A Nintendo Entertainment System emulator written from scratch for the Nokia 9500
Communicator: full-speed games with sound, drawn straight into the 640x200 screen.

Emulator: Sami Vuori, written together with Claude (Anthropic).
Licence: GNU GPL version 2 (COPYING).


INSTALL
  1. Install NES9500.sis (to the phone or the memory card). It puts NES9500 on the Desk.
  2. Copy .nes game files to \NES\ on the memory card (D: on the 9500) or to C:\NES\.
     Games are not included.
  3. Start NES9500 from the Desk, choose a game and press Enter.
  NES9500 looks for games in E:\NES, C:\NES and D:\NES.

WHAT IT IS
  Our own NES core (no outside emulator code), written for the 9500's 150 MHz ARM:
    cpu.c      6502 interpreter, registers kept in locals, official + common unofficial opcodes
    ppu.c      scanline renderer (loopy scroll model, sprite 0 hit, 8 sprites/line) that
               writes each line straight into the framebuffer, already scaled
    apu.c      both pulses, triangle, noise and DMC, non-linear mixing, 22050 Hz mono
    nes.c      memory map, iNES loader, mappers, frame loop, save states
    nesmain.c  ROM list, settings, in-game menu, frame pacing with automatic frameskip
    epocsys.cpp / epocaudio.cpp   native layer from Doom9500/Quake9500 (HAL framebuffer,
               window group at the front, audio thread + CMdaAudioOutputStream), plus a
               menu drawn with the system font and file helpers
  Mappers: 0 NROM, 1 MMC1, 2 UxROM, 3 CNROM, 4 MMC3, 7 AxROM, 11 Color Dreams,
  66 GxROM, 71 Camerica. That covers SMB 1-3, Zelda 1-2, Metroid, Mega Man 1-6,
  Castlevania 1-2, Contra, Kirby, Battletoads, Duck Tales, Tetris...
  Not supported yet: MMC2/MMC4 (Punch-Out!!, Fire Emblem), MMC5 (Castlevania III),
  VRC mappers (Japanese Konami), FDS. Starting such a game says "Mapper N is not supported".
  PAL and NTSC timing: chosen from the header, or from the file name ("(E)",
  "(Europe)", "(Scandinavia)", ...), and can be changed in the menu.

BUILD (on the Win2000 VM, Series 80 v2.0 SDK)
  The project folders must sit on the SDK drive at \NES9500\NES9500 and \NES9500\Launcher
  (o2.bat assumes it).
  1. Emulator, from \NES9500\NES9500\epoc:
       bldmake bldfiles
       abld build armi urel
       (for speed) o2, then abld build armi urel again   (cpu, ppu, apu, nes at -O2)
  2. Launcher (Desk icon), from \NES9500\Launcher:
       bldmake bldfiles
       abld build armi urel
  3. From \NES9500\NES9500\epoc:  makesis NES9500.pkg   (generated from NES9500.pkg.txt)
  4. Release (on the PC): copy NES9500.sis into release\, then
       py tools\make_release.py [version]
     makes release\NES9500-<version>-src.zip (the source) and NES9500-<version>.zip
     (NES9500.sis + readme.txt + COPYING).

LAUNCHER
  NES9500.app (caption "NES9500", the logo from icon_64x50.bmp / icon_25x20.bmp) sits on
  the Desk and starts nes9500.exe at once, then quits. Only if the emulator can't be
  found or started does it stay, with Start / Exit. Launcher\make_masks.py makes the
  icon masks (the green corner pixels = transparent, the black tile stays); run it again
  after changing the icons (copy them into Launcher as appicon_64x50.bmp etc.).

GAMES (not included)
  Copy .nes files to \NES\ on the memory card (D: on the 9500) or to C:\NES\. If no
  NES folder is found, C:\NES is made on the first run. Next to each game: <game>.sav
  (battery save, written when you open the menu or leave the game) and <game>.sta
  (save state). nes9500.cfg in the NES folder keeps the settings, nes9500log.txt the
  log: the HAL screen numbers, the menu font, each ROM's mapper/size, and on a crash
  the exception and the 6502 PC.
  The menu title shows the speed: "60 fps (40 drawn)" = full speed, 2 of 3 frames drawn.

KEYS
  D-pad:   rocker, arrow keys, or W A S D
  A:       Z, K, Ctrl, rocker middle
  B:       X, L
  Turbo A: I        Turbo B: O   (A/B pressed over and over while held)
  Start:   Enter, Space
  Select:  Tab, Shift, Backspace
  Esc / Menu: in-game menu (save/load state, keys, turbo speed, picture size, lines,
           sprites per line, background image, sound, volume, region, reset, another
           game, quit)
  These are the built-in keys. "Keys..." in the menu changes them: choose a button,
  then "Set the key" (replaces its keys), "Add another key" or "Clear", and press the
  key. A key belongs to one button, so giving it to another takes it off the first.
  "Back to the built-in keys" restores the list above. Esc, Menu and Chr can't be
  used (menu and Chr+S/L/F). Saved in nes9500.cfg as "keys scancode=bits ...".
  Turbo speed (menu): fast 30, medium 15, slow 10 presses a second (25/12/8 on PAL).
  Chr+S save state, Chr+L load state (a small square flashes: green saved, blue loaded,
  red no state), Chr+F fast forward on/off.

PICTURE
  The screen is 640x200 and the NES makes 256x240 (a TV shows lines 8-231).
  Lines: "fit all 224" squeezes those 224 lines into 200 (drops every 9th line);
         "crop to 200" shows the middle 200 lines 1:1.
  Picture: 1x is the true shape with "fit"; 1.5x (default), 2x and full width stretch it.

BACKGROUND IMAGE
  Fills the screen around the game picture (at 1.5x: 128 pixels each side; at 1x:
  192; nothing at full width). Put background.bmp in the NES folder, or next to a
  game as <game>.bmp to give that game its own (e.g. BLASTERMASTER.bmp). 640x200
  fits exactly; other sizes are stretched. Uncompressed BMP: 24-bit, 32-bit,
  256-colour or 16-colour (what Paint saves). "Background image" in the menu turns it
  on and off; the log says which file was used, or why it was refused.
  A 5-pixel black edge separates the picture from the wallpaper (not at full width).

SPRITES
  The real NES shows 8 sprites per line and games flicker them to show more. NES9500
  shows up to 16 by default (less flicker); "Sprites per line: 8" in the menu is the
  real behaviour, for the few games that hide things behind the limit.

NOT DONE YET
  More mappers (MMC2 for Punch-Out!!); speed work if needed (ARM assembly for the 6502
  core and the line output).
