It is currently Tue Sep 18, 2018 7:56 pm

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Sat Jun 09, 2018 9:06 am 
Offline

Joined: Fri Jun 08, 2018 8:30 pm
Posts: 4
Hi all , I'm newbe & sorry for my poor english

I want make a jukebox & midi receiver open source project , use SPC700 hardware(from old SNES) + Arduino + microSD + LCD screen + Bluetooth(midi receiver)

the jukebox part is look like this
https://github.com/Moonspine/snes-jukebox
or CaitSith2 version
https://github.com/emukidid/SNES_APU_SD
it can play .spc file successful

but I went it look more powerful , like this
https://www.youtube.com/watch?v=lDPdOzByoWQ
https://www.youtube.com/watch?v=Qbzk2BV-eNY

so my first question , can I get any SPC700 status / info ? like the video has 8 channel volume level and more info , but I know the video is rebuild by FPGA to emu SPC700 , so I went to know what I can get from SPC700 hardware

my second question , how to play a voice or sound ? I mean when I play .spc file , I'll get background music , but how to play like "jump" / "1up" sound at same time like Mario game play ? SPC700 has large memory & .spc file is memory snapshot right? , so the game voice / sound is in the memory ? or write to memory immediately and play it ? and how to trigger it ? because I went receive midi signal , decode the note and play from SPC700 like this

https://www.youtube.com/watch?v=VUeGDyRgK0c
https://twitter.com/matsu_k3/status/739108588455497728

it look like can be change note pitch from game voice or sound , and use wave sample from any game , but ... 2 project are not open source & I want to build it (best easy way is load .spc file & I can use the wave sample , play any pitch of note I want from the midi signal) , so anyone has any idea?


Top
 Profile  
 
PostPosted: Sat Jun 09, 2018 10:38 am 
Offline
User avatar

Joined: Mon Jan 23, 2006 7:47 am
Posts: 132
JokerCatz wrote:
can I get any SPC700 status / info? like the video has 8 channel volume level and more info, but I know the video is rebuild by FPGA to emu SPC700, so I went to know what I can get from SPC700 hardware
JokerCatz wrote:
how to play a voice or sound?


Games load their own small programs (and the relevant samples) into the audio module. Such a program plays its song and listens on the input registers for commands to play sound effects or to load the next song. This is all game-specific, although some games may use the same programs and commands because they're from the same company or because the companies used the same audio library.

The audio hardware only outputs audio, no status info. You may get that by creating your own SPC700 program that returns that info upon request.


Top
 Profile  
 
PostPosted: Sat Jun 09, 2018 11:38 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7519
Location: Seattle
JokerCatz wrote:
so my first question , can I get any SPC700 status / info ? like the video has 8 channel volume level and more info , but I know the video is rebuild by FPGA to emu SPC700 , so I went to know what I can get from SPC700 hardware
As creaothceann said: no, the SPC700 has its own CPU and it basically won't tell you anything.

Quote:
my second question , how to play a voice or sound ? I mean when I play .spc file , I'll get background music , but how to play like "jump" / "1up" sound at same time like Mario game play ? SPC700 has large memory & .spc file is memory snapshot right? , so the game voice / sound is in the memory ? or write to memory immediately and play it ? and how to trigger it ? because I went receive midi signal , decode the note and play from SPC700 like this [...] it look like can be change note pitch from game voice or sound , and use wave sample from any game , but ... 2 project are not open source & I want to build it (best easy way is load .spc file & I can use the wave sample , play any pitch of note I want from the midi signal) , so anyone has any idea?
The SPC700 module provides four 8-bit ports for the CPU inside to communicate with the outside world; every behavior has to be done using that. Every game uploads its own special program into the SPC700's CPU; any given program will do something different.

(For example, Super Mario World and Super Metroid both treat writes to different ports as "change track" and "play sound effect". Other games may use different ports, or an entirely different abstraction. The "undumped" SNES soundtracks generally put something resembling a "dumb" hardware synth in the SPC700 and the SNES's CPU triggers notes.)

Additionally, the SPC700 is limited to a total of 64 KiB of RAM for all the compressed samples, all code, and, if desired, an uncompressed echo buffer. While the SNES's CPU can change what samples are present (assuming the SPC700's CPU cooperates), you're still limited to 64 KiB at any given time: you're not going to get to play arbitrary samples from arbitrary games simultaneously.


Top
 Profile  
 
PostPosted: Sat Jun 09, 2018 2:01 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20556
Location: NE Indiana, USA (NTSC)
But if you know how to program a 6502, you can write your own driver that runs on the SPC700 and communicates with the rest of your system. The SPC700 doesn't run 6502 machine code per se, but its instruction set is about 98% source compatible with 6502 assembly.


Top
 Profile  
 
PostPosted: Sat Jun 09, 2018 4:12 pm 
Offline
User avatar

Joined: Mon Jan 23, 2006 7:47 am
Posts: 132
Btw. ToP probably communicates with the APU as described above.


lidnariq wrote:
Additionally, the SPC700 is limited to a total of 64 KiB of RAM for all the compressed samples, all code, and, if desired, an uncompressed echo buffer. While the SNES's CPU can change what samples are present (assuming the SPC700's CPU cooperates), you're still limited to 64 KiB at any given time: you're not going to get to play arbitrary samples from arbitrary games simultaneously.

Well, you can stream samples to the APU while the song is played. Not really beginner level though.


Top
 Profile  
 
PostPosted: Sat Jun 09, 2018 6:41 pm 
Offline

Joined: Wed Jul 09, 2008 8:46 pm
Posts: 254
I know of a method done by a few games for its music by swapping out unused samples for other samples depending on where in the music it is.

- Lion King did sample swapping for Be Prepared, Can't Wait, Hoo Hah, King of Pride Rock and Under the Stars.

- Captain Tsubasa 5 did sample swapping during its opening to swap out a musical sample and a SFX sample.

- Down the World's opening vocal song used sample swapping. Tales of Phantasia, on the other hand, streamed its vocals during the opening, if memory serves me correctly.


Top
 Profile  
 
PostPosted: Sat Jun 09, 2018 10:15 pm 
Offline

Joined: Fri Jun 08, 2018 8:30 pm
Posts: 4
Hi all , thanx reply fast , I'm a programmer normally use ruby / java and go lang , & I know midi spec / Arduino or something , but I hasn't assembly language experience , I know this may be very difficulty to finish this project , but I want to try :)

if I lean 6502 and write my own code ( scanner ) , and I change .spc file CPU code part , is has any possible to scan memory to get track / samples or manually input header address / length to try what is playable , and dump it , replay from my own code ( player ) ?

& I don't know what is compressed mean , it has any fixed header or something to help me to scan and get the header ( or like address list ) ? if I want to scan the memory and dump it & maybe I just need scan and test .spc file right ? it has all memory datas include CPU status , so I don't need 6502 code to memory scan ?

and has any example with 6502 for SPC700 ? is any possible decompile the CPU code part to 6502 like from .spc file ? it will be help me to write a program to emu .spc file status and get all data what I need ...


Top
 Profile  
 
PostPosted: Sun Jun 10, 2018 12:11 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7519
Location: Seattle
JokerCatz wrote:
[if]I change .spc file CPU code part , is has any possible to scan memory to get track / samples or manually input header address / length to try what is playable , and dump it , replay from my own code ( player ) ?
Yes, SPC sample rippers are a known thing.

Extracting the "track" is going to be much harder: every replay engine will use its own convention for how to store these sequences. I wouldn't count on a generic solution existing.

Quote:
I don't know what is compressed mean
The SPC700 is only capable of playing a specific ยต-law-like compressed format. Nocash has a brief description here.

Quote:
so I don't need 6502 code to memory scan ?
To the best of my knowledge, no, you don't. People have written BRR sample rippers that can just scan SNES ROM images and grab likely candidates out; I don't know how.

Quote:
is any possible decompile the CPU code part to 6502 like from .spc file ?
I'm certain such a disassembler has to exist, but I don't know of one.


Top
 Profile  
 
PostPosted: Sun Jun 10, 2018 1:46 am 
Offline
User avatar

Joined: Mon Jan 23, 2006 7:47 am
Posts: 132
SPC file format
SPC700 execution starts at the address pointed to by PC. A, X and Y are the main CPU registers. PSW is the status register ("Program Status Word"). SP is the stack pointer (a 16-bit address, and the upper 8 bits are probably hardcoded to $01).

Since the SPC700 seems to be very similar to the 6502, it'd make sense to read up on that CPU...
- http://6502.org/tutorials/
- https://youtu.be/fWqBmmPQP40?t=34
- SNES hardware info


Top
 Profile  
 
PostPosted: Sun Jun 10, 2018 1:56 am 
Offline

Joined: Fri Jun 08, 2018 8:30 pm
Posts: 4
hmm ... so , look like this project easiest way is ... split to two part

first part is .spc file player , like Arduino .spc file player at frist post , because they has own CPU code and no spec , too difficult to control ...

second part is custom CPU code , use BRR samples and input notes from 8 pin (D0 ~ D7 pin? , midi channels => BRR samples) , and this part look like can be done with emulator first ...


and another question , the SNES game PCB pins is direct to SPC700 ? or need to use DMA or something ? and when SNES boot and connect game PCB , it need return bootstrap code ? because new model of SNES the SPC700 module is onboard , so it need control from game PCB card ...


Top
 Profile  
 
PostPosted: Sun Jun 10, 2018 6:49 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20556
Location: NE Indiana, USA (NTSC)
Inside the Super NES Control Deck, the data lines D0-D7 are connected to the data bus, and the address lines A0-A1 are connected to the memory controller's "B bus" (I/O address bus). This means that when the CPU writes to addresses in the range $2140-$2143, the SPC700 is selected, and the value in one of the SPC700's four input registers ($00F4-$00F7) is changed. Audio driver code is supposed to listen for requests by reading these input registers and then write back a status value once the driver has finished processing the request.

See also APU specs in Fullsnes.


Top
 Profile  
 
PostPosted: Sun Jun 10, 2018 2:59 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 961
JokerCatz wrote:
the SNES game PCB pins is direct to SPC700 ?

No. The only way for the audio module to see anything outside itself is the set of four I/O ports tepples is describing. It has no cartridge access.

Quote:
or need to use DMA or something ?

No. The SPC700 has to manually check the I/O ports for data, and it's far too slow to keep up with DMA. You can use HDMA if you know what you're doing, but it requires timed code and careful synchronization, and as far as I know it's only ever been used in one homebrew game (N-Warp Daisakusen); mostly games just have the main CPU transfer data manually.

Quote:
and when SNES boot and connect game PCB , it need return bootstrap code ?

The main CPU starts execution in ROM, at a location specified by the RESET vector (also in ROM).

The SPC700 starts execution in an IPL ROM built into the sound module. This 64-byte boot ROM specifies an initial communication protocol on the SPC700 side, and the main CPU must be programmed to transfer at least the initial bits of game-specific code/data through the four audio I/O ports using this protocol. If you want to use a different communication protocol, you have to first upload the SPC700 code for it using the IPL ROM protocol.

Quote:
because new model of SNES the SPC700 module is onboard , so it need control from game PCB card ...

No. It works exactly the same in all models. No cartridge access, no DMA.


Top
 Profile  
 
PostPosted: Sun Jun 10, 2018 4:45 pm 
Offline

Joined: Fri Jun 08, 2018 8:30 pm
Posts: 4
okay ...

the APU specs in Fullsnes look like very useful , and I think I need emu SPC700 first , then try SPC700 hardware , and try to transfer data to SPC700 by main CPU ( maybe try to dev SNES game or do some examples :D )

but I can only dev at weekend or holiday , so will be slowly , and I'll goto Japan ( I live in Taiwan ) buy some old SNES machines at the end of next month , it very cheap at Japan market ... around $13 USD one full functional SNES (NTSC) + games :)


Top
 Profile  
 
PostPosted: Sun Jun 10, 2018 6:06 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3589
Location: Mountain View, CA
I would suggest, when you get to that point, looking at viewtopic.php?f=12&t=17112, which is a thread that contains some code (including official Nintendo documentation) for transferring data from the main 65816 to SPC700.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google Adsense [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group