-
-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poke1 and Peek1 #1616
Poke1 and Peek1 #1616
Conversation
Though I wonder if the API should perhaps be different at that level... |
This can already be done with existing |
that is a good point. |
That's true, but you would have to write an function to split it into individual bits and vice versa. What you said could also be said for |
I think it's about balancing the need for a useful API and how common certain operation are. Since the graphics RAM is nibble based, peek4 and poke4 make a lot of sense for writing to VRAM. That argument doesn't really hold up for peek1 and poke1, which are easy enough utilities to write by hand and wouldn't add the same amount of value for the same amount of people. So it's not the same thing. |
I mean ultimately it's @nesbox decision, but we do tend to prefer a small API. People rarely consider the COST of a larger API... assuming that adding more and more functions is "free". |
I mean, you do have a point, but once again the same thing could be said for |
Ah, yes, I forgot about nibble sized "registers" at various memory locations. :-) |
And basically of them are either very rarely or never accessed directly because there is either an API function to do so, or the values aren't really important unless you're doing something advanced. And did I mention most people not knowing(or forgetting) that they exist? :-) |
I'll just chime in that where I come (demoscene), we use poke4 / peek4 a lot to access video memory. But regarding the design choice of packing nibbles in memory: I would've preferred not packing two nibbles in the video memory in the first place, but do it like c64 color memory: higher nibbles never used. Similarly, registers should not pack nibbles / bits if possible. This way, only poke and peek would be needed. TIC-80 ain't really using only 64k of memory, not even close, so why bother making it more hard to do things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to add peek2()/poke2()
in this case :)
Also, you can always call peek(addr,1)
instead peek1(addr)
, was added here #1475
Thanks
I think the availability of both Should |
Before deprecating them, let's a) profile the performance also, if the new poke api is slower to do the same thing or not. poke4/peek4 tends to be the hottest loops of them all: drawing fullscreen graphics for every pixel. b) consider if clean API is worth breaking existing cartridges, at least for a good while |
Ah, this is indeed a good suggestion and would perhaps be an argument for keeping. It's quite possible that
There are many ways to deprecate things, there is no need to "break existing cartridges". Rather it could simply be that when creating new cartridges those APIs are no long accessible, etc... we already have precedent for this with things like the old palette (old cartridges get it, new ones don't), etc... nothing was broken, yet the old palette was deprecated. It just seems very muddled to have two different API calls to do the exact same thing. At the very least we should soft deprecate one or the other - meaning we have a clear recommendation for which is "better". |
I am against deprecating any API, it will break compatibility with old cartridges. |
Added peek2()/poke2() api here 2db3134 |
Updating The API docs do mention version 1.0 now, which is not released.... Should that we a link to a
Obviously (for the API) this is helped by your "we don't deprecate thing" policy... as the only question is whether a new API or feature exists on the version someone is using, not if the behavior has changed... it's a bit nicer documenting wise. |
I usually add a badge with the version number in which this function works, like |
Are you suggesting that instead of "added in 1.0"? |
Personally, I just like |
Then I think I'll leave it for now, I like trying new things every once in a while - see how they feel. :) |
I think these would be useful, especially for compact single-bit flags in save files.