gbdev/rgbds

`const & non-const` is not computed correctly

Closed this issue · 0 comments

tryConstMask attempts to calculate constant A & B, when A is a constant mask and B is a non-constant symbol (i.e. in a floating section) whose alignment is high enough that all the masked bits are known.

However, we're not actually applying the mask! It just so happens that use cases tend to have masks of all 1 bits and/or low symbol bits of all 0 bits, e.g. Label & $FF with Label at ALIGN[8, 0].

Failure case:

SECTION "test", ROM0, ALIGN[8, 42]
Life: ; $00:xx42
assert (Life & $F0) == $20 ; nope, it's currently $2A