GBA9500 1.1 - Game Boy Advance emulator for the Nokia 9500 / 9300 (Series 80 v2.0)
Started 2026-10-25. Package UID 0x01000A1E. Runs on the Nokia 9500.

WHAT IT IS
  gpSP (Exophase's GBA emulator, notaz's GP2X/Pandora tree, GPL v2) ported to Symbian.
  gpSP translates the GBA's ARM7 code into native ARM code at run time (a dynamic
  recompiler, "dynarec"), which is the only way to get near full speed out of a 150 MHz
  ARM9. The GP2X (ARM920T, ARMv4T) is the same CPU family as the 9500's ARM925T, and its
  dynarec emits only ARMv4T instructions.

  Pokemon FireRed plays and is stable: about 50 frames a second emulated, 11-17 of them
  drawn (auto frameskip). Drawing four tile layers is what limits it (~130 us per line).

    cpu_threaded.c + arm\arm_emit.h   the dynarec (translator), gpSP's own
    arm\arm_stub.S                    the dynarec's assembler glue, gpSP's own
    memory.c                          GBA memory map, DMA, saves, ROM loading/paging
    video.c + arm\video_blend.S       scanline renderer (into a 240x160 RGB565 buffer)
    sound.c                           direct sound + the four GB channels, 22050 Hz stereo
    cpu.c                             CPU state, interrupts (the interpreter is left out)
    gbamain.c                         new: ROM list, menu, pacing, settings, gpSP's
                                      main.c/input.c parts
    epocsys.cpp / epocaudio.cpp       NES9500's native layer (window, framebuffer, keys,
                                      font menu, files, audio thread) + IMB cache sync
    gbastub.cpp, blobapi.h            1.1: the Symbian program that loads the emulator
    blob\                             1.1: start-up code and link script of the emulator
    Launcher\                         the Desk icon (GBA9500.app), starts gba9500.exe

  The gpSP versions it is based on: notaz's tree, commit 862e940b (2013), and libretro's
  (newer fixes, for reference only), commit 5819380c.

1.1: THE EMULATOR IS BUILT BY GCC 14
  As in Quake9500 1.1: all the C (the emulator itself) is built on the PC by a modern GCC
  (Arm GNU Toolchain 14.2, arm-none-eabi, ARMv4T, soft float, newlib) into one file,
  gba9500.rbl. gba9500.exe, built with the Series 80 SDK, is only a loader: it finds the
  GBA folder, loads gba9500.rbl into a code chunk, fixes up its addresses and calls it.
  The emulator reaches Symbian (screen, keys, files, sound, time) through a table of
  functions the stub hands it (blobapi.h). The 1.0 build with the SDK's GCC 2.9 still
  works: epoc\GBA9500_gcc29.mmp.

  Put another build next to it to try it: copy NAME.rbl to the GBA folder and write NAME
  into blob.txt there.

WHAT CHANGED FROM gpSP
  - The asm stub lives in .data, not .text (1.0): the dynarec reaches it with bl from the
    translation caches, which are static arrays in .bss; on EKA1 a process's data/bss are
    far from its code but next to each other. The stub's calls into C are long calls.
  - The 9500 traps unaligned memory accesses, which the GP2X allowed: the stub sends
    unaligned loads and stores through gpSP's C paths, which rotate or align them.
  - Cache sync: User::IMB_Range instead of the GP2X "warm" kernel module.
  - Linking translated blocks goes at most 6 deep and within a 32 KB stack budget;
    deeper exits get a small trampoline.
  - Translation caches: ROM 3MB, RAM 512KB, BIOS 128KB.
  - ROM buffer sized per game: the whole ROM if the heap has room and 6 MB stays free,
    else 32KB pages read from the file (native RFile, kept open).
  - Sound: epocaudio's stream thread drains gpSP's ring (no lock: each side owns one
    index). When the emulator gets ahead the sound clock holds it back. The square wave
    sweep switches the channel off instead of dividing by zero.
  - Files go through single RFile calls (saves in ~0.3 s, states in ~1 s).
  - No zip, no cheats, no gpSP menu/font (our menus use the system font).

INSTALL
  1. Install GBA9500.SIS (memory card or phone memory).
  2. Copy your own GBA BIOS dump to D:\GBA\gba_bios.bin (16384 bytes; D: is the 9500's
     memory card) or C:\GBA\, and your .gba files next to it. Zipped games must be
     unzipped first. The BIOS is not included and can't be.
  3. Start GBA9500 from the Desk.

  The GBA folder is the first of E:\GBA, D:\GBA, C:\GBA that holds gba_bios.bin. It also
  holds:
    gba9500.cfg       settings
    gba9500log.txt    the log (speed lines every ~10 s, a crash report if it crashes)
    <game>.sav        battery saves (written a few frames after the game saves, and when
                      the menu opens)
    <game>.ss0 ...    save states (about 570 KB each)
  game_config.txt (gpSP's per-game idle-loop and BIOS hacks) is installed with the SIS in
  \System\Apps\GBA9500\; a copy in the GBA folder wins. Keep its CRLF line endings.

KEYS
  D-pad:   rocker or arrow keys
  A:       X, K, Ctrl, rocker middle        B:   Z, J
  L:       A, U, left Shift                 R:   S, I, right Shift
  Start:   Enter, Space                     Select: Tab, Backspace
  Esc / Menu: in-game menu (save/load state, state slot, picture, lines per frame,
           frameskip, sound, reset, another game, quit)
  Chr+S save state, Chr+L load state (a small square flashes: green saved, blue loaded,
  red no state in that slot), Chr+F fast forward on/off.

PICTURE
  The GBA makes 240x160. "fit" (default) scales it to 300x200, the whole screen height,
  same shape; "1x" shows it pixel for pixel in the middle. "Lines per frame: every other"
  draws half the lines of each frame (faster, but it flickers).

BUILD
  On the PC (Git Bash), the emulator:
    sh tools/build_blob.sh          -> blob\gba9500.rbl
  It needs the Arm GNU Toolchain 14.2.Rel1 (arm-none-eabi); ARMGCC= points to its folder
  (by default ..\RE9500\tools\dl\arm-gcc) and Python 3 for tools\mkblob.py.
  tools\armsim.c is an ARM interpreter that runs the blob on the PC (it stops at an
  unaligned access, writes PPM frames, takes scripted key presses).

  On the Win2000 VM, Series 80 v2.0 SDK; the project folder sits on the SDK drive at
  \GBA9500 (with blob\ copied there):
    \GBA9500\Launcher:          bldmake bldfiles, abld build armi urel
    \GBA9500\GBA9500\epoc:      bldmake bldfiles, abld build armi urel
                                makesis GBA9500.pkg
  GBA9500.pkg is generated from GBA9500.pkg.txt (UTF-16; the command is in the .txt).

  The old GCC 2.9 build (epoc\GBA9500_gcc29.mmp) also needs: asm (assembles
  arm\arm_stub_pp.s + arm\video_blend_pp.s into gbaasm.lib, made from the .S files by
  tools\mkstub.py) and, for speed, o2 (rebuilds the hot files at -O2, video at -Os).

  tools\check.sh syntax-checks the C as GCC 2.9 would want it (C89) with a host GCC.

LICENCE
  GPL v2 (COPYING.DOC), as gpSP. The C library in gba9500.rbl is newlib
  (COPYING.NEWLIB).
