OSDN Git Service

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