OSDN Git Service

[VM][STATE] Apply New framework to some VMs.
[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_CART                        1
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 #include "../vm_template.h"
40
41 #ifdef USE_SOUND_VOLUME
42 static const _TCHAR *sound_device_caption[] = {
43         _T("PSG"),
44 };
45 #endif
46
47 #ifdef USE_JOY_BUTTON_CAPTIONS
48 static const _TCHAR *joy_button_captions[] = {
49         _T("Up"),
50         _T("Down"),
51         _T("Left"),
52         _T("Right"),
53         _T("Button #1"),
54         _T("Button #2"),
55         _T("Select"),
56         _T("Start"),
57 };
58 #endif
59
60 class csp_state_utils;
61
62 class EMU;
63 class DEVICE;
64 class EVENT;
65
66 class IO;
67 class MEMORY;
68 class Z80;
69
70 class JOYSTICK;
71 class PSG;
72 class VDP;
73
74 class VM : public VM_TEMPLATE
75 {
76 protected:
77         //EMU* emu;
78         //csp_state_utils* state_entry;
79         
80         // devices
81         //EVENT* event;
82         
83         IO* io;
84         MEMORY* memory;
85         Z80* cpu;
86         
87         JOYSTICK* joystick;
88         PSG* psg;
89         VDP* vdp;
90         
91         // memory
92         uint8_t mem[0x10000];
93         bool inserted;
94         
95 public:
96         // ----------------------------------------
97         // initialize
98         // ----------------------------------------
99         
100         VM(EMU* parent_emu);
101         ~VM();
102         
103         // ----------------------------------------
104         // for emulation class
105         // ----------------------------------------
106         
107         // drive virtual machine
108         void reset();
109         void run();
110         
111 #ifdef USE_DEBUGGER
112         // debugger
113         DEVICE *get_cpu(int index);
114 #endif
115         
116         // draw screen
117         void draw_screen();
118         
119         // sound generation
120         void initialize_sound(int rate, int samples);
121         uint16_t* create_sound(int* extra_frames);
122         int get_sound_buffer_ptr();
123 #ifdef USE_SOUND_VOLUME
124         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
125 #endif
126         
127         // user interface
128         void open_cart(int drv, const _TCHAR* file_path);
129         void close_cart(int drv);
130         bool is_cart_inserted(int drv);
131         bool is_frame_skippable();
132         
133         void update_config();
134         bool process_state(FILEIO* state_fio, bool loading);
135         
136         // ----------------------------------------
137         // for each device
138         // ----------------------------------------
139         
140         // devices
141         DEVICE* get_device(int id);
142         //DEVICE* dummy;
143         //DEVICE* first_device;
144         //DEVICE* last_device;
145 };
146
147 #endif