OSDN Git Service

[General][Qt] Merge upstream 2015-03-15.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz2500 / mz2500.h
1 /*
2         SHARP MZ-2500 Emulator 'EmuZ-2500'
3
4         Author : Takeda.Toshiya
5         Date   : 2006.11.24 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _MZ2500_H_
11 #define _MZ2500_H_
12
13 #define DEVICE_NAME             "SHARP MZ-2500"
14 #define CONFIG_NAME             "mz2500"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          55.4
18 #define LINES_PER_FRAME         440
19 #define CHARS_PER_LINE          108
20 #define CPU_CLOCKS              6000000
21 #define SCREEN_WIDTH            640
22 #define SCREEN_HEIGHT           400
23 #define MAX_DRIVE               4
24 #define HAS_MB8876
25 #define HAS_RP5C15
26 #define DATAREC_SOUND
27
28 // memory wait
29 #define Z80_MEMORY_WAIT
30 #define Z80_IO_WAIT
31
32 // device informations for win32
33 #define USE_SPECIAL_RESET
34 #define USE_FD1
35 #define USE_FD2
36 #define USE_FD3
37 #define USE_FD4
38 #define USE_TAPE
39 #define USE_SOCKET
40 #define USE_SHIFT_NUMPAD_KEY
41 #define USE_ALT_F10_KEY
42 #define USE_AUTO_KEY            5
43 #define USE_AUTO_KEY_RELEASE    6
44 #define USE_MONITOR_TYPE        4
45 #define USE_CRT_FILTER
46 #define USE_SCANLINE
47 #define USE_ACCESS_LAMP
48 #define USE_DEBUGGER
49 #define USE_STATE
50
51 #include "../../common.h"
52 #include "../../fileio.h"
53
54 class EMU;
55 class DEVICE;
56 class EVENT;
57
58 class DATAREC;
59 class I8253;
60 class I8255;
61 class IO;
62 class MB8877;
63 class PCM1BIT;
64 class RP5C01;
65 class W3100A;
66 class YM2203;
67 class Z80;
68 class Z80PIO;
69 class Z80SIO;
70
71 class CALENDAR;
72 class CMT;
73 class CRTC;
74 class FLOPPY;
75 class INTERRUPT;
76 class JOYSTICK;
77 class KEYBOARD;
78 class MEMORY;
79 class MOUSE;
80 class MZ1E26;
81 class MZ1E30;
82 class MZ1R13;
83 class MZ1R37;
84 class SERIAL;
85 class TIMER;
86
87 class VM
88 {
89 protected:
90         EMU* emu;
91         
92         // devices
93         EVENT* event;
94         
95         DATAREC* drec;
96         I8253* pit;
97         I8255* pio_i;
98         IO* io;
99         MB8877* fdc;
100         PCM1BIT* pcm;
101         RP5C01* rtc;
102         W3100A* w3100a;
103         YM2203* opn;
104         Z80* cpu;
105         Z80PIO* pio;
106         Z80SIO* sio;
107         
108         CALENDAR* calendar;
109         CMT* cmt;
110         CRTC* crtc;
111         FLOPPY* floppy;
112         INTERRUPT* interrupt;
113         JOYSTICK* joystick;
114         KEYBOARD* keyboard;
115         MEMORY* memory;
116         MOUSE* mouse;
117         MZ1E26* mz1e26;
118         MZ1E30* mz1e30;
119         MZ1R13* mz1r13;
120         MZ1R37* mz1r37;
121         SERIAL* serial;
122         TIMER* timer;
123         
124         // monitor type cache
125         int monitor_type;
126         
127 public:
128         // ----------------------------------------
129         // initialize
130         // ----------------------------------------
131         
132         VM(EMU* parent_emu);
133         ~VM();
134         
135         // ----------------------------------------
136         // for emulation class
137         // ----------------------------------------
138         
139         // drive virtual machine
140         void reset();
141         void special_reset();
142         void run();
143         
144 #ifdef USE_DEBUGGER
145         // debugger
146         DEVICE *get_cpu(int index);
147 #endif
148         
149         // draw screen
150         void draw_screen();
151         int access_lamp();
152         
153         // sound generation
154         void initialize_sound(int rate, int samples);
155         uint16* create_sound(int* extra_frames);
156         int sound_buffer_ptr();
157         
158         // socket
159         void network_connected(int ch);
160         void network_disconnected(int ch);
161         uint8* get_sendbuffer(int ch, int* size);
162         void inc_sendbuffer_ptr(int ch, int size);
163         uint8* get_recvbuffer0(int ch, int* size0, int* size1);
164         uint8* get_recvbuffer1(int ch);
165         void inc_recvbuffer_ptr(int ch, int size);
166         
167         // user interface
168         void open_disk(int drv, _TCHAR* file_path, int bank);
169         void close_disk(int drv);
170         bool disk_inserted(int drv);
171         void play_tape(_TCHAR* file_path);
172         void rec_tape(_TCHAR* file_path);
173         void close_tape();
174         bool tape_inserted();
175         bool now_skip();
176         
177         void update_config();
178         void save_state(FILEIO* state_fio);
179         bool load_state(FILEIO* state_fio);
180         
181         // ----------------------------------------
182         // for each device
183         // ----------------------------------------
184         
185         // devices
186         DEVICE* get_device(int id);
187         DEVICE* dummy;
188         DEVICE* first_device;
189         DEVICE* last_device;
190 };
191
192 #endif