OSDN Git Service

[VM][General] Merge upstream 2016-02-13. Still don't implement OSD/Gui part of joysti...
[csp-qt/common_source_project-fm7.git] / source / src / vm / scv / scv.h
1 /*
2         EPOCH Super Cassette Vision Emulator 'eSCV'
3
4         Author : Takeda.Toshiya
5         Date   : 2006.08.21 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _SCV_H_
11 #define _SCV_H_
12
13 #define DEVICE_NAME             "EPOCH SCV"
14 #define CONFIG_NAME             "scv"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60
18 #define LINES_PER_FRAME         262
19 #define CPU_CLOCKS              4000000
20 #define SCREEN_WIDTH            192
21 #define SCREEN_WIDTH_ASPECT     288
22 #define SCREEN_HEIGHT           222
23
24 // memory wait
25 //#define UPD7801_MEMORY_WAIT
26
27 // device informations for win32
28 #define USE_CART1
29 #define USE_SOUND_VOLUME        2
30 #define USE_DEBUGGER
31 #define USE_JOYSTICK
32 #define USE_STATE
33 #define USE_CRT_MONITOR_4_3 1
34
35 #include "../../common.h"
36 #include "../../fileio.h"
37
38 #ifdef USE_SOUND_VOLUME
39 static const _TCHAR *sound_device_caption[] = {
40         _T("PSG"), _T("PCM"),
41 };
42 static const bool sound_device_monophonic[] = {
43         false, false,
44 };
45 #endif
46
47 class EMU;
48 class DEVICE;
49 class EVENT;
50
51 class UPD7801;
52
53 class IO;
54 class MEMORY;
55 class SOUND;
56 class VDP;
57
58 class VM
59 {
60 protected:
61         EMU* emu;
62         
63         // devices
64         EVENT* event;
65         
66         UPD7801* cpu;
67         
68         IO* io;
69         MEMORY* memory;
70         SOUND* sound;
71         VDP* vdp;
72         
73 public:
74         // ----------------------------------------
75         // initialize
76         // ----------------------------------------
77         
78         VM(EMU* parent_emu);
79         ~VM();
80         
81         // ----------------------------------------
82         // for emulation class
83         // ----------------------------------------
84         
85         // drive virtual machine
86         void reset();
87         void run();
88         
89 #ifdef USE_DEBUGGER
90         // debugger
91         DEVICE *get_cpu(int index);
92 #endif
93         
94         // draw screen
95         void draw_screen();
96         
97         // sound generation
98         void initialize_sound(int rate, int samples);
99         uint16* create_sound(int* extra_frames);
100         int sound_buffer_ptr();
101 #ifdef USE_SOUND_VOLUME
102         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
103 #endif
104         
105         // user interface
106         void open_cart(int drv, const _TCHAR* file_path);
107         void close_cart(int drv);
108         bool cart_inserted(int drv);
109         bool now_skip();
110         
111         void update_config();
112         void save_state(FILEIO* state_fio);
113         bool load_state(FILEIO* state_fio);
114         
115         // ----------------------------------------
116         // for each device
117         // ----------------------------------------
118         
119         // devices
120         DEVICE* get_device(int id);
121         DEVICE* dummy;
122         DEVICE* first_device;
123         DEVICE* last_device;
124 };
125
126 #endif