| version 1.1, 2003/10/16 17:58:00 | version 1.3, 2003/12/08 00:55:30 | 
| Line 9 | Line 9 | 
 | #include        "s98.h" | #include        "s98.h" | 
 |  |  | 
 |  |  | 
| static void IOOUTCALL opn_o088(UINT port, BYTE dat) { | static void IOOUTCALL opn_o088(UINT port, REG8 dat) { | 
 |  |  | 
 | opn.opn2reg = dat; | opn.opn2reg = dat; | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
| static void IOOUTCALL opn_o08a(UINT port, BYTE dat) { | static void IOOUTCALL opn_o08a(UINT port, REG8 dat) { | 
 |  |  | 
 | if (opn.opn2reg < 0x10) { | if (opn.opn2reg < 0x10) { | 
 | if (opn.opn2reg != 0x0e) { | if (opn.opn2reg != 0x0e) { | 
| psggen_setreg(&psg2, opn.opn2reg, dat); | psggen_setreg(&psg1, opn.opn2reg, dat); | 
 | } | } | 
 | } | } | 
 | else { | else { | 
 | if (opn.opn2reg < 0x30) { | if (opn.opn2reg < 0x30) { | 
 | if (opn.opn2reg == 0x28) { | if (opn.opn2reg == 0x28) { | 
 | if ((dat & 0x0f) < 3) { | if ((dat & 0x0f) < 3) { | 
| opngen_keyon((dat & 0x0f), dat); | opngen_keyon(dat & 0x0f, dat); | 
 | } | } | 
 | } | } | 
 | else { | else { | 
| Line 44  static void IOOUTCALL opn_o08a(UINT port | Line 44  static void IOOUTCALL opn_o08a(UINT port | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
| static BYTE IOINPCALL opn_i088(UINT port) { | static REG8 IOINPCALL opn_i088(UINT port) { | 
 |  |  | 
 | (void)port; | (void)port; | 
 | return(fmtimer.status); | return(fmtimer.status); | 
 | } | } | 
 |  |  | 
| static BYTE IOINPCALL opn_i08a(UINT port) { | static REG8 IOINPCALL opn_i08a(UINT port) { | 
 |  |  | 
 | if (opn.opn2reg == 0x0e) { | if (opn.opn2reg == 0x0e) { | 
 | return(0xff); | return(0xff); | 
 | } | } | 
 | if (opn.opn2reg < 0x10) { | if (opn.opn2reg < 0x10) { | 
| return(psggen_getreg(&psg2, opn.opn2reg)); | return(psggen_getreg(&psg1, opn.opn2reg)); | 
 | } | } | 
 | (void)port; | (void)port; | 
 | return(0xff); | return(0xff); | 
| Line 65  static BYTE IOINPCALL opn_i08a(UINT port | Line 65  static BYTE IOINPCALL opn_i08a(UINT port | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
| static void IOOUTCALL opna_o188(UINT port, BYTE dat) { | static void IOOUTCALL opna_o188(UINT port, REG8 dat) { | 
 |  |  | 
 | opn.opnreg = dat; | opn.opnreg = dat; | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
| static void IOOUTCALL opna_o18a(UINT port, BYTE dat) { | static void IOOUTCALL opna_o18a(UINT port, REG8 dat) { | 
 |  |  | 
 | S98_put(NORMAL2608, opn.opnreg, dat); | S98_put(NORMAL2608, opn.opnreg, dat); | 
 | if (opn.opnreg < 0x10) { | if (opn.opnreg < 0x10) { | 
 | if (opn.opnreg != 0x0e) { | if (opn.opnreg != 0x0e) { | 
| psggen_setreg(&psg1, opn.opnreg, dat); | psggen_setreg(&psg2, opn.opnreg, dat); | 
 | } | } | 
 | } | } | 
 | else { | else { | 
| Line 88  static void IOOUTCALL opna_o18a(UINT por | Line 88  static void IOOUTCALL opna_o18a(UINT por | 
 | else if (opn.opnreg < 0x30) { | else if (opn.opnreg < 0x30) { | 
 | if (opn.opnreg == 0x28) { | if (opn.opnreg == 0x28) { | 
 | if ((dat & 0x0f) < 3) { | if ((dat & 0x0f) < 3) { | 
| opngen_keyon((dat & 0x0f)+3, dat); | opngen_keyon((dat & 0x0f) + 3, dat); | 
 | } | } | 
 | else if (((dat & 0x0f) != 3) && | else if (((dat & 0x0f) != 3) && | 
 | ((dat & 0x0f) < 7)) { | ((dat & 0x0f) < 7)) { | 
| opngen_keyon((dat & 0x0f)+2, dat); | opngen_keyon((dat & 0x0f) + 2, dat); | 
 | } | } | 
 | } | } | 
 | else { | else { | 
| Line 110  static void IOOUTCALL opna_o18a(UINT por | Line 110  static void IOOUTCALL opna_o18a(UINT por | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
| static void IOOUTCALL opna_o18c(UINT port, BYTE dat) { | static void IOOUTCALL opna_o18c(UINT port, REG8 dat) { | 
 |  |  | 
 | opn.extreg = dat; | opn.extreg = dat; | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
| static void IOOUTCALL opna_o18e(UINT port, BYTE dat) { | static void IOOUTCALL opna_o18e(UINT port, REG8 dat) { | 
 |  |  | 
 | S98_put(EXTEND2608, opn.extreg, dat); | S98_put(EXTEND2608, opn.extreg, dat); | 
 | opn.reg[opn.extreg + 0x100] = dat; | opn.reg[opn.extreg + 0x100] = dat; | 
| Line 133  static void IOOUTCALL opna_o18e(UINT por | Line 133  static void IOOUTCALL opna_o18e(UINT por | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
| static BYTE IOINPCALL opna_i188(UINT port) { | static REG8 IOINPCALL opna_i188(UINT port) { | 
 |  |  | 
 | (void)port; | (void)port; | 
 | return(fmtimer.status); | return(fmtimer.status); | 
 | } | } | 
 |  |  | 
| static BYTE IOINPCALL opna_i18a(UINT port) { | static REG8 IOINPCALL opna_i18a(UINT port) { | 
 |  |  | 
 | if (opn.opnreg == 0x0e) { | if (opn.opnreg == 0x0e) { | 
| return(fmboard_getjoy(&psg1)); | return(fmboard_getjoy(&psg2)); | 
 | } | } | 
 | else if (opn.opnreg < 0x10) { | else if (opn.opnreg < 0x10) { | 
| return(psggen_getreg(&psg1, opn.opnreg)); | return(psggen_getreg(&psg2, opn.opnreg)); | 
 | } | } | 
 | (void)port; | (void)port; | 
 | return(opn.reg[opn.opnreg]); | return(opn.reg[opn.opnreg]); | 
 | } | } | 
 |  |  | 
| static BYTE IOINPCALL opna_i18c(UINT port) { | static REG8 IOINPCALL opna_i18c(UINT port) { | 
 |  |  | 
 | if (opn.extend) { | if (opn.extend) { | 
 | return((fmtimer.status & 3) | (opn.adpcmmask & 8)); | return((fmtimer.status & 3) | (opn.adpcmmask & 8)); | 
| Line 160  static BYTE IOINPCALL opna_i18c(UINT por | Line 160  static BYTE IOINPCALL opna_i18c(UINT por | 
 | return(0xff); | return(0xff); | 
 | } | } | 
 |  |  | 
| static BYTE IOINPCALL opna_i18e(UINT port) { | static REG8 IOINPCALL opna_i18e(UINT port) { | 
 |  |  | 
 | if (opn.extend) { | if (opn.extend) { | 
 | return(opn.reg[opn.opnreg]); | return(opn.reg[opn.opnreg]); | 
| Line 169  static BYTE IOINPCALL opna_i18e(UINT por | Line 169  static BYTE IOINPCALL opna_i18e(UINT por | 
 | return(0xff); | return(0xff); | 
 | } | } | 
 |  |  | 
| static void extendchannel(BYTE enable) { | static void extendchannel(REG8 enable) { | 
 |  |  | 
 | opn.extend = enable; | opn.extend = enable; | 
 | if (enable) { | if (enable) { |