OSDN Git Service

[VM][STATE] Apply New framework to some VMs.
[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                1
37 #define USE_TAPE_BUTTON
38 #define USE_ALT_F10_KEY
39 #define USE_AUTO_KEY            6
40 #define USE_AUTO_KEY_RELEASE    10
41 #define USE_AUTO_KEY_CAPS
42 #define USE_SOUND_VOLUME        3
43 #define USE_JOYSTICK
44 #define USE_DEBUGGER
45 #define USE_STATE
46 #define USE_CPU_Z80
47
48 #include "../../common.h"
49 #include "../../fileio.h"
50 #include "../vm_template.h"
51
52 #ifdef USE_SOUND_VOLUME
53 static const _TCHAR *sound_device_caption[] = {
54         _T("PSG"), _T("CMT (Signal)"), _T("Noise (CMT)"),
55 };
56 #endif
57
58 class csp_state_utils;
59
60 class EMU;
61 class DEVICE;
62 class EVENT;
63
64 class DATAREC;
65 class IO;
66 class MC6847;
67 class NOT;
68 //class YM2203;
69 class AY_3_891X;
70 class Z80;
71
72 class JOYSTICK;
73 class KEYBOARD;
74 class PHC25_MEMORY;
75 class PHC25_SYSTEM;
76
77 class VM : public VM_TEMPLATE
78 {
79 protected:
80         //EMU* emu;
81         //csp_state_utils* state_entry;
82         
83         // devices
84         //EVENT* event;
85         
86         DATAREC* drec;
87         IO* io;
88         MC6847* vdp;
89         NOT* not_vsync;
90 //      YM2203* psg;
91         AY_3_891X* psg;
92         Z80* cpu;
93         
94         JOYSTICK* joystick;
95         KEYBOARD* keyboard;
96         PHC25_MEMORY* memory;
97         PHC25_SYSTEM* system;
98         
99 public:
100         // ----------------------------------------
101         // initialize
102         // ----------------------------------------
103         
104         VM(EMU* parent_emu);
105         ~VM();
106         
107         // ----------------------------------------
108         // for emulation class
109         // ----------------------------------------
110         
111         // drive virtual machine
112         void reset();
113         void run();
114         
115 #ifdef USE_DEBUGGER
116         // debugger
117         DEVICE *get_cpu(int index);
118 #endif
119         
120         // draw screen
121         void draw_screen();
122         
123         // sound generation
124         void initialize_sound(int rate, int samples);
125         uint16_t* create_sound(int* extra_frames);
126         int get_sound_buffer_ptr();
127 #ifdef USE_SOUND_VOLUME
128         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
129 #endif
130         
131         // user interface
132         void play_tape(int drv, const _TCHAR* file_path);
133         void rec_tape(int drv, const _TCHAR* file_path);
134         void close_tape(int drv);
135         bool is_tape_inserted(int drv);
136         bool is_tape_playing(int drv);
137         bool is_tape_recording(int drv);
138         int get_tape_position(int drv);
139         const _TCHAR* get_tape_message(int drv);
140         void push_play(int drv);
141         void push_stop(int drv);
142         void push_fast_forward(int drv);
143         void push_fast_rewind(int drv);
144         void push_apss_forward(int drv) {}
145         void push_apss_rewind(int drv) {}
146         bool is_frame_skippable();
147         
148         void update_config();
149         bool process_state(FILEIO* state_fio, bool loading);
150         
151         // ----------------------------------------
152         // for each device
153         // ----------------------------------------
154         
155         // devices
156         DEVICE* get_device(int id);
157         //DEVICE* dummy;
158         //DEVICE* first_device;
159         //DEVICE* last_device;
160 };
161
162 #endif