| version 1.1, 2004/08/01 05:31:30 | version 1.3, 2004/08/05 11:30:12 | 
| Line 4 | Line 4 | 
 | #include        "iocore.h" | #include        "iocore.h" | 
 | #include        "sndctrl.h" | #include        "sndctrl.h" | 
 | #include        "keystat.h" | #include        "keystat.h" | 
 |  | #include        "x1f.h" | 
 |  |  | 
 |  |  | 
| void IOOUTCALL sndboard_opmreg(UINT port, REG8 value) { | void IOOUTCALL opm_o(UINT port, REG8 dat) { | 
 |  |  | 
| TRACEOUT(("%.4x, %.2x", port, value)); | REG8    lsb; | 
| sndboard.opmreg = (UINT8)value; | REG8    reg; | 
| } |  | 
|  |  | 
| void IOOUTCALL sndboard_opmdat(UINT port, REG8 value) { |  | 
 |  |  | 
| TRACEOUT(("%.4x, %.2x", port, value)); | lsb = (UINT8)port; | 
| opmgen_setreg(sndboard.opmreg, value); | if (lsb == 0x00) {                                      // 0700 | 
|  | sndboard.opmreg = (UINT8)dat; | 
|  | } | 
|  | else if (lsb == 0x01) {                         // 0701 | 
|  | reg = sndboard.opmreg; | 
|  | sndboard.opmdat[reg] = dat; | 
|  | x1f_opm(reg, dat); | 
|  | opmgen_setreg(reg, dat); | 
|  | } | 
|  | else if ((lsb & (~3)) == 0x04) {        // 0704-0707 | 
|  | ctc_o(port, dat); | 
|  | } | 
 | } | } | 
 |  |  | 
| REG8 IOINPCALL sndboard_opmsta(UINT port) { | REG8 IOINPCALL opm_i(UINT port) { | 
|  |  | 
|  | REG8    lsb; | 
 |  |  | 
| if (pccore.SOUND_SW) { | lsb = (UINT8)port; | 
| return(0x00);                                                           // ゼリアード対策 | if ((lsb & (~1)) == 0x00) {                     // 0700/0701 | 
|  | return(0x00);                                                                                   // ゼリアード | 
|  | } | 
|  | else if ((lsb & (~3)) == 0x04) {        // 0704-0707 | 
|  | return(ctc_i(port)); | 
|  | } | 
|  | else { | 
|  | return(0xff); | 
 | } | } | 
 | return(0xff); |  | 
 | } | } | 
 |  |  | 
 |  |  | 
| void IOOUTCALL sndboard_psgreg(UINT port, REG8 value) { | void IOOUTCALL sndboard_psgreg(UINT port, REG8 dat) { | 
 |  |  | 
| sndboard.psgreg = value; | sndboard.psgreg = dat; | 
 | } | } | 
 |  |  | 
| void IOOUTCALL sndboard_psgdat(UINT port, REG8 value) { | void IOOUTCALL sndboard_psgdat(UINT port, REG8 dat) { | 
 |  |  | 
| if (sndboard.psgreg < 0x0e) { | REG8    reg; | 
| psggen_setreg(&psggen, sndboard.psgreg, value); |  | 
|  | reg = sndboard.psgreg; | 
|  | if (reg < 0x0e) { | 
|  | sndboard.psgdat[reg] = dat; | 
|  | x1f_psg(reg, dat); | 
|  | psggen_setreg(&psggen, reg, dat); | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 44  REG8 IOINPCALL sndboard_psgsta(UINT port | Line 66  REG8 IOINPCALL sndboard_psgsta(UINT port | 
 | REG8    ret; | REG8    ret; | 
 |  |  | 
 | if (sndboard.psgreg < 0x0e) { | if (sndboard.psgreg < 0x0e) { | 
| return(psggen_getreg(&psggen, sndboard.psgreg)); | return(sndboard.psgdat[sndboard.psgreg]); | 
 | } | } | 
 | else if (sndboard.psgreg < 0x10) { | else if (sndboard.psgreg < 0x10) { | 
 | ret = 0xff; | ret = 0xff; | 
| Line 73  REG8 IOINPCALL sndboard_psgsta(UINT port | Line 95  REG8 IOINPCALL sndboard_psgsta(UINT port | 
 |  |  | 
 | void sndboard_reset(void) { | void sndboard_reset(void) { | 
 |  |  | 
| sndboard.opmreg = 0; | ZeroMemory(&sndboard, sizeof(sndboard)); | 
| sndboard.psgreg = 0; | CopyMemory(sndboard.psgdat, psggen_deftbl, sizeof(psggen_deftbl)); | 
 | sndctrl_reset(); | sndctrl_reset(); | 
 | } | } | 
 |  |  |