Previous Thread
Next Thread
Print Thread
#120465 02/10/22 11:06 PM
Joined: Apr 2021
Posts: 46
Likes: 19
K
kmg Offline OP
Member
OP Offline
Member
K
Joined: Apr 2021
Posts: 46
Likes: 19
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)

3 members like this: MrBogi, R. Belmont, Dullaron
Joined: Feb 2004
Posts: 2,383
Likes: 98
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,383
Likes: 98
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: MrBogi
Joined: Feb 2004
Posts: 2,383
Likes: 98
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,383
Likes: 98

Joined: Apr 2021
Posts: 46
Likes: 19
K
kmg Offline OP
Member
OP Offline
Member
K
Joined: Apr 2021
Posts: 46
Likes: 19
Yesterday I made a quick and dirty hack of the dummy plugin and combined it with the "gbmode" tap example to expose all the 0x2001 register bits. Here's SMB3's World 1 map screen (the gray background should match the monochrome yellow theme; it's a PPU bug with a pending PR):

[Linked Image from imgur.com]

I figure doing things like this and similarly being able to switch audio channels on and off from a plugin will be useful for testing purposes.

Joined: Feb 2004
Posts: 2,383
Likes: 98
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,383
Likes: 98
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: MrBogi

Link Copied to Clipboard
Who's Online Now
1 members (Pernod), 21 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,102
Posts119,266
Members5,019
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