OSDN Git Service

[General] Tracking to upstream, rev 2015-01-14.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz2500 / memory80b.h
1 /*\r
2         SHARP MZ-80B Emulator 'EmuZ-80B'\r
3         SHARP MZ-2200 Emulator 'EmuZ-2200'\r
4 \r
5         Author : Takeda.Toshiya\r
6         Date   : 2013.03.14-\r
7 \r
8         [ memory/crtc ]\r
9 */\r
10 \r
11 #ifndef _MEMORY_80B_H_\r
12 #define _MEMORY_80B_H_\r
13 \r
14 #include "../vm.h"\r
15 #include "../../emu.h"\r
16 #include "../device.h"\r
17 \r
18 #define SIG_MEMORY_VRAM_SEL     0\r
19 #define SIG_CRTC_WIDTH80        1\r
20 #define SIG_CRTC_REVERSE        2\r
21 \r
22 class Z80;\r
23 \r
24 class MEMORY : public DEVICE\r
25 {\r
26 private:\r
27         Z80 *d_cpu;\r
28         DEVICE *d_pio;\r
29         \r
30         // memory\r
31         uint8* rbank[32];\r
32         uint8* wbank[32];\r
33         bool is_vram[32];\r
34         uint8 wdmy[0x800];\r
35         uint8 rdmy[0x800];\r
36         uint8 ram[0x10000];\r
37 #ifndef _MZ80B\r
38         uint8 vram[0x10000];    // 0x4000 * (3 pages + dummy)\r
39 #else\r
40         uint8 vram[0xc000];     // 0x4000 * (2 pages + dummy)\r
41 #endif\r
42         uint8 tvram[0x1000];\r
43         uint8 ipl[0x800];\r
44         \r
45         bool ipl_selected;\r
46         uint8 vram_sel, vram_page;\r
47         void update_vram_map();\r
48         \r
49         // crtc\r
50         scrntype palette_pc[8];\r
51         uint8 font[0x800];\r
52         uint8 screen_txt[200][640];\r
53         uint8 screen_gra[200][640];\r
54         uint8 back_color, text_color, vram_mask;\r
55         bool width80, reverse;\r
56         bool hblank;\r
57         void update_palette();\r
58         \r
59 public:\r
60         MEMORY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}\r
61         ~MEMORY() {}\r
62         \r
63         // common functions\r
64         void initialize();\r
65         void reset();\r
66         void special_reset();\r
67         void write_data8(uint32 addr, uint32 data);\r
68         uint32 read_data8(uint32 addr);\r
69         uint32 fetch_op(uint32 addr, int *wait);\r
70         void write_io8(uint32 addr, uint32 data);\r
71         void write_signal(int id, uint32 data, uint32 mask);\r
72         void event_vline(int v, int clock);\r
73         void event_callback(int event_id, int err);\r
74 #ifndef _MZ80B\r
75         void update_config();\r
76 #endif\r
77         void save_state(FILEIO* state_fio);\r
78         bool load_state(FILEIO* state_fio);\r
79         \r
80         // unique function\r
81         void set_context_cpu(Z80* device)\r
82         {\r
83                 d_cpu = device;\r
84         }\r
85         void set_context_pio(DEVICE* device)\r
86         {\r
87                 d_pio = device;\r
88         }\r
89         void load_dat_image(_TCHAR* file_path);\r
90         bool load_mzt_image(_TCHAR* file_path);\r
91         void draw_screen();\r
92 };\r
93 \r
94 #endif\r