2 SHARP MZ-700 Emulator 'EmuZ-700'
3 SHARP MZ-800 Emulator 'EmuZ-800'
4 SHARP MZ-1500 Emulator 'EmuZ-1500'
6 Author : Takeda.Toshiya
16 #define DEVICE_NAME "SHARP MZ-700"
17 #define CONFIG_NAME "mz700"
19 #define DEVICE_NAME "SHARP MZ-800"
20 #define CONFIG_NAME "mz800"
21 #elif defined(_MZ1500)
22 #define DEVICE_NAME "SHARP MZ-1500"
23 #define CONFIG_NAME "mz1500"
26 // device informations for virtual machine
28 #define FRAMES_PER_SEC (3546895.0 / 228.0 / 312.0)
29 #define LINES_PER_FRAME 312
30 #define CPU_CLOCKS 3546895
32 #define FRAMES_PER_SEC (3579545.0 / 228.0 / 262.0)
33 #define LINES_PER_FRAME 262
34 #define CPU_CLOCKS 3579545
36 #define SCREEN_WIDTH 640
37 #define SCREEN_HEIGHT 400
38 #define WINDOW_HEIGHT_ASPECT 480
39 #define IO_ADDR_MAX 0x100
40 #define Z80_MEMORY_WAIT
42 #if defined(_MZ800) || defined(_MZ1500)
47 #define MZ1P17_SW1_4_ON
50 // device informations for win32
54 #define USE_BOOT_MODE 2
57 #define USE_TAPE_BUTTON
58 #if defined(_MZ800) || defined(_MZ1500)
59 #define USE_DRIVE_TYPE 2
60 #define USE_FLOPPY_DISK 2
61 #define USE_QUICK_DISK 1
63 #define USE_SHIFT_NUMPAD_KEY
64 #define USE_ALT_F10_KEY
65 #define USE_AUTO_KEY 5
66 #define USE_AUTO_KEY_RELEASE 6
67 #define USE_AUTO_KEY_CAPS
68 #if defined(_MZ700) || defined(_MZ1500)
69 #define USE_AUTO_KEY_NUMPAD
70 #define USE_VM_AUTO_KEY_TABLE
73 #define USE_MONITOR_TYPE 2
75 #define USE_SCREEN_FILTER
78 #define USE_SOUND_VOLUME 3
80 #define USE_SOUND_VOLUME 5
81 #elif defined(_MZ1500)
82 #define USE_SOUND_VOLUME 6
86 #define USE_PRINTER_TYPE 4
88 #define SUPPORT_TV_RENDER
93 #if defined(_MZ700) || defined(_MZ1500)
94 static const int vm_auto_key_table_base[][2] = {
95 // thanks Mr.Koucha Youkan
96 {0xa1, 0x300 | 0xbe}, // '¡' *** MODIFIED ***
97 {0xa2, 0x300 | 0x38}, // '¢' *** MODIFIED ***
98 {0xa3, 0x300 | 0x39}, // '£' *** MODIFIED ***
99 {0xa4, 0x300 | 0xbc}, // '¤' *** MODIFIED ***
100 {0xa5, 0x300 | 0x30}, // '¥' *** MODIFIED ***
101 {0xa6, 0x200 | 0xdb}, // '¦' *** MODIFIED ***
102 {0xa7, 0x300 | 0x31}, // '§'
103 {0xa8, 0x300 | 0x32}, // '¨'
104 {0xa9, 0x300 | 0x33}, // '©'
105 {0xaa, 0x300 | 0x34}, // 'ª'
106 {0xab, 0x300 | 0x35}, // '«'
107 {0xac, 0x300 | 0xbd}, // '¬' *** MODIFIED ***
108 {0xad, 0x300 | 0xde}, // '' *** MODIFIED ***
109 {0xae, 0x300 | 0xdc}, // '®' *** MODIFIED ***
110 {0xaf, 0x300 | 0x43}, // '¯'
111 {0xb0, 0x200 | 0xe2}, // '°' *** MODIFIED ***
112 {0xb1, 0x200 | 0x31}, // '±'
113 {0xb2, 0x200 | 0x32}, // '²'
114 {0xb3, 0x200 | 0x33}, // '³'
115 {0xb4, 0x200 | 0x34}, // '´'
116 {0xb5, 0x200 | 0x35}, // 'µ'
117 {0xb6, 0x200 | 0x51}, // '¶'
118 {0xb7, 0x200 | 0x57}, // '·'
119 {0xb8, 0x200 | 0x45}, // '¸'
120 {0xb9, 0x200 | 0x52}, // '¹'
121 {0xba, 0x200 | 0x54}, // 'º'
122 {0xbb, 0x200 | 0x41}, // '»'
123 {0xbc, 0x200 | 0x53}, // '¼'
124 {0xbd, 0x200 | 0x44}, // '½'
125 {0xbe, 0x200 | 0x46}, // '¾'
126 {0xbf, 0x200 | 0x47}, // '¿'
127 {0xc0, 0x200 | 0x5a}, // 'À'
128 {0xc1, 0x200 | 0x58}, // 'Á'
129 {0xc2, 0x200 | 0x43}, // 'Â'
130 {0xc3, 0x200 | 0x56}, // 'Ã'
131 {0xc4, 0x200 | 0x42}, // 'Ä'
132 {0xc5, 0x200 | 0x36}, // 'Å'
133 {0xc6, 0x200 | 0x37}, // 'Æ'
134 {0xc7, 0x200 | 0x38}, // 'Ç'
135 {0xc8, 0x200 | 0x39}, // 'È'
136 {0xc9, 0x200 | 0x30}, // 'É'
137 {0xca, 0x200 | 0x59}, // 'Ê'
138 {0xcb, 0x200 | 0x55}, // 'Ë'
139 {0xcc, 0x200 | 0x49}, // 'Ì'
140 {0xcd, 0x200 | 0x4f}, // 'Í'
141 {0xce, 0x200 | 0x50}, // 'Î'
142 {0xcf, 0x200 | 0x48}, // 'Ï'
143 {0xd0, 0x200 | 0x4a}, // 'Ð'
144 {0xd1, 0x200 | 0x4b}, // 'Ñ'
145 {0xd2, 0x200 | 0x4c}, // 'Ò'
146 {0xd3, 0x200 | 0xbb}, // 'Ó'
147 {0xd4, 0x200 | 0xbd}, // 'Ô' *** MODIFIED ***
148 {0xd5, 0x200 | 0xde}, // 'Õ' *** MODIFIED ***
149 {0xd6, 0x200 | 0xdc}, // 'Ö' *** MODIFIED ***
150 {0xd7, 0x200 | 0x4e}, // '×' *** MODIFIED ***
151 {0xd8, 0x200 | 0x4d}, // 'Ø' *** MODIFIED ***
152 {0xd9, 0x200 | 0xbc}, // 'Ù' *** MODIFIED ***
153 {0xda, 0x200 | 0xbe}, // 'Ú' *** MODIFIED ***
154 {0xdb, 0x200 | 0xbf}, // 'Û' *** MODIFIED ***
155 {0xdc, 0x200 | 0xc0}, // 'Ü' *** MODIFIED ***
156 {0xdd, 0x200 | 0x78}, // 'Ý' *** MODIFIED ***
157 {0xde, 0x200 | 0xba}, // 'Þ' *** MODIFIED ***
158 {0xdf, 0x200 | 0xdd}, // 'ß' *** MODIFIED ***
163 #include "../../common.h"
164 #include "../../fileio.h"
165 #include "../vm_template.h"
167 #ifdef USE_SOUND_VOLUME
168 static const _TCHAR *sound_device_caption[] = {
171 #elif defined(_MZ1500)
172 _T("PSG #1"), _T("PSG #2"),
174 _T("Beep"), _T("CMT (Signal)"),
175 #if defined(_MZ800) || defined(_MZ1500)
182 class csp_state_utils;
202 #if defined(_MZ800) || defined(_MZ1500)
215 class VM : public VM_TEMPLATE
219 //csp_state_utils* state_entry;
239 #if defined(_MZ800) || defined(_MZ1500)
245 #elif defined(_MZ1500)
253 Z80SIO* sio_rs; // RS-232C
254 Z80SIO* sio_qd; // QD
268 // ----------------------------------------
270 // ----------------------------------------
275 // ----------------------------------------
276 // for emulation class
277 // ----------------------------------------
279 // drive virtual machine
285 DEVICE *get_cpu(int index);
292 void initialize_sound(int rate, int samples);
293 uint16_t* create_sound(int* extra_frames);
294 int get_sound_buffer_ptr();
295 #ifdef USE_SOUND_VOLUME
296 void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
300 void play_tape(int drv, const _TCHAR* file_path);
301 void rec_tape(int drv, const _TCHAR* file_path);
302 void close_tape(int drv);
303 bool is_tape_inserted(int drv);
304 bool is_tape_playing(int drv);
305 bool is_tape_recording(int drv);
306 int get_tape_position(int drv);
307 const _TCHAR* get_tape_message(int drv);
308 void push_play(int drv);
309 void push_stop(int drv);
310 void push_fast_forward(int drv);
311 void push_fast_rewind(int drv);
312 void push_apss_forward(int drv) {}
313 void push_apss_rewind(int drv) {}
314 #if defined(_MZ800) || defined(_MZ1500)
315 void open_quick_disk(int drv, const _TCHAR* file_path);
316 void close_quick_disk(int drv);
317 bool is_quick_disk_inserted(int drv);
318 uint32_t is_quick_disk_accessed();
319 void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
320 void close_floppy_disk(int drv);
321 bool is_floppy_disk_inserted(int drv);
322 void is_floppy_disk_protected(int drv, bool value);
323 bool is_floppy_disk_protected(int drv);
324 uint32_t is_floppy_disk_accessed();
326 bool is_frame_skippable();
328 void update_config();
330 void save_state(FILEIO* state_fio);
331 bool load_state(FILEIO* state_fio);
333 // ----------------------------------------
335 // ----------------------------------------
338 DEVICE* get_device(int id);
340 //DEVICE* first_device;
341 //DEVICE* last_device;