OSDN Git Service

Merge branch 'master' of github.com:Artanejp/common_source_project-fm7
[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
45 #define SCREEN_WIDTH_ASPECT SCREEN_WIDTH 
46 #define SCREEN_HEIGHT_ASPECT SCREEN_HEIGHT
47 #define WINDOW_WIDTH_ASPECT 640 
48 #define WINDOW_HEIGHT_ASPECT 480
49
50 // memory wait
51 #define Z80_MEMORY_WAIT
52 #define Z80_IO_WAIT
53
54 // device informations for win32
55 #define USE_SPECIAL_RESET
56 #define USE_FD1
57 #define USE_FD2
58 #define USE_FD3
59 #define USE_FD4
60 #ifdef SUPPORT_QUICK_DISK
61 #define USE_QD1
62 #endif
63 #define USE_TAPE
64 #define USE_TAPE_BUTTON
65 #define USE_SHIFT_NUMPAD_KEY
66 #define USE_ALT_F10_KEY
67 #define USE_AUTO_KEY            5
68 #define USE_AUTO_KEY_RELEASE    6
69 #define USE_AUTO_KEY_CAPS
70 #ifndef _MZ80B
71 #define USE_MONITOR_TYPE        2
72 #define USE_CRT_FILTER
73 #endif
74 #define USE_SCANLINE
75 #define USE_ACCESS_LAMP
76 #define USE_DEBUGGER
77 #define USE_STATE
78
79 #include "../../common.h"
80 #include "../../fileio.h"
81
82 class EMU;
83 class DEVICE;
84 class EVENT;
85
86 class DATAREC;
87 class I8253;
88 class I8255;
89 class IO;
90 class MB8877;
91 class PCM1BIT;
92 class Z80;
93 class Z80PIO;
94
95 class CMT;
96 class FLOPPY;
97 class KEYBOARD;
98 class MEMORY;
99 class MZ1R12;
100 class MZ1R13;
101 class TIMER;
102
103 #ifdef SUPPORT_QUICK_DISK
104 class Z80SIO;
105 class QUICKDISK;
106 #endif
107
108 #ifdef SUPPORT_16BIT_BOARD
109 class I286;
110 class I8259;
111 class MZ1M01;
112 #endif
113
114 class VM
115 {
116 protected:
117         EMU* emu;
118         
119         // devices
120         EVENT* event;
121         
122         DATAREC* drec;
123         I8253* pit;
124         I8255* pio_i;
125         IO* io;
126         MB8877* fdc;
127         PCM1BIT* pcm;
128         Z80* cpu;
129         Z80PIO* pio;
130         
131         CMT* cmt;
132         FLOPPY* floppy;
133         KEYBOARD* keyboard;
134         MEMORY* memory;
135         MZ1R12* mz1r12;
136         MZ1R13* mz1r13;
137         TIMER* timer;
138         
139 #ifdef SUPPORT_QUICK_DISK
140         Z80SIO* sio;
141         QUICKDISK* qd;
142 #endif
143         
144 #ifdef SUPPORT_16BIT_BOARD
145         Z80PIO* pio_to16;
146         I286* cpu_16;
147         I8259* pic_16;
148         MZ1M01* mz1m01;
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 special_reset();
166         void run();
167         
168 #ifdef USE_DEBUGGER
169         // debugger
170         DEVICE *get_cpu(int index);
171 #endif
172         
173         // draw screen
174         void draw_screen();
175         int access_lamp();
176         
177         // sound generation
178         void initialize_sound(int rate, int samples);
179         uint16* create_sound(int* extra_frames);
180         int sound_buffer_ptr();
181         
182         // user interface
183         void open_disk(int drv, _TCHAR* file_path, int bank);
184         void close_disk(int drv);
185         bool disk_inserted(int drv);
186 #ifdef SUPPORT_QUICK_DISK
187         void open_quickdisk(int drv, _TCHAR* file_path);
188         void close_quickdisk(int drv);
189         bool quickdisk_inserted(int drv);
190 #endif
191         void play_tape(_TCHAR* file_path);
192         void rec_tape(_TCHAR* file_path);
193         void close_tape();
194         bool tape_inserted();
195         void push_play();
196         void push_stop();
197         void push_fast_forward();
198         void push_fast_rewind();
199         void push_apss_forward() {}
200         void push_apss_rewind() {}
201         bool now_skip();
202         void update_config();
203         void save_state(FILEIO* state_fio);
204         bool load_state(FILEIO* state_fio);
205         bool get_tape_play();
206         // ----------------------------------------
207         // for each device
208         // ----------------------------------------
209         
210         // devices
211         DEVICE* get_device(int id);
212         DEVICE* dummy;
213         DEVICE* first_device;
214         DEVICE* last_device;
215 };
216
217 #endif