OSDN Git Service

[GENERAL] Merge upstream 2017-03-04. Still checking FTBFSs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / phc25 / phc25.h
1 /*
2         SANYO PHC-25 Emulator 'ePHC-25'
3         SEIKO MAP-1010 Emulator 'eMAP-1010'
4
5         Author : Takeda.Toshiya
6         Date   : 2010.08.03-
7
8         [ virtual machine ]
9 */
10
11 #ifndef _PHC25_H_
12 #define _PHC25_H_
13
14 #ifdef _MAP1010
15 #define DEVICE_NAME             "SEIKO MAP-1010"
16 #define CONFIG_NAME             "map1010"
17 #else
18 #define DEVICE_NAME             "SANYO PHC-25"
19 #define CONFIG_NAME             "phc25"
20 #endif
21
22 // device informations for virtual machine
23 #define FRAMES_PER_SEC          60
24 #define LINES_PER_FRAME         262
25 #define CPU_CLOCKS              4000000
26 #define SCREEN_WIDTH            256
27 #define SCREEN_HEIGHT           192
28
29 #define MC6847_ATTR_OFS         0x800
30 #define MC6847_ATTR_INV         0x01
31 #define MC6847_ATTR_AS          0x02
32 #define MC6847_ATTR_CSS         0x04
33 #define HAS_AY_3_8910
34
35 // device informations for win32
36 #define USE_TAPE
37 #define USE_ALT_F10_KEY
38 #define USE_AUTO_KEY            6
39 #define USE_AUTO_KEY_RELEASE    10
40 #define USE_AUTO_KEY_CAPS
41 #define USE_SOUND_FILES         2
42 #define USE_SOUND_FILES_RELAY
43 #if defined(USE_SOUND_FILES)
44 #define USE_SOUND_VOLUME        3
45 #else
46 #define USE_SOUND_VOLUME        2
47 #endif
48 #define USE_JOYSTICK
49 #define USE_DEBUGGER
50 #define USE_STATE
51
52 #include "../../common.h"
53 #include "../../fileio.h"
54
55 #ifdef USE_SOUND_VOLUME
56 static const _TCHAR *sound_device_caption[] = {
57         _T("PSG"), _T("CMT"),
58 #if defined(USE_SOUND_FILES)
59         _T("CMT Relay"),
60 #endif
61 };
62 #endif
63
64 class EMU;
65 class DEVICE;
66 class EVENT;
67
68 class DATAREC;
69 class IO;
70 class MC6847;
71 class NOT;
72 //class YM2203;
73 class AY_3_891X;
74 class Z80;
75
76 class JOYSTICK;
77 class KEYBOARD;
78 class MEMORY;
79 class SYSTEM;
80
81 class VM
82 {
83 protected:
84         EMU* emu;
85         
86         // devices
87         EVENT* event;
88         
89         DATAREC* drec;
90         IO* io;
91         MC6847* vdp;
92         NOT* not_vsync;
93 //      YM2203* psg;
94         AY_3_891X* psg;
95         Z80* cpu;
96         
97         JOYSTICK* joystick;
98         KEYBOARD* keyboard;
99         MEMORY* memory;
100         SYSTEM* system;
101         
102 public:
103         // ----------------------------------------
104         // initialize
105         // ----------------------------------------
106         
107         VM(EMU* parent_emu);
108         ~VM();
109         
110         // ----------------------------------------
111         // for emulation class
112         // ----------------------------------------
113         
114         // drive virtual machine
115         void reset();
116         void run();
117         
118 #ifdef USE_DEBUGGER
119         // debugger
120         DEVICE *get_cpu(int index);
121 #endif
122         
123         // draw screen
124         void draw_screen();
125         
126         // sound generation
127         void initialize_sound(int rate, int samples);
128         uint16_t* create_sound(int* extra_frames);
129         int get_sound_buffer_ptr();
130 #ifdef USE_SOUND_VOLUME
131         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
132 #endif
133         
134         // user interface
135         void play_tape(const _TCHAR* file_path);
136         void rec_tape(const _TCHAR* file_path);
137         void close_tape();
138         bool is_tape_inserted();
139         bool is_tape_playing();
140         bool is_tape_recording();
141         int get_tape_position();
142         bool is_frame_skippable();
143         
144         void update_config();
145         void save_state(FILEIO* state_fio);
146         bool load_state(FILEIO* state_fio);
147         
148         // ----------------------------------------
149         // for each device
150         // ----------------------------------------
151         
152         // devices
153         DEVICE* get_device(int id);
154         DEVICE* dummy;
155         DEVICE* first_device;
156         DEVICE* last_device;
157 };
158
159 #endif