|
|
| version 1.1, 2004/08/01 05:31:30 | version 1.5, 2004/08/12 17:57:36 |
|---|---|
| Line 2 | Line 2 |
| #include "joymng.h" | #include "joymng.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "sound.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) { |
| if (pccore.SOUND_SW) { | REG8 lsb; |
| return(0x00); // ゼリアード対策 | |
| lsb = (UINT8)port; | |
| 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)port; | |
| } | } |
| 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); | |
| } | } |
| (void)port; | |
| } | } |
| REG8 IOINPCALL sndboard_psgsta(UINT port) { | REG8 IOINPCALL sndboard_psgsta(UINT port) { |
| Line 44 REG8 IOINPCALL sndboard_psgsta(UINT port | Line 69 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 64 REG8 IOINPCALL sndboard_psgsta(UINT port | Line 89 REG8 IOINPCALL sndboard_psgsta(UINT port |
| return(ret); | return(ret); |
| } | } |
| else { | else { |
| (void)port; | |
| return(0xff); | return(0xff); |
| } | } |
| } | } |
| Line 71 REG8 IOINPCALL sndboard_psgsta(UINT port | Line 97 REG8 IOINPCALL sndboard_psgsta(UINT port |
| // ---- | // ---- |
| void sndboard_update(void) { | |
| UINT i; | |
| for (i=0; i<14; i++) { | |
| psggen_setreg(&psggen, (REG8)i, sndboard.psgdat[i]); | |
| } | |
| for (i=0x20; i<0x100; i++) { | |
| opmgen_setreg((REG8)i, sndboard.opmdat[i]); | |
| } | |
| } | |
| 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(); |
| } | } |