Hi all, it's been a while, and we've been busy!
Project Update: Happy New Year EditionCode GenerationAddressing ModesIt took forever and a day, but we've finally got the instruction selector issuing all addressing modes for all supported instructions, with the notable exception of indexed indirect (i.e., LDA (zp,X)). Practically, this means you can write C code with addressing modes in mind, and the compiler may be able to figure out what you meant. For example:
Code:
extern char x;
void foo(void) { x *= 2; }
Code:
foo:
asl x
rts
Previously, the compiler would have emitted:
Code:
foo:
lda x
asl
sta x
rts
ASCII Address directiveThe C64 BASIC stub used by the compiler requires specifying the start address of the program in ASCII, as part of a BASIC "SYS" command. To make this more general, an assembler directive was added so that the linker can do this automatically.
Code:
.mos_addr_asciz _start, 5
Once the linker figures out the precise address where the directive's operand will be placed, it replaces the directive with the given number of digits in ASCII containing that address.
SDKQuite a bit of stuff has been added to the SDK for the benefit of C++ runtime support:
- A rudimentary malloc/free implementation.
- An implementation of the C++ new and delete operators using the above.
- GNU attribute((constuctor)) and attribute((destructor)) support to run code before and after main.
- An implementation of C++ static class constructors and destructors using the above.
- An implementation of C++ "magic static" variables (That is, ensuring that static function local class instances have their constructors called exactly once, the first time the definition is entered.)
Note: As a surprising number of people besides me are now submitting patches against the project, these updates are considerably less comprehensive than they used to be; I'm hoping to turn this into more of a highlights than an LLVM Weekly-style laundry list. Also note that I only did a third of the things on here; I won't say which third
There's also quite a few smaller changes and fixes that I didn't mention; this appears to be dangerously close to turning into one of those "open source community" things I've heard about.