OSDN Git Service

[VM] Set 4:3 monitor flag to using TV/4:3 CRT (at least I know).
[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 #ifdef SUPPORT_QUICK_DISK
39 #endif
40 #ifdef SUPPORT_16BIT_BOARD
41 #define HAS_I88
42 #define I8259_MAX_CHIPS         1
43 #endif
44 #define PRINTER_STROBE_RISING_EDGE
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_PRINTER
73 #define USE_PRINTER_TYPE        4
74 #define USE_DEBUGGER
75 #define USE_MOUSE
76 #define USE_CRT_MONITOR_4_3 1
77 #define USE_JOYSTICK
78 #define USE_STATE
79
80 #include "../../common.h"
81 #include "../../fileio.h"
82
83 class EMU;
84 class DEVICE;
85 class EVENT;
86
87 class DATAREC;
88 class I8253;
89 class I8255;
90 class IO;
91 class MB8877;
92 class PCM1BIT;
93 class Z80;
94 class Z80PIO;
95
96 class CMT;
97 class FLOPPY;
98 class KEYBOARD;
99 class MEMORY;
100 class MZ1R12;
101 class MZ1R13;
102 class PRINTER;
103 class TIMER;
104
105 #ifdef SUPPORT_QUICK_DISK
106 class Z80SIO;
107 class QUICKDISK;
108 #endif
109
110 #ifdef SUPPORT_16BIT_BOARD
111 class I286;
112 class I8259;
113 class MZ1M01;
114 #endif
115
116 class VM
117 {
118 protected:
119         EMU* emu;
120         
121         // devices
122         EVENT* event;
123         
124         DATAREC* drec;
125         I8253* pit;
126         I8255* pio_i;
127         IO* io;
128         MB8877* fdc;
129         PCM1BIT* pcm;
130         Z80* cpu;
131         Z80PIO* pio;
132         
133         CMT* cmt;
134         FLOPPY* floppy;
135         KEYBOARD* keyboard;
136         MEMORY* memory;
137         MZ1R12* mz1r12;
138         MZ1R13* mz1r13;
139         PRINTER* printer;
140         TIMER* timer;
141         
142 #ifdef SUPPORT_QUICK_DISK
143         Z80SIO* sio;
144         QUICKDISK* qd;
145 #endif
146         
147 #ifdef SUPPORT_16BIT_BOARD
148         Z80PIO* pio_to16;
149         I286* cpu_16;
150         I8259* pic_16;
151         MZ1M01* mz1m01;
152 #endif
153         
154 public:
155         // ----------------------------------------
156         // initialize
157         // ----------------------------------------
158         
159         VM(EMU* parent_emu);
160         ~VM();
161         
162         // ----------------------------------------
163         // for emulation class
164         // ----------------------------------------
165         
166         // drive virtual machine
167         void reset();
168         void special_reset();
169         void run();
170         
171 #ifdef USE_DEBUGGER
172         // debugger
173         DEVICE *get_cpu(int index);
174 #endif
175         
176         // draw screen
177         void draw_screen();
178         int access_lamp();
179         
180         // sound generation
181         void initialize_sound(int rate, int samples);
182         uint16* create_sound(int* extra_frames);
183         int sound_buffer_ptr();
184         
185         // user interface
186         void open_disk(int drv, const _TCHAR* file_path, int bank);
187         void close_disk(int drv);
188         bool disk_inserted(int drv);
189         void set_disk_protected(int drv, bool value);
190         bool get_disk_protected(int drv);
191 #ifdef SUPPORT_QUICK_DISK
192         void open_quickdisk(int drv, const _TCHAR* file_path);
193         void close_quickdisk(int drv);
194         bool quickdisk_inserted(int drv);
195 #endif
196         void play_tape(const _TCHAR* file_path);
197         void rec_tape(const _TCHAR* file_path);
198         void close_tape();
199         bool tape_inserted();
200         bool tape_playing();
201         bool tape_recording();
202         int tape_position();
203         void push_play();
204         void push_stop();
205         void push_fast_forward();
206         void push_fast_rewind();
207         void push_apss_forward() {}
208         void push_apss_rewind() {}
209         bool now_skip();
210         
211         void update_config();
212         void save_state(FILEIO* state_fio);
213         bool load_state(FILEIO* state_fio);
214         
215         // ----------------------------------------
216         // for each device
217         // ----------------------------------------
218         
219         // devices
220         DEVICE* get_device(int id);
221         DEVICE* dummy;
222         DEVICE* first_device;
223         DEVICE* last_device;
224 };
225
226 #endif