void moonsoundWrite(Moonsound* moonsound, UInt16 ioPort, UInt8 value) { UInt32 systemTime = boardSystemTime(); if (ioPort < 0xC0) { switch (ioPort & 0x01) { case 0: // select register moonsound->opl4latch = value; break; case 1: mixerSync(moonsound->mixer); moonsound->ymf278->writeRegOPL4(moonsound->opl4latch, value, systemTime); break; } } else { switch (ioPort & 0x03) { case 0: moonsound->opl3latch = value; break; case 2: // select register bank 1 moonsound->opl3latch = value | 0x100; break; case 1: case 3: // write fm register mixerSync(moonsound->mixer); moonsound->ymf262->writeReg(moonsound->opl3latch, value, systemTime); break; } } }
UInt8 moonsoundRead(Moonsound* moonsound, UInt16 ioPort) { UInt8 result = 0xff; UInt32 systemTime = boardSystemTime(); if (ioPort < 0xC0) { switch (ioPort & 0x01) { case 1: // read wave register mixerSync(moonsound->mixer); result = moonsound->ymf278->readRegOPL4(moonsound->opl4latch, systemTime); break; } } else { switch (ioPort & 0x03) { case 0: // read status case 2: mixerSync(moonsound->mixer); result = moonsound->ymf262->readStatus() | moonsound->ymf278->readStatus(systemTime); break; case 1: case 3: // read fm register mixerSync(moonsound->mixer); result = moonsound->ymf262->readReg(moonsound->opl3latch); break; } } return result; }
void vlm5030Write(VLM5030* vlm5030, UInt16 ioPort, UInt8 value) { switch (ioPort & 1) { case 0: mixerSync(vlm5030->mixer); VLM5030_data_w(0, value); break; case 1: mixerSync(vlm5030->mixer); VLM5030_RST((value & 0x01) ? 1 : 0 ); VLM5030_VCU((value & 0x04) ? 1 : 0 ); VLM5030_ST( (value & 0x02) ? 1 : 0 ); break; } }
void ym2151Write(YM2151* ym2151, UInt16 ioPort, UInt8 value) { switch (ioPort & 1) { case 0: ym2151->latch = value; break; case 1: mixerSync(ym2151->mixer); YM2151WriteReg(ym2151->opl, ym2151->latch, value); break; } }
void y8950Write(Y8950* y8950, UInt16 ioPort, UInt8 value) { switch (ioPort & 1) { case 0: OPLWrite(y8950->opl, 0, value); break; case 1: mixerSync(y8950->mixer); OPLWrite(y8950->opl, 1, value); break; } }
UInt8 y8950Read(Y8950* y8950, UInt16 ioPort) { switch (ioPort & 1) { case 0: return (UInt8)OPLRead(y8950->opl, 0); case 1: if (y8950->opl->address == 0x14) { mixerSync(y8950->mixer); } return (UInt8)OPLRead(y8950->opl, 1); break; } return 0xff; }
void stream_update(void* dummy1, int idx) { if (theVlm5030 != NULL) { mixerSync(theVlm5030->mixer); } }