OSDN Git Service

[VM] Fix FTBFS for Upstream 2017-03-12.
[csp-qt/common_source_project-fm7.git] / source / src / vm / phc20 / phc20.h
1 /*
2         SANYO PHC-20 Emulator 'ePHC-20'
3
4         Author : Takeda.Toshiya
5         Date   : 2010.09.03-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PHC20_H_
11 #define _PHC20_H_
12
13 #define DEVICE_NAME             "SANYO PHC-20"
14 #define CONFIG_NAME             "phc20"
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            256
21 #define SCREEN_HEIGHT           192
22
23 #define MC6847_VRAM_INV         0x40
24
25 // device informations for win32
26 #define USE_TAPE
27 #define USE_ALT_F10_KEY
28 #define USE_AUTO_KEY            6
29 #define USE_AUTO_KEY_RELEASE    10
30 #define USE_AUTO_KEY_NO_CAPS
31 #define USE_SOUND_VOLUME        2
32 #define USE_DEBUGGER
33 #define USE_STATE
34
35 #include "../../common.h"
36 #include "../../fileio.h"
37
38 #ifdef USE_SOUND_VOLUME
39 static const _TCHAR *sound_device_caption[] = {
40         _T("CMT (Signal)"), _T("Noise (CMT)"),
41 };
42 #endif
43
44 class EMU;
45 class DEVICE;
46 class EVENT;
47
48 class DATAREC;
49 class MC6847;
50 class Z80;
51
52 class MEMORY;
53
54 class VM
55 {
56 protected:
57         EMU* emu;
58         
59         // devices
60         EVENT* event;
61         
62         DATAREC* drec;
63         MC6847* vdp;
64         Z80* cpu;
65         
66         MEMORY* memory;
67         
68 public:
69         // ----------------------------------------
70         // initialize
71         // ----------------------------------------
72         
73         VM(EMU* parent_emu);
74         ~VM();
75         
76         // ----------------------------------------
77         // for emulation class
78         // ----------------------------------------
79         
80         // drive virtual machine
81         void reset();
82         void run();
83         
84 #ifdef USE_DEBUGGER
85         // debugger
86         DEVICE *get_cpu(int index);
87 #endif
88         
89         // draw screen
90         void draw_screen();
91         
92         // sound generation
93         void initialize_sound(int rate, int samples);
94         uint16_t* create_sound(int* extra_frames);
95         int get_sound_buffer_ptr();
96 #ifdef USE_SOUND_VOLUME
97         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
98 #endif
99         
100         // user interface
101         void play_tape(const _TCHAR* file_path);
102         void rec_tape(const _TCHAR* file_path);
103         void close_tape();
104         bool is_tape_inserted();
105         bool is_tape_playing();
106         bool is_tape_recording();
107         int get_tape_position();
108         bool is_frame_skippable();
109         
110         void update_config();
111         void save_state(FILEIO* state_fio);
112         bool load_state(FILEIO* state_fio);
113         
114         // ----------------------------------------
115         // for each device
116         // ----------------------------------------
117         
118         // devices
119         DEVICE* get_device(int id);
120         DEVICE* dummy;
121         DEVICE* first_device;
122         DEVICE* last_device;
123 };
124
125 #endif