OSDN Git Service

[VM][UI][Qt] General : Merge upstream 2015-08-01.
[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 //720
23 #define MAX_DRIVE               4
24 #define HAS_I86
25 #define I8259_MAX_CHIPS         1
26 #define MSM58321_START_DAY      -9
27 #define MSM58321_START_YEAR     1980
28 #define UPD765A_NO_ST0_AT_FOR_SEEK
29 #define MEMORY_ADDR_MAX         0x100000
30 #define MEMORY_BANK_SIZE        0x8000
31 #define IO_ADDR_MAX             0x10000
32
33 // device informations for win32
34 #define USE_FD1
35 #define USE_FD2
36 #define NOTIFY_KEY_DOWN
37 #define USE_SHIFT_NUMPAD_KEY
38 #define USE_ALT_F10_KEY
39 #define USE_AUTO_KEY            5
40 #define USE_AUTO_KEY_RELEASE    6
41 #define USE_MONITOR_TYPE        2
42 #define USE_CRT_FILTER
43 #define USE_SCREEN_ROTATE
44 #define USE_ACCESS_LAMP
45 #define USE_DEBUGGER
46 #define USE_STATE
47
48 #include "../../common.h"
49 #include "../../fileio.h"
50
51 class EMU;
52 class DEVICE;
53 class EVENT;
54
55 class AND;
56 class BEEP;
57 class I8251;
58 class I8255;
59 class I8259;
60 class I286;
61 class IO;
62 class MEMORY;
63 class MSM58321;
64 class PCM1BIT;
65 class UPD765A;
66
67 class CRTC;
68 class IOCTRL;
69 class KANJI;
70
71 class VM
72 {
73 protected:
74         EMU* emu;
75         
76         // devices
77         EVENT* event;
78         
79         AND* and;
80         BEEP* beep;
81         I8251* sio;
82         I8255* pio0;
83         I8255* pio1;
84         I8259* pic;     // includes 2chips
85         I286* cpu;
86         IO* io;
87         MEMORY* memory;
88         MSM58321* rtc;
89         PCM1BIT* pcm;
90         UPD765A* fdc;
91         
92         CRTC* crtc;
93         IOCTRL* ioctrl;
94         KANJI* kanji;
95         
96         // memory
97         uint8 ram[0xc0000];     // Main RAM 768KB
98         uint8 ipl[0x8000];      // IPL 32KB
99         
100 public:
101         // ----------------------------------------
102         // initialize
103         // ----------------------------------------
104         
105         VM(EMU* parent_emu);
106         ~VM();
107         
108         // ----------------------------------------
109         // for emulation class
110         // ----------------------------------------
111         
112         // drive virtual machine
113         void reset();
114         void run();
115         
116 #ifdef USE_DEBUGGER
117         // debugger
118         DEVICE *get_cpu(int index);
119 #endif
120         
121         // draw screen
122         void draw_screen();
123         int access_lamp();
124         
125         // sound generation
126         void initialize_sound(int rate, int samples);
127         uint16* create_sound(int* extra_frames);
128         int sound_buffer_ptr();
129         
130         // notify key
131         void key_down(int code, bool repeat);
132         void key_up(int code);
133         
134         // user interface
135         void open_disk(int drv, _TCHAR* file_path, int bank);
136         void close_disk(int drv);
137         bool disk_inserted(int drv);
138         void set_disk_protected(int drv, bool value);
139         bool get_disk_protected(int drv);
140         bool now_skip();
141         
142         void update_config();
143         void save_state(FILEIO* state_fio);
144         bool load_state(FILEIO* state_fio);
145         
146         // ----------------------------------------
147         // for each device
148         // ----------------------------------------
149         
150         // devices
151         DEVICE* get_device(int id);
152         DEVICE* dummy;
153         DEVICE* first_device;
154         DEVICE* last_device;
155 };
156
157 #endif