[Coco] Assembler directives
William Astle
lost at l-w.ca
Thu Mar 21 10:38:50 EDT 2019
On 2019-03-21 7:07 a.m., Mark McDougall wrote:
> On 20/03/2019 10:21 pm, Phill Harvey-Smith wrote:
>
>> Is there a more succinct way of expressing this so that multiple
>> conditions can be combined.
>
> Thinking outside the box, as part of the build you could pass it through
> the GNU C preprocessor... I've actually considered doing it in the past
> for other assemblers.
That actually works pretty well for the most part with lwasm at least.
It works best if you also give it --pragma=newsource, though.
One of the problems with running source through the C preprocessor is
that it leaves behind lines starting with a # that need to be ignored
(or parsed, potentially). lwasm will treat lines starting with # as
comments for this reason.
For folks not in the know, lwasm has a mode where operands can contain
spaces. However, that comes at the expense of line terminal comments
requiring a ";" to introduce them. This is required to eliminate parsing
ambiguity. This mode is useful when using the C preprocessor because
macro substitution can lead to spaces appearing in the result where
there were none in the original. If you're just using the preprocessor
for conditional assembly and file inclusion, though, that isn't a major
concern.
More information about the Coco
mailing list