Skip to content
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

Companion file for conveniences #38

Open
3 tasks
ISSOtm opened this issue Nov 15, 2022 · 7 comments
Open
3 tasks

Companion file for conveniences #38

ISSOtm opened this issue Nov 15, 2022 · 7 comments

Comments

@ISSOtm
Copy link
Member

ISSOtm commented Nov 15, 2022

See #36 and #37 for context.

It would be useful to distribute a file whose defines aren't just strictly hardware-related. For distribution convenience, I'd suggest putting it in this same repo; this should not be a big deal, considering the size of the files in question.

Here are some discussion items:

  • Any reasons not to do this?
  • How to call it?
  • What to put in it?

An obvious candidate for the contents is the PAD{B,F}_* constants, but there are likely more that I'm missing right now.

@Rangi42
Copy link
Contributor

Rangi42 commented Nov 15, 2022

How about "hardware_extras.inc" or "hardware-extras.inc"? "foo-extras" looks like a common pattern for useful but inessential library additions.

@zlago
Copy link
Contributor

zlago commented Nov 15, 2022

maybe name it after the constants it has, but store them in extras/ directory? so hardware.inc would have hardware constants, pads-gba.inc would have gba convention pad constants...

@pinobatch
Copy link
Member

windows.h automatically includes some lesser-used convenience headers if WIN32_LEAN_AND_MEAN is not defined. For the sake of easing the transition, would an analogous define for hardware.inc that disables the extra headers be a good or bad idea?

@aaaaaa123456789
Copy link
Member

aaaaaa123456789 commented Nov 15, 2022

I'd call it something like stdlib.inc, since that's what its goal seems to be. (And I'd have stdlib.inc include hardware.inc for simplicity.)
Some other possible additions for such a file would be:

  • The identity palette mapping for DMG-based games, $E4 (as PAL_IDENTITY or BGP_IDENTITY or something like that)
  • An identity character map (setcharmap ascii or setcharmap identity; I favour the latter) to suppress the corresponding warnings in RGBASM when identity mappings are used
  • Alternate unofficial names for registers with known official names (like the audio or HDMA registers)

windows.h automatically includes some lesser-used convenience headers if WIN32_LEAN_AND_MEAN is not defined. For the sake of easing the transition, would an analogous define for hardware.inc that disables the extra headers be a good or bad idea?

Copying what I said in #37:

First of all, if a constant for "extra" definitions was to be added, it would have to be opt in, not opt out.
That being said, it's still a bad idea. This project has been offered to users as a way to reference hardware, not to impose opinionated non-hardware non-conventions onto unaware codebases. The registers have official names, and the flags have obvious behaviors; anything else shouldn't be here, because the advertised goal isn't to impose on random codebases.

If you want to make a "standard library", the proper way to do that is to make an actual standard library repository.

@Rangi42
Copy link
Contributor

Rangi42 commented Nov 15, 2022

If it's going to be called stdlib.inc, I can think of various things besides "subjective hardware-related constants" that could be added. In particular, the macros that are frequently recommended and even used in example code, like lb hl, HVAL, LVAL, or bigdw BigEndianWord. Conversely, if it's not going to define such utility macros (understandable since many projects define their own), I think "stdlib" is too broad a name for that one file.

@ISSOtm
Copy link
Member Author

ISSOtm commented Nov 22, 2022

I'd add them to the file, since projects that define their own aren't using stdlib.inc in the first place; and if they were (and it had incompatible semantics, or something), then PURGE would allow overriding them anyway.

Shall we open a PR, then?

@evie-calico
Copy link
Contributor

A CGB-format rgb macro would be nice too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants