-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathboard.c
61 lines (48 loc) · 1.58 KB
/
board.c
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
// Copyright 2008-2010 Segher Boessenkool <[email protected]>
// Licensed under the terms of the GNU GPL, version 2
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
#include <stdio.h>
#include "types.h"
#include "emu.h"
#include "platform.h"
#include "board.h"
struct board *board;
static struct board *board_detect(void)
{
if (mem[0x19792] == 0x4311 && mem[0x19794] == 0x4e43) // VII
return &board_VII;
if (mem[0x42daa] == 0x4311 && mem[0x42dac] == 0x4e43) // VC1
return &board_VII;
if (mem[0x3ecb9] == 0x4311 && mem[0x3ecbb] == 0x4e43) // VC2
return &board_VII;
if (mem[0x3ff1c] == 0x4311 && mem[0x3ff1e] == 0x4e43) // Wireless 60
return &board_W60;
if (mem[0x7e5a8] == 0x4311 && mem[0x7e5aa] == 0x4e43) // Zone 60
return &board_W60;
if (mem[0xb1c6] == 0x9311 && mem[0xb1c8] == 0x4501 &&
mem[0xb1c9] == 0x5e44)
return &board_WAL;
if (mem[0x5ce1] == 0x42c2 && mem[0x5ce2] == 0x5e42)
return &board_BAT;
if (mem[0x5675c] == 0x9311 && mem[0x5675e] == 0x4240 && // Winnie
mem[0x5675f] == 0x4e44)
return &board_V_X;
return &board_V_X;
return 0;
}
void board_init(void)
{
board = board_detect();
if (board == 0) {
warn("couldn't detect board\n");
board = &board_dummy;
}
else if (board == &board_VII) printf("detected Vii\n");
else if (board == &board_W60) printf("detected Wireless60\n");
else if (board == &board_WAL) printf("detected Wall-E\n");
else if (board == &board_BAT) printf("detected Batman\n");
else if (board == &board_V_X) printf("detected V.Smile\n");
else printf("detected unknown board\n");
if (board->init)
board->init();
}