[stella] The newbie DASM #constant problem

Subject: [stella] The newbie DASM #constant problem
From: Erik Mooney <erik@xxxxxxxxxx>
Date: Sat, 10 Apr 2004 00:05:34 -0400
We had a discussion a couple weeks ago about whether the assembler could
possibly notice and warn about the most common syntax error made by new
(and experienced) 2600 programmers - writing LDA 5 when you mean LDA #5.
As I was coding for the 2600 today, the solution hit me: have DASM throw a
warning for any read from a zeropage location between 0 and $7F that uses
a number rather than a constant reference.  In common coding practice, we
never refer to any of the TIA registers numerically - we always use the
constant names like CXM1FB.

LDA 5		;warning, almost certainly a mistake!
LDA #5		;good - never warn if the # is used
LDA CXM1FB	;good - a constant name is used
LDA $85		;don't warn - RAM access, which is often done numerically

Of course, there's the usual debate over whether something like this
should go into an ostensibly general-purpose assembler, but I think it's
worthwhile implementing as an option.  I might even have a go myself once
DASM moves to open source.

Anyone have any opinions?

Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Current Thread