Alternate SPC700 syntax

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Alternate SPC700 syntax

Post by Near »

Fantastic, someone used the alternate SPC700 syntax in actual code :D

Shiru: May I ask what your overall impression was of the idea? It's meant to mimic 65816 assembly syntax.

Also if you had any ideas for improvement, that'd be great too. I'll be using that syntax in future bsnes debugger builds.

(Note that I did change the +n syntax to ,n to further match the 65816 in my WIP builds. Apologies, I can make you a table if you'd prefer not to change your code and have it work with bass v05+.)
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

Alternate SPC700 syntax was really comfortable to use. I started with other SPC700 assemblers initially, and had problems figuring out opcodes betweed different docs and these assemblers. The alternate syntax was more 6502-like, except for that +n.

I can change +n to ,n in the source and update the archive when you release bass with this change, no problem.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Shiru wrote:The alternate syntax was more 6502-like
That does it: I might even make a Super NES project next. I had known for years that inside every SPC700 was a 6502 struggling to get out, and I was just waiting for someone to open the gate.
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Post by Near »

I can change +n to ,n in the source and update the archive when you release bass with this change, no problem.
Appreciate the flexibility :D

Here's the updated version:

Code: Select all

http://byuu.org/files/bass_v05.tar.bz2
Changes:
+n -> ,n
x,y -> x=y (to prevent ambiguity with ,n indexing and to clarify operator order)
addr.bit -> addr:bit
sti -> stc, str (c = carry, r = RAM)
ldi -> ldc, ldr
ori -> orc, orr
not -> cmc (complement carry)
cbn, dbn -> bne, bnz

bnz sucks, so I was thinking about maybe bne y-=target and bne $00-=target; to match the lda (x)+ style. Not sure yet.

If you have any suggestions, I'm open to change. The table file is in bass/arch/table/snes-smp.arch; so feel free to experiment if you like.

As such, I can't guarantee this instruction set is 100% finalized until I have some peer review. If you'd rather wait for it to be settled instead of aiming for a moving target, I completely understand.

EDIT: okay, made these changes.

bnz *08=*08 -> bne --*08=*08
bnz y=*08 -> bne --y=*08
lda (x)+ -> lda (x++)
sta (x)+ -> sta (x++)

Prefix/postfix matches the actual opcode behavior.
I had known for years that inside every SPC700 was a 6502 struggling to get out, and I was just waiting for someone to open the gate.
Indeed, the "official" instruction set for the SPC700 was just painfully bad. The architecture is very much like a 6502, right down to the addressing modes [eg (dp,x) and (dp),y ]. It just extends things and adds a few curve-balls that make a direct mapping difficult (multiple argument instructions, mostly.)

Stupidly, 6502 (and as a result, 65816) use addr,x instead of addr+x, which is a major problem for the SPC700's multiple arguments. I figure that it'd be an infinitely more difficult battle to get 6502/65816 users to start using lda $2000+x, so I had to change the multi-argument syntax for the SPC700 to =, eg and $08=#$20 ($08 &= #$20)

(Sorry for off-topic comment, let's split this thread [including the second-half of this comment] if discussion is to continue, please.)
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

I've updated spc700.asm in Crazy Christmas source code to bass v05.
Post Reply