OSDN Git Service

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