OSDN Git Service

[VM] I forgot to update (and remove USE_SOUND_FILES*) defines.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz80k / mz80k.h
1 /*
2         SHARP MZ-80K/C Emulator 'EmuZ-80K'
3         SHARP MZ-1200 Emulator 'EmuZ-1200'
4
5         Author : Takeda.Toshiya
6         Date   : 2010.08.18-
7
8         SHARP MZ-80A Emulator 'EmuZ-80A'
9         Modify : Hideki Suga
10         Date   : 2014.12.10 -
11
12         [ virtual machine ]
13 */
14
15 #ifndef _MZ80K_H_
16 #define _MZ80K_H_
17
18 #if defined(_MZ1200)
19 #define DEVICE_NAME             "SHARP MZ-1200"
20 #define CONFIG_NAME             "mz1200"
21 #elif defined(_MZ80A)
22 #define DEVICE_NAME             "SHARP MZ-80A"
23 #define CONFIG_NAME             "mz80a"
24 #else
25 #define DEVICE_NAME             "SHARP MZ-80K/C"
26 #define CONFIG_NAME             "mz80k"
27 #endif
28
29 #ifdef _MZ80A
30 #define SUPPORT_MZ80AIF
31 #else
32 #define SUPPORT_MZ80FIO
33 #endif
34
35 // device informations for virtual machine
36 #define FRAMES_PER_SEC          60
37 #define LINES_PER_FRAME         262
38 #define CPU_CLOCKS              2000000
39 #define SCREEN_WIDTH            320
40 #define SCREEN_HEIGHT           200
41 #define WINDOW_HEIGHT_ASPECT    240
42 #if defined(SUPPORT_MZ80AIF)
43 #define HAS_MB8866
44 #define MAX_DRIVE               4
45 #elif defined(SUPPORT_MZ80FIO)
46 #define HAS_T3444M
47 #define MAX_DRIVE               4
48 #endif
49 #define PRINTER_STROBE_RISING_EDGE
50
51 // device informations for win32
52 #define USE_DIPSWITCH
53 #define USE_TAPE1
54 #define USE_TAPE_BUTTON
55 #define NOTIFY_KEY_DOWN
56 #define USE_SHIFT_NUMPAD_KEY
57 #define USE_ALT_F10_KEY
58 #define USE_AUTO_KEY            5
59 #define USE_AUTO_KEY_RELEASE    6
60 #define USE_AUTO_KEY_NO_CAPS
61 #define USE_PRINTER
62 #define USE_PRINTER_TYPE        4
63 #define USE_DEBUGGER
64 #define USE_STATE
65 #if defined(SUPPORT_MZ80AIF) || defined(SUPPORT_MZ80FIO)
66 #define USE_FD1
67 #define USE_FD2
68 #define USE_FD3
69 #define USE_FD4
70 #define USE_SOUND_VOLUME        4
71 #else
72 #define USE_SOUND_VOLUME        3
73 #endif
74 #if defined(_MZ80K)
75 #define USE_MONITOR_TYPE        2
76 #endif
77
78 #include "../../common.h"
79 #include "../../fileio.h"
80
81 #ifdef USE_SOUND_VOLUME
82 static const _TCHAR *sound_device_caption[] = {
83         _T("Beep"), _T("CMT (Signal)"),
84 #if defined(SUPPORT_MZ80AIF) || defined(SUPPORT_MZ80FIO)
85         _T("Noise (FDD)"),
86 #endif
87         _T("Noise (CMT)"),
88 };
89 #endif
90
91 class EMU;
92 class DEVICE;
93 class EVENT;
94
95 #if defined(_MZ1200) || defined(_MZ80A)
96 class AND;
97 #endif
98 class DATAREC;
99 class I8253;
100 class I8255;
101 class LS393;
102 class PCM1BIT;
103 class Z80;
104
105 class KEYBOARD;
106 class MEMORY;
107 class PRINTER;
108
109 #if defined(SUPPORT_MZ80AIF)
110 class MB8877;
111 class IO;
112 class MZ80AIF;
113 #elif defined(SUPPORT_MZ80FIO)
114 class T3444A;
115 class IO;
116 class MZ80FIO;
117 #endif
118
119 class VM
120 {
121 protected:
122         EMU* emu;
123         
124         // devices
125         EVENT* event;
126         
127 #if defined(_MZ1200) || defined(_MZ80A)
128         AND* and_int;
129 #endif
130         DATAREC* drec;
131         I8253* ctc;
132         I8255* pio;
133         LS393* counter;
134         PCM1BIT* pcm;
135         Z80* cpu;
136         
137         KEYBOARD* keyboard;
138         MEMORY* memory;
139         PRINTER* printer;
140         
141 #if defined(SUPPORT_MZ80AIF)
142         MB8877* fdc;
143         IO* io;
144         MZ80AIF* mz80aif;
145 #elif defined(SUPPORT_MZ80FIO)
146         T3444A* fdc;
147         IO* io;
148         MZ80FIO* mz80fio;
149 #endif
150         
151 public:
152         // ----------------------------------------
153         // initialize
154         // ----------------------------------------
155         
156         VM(EMU* parent_emu);
157         ~VM();
158         
159         // ----------------------------------------
160         // for emulation class
161         // ----------------------------------------
162         
163         // drive virtual machine
164         void reset();
165         void run();
166         
167 #ifdef USE_DEBUGGER
168         // debugger
169         DEVICE *get_cpu(int index);
170 #endif
171         
172         // draw screen
173         void draw_screen();
174         
175         // sound generation
176         void initialize_sound(int rate, int samples);
177         uint16_t* create_sound(int* extra_frames);
178         int get_sound_buffer_ptr();
179 #ifdef USE_SOUND_VOLUME
180         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
181 #endif
182         
183         // notify key
184         void key_down(int code, bool repeat);
185         void key_up(int code);
186         
187         // user interface
188 #if defined(SUPPORT_MZ80AIF) || defined(SUPPORT_MZ80FIO)
189         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
190         void close_floppy_disk(int drv);
191         bool is_floppy_disk_inserted(int drv);
192         void is_floppy_disk_protected(int drv, bool value);
193         bool is_floppy_disk_protected(int drv);
194         uint32_t is_floppy_disk_accessed();
195 #endif
196         void play_tape(int drv, const _TCHAR* file_path);
197         void rec_tape(int drv, const _TCHAR* file_path);
198         void close_tape(int drv);
199         bool is_tape_inserted(int drv);
200         bool is_tape_playing(int drv);
201         bool is_tape_recording(int drv);
202         int get_tape_position(int drv);
203         const _TCHAR* get_tape_message(int drv);
204         void push_play(int drv);
205         void push_stop(int drv);
206         void push_fast_forward(int drv);
207         void push_fast_rewind(int drv);
208         void push_apss_forward(int drv) {}
209         void push_apss_rewind(int drv) {}
210         bool is_frame_skippable();
211         
212         void update_config();
213         void save_state(FILEIO* state_fio);
214         bool load_state(FILEIO* state_fio);
215         
216         // ----------------------------------------
217         // for each device
218         // ----------------------------------------
219         
220         // devices
221         DEVICE* get_device(int id);
222         DEVICE* dummy;
223         DEVICE* first_device;
224         DEVICE* last_device;
225 };
226
227 #endif