Conversation
db3d3cd to
14fc47b
Compare
|
Drafted for now because I'm sure other constant series can/should have explicit max values. And the map constants should have |
|
for the map limit -1 is also used as terminator for IsInArray searching function, outside of LAST_MAP considerations |
|
Define strings with Also leaving this as a draft because after it's reviewed and ready, I'll want to open a similar PR for pokecrystal and make sure they're in sync before merge. |
1b2448c to
e22ffd6
Compare
|
Changed terminology "max" to "limit" :
Error message now tell :
Added some constants for limit: WIP: Welcoming opinions. |
e52eece to
242d511
Compare
0e2536b to
e3f1bef
Compare
|
Added more $FF terminated searchable constants Keep the update commit separated for clarity in the draft, will most liequelly squash for actual commit unless told otherwise. |
e3f1bef to
b9ee383
Compare
|
@Engezerstorung I hope you don't mind, but I ended up taking a rather different approach to your idea in https://github.com/Rangi42/pokered/tree/const-max.
Personally I think that verifying the unusual limitations is the biggest benefit of your idea, since the fundamental byte- and word-based limits tend to show up anyway from |
|
Make const_def more robust for edge cases. Fixed const_next, it previously wouldnt have been behaving properly in some situations. |
|
Took inspiration of macros bit_const_def & co from rangi42 pr #561 with a different approach. They dont define a limit, but the "format" expected for the constant values. |
ca1a7c6 to
4c12411
Compare
8c26a87 to
cebcbd5
Compare
Introduce a constant limit value cap as a third argument during const_def, throw an error in const if const_value pass const_limit.
Make const_def more robust for edge cases. NYBBLE and BIT defined constants are forced to be between 0 and $F or $7 respectively. Defined constants values are masked as to not be actually bigger than their intended "format" when negative. (if CONSTANT -1 is intended to be $FF, then avoid the issue where `ld bc, CONSTANT` woud result in bc = $FFFF). Fixed const_next, it previously wouldnt have been behaving properly in some situations. Exemple : const_value > 0 but incrementation negative and \1 < const_value would have resulted in a fail situation when it shouldnt have.
0424c25 to
ac42497
Compare
|
Added limit verification to shift_const, macro also now define BIT_\1 constant for bit order value. |
224bb32 to
7b47db0
Compare
Added limit verification to shift_const, macro also now define BIT_\1 constant for bit order value.
2ef08db to
f3922c9
Compare
f3922c9 to
ea1dbaa
Compare

Introduce a constant max value cap as a third argument during const_def, throw an error in const if const_value > const_max.
Useful for situation where $FF is reserved for terminator use or otherwise, or when there is an engine limitation on available IDs like for tilesets.
For now i have set it as a third argument and with a default maximum of $FFFF as to have it be backward compatible with current data structure.Idealy I imagine it as a second argument and with a maximum of $FF. The reasoning that most constant are often limited to 8 bits and there is more often constants where $FF is excluded than there is a difference in "step" for the next constant.