OSDN Git Service

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