nesdev.com
http://forums.nesdev.com/

Implementing GBS playback in an emulator
http://forums.nesdev.com/viewtopic.php?f=20&t=14742
Page 1 of 1

Author:  drpavelleer [ Fri Aug 26, 2016 7:35 am ]
Post subject:  Implementing GBS playback in an emulator

So I already have an emulator that can emulate GB/GBC games fully, but I would like to add the ability to play GBS files.

I've had a look around documentation of the format and source code of already existing players, but I'm left confused.
Most notably the GBS spec document confuses me the most, as it is very vague in where I should start reading GB instructions (Is it at 0x70 or at the load address? The example in ROM-bank switching didn't clear anything up)
The only thing I've gotten working is offsetting the RST positions to the load address but even then I don't know if I'm doing it correctly because I'm overwriting instructions that are already there and that doesn't seem right (right at the very start of the file).

So, to make this easier on myself, from the perspective of an existing emulator, what do I need to add/modify to get it playing GBS files?

Author:  mic_ [ Mon Sep 19, 2016 2:14 am ]
Post subject:  Re: Implementing GBS playback in an emulator

I set things up like this:

Code:
    musicFile.read((char*)&mFileHeader, 0x70);

    numBanks = ((fileSize + mFileHeader.loadAddress - 0x70) + 0x3fff) >> 14;

    rom = new unsigned char[(uint32_t)numBanks << 14];

    memset(rom, 0, (uint32_t)numBanks << 14);
    musicFile.read((char*)rom + mFileHeader.loadAddress, fileSize-0x70);

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/