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 / pcengine / pcengine.h
1 /*
2         NEC-HE PC Engine Emulator 'ePCEngine'
3
4         Author : Takeda.Toshiya
5         Date   : 2012.10.31-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PCENGINE_H_
11 #define _PCENGINE_H_
12
13 #define DEVICE_NAME             "NEC-HE PC Engine"
14 #define CONFIG_NAME             "pcengine"
15
16 #define FRAMES_PER_SEC          60
17 #define LINES_PER_FRAME         262
18 #define CPU_CLOCKS              7159090
19 #define SCREEN_WIDTH            352
20 #define SCREEN_HEIGHT           240
21 // pixel aspect should be 8:7
22 #define WINDOW_HEIGHT_ASPECT    210
23
24 #define SUPPORT_SUPER_GFX
25 #define SUPPORT_BACKUP_RAM
26 #define SUPPORT_CDROM
27 #define _SCSI_DEBUG_LOG
28 #define _CDROM_DEBUG_LOG
29
30 //#define SCSI_HOST_AUTO_ACK
31 #define SCSI_DEV_IMMEDIATE_SELECT
32
33 // device informations for win32
34 #define SOUND_RATE_DEFAULT      5       // 44100Hz
35 #define SUPPORT_TV_RENDER
36 #define USE_CART                1
37 #define USE_COMPACT_DISC        1
38 #define USE_SOUND_VOLUME        3
39 #define USE_JOYSTICK
40 #define USE_JOYSTICK_TYPE       4
41 #define JOYSTICK_TYPE_DEFAULT   0
42 #define USE_JOY_BUTTON_CAPTIONS
43 #define USE_DEBUGGER
44 #define USE_STATE
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("CD-DA"), _T("ADPCM")
53 };
54 #endif
55
56 #ifdef USE_JOY_BUTTON_CAPTIONS
57 static const _TCHAR *joy_button_captions[] = {
58         _T("Up"),
59         _T("Down"),
60         _T("Left"),
61         _T("Right"),
62         _T("Button #1"),
63         _T("Button #2"),
64         _T("Select"),
65         _T("Run"),
66         _T("Button #3"),
67         _T("Button #4"),
68         _T("Button #5"),
69         _T("Button #6"),
70 };
71 #endif
72
73 class EMU;
74 class DEVICE;
75 class EVENT;
76
77 class HUC6280;
78 class MSM5205;
79 class SCSI_HOST;
80 class SCSI_CDROM;
81
82 namespace PCEDEV {
83         class PCE;
84         class ADPCM;
85 }
86 class VM : public VM_TEMPLATE
87 {
88 protected:
89         //EMU* emu;
90         //csp_state_utils* state_entry;
91         
92         // devices
93         EVENT* pceevent;
94         
95         HUC6280* pcecpu;
96         MSM5205* adpcm;
97         SCSI_HOST* scsi_host;
98         SCSI_CDROM* scsi_cdrom;
99         PCEDEV::PCE* pce;
100         PCEDEV::ADPCM* pce_adpcm;
101 public:
102         // ----------------------------------------
103         // initialize
104         // ----------------------------------------
105         
106         VM(EMU_TEMPLATE* parent_emu);
107         ~VM();
108         
109         // ----------------------------------------
110         // for emulation class
111         // ----------------------------------------
112         
113         // drive virtual machine
114         void reset();
115         void run();
116         double get_frame_rate();
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 open_cart(int drv, const _TCHAR* file_path);
136         void close_cart(int drv);
137         bool is_cart_inserted(int drv);
138         void open_compact_disc(int drv, const _TCHAR* file_path);
139         void close_compact_disc(int drv);
140         bool is_compact_disc_inserted(int drv);
141         uint32_t is_compact_disc_accessed();
142         bool is_frame_skippable()
143         {
144                 return false;
145         }
146         
147         double get_current_usec();
148         uint64_t get_current_clock_uint64();
149         
150         void update_config();
151         bool process_state(FILEIO* state_fio, bool loading);
152         
153         // ----------------------------------------
154         // for each device
155         // ----------------------------------------
156         
157         // devices
158         DEVICE* get_device(int id);
159         //DEVICE* dummy;
160         //DEVICE* first_device;
161         //DEVICE* last_device;
162 };
163
164 #endif