-
Notifications
You must be signed in to change notification settings - Fork 22
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
Defining F values based on B values #42
Comments
I think single-bit values should use @aaaaaa123456789 sugested (Also, the name |
If the names of the constants don't make it clear which is which, the constants themselves are confusing (i.e., unrecognisable on use) and shouldn't be defined at all! |
That's a very good point! I find that the current names are clear, but not intuitive. Because I just think that it should remain easier to learn that scheme, since it does take a little getting used to. |
Personally I find the If backwards compatibility weren't so important I'd suggest |
My hardware-ex.inc project (which is not yet public in a usable form) aims to extend hardware.inc to support Mega Duck and Analogue Pocket's .pocket format. For that project I preferred method 3 since constants can have up to three definitions, and it's nice that each unique value is only defined in a single place. I'd strongly suggest this method. As for prefix vs suffix, I personally prefer prefix, but this is not a strong opinion. |
The hardware.inc convention is for
<REG>B_<FIELD>
to be a 0-7 bit value, and<REG>F_<FIELD>
to be the corresponding mask value. A few examples:I'd like to make these consistent in one of three ways:
%00000100
.$08
.DEF OAMF_PRI EQU 1 << OAMB_PRI
.The advantage of option 3 would be avoiding redundancy or mismatch between the values, making the connection obvious.
The advantages of 1 or 2 would be explicitly showing the numeric mask value (although that could still be a comment next to the
1 << B
, in either bin or hex).My own preference is for option 3, but I wanted to get feedback from the maintainers here before PRing anything.
(If that is the preference, I'd even consider going further and having a macro like
DEF_FLAG OAMB_PRI EQU 7, OAMF_PRI
to reduce the line count.)The text was updated successfully, but these errors were encountered: