static void IOOUTCALL opna_o18e(UINT port, REG8 dat) { UINT addr; if (!opn.extend) { return; } addr = opn.addr - 0x100; if (addr >= 0x100) { return; } S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { opngen_setreg(6, addr, dat); } else { if (addr == 0x10) { if (!(dat & 0x80)) { opn.adpcmmask = ~(dat & 0x1c); } } } (void)port; }
static void IOOUTCALL ymf_o18e(UINT port, REG8 dat) { UINT addr; if (!g_opn.extend) { return; } g_opn.data1 = dat; if (g_opn.addr1h != 1) { return; } addr = g_opn.addr1l; S98_put(EXTEND2608, addr, dat); g_opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { opngen_setreg(&g_opngen, 3, addr, dat); } else { if (addr == 0x10) { if (!(dat & 0x80)) { g_opn.adpcmmask = ~(dat & 0x1c); } } } (void)port; }
static void IOOUTCALL opn_o18a(UINT port, REG8 dat) { UINT addr; g_opn.data1 = dat; addr = g_opn.addr1l; S98_put(NORMAL2608, addr, dat); g_opn.reg[addr] = dat; if (addr < 0x10) { psggen_setreg(&g_psg1, addr, dat); } else if (addr < 0x100) { if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon(&g_opngen, dat & 0x0f, dat); } } else { fmtimer_setreg(addr, dat); if (addr == 0x27) { g_opngen.opnch[2].extop = dat & 0xc0; } } } else if (addr < 0xc0) { opngen_setreg(&g_opngen, 0, addr, dat); } } (void)port; }
static void IOOUTCALL spr_o58a(UINT port, REG8 dat) { UINT addr; // g_opn.data2 = dat; addr = g_opn.addr2l; g_opn.reg[addr + 0x200] = dat; if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon(&g_opngen, (dat & 0x0f) + 6, dat); } else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) { opngen_keyon(&g_opngen, (dat & 0x0f) + 5, dat); } } else { if (addr == 0x27) { g_opngen.opnch[8].extop = dat & 0xc0; } } } else if (addr < 0xc0) { opngen_setreg(&g_opngen, 6, addr, dat); } (void)port; }
static void IOOUTCALL spr_o48a(UINT port, REG8 dat) { UINT addr; // g_opn2.data2 = dat; addr = g_opn2.addr2l; g_opn2.reg[addr + 0x200] = dat; if (addr >= 0x100) { return; } if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon(&g_opngen, (dat & 0x0f) + 18, dat); } else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) { opngen_keyon(&g_opngen, (dat & 0x0f) + 17, dat); } } else { if (addr == 0x27) { g_opngen.opnch[20].extop = dat & 0xc0; } } } else if (addr < 0xc0) { opngen_setreg(&g_opngen, 18, addr, dat); } (void)port; }
static void IOOUTCALL spr_o58a(UINT port, REG8 dat) { UINT addr; // opn.data2 = dat; addr = opn.addr2; if (addr >= 0x100) { return; } if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon((dat & 0x0f) + 6, dat); } else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) { opngen_keyon((dat & 0x0f) + 5, dat); } } else { if (addr == 0x27) { opnch[8].extop = dat & 0xc0; } } } else if (addr < 0xc0) { opngen_setreg(6, addr, dat); } opn.reg[addr + 0x200] = dat; (void)port; }
static void IOOUTCALL opn_o08a(UINT port, REG8 dat) { UINT addr; opn.data2 = dat; addr = opn.addr2; if (addr < 0x10) { if (addr != 0x0e) { psggen_setreg(&psg1, addr, dat); } } else { if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon(dat & 0x0f, dat); } } else { fmtimer_setreg(addr, dat); if (addr == 0x27) { opnch[2].extop = dat & 0xc0; } } } else if (addr < 0xc0) { opngen_setreg(0, addr, dat); } opn.reg[addr + 0x200] = dat; } (void)port; }
static void IOOUTCALL spr_o48e(UINT port, REG8 dat) { UINT addr; // g_opn.data2 = dat; addr = g_opn2.addr2h; g_opn2.reg[addr + 0x300] = dat; if (addr >= 0x30) { opngen_setreg(&g_opngen, 21, addr, dat); } (void)port; }
static void IOOUTCALL spr_o58e(UINT port, REG8 dat) { UINT addr; // opn.data2 = dat; addr = opn.addr2 - 0x100; if (addr >= 0x100) { return; } opn.reg[addr + 0x300] = dat; if (addr >= 0x30) { opngen_setreg(9, addr, dat); } (void)port; }
static void IOOUTCALL spb_o18e(UINT port, REG8 dat) { UINT addr; // g_opn.data1 = dat; addr = g_opn.addr1h; // S98_put(EXTEND2608, addr, dat); g_opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { opngen_setreg(&g_opngen, 3, addr, dat); } else if (addr < 0x12) { adpcm_setreg(&g_adpcm, addr, dat); } (void)port; }
static void IOOUTCALL opna_o18a(UINT port, REG8 dat) { UINT addr; opn.data = dat; addr = opn.addr; if (addr >= 0x100) { return; } S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { psggen_setreg(&psg2, addr, dat); } } else { if (addr < 0x20) { if (opn.extend) { rhythm_setreg(&rhythm, addr, dat); } } else if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon((dat & 0x0f) + 3, dat); } else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) { opngen_keyon((dat & 0x0f) + 2, dat); } } else { fmtimer_setreg(addr, dat); if (addr == 0x27) { opnch[2].extop = dat & 0xc0; } } } else if (addr < 0xc0) { opngen_setreg(3, addr, dat); } opn.reg[addr] = dat; } (void)port; }
static void IOOUTCALL p86_o28e(UINT port, REG8 dat) { UINT addr; // g_opn3.data1 = dat; addr = g_opn3.addr1h; if (addr >= 0x100) { return; } // S98_put(EXTEND2608, addr, dat); g_opn3.reg[addr + 0x100] = dat; if (addr >= 0x30) { opngen_setreg(&g_opngen, 27, addr, dat); } else if (addr < 0x12) { adpcm_setreg(&g_adpcm3, addr, dat); } (void)port; }
static void IOOUTCALL spb_o18e(UINT port, REG8 dat) { UINT addr; opn.data = dat; addr = opn.addr - 0x100; if (addr >= 0x100) { return; } S98_put(EXTEND2608, addr, dat); opn.reg[addr + 0x100] = dat; if (addr >= 0x30) { opngen_setreg(3, addr, dat); } else if (addr < 0x12) { adpcm_setreg(&adpcm, addr, dat); } (void)port; }
/** * Writes extended register (Inner) * @param[in] opna The instance * @param[in] nAddress The address * @param[in] cData The data */ static void writeExtendedRegister(POPNA opna, UINT nAddress, REG8 cData) { const UINT8 cCaps = opna->s.cCaps; CExternalOpna* pExt = reinterpret_cast<CExternalOpna*>(opna->userdata); if (nAddress < 0x12) { if (cCaps & OPNA_HAS_ADPCM) { adpcm_setreg(&opna->adpcm, nAddress, cData); if ((pExt) && (pExt->HasADPCM())) { pExt->WriteRegister(nAddress + 0x100, cData); } } else { if (nAddress == 0x10) { if (!(cData & 0x80)) { opna->s.adpcmmask = ~(cData & 0x1c); } } } } else if (nAddress >= 0x30) { if (cCaps & OPNA_HAS_EXTENDEDFM) { if (!pExt) { opngen_setreg(&opna->opngen, 3, nAddress, cData); } else { pExt->WriteRegister(nAddress + 0x100, cData); } } } }
static void IOOUTCALL ymf_o18a(UINT port, REG8 dat) { UINT addr; opn.data = dat; addr = opn.addr; if (addr >= 0x100) { return; } S98_put(NORMAL2608, addr, dat); if (addr < 0x10) { if (addr != 0x0e) { psggen_setreg(&psg1, addr, dat); } } else { if (addr < 0x20) { rhythm_setreg(&rhythm, addr, dat); } else if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon(dat & 0x0f, dat); } else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) { opngen_keyon((dat & 0x07) - 1, dat); } } else { fmtimer_setreg(addr, dat); } } else if (addr < 0xc0) { opngen_setreg(0, addr, dat); } opn.reg[addr] = dat; } (void)port; }
static void IOOUTCALL ymf_o18a(UINT port, REG8 dat) { UINT addr; g_opn.data1 = dat; if (g_opn.addr1h != 0) { return; } addr = g_opn.addr1l; S98_put(NORMAL2608, addr, dat); g_opn.reg[addr] = dat; if (addr < 0x10) { psggen_setreg(&g_psg1, addr, dat); } else { if (addr < 0x20) { rhythm_setreg(&g_rhythm, addr, dat); } else if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon(&g_opngen, dat & 0x0f, dat); } else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) { opngen_keyon(&g_opngen, (dat & 0x07) - 1, dat); } } else { fmtimer_setreg(addr, dat); } } else if (addr < 0xc0) { opngen_setreg(&g_opngen, 0, addr, dat); } } (void)port; }
static void IOOUTCALL spb_o08a(UINT port, REG8 dat) { UINT addr; // g_opn2.data1 = dat; addr = g_opn2.addr1l; // S98_put(NORMAL2608, addr, dat); g_opn2.reg[addr] = dat; if (addr < 0x10) { psggen_setreg(&g_psg2, addr, dat); } else { if (addr < 0x20) { rhythm_setreg(&g_rhythm2, addr, dat); } else if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon(&g_opngen, (dat & 0x0f) + 12, dat); } else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) { opngen_keyon(&g_opngen, (dat & 0x0f) + 11, dat); } } else { fmtimer_setreg(addr, dat); if (addr == 0x27) { g_opngen.opnch[14].extop = dat & 0xc0; } } } else if (addr < 0xc0) { opngen_setreg(&g_opngen, 12, addr, dat); } } (void)port; }
static void IOOUTCALL p86_o28a(UINT port, REG8 dat) { UINT addr; // g_opn3.data1 = dat; addr = g_opn3.addr1l; // S98_put(NORMAL2608, addr, dat); g_opn3.reg[addr] = dat; if (addr < 0x10) { psggen_setreg(&g_psg3, addr, dat); } else { if (addr < 0x20) { rhythm_setreg(&g_rhythm3, addr, dat); } else if (addr < 0x30) { if (addr == 0x28) { if ((dat & 0x0f) < 3) { opngen_keyon(&g_opngen, (dat & 0x0f) + 24, dat); } else if (((dat & 0x0f) != 3) && ((dat & 0x0f) < 7)) { opngen_keyon(&g_opngen, (dat & 0x0f) + 23, dat); } } else { fmtimer_setreg(addr, dat); if (addr == 0x27) { g_opngen.opnch[26].extop = dat & 0xc0; } } } else if (addr < 0xc0) { opngen_setreg(&g_opngen, 24, addr, dat); } } (void)port; }
/** * Writes register (Inner) * @param[in] opna The instance * @param[in] nAddress The address * @param[in] cData The data */ static void writeRegister(POPNA opna, UINT nAddress, REG8 cData) { const UINT8 cCaps = opna->s.cCaps; CExternalOpna* pExt = reinterpret_cast<CExternalOpna*>(opna->userdata); if (nAddress < 0x10) { if (cCaps & OPNA_HAS_PSG) { keydisp_psg(opna->s.reg, nAddress); if ((!pExt) || (!pExt->HasPsg())) { psggen_setreg(&opna->psg, nAddress, cData); } else { pExt->WriteRegister(nAddress, cData); } } } else if (nAddress < 0x20) { if (cCaps & OPNA_HAS_RHYTHM) { if ((!pExt) || (!pExt->HasRhythm())) { rhythm_setreg(&opna->rhythm, nAddress, cData); } else { pExt->WriteRegister(nAddress, cData); } } } else if (nAddress < 0x30) { if (nAddress == 0x28) { REG8 cChannel = cData & 0x0f; if (cChannel < 8) { opna->s.keyreg[cChannel] = cData; } if (cChannel < 3) { } else if ((cCaps & OPNA_HAS_EXTENDEDFM) && (cChannel >= 4) && (cChannel < 7)) { cChannel--; } else { return; } if (!pExt) { opngen_keyon(&opna->opngen, cChannel, cData); } else { pExt->WriteRegister(nAddress, cData); } keydisp_opnakeyon(opna->s.reg, cData); } else if (nAddress == 0x27) { if (cCaps & OPNA_HAS_TIMER) { opna_settimer(opna, cData); } if (pExt) { pExt->WriteRegister(nAddress, cData); } else { opna->opngen.opnch[2].extop = cData & 0xc0; } } else if (nAddress == 0x22) { if (pExt) { pExt->WriteRegister(nAddress, cData); } } } else if (nAddress < 0xc0) { if (!pExt) { opngen_setreg(&opna->opngen, 0, nAddress, cData); } else { pExt->WriteRegister(nAddress, cData); } } }