/************************************************* 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 //cpu_write(d,0x4831,1); 0xD00000-0xDFFFFF //cpu_write(d,0x4832,2); 0xE00000-0xEFFFFF //cpu_write(d,0x4833,3); 0xF00000-0xFFFFFF if(rom_size>0x400000)//spc7110 Tengai Makyou Zero (Japan) { cpu_write(d,0x4834,0xFF);//enable spc7110 mmc? //dump first 1MB,always fixed at C00000 for(local i = 0; i < 0x100000; i += 0x10000) { cpu_read (d, 0xC00000+i, 0x10000); } //dump next roms for(local i = 0; i < (rom_size-0x100000); i += 0x10000) { if((i%0x100000)==0) cpu_write(d,0x4831,(i/0x100000)+1); cpu_read (d, 0xD00000+i&0xFFFFF, 0x10000); } cpu_write(d,0x4834,0x00); } else for(local i = 0; i < rom_size; i += 0x10000) { if(i<0x400000) cpu_read (d, 0xC00000+i, 0x10000); else cpu_read (d, 0x000000+i, 0x10000); } } 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 += 0x200) { ram_write (d, 0x306000+(i&0x1FFF)+((i/0x2000)*0x10000), 0x200); } }