OSDN Git Service

[General][Qt] Merge upstream 2015-03-15.
[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 USE_CART1
29 #define USE_TAPE
30 #define TAPE_BINARY_ONLY
31 #define NOTIFY_KEY_DOWN
32 #define USE_ALT_F10_KEY
33 #define USE_AUTO_KEY            5
34 #define USE_AUTO_KEY_RELEASE    6
35 #define USE_AUTO_KEY_CAPS
36 #define USE_DEBUGGER
37 #define USE_STATE
38
39 #include "../../common.h"
40 #include "../../fileio.h"
41
42 class EMU;
43 class DEVICE;
44 class EVENT;
45
46 class IO;
47 class MEMORY;
48 class SN76489AN;
49 class TMS9918A;
50 class Z80;
51
52 class CMT;
53 class KEYBOARD;
54 class PRINTER;
55
56 class VM
57 {
58 protected:
59         EMU* emu;
60         
61         // devices
62         EVENT* event;
63         
64         IO* io;
65         MEMORY* memory;
66         SN76489AN* psg;
67         TMS9918A* vdp;
68         Z80* cpu;
69         
70         CMT* cmt;
71         KEYBOARD* key;
72         PRINTER* prt;
73         
74         // memory
75         uint8 ipl[0x4000];      // ipl (16k)
76         uint8 ram[0x1000];      // ram (4k)
77         uint8 ext[0x4000];      // ext ram/rom (16k)
78         uint8 cart[0x4000];     // cartridge (16k)
79         bool inserted;
80         
81 public:
82         // ----------------------------------------
83         // initialize
84         // ----------------------------------------
85         
86         VM(EMU* parent_emu);
87         ~VM();
88         
89         // ----------------------------------------
90         // for emulation class
91         // ----------------------------------------
92         
93         // drive virtual machine
94         void reset();
95         void run();
96         
97 #ifdef USE_DEBUGGER
98         // debugger
99         DEVICE *get_cpu(int index);
100 #endif
101         
102         // draw screen
103         void draw_screen();
104         
105         // sound generation
106         void initialize_sound(int rate, int samples);
107         uint16* create_sound(int* extra_frames);
108         int sound_buffer_ptr();
109         
110         // notify key
111         void key_down(int code, bool repeat);
112         void key_up(int code);
113         
114         // user interface
115         void open_cart(int drv, _TCHAR* file_path);
116         void close_cart(int drv);
117         bool cart_inserted(int drv);
118         void play_tape(_TCHAR* file_path);
119         void rec_tape(_TCHAR* file_path);
120         void close_tape();
121         bool tape_inserted();
122         bool now_skip();
123         
124         void update_config();
125         void save_state(FILEIO* state_fio);
126         bool load_state(FILEIO* state_fio);
127         
128         // ----------------------------------------
129         // for each device
130         // ----------------------------------------
131         
132         // devices
133         DEVICE* get_device(int id);
134         DEVICE* dummy;
135         DEVICE* first_device;
136         DEVICE* last_device;
137 };
138
139 #endif