Previous Thread
Next Thread
Print Thread
Page 2 of 2 1 2
Joined: Mar 2001
Posts: 17,294
Likes: 272
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,294
Likes: 272
On the currently live documentation, install_read_tap/install_write_tap have a link to the definition of a pass through handler, but nothing about a return value that I can see?

Joined: Feb 2014
Posts: 1,225
Likes: 224
G
Very Senior Member
Very Senior Member
G Offline
Joined: Feb 2014
Posts: 1,225
Likes: 224
https://docs.mamedev.org/techspecs/memory.html#taps


I think that the thing that was confusing to me is that in my mind I established a 1:1 correspondence equivalence between the c functions and the lua functions.

When I installed a c function tap with install_write_tap (and ignoring the return value) it didn't disappear like the lua install_write_tap would.

I guess I expected them to behave in the exact same way where it would persist without any additional action.



plus when I ran "grep install_write_tap -r src" that a lot of drivers will use an install_write_tap without bothering with the return value.




Unrelated, but speaking of documentation that's a bit confusing I looked at this for an hour:

4.3.3 Lambda function

(...).lr{8,16,32,64}(NAME([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... }))
(...).lr{8,16,32,64}([...](address_space &space, offs_t offset, uNN mem_mask) -> uNN { ... }, "name")
(...).lw{8,16,32,64}(NAME([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... }))
(...).lw{8,16,32,64}([...](address_space &space, offs_t offset, uNN data, uNN mem_mask) -> void { ... }, "name")
(...).lrw{8,16,32,64}(NAME(read), NAME(write))
(...).lrw{8,16,32,64}(read, "name_r", write, "name_w")


and I couldn't figure out what the last two meant...


(...).lrw{8,16,32,64}(NAME(read), NAME(write))
(...).lrw{8,16,32,64}(read, "name_r", write, "name_w")


then I finally realized they're just variations of the first 4, where lr and lw combined into one lrw.

The pattern for the last two doesn't match the pattern given for the first 4 (which of course is easy to spot if you know what you're looking at).
If it said "NAME(<read_function>), NAME(<write_function>)" that would have helped.

(that's what happens when you read documentation at 2am)

Last edited by Golden Child; 06/28/25 08:07 PM.
Joined: Mar 2001
Posts: 17,294
Likes: 272
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,294
Likes: 272
Ok. What I was looking at, and I suspect OG was too, was https://docs.mamedev.org/luascript/ref-mem.html#address-space

Which also documents the memory taps, but differently.

Page 2 of 2 1 2

Link Copied to Clipboard
Who's Online Now
3 members (AJR, Kale, 1 invisible), 229 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,381
Posts122,712
Members5,085
Most Online1,529
Jun 7th, 2025
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0