OSDN Git Service

[VM][Qt] Add Sony SMC-70/777 .
[csp-qt/common_source_project-fm7.git] / source / src / vm / smc777 / smc777.h
1 /*
2         SONY SMC-777 Emulator 'eSMC-777'
3
4         Author : Takeda.Toshiya
5         Date   : 2015.08.13-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _SMC777_H_
11 #define _SMC777_H_
12
13 #if defined(_SMC70)
14 #define DEVICE_NAME             "SONY SMC-70"
15 #define CONFIG_NAME             "smc70"
16 #elif defined(_SMC777)
17 #define DEVICE_NAME             "SONY SMC-777"
18 #define CONFIG_NAME             "smc777"
19 #endif
20
21 // device informations for virtual machine
22 #define FRAMES_PER_SEC          60
23 #define LINES_PER_FRAME         262
24 #define CHARS_PER_LINE          128
25 #define HD46505_HORIZ_FREQ      15734
26 #define CPU_CLOCKS              4027975
27 #define SCREEN_WIDTH            640
28 #define SCREEN_HEIGHT           400
29 #define MAX_DRIVE               2
30 #define MB8877_NO_BUSY_AFTER_SEEK
31 #define SUPPORT_MEDIA_TYPE_1DD
32 #define IO_ADDR_MAX             0x10000
33 #define SUPPORT_VARIABLE_TIMING
34
35 // device informations for win32
36 #define USE_SPECIAL_RESET
37 #define USE_FD1
38 #define USE_FD2
39 #define USE_TAPE
40 #define USE_TAPE_BUTTON
41 #define NOTIFY_KEY_DOWN
42 //#define USE_SHIFT_NUMPAD_KEY
43 #define USE_ALT_F10_KEY
44 #define USE_AUTO_KEY            8
45 #define USE_AUTO_KEY_RELEASE    10
46 #define AUTO_KEY_US
47 #define USE_VM_AUTO_KEY_TABLE
48 #define USE_CRT_FILTER
49 #define USE_SCANLINE
50 #define USE_ACCESS_LAMP
51 #define USE_DEBUGGER
52 #define USE_STATE
53
54 static const int vm_autokey_table_base[][2] = {
55         // 0x100: shift
56         // 0x200: kana
57         {0xa1,  0x300 | 0xbf},  // '¡' -> '/'
58         {0xa2,  0x300 | 0xba},  // '¢' -> ':'
59         {0xa3,  0x300 | 0xdd},  // '£' -> ']'
60         {0xa4,  0x300 | 0xbe},  // '¤' -> '.'
61         {0xa5,  0x300 | 0xe2},  // '¥' -> '_'
62         {0xa6,  0x200 | 0xbf},  // '¦' -> '/'
63         {0xa7,  0x300 | 0x31},  // '§' -> '1'
64         {0xa8,  0x300 | 0x32},  // '¨' -> '2'
65         {0xa9,  0x300 | 0x33},  // '©' -> '3'
66         {0xaa,  0x300 | 0x34},  // 'ª' -> '4'
67         {0xab,  0x300 | 0x35},  // '«' -> '5'
68         {0xac,  0x300 | 0x4e},  // '¬' -> 'N'
69         {0xad,  0x300 | 0x4d},  // '­' -> 'M'
70         {0xae,  0x300 | 0xbc},  // '®' -> ','
71         {0xaf,  0x300 | 0x43},  // '¯' -> 'C'
72         {0xb0,  0x300 | 0xdb},  // '°' -> '['
73         {0xb1,  0x200 | 0x31},  // '±' -> '1'
74         {0xb2,  0x200 | 0x32},  // '²' -> '2'
75         {0xb3,  0x200 | 0x33},  // '³' -> '3'
76         {0xb4,  0x200 | 0x34},  // '´' -> '4'
77         {0xb5,  0x200 | 0x35},  // 'µ' -> '5'
78         {0xb6,  0x200 | 0x51},  // '¶' -> 'Q'
79         {0xb7,  0x200 | 0x57},  // '·' -> 'W'
80         {0xb8,  0x200 | 0x45},  // '¸' -> 'E'
81         {0xb9,  0x200 | 0x52},  // '¹' -> 'R'
82         {0xba,  0x200 | 0x54},  // 'º' -> 'T'
83         {0xbb,  0x200 | 0x41},  // '»' -> 'A'
84         {0xbc,  0x200 | 0x53},  // '¼' -> 'S'
85         {0xbd,  0x200 | 0x44},  // '½' -> 'D'
86         {0xbe,  0x200 | 0x46},  // '¾' -> 'F'
87         {0xbf,  0x200 | 0x47},  // '¿' -> 'G'
88         {0xc0,  0x200 | 0x5a},  // 'À' -> 'Z'
89         {0xc1,  0x200 | 0x58},  // 'Á' -> 'X'
90         {0xc2,  0x200 | 0x43},  // 'Â' -> 'C'
91         {0xc3,  0x200 | 0x56},  // 'Ã' -> 'V'
92         {0xc4,  0x200 | 0x42},  // 'Ä' -> 'B'
93         {0xc5,  0x200 | 0x36},  // 'Å' -> '6'
94         {0xc6,  0x200 | 0x37},  // 'Æ' -> '7'
95         {0xc7,  0x200 | 0x38},  // 'Ç' -> '8'
96         {0xc8,  0x200 | 0x39},  // 'È' -> '9'
97         {0xc9,  0x200 | 0x30},  // 'É' -> '0'
98         {0xca,  0x200 | 0x59},  // 'Ê' -> 'Y'
99         {0xcb,  0x200 | 0x55},  // 'Ë' -> 'U'
100         {0xcc,  0x200 | 0x49},  // 'Ì' -> 'I'
101         {0xcd,  0x200 | 0x4f},  // 'Í' -> 'O'
102         {0xce,  0x200 | 0x50},  // 'Î' -> 'P'
103         {0xcf,  0x200 | 0x48},  // 'Ï' -> 'H'
104         {0xd0,  0x200 | 0x4a},  // 'Ð' -> 'J'
105         {0xd1,  0x200 | 0x4b},  // 'Ñ' -> 'K'
106         {0xd2,  0x200 | 0x4c},  // 'Ò' -> 'L'
107         {0xd3,  0x200 | 0xbb},  // 'Ó' -> ';'
108         {0xd4,  0x200 | 0x4e},  // 'Ô' -> 'N'
109         {0xd5,  0x200 | 0x4d},  // 'Õ' -> 'M'
110         {0xd6,  0x200 | 0xbc},  // 'Ö' -> ','
111         {0xd7,  0x200 | 0xbd},  // '×' -> '-'
112         {0xd8,  0x200 | 0xde},  // 'Ø' -> '^'
113         {0xd9,  0x200 | 0xdc},  // 'Ù' -> '\'
114         {0xda,  0x200 | 0xc0},  // 'Ú' -> '@'
115         {0xdb,  0x200 | 0xdb},  // 'Û' -> '['
116         {0xdc,  0x200 | 0xbe},  // 'Ü' -> '.'
117         {0xdd,  0x200 | 0xe2},  // 'Ý' -> '_'
118         {0xde,  0x200 | 0xba},  // 'Þ' -> ':'
119         {0xdf,  0x200 | 0xdd},  // 'ß' -> ']'
120         {-1,    -1},
121 };
122
123 #include "../../common.h"
124 #include "../../fileio.h"
125
126 class EMU;
127 class DEVICE;
128 class EVENT;
129
130 class DATAREC;
131 class HD46505;
132 class MB8877;
133 class PCM1BIT;
134 class SN76489AN;
135 class Z80;
136
137 class IO;
138
139 class VM
140 {
141 protected:
142         EMU* emu;
143         
144         // devices
145         EVENT* event;
146         
147         DATAREC* drec;
148         HD46505* crtc;
149         MB8877* fdc;
150         PCM1BIT* pcm;
151         SN76489AN* psg;
152         Z80* cpu;
153         
154         IO* io;
155         
156 public:
157         // ----------------------------------------
158         // initialize
159         // ----------------------------------------
160         
161         VM(EMU* parent_emu);
162         ~VM();
163         
164         // ----------------------------------------
165         // for emulation class
166         // ----------------------------------------
167         
168         // drive virtual machine
169         void reset();
170         void special_reset();
171         void run();
172         double frame_rate();
173         
174 #ifdef USE_DEBUGGER
175         // debugger
176         DEVICE *get_cpu(int index);
177 #endif
178         
179         // draw screen
180         void draw_screen();
181         int access_lamp();
182         
183         // sound generation
184         void initialize_sound(int rate, int samples);
185         uint16* create_sound(int* extra_frames);
186         int sound_buffer_ptr();
187         
188         // notify key
189         void key_down(int code, bool repeat);
190         void key_up(int code);
191         
192         // user interface
193         void open_disk(int drv, const _TCHAR* file_path, int bank);
194         void close_disk(int drv);
195         bool disk_inserted(int drv);
196         void set_disk_protected(int drv, bool value);
197         bool get_disk_protected(int drv);
198         void play_tape(const _TCHAR* file_path);
199         void rec_tape(const _TCHAR* file_path);
200         void close_tape();
201         bool tape_inserted();
202         void push_play();
203         void push_stop();
204         void push_fast_forward();
205         void push_fast_rewind();
206         void push_apss_forward() {}
207         void push_apss_rewind() {}
208         bool get_tape_play(void);
209         bool now_skip();
210         
211         void update_config();
212         void save_state(FILEIO* state_fio);
213         bool load_state(FILEIO* state_fio);
214         
215         // ----------------------------------------
216         // for each device
217         // ----------------------------------------
218         
219         // devices
220         DEVICE* get_device(int id);
221         DEVICE* dummy;
222         DEVICE* first_device;
223         DEVICE* last_device;
224 };
225
226 #endif