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 / fp1100 / main.h
1 /*
2         CASIO FP-1100 Emulator 'eFP-1100'
3
4         Author : Takeda.Toshiya
5         Date   : 2010.06.17-
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_INTS   0
18 #define SIG_MAIN_INTA   1
19 #define SIG_MAIN_INTB   2
20 #define SIG_MAIN_INTC   3
21 #define SIG_MAIN_INTD   4
22 #define SIG_MAIN_COMM   5
23
24 class MAIN : public DEVICE
25 {
26 private:
27         // to main cpu
28         DEVICE *d_cpu;
29         // to sub pcb
30         DEVICE *d_sub;
31         // to slots
32         DEVICE *d_slot[8];
33         
34         uint8 *wbank[16];
35         uint8 *rbank[16];
36         uint8 wdmy[0x1000];
37         uint8 rdmy[0x1000];
38         uint8 ram[0x10000];
39         uint8 rom[0x9000];
40         
41         uint8 comm_data;
42         bool rom_sel;
43         uint8 slot_sel;
44         uint8 intr_mask;
45         uint8 intr_req;
46         
47         void update_memory_map();
48         void update_intr();
49         
50 public:
51         MAIN(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
52         {
53                 intr_mask = intr_req = 0;
54         }
55         ~MAIN() {}
56         
57         // common functions
58         void initialize();
59         void reset();
60         void write_data8(uint32 addr, uint32 data);
61         uint32 read_data8(uint32 addr);
62         void write_io8(uint32 addr, uint32 data);
63         uint32 read_io8(uint32 addr);
64         void write_signal(int id, uint32 data, uint32 mask);
65         uint32 intr_ack();
66         void intr_reti();
67         void save_state(FILEIO* state_fio);
68         bool load_state(FILEIO* state_fio);
69         
70         // unique functions
71         void set_context_cpu(DEVICE *device)
72         {
73                 d_cpu = device;
74         }
75         void set_context_sub(DEVICE *device)
76         {
77                 d_sub = device;
78         }
79         void set_context_slot(int slot, DEVICE *device)
80         {
81                 d_slot[slot] = device;
82         }
83 };
84
85 #endif