OSDN Git Service

[VM][DATAREC][FDD] Add sounds of SEEK/CMT, excepts either pseudo devices / bios.
[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_TAPE
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 DONT_KEEEP_KEY_PRESSED
35 #define USE_SOUND_FILES         3
36 #if defined(USE_SOUND_FILES)
37 #define USE_SOUND_VOLUME        3
38 #else
39 #define USE_SOUND_VOLUME        2
40 #endif
41 #define USE_DEBUGGER
42 #define USE_STATE
43
44 #include "../../common.h"
45
46 #ifdef USE_SOUND_VOLUME
47 static const _TCHAR *sound_device_caption[] = {
48         _T("Beep"), _T("CMT"),
49 #if defined(USE_SOUND_FILES)
50         _T("CMT Buttons"),
51 #endif
52 };
53 #endif
54
55 class EMU;
56 class DEVICE;
57 class EVENT;
58
59 class DATAREC;
60 class MEMORY;
61 class PCM1BIT;
62 class UPD16434;
63 class UPD1990A;
64 class UPD7810;
65
66 class IO;
67
68 #include "../../fileio.h"
69
70 class VM
71 {
72 protected:
73         EMU* emu;
74         
75         // devices
76         EVENT* event;
77         
78         DATAREC* drec;
79         MEMORY* memory;
80         PCM1BIT* pcm;
81         UPD16434* lcd[4];
82         UPD1990A* rtc;
83         UPD7810* cpu;
84         
85         IO* io;
86         
87         // memory
88         uint8_t ram[0x5000];
89         uint8_t rom1[0x1000];
90         uint8_t rom2[0x4000];
91         
92 public:
93         // ----------------------------------------
94         // initialize
95         // ----------------------------------------
96         
97         VM(EMU* parent_emu);
98         ~VM();
99         
100         // ----------------------------------------
101         // for emulation class
102         // ----------------------------------------
103         
104         // drive virtual machine
105         void reset();
106         void run();
107         
108 #ifdef USE_DEBUGGER
109         // debugger
110         DEVICE *get_cpu(int index);
111 #endif
112         
113         // draw screen
114         void draw_screen();
115         
116         // sound generation
117         void initialize_sound(int rate, int samples);
118         uint16_t* create_sound(int* extra_frames);
119         int get_sound_buffer_ptr();
120 #ifdef USE_SOUND_VOLUME
121         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
122 #endif
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 is_tape_inserted();
129         bool is_tape_playing();
130         bool is_tape_recording();
131         int get_tape_position();
132         bool is_frame_skippable();
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