/*VRC7 FLASH MEMORY WRITE generic CPU memory bank cpu address|rom address |page|task $8000-$9fff|0x02000-0x03fff|1 |write (0x2aaa & 0x1fff) + 0x8000 $a000-$bfff|0x04000-0x05fff|2 |write (0x5555 & 0x1fff) + 0xa000 $c000-$dfff|n * 0x2000 |n |write area $e000-$efff|末尾 |fix |boot area, 未使用*/ board <- { mappernum = 85, vram_mirrorfind = false, ppu_ramfind = true, cpu_rom = { banksize = 0x2000, size_max = 4 * mega, size_base = 1 * mega }, cpu_ram = { banksize = 0x2000, size_max = 0x2000, size_base = 0x2000 }, ppu_rom = { banksize = 0x2000 / 8, size_max = 2 * mega, size_base = 1* mega } }; function cpu_dump(d, pagesize, banksize) { for(local i = 0; i < pagesize - 2; i += 2){ cpu_write(d, 0x8000, i); cpu_write(d, 0x8018, i | 1); cpu_read(d, 0x8000, banksize * 2); } cpu_write(d, 0x9000, 0x3e); cpu_read(d, 0xc000, banksize * 2); } function ppu_dump(d, pagesize, banksize) { cpu_write(d, 0xa000, 0); for(local i = 0; i < pagesize; i += 8){ local t = i; for(local j = 0xa000; j < 0xe000; j += 0x1000){ cpu_write(d, j, t++); cpu_write(d, j+0x18, t++); } ppu_read(d, 0, banksize * 8); } } function cpu_ram_access(d, pagesize, banksize) { cpu_write(d, 0xe000, 0x80); cpu_ramrw(d, 0x6000, banksize); cpu_write(d, 0xe000, 0x00); } /* this is RC851/352402 style. RV051/353429 style is not supported. 352402: Program ROM/ Charcter RAM/ Backup RAM/ R1 = A5, R0 = A4/ Extra Sound 353429: Program ROM/ Charcter ROM/ R1 = A3, R0 = ? */ function program_initalize(d, cpu_banksize, ppu_banksize) { cpu_command(d, 0, 0xc000, cpu_banksize); cpu_command(d, 0x2aaa, 0x8000, cpu_banksize); cpu_command(d, 0x5555, 0xa000, cpu_banksize); cpu_write(d, 0x8000, 1); cpu_write(d, 0x8010, 2); cpu_write(d, 0x9000, 0); } function cpu_transfer(d, start, end, cpu_banksize) { for(local i = start; i < end - 1; i += 1){ cpu_write(d, 0x9000, i); cpu_program(d, 0xc000, cpu_banksize); } cpu_program(d, 0xe000, cpu_banksize); } function ppu_transfer(d, start, end, size) { }