OSDN Git Service

fbb641a50dd4cc69e9553fc2c410d52b4e1e9564
[csp-qt/common_source_project-fm7.git] / source / src / vm / gamegear / gamegear.h
1 /*
2         SEGA GAME GEAR Emulator 'yaGAME GEAR'
3
4         Author : tanam
5         Date   : 2013.08.24-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _GAMEGEAR_H_
11 #define _GAMEGEAR_H_
12
13 #define DEVICE_NAME             "SEGA GAME GEAR"
14 #define CONFIG_NAME             "gamegear"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC                  60
18 #define LINES_PER_FRAME                 262
19 #define CPU_CLOCKS                              3579545
20 #define SCREEN_WIDTH                    256
21 #define SCREEN_HEIGHT                   192
22 #define TMS9918A_VRAM_SIZE              0x4000
23 #define TMS9918A_LIMIT_SPRITES
24 #define MAX_DRIVE                               1
25
26 // device informations for win32
27 #define USE_CART                1
28 #define USE_FLOPPY_DISK         1
29 #define USE_TAPE                1
30 #define USE_TAPE_BUTTON
31 #define USE_ALT_F10_KEY
32 #define USE_AUTO_KEY                    5
33 #define USE_AUTO_KEY_RELEASE    8
34 #define USE_AUTO_KEY_CAPS
35 #define USE_SOUND_VOLUME        4
36 #define USE_JOYSTICK
37 #define USE_DEBUGGER
38 #define USE_CPU_Z80
39
40 #include "../../common.h"
41 #include "../../fileio.h"
42 #include "../vm_template.h"
43
44 #ifdef USE_SOUND_VOLUME
45 static const _TCHAR *sound_device_caption[] = {
46         _T("PSG"), _T("CMT (Signal)"), _T("Noise (FDD)"), _T("Noise (CMT)"),
47 };
48 #endif
49
50 class EMU;
51 class DEVICE;
52 class EVENT;
53
54 class DATAREC;
55 class I8251;
56 class I8255;
57 class IO;
58 class SN76489AN;
59 class _315_5124;
60 class UPD765A;
61 class Z80;
62
63 class KEYBOARD;
64 class MEMORY;
65 class SYSTEM;
66
67 class VM : public VM_TEMPLATE
68 {
69 protected:
70         //EMU* emu;
71         
72         // devices
73         //EVENT* event;
74         
75         DATAREC* drec;
76         I8251* sio;
77         I8255* pio_k;
78         I8255* pio_f;
79         IO* io;
80         SN76489AN* psg;
81         _315_5124* vdp;
82         UPD765A* fdc;
83         Z80* cpu;
84         
85         KEYBOARD* key;
86         MEMORY* memory;
87         SYSTEM* system;
88         
89 public:
90         // ----------------------------------------
91         // initialize
92         // ----------------------------------------
93         
94         VM(EMU* parent_emu);
95         ~VM();
96         
97         // ----------------------------------------
98         // for emulation class
99         // ----------------------------------------
100         
101         // drive virtual machine
102         void reset();
103         void run();
104         
105 #ifdef USE_DEBUGGER
106         // debugger
107         DEVICE *get_cpu(int index);
108 #endif
109         
110         // draw screen
111         void draw_screen();
112         
113         // sound generation
114         void initialize_sound(int rate, int samples);
115         uint16_t* create_sound(int* extra_frames);
116         int get_sound_buffer_ptr();
117 #ifdef USE_SOUND_VOLUME
118         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
119 #endif
120         
121         // user interface
122         void open_cart(int drv, const _TCHAR* file_path);
123         void close_cart(int drv);
124         bool is_cart_inserted(int drv);
125         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
126         void close_floppy_disk(int drv);
127         bool is_floppy_disk_inserted(int drv);
128         void is_floppy_disk_protected(int drv, bool value);
129         bool is_floppy_disk_protected(int drv);
130         uint32_t is_floppy_disk_accessed();
131         void play_tape(int drv, const _TCHAR* file_path);
132         void rec_tape(int drv, const _TCHAR* file_path);
133         void close_tape(int drv);
134         bool is_tape_inserted(int drv);
135         bool is_tape_playing(int drv);
136         bool is_tape_recording(int drv);
137         int get_tape_position(int drv);
138         const _TCHAR* get_tape_message(int drv);
139         void push_play(int drv);
140         void push_stop(int drv);
141         void push_fast_forward(int drv);
142         void push_fast_rewind(int drv);
143         void push_apss_forward(int drv) {}
144         void push_apss_rewind(int drv) {}
145         bool is_frame_skippable();
146         
147         void update_config();
148         bool process_state(FILEIO* state_fio, bool loading);
149         
150         // ----------------------------------------
151         // for each device
152         // ----------------------------------------
153         
154         // devices
155         DEVICE* get_device(int id);
156         //DEVICE* dummy;
157         //DEVICE* first_device;
158         //DEVICE* last_device;
159 };
160
161 #endif