unsigned char *mp3_mem = 0;\r
\r
#define MP3_SIZE_MAX (0x400000 + 0x800000) // 12M\r
-#define CODE940_FILE "pico940_v2.bin"\r
+#define CODE940_FILE "pico940_v3.bin"\r
\r
int crashed_940 = 0;\r
\r
\r
//printf("%05i:%03i: ym w ([%i] %02x)\n", Pico.m.frame_count, Pico.m.scanline, a, v);\r
\r
- switch (a) {\r
+ switch (a)\r
+ {\r
case 0: /* address port 0 */\r
if (addr_A1 == 0 && ST_address == v)\r
return 0; /* address already selected, don't send this command to 940 */\r
addr_A1 = *(INT32 *) (REGS + 0x200);\r
}\r
\r
+void YM2612PicoStateSave2_940(int tat, int tbt)\r
+{\r
+ UINT8 *ym_remote_regs, *ym_local_regs;\r
+ add_job_940(JOB940_PICOSTATESAVE2);\r
+ if (CHECK_BUSY(JOB940_PICOSTATESAVE2)) wait_busy_940(JOB940_PICOSTATESAVE2);\r
+\r
+ ym_remote_regs = (UINT8 *) shared_ctl->writebuff0;\r
+ ym_local_regs = YM2612GetRegs();\r
+ if (*(UINT32 *)(ym_remote_regs + 0x100) != 0x41534d59) {\r
+ printf("code940 didn't return valid save data\n");\r
+ return;\r
+ }\r
+\r
+ /* copy addin data only */\r
+ memcpy(ym_local_regs, ym_remote_regs, 0x20);\r
+ memcpy(ym_local_regs + 0x100, ym_remote_regs + 0x100, 0x30);\r
+ memcpy(ym_local_regs + 0x0b8, ym_remote_regs + 0x0b8, 0x48);\r
+ memcpy(ym_local_regs + 0x1b8, ym_remote_regs + 0x1b8, 0x48);\r
+ *(INT32 *)(ym_local_regs + 0x108) = tat;\r
+ *(INT32 *)(ym_local_regs + 0x10c) = tbt;\r
+}\r
+\r
+int YM2612PicoStateLoad2_940(int *tat, int *tbt)\r
+{\r
+ UINT8 *ym_remote_regs, *ym_local_regs;\r
+ ym_local_regs = YM2612GetRegs();\r
+ ym_remote_regs = (UINT8 *) shared_ctl->writebuff0;\r
+\r
+ if (*(UINT32 *)(ym_local_regs + 0x100) != 0x41534d59)\r
+ return -1;\r
+\r
+ *tat = *(INT32 *)(ym_local_regs + 0x108);\r
+ *tbt = *(INT32 *)(ym_local_regs + 0x10c);\r
+\r
+ if (CHECK_BUSY(JOB940_YM2612UPDATEONE)) wait_busy_940(JOB940_YM2612UPDATEONE);\r
+\r
+ /* flush writes */\r
+ if (shared_ctl->writebuffsel == 1) {\r
+ shared_ctl->writebuff0[writebuff_ptr & 0xffff] = 0xffff;\r
+ } else {\r
+ shared_ctl->writebuff1[writebuff_ptr & 0xffff] = 0xffff;\r
+ }\r
+ shared_ctl->writebuffsel ^= 1;\r
+ writebuff_ptr = 0;\r
+ add_job_940(JOB940_PICOSTATELOAD2_PREP);\r
+ if (CHECK_BUSY(JOB940_PICOSTATELOAD2_PREP)) wait_busy_940(JOB940_PICOSTATELOAD2_PREP);\r
+\r
+ memcpy(ym_remote_regs, ym_local_regs, 0x200);\r
+\r
+ add_job_940(JOB940_PICOSTATELOAD2);\r
+ if (CHECK_BUSY(JOB940_PICOSTATELOAD2)) wait_busy_940(JOB940_PICOSTATELOAD2);\r
+\r
+ return 0;\r
+}\r
+\r
\r
static void internal_reset(void)\r
{\r
if (shared_mem != NULL) return;\r
\r
shared_mem = (unsigned char *) mmap(0, 0x210000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x2000000);\r
- if(shared_mem == MAP_FAILED)\r
+ if (shared_mem == MAP_FAILED)\r
{\r
printf("mmap(shared_data) failed with %i\n", errno);\r
exit(1);\r
\r
extern char **g_argv;\r
\r
-/* none of the functions in this file should be called before this one */\r
void YM2612Init_940(int baseclock, int rate)\r
{\r
printf("YM2612Init_940()\n");\r