OSDN Git Service

[General] Merge upstream, 2015-01-30 Writetrk.test.
[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 MAX_DRIVE               4
37 #define HAS_MB8876
38 #define PCM1BIT_HIGH_QUALITY
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
46 // memory wait
47 #define Z80_MEMORY_WAIT
48 #define Z80_IO_WAIT
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 #ifdef SUPPORT_QUICK_DISK
57 #define USE_QD1
58 #endif
59 #define USE_TAPE
60 #define USE_TAPE_BUTTON
61 #define USE_SHIFT_NUMPAD_KEY
62 #define USE_ALT_F10_KEY
63 #define USE_AUTO_KEY            5
64 #define USE_AUTO_KEY_RELEASE    6
65 #define USE_AUTO_KEY_CAPS
66 #ifndef _MZ80B
67 #define USE_MONITOR_TYPE        2
68 #define USE_CRT_FILTER
69 #endif
70 #define USE_SCANLINE
71 #define USE_ACCESS_LAMP
72 #define USE_DEBUGGER
73 #define USE_STATE
74
75 #include "../../common.h"
76
77 class EMU;
78 class DEVICE;
79 class EVENT;
80
81 class DATAREC;
82 class I8253;
83 class I8255;
84 class IO;
85 class MB8877;
86 class PCM1BIT;
87 class Z80;
88 class Z80PIO;
89
90 class CMT;
91 class FLOPPY;
92 class KEYBOARD;
93 class MEMORY;
94 class MZ1R12;
95 class MZ1R13;
96 class TIMER;
97
98 #ifdef SUPPORT_QUICK_DISK
99 class Z80SIO;
100 class QUICKDISK;
101 #endif
102
103 #ifdef SUPPORT_16BIT_BOARD
104 class I286;
105 class I8259;
106 class MZ1M01;
107 #endif
108
109 class FILEIO;
110
111 class VM
112 {
113 protected:
114         EMU* emu;
115         
116         // devices
117         EVENT* event;
118         
119         DATAREC* drec;
120         I8253* pit;
121         I8255* pio_i;
122         IO* io;
123         MB8877* fdc;
124         PCM1BIT* pcm;
125         Z80* cpu;
126         Z80PIO* pio;
127         
128         CMT* cmt;
129         FLOPPY* floppy;
130         KEYBOARD* keyboard;
131         MEMORY* memory;
132         MZ1R12* mz1r12;
133         MZ1R13* mz1r13;
134         TIMER* timer;
135         
136 #ifdef SUPPORT_QUICK_DISK
137         Z80SIO* sio;
138         QUICKDISK* qd;
139 #endif
140         
141 #ifdef SUPPORT_16BIT_BOARD
142         Z80PIO* pio_to16;
143         I286* cpu_16;
144         I8259* pic_16;
145         MZ1M01* mz1m01;
146 #endif
147         
148 public:
149         // ----------------------------------------
150         // initialize
151         // ----------------------------------------
152         
153         VM(EMU* parent_emu);
154         ~VM();
155         
156         // ----------------------------------------
157         // for emulation class
158         // ----------------------------------------
159         
160         // drive virtual machine
161         void reset();
162         void special_reset();
163         void run();
164         
165 #ifdef USE_DEBUGGER
166         // debugger
167         DEVICE *get_cpu(int index);
168 #endif
169         
170         // draw screen
171         void draw_screen();
172         int access_lamp();
173         
174         // sound generation
175         void initialize_sound(int rate, int samples);
176         uint16* create_sound(int* extra_frames);
177         int sound_buffer_ptr();
178         
179         // user interface
180         void open_disk(int drv, _TCHAR* file_path, int bank);
181         void close_disk(int drv);
182         bool disk_inserted(int drv);
183 #ifdef SUPPORT_QUICK_DISK
184         void open_quickdisk(int drv, _TCHAR* file_path);
185         void close_quickdisk(int drv);
186         bool quickdisk_inserted(int drv);
187 #endif
188         void play_tape(_TCHAR* file_path);
189         void rec_tape(_TCHAR* file_path);
190         void close_tape();
191         bool tape_inserted();
192         void push_play();
193         void push_stop();
194         bool now_skip();
195         
196         void update_config();
197         void save_state(FILEIO* state_fio);
198         bool load_state(FILEIO* state_fio);
199         
200         // ----------------------------------------
201         // for each device
202         // ----------------------------------------
203         
204         // devices
205         DEVICE* get_device(int id);
206         DEVICE* dummy;
207         DEVICE* first_device;
208         DEVICE* last_device;
209 };
210
211 #endif