OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[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_FLOPPY_DISK         2
30 #define NOTIFY_KEY_DOWN
31 #define USE_KEY_LOCKED
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_AUTO_KEY_NUMPAD
37 #define USE_SCREEN_FILTER
38 #define USE_SOUND_VOLUME        2
39 #define USE_DEBUGGER
40 #define USE_CPU_I386
41
42 #include "../../common.h"
43 #include "../../fileio.h"
44 #include "../vm_template.h"
45
46 #ifdef USE_SOUND_VOLUME
47 static const _TCHAR *sound_device_caption[] = {
48         _T("Beep"), _T("Noise (FDD)"),
49 };
50 #endif
51
52 class EMU;
53 class DEVICE;
54 class EVENT;
55
56 class BEEP;
57 class I386;
58 class I8237;
59 class I8251;
60 class I8253;
61 class I8255;
62 class I8259;
63 class IO;
64 class UPD1990A;
65 class UPD7220;
66 class UPD765A;
67
68 namespace N5200 {
69         class DISPLAY;
70         class FLOPPY;
71         class KEYBOARD;
72         class MEMORY;
73         class SYSTEM;
74 }
75
76 class VM : public VM_TEMPLATE
77 {
78 protected:
79         //EMU* emu;
80         
81         // devices
82         //EVENT* event;
83         
84         BEEP* beep;
85         I386* cpu;
86         I8237* dma;
87         I8251* sio_r;
88         I8251* sio_k;
89         I8253* pit;
90         I8255* pio_s;
91         I8255* pio_p;
92         I8259* pic;
93         IO* io;
94         UPD1990A* rtc;
95         UPD7220* gdc_c;
96         UPD7220* gdc_g;
97         UPD765A* fdc;
98         
99         N5200::DISPLAY* display;
100         N5200::FLOPPY* floppy;
101         N5200::KEYBOARD* keyboard;
102         N5200::MEMORY* memory;
103         N5200::SYSTEM* system;
104         
105 public:
106         // ----------------------------------------
107         // initialize
108         // ----------------------------------------
109         
110         VM(EMU* parent_emu);
111         ~VM();
112         
113         // ----------------------------------------
114         // for emulation class
115         // ----------------------------------------
116         
117         // drive virtual machine
118         void reset();
119         void run();
120         
121 #ifdef USE_DEBUGGER
122         // debugger
123         DEVICE *get_cpu(int index);
124 #endif
125         
126         // draw screen
127         void draw_screen();
128         
129         // sound generation
130         void initialize_sound(int rate, int samples);
131         uint16_t* create_sound(int* extra_frames);
132         int get_sound_buffer_ptr();
133 #ifdef USE_SOUND_VOLUME
134         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
135 #endif
136         
137         // notify key
138         void key_down(int code, bool repeat);
139         void key_up(int code);
140         bool get_caps_locked();
141         bool get_kana_locked();
142         
143         // user interface
144         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
145         void close_floppy_disk(int drv);
146         bool is_floppy_disk_inserted(int drv);
147         void is_floppy_disk_protected(int drv, bool value);
148         bool is_floppy_disk_protected(int drv);
149         uint32_t is_floppy_disk_accessed();
150         bool is_frame_skippable();
151         
152         void update_config();
153         bool process_state(FILEIO* state_fio, bool loading);
154         
155         // ----------------------------------------
156         // for each device
157         // ----------------------------------------
158         
159         // devices
160         DEVICE* get_device(int id);
161         //DEVICE* dummy;
162         //DEVICE* first_device;
163         //DEVICE* last_device;
164 };
165
166 #endif