OSDN Git Service

[VM][General] Merge upstream 2016-02-13. Still don't implement OSD/Gui part of joysti...
[csp-qt/common_source_project-fm7.git] / source / src / vm / mycomz80a / mycomz80a.h
1 /*
2         Japan Electronics College MYCOMZ-80A Emulator 'eMYCOMZ-80A'
3
4         Author : Takeda.Toshiya
5         Date   : 2009.05.13-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _MYCOMZ80A_H_
11 #define _MYCOMZ80A_H_
12
13 #define DEVICE_NAME             "Japan Electronics College MYCOMZ-80A"
14 #define CONFIG_NAME             "mycomz80a"
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          64
20 #define HD46505_HORIZ_FREQ      15750
21 #define CPU_CLOCKS              2500000
22 #define SCREEN_WIDTH            640
23 #define SCREEN_HEIGHT           400
24 #define SUPPORT_VARIABLE_TIMING
25 #define HAS_MSM5832
26
27 // device informations for win32
28 #define USE_TAPE
29 #define NOTIFY_KEY_DOWN
30 #define USE_SHIFT_NUMPAD_KEY
31 #define USE_ALT_F10_KEY
32 #define USE_AUTO_KEY            5
33 #define USE_AUTO_KEY_RELEASE    6
34 #define USE_AUTO_KEY_CAPS
35 #define USE_CRT_FILTER
36 #define USE_SCANLINE
37 #define USE_SOUND_VOLUME        2
38 #define USE_DEBUGGER
39 #define USE_STATE
40
41 #include "../../common.h"
42 #include "../../fileio.h"
43
44 #ifdef USE_SOUND_VOLUME
45 static const _TCHAR *sound_device_caption[] = {
46         _T("PSG"), _T("CMT"),
47 };
48 static const bool sound_device_monophonic[] = {
49         false, false,
50 };
51 #endif
52
53 class EMU;
54 class DEVICE;
55 class EVENT;
56
57 class DATAREC;
58 class HD46505;
59 class I8255;
60 class IO;
61 class MSM58321;
62 class SN76489AN;
63 class Z80;
64
65 class DISPLAY;
66 class KEYBOARD;
67 class MEMORY;
68
69 class VM
70 {
71 protected:
72         EMU* emu;
73         
74         // devices
75         EVENT* event;
76         
77         DATAREC* drec;
78         HD46505* crtc;
79         I8255* pio1;
80         I8255* pio2;
81         I8255* pio3;
82         IO* io;
83         MSM58321* rtc;
84         SN76489AN* psg;
85         Z80* cpu;
86         
87         DISPLAY* display;
88         KEYBOARD* keyboard;
89         MEMORY* memory;
90         
91 public:
92         // ----------------------------------------
93         // initialize
94         // ----------------------------------------
95         
96         VM(EMU* parent_emu);
97         ~VM();
98         
99         // ----------------------------------------
100         // for emulation class
101         // ----------------------------------------
102         
103         // drive virtual machine
104         void reset();
105         void run();
106         double frame_rate();
107         
108 #ifdef USE_DEBUGGER
109         // debugger
110         DEVICE *get_cpu(int index);
111 #endif
112         
113         // draw screen
114         void draw_screen();
115         
116         // sound generation
117         void initialize_sound(int rate, int samples);
118         uint16* create_sound(int* extra_frames);
119         int sound_buffer_ptr();
120 #ifdef USE_SOUND_VOLUME
121         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
122 #endif
123         
124         // notify key
125         void key_down(int code, bool repeat);
126         void key_up(int code);
127         
128         // user interface
129         void play_tape(const _TCHAR* file_path);
130         void rec_tape(const _TCHAR* file_path);
131         void close_tape();
132         bool tape_inserted();
133         bool tape_playing();
134         bool tape_recording();
135         int tape_position();
136         bool now_skip();
137         
138         void update_config();
139         void save_state(FILEIO* state_fio);
140         bool load_state(FILEIO* state_fio);
141         
142         // ----------------------------------------
143         // for each device
144         // ----------------------------------------
145         
146         // devices
147         DEVICE* get_device(int id);
148         DEVICE* dummy;
149         DEVICE* first_device;
150         DEVICE* last_device;
151 };
152
153 #endif