OSDN Git Service

[General][Qt] Enable to build even not support counter of CMT.
[csp-qt/common_source_project-fm7.git] / source / src / vm / msx / msx.h
1 /*
2         ASCII MSX1 Emulator 'yaMSX1'
3         ASCII MSX2 Emulator 'yaMSX2'
4         Pioneer PX-7 Emulator 'ePX-7'
5
6         Author : tanam
7         Date   : 2013.06.29-
8
9         modified by Takeda.Toshiya
10         modified by umaiboux
11
12         [ virtual machine ]
13 */
14
15 #ifndef _MSX_H_
16 #define _MSX_H_
17
18 #if defined(_PX7)
19 #define DEVICE_NAME             "PIONEER PX-7"
20 #define CONFIG_NAME             "px7"
21 #elif defined(_MSX1)
22 #define DEVICE_NAME             "ASCII MSX1"
23 #define CONFIG_NAME             "msx1"
24 #elif defined(_MSX2)
25 #define DEVICE_NAME             "ASCII MSX2"
26 #define CONFIG_NAME             "msx2"
27 #endif
28
29 // device informations for virtual machine
30 #define FRAMES_PER_SEC          60
31 #define LINES_PER_FRAME         262
32 #define CPU_CLOCKS              3579545
33 #if defined(_MSX2)
34 #define SCREEN_WIDTH            ((256 + 15)*2)  // V99X8_WIDTH
35 #define SCREEN_HEIGHT           ((212 + 15)*2)  // V99X8_HEIGHT
36 #else
37 #define SCREEN_WIDTH            512
38 #define SCREEN_HEIGHT           384
39 #endif
40 #define TMS9918A_VRAM_SIZE      0x4000
41 #define TMS9918A_LIMIT_SPRITES
42 #if defined(_PX7)
43 #define TMS9918A_SUPER_IMPOSE
44 #else
45 #define MAX_DRIVE               2
46 #define SUPPORT_MEDIA_TYPE_1DD
47 #define Z80_PSEUDO_BIOS
48 #endif
49 #define HAS_AY_3_8910
50 // for Flappy Limited '85
51 #define YM2203_PORT_MODE        0x80
52
53 // device informations for win32
54 #define USE_CART1
55 #define USE_CART2
56 #define USE_TAPE
57 #define USE_TAPE_PTR
58 #if defined(_PX7)
59 #define USE_LASER_DISC
60 #else
61 #define USE_FD1
62 #define USE_FD2
63 #endif
64 #define USE_ALT_F10_KEY
65 #define USE_AUTO_KEY            6
66 #define USE_AUTO_KEY_RELEASE    10
67 #define USE_DEBUGGER
68 #define USE_STATE
69
70 #include "../../common.h"
71 #include "../../fileio.h"
72
73 class EMU;
74 class DEVICE;
75 class EVENT;
76
77 class DATAREC;
78 class I8255;
79 class IO;
80 #if defined(_PX7)
81 class LD700;
82 #endif
83 class NOT;
84 class YM2203;
85 class PCM1BIT;
86 #if defined(_MSX2)
87 class RP5C01;
88 class V99X8;
89 #else
90 class TMS9918A;
91 #endif
92 class Z80;
93
94 class JOYSTICK;
95 class KEYBOARD;
96 class MEMORY;
97 #if defined(_MSX2)
98 class RTCIF;
99 #endif
100 class SLOT0;
101 class SLOT1;
102 class SLOT2;
103 class SLOT3;
104
105 class VM
106 {
107 protected:
108         EMU* emu;
109         
110         // devices
111         EVENT* event;
112         
113         DATAREC* drec;
114         I8255* pio;
115         IO* io;
116 #if defined(_PX7)
117         LD700* ldp;
118 #endif
119         NOT* d_not;
120         YM2203* psg;
121         PCM1BIT* pcm;
122 #if defined(_MSX2)
123         RP5C01* rtc;
124         V99X8* vdp;
125 #else
126         TMS9918A* vdp;
127 #endif
128         Z80* cpu;
129         
130         JOYSTICK* joystick;
131         KEYBOARD* keyboard;
132         MEMORY* memory;
133 #ifdef _MSX2
134         RTCIF* rtcif;
135 #endif
136         SLOT0 *slot0;
137         SLOT1 *slot1;
138         SLOT2 *slot2;
139         SLOT3 *slot3;
140         
141 public:
142         // ----------------------------------------
143         // initialize
144         // ----------------------------------------
145         
146         VM(EMU* parent_emu);
147         ~VM();
148         
149         // ----------------------------------------
150         // for emulation class
151         // ----------------------------------------
152         
153         // drive virtual machine
154         void reset();
155         void run();
156         
157 #ifdef USE_DEBUGGER
158         // debugger
159         DEVICE *get_cpu(int index);
160 #endif
161         
162         // draw screen
163         void draw_screen();
164         
165         // sound generation
166         void initialize_sound(int rate, int samples);
167         uint16* create_sound(int* extra_frames);
168         int sound_buffer_ptr();
169 #if defined(_PX7)
170         void movie_sound_callback(uint8 *buffer, long size);
171 #endif
172         
173         // user interface
174         void open_cart(int drv, _TCHAR* file_path);
175         void close_cart(int drv);
176         bool cart_inserted(int drv);
177         void play_tape(_TCHAR* file_path);
178         void rec_tape(_TCHAR* file_path);
179         void close_tape();
180         bool tape_inserted();
181         int  get_tape_ptr();
182 #if defined(_PX7)
183         void open_laser_disc(_TCHAR* file_path);
184         void close_laser_disc();
185         bool laser_disc_inserted();
186 #else
187         void open_disk(int drv, _TCHAR* file_path, int bank);
188         void close_disk(int drv);
189         bool disk_inserted(int drv);
190         void write_protect_fd(int drv, bool flag);
191         bool is_write_protect_fd(int drv);
192         //int access_lamp();
193 #endif
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