rgbds: Disallowing negative constants in `ds` breaks backwards compatibility

It has been a very common usage to use a negative ds to declare multiple labels on the same WRAM area, such as:

wLabelA1:: ds 2
wLabelA2:: ds 4

  ds wLabelA1 - @

wLabelB1:: ds 3
wLabelB2:: ds 3

That code would be used to declare a 6-byte area. While it is technically possible to interleave the labels, doing it this way is much clearer when hundreds of such cases are involved.

Commit fe65e07 breaks this, making rgbds backwards-incompatible and removing something that was a feature, not a bug. (Perhaps add a flag to treat it as a bug if needed, but it shouldn’t be the only behavior.)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 25 (24 by maintainers)

Most upvoted comments

Something like this should work:

SECTION "test", WRAM0[$c000]
wA1:: ds 2
wA2:: ds 2

  union
wB1:: ds 3
wB2:: ds 1
wB3:: ds 2
  unext
wC1:: ds 4
wC2:: ds 4
  unext
wD1:: ds 2
wD2:: ds 1
  uend

wE1:: ds 2
wE2:: ds 2

This should result in something like this:

C000 wA1
C002 wA2
C004 wB1
C007 wB2
C008 wB3
C004 wC1
C008 wC2
C004 wD1
C006 wD2
C00C wE1
C00E wE2

This is an example; I’ll leave the exact syntax up to you. But this is pretty much what we’re attempting to achieve via negative ds declarations.

Solution: abandon the recent versions of rgbds and fork the old, sane version