OSDN Git Service

[UI][Qt][CMT] MZ : Apply playing status to menu.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz80k / mz80k.h
1 /*
2         SHARP MZ-80K 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"
26 #define CONFIG_NAME             "mz80k"
27 #endif
28
29 #ifdef _MZ80A
30 #define SUPPORT_MZ80AIF
31 #endif
32
33 // device informations for virtual machine
34 #define FRAMES_PER_SEC          60
35 #define LINES_PER_FRAME         262
36 #define CPU_CLOCKS              2000000
37 #define SCREEN_WIDTH            320
38 #define SCREEN_HEIGHT           200
39 #ifdef SUPPORT_MZ80AIF
40 #define HAS_MB8876
41 #define MAX_DRIVE               4
42 #endif
43
44 // device informations for win32
45 #define USE_TAPE
46 #define USE_TAPE_BUTTON
47 #define USE_SHIFT_NUMPAD_KEY
48 #define USE_ALT_F10_KEY
49 #define USE_AUTO_KEY            5
50 #define USE_AUTO_KEY_RELEASE    6
51 #define USE_AUTO_KEY_NO_CAPS
52 #define USE_DEBUGGER
53 #define USE_STATE
54 #ifdef SUPPORT_MZ80AIF
55 #define USE_FD1
56 #define USE_FD2
57 #define USE_FD3
58 #define USE_FD4
59 #define USE_ACCESS_LAMP
60 #endif
61
62 #include "../../common.h"
63
64 class EMU;
65 class DEVICE;
66 class EVENT;
67
68 #if defined(_MZ1200) || defined(_MZ80A)
69 class AND;
70 #endif
71 class DATAREC;
72 class I8253;
73 class I8255;
74 class LS393;
75 class PCM1BIT;
76 class Z80;
77
78 class DISPLAY;
79 class KEYBOARD;
80 class MEMORY;
81
82 #ifdef SUPPORT_MZ80AIF
83 class MB8877;
84 class FLOPPY;
85 class IO;
86 #endif
87
88 class FILEIO;
89
90 class VM
91 {
92 protected:
93         EMU* emu;
94         
95         // devices
96         EVENT* event;
97         
98 #if defined(_MZ1200) || defined(_MZ80A)
99         AND* l_and; // and is reserved word.
100 #endif
101         DATAREC* drec;
102         I8253* ctc;
103         I8255* pio;
104         LS393* counter;
105         PCM1BIT* pcm;
106         Z80* cpu;
107         
108         DISPLAY* display;
109         KEYBOARD* keyboard;
110         MEMORY* memory;
111         
112 #ifdef SUPPORT_MZ80AIF
113         MB8877* fdc;
114         FLOPPY* floppy;
115         IO* io;
116 #endif
117         
118 public:
119         // ----------------------------------------
120         // initialize
121         // ----------------------------------------
122         
123         VM(EMU* parent_emu);
124         ~VM();
125         
126         // ----------------------------------------
127         // for emulation class
128         // ----------------------------------------
129         
130         // drive virtual machine
131         void reset();
132         void run();
133         
134 #ifdef USE_DEBUGGER
135         // debugger
136         DEVICE *get_cpu(int index);
137 #endif
138         
139         // draw screen
140         void draw_screen();
141 #ifdef SUPPORT_MZ80AIF
142         int access_lamp();
143 #endif
144         
145         // sound generation
146         void initialize_sound(int rate, int samples);
147         uint16* create_sound(int* extra_frames);
148         int sound_buffer_ptr();
149         
150         // user interface
151 #ifdef SUPPORT_MZ80AIF
152         void open_disk(int drv, _TCHAR* file_path, int bank);
153         void close_disk(int drv);
154         bool disk_inserted(int drv);
155         void write_protect_fd(int drv, bool flag);
156         bool is_write_protect_fd(int drv);
157 #endif
158         void play_tape(_TCHAR* file_path);
159         void rec_tape(_TCHAR* file_path);
160         void close_tape();
161         bool tape_inserted();
162         int get_tape_ptr(void);
163         bool get_tape_play(void);
164         void push_play();
165         void push_stop();
166         bool now_skip();
167         
168         void update_config();
169         void save_state(FILEIO* state_fio);
170         bool load_state(FILEIO* state_fio);
171         
172         // ----------------------------------------
173         // for each device
174         // ----------------------------------------
175         
176         // devices
177         DEVICE* get_device(int id);
178         DEVICE* dummy;
179         DEVICE* first_device;
180         DEVICE* last_device;
181 };
182
183 #endif