Re: [WP34s] Assembler question Message #5 Posted by Neil Hamilton (Ottawa) on 14 May 2012, 9:45 a.m., in response to message #1 by fhub
Franz,
As you have seen, the assembler recently acquired the ability to use aliases in addition to the original mnemonics. These aliases are easier to use and (usually) more intuitive -- and the tools suite will take them all, old and new (even mixed in the same source!). [There are some examples of them being used in the SVN library directory. They files have names like "8queens_alias.wp34s".]
In order to allow the tool suite to not require continuous maintenance, it was designed to be table-driven from the "wp34s.op" file generated by the C build environment. Because of this, the assembler had little latitude in where a space was placed or not based on the original generation of this table. If there was a space in the table, you needed a space in your code.
Your 1st 2 examples are from the original mnemonic set and the format has always been exactly as you see here -- no change.
I think the newer aliases always use a space to make it more consistent (though I may be wrong).
The next 2 examples are new aliases for indirection. It was decided that the space here made more intuitive sense, especially when coupled with register arithmetic. For example "STO- ->00" would look truly strange as "STO-->00".
Given that the indirection syntax can use any of the following choices:
STO- ->00
STO- >00
STO- =>00
STO- @00
there would be confusion for "STO->00" if the space was not required.
For the alpha, it is almost always better to use the preprocessor to generate these. The preprocessor will handle your "No single space possible within a string?" example with ease:
"put as many spaces as you like!"
These will be converted to "[space]" within the tool and parsed into as many triple or single alpha op-codes as required. (See documentation for more details.)
We cannot (currently) use an undelimited space in the non-preprocessor source because the whitespace is used as delimiters in the "wp34s.op" file and an undelimited space just looks like a token separator to the assembler's "wp34s.op" parser.
As an example of the preprocessor in action, the output for the "put as many..." string is as follows (output edited for clarity):
$ echo "put as many spaces as you like!" > alpha.wp34s
$ wp34s_asm.pl -pp alpha.wp34s -o blah
$ cat wp34s_pp.lst
0001 /* */ [alpha]'put' // "put as many spaces as you like!"
0002 /* */ [alpha]'[space]as'
0003 /* */ [alpha]'[space]ma'
0004 /* */ [alpha]'ny[space]'
0005 /* */ [alpha]'spa'
0006 /* */ [alpha]'ces'
0007 /* */ [alpha]'[space]as'
0008 /* */ [alpha]'[space]yo'
0009 /* */ [alpha]'u[space]l'
0010 /* */ [alpha]'ike'
0011 /* */ [alpha] !
0012 /* */ END
If you want to see what is legal for an op-code, you can run the following command to generate a (BIG!) table of what is valid:
$ wp34s_asm.pl -syntax syntax.tbl
The output will be in the file "syntax.tbl". It may still have some inconsistencies with regard to the [alpha] stuff but it is getting better.
BTW: I don't detect any noticeable slow-down in the tool chain due to the aliases. It could be that this is due to the speed of your relatively ancient Win-98 machine. :-)
|