SNES APU Programming

Gabries

SNES Gamer
Thanks in advance for any help given.

I have been trying to find a group or forum dedicated to emulation in the hopes that someone would have some idea about the SNES Audio Processing Unit. I know this question is technical in nature, which is why I am placing it in this section of the forum (I guess it could be moved if necessary). Also, if someone can suggest a better place to place such a question, I would welcome said suggestion.

Here's my dilemma:
Not too long ago I became interested in programming my own SNES music player. I knew that the emulation itself would be too difficult for a hobbyist like me, so after doing some research I ended up using Anti Resonance's SNESAPU emulator. In www.alpha-ii.com (Anti Resonance's web page) I found the source code for the SNESAPU project in x86 assembly (written in NASM). Although primarily to be used in a dll for Windows, I work in a Linux environment and was able to create the object files from the source code and link them and make a simple emulator capable of playing spc files. The thing is that this emulator was too basic. I decided to start tweaking pitch and fading, as well as sampling hertz using functions Anti Resonance defined in his headers.

Here things got interesting. If I used this one function, setAPUOpts, the emulator had a tendency to throw a segmentation fault once in a while. I dug through the assembly language and determined that a second function was being called, this being setDSPOpts. If I called this function through C++, the program demonstrated the same symptoms: It Seg faulted frequently (but not always. Very random, although some songs were rather predictable).
I came to this conclusion: setDSPOpts had some assembly error (although it was called once in assembly in order to initialize the emu, and it works...).

I know this is long. I have two questions:

1. Can anyone shed some light into the situation? Anyone willing to help me comment the assembly language code (I know very little)?

2. If not, does anyone know how to contact Anti Resonance himself? I've searched and searched for some information on him, and failed miserably.

Again, I know this is very technical in nature, but I hope that someone can help me. Merci beaucoup.
 

Zach

New member
I doubt anyone on the forum can help you with your questions..

That being said, I never heard of the emulation core your using.. Have you tried looking at open source emulators and SPC players, to see how they are built or whose core they are using ?

Might be a better approach, especially if you want to teach yourself anything. Studying other peoples' code is the number one way to learn
 
Top