static void galpani2_mcu_nmi(void) { UINT32 mcu_list, mcu_command, mcu_address, mcu_src, mcu_dst, mcu_size; /* "Last Check" */ galpani2_write_kaneko(); for ( mcu_list = 0x100020; mcu_list < (0x100020 + 0x40); mcu_list += 4 ) { mcu_command = cpunum_read_byte(0, mcu_list + 1 ); mcu_address = 0x100000 + (cpunum_read_byte(0, mcu_list + 2)<<8) + (cpunum_read_byte(0, mcu_list + 3)<<0) ; switch (mcu_command) { case 0x00: break; case 0x0a: // Copy N bytes from RAM1 to RAM2 mcu_src = (cpunum_read_byte(0, mcu_address + 2)<<8) + (cpunum_read_byte(0, mcu_address + 3)<<0) ; mcu_dst = (cpunum_read_byte(0, mcu_address + 6)<<8) + (cpunum_read_byte(0, mcu_address + 7)<<0) ; mcu_size = (cpunum_read_byte(0, mcu_address + 8)<<8) + (cpunum_read_byte(0, mcu_address + 9)<<0) ; logerror("CPU #0 PC %06X : MCU executes command $A, %04X %02X-> %04x\n",activecpu_get_pc(),mcu_src,mcu_size,mcu_dst); for( ; mcu_size > 0 ; mcu_size-- ) { mcu_src &= 0xffff; mcu_dst &= 0xffff; cpunum_write_byte(1,0x100000 + mcu_dst,cpunum_read_byte(0,0x100000 + mcu_src)); mcu_src ++; mcu_dst ++; } /* Raise a "job done" flag */ cpunum_write_byte(0,mcu_address+0,0xff); cpunum_write_byte(0,mcu_address+1,0xff); break; default: /* Raise a "job done" flag */ cpunum_write_byte(0,mcu_address+0,0xff); cpunum_write_byte(0,mcu_address+1,0xff); logerror("CPU #0 PC %06X : MCU ERROR, unknown command %02X\n",activecpu_get_pc(),mcu_command); } /* Erase command? */ cpunum_write_byte(0,mcu_list + 1,0x00); } }
void galpani2_mcu_run(void) { int i,x; /* Write "KANEKO" to 100000-100005, but do not clash with ram test */ x = 0; for (i = 0x100000; i < 0x100007; i++) x |= cpunum_read_byte(0,i); if ( x == 0 ) { galpani2_write_kaneko(); cpunum_write_byte(1,0x100006,1); logerror("MCU executes CHECK0\n"); } }
static void galpani2_mcu_nmi2(running_machine *machine) { galpani2_write_kaneko(machine->device("maincpu")); //logerror("%s : MCU executes CHECKs synchro\n", cpuexec_describe_context(machine)); }