Inspired by the other threads on using WDC's compiler, I started writing a Tetris implementation for my system in C.
It has modern "SRS" rotations, holds, and hard drops along with two-player versus mode.
The drawing code relies on my custom blitter circuit, but I've separated out the game logic from the drawing logic so that someone who wanted to fork it for another platform hopefully wouldn't have too much trouble. It could still stand some optimization, but runs decently well on both the emulator and the physical prototype.
Tetris repo:
https://github.com/clydeshaffer/GameTankTetrisGameTank emulator:
https://github.com/clydeshaffer/GameTankEmulatorOther notes...
In the process of getting the code generated by WDC02CC to work, I ended up adding a bunch more W65C02S opcodes to my fork of Gianluca Ghettini's emulation library. In particular, a target system will need to support the "zero page indirect" addressing mode to run binaries from this compiler.
The makefile should work on both Windows and Linux. Though I did have to modify zpage.inc and wdc02cc.cfg in the WDCTools dir to remove the "134" clauses. On Windows I run the makefile in git bash, which is why dd is an available command.
Ideally I should link to zlib6502 as a submodule and trigger its build in the makefile, but for now I'm a bit lazy and grabbed the binary I compiled a while ago and use for multiple projects. It's in the lib folder and labeled with its expected memory locations in the filename. Fortunately it turned out to not be overly difficult to "manually" link it. The file assets.asm defines a section with an absolute offset and imports the binary, as well as reserving the RAM locations it needs. This is enough to convince WDCLN to put it in the right place.
Later I'm planning to try building the C code with other emulators, and find out where the WDC02CC output rates against the likes of vbcc and cc65. For reference, here's the output of the linker as of the latest commit:
Code:
Section: ORG: ROM ORG: SIZE:
PAGE0 000020 ------ D4H ( 212)
CODE 008000 008000 285AH ( 10330)
KDATA 00A85A 00A85A AC9H ( 2761)
DATA 000500 00B323 13EH ( 318)
UDATA 00063E ------ 22BH ( 555)
inflated 000200 000200 2FDH ( 765)
inflate 00E000 00E000 1FCH ( 508)
startup 00FE00 00FE00 164H ( 356)
vectors 00FFFA 00FFFA 6H ( 6)
Total 3DC3H ( 15811)