Thread Like Summary
Dullaron, MrBogi, R. Belmont
Total Likes: 5
Original Post (Thread Starter)
#120465 02/10/2022 11:06 PM
by kmg
kmg
Did you know the Famicom had a Gameboy mode 6 years before the release of the handheld?

[Linked Image from imgur.com] [Linked Image from imgur.com] [Linked Image from imgur.com]

Ok, apologies for the clickbait-y idea I stole from YT. I just wanted to draw attention to the cool memory tap addition Vas made to the Lua system yesterday. I had wanted to intercept memory read/writes from Lua before but didn't know how to do it. Here's my newb Lua script to force the NES PPU to always be in "green-scale":

Code
function callback(offset, data, mask) return data | 0x41 end
memory = manager.machine.devices[":maincpu"].spaces["program"]

if passthrough == nil then
        passthrough = memory:install_write_tap(0x2001, 0x2001, "gbmode", callback)
else
        passthrough:reinstall()
end

emu.register_stop(function() passthrough:remove() end)
Liked Replies
#120466 Feb 11th a 04:42 AM
by Vas Crabb
Vas Crabb
Thanks, I wanted to show a silly tap demo like this to demonstrate the new functionality, but hadn’t thought of a nice simple but visible example. You beat me to it. I’m working on addressing some pitfalls in the new Lua functionality so it’ll be easier to use by the time 0.241 is released (e.g. not crashing with a pure virtual function call if you don’t remember to explicitly remove your taps, and not having symbol tables garbage collected out from under you while you have expressions other symbol tables that depend on them).
1 member likes this
#120475 Feb 12th a 04:49 PM
by Vas Crabb
Vas Crabb
If it can speed up turnaround time for testing, that’s great. Hopefully it’ll also be useful for sophisticated cheat/hack applications, and other fun things. I build tools and hope people do cool things with them.
1 member likes this
Who's Online Now
4 members (Praxis, mixmaster, Olivier Galibert, 1 invisible), 18 guests, and 3 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,086
Posts119,083
Members5,014
Most Online890
Jan 17th, 2020
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com