Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - VGM file data blocks??

Reply to topic
Author Message
  • Joined: 16 Jun 2017
  • Posts: 3
  • Location: Sacramento, California
Reply with quote
VGM file data blocks??
Post Posted: Sun Jan 07, 2018 7:19 am
Hi everybody on the forum. I am a somewhat new user here although I've been reading the articles for quite some time. I am hugely grateful for all the great information you guys have put online, as it has helped me immensely with the projects I have done thus far.

I have some experience with the YM2612, I built a midi-controlled musical keyboard, like the ones you can see a lot on YouTube (and I think Maxim actually built one of these himself, haha.) So I am familiar with the registers, sending read/write instructions and all that, at least on a hardware level as controlled by a microcontroller like an Arduino. I am not as familiar with assembly language of the system though, although I don't think I'll need that for my question.

So anyway, the reason I'm asking for your guys' help is because I'm trying to build a .vgm file player from hardware, controlled by an Arduino (so a YM2612 controlled by an Arduino, and will at the SN76489 later). I understand a good amount of the write instructions (0x52 0xaa 0xdd, 0x53 0xaa 0xdd, etc) and should be able to code those no problem.

The issue I am having is with the data block format. In the file I'm working with (Road Rash II opening theme) the .vgm instructions start at address 0x40, and look like they start with a stream of uncompressed PCM data which is handled by register 2A in port 0 of the YM2612. The bytes are (starting at 0x40):

67 66 00 10 2d 00 00 65 92 a7 7c 65

So I believe this means that the number of samples is 2d10 which is 11,536 samples. I figured that this might be like an offset kind of thing, where I could look at the address which is around 0x40 + 2d10 + a few bytes, to see the end of the samples and look for a type of terminator byte sequence, or maybe a new instruction being initiated, but I didn't find it. I guess I also don't understand how to handle this data. I read in a similar thread (forum won't let me link it apparently) that each nibble is a sample value, so for example 0x6F would be two separate values, 6 and F. And these are played back at a bitrate like 16 kHz and this is also possible to do in Audacity. I guess I have a lot more research to do.

Anyways sorry for the long question but if anyone can shed some light on this it would help me immensely. I told my girlfriend I could finish this project before the weekend is over but now she will probably leave me for a better looking and smarter man :D

Thanks everybody
segaInstructionsHex.PNG (11.79 KB)
Road Rash II theme in Hex Editor
segaInstructionsHex.PNG

  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Sun Jan 07, 2018 7:56 am
This is a feature that was added for samples for YM2612. You should have it remember where the data block is, then skip over it (as you know the length) and interpret the following byte as a VGM command. Later commands will refer back to it.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!