|
|
| version 1.1, 2003/10/16 17:58:00 | version 1.9, 2007/11/03 00:00:19 |
|---|---|
| Line 9 | Line 9 |
| #include "s98.h" | #include "s98.h" |
| static void IOOUTCALL ymf_o188(UINT port, BYTE dat) { | static void IOOUTCALL ymf_o188(UINT port, REG8 dat) { |
| opn.opnreg = dat; | opn.addr = dat; |
| opn.data = dat; | |
| (void)port; | (void)port; |
| } | } |
| static void IOOUTCALL ymf_o18a(UINT port, BYTE dat) { | static void IOOUTCALL ymf_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) { |
| 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 38 static void IOOUTCALL ymf_o18a(UINT port | Line 46 static void IOOUTCALL ymf_o18a(UINT port |
| } | } |
| } | } |
| else { | else { |
| fmtimer_setreg(opn.opnreg, dat); | fmtimer_setreg(addr, dat); |
| } | } |
| } | } |
| 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 ymf_o18c(UINT port, BYTE dat) { | static void IOOUTCALL ymf_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 ymf_o18e(UINT port, BYTE dat) { | static void IOOUTCALL ymf_o18e(UINT port, REG8 dat) { |
| UINT addr; | |
| S98_put(EXTEND2608, opn.extreg, dat); | if (!opn.extend) { |
| opn.reg[opn.extreg + 0x100] = dat; | return; |
| if (opn.extreg >= 0x30) { | } |
| sound_sync(); | opn.data = dat; |
| opngen_setreg(3, opn.extreg, 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 73 static void IOOUTCALL ymf_o18e(UINT port | Line 93 static void IOOUTCALL ymf_o18e(UINT port |
| (void)port; | (void)port; |
| } | } |
| static BYTE IOINPCALL ymf_i188(UINT port) { | static REG8 IOINPCALL ymf_i188(UINT port) { |
| (void)port; | (void)port; |
| return(fmtimer.status); | return(fmtimer.status); |
| } | } |
| static BYTE IOINPCALL ymf_i18a(UINT port) { | static REG8 IOINPCALL ymf_i18a(UINT port) { |
| UINT addr; | |
| if (opn.opnreg == 0x0e) { | 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)); |
| } | } |
| (void)port; | else if (addr == 0xff) { |
| return(opn.reg[opn.opnreg]); | return(1); |
| } | } |
| else { | |
| static BYTE IOINPCALL ymf_i18c(UINT port) { | (void)port; |
| return(opn.data); | |
| if (opn.extend) { | |
| return(fmtimer.status & 3); | |
| } | } |
| (void)port; | |
| return(0xff); | |
| } | } |
| static BYTE IOINPCALL ymf_i18e(UINT port) { | static REG8 IOINPCALL ymf_i18c(UINT port) { |
| if (opn.extend) { | if (opn.extend) { |
| return(opn.reg[opn.opnreg]); | return(fmtimer.status & 3); |
| } | } |
| (void)port; | (void)port; |
| return(0xff); | return(0xff); |
| } | } |
| static void extendchannel(BYTE enable) { | static void extendchannel(REG8 enable) { |
| opn.extend = enable; | opn.extend = enable; |
| if (enable) { | if (enable) { |
| Line 123 static void extendchannel(BYTE enable) { | Line 142 static void extendchannel(BYTE enable) { |
| } | } |
| } | } |
| static void IOOUTCALL ymf_oa460(UINT port, BYTE dat) { | static void IOOUTCALL ymf_oa460(UINT port, REG8 dat) { |
| cs4231.extfunc = dat; | cs4231.extfunc = dat; |
| extendchannel((BYTE)(dat & 1)); | extendchannel((REG8)(dat & 1)); |
| (void)port; | (void)port; |
| } | } |
| static BYTE IOINPCALL ymf_ia460(UINT port) { | static REG8 IOINPCALL ymf_ia460(UINT port) { |
| (void)port; | (void)port; |
| return(0x80 | (cs4231.extfunc & 1)); | return(0x80 | (cs4231.extfunc & 1)); |
| Line 143 static const IOOUT ymf_o[4] = { | Line 162 static const IOOUT ymf_o[4] = { |
| ymf_o188, ymf_o18a, ymf_o18c, ymf_o18e}; | ymf_o188, ymf_o18a, ymf_o18c, ymf_o18e}; |
| static const IOINP ymf_i[4] = { | static const IOINP ymf_i[4] = { |
| ymf_i188, ymf_i18a, ymf_i18c, ymf_i18e}; | ymf_i188, ymf_i18a, ymf_i18c, NULL}; |
| void board118_reset(void) { | void board118_reset(const NP2CFG *pConfig) { |
| fmtimer_reset(0xc0); | fmtimer_reset(0xc0); |
| opngen_setcfg(3, OPN_STEREO | 0x038); | opngen_setcfg(3, OPN_STEREO | 0x038); |
| cs4231io_reset(); | cs4231io_reset(); |
| soundrom_load(0xcc000, "118"); | soundrom_load(0xcc000, OEMTEXT("118")); |
| fmboard_extreg(extendchannel); | fmboard_extreg(extendchannel); |
| (void)pConfig; | |
| } | } |
| void board118_bind(void) { | void board118_bind(void) { |
| fmboard_fmrestore(0, 0); | |
| fmboard_fmrestore(3, 1); | |
| psggen_restore(&psg1); | |
| fmboard_rhyrestore(&rhythm, 0); | |
| sound_streamregist(&opngen, (SOUNDCB)opngen_getpcm); | sound_streamregist(&opngen, (SOUNDCB)opngen_getpcm); |
| sound_streamregist(&psg1, (SOUNDCB)psggen_getpcm); | sound_streamregist(&psg1, (SOUNDCB)psggen_getpcm); |
| sound_streamregist(&rhythm, (SOUNDCB)rhythm_getpcm); | rhythm_bind(&rhythm); |
| cs4231io_bind(); | cs4231io_bind(); |
| cbuscore_attachsndex(0x188, ymf_o, ymf_i); | cbuscore_attachsndex(0x188, ymf_o, ymf_i); |
| iocore_attachout(0xa460, ymf_oa460); | iocore_attachout(0xa460, ymf_oa460); |