Articles tagged “VGM”

Following the STM8S tutorial in my previous post, I've tried to put the chip to some practical use. My initial experiments into producing a video signal proved unsuccessful; I managed a static image using hard-coded delay loops, but when trying to use interrupts to trigger the generation of scanlines the timing was all wrong and without an oscilloscope or a working simulator I couldn't find out what was wrong. I decided to turn my attention from picture to sound. VGM files store game music by logging the data written to the sound chips inside the console or computer directly along with the delay between writes.

What with the weekend having an extra Monday tacked on for good measure (Labour Day), I felt the need to be productive. I also felt the need to listen to VGM files converted to MIDI, so rustled up a VGM to MIDI converter. There already is one (available on the SMS Power! site), but I could never get it to work. Having never really puzzled out the YM2413 ('OPLL', FM chip) I limited it to the square-wave generating PSG. First of all, you need to be able to convert a tone register value (from 0 to 1023), the period of the output square wave, to a MIDI key value (0 to 127, where every 12 keys represent an octave).

As (yet another) side project to all this Z80 work, I've also decided to have a stab at the Japanese Master System's FM chip. It's a YM2413, and the

Lots of fixes... Download here! (New package includes loading music from Fire Track as a sample)
- Fixed reading of files. I'd used 'char' instead of 'unsigned char'. Files that played back as plain silence now play back fully, also play at correct speed. What a stupid mistake - it's amazing it worked at all! I ended up rewriting the entire PSG emulation thinking it was that that was to blame... evidently not! - Halved frequency of noise channel by only switching output once on 2 clocks.

Fixed drunk pilots. New algorithm is about 20 lines shorter, 10 times faster, 5 times simpler. Reason for drunk pilots: drunk coder.Implemented scoring, including:
Variable points for shooting enemies.Variable points for shooting objects on the ground.Display of score at top of screen. Updated pause screen, all sprites now remain on-screen, background is less wavy.Trimming of enemy attack times so they follow on from eachother nice and quickly.Numerous minor bugfixes and tweaks. The score might look nice there, but it really needs to be stuck on a background - any sprites trying to come in are cut off and look really odd popping into existance 8 pixels down from the top of the screen (8 sprite limit, and I have 8 digits in my score).

I felt like a different project for the evening, so started work on a console-based VGM player. Click to download. [193KB] (Comes with a few sample tunes). There are a number of (mainly minor) bugs listed in the readme.txt file, but it's not too shabby. It uses SDL to produce the sound (directly writing to the primary buffer). I'd be interested to hear any feedback! Oh, Fire Track... Well, there's a rip of the BBC Micro version's in-game music (just recorded directly from an emulator, hence the sfx over the top) in the above zip file.

RSSSearchBrowse by dateIndexTags