OSDN Git Service

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