OSDN Git Service

ram dump 対応
[unagi/old-svn-converted.git] / client / trunk / anago / nintendo_cnrom.af
1 board <- {
2         mappernum = 3,
3         cpu_rom = {
4                 size_base = 0x8000, size_max = 0x8000
5                 banksize = 0x8000
6         },
7         ppu_rom= {
8                 size_base = 0x8000, size_max = 0x8000,
9                 banksize = 0x2000
10         },
11         ppu_ramfind = false, vram_mirrorfind = true
12 };
13 function cpu_dump(d, pagesize, banksize)
14 {
15         cpu_read(d, 0x8000, 0x4000);
16         cpu_read(d, 0xc000, 0x4000);
17 }
18 function ppu_dump(d, pagesize, banksize)
19 {
20         local security = 0; //0,1,2,3 or don't care
21         security = security << 4;
22         for(local i = 0; i < pagesize; i++){
23                 cpu_write(d, 0x8000, security | i);
24                 ppu_read(d, 0, banksize);
25         }
26 }
27
28 function program_initalize(d, cpu_banksize, ppu_banksize)
29 {
30         cpu_write(d, 0x8000, 0x30);
31         cpu_command(d, 0, 0x8000, cpu_banksize);
32         cpu_command(d, 0x02aa, 0xc000, cpu_banksize);
33         cpu_command(d, 0x0555, 0xc000, cpu_banksize);
34         ppu_command(d, 0, 0x0000, ppu_banksize);
35         ppu_command(d, 0x02aa, 0x0000, ppu_banksize);
36         ppu_command(d, 0x0555, 0x0000, ppu_banksize);
37 }
38
39 function cpu_transfer(d, start, end, cpu_banksize)
40 {
41         if(cpu_banksize == 0x8000){
42                 cpu_program(d, 0x8000, 0x4000);
43         }
44         cpu_program(d, 0xc000, 0x4000);
45 }
46
47 function ppu_transfer(d, start, end, ppu_banksize)
48 {
49         for(local i = start; i < end; i++){
50                 cpu_write(d, 0x8000, 0xf0 | i);
51                 ppu_program(d, 0x0000, ppu_banksize);
52         }
53 }