Open mid-kid opened 4 years ago
* [ ] `ds $0150 - $0104` can become `ds $0150 - @` in home/header.asm
Well, considering hacks could choose to put anything there but 0 should be the default value for the header (as RGBFIX just patches over instead of overwriting the whole region), that'd be one of the places where ds $150 - @, 0
would make sense.
2-arg ds
added in rednex/rgbds@4cc24f436947890f41a3e16392a3c7ec7e8949ba.
User-defined functions are under development, which will allow replacing the coord macros:
def coord(x, y) = coord(x, y, wTilemap)
def coord(x, y, origin) = y * SCREEN_WIDTH + x + origin
def bgcoord(x, y) = bgcoord(x, y, vBGMap0)
def bgcoord(x, y, origin) = y * BG_MAP_WIDTH + x + origin
Old:
hlcoord 1, 2
debgcoord 3, 4, wAttrmap
dwcoord 5, 6
ldcoord_a 7, 8
lda_coord 9, 10
New:
ld hl, coord(1, 2)
ld de, bgcoord(3, 4, wAttrmap)
dw coord(5, 6)
ld [coord(7, 8)], a
ld a, [coord(9, 10)]
If a ternary operator is added later, then maskbits n
can become ld a, bitmask(n)
:
def bitmask(n) = n > 0 ? bitmask(n, 1) : 0
def bitmask(n, x) = n <= x+1 ? x : bitmask(n, x*2+1)
Features I think we should avoid (generally because they make it harder to process .asm files via regular expressions, as with optimize.py):
* New `MACRO name` and `DEF name EQU value` syntax (the old syntaxes are more familiar and not deprecated)
Be careful, as the changelog states:
The old syntax will still be supported for a couple versions, but may eventually be phased out.
(Emphasis added.) The syntax change is to get rid of the newbie trap that is "column 1", and it hasn't been deprecated as a courtesy due to the wide usage; but you're still strongly advised to prepare for an eventual deprecation.
def rgb555(r, g, b) = (r << 0) | (g << 5) | (b << 10)
RGB: MACRO
rept _NARG / 3
assert_valid_rgb \1, \2, \3
dw rgb555(\1, \2, \3)
shift 3
endr
ENDM
BASE_TMHM rb (NUM_TM_HM_TUTOR + 7) / 8
for n, (NUM_TM_HM_TUTOR + 7) / 8
ds ((\1) + 7) / 8
def nb_flags(n) := (n + 7) / 8
BASE_TMHM rb nb_flags(NUM_TM_HM_TUTOR)
for n, nb_flags(NUM_TM_HM_TUTOR)
ds nb_flags(\1)
This issue I presume is meant to be a tracker for RGBDS updates and the syntax that goes along with them for pokecrystal adoption
This issue thread will keep track of different optimizations and improvements we can make when newer versions of rgbds are released.
These will be in some RGBDS >0.7.0:
&&
/||
instead of some nestedif
sFeatures I think we should avoid (generally because they make it harder to process .asm files via regular expressions, as with optimize.py):
/* block comments */
::
to separate multiple instructions on one line