Mmmkay, so I tried adapting ikari's video player code to my program and nothing at all happened. So I tried using your code and I'm getting somewhere because it's crashing Bizhawk now - which I've learned happens when it hits a WAI command and never gets an interrupt, which due to the way I hacked it out means it's taking the "NoMSU" branch. So, I haven't made it recognize that I'm trying to use MSU1 yet. Bizhawk is just a shell for bsnes v87, so it definitely should work, right...?
I decided to try it in higan and magically, it works. Works on my SD2SNES as well. So I guess somehow Bizhawk lacks MSU1 support despite using bsnes.
I'm grateful for the help trying to get this put together but I can't believe that the actual specification page on byuu's site that all this knowledge seems to come from is just plain gone. Without your help I'd have never figured it out. Did I miss something? I was just reading some heated conversations right on this forum no more than a year ago getting the fine details of it worked out. Seems like an exciting new development like this should have resulted in a bunch of interesting new hacks in the meantime yet MSU1 barely even brings in a handful of google results. Do I dare start relying on it for more than mere demos?
(Speaking of those conversations, did they ever reach some kind of agreement about the audio frequency/clock speed? I was extremely concerned to see the issue of video and audio de-syncing brushed aside as unimportant - a tiny desync becomes absolutely intolerable very quickly.)
Anyways. The audio is hideously out of sync the way I have it written now... It starts playing several seconds before the video begins to load. As far as I can tell from my code, the first frame should appear on screen 4-5 frames after the audio begins playing, so I'm assuming there's some kind of long buffering delay or something from loading the audio data. When looking at ikari's video player it looked like he had it set up to start the audio as the first frame is drawn, but I'm not sure that's any better if you still have a significant delay right after the audio starts.
Was trying to take a closer look in higan but I'm shocked to discover it doesn't even seem to have a frame counter so I can see how much of a delay I'm even dealing with... Why oh why doesn't it just work in Bizhawk. I think I may have to go bother adelikat about that, if he's forgiven me for the last time I wasted his time.
The video is looking amazing though. On my TV it's like 3/4 of an 8x8 tile row away from fullscreen, you can hardly tell it isn't a full picture. Frame processing is at ~200/2682 after maybe a day running full speed. Gives me time to figure out the data stream, though I am worried I won't have a processor left when it's done.
EDIT: Oh, I see:
Code: Select all
lda #$01 ; Set audio state to play, no repeat.
sta MSU_CONTROL
lda #$00
- inc a
wai
sta MSU_VOLUME
cmp #$FF
bne -
; The MSU1 will now start playing.
; Use lda #$03 to play a song repeatedly.
So it's taking a bunch of frames to gradually ramp up the volume. I guess I can build that into my normal frame loop, if I even need it.
EDIT: Audio is nicely synced and I got rid of that annoying little line of pixels at the bottom by blanking both tilemaps first. Literally all I need now is to learn to DMA frames from MSU1 and I've got it.