| version 1.5, 2005/02/09 20:11:33 | version 1.8, 2007/11/03 00:00:19 | 
| Line 11 | Line 11 | 
 |  |  | 
 | static void IOOUTCALL opna_o188(UINT port, REG8 dat) { | static void IOOUTCALL opna_o188(UINT port, REG8 dat) { | 
 |  |  | 
| opn.opnreg = dat; | opn.addr = dat; | 
|  | opn.data = dat; | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
 | static void IOOUTCALL opna_o18a(UINT port, REG8 dat) { | static void IOOUTCALL opna_o18a(UINT port, REG8 dat) { | 
 |  |  | 
| S98_put(NORMAL2608, opn.opnreg, dat); | UINT    addr; | 
| if (opn.opnreg < 0x10) { |  | 
| if (opn.opnreg != 0x0e) { | opn.data = dat; | 
| psggen_setreg(&psg1, opn.opnreg, 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 { | else { | 
| if (opn.opnreg < 0x20) { | if (addr < 0x20) { | 
 | if (opn.extend) { | if (opn.extend) { | 
| rhythm_setreg(&rhythm, opn.opnreg, dat); | rhythm_setreg(&rhythm, addr, dat); | 
 | } | } | 
 | } | } | 
| else if (opn.opnreg < 0x30) { | else if (addr < 0x30) { | 
| if (opn.opnreg == 0x28) { | if (addr == 0x28) { | 
 | if ((dat & 0x0f) < 3) { | if ((dat & 0x0f) < 3) { | 
 | opngen_keyon(dat & 0x0f, dat); | opngen_keyon(dat & 0x0f, dat); | 
 | } | } | 
| Line 40  static void IOOUTCALL opna_o18a(UINT por | Line 48  static void IOOUTCALL opna_o18a(UINT por | 
 | } | } | 
 | } | } | 
 | else { | else { | 
| fmtimer_setreg(opn.opnreg, dat); | fmtimer_setreg(addr, dat); | 
| if (opn.opnreg == 0x27) { | if (addr == 0x27) { | 
 | opnch[2].extop = dat & 0xc0; | opnch[2].extop = dat & 0xc0; | 
 | } | } | 
 | } | } | 
 | } | } | 
| else if (opn.opnreg < 0xc0) { | else if (addr < 0xc0) { | 
| opngen_setreg(0, opn.opnreg, dat); | opngen_setreg(0, addr, dat); | 
 | } | } | 
| opn.reg[opn.opnreg] = dat; | opn.reg[addr] = dat; | 
 | } | } | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
 | static void IOOUTCALL opna_o18c(UINT port, REG8 dat) { | static void IOOUTCALL opna_o18c(UINT port, REG8 dat) { | 
 |  |  | 
| opn.extreg = dat; | if (opn.extend) { | 
|  | opn.addr = dat + 0x100; | 
|  | opn.data = dat; | 
|  | } | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
 | static void IOOUTCALL opna_o18e(UINT port, REG8 dat) { | static void IOOUTCALL opna_o18e(UINT port, REG8 dat) { | 
 |  |  | 
| S98_put(EXTEND2608, opn.extreg, dat); | UINT    addr; | 
| opn.reg[opn.extreg + 0x100] = dat; |  | 
| if (opn.extreg >= 0x30) { | if (!opn.extend) { | 
| opngen_setreg(3, opn.extreg, dat); | return; | 
|  | } | 
|  | 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 { | else { | 
| if (opn.extreg == 0x10) { | if (addr == 0x10) { | 
 | if (!(dat & 0x80)) { | if (!(dat & 0x80)) { | 
 | opn.adpcmmask = ~(dat & 0x1c); | opn.adpcmmask = ~(dat & 0x1c); | 
 | } | } | 
| Line 85  static REG8 IOINPCALL opna_i188(UINT por | Line 106  static REG8 IOINPCALL opna_i188(UINT por | 
 |  |  | 
 | static REG8 IOINPCALL opna_i18a(UINT port) { | static REG8 IOINPCALL opna_i18a(UINT port) { | 
 |  |  | 
| if (opn.opnreg == 0x0e) { | UINT    addr; | 
|  |  | 
|  | addr = opn.addr; | 
|  | if (addr == 0x0e) { | 
 | return(fmboard_getjoy(&psg1)); | return(fmboard_getjoy(&psg1)); | 
 | } | } | 
| else if (opn.opnreg < 0x10) { | else if (addr < 0x10) { | 
| return(psggen_getreg(&psg1, opn.opnreg)); | return(psggen_getreg(&psg1, addr)); | 
|  | } | 
|  | else if (addr == 0xff) { | 
|  | return(1); | 
 | } | } | 
 | (void)port; | (void)port; | 
| return(opn.reg[opn.opnreg]); | return(opn.data); | 
 | } | } | 
 |  |  | 
 | static REG8 IOINPCALL opna_i18c(UINT port) { | static REG8 IOINPCALL opna_i18c(UINT port) { | 
| Line 107  static REG8 IOINPCALL opna_i18c(UINT por | Line 134  static REG8 IOINPCALL opna_i18c(UINT por | 
 | static REG8 IOINPCALL opna_i18e(UINT port) { | static REG8 IOINPCALL opna_i18e(UINT port) { | 
 |  |  | 
 | if (opn.extend) { | if (opn.extend) { | 
| return(opn.reg[opn.opnreg]); | UINT addr = opn.addr - 0x100; | 
|  | if ((addr == 0x08) || (addr == 0x0f)) { | 
|  | return(opn.reg[addr + 0x100]); | 
|  | } | 
|  | return(opn.data); | 
 | } | } | 
 | (void)port; | (void)port; | 
 | return(0xff); | return(0xff); | 
| Line 137  static const IOINP opna_i[4] = { | Line 168  static const IOINP opna_i[4] = { | 
 | opna_i188,      opna_i18a,      opna_i18c,      opna_i18e}; | opna_i188,      opna_i18a,      opna_i18c,      opna_i18e}; | 
 |  |  | 
 |  |  | 
| void board86_reset(void) { | void board86_reset(const NP2CFG *pConfig) { | 
 |  |  | 
| fmtimer_reset((np2cfg.snd86opt & 0x10) | | fmtimer_reset((pConfig->snd86opt & 0x10) | | 
| ((np2cfg.snd86opt & 0x4) << 5) | | ((pConfig->snd86opt & 0x4) << 5) | | 
| ((np2cfg.snd86opt & 0x8) << 3)); | ((pConfig->snd86opt & 0x8) << 3)); | 
 | opngen_setcfg(3, OPN_STEREO | 0x038); | opngen_setcfg(3, OPN_STEREO | 0x038); | 
| if (np2cfg.snd86opt & 2) { | if (pConfig->snd86opt & 2) { | 
 | soundrom_load(0xcc000, OEMTEXT("86")); | soundrom_load(0xcc000, OEMTEXT("86")); | 
 | } | } | 
| opn.base = (np2cfg.snd86opt & 0x01)?0x000:0x100; | opn.base = (pConfig->snd86opt & 0x01)?0x000:0x100; | 
 | fmboard_extreg(extendchannel); | fmboard_extreg(extendchannel); | 
 | } | } | 
 |  |  | 
| Line 168  void board86_bind(void) { | Line 199  void board86_bind(void) { | 
 |  |  | 
 | static void IOOUTCALL opnac_o18e(UINT port, REG8 dat) { | static void IOOUTCALL opnac_o18e(UINT port, REG8 dat) { | 
 |  |  | 
| S98_put(EXTEND2608, opn.extreg, dat); | UINT    addr; | 
| opn.reg[opn.extreg + 0x100] = dat; |  | 
| if (opn.extreg >= 0x30) { | if (!opn.extend) { | 
| opngen_setreg(3, opn.extreg, dat); | return; | 
|  | } | 
|  | 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 { | else { | 
| if (opn.extreg < 0x12) { | if (addr < 0x12) { | 
| adpcm_setreg(&adpcm, opn.extreg, dat); | adpcm_setreg(&adpcm, addr, dat); | 
 | } | } | 
 | } | } | 
 | (void)port; | (void)port; | 
| Line 194  static REG8 IOINPCALL opnac_i18c(UINT po | Line 235  static REG8 IOINPCALL opnac_i18c(UINT po | 
 | static REG8 IOINPCALL opnac_i18e(UINT port) { | static REG8 IOINPCALL opnac_i18e(UINT port) { | 
 |  |  | 
 | if (opn.extend) { | if (opn.extend) { | 
| if (opn.extreg == 0x08) { | UINT addr = opn.addr - 0x100; | 
|  | if (addr == 0x08) { | 
 | return(adpcm_readsample(&adpcm)); | return(adpcm_readsample(&adpcm)); | 
 | } | } | 
| return(opn.reg[opn.opnreg]); | else if (addr == 0x0f) { | 
|  | return(opn.reg[addr + 0x100]); | 
|  | } | 
|  | return(opn.data); | 
 | } | } | 
 | (void)port; | (void)port; | 
 | return(0xff); | return(0xff); |