-
Notifications
You must be signed in to change notification settings - Fork 30
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
Use the cc65 library's new vpoke() function in C demoes. #70
Conversation
…t in the source file.
Why does vpoke() have the value as the first and the address as the second argument? |
It allows the implementation to be smaller -- and, both the function and calling programs run faster. |
This order of arguments of One could change the name of |
There is precedence for the order that I chose: int fputc(int c, FILE* f);
int fputs(const char* s, FILE* f);
size_t fwrite(const void* buf, size_t size, size_t count, FILE* f); Some standard functions use the |
We already can do it: #define VPOKE(dest,src) vpoke(src,dest) We even can go "overboard", and write: #define VPOKE(high,address,data) vpoke(data, ((unsigned long)(high) << 16) | (address)) |
I think those examples of reverse order assignment are exceptions because they were afterthoughts, e.g. putchar() probably existed first, and fputc() came as an extension. I don't think the solution with capitals looks like C. Another example from C library with order |
I really like the idea of a macro vpoke() with the "correct" order, and an implementation __vpoke() with the swapped one. (Where would we change this?) |
vpoke is defined here: Then one could change the asm source at: Note: the standard PEEK and POKE in cc65 are in all caps and are macros: https://github.com/cc65/cc65/blob/master/include/peekpoke.h |
Note that the number and order of
vpoke()'s
parameters changed.The VERA address now is a single argument. That makes it slightly easier to see where things are being poked.