OSDN Git Service

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