OSDN Git Service

[VM][EVENT] Specify CPU per VM.
[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_TAPE1
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 #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("CMT (Signal)"), _T("Noise (CMT)"),
43 };
44 #endif
45
46 class EMU;
47 class DEVICE;
48 class EVENT;
49
50 class DATAREC;
51 class MC6847;
52 class Z80;
53
54 class MEMORY;
55
56 class VM
57 {
58 protected:
59         EMU* emu;
60         
61         // devices
62         EVENT* event;
63         
64         DATAREC* drec;
65         MC6847* vdp;
66         Z80* cpu;
67         
68         MEMORY* memory;
69         
70 public:
71         // ----------------------------------------
72         // initialize
73         // ----------------------------------------
74         
75         VM(EMU* parent_emu);
76         ~VM();
77         
78         // ----------------------------------------
79         // for emulation class
80         // ----------------------------------------
81         
82         // drive virtual machine
83         void reset();
84         void run();
85         
86 #ifdef USE_DEBUGGER
87         // debugger
88         DEVICE *get_cpu(int index);
89 #endif
90         
91         // draw screen
92         void draw_screen();
93         
94         // sound generation
95         void initialize_sound(int rate, int samples);
96         uint16_t* create_sound(int* extra_frames);
97         int get_sound_buffer_ptr();
98 #ifdef USE_SOUND_VOLUME
99         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
100 #endif
101         
102         // user interface
103         void play_tape(int drv, const _TCHAR* file_path);
104         void rec_tape(int drv, const _TCHAR* file_path);
105         void close_tape(int drv);
106         bool is_tape_inserted(int drv);
107         bool is_tape_playing(int drv);
108         bool is_tape_recording(int drv);
109         int get_tape_position(int drv);
110         const _TCHAR* get_tape_message(int drv);
111         bool is_frame_skippable();
112         
113         void update_config();
114         void save_state(FILEIO* state_fio);
115         bool load_state(FILEIO* state_fio);
116         
117         // ----------------------------------------
118         // for each device
119         // ----------------------------------------
120         
121         // devices
122         DEVICE* get_device(int id);
123         DEVICE* dummy;
124         DEVICE* first_device;
125         DEVICE* last_device;
126 };
127
128 #endif