OSDN Git Service

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