OSDN Git Service

[VM][PC100] Add a seek sound.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc100 / pc100.h
1 /*
2         NEC PC-100 Emulator 'ePC-100'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.07.12 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PC100_H_
11 #define _PC100_H_
12
13 #define DEVICE_NAME             "NEC PC-100"
14 #define CONFIG_NAME             "pc100"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          55.4
18 #define LINES_PER_FRAME         544
19 #define CPU_CLOCKS              6988800
20 #define SCREEN_WIDTH            720
21 #define SCREEN_HEIGHT           512
22 #define WINDOW_HEIGHT_ASPECT    540
23 //720
24 #define MAX_DRIVE               4
25 #define HAS_I86
26 #define I8259_MAX_CHIPS         1
27 #define MSM58321_START_DAY      -9
28 #define MSM58321_START_YEAR     1980
29 #define UPD765A_NO_ST0_AT_FOR_SEEK
30 #define MEMORY_ADDR_MAX         0x100000
31 #define MEMORY_BANK_SIZE        0x8000
32 #define IO_ADDR_MAX             0x10000
33
34 // device informations for win32
35 #define USE_FD1
36 #define USE_FD2
37 #define NOTIFY_KEY_DOWN
38 #define USE_SHIFT_NUMPAD_KEY
39 #define USE_ALT_F10_KEY
40 #define USE_AUTO_KEY            5
41 #define USE_AUTO_KEY_RELEASE    6
42 #define USE_MONITOR_TYPE        2
43 #define USE_CRT_FILTER
44 #define USE_SCREEN_ROTATE
45 #define USE_ACCESS_LAMP
46 #define USE_SOUND_FILES 2
47 #if defined(USE_SOUND_FILES)
48 #define USE_SOUND_VOLUME        3
49 #else
50 #define USE_SOUND_VOLUME        2
51 #endif
52 #define USE_MOUSE
53 #define USE_DEBUGGER
54 #define USE_STATE
55
56 #include "../../common.h"
57 #include "../../fileio.h"
58
59 #ifdef USE_SOUND_VOLUME
60 static const _TCHAR *sound_device_caption[] = {
61         _T("Beep #1"), _T("Beep #2"),
62 #if defined(USE_SOUND_FILES)
63         _T("FDD SEEK"),
64 #endif
65 };
66 #endif
67
68 class EMU;
69 class DEVICE;
70 class EVENT;
71
72 class AND;
73 class BEEP;
74 class I8251;
75 class I8255;
76 class I8259;
77 class I286;
78 class IO;
79 class MEMORY;
80 class MSM58321;
81 class PCM1BIT;
82 class UPD765A;
83
84 class CRTC;
85 class IOCTRL;
86 class KANJI;
87
88 class VM
89 {
90 protected:
91         EMU* emu;
92         
93         // devices
94         EVENT* event;
95         
96         AND* and_drq;
97         BEEP* beep;
98         I8251* sio;
99         I8255* pio0;
100         I8255* pio1;
101         I8259* pic;     // includes 2chips
102         I286* cpu;
103         IO* io;
104         MEMORY* memory;
105         MSM58321* rtc;
106         PCM1BIT* pcm;
107         UPD765A* fdc;
108         
109         CRTC* crtc;
110         IOCTRL* ioctrl;
111         KANJI* kanji;
112         
113         // memory
114         uint8_t ram[0xc0000];   // Main RAM 768KB
115         uint8_t ipl[0x8000];    // IPL 32KB
116         
117 public:
118         // ----------------------------------------
119         // initialize
120         // ----------------------------------------
121         
122         VM(EMU* parent_emu);
123         ~VM();
124         
125         // ----------------------------------------
126         // for emulation class
127         // ----------------------------------------
128         
129         // drive virtual machine
130         void reset();
131         void run();
132         
133 #ifdef USE_DEBUGGER
134         // debugger
135         DEVICE *get_cpu(int index);
136 #endif
137         
138         // draw screen
139         void draw_screen();
140         uint32_t get_access_lamp_status();
141         
142         // sound generation
143         void initialize_sound(int rate, int samples);
144         uint16_t* create_sound(int* extra_frames);
145         int get_sound_buffer_ptr();
146 #ifdef USE_SOUND_VOLUME
147         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
148 #endif
149         
150         // notify key
151         void key_down(int code, bool repeat);
152         void key_up(int code);
153         
154         // user interface
155         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
156         void close_floppy_disk(int drv);
157         bool is_floppy_disk_inserted(int drv);
158         void is_floppy_disk_protected(int drv, bool value);
159         bool is_floppy_disk_protected(int drv);
160         bool is_frame_skippable();
161         
162         void update_config();
163         void save_state(FILEIO* state_fio);
164         bool load_state(FILEIO* state_fio);
165         
166         // ----------------------------------------
167         // for each device
168         // ----------------------------------------
169         
170         // devices
171         DEVICE* get_device(int id);
172         DEVICE* dummy;
173         DEVICE* first_device;
174         DEVICE* last_device;
175 };
176
177 #endif