OSDN Git Service

[INITIAL] Import 20141226 version of http://homepage3.nifty.com/takeda-toshiya/common...
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc6001 / pc6001.h
1 /*\r
2         NEC PC-6001 Emulator 'yaPC-6001'\r
3         NEC PC-6001mkII Emulator 'yaPC-6201'\r
4         NEC PC-6001mkIISR Emulator 'yaPC-6401'\r
5         NEC PC-6601 Emulator 'yaPC-6601'\r
6         NEC PC-6601SR Emulator 'yaPC-6801'\r
7 \r
8         Author : tanam\r
9         Date   : 2013.07.15-\r
10 \r
11         [ virtual machine ]\r
12 */\r
13 \r
14 #ifndef _PC6001_H_\r
15 #define _PC6001_H_\r
16 \r
17 #if defined(_PC6001)\r
18 #define DEVICE_NAME             "NEC PC-6001"\r
19 #define CONFIG_NAME             "pc6001"\r
20 #define SUB_CPU_ROM_FILE_NAME   "SUBCPU.60"\r
21 #define SCREEN_WIDTH            256\r
22 #define SCREEN_HEIGHT           192\r
23 #define CPU_CLOCKS              3993600\r
24 #define HAS_AY_3_8910\r
25 #elif defined(_PC6001MK2)\r
26 #define DEVICE_NAME             "NEC PC-6001mkII"\r
27 #define CONFIG_NAME             "pc6001mk2"\r
28 #define SUB_CPU_ROM_FILE_NAME   "SUBCPU.62"\r
29 #define SCREEN_WIDTH            640\r
30 #define SCREEN_HEIGHT           400\r
31 #define CPU_CLOCKS              4000000\r
32 #define HAS_AY_3_8910\r
33 #elif defined(_PC6001MK2SR)\r
34 #define DEVICE_NAME             "NEC PC-6001mkIISR"\r
35 #define CONFIG_NAME             "pc6001mk2sr"\r
36 #define SUB_CPU_ROM_FILE_NAME   "SUBCPU.68"\r
37 #define SCREEN_WIDTH            640\r
38 #define SCREEN_HEIGHT           400\r
39 #define CPU_CLOCKS              3580000\r
40 #elif defined(_PC6601)\r
41 #define DEVICE_NAME             "NEC PC-6601"\r
42 #define CONFIG_NAME             "pc6601"\r
43 #define SUB_CPU_ROM_FILE_NAME   "SUBCPU.66"\r
44 #define SCREEN_WIDTH            640\r
45 #define SCREEN_HEIGHT           400\r
46 #define CPU_CLOCKS              4000000\r
47 #define HAS_AY_3_8910\r
48 #elif defined(_PC6601SR)\r
49 #define DEVICE_NAME             "NEC PC-6601SR"\r
50 #define CONFIG_NAME             "pc6601sr"\r
51 #define SUB_CPU_1_ROM_FILE_NAME "SUBCPU1.68"\r
52 #define SUB_CPU_2_ROM_FILE_NAME "SUBCPU2.68"\r
53 #define SUB_CPU_3_ROM_FILE_NAME "SUBCPU3.68"\r
54 #define SCREEN_WIDTH            640\r
55 #define SCREEN_HEIGHT           400\r
56 #define CPU_CLOCKS              3580000\r
57 #endif\r
58 \r
59 // device informations for virtual machine\r
60 #define FRAMES_PER_SEC          60\r
61 #define LINES_PER_FRAME         262\r
62 #define MAX_DRIVE               4\r
63 #define MC6847_ATTR_OFS         0\r
64 #define MC6847_VRAM_OFS         0x200\r
65 #define MC6847_ATTR_AG          0x80\r
66 #define MC6847_ATTR_AS          0x40\r
67 #define MC6847_ATTR_INTEXT      0x20\r
68 #define MC6847_ATTR_GM0         0x10\r
69 #define MC6847_ATTR_GM1         0x08\r
70 #define MC6847_ATTR_GM2         0x04\r
71 #define MC6847_ATTR_CSS         0x02\r
72 #define MC6847_ATTR_INV         0x01\r
73 \r
74 // device informations for win32\r
75 #define USE_CART1\r
76 #define USE_FD1\r
77 #define USE_FD2\r
78 #if defined(_PC6601) || defined(_PC6601SR)\r
79 #define USE_FD3\r
80 #define USE_FD4\r
81 #endif\r
82 #define USE_TAPE\r
83 #define TAPE_PC6001\r
84 #define USE_ALT_F10_KEY\r
85 #define USE_AUTO_KEY            6\r
86 #define USE_AUTO_KEY_RELEASE    10\r
87 #define USE_AUTO_KEY_CAPS\r
88 #if !defined(_PC6001)\r
89 #define USE_CRT_FILTER\r
90 #define USE_SCANLINE\r
91 #endif\r
92 #define USE_ACCESS_LAMP\r
93 #define USE_DEBUGGER\r
94 \r
95 #include "../../common.h"\r
96 \r
97 class EMU;\r
98 class DEVICE;\r
99 class EVENT;\r
100 \r
101 class I8255;\r
102 class IO;\r
103 #ifdef _PC6001\r
104 class MC6847;\r
105 #else\r
106 class UPD7752;\r
107 #endif\r
108 class PC6031;\r
109 class PC80S31K;\r
110 class UPD765A;\r
111 class YM2203;\r
112 class Z80;\r
113 \r
114 class DATAREC;\r
115 class MCS48;\r
116 \r
117 #ifdef _PC6001\r
118 class DISPLAY;\r
119 #endif\r
120 #if defined(_PC6601) || defined(_PC6601SR)\r
121 class FLOPPY;\r
122 #endif\r
123 class JOYSTICK;\r
124 class MEMORY;\r
125 class PRINTER;\r
126 class PSUB;\r
127 class SUB;\r
128 class TIMER;\r
129 \r
130 class VM\r
131 {\r
132 protected:\r
133         EMU* emu;\r
134         int vdata;\r
135         \r
136         // devices\r
137         EVENT* event;\r
138         \r
139         I8255* pio_sub;\r
140         IO* io;\r
141         YM2203* psg;\r
142         Z80* cpu;\r
143 #ifdef _PC6001\r
144         MC6847* vdp;\r
145         DISPLAY* display;\r
146 #else\r
147         UPD7752* voice;\r
148 #endif\r
149 #if defined(_PC6601) || defined(_PC6601SR)\r
150         FLOPPY* floppy;\r
151 #endif\r
152         JOYSTICK* joystick;\r
153         MEMORY* memory;\r
154         PRINTER *printer;\r
155         PSUB* psub;\r
156         TIMER* timer;\r
157         \r
158         MCS48* cpu_sub;\r
159         SUB* sub;\r
160         DATAREC* drec;\r
161         \r
162         PC6031* pc6031;\r
163         I8255* pio_fdd;\r
164         I8255* pio_pc80s31k;\r
165         PC80S31K *pc80s31k;\r
166         UPD765A* fdc_pc80s31k;\r
167         Z80* cpu_pc80s31k;\r
168         \r
169         bool support_sub_cpu;\r
170         bool support_pc80s31k;\r
171         \r
172 public:\r
173         // ----------------------------------------\r
174         // initialize\r
175         // ----------------------------------------\r
176         \r
177         VM(EMU* parent_emu);\r
178         ~VM();\r
179         \r
180         // ----------------------------------------\r
181         // for emulation class\r
182         // ----------------------------------------\r
183         \r
184         // drive virtual machine\r
185         void reset();\r
186         void run();\r
187         \r
188 #ifdef USE_DEBUGGER\r
189         // debugger\r
190         DEVICE *get_cpu(int index);\r
191 #endif\r
192         \r
193         // draw screen\r
194         void draw_screen();\r
195         // sound generation\r
196         void initialize_sound(int rate, int samples);\r
197         uint16* create_sound(int* extra_frames);\r
198         int sound_buffer_ptr();\r
199         \r
200         // user interface\r
201         void open_cart(int drv,_TCHAR* file_path);\r
202         void close_cart(int drv);\r
203         bool cart_inserted(int drv);\r
204         int access_lamp();\r
205         void open_disk(int drv, _TCHAR* file_path, int offset);\r
206         void close_disk(int drv);\r
207         bool disk_inserted(int drv);\r
208         void play_tape(_TCHAR* file_path);\r
209         void rec_tape(_TCHAR* file_path);\r
210         void close_tape();\r
211         bool tape_inserted();\r
212         bool now_skip();\r
213         \r
214         void update_config();\r
215         \r
216         // ----------------------------------------\r
217         // for each device\r
218         // ----------------------------------------\r
219         \r
220         // devices\r
221         DEVICE* get_device(int id);\r
222         DEVICE* dummy;\r
223         DEVICE* first_device;\r
224         DEVICE* last_device;\r
225         \r
226         int sr_mode;\r
227 };\r
228 #endif\r