int addr;\r
\r
a &= 3;\r
- if (a == 1 && ym2612.OPN.ST.address == 0x2a) /* DAC data */\r
- {\r
- int cycles = is_from_z80 ? z80_cyclesDone() : z80_cycles_from_68k();\r
- //elprintf(EL_STATUS, "%03i dac w %08x z80 %i", cycles, d, is_from_z80);\r
- if (ym2612.dacen)\r
- PsndDoDAC(cycles);\r
- ym2612.dacout = ((int)d - 0x80) << 6;\r
- return 0;\r
- }\r
-\r
switch (a)\r
{\r
case 0: /* address port 0 */\r
+ case 2: /* address port 1 */\r
ym2612.OPN.ST.address = d;\r
- ym2612.addr_A1 = 0;\r
+ ym2612.addr_A1 = (a & 2) >> 1;\r
#ifdef __GP2X__\r
if (PicoIn.opt & POPT_EXT_FM) YM2612Write_940(a, d, -1);\r
#endif\r
return 0;\r
\r
case 1: /* data port 0 */\r
- if (ym2612.addr_A1 != 0)\r
- return 0;\r
-\r
- addr = ym2612.OPN.ST.address;\r
+ case 3: /* data port 1 */\r
+ addr = ym2612.OPN.ST.address | ((int)ym2612.addr_A1 << 8);\r
ym2612.REGS[addr] = d;\r
\r
switch (addr)\r
}\r
return 0;\r
}\r
+ case 0x2a: { /* DAC data */\r
+ int cycles = is_from_z80 ? z80_cyclesDone() : z80_cycles_from_68k();\r
+ //elprintf(EL_STATUS, "%03i dac w %08x z80 %i", cycles, d, is_from_z80);\r
+ if (ym2612.dacen)\r
+ PsndDoDAC(cycles);\r
+ ym2612.dacout = ((int)d - 0x80) << 6;\r
+ return 0;\r
+ }\r
case 0x2b: { /* DAC Sel (YM2612) */\r
ym2612.dacen = d & 0x80;\r
#ifdef __GP2X__\r
}\r
}\r
break;\r
-\r
- case 2: /* address port 1 */\r
- ym2612.OPN.ST.address = d;\r
- ym2612.addr_A1 = 1;\r
-#ifdef __GP2X__\r
- if (PicoIn.opt & POPT_EXT_FM) YM2612Write_940(a, d, -1);\r
-#endif\r
- return 0;\r
-\r
- case 3: /* data port 1 */\r
- if (ym2612.addr_A1 != 1)\r
- return 0;\r
-\r
- addr = ym2612.OPN.ST.address | 0x100;\r
- ym2612.REGS[addr] = d;\r
- break;\r
}\r
\r
#ifdef __GP2X__\r