OSDN Git Service

[VM][General] Merge upstream 2016-02-13. Still don't implement OSD/Gui part of joysti...
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc8201 / pc8201.h
1 /*
2         NEC PC-8201 Emulator 'ePC-8201'
3
4         Author : Takeda.Toshiya
5         Date   : 2009.03.31-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PC8201_H_
11 #define _PC8201_H_
12
13 #ifdef _PC8201A
14 #define DEVICE_NAME             "NEC PC-8201A"
15 #define CONFIG_NAME             "pc8201a"
16 #else
17 #define DEVICE_NAME             "NEC PC-8201"
18 #define CONFIG_NAME             "pc8201"
19 #endif
20
21 // device informations for virtual machine
22 #define FRAMES_PER_SEC          60
23 #define LINES_PER_FRAME         64
24 #define CPU_CLOCKS              2457600
25 #define SCREEN_WIDTH            240
26 #define SCREEN_HEIGHT           64
27 #define HAS_I8085
28
29 // device informations for win32
30 #define USE_TAPE
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_SOUND_VOLUME        2
37 #define USE_DEBUGGER
38 #define USE_STATE
39
40 #include "../../common.h"
41 #include "../../fileio.h"
42
43 #ifdef USE_SOUND_VOLUME
44 static const _TCHAR *sound_device_caption[] = {
45         _T("Beep"), _T("CMT"),
46 };
47 static const bool sound_device_monophonic[] = {
48         false, false,
49 };
50 #endif
51
52 class EMU;
53 class DEVICE;
54 class EVENT;
55
56 class DATAREC;
57 class I8080;
58 class I8155;
59 class IO;
60 class PCM1BIT;
61 class UPD1990A;
62
63 class CMT;
64 class KEYBOARD;
65 class LCD;
66 class MEMORY;
67
68 class VM
69 {
70 protected:
71         EMU* emu;
72         
73         // devices
74         EVENT* event;
75         
76         DATAREC* drec;
77         I8080* cpu;
78         I8155* pio;
79         IO* io;
80         PCM1BIT* pcm;
81         UPD1990A* rtc;
82         
83         CMT* cmt;
84         KEYBOARD* keyboard;
85         LCD* lcd;
86         MEMORY* memory;
87         
88 public:
89         // ----------------------------------------
90         // initialize
91         // ----------------------------------------
92         
93         VM(EMU* parent_emu);
94         ~VM();
95         
96         // ----------------------------------------
97         // for emulation class
98         // ----------------------------------------
99         
100         // drive virtual machine
101         void reset();
102         void run();
103         
104 #ifdef USE_DEBUGGER
105         // debugger
106         DEVICE *get_cpu(int index);
107 #endif
108         
109         // draw screen
110         void draw_screen();
111         
112         // sound generation
113         void initialize_sound(int rate, int samples);
114         uint16* create_sound(int* extra_frames);
115         int sound_buffer_ptr();
116 #ifdef USE_SOUND_VOLUME
117         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
118 #endif
119         
120         // notify key
121         void key_down(int code, bool repeat);
122         void key_up(int code);
123         
124         // user interface
125         void play_tape(const _TCHAR* file_path);
126         void rec_tape(const _TCHAR* file_path);
127         void close_tape();
128         bool tape_inserted();
129         bool tape_playing();
130         bool tape_recording();
131         int tape_position();
132         bool now_skip();
133         
134         void update_config();
135         void save_state(FILEIO* state_fio);
136         bool load_state(FILEIO* state_fio);
137         
138         // ----------------------------------------
139         // for each device
140         // ----------------------------------------
141         
142         // devices
143         DEVICE* get_device(int id);
144         DEVICE* dummy;
145         DEVICE* first_device;
146         DEVICE* last_device;
147 };
148
149 #endif