OSDN Git Service

[VM][EVENT] Specify CPU per VM.
[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 WINDOW_HEIGHT_ASPECT    480
35 #define MAX_DRIVE               4
36 #ifdef _MZ6550
37 #define HAS_I286
38 #else
39 #define HAS_I86
40 #endif
41 #define I8259_MAX_CHIPS         2
42 #define UPD7220_HORIZ_FREQ      24860
43 #define Z80CTC_CLOCKS           2457600
44 #define SINGLE_MODE_DMA
45 #define IO_ADDR_MAX             0x400
46 #define HAS_AY_3_8912
47 #define PRINTER_STROBE_RISING_EDGE
48 #define SUPPORT_VARIABLE_TIMING
49
50 // device informations for win32
51 #define USE_SPECIAL_RESET
52 #define USE_FD1
53 #define USE_FD2
54 #define USE_FD3
55 #define USE_FD4
56 #define NOTIFY_KEY_DOWN
57 #define USE_KEY_LOCKED
58 #define USE_SHIFT_NUMPAD_KEY
59 #define USE_ALT_F10_KEY
60 #define USE_AUTO_KEY            5
61 #define USE_AUTO_KEY_RELEASE    6
62 #define USE_AUTO_KEY_NUMPAD
63 #define USE_SCREEN_FILTER
64 #define USE_SCANLINE
65 #define USE_SOUND_VOLUME        2
66 #define USE_MOUSE
67 #define USE_PRINTER
68 #define USE_PRINTER_TYPE        4
69 #define USE_DEBUGGER
70 #define USE_STATE
71 #define USE_CPU_I286
72
73 #include "../../common.h"
74 #include "../../fileio.h"
75
76 #ifdef USE_SOUND_VOLUME
77 static const _TCHAR *sound_device_caption[] = {
78         _T("PSG"), _T("Noise (FDD)"),
79 };
80 #endif
81
82 class EMU;
83 class DEVICE;
84 class EVENT;
85
86 class I8237;
87 class I8255;
88 class I8259;
89 //#if defined(HAS_I286) || defined(HAS_I186)
90 class I286;
91 //#else
92 //class I86;
93 //#endif
94 class IO;
95 class LS393;
96 class NOT;
97 class RP5C01;
98 class UPD7220;
99 class UPD765A;
100 //class YM2203;
101 class AY_3_891X;
102 class Z80CTC;
103 class Z80SIO;
104
105 class DISPLAY;
106 class KEYBOARD;
107 class MEMORY;
108 class SYSPORT;
109
110 class VM
111 {
112 protected:
113         EMU* emu;
114         
115         // devices
116         EVENT* event;
117         
118         DEVICE* printer;
119         I8237* dma;
120         I8255* pio;
121         I8259* pic;     // includes 2chips
122 //#if defined(HAS_I286) || defined(HAS_I186)
123         I286* cpu;
124 //#else
125 //      I86* cpu;
126 //#endif
127         IO* io;
128         LS393* div;
129         NOT* not_data0;
130         NOT* not_data1;
131         NOT* not_data2;
132         NOT* not_data3;
133         NOT* not_data4;
134         NOT* not_data5;
135         NOT* not_data6;
136         NOT* not_data7;
137         NOT* not_busy;
138         RP5C01* rtc;
139         UPD7220* gdc;
140         UPD765A* fdc;
141 //      YM2203* psg;
142         AY_3_891X* psg;
143         Z80CTC* ctc0;
144 #if defined(_MZ6500) || defined(_MZ6550)
145         Z80CTC* ctc1;
146 #endif
147         Z80SIO* sio;
148         
149         DISPLAY* display;
150         KEYBOARD* keyboard;
151         MEMORY* memory;
152         SYSPORT* sysport;
153         
154 public:
155         // ----------------------------------------
156         // initialize
157         // ----------------------------------------
158         
159         VM(EMU* parent_emu);
160         ~VM();
161         
162         // ----------------------------------------
163         // for emulation class
164         // ----------------------------------------
165         
166         // drive virtual machine
167         void reset();
168         void special_reset();
169         void run();
170         double get_frame_rate();
171         
172 #ifdef USE_DEBUGGER
173         // debugger
174         DEVICE *get_cpu(int index);
175 #endif
176         
177         // draw screen
178         void draw_screen();
179         
180         // sound generation
181         void initialize_sound(int rate, int samples);
182         uint16_t* create_sound(int* extra_frames);
183         int get_sound_buffer_ptr();
184 #ifdef USE_SOUND_VOLUME
185         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
186 #endif
187         
188         // notify key
189         void key_down(int code, bool repeat);
190         void key_up(int code);
191         bool get_caps_locked();
192         bool get_kana_locked();
193         
194         // user interface
195         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
196         void close_floppy_disk(int drv);
197         bool is_floppy_disk_inserted(int drv);
198         void is_floppy_disk_protected(int drv, bool value);
199         bool is_floppy_disk_protected(int drv);
200         uint32_t is_floppy_disk_accessed();
201         bool is_frame_skippable();
202         
203         void update_config();
204         void save_state(FILEIO* state_fio);
205         bool load_state(FILEIO* state_fio);
206         
207         // ----------------------------------------
208         // for each device
209         // ----------------------------------------
210         
211         // devices
212         DEVICE* get_device(int id);
213         DEVICE* dummy;
214         DEVICE* first_device;
215         DEVICE* last_device;
216 };
217
218 #endif