3.3. Source Format

LWASM accepts plain text files in a relatively free form. It can handle lines terminated with CR, LF, CRLF, or LFCR which means it should be able to assemble files on any platform on which it compiles.

Each line may start with a symbol. If a symbol is present, there must not be any whitespace preceding it. It is legal for a line to contain nothing but a symbol.

The op code is separated from the symbol by whitespace. If there is no symbol, there must be at least one white space character preceding it. If applicable, the operand follows separated by whitespace. Following the opcode and operand is an optional comment.

It is important to note that operands cannot contain any whitespace except in the case of delimited strings. This is because the first whitespace character will be interpreted as the separator between the operand column and the comment. This behaviour is required for approximate source compatibility with other 6x09 assemblers.

A comment can also be introduced with a * or a ;. The comment character is optional for end of statement comments. However, if a symbol is the only thing present on the line other than the comment, the comment character is mandatory to prevent the assembler from interpreting the comment as an opcode.

For compatibility with the output generated by some C preprocessors, LWASM will also ignore lines that begin with a #. This should not be used as a general comment character, however.

The opcode is not treated case sensitively. Neither are register names in the operand fields. Symbols, however, are case sensitive.

As of version 2.6, LWASM supports files with line numbers. If line numbers are present, the line must start with a digit. The line number itself must consist only of digits. The line number must then be followed by either the end of the line or exactly one white space character. After that white space character, the lines are interpreted exactly as above.