/************************************************* sfc/snes hirom dump script cpu_read cpu_write ram_read ram_write 20181108: FIXED SRAM DUMP SUPPORT 32K OR MORE 20190327: Add test script to dump Tengai Makyou Zero *************************************************/ function cpu_dump(d, rom_size, banksize) { //spc7110 /* 0x4834:0xFF enable mmc? 0x4834:0x00 disable mmc? 0x4831: unknow. 0x4832:0x00-0x03 bank to 0xE00000. 0x4833:0x00-0x03 bank to 0xF00000. note: bank0 is rom offset 0x100000,not 0 base. */ cpu_write(d,0x4834,0xFF);//enable spc7110 mmc? for(local i = 0; i < rom_size; i += 0x10000) { if(i<0x100000) cpu_read (d, 0xC00000+(i&0xFFFFF), 0x10000); else { if( (i&0xFFFFF)==0 ) cpu_write(d, 0x4833, (i/0x100000)-1 );//0-3 cpu_read (d, 0xF00000+(i&0xFFFFF), 0x10000); } } cpu_write( d, 0x4834, 0 ); } function save_dump(d, save_size, max_size) { for(local i = 0; i < save_size; i += 0x400) { ram_read (d, 0x306000+(i&0x1FFF)+((i/0x2000)*0x10000), 0x400); } } function save_write(d, save_size, max_size) { for(local i = 0; i < save_size; i += 0x400) { ram_write (d, 0x306000+(i&0x1FFF)+((i/0x2000)*0x10000), 0x400); } }