OSDN Git Service

[VM][EVENT] Specify CPU per VM.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc2001 / pc2001.h
1 /*
2         NEC PC-2001 Emulator 'ePC-2001'
3
4         Origin : PockEmul
5         Author : Takeda.Toshiya
6         Date   : 2016.03.18-
7
8         [ virtual machine ]
9 */
10
11 #ifndef _PC2001_H_
12 #define _PC2001_H_
13
14 #define DEVICE_NAME             "NEC PC-2001"
15 #define CONFIG_NAME             "pc2001"
16
17 // device informations for virtual machine
18 #define FRAMES_PER_SEC          60
19 #define LINES_PER_FRAME         24
20 #define CPU_CLOCKS              (4000000 / 4)
21 #define SCREEN_WIDTH            240
22 #define SCREEN_HEIGHT           24
23 #define HAS_UPD7907
24 #define MEMORY_ADDR_MAX         0x10000
25 #define MEMORY_BANK_SIZE        0x1000
26
27 // device informations for win32
28 #define WINDOW_MODE_BASE        2
29 #define USE_TAPE1
30 #define USE_ALT_F10_KEY
31 #define USE_AUTO_KEY            6
32 #define USE_AUTO_KEY_RELEASE    10
33 #define USE_AUTO_KEY_CAPS_LOCK  (0xf2 | 0x100)
34 #define USE_AUTO_KEY_NUMPAD
35 #define DONT_KEEEP_KEY_PRESSED
36 #define USE_SOUND_VOLUME        3
37 #define USE_DEBUGGER
38 #define USE_STATE
39 #define USE_CPU_UPD7810
40
41 #include "../../common.h"
42
43 #ifdef USE_SOUND_VOLUME
44 static const _TCHAR *sound_device_caption[] = {
45         _T("Beep"), _T("CMT (Signal)"), _T("Noise (CMT)"),
46 };
47 #endif
48
49 class EMU;
50 class DEVICE;
51 class EVENT;
52
53 class DATAREC;
54 class MEMORY;
55 class PCM1BIT;
56 class UPD16434;
57 class UPD1990A;
58 class UPD7810;
59
60 class IO;
61
62 #include "../../fileio.h"
63
64 class VM
65 {
66 protected:
67         EMU* emu;
68         
69         // devices
70         EVENT* event;
71         
72         DATAREC* drec;
73         MEMORY* memory;
74         PCM1BIT* pcm;
75         UPD16434* lcd[4];
76         UPD1990A* rtc;
77         UPD7810* cpu;
78         
79         IO* io;
80         
81         // memory
82         uint8_t ram[0x5000];
83         uint8_t rom1[0x1000];
84         uint8_t rom2[0x4000];
85         
86 public:
87         // ----------------------------------------
88         // initialize
89         // ----------------------------------------
90         
91         VM(EMU* parent_emu);
92         ~VM();
93         
94         // ----------------------------------------
95         // for emulation class
96         // ----------------------------------------
97         
98         // drive virtual machine
99         void reset();
100         void run();
101         
102 #ifdef USE_DEBUGGER
103         // debugger
104         DEVICE *get_cpu(int index);
105 #endif
106         
107         // draw screen
108         void draw_screen();
109         
110         // sound generation
111         void initialize_sound(int rate, int samples);
112         uint16_t* create_sound(int* extra_frames);
113         int get_sound_buffer_ptr();
114 #ifdef USE_SOUND_VOLUME
115         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
116 #endif
117         
118         // user interface
119         void play_tape(int drv, const _TCHAR* file_path);
120         void rec_tape(int drv, const _TCHAR* file_path);
121         void close_tape(int drv);
122         bool is_tape_inserted(int drv);
123         bool is_tape_playing(int drv);
124         bool is_tape_recording(int drv);
125         int get_tape_position(int drv);
126         const _TCHAR* get_tape_message(int drv);
127         bool is_frame_skippable();
128         
129         void update_config();
130         void save_state(FILEIO* state_fio);
131         bool load_state(FILEIO* state_fio);
132         
133         // ----------------------------------------
134         // for each device
135         // ----------------------------------------
136         
137         // devices
138         DEVICE* get_device(int id);
139         DEVICE* dummy;
140         DEVICE* first_device;
141         DEVICE* last_device;
142 };
143
144 #endif