OSDN Git Service

[General] Merge upstream 2018-05-24. Still not test to build, will test.
[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_DRIVE_TYPE          2
36 #define USE_FLOPPY_DISK         2
37 #define NOTIFY_KEY_DOWN
38 #define USE_KEY_LOCKED
39 #define USE_SHIFT_NUMPAD_KEY
40 #define USE_ALT_F10_KEY
41 #define USE_AUTO_KEY            5
42 #define USE_AUTO_KEY_RELEASE    6
43 #define USE_AUTO_KEY_NUMPAD
44 #define USE_MONITOR_TYPE        2
45 #define USE_SCREEN_FILTER
46 #define USE_SOUND_VOLUME        3
47 #define USE_MOUSE
48 #define USE_DEBUGGER
49 #define USE_STATE
50 #define USE_CPU_I286
51
52 #include "../../common.h"
53 #include "../../fileio.h"
54
55 #ifdef USE_SOUND_VOLUME
56 static const _TCHAR *sound_device_caption[] = {
57         _T("Beep #1"), _T("Beep #2"), _T("Noise (FDD)"),
58 };
59 #endif
60
61 class EMU;
62 class DEVICE;
63 class EVENT;
64
65 class AND;
66 class BEEP;
67 class I8251;
68 class I8255;
69 class I8259;
70 class I286;
71 class IO;
72 class MEMORY;
73 class MSM58321;
74 class PCM1BIT;
75 class UPD765A;
76
77 class CRTC;
78 class IOCTRL;
79 class KANJI;
80
81 class VM
82 {
83 protected:
84         EMU* emu;
85         
86         // devices
87         EVENT* event;
88         
89         AND* and_drq;
90         BEEP* beep;
91         I8251* sio;
92         I8255* pio0;
93         I8255* pio1;
94         I8259* pic;     // includes 2chips
95         I286* cpu;
96         IO* io;
97         MEMORY* memory;
98         MSM58321* rtc;
99         PCM1BIT* pcm;
100         UPD765A* fdc;
101         
102         CRTC* crtc;
103         IOCTRL* ioctrl;
104         KANJI* kanji;
105         
106         // memory
107         uint8_t ram[0xc0000];   // Main RAM 768KB
108         uint8_t ipl[0x8000];    // IPL 32KB
109         
110 public:
111         // ----------------------------------------
112         // initialize
113         // ----------------------------------------
114         
115         VM(EMU* parent_emu);
116         ~VM();
117         
118         // ----------------------------------------
119         // for emulation class
120         // ----------------------------------------
121         
122         // drive virtual machine
123         void reset();
124         void run();
125         
126 #ifdef USE_DEBUGGER
127         // debugger
128         DEVICE *get_cpu(int index);
129 #endif
130         
131         // draw screen
132         void draw_screen();
133         
134         // sound generation
135         void initialize_sound(int rate, int samples);
136         uint16_t* create_sound(int* extra_frames);
137         int get_sound_buffer_ptr();
138 #ifdef USE_SOUND_VOLUME
139         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
140 #endif
141         
142         // notify key
143         void key_down(int code, bool repeat);
144         void key_up(int code);
145         bool get_caps_locked();
146         bool get_kana_locked();
147         
148         // user interface
149         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
150         void close_floppy_disk(int drv);
151         bool is_floppy_disk_inserted(int drv);
152         void is_floppy_disk_protected(int drv, bool value);
153         bool is_floppy_disk_protected(int drv);
154         uint32_t is_floppy_disk_accessed();
155         bool is_frame_skippable();
156         
157         void update_config();
158         void save_state(FILEIO* state_fio);
159         bool load_state(FILEIO* state_fio);
160         
161         // ----------------------------------------
162         // for each device
163         // ----------------------------------------
164         
165         // devices
166         DEVICE* get_device(int id);
167         DEVICE* dummy;
168         DEVICE* first_device;
169         DEVICE* last_device;
170 };
171
172 #endif