OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[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 pcb ]
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 namespace MZ3500 {
29
30 class MAIN : public DEVICE
31 {
32 private:
33         DEVICE *d_maincpu, *d_subcpu, *d_fdc;
34         
35         uint8_t* rbank[32];     // 64KB / 2KB
36         uint8_t* wbank[32];
37         uint8_t wdmy[0x800];
38         uint8_t rdmy[0x800];
39         uint8_t ipl[0x2000];
40         uint8_t ram[0x40000];
41         uint8_t common[0x800];
42         uint8_t basic[0x8000];
43         uint8_t ext[0x8000];
44         
45         uint8_t ma, ms, mo;
46         bool me1, me2;
47         
48         uint8_t srqb, sres;
49         bool sack, srdy;
50         bool intfd, int0, int1, int2, int3, int4;
51         bool me, e1;
52         uint8_t inp;
53         bool motor, drq, index;
54         
55         bool crt_400line;
56         
57         void update_irq();
58         void update_bank();
59         
60 public:
61         MAIN(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
62         {
63                 intfd = int0 = int1 = int2 = int3 = int4 = false;
64                 me = e1 = false;
65                 set_device_name(_T("Memory Bus(MAIN)"));
66         }
67         ~MAIN() {}
68         
69         // common functions
70         void initialize();
71         void reset();
72         void write_data8(uint32_t addr, uint32_t data);
73         uint32_t read_data8(uint32_t addr);
74         uint32_t fetch_op(uint32_t addr, int *wait);
75         void write_io8(uint32_t addr, uint32_t data);
76         uint32_t read_io8(uint32_t addr);
77         void write_signal(int id, uint32_t data, uint32_t mask);
78         bool process_state(FILEIO* state_fio, bool loading);
79         
80         // unique functions
81         void set_context_maincpu(DEVICE* device)
82         {
83                 d_maincpu = device;
84         }
85         void set_context_subcpu(DEVICE* device)
86         {
87                 d_subcpu = device;
88         }
89         void set_context_fdc(DEVICE* device)
90         {
91                 d_fdc = device;
92         }
93         uint8_t *get_ipl()
94         {
95                 return ipl;
96         }
97         uint8_t *get_common()
98         {
99                 return common;
100         }
101 };
102
103 }
104 #endif
105