Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

Debugger: Lua - Add emu.readRegister and emu.writeRegister#75

Open
HertzDevil wants to merge 1 commit into
SourMesen:masterfrom
HertzDevil:feature/lua-read-write-register
Open

Debugger: Lua - Add emu.readRegister and emu.writeRegister#75
HertzDevil wants to merge 1 commit into
SourMesen:masterfrom
HertzDevil:feature/lua-read-write-register

Conversation

@HertzDevil

Copy link
Copy Markdown
Contributor

This PR adds two functions to the Lua API for reading from or writing to selected internal registers and pseudo-registers directly, without having to go through emu.getState every time, which creates very large tables with values the caller isn't interested in (the SNES one for example has 602 entries). This is especially useful for setting individual flags in a status register, see my forum comment that led to this PR.

The interpretations of the registers are identical to debugger expressions for the most part, with two notable exceptions: ML and MH are distinct registers on the CX4, and PC is read-only on the WonderSwan.

@jrdek

jrdek commented Apr 17, 2026

Copy link
Copy Markdown

+1 -- this is extremely useful functionality! getState() is painfully slow due to serializing the entire IConsole state, even though most Lua scripts probably don't consume most of it.

Mokona pushed a commit to Mokona/MesenCE that referenced this pull request May 17, 2026
…aTiming

NES: Fixed overclocking causing the APU to desynchronize from the CPU
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants