forked from arantius/anago-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_Sunsoft5.ad
75 lines (69 loc) · 1.99 KB
/
_Sunsoft5.ad
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
70
71
72
73
74
75
// From http://bakutendo.blog87.fc2.com/blog-entry-189.html
// とsunsoft5(マッパ69)
/*
SUNSOFT 5A[PRG:MAX 2M]
バットマン
SUNSOFT 5B[拡張音源]
ギミック
FME-7[PRG:MAX 4M] & SUNSOFT 5B[拡張音源]?
炎の闘球児ドッジ弾平
FME-7+BB[PRG:MAX 4M]
バーコードワールド
炎の闘球児ドッジ弾平2
CPU Memmory Bank
cpu address|rom address |page|task
$8000-$9fff|0x02000-0x03fff|1 |write 0x2aaa
$a000-$bfff|0x04000-0x05fff|2 |write 0x5555
$c000-$dfff|0x02000*n |n |write area
$e000-$ffff|末尾 |fix |
PPU Memmory Bank
ppu address|rom address |page|task
$0000-$03ff|0x02800-0x02bff|0x0a|write 0x02aaa
$0400-$07ff|0x05400-0x057ff|0x15|write 0x05555
$0800-$0bff|未使用
$0c00-$0fff|未使用
$1000-$1FFF|0x1000*n |n |write area
*/
board <- {
mappernum = 69, vram_mirrorfind = false,
cpu = {banksize = 0x2000, maxsize = 4 * mega},
ppu = {banksize = 0x0400, maxsize = 2 * mega},
};
function initalize(d, cpu_banksize, ppu_banksize)
{
cpu_command(d, 0x2aaa, 0x8000, cpu_banksize);
cpu_command(d, 0x5555, 0xa000, cpu_banksize);
cpu_write(d, 0x8000, 0x09);
cpu_write(d, 0xa000, 1);
cpu_write(d, 0x8000, 0x0a);
cpu_write(d, 0xa000, 2);
ppu_command(d, 0x2aaa, 0x0000, ppu_banksize);
ppu_command(d, 0x5555, 0x0400, ppu_banksize);
cpu_write(d, 0x8000, 0);
cpu_write(d, 0xa000, 0x0a);
cpu_write(d, 0x8000, 1);
cpu_write(d, 0xa000, 0x15);
}
function cpu_transfer(d, start, end, cpu_banksize)
{
for(local i = start; i < end - 1; i += 1){
cpu_write(d, 0x8000, 0x0b);
cpu_write(d, 0xa000, i);
cpu_program(d, 0xc000, cpu_banksize);
}
cpu_program(d, 0xe000, cpu_banksize)
}
function ppu_transfer(d, start, end, ppu_banksize)
{
for(local i = start; i < end; i += 4){
cpu_write(d, 0x8000, 4);
cpu_write(d, 0xa000, i);
cpu_write(d, 0x8000, 5);
cpu_write(d, 0xa000, i | 1);
cpu_write(d, 0x8000, 6);
cpu_write(d, 0xa000, i | 2);
cpu_write(d, 0x8000, 7);
cpu_write(d, 0xa000, i | 3);
ppu_program(d, 0x1000, ppu_banksize * 4);
}
}