Finally ready to post what I've got. First, SPC-700 assembly using ca65:
spc-ca65-0.1.0.zip
Then, 65C02 syntax for SPC-700:
spc65-0.1.0.zip
And, a buildable source code example using it that plays a chord using the SPC-700:
spc-chord.zip
These use cc65-2.13.3, the last stable release I could find. Both include scripts to run full instruction tests. There are lots of notes with them, so I'm just summarizing the points worth discussing. The SPC-700 macros include an option to use ca65-style addressing, where it defaults to absolute rather than direct-page (< gives direct-page). ! can also be used. The one addressing mode I couldn't get to work as specified is memory.bit, where bit must be in parenthesis if it uses a named constant, as ca65 thinks it's a . directive otherwise:
Code: Select all
mov1 c, $1412.7 ; OK
bitnum = 6
mov1 c, $1412.bitnum ; error
mov1 c, $1412.(bitnum) ; OK: workaround
I hope I got the syntax right for these addressing modes:
Code: Select all
CALL !abs ; ! really required even though it only supports abs?
TCALL $x ; 0-15
PCALL $xx ; 0-$FF, calls $FF00 + $xx
MOV1 C, mem.bit
AND1 C, /mem.bit ; the slash for AND with complement of memory bit?
The 65C02 macros coexist with the SPC-700 instruction syntax, for easy use of both styles of code in the same progam, as when including SPC-700 libraries and using 65C02 syntax in your code:
Code: Select all
and ($12),y ; OK
and a, [$12]+y ; OK
I consider automatic use of direct-page addressing an optimization issue, since you can use < where it's critical, thus haven't looked at the patched ca65 yet.
PLA, PLX, and PLY don't set status flags. Perhaps we should have these do a compare or inc/dec (to avoid modifying carry) afterwards?
It's quite novel to be able to code 65xx assembly for the SPC-700. Even things like stack access work:
Code: Select all
lda #$12
tsx
pha
lda $100,x ; A=$12
Thanks again tepples for paving the way for this! I'm eager to do GB-Z80 in the near future.
EDIT: added spc-chord code example I forgot to link when I posted.
Edit: how about sp65c02? Heh