joeldipops / gbz80-pseudoOps

Set of rgbasm macros and constants to facilitate readability for modern programmers
MIT License
8 stars 1 forks source link

Jump pseudo instructions that describe conditions better? #4

Closed DonaldHays closed 5 years ago

DonaldHays commented 5 years ago

This is a really interesting project you have, that really adds a lot of convenient value in a really straightforward, un-intrusive way. I think it's pretty common for developers to create macros for things that would make sense to be instructions, but aren't. A library that provides many of them all at once makes a lot of sense.

A collection of like-minded macros I wrote before but haven't gotten around to publishing involved making jumps clearer. They add pseudo-instructions for jr, jp, call, and ret for when the previous operation (a sub or a cp) produced a "less than", "greater than", "less than or equal", "greater than or equal", "equal", or "not equal" condition.

I feel like instructions of that sort might make sense for this library. I've attached my previous code. If you think the idea is appropriate for your library, feel free to use it to any extent you wish, harvesting directly, or just inspiring your own macros developed to your particular style and standard.

I will warn that while I'm pretty sure they work correctly, they are a year or two old, I never used them in a real project, I don't remember how well I tested them, and so any or all of them may well be implemented incorrectly :D

https://gist.github.com/DonaldHays/a2cdddba571a20d73e9b5f6550695cf3

joeldipops commented 5 years ago

Thanks, this is a great fit. I'll reformat them because I get a bit obsessive about formatting but they'll make their way into the library for sure.

joeldipops commented 5 years ago

jp & jr added. ret and call to follow

joeldipops commented 5 years ago

Done