Monday, 15th May 2006
In my Game Gear-related fiddling, I optimised the tween demo code significantly, but then slowed it back down again by adding 4 more points, extending the rotation code to using 16.16 rather than 16.8 fixed-point and using a proper linear tween. It's still a bit smoother, though:
Wednesday, 3rd May 2006
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).
This is easiest if you have a real frequency (in Hertz) to work with, so I have the formulae:
Frequency = ClockSpeed ÷ (32 × ToneReg) Key = 12 × Log2|Frequency × Constant|ClockSpeed is the clock speed of the PSG in Hertz. Constant is a precalculated constant used to scale the frequency to a range so that 440Hz ends up being played as key A, octave 5.
As it is unlikely you'll get a round number with this, I rely on adjusting the MIDI pitch wheel. Now it's a case of detecting attacks (when the volume of a channel increases) and releases (when the volume of a channel is set to 0) to create MIDI key press and release messages.
Percussion (white noise from the PSG) is handled the same way, except that instead of using mapping frequencies to keys and pitch wheels it plays one of 3 different drums corresponding to the 3 different pitches of noise.
- Power Strike 2 (GG) - Weapon Select
- Ristar (GG) - Du-Di-Da!
- Marble Madness - Tune 09
- The Flash - Trickster for Mayor
- Sega Chess - White Wins
- Sonic Chaos - Mecha Green Hill Zone
- Sonic the Hedgehog - Bonus Zone
- Ys - Holders of Power
The problem with sound-related apps is that they don't provide very interesting screenshots, so I took on a little side project that I hoped would. (After all, journals are a bit dull if they're plain text).
Yep, it's that 3MHz, 32-colour, 8KB powerhouse the Sega Game Gear again.
Looking on pouet.net, there is only one Game Gear demo on there. If I haven't got it in me to complete a full-blown game, I can at least try and contribute something. After all, it's a relatively simple Z80 system to write programs for.
Have the typically poorly-shot video to see it in action:
(The odd flickering horizontal band that sometimes appears is a case of me using up the 8 sprite per scanline ration).