Description
These would be useful as opt-in link-time warnings:
-
For every
ld
, check for and suggest usingldh
instead if possible.(This would be an improved substitute for the removed feature of
rgbasm -L
, which optimized known-constantld
toldh
.) -
For every
jp
, check for and suggest usingjr
instead if possible. -
For every control flow instruction (
call
,jp
,jr
,rst
) targeting a label in ROMX, do a lint equivalent ofassert BANK(@) == 0 || BANK(<target>) == 0 || BANK(@) == BANK(<target>)
.(
rst
always targets ROM0, but if we add support for swappable ROM0, possibly via HDFs ([Feature request/proposal] Hardware layout description files (custom mapper support) #524), then this would be multi-banked.)Do this only if PC is in a ROMX section, which also excludes
LOAD
. (In theory,BANK(@) != 0
for ROMX, but-t
maps ROMX to ROM0. The destination is then guaranteed to be in ROM0 as well, but that may not remain the case if we add some similar feature to HDFs, so a cheap stringent check forBANK(@) == 0
is good for future-proofing.)(Possibly make this a multi-level lint, where by default cross-SECTION jumps are not checked?)