OSDN Git Service

f53593b38ade914d18758eb9b349fc78f2857395
[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 class DISPLAY;
69 class FLOPPY;
70 class KEYBOARD;
71 class MEMORY;
72 class SYSTEM;
73
74 class VM : public VM_TEMPLATE
75 {
76 protected:
77         //EMU* emu;
78         
79         // devices
80         //EVENT* event;
81         
82         BEEP* beep;
83         I386* cpu;
84         I8237* dma;
85         I8251* sio_r;
86         I8251* sio_k;
87         I8253* pit;
88         I8255* pio_s;
89         I8255* pio_p;
90         I8259* pic;
91         IO* io;
92         UPD1990A* rtc;
93         UPD7220* gdc_c;
94         UPD7220* gdc_g;
95         UPD765A* fdc;
96         
97         DISPLAY* display;
98         FLOPPY* floppy;
99         KEYBOARD* keyboard;
100         MEMORY* memory;
101         SYSTEM* system;
102         
103 public:
104         // ----------------------------------------
105         // initialize
106         // ----------------------------------------
107         
108         VM(EMU* parent_emu);
109         ~VM();
110         
111         // ----------------------------------------
112         // for emulation class
113         // ----------------------------------------
114         
115         // drive virtual machine
116         void reset();
117         void run();
118         
119 #ifdef USE_DEBUGGER
120         // debugger
121         DEVICE *get_cpu(int index);
122 #endif
123         
124         // draw screen
125         void draw_screen();
126         
127         // sound generation
128         void initialize_sound(int rate, int samples);
129         uint16_t* create_sound(int* extra_frames);
130         int get_sound_buffer_ptr();
131 #ifdef USE_SOUND_VOLUME
132         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
133 #endif
134         
135         // notify key
136         void key_down(int code, bool repeat);
137         void key_up(int code);
138         bool get_caps_locked();
139         bool get_kana_locked();
140         
141         // user interface
142         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
143         void close_floppy_disk(int drv);
144         bool is_floppy_disk_inserted(int drv);
145         void is_floppy_disk_protected(int drv, bool value);
146         bool is_floppy_disk_protected(int drv);
147         uint32_t is_floppy_disk_accessed();
148         bool is_frame_skippable();
149         
150         void update_config();
151         bool process_state(FILEIO* state_fio, bool loading);
152         
153         // ----------------------------------------
154         // for each device
155         // ----------------------------------------
156         
157         // devices
158         DEVICE* get_device(int id);
159         //DEVICE* dummy;
160         //DEVICE* first_device;
161         //DEVICE* last_device;
162 };
163
164 #endif