OSDN Git Service

[INITIAL] Import 20141226 version of http://homepage3.nifty.com/takeda-toshiya/common...
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz3500 / main.h
1 /*\r
2         SHARP MZ-3500 Emulator 'EmuZ-3500'\r
3 \r
4         Author : Takeda.Toshiya\r
5         Date   : 2010.08.31-\r
6 \r
7         [ main ]\r
8 */\r
9 \r
10 #ifndef _MAIN_H_\r
11 #define _MAIN_H_\r
12 \r
13 #include "../vm.h"\r
14 #include "../../emu.h"\r
15 #include "../device.h"\r
16 \r
17 #define SIG_MAIN_SACK   0\r
18 #define SIG_MAIN_SRDY   1\r
19 #define SIG_MAIN_INTFD  2\r
20 #define SIG_MAIN_INT0   3\r
21 #define SIG_MAIN_INT1   4\r
22 #define SIG_MAIN_INT2   5\r
23 #define SIG_MAIN_INT3   6\r
24 #define SIG_MAIN_INT4   7\r
25 #define SIG_MAIN_DRQ    8\r
26 #define SIG_MAIN_INDEX  9\r
27 \r
28 class MAIN : public DEVICE\r
29 {\r
30 private:\r
31         DEVICE *d_cpu, *d_subcpu, *d_fdc;\r
32         \r
33         uint8* rbank[32];       // 64KB / 2KB\r
34         uint8* wbank[32];\r
35         uint8 wdmy[0x800];\r
36         uint8 rdmy[0x800];\r
37         uint8 ipl[0x2000];\r
38         uint8 ram[0x40000];\r
39         uint8 common[0x800];\r
40         uint8 basic[0x8000];\r
41         uint8 ext[0x8000];\r
42         \r
43         uint8 ma, ms, mo;\r
44         bool me1, me2;\r
45         \r
46         uint8 srqb, sres;\r
47         bool sack, srdy;\r
48         bool intfd, int0, int1, int2, int3, int4;\r
49         bool me, e1;\r
50         uint8 inp;\r
51         bool motor, drq, index;\r
52         \r
53         void update_irq();\r
54         void update_bank();\r
55         \r
56 public:\r
57         MAIN(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)\r
58         {\r
59                 intfd = int0 = int1 = int2 = int3 = int4 = false;\r
60                 me = e1 = false;\r
61         }\r
62         ~MAIN() {}\r
63         \r
64         // common functions\r
65         void initialize();\r
66         void reset();\r
67         void write_data8(uint32 addr, uint32 data);\r
68         uint32 read_data8(uint32 addr);\r
69         void write_io8(uint32 addr, uint32 data);\r
70         uint32 read_io8(uint32 addr);\r
71         void write_signal(int id, uint32 data, uint32 mask);\r
72         \r
73         // unique functions\r
74         void set_context_cpu(DEVICE* device)\r
75         {\r
76                 d_cpu = device;\r
77         }\r
78         void set_context_subcpu(DEVICE* device)\r
79         {\r
80                 d_subcpu = device;\r
81         }\r
82         void set_context_fdc(DEVICE* device)\r
83         {\r
84                 d_fdc = device;\r
85         }\r
86         uint8 *get_ipl()\r
87         {\r
88                 return ipl;\r
89         }\r
90         uint8 *get_common()\r
91         {\r
92                 return common;\r
93         }\r
94 };\r
95 \r
96 #endif\r
97 \r