OSDN Git Service

[VM][General][WIP] Apply new (Upstream 2016-02-21) APIs to VMs.
[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_VOLUME        2
47 #define USE_DEBUGGER
48 #define USE_STATE
49 #define USE_MOUSE
50
51 #include "../../common.h"
52 #include "../../fileio.h"
53
54 #ifdef USE_SOUND_VOLUME
55 static const _TCHAR *sound_device_caption[] = {
56         _T("Beep #1"), _T("Beep #2"),
57 };
58 #endif
59
60 class EMU;
61 class DEVICE;
62 class EVENT;
63
64 class AND;
65 class BEEP;
66 class I8251;
67 class I8255;
68 class I8259;
69 class I286;
70 class IO;
71 class MEMORY;
72 class MSM58321;
73 class PCM1BIT;
74 class UPD765A;
75
76 class CRTC;
77 class IOCTRL;
78 class KANJI;
79
80 class VM
81 {
82 protected:
83         EMU* emu;
84         
85         // devices
86         EVENT* event;
87         
88         AND* and_drq;
89         BEEP* beep;
90         I8251* sio;
91         I8255* pio0;
92         I8255* pio1;
93         I8259* pic;     // includes 2chips
94         I286* cpu;
95         IO* io;
96         MEMORY* memory;
97         MSM58321* rtc;
98         PCM1BIT* pcm;
99         UPD765A* fdc;
100         
101         CRTC* crtc;
102         IOCTRL* ioctrl;
103         KANJI* kanji;
104         
105         // memory
106         uint8 ram[0xc0000];     // Main RAM 768KB
107         uint8 ipl[0x8000];      // IPL 32KB
108         
109 public:
110         // ----------------------------------------
111         // initialize
112         // ----------------------------------------
113         
114         VM(EMU* parent_emu);
115         ~VM();
116         
117         // ----------------------------------------
118         // for emulation class
119         // ----------------------------------------
120         
121         // drive virtual machine
122         void reset();
123         void run();
124         
125 #ifdef USE_DEBUGGER
126         // debugger
127         DEVICE *get_cpu(int index);
128 #endif
129         
130         // draw screen
131         void draw_screen();
132         int get_access_lamp_status();
133         
134         // sound generation
135         void initialize_sound(int rate, int samples);
136         uint16* 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         
146         // user interface
147         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
148         void close_floppy_disk(int drv);
149         bool is_floppy_disk_inserted(int drv);
150         void is_floppy_disk_protected(int drv, bool value);
151         bool is_floppy_disk_protected(int drv);
152         bool is_frame_skippable();
153         
154         void update_config();
155         void save_state(FILEIO* state_fio);
156         bool load_state(FILEIO* state_fio);
157         
158         // ----------------------------------------
159         // for each device
160         // ----------------------------------------
161         
162         // devices
163         DEVICE* get_device(int id);
164         DEVICE* dummy;
165         DEVICE* first_device;
166         DEVICE* last_device;
167 };
168
169 #endif