void fmunit_write(int offset, int data) { if(!snd.enabled || !sms.use_fm) return; FM_Write(offset, data); }
void FM_WriteReg(int reg, int data) { FM_Write(0, reg); FM_Write(1, data); }
void FM_SetContext(uint8 *data) { int i; uint8 *reg = fm_context.reg; memcpy(&fm_context, data, sizeof(FM_Context)); /* If we are loading a save state, we want to update the YM2413 context but not actually write to the current YM2413 emulator. */ if(!snd.enabled || !sms.use_fm) return; FM_Write(0, 0x0E); FM_Write(1, reg[0x0E]); for(i = 0x00; i <= 0x07; i++) { FM_Write(0, i); FM_Write(1, reg[i]); } for(i = 0x10; i <= 0x18; i++) { FM_Write(0, i); FM_Write(1, reg[i]); } for(i = 0x20; i <= 0x28; i++) { FM_Write(0, i); FM_Write(1, reg[i]); } for(i = 0x30; i <= 0x38; i++) { FM_Write(0, i); FM_Write(1, reg[i]); } FM_Write(0, fm_context.latch); }