KungFuFurby / snesgss

Part copy from the Google Code repository by Shiru ( https://code.google.com/archive/p/snesgss/ ), part fork of SNES Game Sound System by Shiru
Apache License 2.0
5 stars 1 forks source link

Hard coded spc driver #3

Open anaanook opened 2 years ago

anaanook commented 2 years ago

While I'm still trying to get this project to build, I've noticed that currently the SPC driver is just hard coded into spc700.h. this makes flexibility for modifying/recompiling the spc driver a pain. Would be great if at the very least it sourced an external spc bin.

Ideally it'd assemble it fresh from the proved asm file.

KungFuFurby commented 2 years ago

It's not as hard-coded as you think. The source code is stored in snesgss/snes/spc700.asm, however it needs to be compiled with a version of bass that supports the align command at the absolute least... which means v12r03 or earlier after looking up the history. Then the binary needs to be converted over to a .h file for use in the C++ program, which then has to be recompiled. The same situation applies with SNESMod, actually.

Technically dynamic compilation could be an option down the line...

anaanook commented 2 years ago

Ah, yeah I guess what I was referring to was the fact that in order to modify the spc700 drive rebuilding the application is required. A proposed middle ground to avoid dynamic compiling would be to just load a pre compiled bin from the application directory? This would save the step of having to convert the binary to c++ code, paste into header, and rebuild application.

I spent a bit of time messing with spc700.asm to get it compiling on the latest version of bass, some things needed to be modified for the current syntax with nested labels which was straightforward enough.

my ASM knowledge is quite poor however, and yeah, the align command, how involved would it be to just workaround it? Its only used once from what I can tell.

KungFuFurby commented 2 years ago

Just recently tested compilation using various past bass versions, courtesy of the https://github.com/bass-assembler/bass-history-kit .

I couldn't compile every single known version of bass to see which ones were compatible (in my case, I couldn't test v06r01, v07 and v11r08 due to compilation errors and would have to change more than just makefiles in there in order to get them to compile), but going by numerical version (if it had v##r##, I chose the one with the highest r number instead of just v##), I succeeded with v08r01, v09r02 and v10, and all three binaries even came out identical. v12r03 was a failure because for whatever reason I got a zero byte output file. It didn't error out, though.

anaanook commented 2 years ago

Hey thanks for looking into this, I was able to get this to compile on bass v10, which is great, and it seems to output the same binary data that's present in the .h file.

I now understand what align does too, if we wanted to get the asm compiling on the current version of bass I don't think it'd be out of the question?

KungFuFurby commented 2 years ago

I ran into a different problem on that one for a start. Although align is part of the problem, I got an invalid define identifier at streamData, which means the processing of defines with math involved may have changed.

A new issue has been created with regards to that particular scenario: #6