-
Notifications
You must be signed in to change notification settings - Fork 0
/
sms.h
101 lines (83 loc) · 1.89 KB
/
sms.h
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef _SMS_H_
#define _SMS_H_
enum {
SLOT_BIOS = 0,
SLOT_CARD = 1,
SLOT_CART = 2,
SLOT_EXP = 3
};
enum {
MAPPER_NONE = 0,
MAPPER_SEGA = 1,
MAPPER_CODIES = 2,
MAPPER_KOREAN = 3,
};
enum {
DISPLAY_NTSC = 0,
DISPLAY_PAL = 1
};
enum {
FPS_NTSC = 60,
FPS_PAL = 50
};
enum {
CLOCK_NTSC = 3579545,
CLOCK_PAL = 3579545
};
enum {
CONSOLE_NONE = 0x00,
CONSOLE_SMS = 0x20,
CONSOLE_SMSJ = 0x21,
CONSOLE_SMS2 = 0x22,
CONSOLE_GG = 0x40,
CONSOLE_GGMS = 0x41,
CONSOLE_MD = 0x80,
CONSOLE_MDPBC = 0x81,
CONSOLE_GEN = 0x82,
CONSOLE_GENPBC = 0x83
};
#define HWTYPE_SMS CONSOLE_SMS
#define HWTYPE_GG CONSOLE_GG
#define HWTYPE_MD CONSOLE_MD
#define IS_SMS (sms.console & HWTYPE_SMS)
#define IS_GG (sms.console & HWTYPE_GG)
#define IS_MD (sms.console & HWTYPE_MD)
enum {
TERRITORY_DOMESTIC = 0,
TERRITORY_EXPORT = 1
};
/* SMS context */
typedef struct
{
uint8 wram[0x2000];
uint8 paused;
uint8 save;
uint8 territory;
uint8 console;
uint8 display;
uint8 fm_detect;
uint8 use_fm;
uint8 memctrl;
uint8 ioctrl;
struct {
uint8 pdr; /* Parallel data register */
uint8 ddr; /* Data direction register */
uint8 txdata; /* Transmit data buffer */
uint8 rxdata; /* Receive data buffer */
uint8 sctrl; /* Serial mode control and status */
} sio;
struct {
int type;
} device[2];
} sms_t;
/* Global data */
extern sms_t sms;
extern uint8 dummy_write[0x400];
extern uint8 dummy_read[0x400];
/* Function prototypes */
void sms_init(void);
void sms_reset(void);
void sms_shutdown(void);
void sms_mapper_w(int address, int data);
int sms_irq_callback(int param);
#endif /* _SMS_H_ */