OSDN Git Service

[VM][DATAREC][FDD] Add sounds of SEEK/CMT, excepts either pseudo devices / bios.
[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_FILES         2
32 #if defined(USE_SOUND_FILES)
33 #define USE_SOUND_VOLUME        2
34 #else
35 #define USE_SOUND_VOLUME        1
36 #endif
37 #define USE_DEBUGGER
38 #define USE_STATE
39
40 #include "../../common.h"
41 #include "../../fileio.h"
42
43 #ifdef USE_SOUND_VOLUME
44 static const _TCHAR *sound_device_caption[] = {
45         _T("CMT"),
46 #if defined(USE_SOUND_FILES)
47         _T("CMT Relay"),
48 #endif
49 };
50 #endif
51
52 class EMU;
53 class DEVICE;
54 class EVENT;
55
56 class DATAREC;
57 class MC6847;
58 class Z80;
59
60 class MEMORY;
61
62 class VM
63 {
64 protected:
65         EMU* emu;
66         
67         // devices
68         EVENT* event;
69         
70         DATAREC* drec;
71         MC6847* vdp;
72         Z80* cpu;
73         
74         MEMORY* memory;
75         
76 public:
77         // ----------------------------------------
78         // initialize
79         // ----------------------------------------
80         
81         VM(EMU* parent_emu);
82         ~VM();
83         
84         // ----------------------------------------
85         // for emulation class
86         // ----------------------------------------
87         
88         // drive virtual machine
89         void reset();
90         void run();
91         
92 #ifdef USE_DEBUGGER
93         // debugger
94         DEVICE *get_cpu(int index);
95 #endif
96         
97         // draw screen
98         void draw_screen();
99         
100         // sound generation
101         void initialize_sound(int rate, int samples);
102         uint16_t* create_sound(int* extra_frames);
103         int get_sound_buffer_ptr();
104 #ifdef USE_SOUND_VOLUME
105         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
106 #endif
107         
108         // user interface
109         void play_tape(const _TCHAR* file_path);
110         void rec_tape(const _TCHAR* file_path);
111         void close_tape();
112         bool is_tape_inserted();
113         bool is_tape_playing();
114         bool is_tape_recording();
115         int get_tape_position();
116         bool is_frame_skippable();
117         
118         void update_config();
119         void save_state(FILEIO* state_fio);
120         bool load_state(FILEIO* state_fio);
121         
122         // ----------------------------------------
123         // for each device
124         // ----------------------------------------
125         
126         // devices
127         DEVICE* get_device(int id);
128         DEVICE* dummy;
129         DEVICE* first_device;
130         DEVICE* last_device;
131 };
132
133 #endif