OSDN Git Service

[VM][UI][Qt] General : Merge upstream 2015-08-01.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz5500 / mz5500.h
1 /*
2         SHARP MZ-5500 Emulator 'EmuZ-5500'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.04.10 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _MZ5500_H_
11 #define _MZ5500_H_
12
13 #if defined(_MZ5500)
14 #define DEVICE_NAME             "SHARP MZ-5500"
15 #define CONFIG_NAME             "mz5500"
16 #elif defined(_MZ6500)
17 #define DEVICE_NAME             "SHARP MZ-6500"
18 #define CONFIG_NAME             "mz6500"
19 #elif defined(_MZ6550)
20 #define DEVICE_NAME             "SHARP MZ-6550"
21 #define CONFIG_NAME             "mz6550"
22 #endif
23
24 // device informations for virtual machine
25 #define FRAMES_PER_SEC          55.49
26 #define LINES_PER_FRAME         448
27 #if defined(_MZ5500)
28 #define CPU_CLOCKS              4915200
29 #elif defined(_MZ6500) || defined(_MZ6550)
30 #define CPU_CLOCKS              8000000
31 #endif
32 #define SCREEN_WIDTH            640
33 #define SCREEN_HEIGHT           400
34 #define MAX_DRIVE               4
35 #ifdef _MZ6550
36 #define HAS_I286
37 #else
38 #define HAS_I86
39 #endif
40 #define I8259_MAX_CHIPS         2
41 #define UPD7220_HORIZ_FREQ      24860
42 #define Z80CTC_CLOCKS           2457600
43 #define SINGLE_MODE_DMA
44 #define IO_ADDR_MAX             0x400
45 #define HAS_AY_3_8912
46 #define SUPPORT_VARIABLE_TIMING
47
48 // device informations for win32
49 #define USE_SPECIAL_RESET
50 #define USE_FD1
51 #define USE_FD2
52 #define USE_FD3
53 #define USE_FD4
54 #define NOTIFY_KEY_DOWN
55 #define USE_SHIFT_NUMPAD_KEY
56 #define USE_ALT_F10_KEY
57 #define USE_AUTO_KEY            5
58 #define USE_AUTO_KEY_RELEASE    6
59 #define USE_CRT_FILTER
60 #define USE_SCANLINE
61 #define USE_ACCESS_LAMP
62 #define USE_DEBUGGER
63 #define USE_STATE
64
65 #include "../../common.h"
66 #include "../../fileio.h"
67
68 class EMU;
69 class DEVICE;
70 class EVENT;
71
72 class I8237;
73 class I8255;
74 class I8259;
75 class I286;
76 class IO;
77 class LS393;
78 class RP5C01;
79 class UPD7220;
80 class UPD765A;
81 class YM2203;
82 class Z80CTC;
83 class Z80SIO;
84
85 class DISPLAY;
86 class KEYBOARD;
87 class MEMORY;
88 class SYSPORT;
89
90 class VM
91 {
92 protected:
93         EMU* emu;
94         
95         // devices
96         EVENT* event;
97         
98         I8237* dma;
99         I8255* pio;
100         I8259* pic;     // includes 2chips
101         I286* cpu;
102         IO* io;
103         LS393* div;
104         RP5C01* rtc;
105         UPD7220* gdc;
106         UPD765A* fdc;
107         YM2203* psg;
108         Z80CTC* ctc0;
109 #if defined(_MZ6500) || defined(_MZ6550)
110         Z80CTC* ctc1;
111 #endif
112         Z80SIO* sio;
113         
114         DISPLAY* display;
115         KEYBOARD* keyboard;
116         MEMORY* memory;
117         SYSPORT* sysport;
118         
119 public:
120         // ----------------------------------------
121         // initialize
122         // ----------------------------------------
123         
124         VM(EMU* parent_emu);
125         ~VM();
126         
127         // ----------------------------------------
128         // for emulation class
129         // ----------------------------------------
130         
131         // drive virtual machine
132         void reset();
133         void special_reset();
134         void run();
135         double frame_rate();
136         
137 #ifdef USE_DEBUGGER
138         // debugger
139         DEVICE *get_cpu(int index);
140 #endif
141         
142         // draw screen
143         void draw_screen();
144         int access_lamp();
145         
146         // sound generation
147         void initialize_sound(int rate, int samples);
148         uint16* create_sound(int* extra_frames);
149         int sound_buffer_ptr();
150         
151         // notify key
152         void key_down(int code, bool repeat);
153         void key_up(int code);
154         
155         // user interface
156         void open_disk(int drv, _TCHAR* file_path, int bank);
157         void close_disk(int drv);
158         bool disk_inserted(int drv);
159         void set_disk_protected(int drv, bool value);
160         bool get_disk_protected(int drv);
161         bool now_skip();
162         
163         void update_config();
164         void save_state(FILEIO* state_fio);
165         bool load_state(FILEIO* state_fio);
166         
167         // ----------------------------------------
168         // for each device
169         // ----------------------------------------
170         
171         // devices
172         DEVICE* get_device(int id);
173         DEVICE* dummy;
174         DEVICE* first_device;
175         DEVICE* last_device;
176 };
177
178 #endif