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 / phc20 / phc20.h
1 /*
2         SANYO PHC-20 Emulator 'ePHC-20'
3
4         Author : Takeda.Toshiya
5         Date   : 2010.09.03-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PHC20_H_
11 #define _PHC20_H_
12
13 #define DEVICE_NAME             "SANYO PHC-20"
14 #define CONFIG_NAME             "phc20"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60
18 #define LINES_PER_FRAME         262
19 #define CPU_CLOCKS              4000000
20 #define SCREEN_WIDTH            256
21 #define SCREEN_HEIGHT           192
22
23 #define MC6847_VRAM_INV         0x40
24
25 // device informations for win32
26 #define USE_TAPE
27 #define USE_ALT_F10_KEY
28 #define USE_AUTO_KEY            6
29 #define USE_AUTO_KEY_RELEASE    10
30 #define USE_AUTO_KEY_NO_CAPS
31 #define USE_DEBUGGER
32 #define USE_STATE
33
34 #include "../../common.h"
35
36 class EMU;
37 class DEVICE;
38 class EVENT;
39
40 class DATAREC;
41 class MC6847;
42 class Z80;
43
44 class MEMORY;
45
46 class FILEIO;
47
48 class VM
49 {
50 protected:
51         EMU* emu;
52         
53         // devices
54         EVENT* event;
55         
56         DATAREC* drec;
57         MC6847* vdp;
58         Z80* cpu;
59         
60         MEMORY* memory;
61         
62 public:
63         // ----------------------------------------
64         // initialize
65         // ----------------------------------------
66         
67         VM(EMU* parent_emu);
68         ~VM();
69         
70         // ----------------------------------------
71         // for emulation class
72         // ----------------------------------------
73         
74         // drive virtual machine
75         void reset();
76         void run();
77         
78 #ifdef USE_DEBUGGER
79         // debugger
80         DEVICE *get_cpu(int index);
81 #endif
82         
83         // draw screen
84         void draw_screen();
85         
86         // sound generation
87         void initialize_sound(int rate, int samples);
88         uint16* create_sound(int* extra_frames);
89         int sound_buffer_ptr();
90         
91         // user interface
92         void play_tape(_TCHAR* file_path);
93         void rec_tape(_TCHAR* file_path);
94         void close_tape();
95         bool tape_inserted();
96         bool now_skip();
97         
98         void update_config();
99         void save_state(FILEIO* state_fio);
100         bool load_state(FILEIO* state_fio);
101         
102         // ----------------------------------------
103         // for each device
104         // ----------------------------------------
105         
106         // devices
107         DEVICE* get_device(int id);
108         DEVICE* dummy;
109         DEVICE* first_device;
110         DEVICE* last_device;
111 };
112
113 #endif