OSDN Git Service

[VM][CMAKE][MZ2800][MZ5500][PASOPIA][PASOPIA7] Fix FTBFSs.
[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 #define USE_MOUSE
65 #define USE_JOYSTICK
66
67 #include "../../common.h"
68 #include "../../fileio.h"
69
70 class EMU;
71 class DEVICE;
72 class EVENT;
73
74 class I8237;
75 class I8255;
76 class I8259;
77 class I286;
78 class IO;
79 class LS393;
80 class RP5C01;
81 class UPD7220;
82 class UPD765A;
83 class YM2203;
84 class Z80CTC;
85 class Z80SIO;
86
87 class DISPLAY;
88 class KEYBOARD;
89 class MEMORY;
90 class SYSPORT;
91
92 class VM
93 {
94 protected:
95         EMU* emu;
96         
97         // devices
98         EVENT* event;
99         
100         I8237* dma;
101         I8255* pio;
102         I8259* pic;     // includes 2chips
103         I286* cpu;
104         IO* io;
105         LS393* div;
106         RP5C01* rtc;
107         UPD7220* gdc;
108         UPD765A* fdc;
109         YM2203* psg;
110         Z80CTC* ctc0;
111 #if defined(_MZ6500) || defined(_MZ6550)
112         Z80CTC* ctc1;
113 #endif
114         Z80SIO* sio;
115         
116         DISPLAY* display;
117         KEYBOARD* keyboard;
118         MEMORY* memory;
119         SYSPORT* sysport;
120         
121 public:
122         // ----------------------------------------
123         // initialize
124         // ----------------------------------------
125         
126         VM(EMU* parent_emu);
127         ~VM();
128         
129         // ----------------------------------------
130         // for emulation class
131         // ----------------------------------------
132         
133         // drive virtual machine
134         void reset();
135         void special_reset();
136         void run();
137         double frame_rate();
138         
139 #ifdef USE_DEBUGGER
140         // debugger
141         DEVICE *get_cpu(int index);
142 #endif
143         
144         // draw screen
145         void draw_screen();
146         int access_lamp();
147         
148         // sound generation
149         void initialize_sound(int rate, int samples);
150         uint16* create_sound(int* extra_frames);
151         int sound_buffer_ptr();
152         
153         // notify key
154         void key_down(int code, bool repeat);
155         void key_up(int code);
156         
157         // user interface
158         void open_disk(int drv, const _TCHAR* file_path, int bank);
159         void close_disk(int drv);
160         bool disk_inserted(int drv);
161         void set_disk_protected(int drv, bool value);
162         bool get_disk_protected(int drv);
163         bool now_skip();
164         
165         void update_config();
166         void save_state(FILEIO* state_fio);
167         bool load_state(FILEIO* state_fio);
168         
169         // ----------------------------------------
170         // for each device
171         // ----------------------------------------
172         
173         // devices
174         DEVICE* get_device(int id);
175         DEVICE* dummy;
176         DEVICE* first_device;
177         DEVICE* last_device;
178 };
179
180 #endif