OSDN Git Service

[VM] TRY:Use namespace {VMNAME} to separate around VMs. This feature still apply...
[csp-qt/common_source_project-fm7.git] / source / src / vm / pyuta / pyuta.h
1 /*
2         TOMY PyuTa Emulator 'ePyuTa'
3
4         Author : Takeda.Toshiya
5         Date   : 2007.07.15 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PYUTA_H_
11 #define _PYUTA_H_
12
13 #define DEVICE_NAME             "TOMY PyuTa"
14 #define CONFIG_NAME             "pyuta"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60
18 #define LINES_PER_FRAME         262
19 #define CPU_CLOCKS              10700000
20 #define SCREEN_WIDTH            256
21 #define SCREEN_HEIGHT           192
22 #define TMS9918A_VRAM_SIZE      0x4000
23 //#define TMS9918A_LIMIT_SPRITES
24
25 // device informations for win32
26 #define USE_CART                1
27 #define USE_TAPE                1
28 #define USE_TAPE_BUTTON
29 #define USE_ALT_F10_KEY
30 #define USE_AUTO_KEY            5
31 #define USE_AUTO_KEY_RELEASE    6
32 #define USE_AUTO_KEY_CAPS
33 #define USE_SOUND_VOLUME        3
34 #define USE_JOYSTICK
35 #define USE_DEBUGGER
36 //#define USE_STATE
37 #define USE_CPU_TMS9995
38
39 #include "../../common.h"
40 #include "../../fileio.h"
41 #include "../vm_template.h"
42
43 #ifdef USE_SOUND_VOLUME
44 static const _TCHAR *sound_device_caption[] = {
45         _T("PSG"), _T("CMT (Signal)"), _T("Noise (CMT)"),
46 };
47 #endif
48
49
50 class EMU;
51 class DEVICE;
52 class EVENT;
53
54 class DATAREC;
55 class SN76489AN;
56 class TMS9918A;
57 class TMS9995;
58 namespace PYUTA {
59         class MEMORY;
60 }
61 //class PYUTA::MEMORY;
62
63 class VM : public VM_TEMPLATE
64 {
65 protected:
66         //EMU* emu;
67         //csp_state_utils* state_entry;
68         
69         // devices
70         //EVENT* event;
71         
72         DATAREC* drec;
73         SN76489AN* psg;
74         TMS9918A* vdp;
75         TMS9995* cpu;
76         PYUTA::MEMORY* memory;
77
78 public:
79         // ----------------------------------------
80         // initialize
81         // ----------------------------------------
82         
83         VM(EMU* parent_emu);
84         ~VM();
85         
86         // ----------------------------------------
87         // for emulation class
88         // ----------------------------------------
89         
90         // drive virtual machine
91         void reset();
92         void run();
93         
94 #ifdef USE_DEBUGGER
95         // debugger
96         DEVICE *get_cpu(int index);
97 #endif
98         
99         // draw screen
100         void draw_screen();
101         
102         // sound generation
103         void initialize_sound(int rate, int samples);
104         uint16_t* create_sound(int* extra_frames);
105         int get_sound_buffer_ptr();
106 #ifdef USE_SOUND_VOLUME
107         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
108 #endif
109         
110         // user interface
111         void open_cart(int drv, const _TCHAR* file_path);
112         void close_cart(int drv);
113         bool is_cart_inserted(int drv);
114         void play_tape(int drv, const _TCHAR* file_path);
115         void rec_tape(int drv, const _TCHAR* file_path);
116         void close_tape(int drv);
117         bool is_tape_inserted(int drv);
118         bool is_tape_playing(int drv);
119         bool is_tape_recording(int drv);
120         int get_tape_position(int drv);
121         const _TCHAR* get_tape_message(int drv);
122         void push_play(int drv);
123         void push_stop(int drv);
124         void push_fast_forward(int drv);
125         void push_fast_rewind(int drv);
126         void push_apss_forward(int drv) {}
127         void push_apss_rewind(int drv) {}
128         bool is_frame_skippable();
129         
130         void update_config();
131         bool process_state(FILEIO* state_fio, bool loading);
132         
133         // ----------------------------------------
134         // for each device
135         // ----------------------------------------
136         
137         // devices
138         DEVICE* get_device(int id);
139         //DEVICE* dummy;
140         //DEVICE* first_device;
141         //DEVICE* last_device;
142 };
143
144 #endif