OSDN Git Service

[VM][MZ2800] Fix crash at building VM. Thanks to http://hanabi.2ch.net/test/read...
[csp-qt/common_source_project-fm7.git] / source / src / vm / n5200 / n5200.h
1 /*
2         NEC N5200 Emulator 'eN5200'
3
4         Author : Takeda.Toshiya
5         Date   : 2009.06.03-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _N5200_H_
11 #define _N5200_H_
12
13 #define DEVICE_NAME             "NEC N5200"
14 #define CONFIG_NAME             "n5200"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          55.4
18 #define LINES_PER_FRAME         550
19 #define CPU_CLOCKS              16000000
20 #define SCREEN_WIDTH            640
21 #define SCREEN_HEIGHT           400
22 #define WINDOW_HEIGHT_ASPECT    480
23 #define MAX_DRIVE               4
24 #define HAS_I386
25 #define I8259_MAX_CHIPS         2
26 #define IO_ADDR_MAX             0x10000
27
28 // device informations for win32
29 #define USE_FD1
30 #define USE_FD2
31 #define NOTIFY_KEY_DOWN
32 #define USE_SHIFT_NUMPAD_KEY
33 #define USE_ALT_F10_KEY
34 #define USE_AUTO_KEY            5
35 #define USE_AUTO_KEY_RELEASE    6
36 #define USE_CRT_FILTER
37 #define USE_ACCESS_LAMP
38 #define USE_SOUND_VOLUME        1
39
40 #include "../../common.h"
41 #include "../../fileio.h"
42
43 #ifdef USE_SOUND_VOLUME
44 static const _TCHAR *sound_device_caption[] = {
45         _T("Beep"),
46 };
47 #endif
48
49 class EMU;
50 class DEVICE;
51 class EVENT;
52
53 class BEEP;
54 class I386;
55 class I8237;
56 class I8251;
57 class I8253;
58 class I8255;
59 class I8259;
60 class IO;
61 class UPD1990A;
62 class UPD7220;
63 class UPD765A;
64
65 class DISPLAY;
66 class FLOPPY;
67 class KEYBOARD;
68 class MEMORY;
69 class SYSTEM;
70
71 class VM
72 {
73 protected:
74         EMU* emu;
75         
76         // devices
77         EVENT* event;
78         
79         BEEP* beep;
80         I386* cpu;
81         I8237* dma;
82         I8251* sio_r;
83         I8251* sio_k;
84         I8253* pit;
85         I8255* pio_s;
86         I8255* pio_p;
87         I8259* pic;
88         IO* io;
89         UPD1990A* rtc;
90         UPD7220* gdc_c;
91         UPD7220* gdc_g;
92         UPD765A* fdc;
93         
94         DISPLAY* display;
95         FLOPPY* floppy;
96         KEYBOARD* keyboard;
97         MEMORY* memory;
98         SYSTEM* system;
99         
100 public:
101         // ----------------------------------------
102         // initialize
103         // ----------------------------------------
104         
105         VM(EMU* parent_emu);
106         ~VM();
107         
108         // ----------------------------------------
109         // for emulation class
110         // ----------------------------------------
111         
112         // drive virtual machine
113         void reset();
114         void run();
115         
116         // draw screen
117         void draw_screen();
118         uint32_t get_access_lamp_status();
119         
120         // sound generation
121         void initialize_sound(int rate, int samples);
122         uint16_t* create_sound(int* extra_frames);
123         int get_sound_buffer_ptr();
124 #ifdef USE_SOUND_VOLUME
125         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
126 #endif
127         
128         // notify key
129         void key_down(int code, bool repeat);
130         void key_up(int code);
131         
132         // user interface
133         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
134         void close_floppy_disk(int drv);
135         bool is_floppy_disk_inserted(int drv);
136         void is_floppy_disk_protected(int drv, bool value);
137         bool is_floppy_disk_protected(int drv);
138         bool is_frame_skippable();
139         
140         void update_config();
141         
142         // ----------------------------------------
143         // for each device
144         // ----------------------------------------
145         
146         // devices
147         DEVICE* get_device(int id);
148         DEVICE* dummy;
149         DEVICE* first_device;
150         DEVICE* last_device;
151 };
152
153 #endif