libretroadmin 71bbd10ad0 tengen: auto-reload + trigger-on-reach-0 for RAMBO-1 IRQ (#544)
The Tengen 800032 (RAMBO-1) IRQ counter on real hardware auto-reloads
from its latch when it would otherwise underflow, and the IRQ
triggers when the counter REACHES zero (going from 1 to 0) rather
than on the underflow step that follows.

Upstream's earlier model triggered on underflow (count 0 -> 0xFF)
and then continued decrementing through 0xFE, 0xFD, ... until the
game wrote a reload register ($C000/$C001/$E000/$E001 with
rmode==1).  For titles that don't write the reload register on
every IRQ - Skull & Crossbones in 2-player mode is the documented
case (libretro docs Compatibility entry), but Hard Drivin', Klax,
Rolling Thunder, Road Runner, Xenophobe etc. all use the same
mapper - subsequent IRQs after the first underflow are silently
swallowed, displacing the status-bar split point and producing the
screen-shake / glitch reported in #544.

Backport reference: negativeExponent's libretro-fceumm_next commit
7f277a8 ("Cleanup mapper 64/158") plus the Mesen RAMBO-1 model.
This patch is the minimal algorithmic delta against upstream:

  - RAMBO1IRQHook (CPU-cycle mode, IRQmode==1): trigger on
    IRQCount reaching 0, auto-reload from IRQLatch on the next
    clock after the trigger.
  - RAMBO1HBHook (scanline / A12-approximation mode, IRQmode==0):
    same change.  rmode is still set on IRQ fire so existing
    register-reload semantics on $C000/$C001/$E000/$E001 are
    preserved bit-for-bit - the writes do exactly what they did
    before, the only behaviour change is what the IRQ hook itself
    does between writes.
  - IRQLatch == 0 edge case handled (reload yields 0, which is the
    reach-0 trigger condition, so IRQs fire on every clock - the
    documented hardware behaviour at latch=0).

Crucially, this does NOT change:
  - SFORMAT chunk layout (REGS/CMDR/MIRR/RMOD/IRQM/IRQC/IRQA/IRQL
    chunks all still present, same byte sizes, same order).  Old
    savestates continue to load correctly.
  - The write-side dispatch (RAMBO1_Write) for $A000, $8000,
    $8001, $C000, $C001, $E000, $E001 - all behave exactly as
    before, including the rmode==1 conditional reload.
  - Mapper 158 (TENGEN 800037, Alien Syndrome Unl) wiring - it
    shares the RAMBO1 IRQ hook and gets the same fix for free.
  - PRG/CHR/mirroring sync logic.
  - Power-on and StateRestore behaviour.

Build verified: tengen.c -O2 / -O3 / aarch64 -O2 clean.
2026-06-14 17:30:41 +02:00
2024-09-23 05:55:21 -07:00
2023-01-02 19:47:36 +01:00
2026-04-02 10:14:04 +01:00
Fix
2017-12-21 20:40:28 +09:00
2014-12-23 09:50:29 +01:00
2015-08-06 13:28:43 +02:00
2025-09-03 16:20:50 +02:00
2019-06-28 23:44:06 +02:00

Build Status Build status

FCE Ultra mappers modified

FCEU "mappers modified" is an unofficial build of FCEU Ultra by CaH4e3, which supports a lot of new mappers including some obscure mappers such as one for unlicensed NES ROM's.

Sequential targets Light Guns support added

Support for Sequential targets Light Guns has been added. "Gun Aux A" serves as light sensor logic input.

Description
Pinned internal source mirror of libretro/libretro-fceumm for Supergame releases
Readme 4.3 MiB
Languages
C 97.7%
Python 2%
C++ 0.2%