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_FLOPPY_DISK 2
60 #define USE_QUICK_DISK 1
62 #define USE_SHIFT_NUMPAD_KEY
63 #define USE_ALT_F10_KEY
64 #define USE_AUTO_KEY 5
65 #define USE_AUTO_KEY_RELEASE 6
66 #define USE_AUTO_KEY_CAPS
67 #if defined(_MZ700) || defined(_MZ1500)
68 #define USE_AUTO_KEY_NUMPAD
69 #define USE_VM_AUTO_KEY_TABLE
72 #define USE_MONITOR_TYPE 2
74 #define USE_SCREEN_FILTER
77 #define USE_SOUND_VOLUME 3
79 #define USE_SOUND_VOLUME 5
80 #elif defined(_MZ1500)
81 #define USE_SOUND_VOLUME 6
85 #define USE_PRINTER_TYPE 4
87 #define SUPPORT_TV_RENDER
92 #if defined(_MZ700) || defined(_MZ1500)
93 static const int vm_auto_key_table_base[][2] = {
94 // thanks Mr.Koucha Youkan
95 {0xa1, 0x300 | 0xbe}, // '¡' *** MODIFIED ***
96 {0xa2, 0x300 | 0x38}, // '¢' *** MODIFIED ***
97 {0xa3, 0x300 | 0x39}, // '£' *** MODIFIED ***
98 {0xa4, 0x300 | 0xbc}, // '¤' *** MODIFIED ***
99 {0xa5, 0x300 | 0x30}, // '¥' *** MODIFIED ***
100 {0xa6, 0x200 | 0xdb}, // '¦' *** MODIFIED ***
101 {0xa7, 0x300 | 0x31}, // '§'
102 {0xa8, 0x300 | 0x32}, // '¨'
103 {0xa9, 0x300 | 0x33}, // '©'
104 {0xaa, 0x300 | 0x34}, // 'ª'
105 {0xab, 0x300 | 0x35}, // '«'
106 {0xac, 0x300 | 0xbd}, // '¬' *** MODIFIED ***
107 {0xad, 0x300 | 0xde}, // '' *** MODIFIED ***
108 {0xae, 0x300 | 0xdc}, // '®' *** MODIFIED ***
109 {0xaf, 0x300 | 0x43}, // '¯'
110 {0xb0, 0x200 | 0xe2}, // '°' *** MODIFIED ***
111 {0xb1, 0x200 | 0x31}, // '±'
112 {0xb2, 0x200 | 0x32}, // '²'
113 {0xb3, 0x200 | 0x33}, // '³'
114 {0xb4, 0x200 | 0x34}, // '´'
115 {0xb5, 0x200 | 0x35}, // 'µ'
116 {0xb6, 0x200 | 0x51}, // '¶'
117 {0xb7, 0x200 | 0x57}, // '·'
118 {0xb8, 0x200 | 0x45}, // '¸'
119 {0xb9, 0x200 | 0x52}, // '¹'
120 {0xba, 0x200 | 0x54}, // 'º'
121 {0xbb, 0x200 | 0x41}, // '»'
122 {0xbc, 0x200 | 0x53}, // '¼'
123 {0xbd, 0x200 | 0x44}, // '½'
124 {0xbe, 0x200 | 0x46}, // '¾'
125 {0xbf, 0x200 | 0x47}, // '¿'
126 {0xc0, 0x200 | 0x5a}, // 'À'
127 {0xc1, 0x200 | 0x58}, // 'Á'
128 {0xc2, 0x200 | 0x43}, // 'Â'
129 {0xc3, 0x200 | 0x56}, // 'Ã'
130 {0xc4, 0x200 | 0x42}, // 'Ä'
131 {0xc5, 0x200 | 0x36}, // 'Å'
132 {0xc6, 0x200 | 0x37}, // 'Æ'
133 {0xc7, 0x200 | 0x38}, // 'Ç'
134 {0xc8, 0x200 | 0x39}, // 'È'
135 {0xc9, 0x200 | 0x30}, // 'É'
136 {0xca, 0x200 | 0x59}, // 'Ê'
137 {0xcb, 0x200 | 0x55}, // 'Ë'
138 {0xcc, 0x200 | 0x49}, // 'Ì'
139 {0xcd, 0x200 | 0x4f}, // 'Í'
140 {0xce, 0x200 | 0x50}, // 'Î'
141 {0xcf, 0x200 | 0x48}, // 'Ï'
142 {0xd0, 0x200 | 0x4a}, // 'Ð'
143 {0xd1, 0x200 | 0x4b}, // 'Ñ'
144 {0xd2, 0x200 | 0x4c}, // 'Ò'
145 {0xd3, 0x200 | 0xbb}, // 'Ó'
146 {0xd4, 0x200 | 0xbd}, // 'Ô' *** MODIFIED ***
147 {0xd5, 0x200 | 0xde}, // 'Õ' *** MODIFIED ***
148 {0xd6, 0x200 | 0xdc}, // 'Ö' *** MODIFIED ***
149 {0xd7, 0x200 | 0x4e}, // '×' *** MODIFIED ***
150 {0xd8, 0x200 | 0x4d}, // 'Ø' *** MODIFIED ***
151 {0xd9, 0x200 | 0xbc}, // 'Ù' *** MODIFIED ***
152 {0xda, 0x200 | 0xbe}, // 'Ú' *** MODIFIED ***
153 {0xdb, 0x200 | 0xbf}, // 'Û' *** MODIFIED ***
154 {0xdc, 0x200 | 0xc0}, // 'Ü' *** MODIFIED ***
155 {0xdd, 0x200 | 0x78}, // 'Ý' *** MODIFIED ***
156 {0xde, 0x200 | 0xba}, // 'Þ' *** MODIFIED ***
157 {0xdf, 0x200 | 0xdd}, // 'ß' *** MODIFIED ***
162 #include "../../common.h"
163 #include "../../fileio.h"
164 #include "../vm_template.h"
166 #ifdef USE_SOUND_VOLUME
167 static const _TCHAR *sound_device_caption[] = {
170 #elif defined(_MZ1500)
171 _T("PSG #1"), _T("PSG #2"),
173 _T("Beep"), _T("CMT (Signal)"),
174 #if defined(_MZ800) || defined(_MZ1500)
181 class csp_state_utils;
201 #if defined(_MZ800) || defined(_MZ1500)
214 class VM : public VM_TEMPLATE
218 //csp_state_utils* state_entry;
238 #if defined(_MZ800) || defined(_MZ1500)
244 #elif defined(_MZ1500)
252 Z80SIO* sio_rs; // RS-232C
253 Z80SIO* sio_qd; // QD
267 // ----------------------------------------
269 // ----------------------------------------
274 // ----------------------------------------
275 // for emulation class
276 // ----------------------------------------
278 // drive virtual machine
284 DEVICE *get_cpu(int index);
291 void initialize_sound(int rate, int samples);
292 uint16_t* create_sound(int* extra_frames);
293 int get_sound_buffer_ptr();
294 #ifdef USE_SOUND_VOLUME
295 void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
299 void play_tape(int drv, const _TCHAR* file_path);
300 void rec_tape(int drv, const _TCHAR* file_path);
301 void close_tape(int drv);
302 bool is_tape_inserted(int drv);
303 bool is_tape_playing(int drv);
304 bool is_tape_recording(int drv);
305 int get_tape_position(int drv);
306 const _TCHAR* get_tape_message(int drv);
307 void push_play(int drv);
308 void push_stop(int drv);
309 void push_fast_forward(int drv);
310 void push_fast_rewind(int drv);
311 void push_apss_forward(int drv) {}
312 void push_apss_rewind(int drv) {}
313 #if defined(_MZ800) || defined(_MZ1500)
314 void open_quick_disk(int drv, const _TCHAR* file_path);
315 void close_quick_disk(int drv);
316 bool is_quick_disk_inserted(int drv);
317 uint32_t is_quick_disk_accessed();
318 void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
319 void close_floppy_disk(int drv);
320 bool is_floppy_disk_inserted(int drv);
321 void is_floppy_disk_protected(int drv, bool value);
322 bool is_floppy_disk_protected(int drv);
323 uint32_t is_floppy_disk_accessed();
325 bool is_frame_skippable();
327 void update_config();
329 void save_state(FILEIO* state_fio);
330 bool load_state(FILEIO* state_fio);
332 // ----------------------------------------
334 // ----------------------------------------
337 DEVICE* get_device(int id);
339 //DEVICE* first_device;
340 //DEVICE* last_device;