forked from arantius/anago-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
konami_vrc7.ag
69 lines (66 loc) · 1.95 KB
/
konami_vrc7.ag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*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 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, banksize)
{
for(local i = start; i < end - 1; i += 1){
cpu_write(d, 0x9000, i);
cpu_program(d, 0xc000, banksize);
}
cpu_program(d, 0xe000, banksize);
}
function ppu_transfer(d, start, end, size)
{
}