jkotlinski / lsdpack

Standalone LSDj recorder+player
GNU General Public License v2.0
116 stars 18 forks source link

on the structure of lsdj.s #3

Open merumerutho opened 5 years ago

merumerutho commented 5 years ago

This is not an actual issue, more of a request of documentation. I would like to try to port the lsdj player to GBA. AFAIK, GBA has the same audio registers of GB/GBC plus some additional ones.

From my understanding, lsdpack translated lsdj music into cpu registers read from an emulator, those values are saved and the player on a ROM proceeds to play back the values copying them to the register. It should be possible to play back the registers on GBA rewriting a routine for ARM (maybe even C could be suitable, if it's not too slow?), maybe even adding the compression, but I'm trying to figure out the starting register address, the order and the correspondance of the register values written in the "lsdj.s" file.

If there could be some kind of documentation on the structure of the lsdj.s file, or how many and which the addresses are I would be glad since I can't figure them out neither from the player routines (I'm not familiar with assembly, at least for now), nor from the writer.cpp file (I clearly see where it writes, I just don't understand from which addresses).

jkotlinski commented 5 years ago

Hi! Great idea! lsdpack records writes to the sound addresses ($ff10-$ff3f) plus some special events, when LYC happens (for timing), and when a song starts or stops. Samples are encoded also specially. The actual waveforms are written first and later those samples are refered to. I am struggling how to document in a way that is easier than just reading the code in writer.cpp , if you have specific questions I can try to answer.

A reference of Game Boy sound can be found if you search internet for "gbspec.txt"

cyberic99 commented 5 years ago

What I find hard is how to handle timing in the replayer code. It is hard to sync to the LYC if you try to replay on a platform where there is no LYC ;-)

@jkotlinski, would it be possible to include timing information, by adding comments to the .s file?

@merutochan I think you should alter writer.cpp to output in another format, for instance a C-array

jkotlinski commented 5 years ago

LYC happens 6 times per screen update. 6 • 59.73 Hz = 358.38 Hz.

On Fri, 5 Jul 2019 at 10:42, cyberic99 notifications@github.com wrote:

What I find hard is how to handle timing in the replayer code. It is hard to sync to the LYC if you try to replay on a platform where there is no LYC ;-)

@jkotlinski https://github.com/jkotlinski, would it be possible to include timing information, by adding comments to the .s file?

@Merutochan https://github.com/Merutochan I think you should alter writer.cpp to output in another format, for instance a C-array

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jkotlinski/lsdpack/issues/3?email_source=notifications&email_token=AAY34O4LWZDGH7I6EYRIAI3P54CQRA5CNFSM4H4YXYDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZI56HI#issuecomment-508682013, or mute the thread https://github.com/notifications/unsubscribe-auth/AAY34OZD4CVYIG7XWGOONCDP54CQRANCNFSM4H4YXYDA .