#16167·mame

apple2gs: lua space read/write taps not firing consistently

Author: inexorabletashCreated Sep 17, 2026Updated Sep 17, 2026

MAME version

0.289 (ample-289-u2)

System information

macOS Version 15.7.9 (24G830)

Emulated system/software

apple2gs

Incorrect behaviour

A read tap installed via space:install_read_tap(0x40F5, 0x40F5, "t1", callback) does not fire consistently.

Using a read tap on space:install_read_tap(0x4000, 0x5000, "t2", callback) then filtering for the passed offset == 0x40F5 does work. And if both taps are installed, then the first now starts working!

Expected behaviour

space:install_read_tap(0x40F5, 0x40F5, "t1", callback) should fire on any read access to 0x0040F5 in the emulated system's active memory banking

Steps to reproduce

Launching mame with:

mame64 apple2gs -skip_gameinfo -window -nomax -nothrottle -sl7 cffa2 -hard1 a2d_build.2mg -autoboot_script autoboot.lua

The 2mg comes from: a2d_build.2mg.zip

(a local build in which 0x40F5 is a "heartbeat" routine)

Use the following as autoboot.lua:

lua
print("installing taps")
local mem = manager.machine.devices[":maincpu"].spaces["program"]

emu.t1 = mem:install_read_tap(0x40F5, 0x40F5, "t1", function(offset, value, mask) if offset == 0x40F5 then print("t1") end end)

emu.t2 = mem:install_read_tap(0x4000, 0x5000, "t2", function(offset, value, mask) if offset == 0x40F5 then print("t2") end end)

Try first with the script as-is. You should see "t1" and "t2" both printed out regularly once the app has started.

Now delete the emu.t2 = ... line and try again. You'll see "t1" printed out a few times, then it stops.

Additional detail

The problem does not reproduce on other apple2* models.