#include "../common/arm_utils.h"\r
#include "../common/menu.h"\r
#include "../../Pico/PicoInt.h"\r
+#include "../../Pico/sound/ym2612.h"\r
#include "../../Pico/sound/mix.h"\r
\r
/* we will need some gp2x internals here */\r
/* these will be managed locally on our side */\r
extern int *ym2612_dacen;\r
extern INT32 *ym2612_dacout;\r
-extern void *ym2612_regs;\r
-\r
static UINT8 *REGS = 0; /* we will also keep local copy of regs for savestates and such */\r
-static INT32 addr_A1; /* address line A1 */\r
-static int dacen;\r
+static INT32 *addr_A1; /* address line A1 */\r
+\r
+static int dacen;\r
static INT32 dacout;\r
static UINT8 ST_address; /* address register */\r
static UINT8 ST_status; /* status flag */\r
\r
switch( a ) {\r
case 0: /* address port 0 */\r
- if (!addr_A1 && ST_address == v)\r
+ if (!*addr_A1 && ST_address == v)\r
return 0; /* address already selected, don't send this command to 940 */\r
ST_address = v;\r
/* don't send DAC or timer related address changes to 940 */\r
- if (!addr_A1 && (v & 0xf0) == 0x20 &&\r
+ if (!*addr_A1 && (v & 0xf0) == 0x20 &&\r
(v == 0x24 || v == 0x25 || v == 0x26 || v == 0x2a))\r
return 0;\r
- addr_A1 = 0;\r
+ *addr_A1 = 0;\r
upd = 0;\r
break;\r
\r
case 1: /* data port 0 */\r
- if (addr_A1 != 0) {\r
+ if (*addr_A1 != 0) {\r
return 0; /* verified on real YM2608 */\r
}\r
\r
break;\r
\r
case 2: /* address port 1 */\r
- if (addr_A1 && ST_address == v)\r
+ if (*addr_A1 && ST_address == v)\r
return 0;\r
ST_address = v;\r
- addr_A1 = 1;\r
+ *addr_A1 = 1;\r
upd = 0;\r
break;\r
\r
case 3: /* data port 1 */\r
- if (addr_A1 != 1) {\r
+ if (*addr_A1 != 1) {\r
return 0; /* verified on real YM2608 */\r
}\r
\r
\r
void YM2612PicoStateLoad_940(void)\r
{\r
- int i, old_A1 = addr_A1;\r
+ int i, old_A1 = *addr_A1;\r
\r
/* make sure JOB940_PICOSTATELOAD gets done before next JOB940_YM2612UPDATEONE */\r
add_job_940(JOB940_PICOSTATELOAD);\r
YM2612Write_940(3, REGS[i|0x100]);\r
}\r
\r
- addr_A1 = old_A1;\r
+ *addr_A1 = old_A1;\r
}\r
\r
\r
ST_TAC = 0;\r
ST_TB = 0;\r
ST_TBC = 0;\r
- dacen = 0;\r
+ dacen = 0;\r
+ dacout = 0;\r
+ ST_address= 0;\r
}\r
\r
\r
memset(shared_data, 0, sizeof(*shared_data));\r
memset(shared_ctl, 0, sizeof(*shared_ctl));\r
\r
+ /* cause local ym2612 to init REGS */\r
+ YM2612Init_(baseclock, rate);\r
+\r
REGS = YM2612GetRegs();\r
+ addr_A1 = (INT32 *) (REGS + 0x200);\r
\r
ym2612_dacen = &dacen;\r
ym2612_dacout = &dacout;\r