OSDN Git Service

[VM][EVENT] Specify CPU per VM.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pv1000 / pv1000.h
1 /*
2         CASIO PV-1000 Emulator 'ePV-1000'
3
4         Author : Takeda.Toshiya
5         Date   : 2006.11.16 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PV1000_H_
11 #define _PV1000_H_
12
13 #define DEVICE_NAME             "CASIO PV-1000"
14 #define CONFIG_NAME             "pv1000"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60
18 #define LINES_PER_FRAME         67
19 #define CPU_CLOCKS              3579545
20 #define SCREEN_WIDTH            256
21 #define SCREEN_HEIGHT           192
22 #define LINES_PER_HBLANK        51
23 #define CLOCKS_PER_HBLANK       800
24 #define MEMORY_ADDR_MAX         0x10000
25 #define MEMORY_BANK_SIZE        0x800
26
27 // device informations for win32
28 #define SUPPORT_TV_RENDER
29 #define USE_CART1
30 #define USE_SOUND_VOLUME        1
31 #define USE_JOYSTICK
32 #define USE_JOY_BUTTON_CAPTIONS
33 #define USE_DEBUGGER
34 #define USE_STATE
35 #define USE_CPU_Z80
36
37 #include "../../common.h"
38 #include "../../fileio.h"
39
40 #ifdef USE_SOUND_VOLUME
41 static const _TCHAR *sound_device_caption[] = {
42         _T("PSG"),
43 };
44 #endif
45
46 #ifdef USE_JOY_BUTTON_CAPTIONS
47 static const _TCHAR *joy_button_captions[] = {
48         _T("Up"),
49         _T("Down"),
50         _T("Left"),
51         _T("Right"),
52         _T("Button #1"),
53         _T("Button #2"),
54         _T("Select"),
55         _T("Start"),
56 };
57 #endif
58
59 class EMU;
60 class DEVICE;
61 class EVENT;
62
63 class IO;
64 class MEMORY;
65 class Z80;
66
67 class JOYSTICK;
68 class PSG;
69 class VDP;
70
71 class VM
72 {
73 protected:
74         EMU* emu;
75         
76         // devices
77         EVENT* event;
78         
79         IO* io;
80         MEMORY* memory;
81         Z80* cpu;
82         
83         JOYSTICK* joystick;
84         PSG* psg;
85         VDP* vdp;
86         
87         // memory
88         uint8_t mem[0x10000];
89         bool inserted;
90         
91 public:
92         // ----------------------------------------
93         // initialize
94         // ----------------------------------------
95         
96         VM(EMU* parent_emu);
97         ~VM();
98         
99         // ----------------------------------------
100         // for emulation class
101         // ----------------------------------------
102         
103         // drive virtual machine
104         void reset();
105         void run();
106         
107 #ifdef USE_DEBUGGER
108         // debugger
109         DEVICE *get_cpu(int index);
110 #endif
111         
112         // draw screen
113         void draw_screen();
114         
115         // sound generation
116         void initialize_sound(int rate, int samples);
117         uint16_t* create_sound(int* extra_frames);
118         int get_sound_buffer_ptr();
119 #ifdef USE_SOUND_VOLUME
120         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
121 #endif
122         
123         // user interface
124         void open_cart(int drv, const _TCHAR* file_path);
125         void close_cart(int drv);
126         bool is_cart_inserted(int drv);
127         bool is_frame_skippable();
128         
129         void update_config();
130         void save_state(FILEIO* state_fio);
131         bool load_state(FILEIO* state_fio);
132         
133         // ----------------------------------------
134         // for each device
135         // ----------------------------------------
136         
137         // devices
138         DEVICE* get_device(int id);
139         DEVICE* dummy;
140         DEVICE* first_device;
141         DEVICE* last_device;
142 };
143
144 #endif