X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fpsg.cpp;h=ec849c5d8d1cbed2c1f40587e71c0edcef333817;hb=8ba4c4438d796f83851cd53914dff928193ed658;hp=5d6e6693101fabae7981911dd16dd0826e39600a;hpb=d22f243fc585a46e4c29d00bd32727d9f9f4055c;p=thunder diff --git a/src/psg.cpp b/src/psg.cpp index 5d6e669..ec849c5 100644 --- a/src/psg.cpp +++ b/src/psg.cpp @@ -15,15 +15,14 @@ // // Notes: // ------ -// The emulator creates signed 16-bit samples. Make sure there's enough room in -// your buffer for them! +// The emulator creates signed 16-bit samples. Make sure there's enough room +// in your buffer for them! // #include "psg.h" #include #include - struct Voice { uint8_t leftVolume; @@ -37,11 +36,9 @@ struct Voice static Voice voice[8]; static uint8_t memory[0x200]; -//static static uint32_t sampleRate = 44100; static uint32_t divisor; - void InitPSG(uint32_t s/*=44100*/) { sampleRate = s; @@ -52,10 +49,9 @@ void InitPSG(uint32_t s/*=44100*/) voice[i].noiseSeed = 1; } - // -// Note that it doesn't wipe out the buffer passed in, if you want it wiped, -// you have to wipe it yourself. :-) +// Note that it doesn't wipe out the buffer passed in; if you want it wiped, +// you have to wipe it yourself. :-) // void UpdatePSG(uint8_t * buffer, int count) { @@ -137,7 +133,6 @@ if F == 22050, then counter += 0.5 for each sample. } } - void WritePSG(uint16_t address, uint8_t data) { if ((address >= 0x100) && (address <= 0x13F)) @@ -154,7 +149,7 @@ void WritePSG(uint16_t address, uint8_t data) break; case 1: voice[channel].waveform = data >> 4; - voice[channel].frequency = ((data & 0x0F) << 16) + voice[channel].frequency = ((data & 0x0F) << 16) | (voice[channel].frequency & 0x0FFFF); #if 0 printf("PSG: Setting waveform on channel %i to %i...\n", channel, voice[channel].waveform); @@ -202,9 +197,7 @@ if (data & 0x0F) memory[address & 0x01FF] = data; } - uint8_t ReadPSG(uint16_t address) { return memory[address & 0x01FF]; } -