SPC700

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
mog123
Hazed
Posts: 62
Joined: Sat Apr 01, 2006 11:33 pm

SPC700

Post by mog123 »

I've got a simple question: Does it communicate with the cpu, or just gets music data from it, decryps it and send the sound wave to audio out?
From my observation on the pinout, it's the latter.
My general dev blog:
http://mog123x.blogspot.com
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

And looking at a chip pinout for a couple minutes totally makes you an expert. ¬_¬
Guess again.

Getting 'music data' (which isn't differentiable from any other data) is done exactly like the rest, through the 8 mapped one-way two-in-one regs.
The spc700 is a whole cpu, so you can make it loop forever waiting for an exact byte sequence from those lines. Or whatever you want to make it do, read the spc700 opcode list (and all the other docs while you're at it, gee).

The spc doesn't do any "decrypting". It's a cpu, it does what its program tells it to. That can range from feeding data to its dsp to software mixing to sending back data to the scpu for whatever possible purpose.

Monitor scpu-sapu communication in games like Lost Vikings or smth to see an example.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
mog123
Hazed
Posts: 62
Joined: Sat Apr 01, 2006 11:33 pm

Post by mog123 »

grinvader wrote:And looking at a chip pinout for a couple minutes totally makes you an expert. ¬_¬
I didn't say anything like that, sorry if you got that impression.

Ok, I see now that I had it all wrong - I was talking about the APU as a whole (ram, dsp, scp700), that's a detachable part in old rev SNES units, like in the picture here:
http://www.alpha-ii.com/Info/Grafix/SPD ... Module.JPG
And it's interface port:
http://www.raphnet.net/electronique/sne ... erface.png
Looking at it, leads me to a conclusion that the snes_cpu sets the adress and sends the data to the snes_apu without getting any feedback from it. Am I right or wrong here? If wrong, then why?

Why do I want to know this? I'm trying to interface this to a GBA using shift registers and it's link port to play spc's out of the GBA.
My general dev blog:
http://mog123x.blogspot.com
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

Read the documents: link

Most games send a program to the APU and the data for the current song + sound effects. Most of these programs don't write anything back and don't expect any more data, which is why *.spc plugins (Winamp etc.) don't have to emulate a SNES, too.

The SPC700 has a DIV instruction while the 5A22 doesn't, so in theory you could use the SPC700 to calculate.
anomie wrote:

Code: Select all

2140 rwb++++ APUIO0 - APU I/O register 0
2141 rwb++++ APUIO1 - APU I/O register 1
2142 rwb++++ APUIO2 - APU I/O register 2
2143 rwb++++ APUIO3 - APU I/O register 3
        xxxxxxxx

        These registers are used in communication with the SPC700. Note that
        the value written here is not the value read back. Rather, the value
        written shows up in the SPC700's registers $F4-7, and the values
        written to those registers by the SPC700 are what you read here.

Code: Select all

$00F4 r- CPUI0 - CPU  input register 0
$00F4 -w CPUO0 - CPU output register 0
$00F5 r- CPUI1 - CPU  input register 1
$00F5 -w CPUO1 - CPU output register 1
$00F6 r- CPUI2 - CPU  input register 2
$00F6 -w CPUO2 - CPU output register 2
$00F7 r- CPUI3 - CPU  input register 3
$00F7 -w CPUO3 - CPU output register 3
        xxxxxxxx

        These registers are used in communication with the 5A22 S-CPU. There
        are eight total registers accessed by these four addresses: four
        write-only output ports to the S-CPU and four read-only input ports
        from the S-CPU. Writing a value to an output port doesn't affect the
        value in the corresponding input port; the SPC700 can modify the input
        ports only by clearing them using the CONTROL register.
        
        If the SPC700 writes to an output port while the S-CPU is reading it,
        the S-CPU will read the logical OR of the old and new values. The
        exact cycles during which the 'read' actually occurs is not known,
        although a good guess would be some portion of the final 3 master
        cycles of the 6-cycle S-CPU memory access. Possibly the same thing
        happens the other way around, but the details are unknown.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

creaothceann wrote: Most games send a program to the APU and the data for the current song + sound effects. Most of these programs don't write anything back and don't expect any more data, which is why *.spc plugins (Winamp etc.) don't have to emulate a SNES, too.
Well to clarify, the APU sends something back in many instances because you really can't transfer anything to and from it without acknowledgment. IPL Boot ROM case in point. After that it varies on the game's protocol, but certainly the APU and CPU communicate BOTH ways in many instances for many games. I would certainly agree though that this is primarily limited on song and/or sound effect loads. Most games don't do much communicating after that other than the notable exceptions where streaming sound is used.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
Post Reply