Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
84 lines (75 sloc) 2.01 KB
/*
HVC-2I Fire Emblem Gaiden
command line option
./anago d22 mmc4_fkrom.ae hvc_2i.nes b
*/
board <- {
mappernum = 10, vram_mirrorfind = false, ppu_ramfind = false,
cpu_rom = {
size_base = 1 * mega, size_max = 2 * mega,
banksize = 0x4000,
},
cpu_ram = {
size_base = 0x2000, size_max = 0x2000,
banksize = 0x2000,
},
ppu_rom = {
size_base = 0x10000, size_max = 1 * mega,
banksize = 0x1000
}
};
/*
[cpu memmorymap - read]
$6000-$7fff SRAM (battery backuped, optional)
$8000-$bfff program ROM bank #0
$c000-$ffff program ROM bank #1 (fixed)
[cpu memmorymap - write]
$a000-$afff program ROM bank register #0
$b000-$bfff charcter ROM bank register #0
$c000-$cfff charcter ROM bank register #1
$d000-$dfff charcter ROM bank register #2
$d000-$dfff charcter ROM bank register #3
[ppu memorymap - read]
0x0000-0x0fff charcter ROM bank #A (#0 or #1)
0x0fd0-0x0fdf charcter ROM bank register switch to #0
0x0fe0-0x0fef charcter ROM bank register switch to #1
0x1000-0x1fff charcter ROM bank #B (#2 or #3)
0x1fd0-0x1fdf charcter ROM bank register switch to #2
0x1fe0-0x1fef charcter ROM bank register switch to #3
*/
function cpu_dump(d, pagesize, banksize)
{
for(local i = 0; i < pagesize - 1; i += 1){
cpu_write(d, 0xa000, i);
cpu_read(d, 0x8000, banksize);
}
cpu_read(d, 0xc000, banksize);
}
/*
PPU の read 途中にバンクレジスタが切り替わるらしいので下記の処理で
同じデータを得るようにする。
PPU address register
0x0000-0x0fdf -> #0
0x0fe0-0x0fff -> #1
0x1000-0x1fdf -> #2
0x1fe0-0x1fff -> #3
ppu_read 前に #0 + #1 , #2 + #3 の内容は同じにしておく。
*/
function ppu_dump(d, pagesize, banksize)
{
for(local i = 0; i < pagesize; i += 2){
ppu_read(d, 0x0fd0, 0);
cpu_write(d, 0xb000, i);
ppu_read(d, 0x0fe0, 0);
cpu_write(d, 0xc000, i);
ppu_read(d, 0x1fd0, 0);
cpu_write(d, 0xd000, i + 1);
ppu_read(d, 0x1fe0, 0);
cpu_write(d, 0xe000, i + 1);
ppu_read(d, 0, banksize * 2);
}
}
function cpu_ram_access(d, pagesize, banksize)
{
cpu_ramrw(d, 0x6000, banksize);
}