OSDN Git Service

[VM] I forgot to update (and remove USE_SOUND_FILES*) defines.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pv2000 / pv2000.h
1 /*
2         CASIO PV-2000 Emulator 'EmuGaki'
3
4         Author : Takeda.Toshiya
5         Date   : 2006.08.18 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PV2000_H_
11 #define _PV2000_H_
12
13 #define DEVICE_NAME             "CASIO PV-2000"
14 #define CONFIG_NAME             "pv2000"
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 MEMORY_ADDR_MAX         0x10000
25 #define MEMORY_BANK_SIZE        0x1000
26
27 // device informations for win32
28 #define SUPPORT_TV_RENDER
29 #define USE_CART1
30 #define USE_TAPE1
31 #define TAPE_BINARY_ONLY
32 #define NOTIFY_KEY_DOWN
33 #define USE_ALT_F10_KEY
34 #define USE_AUTO_KEY            5
35 #define USE_AUTO_KEY_RELEASE    6
36 #define USE_AUTO_KEY_CAPS
37 #define USE_SOUND_VOLUME        2
38 #define USE_JOYSTICK
39 #define USE_DEBUGGER
40 #define USE_STATE
41
42 #include "../../common.h"
43 #include "../../fileio.h"
44
45 #ifdef USE_SOUND_VOLUME
46 static const _TCHAR *sound_device_caption[] = {
47         _T("PSG"),
48 //      _T("CMT Relay"),
49 };
50 #endif
51
52 class EMU;
53 class DEVICE;
54 class EVENT;
55
56 class IO;
57 class MEMORY;
58 class SN76489AN;
59 class TMS9918A;
60 class Z80;
61
62 class CMT;
63 class KEYBOARD;
64 class PRINTER;
65
66 class VM
67 {
68 protected:
69         EMU* emu;
70         
71         // devices
72         EVENT* event;
73         
74         IO* io;
75         MEMORY* memory;
76         SN76489AN* psg;
77         TMS9918A* vdp;
78         Z80* cpu;
79         
80         CMT* cmt;
81         KEYBOARD* key;
82         PRINTER* prt;
83         
84         // memory
85         uint8_t ipl[0x4000];    // ipl (16k)
86         uint8_t ram[0x1000];    // ram (4k)
87         uint8_t ext[0x4000];    // ext ram/rom (16k)
88         uint8_t cart[0x4000];   // cartridge (16k)
89         bool inserted;
90         
91 public:
92         // ----------------------------------------
93         // initialize
94         // ----------------------------------------
95         
96         VM(EMU* parent_emu);
97         ~VM();
98         
99         // ----------------------------------------
100         // for emulation class
101         // ----------------------------------------
102         
103         // drive virtual machine
104         void reset();
105         void run();
106         
107 #ifdef USE_DEBUGGER
108         // debugger
109         DEVICE *get_cpu(int index);
110 #endif
111         
112         // draw screen
113         void draw_screen();
114         
115         // sound generation
116         void initialize_sound(int rate, int samples);
117         uint16_t* create_sound(int* extra_frames);
118         int get_sound_buffer_ptr();
119 #ifdef USE_SOUND_VOLUME
120         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
121 #endif
122         
123         // notify key
124         void key_down(int code, bool repeat);
125         void key_up(int code);
126         
127         // user interface
128         void open_cart(int drv, const _TCHAR* file_path);
129         void close_cart(int drv);
130         bool is_cart_inserted(int drv);
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_frame_skippable();
136         
137         void update_config();
138         void save_state(FILEIO* state_fio);
139         bool load_state(FILEIO* state_fio);
140         
141         // ----------------------------------------
142         // for each device
143         // ----------------------------------------
144         
145         // devices
146         DEVICE* get_device(int id);
147         DEVICE* dummy;
148         DEVICE* first_device;
149         DEVICE* last_device;
150 };
151
152 #endif