OSDN Git Service

[VM] Remove define value for before commit.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz2500 / mz80b.h
1 /*
2         SHARP MZ-80B Emulator 'EmuZ-80B'
3         SHARP MZ-2200 Emulator 'EmuZ-2200'
4
5         Author : Takeda.Toshiya
6         Date   : 2013.03.14-
7
8         [ virtual machine ]
9 */
10
11 #ifndef _MZ80B_H_
12 #define _MZ80B_H_
13
14 #if defined(_MZ80B)
15 #define DEVICE_NAME             "SHARP MZ-80B"
16 #define CONFIG_NAME             "mz80b"
17 #elif defined(_MZ2000)
18 #define DEVICE_NAME             "SHARP MZ-2000"
19 #define CONFIG_NAME             "mz2000"
20 #else
21 #define DEVICE_NAME             "SHARP MZ-2200"
22 #define CONFIG_NAME             "mz2200"
23 #endif
24
25 #ifndef _MZ80B
26 #define SUPPORT_QUICK_DISK
27 #define SUPPORT_16BIT_BOARD
28 #endif
29
30 // device informations for virtual machine
31 #define FRAMES_PER_SEC          60
32 #define LINES_PER_FRAME         262
33 #define CPU_CLOCKS              4000000
34 #define SCREEN_WIDTH            640
35 #define SCREEN_HEIGHT           400
36 #define WINDOW_HEIGHT_ASPECT    480
37 #define MAX_DRIVE               4
38 #define HAS_MB8876
39 #ifdef SUPPORT_QUICK_DISK
40 #endif
41 #ifdef SUPPORT_16BIT_BOARD
42 #define HAS_I88
43 #define I8259_MAX_CHIPS         1
44 #endif
45 #define PRINTER_STROBE_RISING_EDGE
46
47 // memory wait
48 #define Z80_MEMORY_WAIT
49 #define Z80_IO_WAIT
50
51 // device informations for win32
52 #define USE_SPECIAL_RESET
53 #define USE_FD1
54 #define USE_FD2
55 #define USE_FD3
56 #define USE_FD4
57 #ifdef SUPPORT_QUICK_DISK
58 #define USE_QD1
59 #endif
60 #define USE_TAPE1
61 #define USE_TAPE_BUTTON
62 #define USE_SHIFT_NUMPAD_KEY
63 #define USE_ALT_F10_KEY
64 #define USE_AUTO_KEY            5
65 #define USE_AUTO_KEY_RELEASE    6
66 #define USE_AUTO_KEY_CAPS
67 #define USE_AUTO_KEY_NUMPAD
68 #define USE_MONITOR_TYPE        4
69 #ifndef _MZ80B
70 #define USE_SCREEN_FILTER
71 #endif
72 #define USE_SCANLINE
73 #define USE_SOUND_VOLUME        4
74 #define USE_PRINTER
75 #define USE_PRINTER_TYPE        4
76 #define USE_DEBUGGER
77 #define USE_STATE
78
79 #include "../../common.h"
80 #include "../../fileio.h"
81
82 #ifdef USE_SOUND_VOLUME
83 static const _TCHAR *sound_device_caption[] = {
84         _T("Beep"), _T("CMT (Signal)"), _T("Noise (FDD)"), _T("Noise (CMT)"),
85 };
86 #endif
87
88 class EMU;
89 class DEVICE;
90 class EVENT;
91
92 class DATAREC;
93 class I8253;
94 class I8255;
95 class IO;
96 class MB8877;
97 class PCM1BIT;
98 class Z80;
99 class Z80PIO;
100
101 class CMT;
102 class FLOPPY;
103 class KEYBOARD;
104 class MEMORY;
105 class MZ1R12;
106 class MZ1R13;
107 class PRINTER;
108 class TIMER;
109
110 #ifdef SUPPORT_QUICK_DISK
111 class Z80SIO;
112 class QUICKDISK;
113 #endif
114
115 #ifdef SUPPORT_16BIT_BOARD
116 class I286;
117 class I8259;
118 class MZ1M01;
119 #endif
120
121 class VM
122 {
123 protected:
124         EMU* emu;
125         
126         // devices
127         EVENT* event;
128         
129         DATAREC* drec;
130         I8253* pit;
131         I8255* pio_i;
132         IO* io;
133         MB8877* fdc;
134         PCM1BIT* pcm;
135         Z80* cpu;
136         Z80PIO* pio;
137         
138         CMT* cmt;
139         FLOPPY* floppy;
140         KEYBOARD* keyboard;
141         MEMORY* memory;
142         MZ1R12* mz1r12;
143         MZ1R13* mz1r13;
144         PRINTER* printer;
145         TIMER* timer;
146         
147 #ifdef SUPPORT_QUICK_DISK
148         Z80SIO* sio;
149         QUICKDISK* qd;
150 #endif
151         
152 #ifdef SUPPORT_16BIT_BOARD
153         Z80PIO* pio_to16;
154         I286* cpu_16;
155         I8259* pic_16;
156         MZ1M01* mz1m01;
157 #endif
158         
159 public:
160         // ----------------------------------------
161         // initialize
162         // ----------------------------------------
163         
164         VM(EMU* parent_emu);
165         ~VM();
166         
167         // ----------------------------------------
168         // for emulation class
169         // ----------------------------------------
170         
171         // drive virtual machine
172         void reset();
173         void special_reset();
174         void run();
175         
176 #ifdef USE_DEBUGGER
177         // debugger
178         DEVICE *get_cpu(int index);
179 #endif
180         
181         // draw screen
182         void draw_screen();
183         
184         // sound generation
185         void initialize_sound(int rate, int samples);
186         uint16_t* create_sound(int* extra_frames);
187         int get_sound_buffer_ptr();
188 #ifdef USE_SOUND_VOLUME
189         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
190 #endif
191         
192         // user interface
193         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
194         void close_floppy_disk(int drv);
195         bool is_floppy_disk_inserted(int drv);
196         void is_floppy_disk_protected(int drv, bool value);
197         bool is_floppy_disk_protected(int drv);
198         uint32_t is_floppy_disk_accessed();
199 #ifdef SUPPORT_QUICK_DISK
200         void open_quick_disk(int drv, const _TCHAR* file_path);
201         void close_quick_disk(int drv);
202         bool is_quick_disk_inserted(int drv);
203         uint32_t is_quick_disk_accessed();
204 #endif
205         void play_tape(int drv, const _TCHAR* file_path);
206         void rec_tape(int drv, const _TCHAR* file_path);
207         void close_tape(int drv);
208         bool is_tape_inserted(int drv);
209         bool is_tape_playing(int drv);
210         bool is_tape_recording(int drv);
211         int get_tape_position(int drv);
212         const _TCHAR* get_tape_message(int drv);
213         void push_play(int drv);
214         void push_stop(int drv);
215         void push_fast_forward(int drv);
216         void push_fast_rewind(int drv);
217         void push_apss_forward(int drv) {}
218         void push_apss_rewind(int drv) {}
219         bool is_frame_skippable();
220         
221         void update_config();
222         void save_state(FILEIO* state_fio);
223         bool load_state(FILEIO* state_fio);
224         
225         // ----------------------------------------
226         // for each device
227         // ----------------------------------------
228         
229         // devices
230         DEVICE* get_device(int id);
231         DEVICE* dummy;
232         DEVICE* first_device;
233         DEVICE* last_device;
234 };
235
236 #endif