OSDN Git Service

[General][Qt] Merge upstream 2015-03-15.
[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_DEBUGGER
38 #define USE_STATE
39
40 #include "../../common.h"
41 #include "../../fileio.h"
42
43 class EMU;
44 class DEVICE;
45 class EVENT;
46
47 class DATAREC;
48 class HD46505;
49 class I8255;
50 class IO;
51 class MSM58321;
52 class SN76489AN;
53 class Z80;
54
55 class DISPLAY;
56 class KEYBOARD;
57 class MEMORY;
58
59 class VM
60 {
61 protected:
62         EMU* emu;
63         
64         // devices
65         EVENT* event;
66         
67         DATAREC* drec;
68         HD46505* crtc;
69         I8255* pio1;
70         I8255* pio2;
71         I8255* pio3;
72         IO* io;
73         MSM58321* rtc;
74         SN76489AN* psg;
75         Z80* cpu;
76         
77         DISPLAY* display;
78         KEYBOARD* keyboard;
79         MEMORY* memory;
80         
81 public:
82         // ----------------------------------------
83         // initialize
84         // ----------------------------------------
85         
86         VM(EMU* parent_emu);
87         ~VM();
88         
89         // ----------------------------------------
90         // for emulation class
91         // ----------------------------------------
92         
93         // drive virtual machine
94         void reset();
95         void run();
96         double frame_rate();
97         
98 #ifdef USE_DEBUGGER
99         // debugger
100         DEVICE *get_cpu(int index);
101 #endif
102         
103         // draw screen
104         void draw_screen();
105         
106         // sound generation
107         void initialize_sound(int rate, int samples);
108         uint16* create_sound(int* extra_frames);
109         int sound_buffer_ptr();
110         
111         // notify key
112         void key_down(int code, bool repeat);
113         void key_up(int code);
114         
115         // user interface
116         void play_tape(_TCHAR* file_path);
117         void rec_tape(_TCHAR* file_path);
118         void close_tape();
119         bool tape_inserted();
120         bool now_skip();
121         
122         void update_config();
123         void save_state(FILEIO* state_fio);
124         bool load_state(FILEIO* state_fio);
125         
126         // ----------------------------------------
127         // for each device
128         // ----------------------------------------
129         
130         // devices
131         DEVICE* get_device(int id);
132         DEVICE* dummy;
133         DEVICE* first_device;
134         DEVICE* last_device;
135 };
136
137 #endif