OSDN Git Service

[General][Qt] Merge upstream 2015-03-15.
[csp-qt/common_source_project-fm7.git] / source / src / vm / fmr50 / fmr50.h
1 /*
2         FUJITSU FMR-50 Emulator 'eFMR-50'
3         FUJITSU FMR-60 Emulator 'eFMR-60'
4
5         Author : Takeda.Toshiya
6         Date   : 2008.04.28 -
7
8         [ virtual machine ]
9 */
10
11 #ifndef _FMR50_H_
12 #define _FMR50_H_
13
14 #if defined(_FMR50)
15 #if defined(HAS_I286)
16 #define DEVICE_NAME             "FUJITSU FMR-50 (i286)"
17 #define CONFIG_NAME             "fmr50_i286"
18 #elif defined(HAS_I386)
19 #define DEVICE_NAME             "FUJITSU FMR-50 (i386)"
20 #define CONFIG_NAME             "fmr50_i386"
21 #elif defined(HAS_I486)
22 #define DEVICE_NAME             "FUJITSU FMR-50 (i486)"
23 #define CONFIG_NAME             "fmr50_i486"
24 #elif defined(HAS_PENTIUM)
25 #define DEVICE_NAME             "FUJITSU FMR-250"
26 #define CONFIG_NAME             "fmr250"
27 #endif
28 #elif defined(_FMR60)
29 #if defined(HAS_I286)
30 #define DEVICE_NAME             "FUJITSU FMR-60"
31 #define CONFIG_NAME             "fmr60"
32 #elif defined(HAS_I386)
33 #define DEVICE_NAME             "FUJITSU FMR-70"
34 #define CONFIG_NAME             "fmr70"
35 #elif defined(HAS_I486)
36 #define DEVICE_NAME             "FUJITSU FMR-80"
37 #define CONFIG_NAME             "fmr80"
38 #elif defined(HAS_PENTIUM)
39 #define DEVICE_NAME             "FUJITSU FMR-280"
40 #define CONFIG_NAME             "fmr280"
41 #endif
42 #endif
43
44 // device informations for virtual machine
45 #define FRAMES_PER_SEC          55.4
46 #if defined(_FMR60)
47 #define LINES_PER_FRAME         784
48 #define CHARS_PER_LINE          98
49 #else
50 #define LINES_PER_FRAME         440
51 #define CHARS_PER_LINE          54
52 #endif
53 //#define CPU_CLOCKS            12000000
54 #define CPU_CLOCKS              8000000
55 #if defined(_FMR60)
56 #define SCREEN_WIDTH            1120
57 #define SCREEN_HEIGHT           750
58 #else
59 #define SCREEN_WIDTH            640
60 #define SCREEN_HEIGHT           400
61 #endif
62 #define MAX_DRIVE               4
63 #define MAX_SCSI                8
64 #define MAX_MEMCARD             2
65 #if defined(HAS_I286)
66 #define I86_BIOS_CALL
67 #else
68 #define I386_BIOS_CALL
69 #endif
70 #define I8259_MAX_CHIPS         2
71 //#define SINGLE_MODE_DMA
72 #define IO_ADDR_MAX             0x10000
73
74 // device informations for win32
75 #define USE_CPU_TYPE            2
76 #define USE_FD1
77 #define USE_FD2
78 #define USE_FD3
79 #define USE_FD4
80 #define NOTIFY_KEY_DOWN
81 #define USE_SHIFT_NUMPAD_KEY
82 #define USE_ALT_F10_KEY
83 #define USE_AUTO_KEY            5
84 #define USE_AUTO_KEY_RELEASE    6
85 #define USE_CRT_FILTER
86 #define USE_ACCESS_LAMP
87 #define USE_DEBUGGER
88 #define USE_STATE
89
90 #include "../../common.h"
91 #include "../../fileio.h"
92
93 class EMU;
94 class DEVICE;
95 class EVENT;
96
97 class HD46505;
98 #ifdef _FMR60
99 class HD63484;
100 #endif
101 class I8251;
102 class I8253;
103 class I8259;
104 #if defined(HAS_I286)
105 class I286;
106 #else
107 class I386;
108 #endif
109 class IO;
110 class MB8877;
111 class MSM58321;
112 class PCM1BIT;
113 class UPD71071;
114
115 class BIOS;
116 class CMOS;
117 class FLOPPY;
118 class KEYBOARD;
119 class MEMORY;
120 //class SERIAL;
121 class SCSI;
122 class TIMER;
123
124 class VM
125 {
126 protected:
127         EMU* emu;
128         
129         // devices
130         EVENT* event;
131         
132         HD46505* crtc;
133 #if defined(_FMR60)
134         HD63484* acrtc;
135 #endif
136         I8251* sio;
137         I8253* pit0;
138         I8253* pit1;
139         I8259* pic;
140 #if defined(HAS_I286)
141         I286* cpu;
142 #else
143         I386* cpu;
144 #endif
145         IO* io;
146         MB8877* fdc;
147         MSM58321* rtc;
148         PCM1BIT* pcm;
149         UPD71071* dma;
150         
151         BIOS* bios;
152         CMOS* cmos;
153         FLOPPY* floppy;
154         KEYBOARD* keyboard;
155         MEMORY* memory;
156         SCSI* scsi;
157 //      SERIAL* serial;
158         TIMER* timer;
159         
160 public:
161         // ----------------------------------------
162         // initialize
163         // ----------------------------------------
164         
165         VM(EMU* parent_emu);
166         ~VM();
167         
168         // ----------------------------------------
169         // for emulation class
170         // ----------------------------------------
171         
172         // drive virtual machine
173         void reset();
174         void run();
175         
176 #ifdef USE_DEBUGGER
177         // debugger
178         DEVICE *get_cpu(int index);
179 #endif
180         
181         // draw screen
182         void draw_screen();
183         int access_lamp();
184         
185         // sound generation
186         void initialize_sound(int rate, int samples);
187         uint16* create_sound(int* extra_frames);
188         int sound_buffer_ptr();
189         
190         // notify key
191         void key_down(int code, bool repeat);
192         void key_up(int code);
193         
194         // user interface
195         void open_disk(int drv, _TCHAR* file_path, int bank);
196         void close_disk(int drv);
197         bool disk_inserted(int drv);
198         bool now_skip();
199         
200         void update_config();
201         void save_state(FILEIO* state_fio);
202         bool load_state(FILEIO* state_fio);
203         
204         // ----------------------------------------
205         // for each device
206         // ----------------------------------------
207         
208         // devices
209         DEVICE* get_device(int id);
210         DEVICE* dummy;
211         DEVICE* first_device;
212         DEVICE* last_device;
213 };
214
215 #endif