Sweeter 16 for the 65C02 up on GitHub ... NMOS version coming

BruceMcF

Active Member
May 19, 2019
205
63
28
I am trying to implement a new VM for Steve Wozniak's venerable Sweet16. This is primarily targeted at David Murray's CX16 project, but my development approach is to use the Vice emulator of a C64 with a SuperCPU to get the 65C02 execution along with VICE's excellent Monitor.

It's already somewhat working, with binaries assembled to the top 1K of Golden RAM ($CC00) available at the Github site (and zip file attached). However, once it's fully debugged, I'll be making an NMOS 6502 version which will hopefully still be appreciably faster than the original. ... I have to aim at running faster, because Steve's code is a marvel of codespace optimized spaghetti code.

This is still v0.0.x, so while I have found the bugs for the three routines I wrote for debugging, I haven't exercised all instructions yet. I need unit tests for all 31 operations before I am going to advance it to v1.0.0 and turn to the NMOS6502 version. Feel free to make pull requests for expanding the Sweet16 test code at the Github repository.

Note that by necessity it will have to trample C64 Basic space, so the NMOS version is going to target pseudo-registers at $02-$21 like the original, with four bytes to store the original register values (restored on return to 6502 code) at $22-$25 and a jump vector at $25/$26.

Also note that there are three additional operations in this version: ADJ0 and ADJS to add the signed extended byte operand to the accumulator and stack pointer, and CALL to call a machine language routine with its call vector in Register 11.
 

Attachments

BruceMcF

Active Member
May 19, 2019
205
63
28
NMOS 6502 version that passes my (fairly rudimentary) tests now up on the development branch. It is loaded into Golden RAM at $CC00, occupies $CC00-$CDF0. The binary assembles the text code right after it, but feel free to comment out the text code load and just make a binary that fits into $CC00-$CDF0, leaving $CE00-$CFFF available for Sweet16 code ... or to assemble it to any other page boundary that you see fit.

The only limitation is that it needs to be assembled within the first 7 bytes of a page, or else not all of the indirect jumps will work.

You are looking for Sweet64.asm and Sweet64.bin at https://github.com/BruceMcF/Sweeter16/tree/development ... also sweet16vm_code.asm if you want to include the test code, and the readme.md if you want a description of the Sweet16 system and my 3 extension operations.