OSDN Git Service

スクリプトファイルの属性を変更
[unagi/old-svn-converted.git] / client / trunk / anago / irem_g101.ad
1 /*
2 IREM G-101 based cartridge
3
4 $8000-$9fff bank#0, switchable or last - 1
5 $a000-$bfff bank#1, switchable
6 $c000-$dfff bank#2, last - 1 or switchable
7 $e000-$ffff 
8 note:
9 Major League PCB maybe ignore write operation to $9000-$9fff
10 $9000-$9fff write register are fixed to bank #2 = last -1
11 */
12
13 board <- {
14         mappernum = 32,
15         cpu_rom = {
16                 size_base = 1 * mega, size_max = 2 * mega,
17                 banksize = 0x2000
18         },
19         ppu_rom = {
20                 size_base = 1 * mega, size_max = 1 * mega,
21                 banksize = 0x0400
22         },
23         ppu_ramfind = false,
24         vram_mirrorfind = false
25 };
26
27 function cpu_dump(d, pagesize, banksize)
28 {
29         if(false){
30                 cpu_write(d, 0x9000, 0);
31                 for(local i = 0; i < pagesize - 2; i += 2){
32                         cpu_write(d, 0x8000, i);
33                         cpu_write(d, 0xa000, i | 1);
34                         cpu_read(d, 0x8000, banksize * 2);
35                 }
36                 cpu_read(d, 0xc000, banksize);
37                 cpu_read(d, 0xe000, banksize);
38         }else{
39                 cpu_write(d, 0x9000, 2);
40                 for(local i = 0; i < pagesize - 2; i += 2){
41                         cpu_write(d, 0x8000, i);
42                         cpu_write(d, 0xa000, i | 1);
43                         cpu_read(d, 0xc000, banksize);
44                         cpu_read(d, 0xa000, banksize);
45                 }
46                 cpu_read(d, 0x8000, banksize);
47                 cpu_read(d, 0xe000, banksize);
48         }
49 }
50 function ppu_dump(d, pagesize, banksize)
51 {
52         for(local i = 0; i < pagesize ; i += 8){
53                 for(local j = 0; j < 8; j += 1){
54                         cpu_write(d, 0xb000 + j, i + j);
55                 }
56                 ppu_read(d, 0, banksize * 8);
57         }
58 }
59
60 function program_initalize(d, cpu_banksize, ppu_banksize)
61 {
62         cpu_write(d, 0x9000, 0);
63         cpu_write(d, 0x8000, 0);
64         cpu_command(d, 0, 0x8000, cpu_banksize);
65         cpu_command(d, 0x02aa, 0xc000, cpu_banksize);
66         cpu_command(d, 0x0555, 0xc000, cpu_banksize);
67         cpu_write(d, 0xb000, [0xa, 0x15, 0]);
68         cpu_command(d, 0x2aaa, 0x0000, ppu_banksize);
69         cpu_command(d, 0x5555, 0x0400, ppu_banksize);
70         cpu_command(d, 0, 0x0800, ppu_banksize);
71 }
72
73 function cpu_transfer(d, start, end, cpu_banksize)
74 {
75         for(local i = start; i < end - 1; i += 1){
76                 cpu_write(d, 0x8000, i);
77                 cpu_program(d, 0x8000, cpu_banksize);
78         }
79         cpu_program(d, 0xc000, cpu_banksize);
80 }
81
82 function ppu_transfer(d, start, end, ppu_banksize)
83 {
84         for(local i = start; i < end; i +=4){
85                 cpu_write(d, 0xb004, [i, i+1, i+2, i+3]);
86                 ppu_program(d, 0x1000, ppu_banksize * 4);
87         }
88 }