OSDN Git Service

7c6f323d121940be0d3bdd497074302910f99fce
[csp-qt/common_source_project-fm7.git] / source / src / vm / multi8 / multi8.h
1 /*
2         MITSUBISHI Electric MULTI8 Emulator 'EmuLTI8'
3
4         Author : Takeda.Toshiya
5         Date   : 2006.09.15 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _MULTI8_H_
11 #define _MULTI8_H_
12
13 #define DEVICE_NAME             "MITSUBISHI Electric MULTI 8"
14 #define CONFIG_NAME             "multi8"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60.58
18 #define LINES_PER_FRAME         260
19 #define CHARS_PER_LINE          112
20 #define HD46505_HORIZ_FREQ      15750
21 #define CPU_CLOCKS              3993600
22 #define SCREEN_WIDTH            640
23 #define SCREEN_HEIGHT           400
24 #define WINDOW_HEIGHT_ASPECT    480
25 #define I8259_MAX_CHIPS         1
26 #define MAX_DRIVE               4
27 #define UPD765A_DONT_WAIT_SEEK
28 #define HAS_AY_3_8912
29 #define SUPPORT_VARIABLE_TIMING
30
31 // device informations for win32
32 #define SUPPORT_TV_RENDER
33 #define USE_TAPE                        1
34 #define TAPE_BINARY_ONLY
35 #define USE_FLOPPY_DISK         2
36 #define USE_KEY_LOCKED
37 #define USE_SHIFT_NUMPAD_KEY
38 #define USE_ALT_F10_KEY
39 #define USE_AUTO_KEY            5
40 #define USE_AUTO_KEY_RELEASE    6
41 #define USE_AUTO_KEY_CAPS
42 #define USE_AUTO_KEY_NUMPAD
43 #define USE_SCREEN_FILTER
44 #define USE_SCANLINE
45
46 #define USE_SOUND_VOLUME        3
47 #define USE_DEBUGGER
48 #define USE_STATE
49 #define USE_CPU_Z80
50
51 #include "../../common.h"
52 #include "../../fileio.h"
53 #include "../vm_template.h"
54
55 #ifdef USE_SOUND_VOLUME
56 static const _TCHAR *sound_device_caption[] = {
57         _T("PSG"), _T("Beep"), _T("Noise (FDD)"),
58 };
59 #endif
60
61 class csp_state_utils;
62 class EMU;
63 class DEVICE;
64 class EVENT;
65
66 class BEEP;
67 class HD46505;
68 class I8251;
69 class I8253;
70 class I8255;
71 class I8259;
72 class IO;
73 class UPD765A;
74 //class YM2203;
75 class AY_3_891X;
76 class Z80;
77
78 class CMT;
79 class DISPLAY;
80 class FLOPPY;
81 class KANJI;
82 class KEYBOARD;
83 class MEMORY;
84
85 class VM : public VM_TEMPLATE
86 {
87 protected:
88         //EMU* emu;
89         //csp_state_utils *state_entry;
90         
91         // devices
92         //EVENT* event;
93         
94         BEEP* beep;
95         HD46505* crtc;
96         I8251* sio;
97         I8253* pit;
98         I8255* pio;
99         I8259* pic;
100         IO* io;
101         UPD765A* fdc;
102 //      YM2203* psg;
103         AY_3_891X* psg;
104         Z80* cpu;
105         
106         CMT* cmt;
107         DISPLAY* display;
108         FLOPPY* floppy;
109         KANJI* kanji;
110         KEYBOARD* key;
111         MEMORY* memory;
112         
113 public:
114         // ----------------------------------------
115         // initialize
116         // ----------------------------------------
117         
118         VM(EMU* parent_emu);
119         ~VM();
120         
121         // ----------------------------------------
122         // for emulation class
123         // ----------------------------------------
124         
125         // drive virtual machine
126         void reset();
127         void run();
128         double get_frame_rate();
129         
130 #ifdef USE_DEBUGGER
131         // debugger
132         DEVICE *get_cpu(int index);
133 #endif
134         
135         // draw screen
136         void draw_screen();
137         
138         // sound generation
139         void initialize_sound(int rate, int samples);
140         uint16_t* create_sound(int* extra_frames);
141         int get_sound_buffer_ptr();
142 #ifdef USE_SOUND_VOLUME
143         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
144 #endif
145         
146         // notify key
147         bool get_caps_locked();
148         bool get_kana_locked();
149         
150         // user interface
151         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
152         void close_floppy_disk(int drv);
153         bool is_floppy_disk_inserted(int drv);
154         void is_floppy_disk_protected(int drv, bool value);
155         bool is_floppy_disk_protected(int drv);
156         uint32_t is_floppy_disk_accessed();
157         void play_tape(int drv, const _TCHAR* file_path);
158         void rec_tape(int drv, const _TCHAR* file_path);
159         void close_tape(int drv);
160         bool is_tape_inserted(int drv);
161         bool is_frame_skippable();
162         
163         void update_config();
164         void decl_state();
165         void save_state(FILEIO* state_fio);
166         bool load_state(FILEIO* state_fio);
167         
168         // ----------------------------------------
169         // for each device
170         // ----------------------------------------
171         
172         // devices
173         DEVICE* get_device(int id);
174         //DEVICE* dummy;
175         //DEVICE* first_device;
176         //DEVICE* last_device;
177 };
178
179 #endif