Back in January when CaptainCulry start a post about creating an SL appliance (
http://forum.6502.org/viewtopic.php?f=12&t=5898) I tried porting the sl utility using the WDC 6502 C compiler and found that it mysteriously crashed mid-module so I gave up and ported part of it manually to assembler.
I found some time today to try and figure out why the compiler is crashing. I added comment blocks to the code until the (nearly) empty files where compilable (but did nothing) then removed the comments one at a time until the compiler crashed and examined the last section to see what might have triggered it.
It turns out the tenary (or conditional) operator (e.g. (a == 9) ? x : y) is the source of the bug. When I replaced these with equivalent code using if/then/else and added some support code for UNIX functions not in the WDC library, I managed to get it all compiled and linked.
At the moment its over 32K linked with over 16K of data. I may have to take one of the trains out to make it run in less memory. There are too many strings.
Code:
wdcln -G -HZ -G -T -C0300 -Osl.bin sl.obj curses.obj unix.obj -Lc
WDC 65C816 Linker Version 3.49.1 Apr 24 2006 15:40:38
Copyright (C) 1992-2006 The Western Design Center, Inc.
Section: ORG: ROM ORG: SIZE:
PAGE0 000020 ------ 4EH ( 78)
CODE 000300 000300 2B42H ( 11074)
DATA 002E42 002E42 41DEH ( 16862)
UDATA 007020 ------ 1F4AH ( 8010)
Total
The SL application uses the UNIX ncurses library and I have started coding a simple implementation. I will keep working at it so it can serve as a demonstration of the WDC 6502 C compiler.
I'll try to get a video of it running on one of my three chip boards at a measley ~1MHz when its complete.