Update audio custom wave pattern data.

Signed-off-by: Adrian.Conlon <adrian.conlon@arup.com>
This commit is contained in:
Adrian.Conlon 2017-09-21 10:36:52 +01:00
parent 32a585a980
commit 7830c29f6a
4 changed files with 20 additions and 10 deletions

View File

@ -751,6 +751,13 @@ namespace EightBit {
setEnabled((value >> 7) & Processor::Mask1); // Bit 7
}
void setPackedWaveDatum(int i, uint8_t value) {
voice3()->setPackedWaveDatum(i, value);
}
uint8_t packedWaveDatum(int i) {
return voice3()->packedWaveDatum(i);
}
private:
std::array<std::shared_ptr<AudioVoice>, 4> m_voices;

View File

@ -70,6 +70,9 @@ namespace EightBit {
NR51 = 0x25, // R/W Mask8
NR52 = 0x26, // R/W Mask8 Mask8
WAVE_PATTERN_RAM_START = 0x30,
WAVE_PATTERN_RAM_END = 0x3F,
// LCD Display Registers
LCDC = 0x40, // R/W Mask8
STAT = 0x41, // R/W Mask7
@ -84,9 +87,6 @@ namespace EightBit {
WY = 0x4A, // R/W Mask8
WX = 0x4B, // R/W Mask8
WPRAM_START = 0x30,
WPRAM_END = 0x3F,
// Boot rom control
BOOT_DISABLE = 0x50,
};

View File

@ -670,10 +670,10 @@ std::string EightBit::GameBoy::Disassembler::io(uint8_t value) {
case Bus::NR52:
return "NR52";
case Bus::WPRAM_START:
return "WPRAM_START";
case Bus::WPRAM_END:
return "WPRAM_END";
case Bus::WAVE_PATTERN_RAM_START:
return "WAVE_PATTERN_RAM_START";
case Bus::WAVE_PATTERN_RAM_END:
return "WAVE_PATTERN_RAM_END";
// Boot rom control
case Bus::BOOT_DISABLE:

View File

@ -195,7 +195,10 @@ void EightBit::GameBoy::Bus::Bus_ReadingByte(const uint16_t address) {
break;
default:
mask(0);
if ((address >= (BASE + WAVE_PATTERN_RAM_START)) && (address <= (BASE + WAVE_PATTERN_RAM_END)))
poke(address, audio().packedWaveDatum(address - WAVE_PATTERN_RAM_START));
else
mask(0);
break;
}
}
@ -403,8 +406,8 @@ void EightBit::GameBoy::Bus::Bus_WrittenByte(const uint16_t address) {
break;
default:
if ((address >= (BASE + WPRAM_START)) && (address <= (BASE + WPRAM_END)))
; // Wave form data
if ((address >= (BASE + WAVE_PATTERN_RAM_START)) && (address <= (BASE + WAVE_PATTERN_RAM_END)))
audio().setPackedWaveDatum(address - WAVE_PATTERN_RAM_START, value);
else if ((address > BASE) && (address < (BASE + 0x4c)))
assert(false);
}