[Coco] mamou syntax question.

William Astle lost at l-w.ca
Sat Jul 2 03:17:45 EDT 2011


On 11-07-01 11:26 PM, Aaron Wolfe wrote:
> There is also another powerful open source, cross platform assembler available:
>
> http://lost.l-w.ca/coco/lwtools/

Thanks for the plug.

For the record, lwasm (the assembler in lwtools) also ends expressions 
(most operands) at whitespace.

The reason for this is that standard 6809 assembly source is *defined* 
to end the operand at a space (or tab). The source is supposed to 
contain four columns separated by white space (an optional symbol, which 
must be at the start of the line, the opcode which must not be at the 
start of the line, the operand, and an optional comment which must be 
separated from the operand by whitespace.) Things are further 
complicated by the fact that "*" introduces comments yet is also the 
symbol for multiplication, and even doubles as the address of the 
current instruction.

The situation is further complicated by many existing assemblers already 
accepting that source structure leading to much extant source code which 
is also in that format, and most experienced programmers expecting that 
format.

Thus, to have even remote source compatibility with, say, EDTASM (as 
only one example--others have the same limitation), one must also 
disallow whitespace in expressions. Otherwise, with the wrong comment 
structure (especially comments starting with "*" or other symbol that 
also doubles as an operator), bizarre errors or unexpected assembly 
results will occur.

There are a lot of things that can be supported in addition to that 
basic line structure without breaking compatibility with old source 
code, but, alas, supporting spaces in operands is not one of them. (Such 
things as allowing for optional line numbers and at least one 
interesting variation on symbol declaration, for instance, are doable 
with minimal hassle.)

In order to allow spaces in expressions, it is necessary to change two 
things about source structure, both of which lead to source structure 
compatibility problems. The first is to disallow the use of "*" to 
introduce comments and use something else, say ";". The second is to 
require a comment character to introduce statement trailing comments.



More information about the Coco mailing list