I've been trying to get a simple application to compile using WDC's 6502 compiler and have come to the conclusion that its currently impossible with the free version of the tools (WDC Tools 2.1).
The issues are:
1. The compiler crashes if you use a conditional expression e.g. (this == that) ? 7 : 11. You can rewrite code to avoid these.
2. A configuration file used to define the page zero locations used by the runtime routines looks like it should support some conditional selection based on processor type (65C02/65C134) but it doesn't. You have to comment out the addresses for processor you aren't using.
3. WDC should have provided a template startup assembler module that kicks off the main function (commonly called crt0.o in UNIX). You have to hand craft one but this needs some knowledge not in the C or assembler manual.
4. The C library provided seems to contains internal runtime support routines compiled for the 65C02 but standard C library functions compiled for the 65C134. They expect the runtime variables on page zero to be in different places.
Sadly there is no work around for this last one. The free compiler doesn't come with source so you can't rebuild the libraries and runtime to match.
There is also a bug in the assembler (3.49.1) which stops expression evaluation when it hits a space, Like this:
Code:
106 00:0012: 85 58 sta CNT + 1
107 00:0014: 05 58 ora CNT + 0
No spaces and it gets it right.
Code:
106 00:0012: 85 59 sta CNT+1
107 00:0014: 05 58 ora CNT+0
I'm working with WDC to try and get things going again.