OSDN Git Service

[General][Qt] Merge upstream 2015-03-15.
[csp-qt/common_source_project-fm7.git] / source / src / vm / hc80 / hc80.h
1 /*
2         EPSON HC-80 Emulator 'eHC-80'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.03.14 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _HC80_H_
11 #define _HC80_H_
12
13 #define DEVICE_NAME             "EPSON HC-80"
14 #define CONFIG_NAME             "hc80"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          64
18 #define LINES_PER_FRAME         64
19 #define CPU_CLOCKS              2457600
20 #define SCREEN_WIDTH            480
21 #define SCREEN_HEIGHT           64
22 #define MAX_DRIVE               4
23
24 // device informations for win32
25 #define USE_SPECIAL_RESET
26 #define USE_DEVICE_TYPE         3
27 #define USE_FD1
28 #define USE_FD2
29 #define USE_FD3
30 #define USE_FD4
31 #define NOTIFY_KEY_DOWN
32 #define USE_ALT_F10_KEY
33 #define USE_AUTO_KEY            6
34 #define USE_AUTO_KEY_RELEASE    10
35 #define USE_ACCESS_LAMP
36 #define USE_DEBUGGER
37 #define USE_STATE
38
39 #include "../../common.h"
40 #include "../../fileio.h"
41
42 class EMU;
43 class DEVICE;
44 class EVENT;
45
46 class BEEP;
47 class I8251;
48 class PTF20;
49 class Z80;
50
51 class IO;
52 class MEMORY;
53
54 class VM
55 {
56 protected:
57         EMU* emu;
58         
59         // devices
60         EVENT* event;
61         
62         BEEP* beep;
63         I8251* sio;
64         PTF20* tf20;
65         Z80* cpu;
66         
67         IO* io;
68         MEMORY* memory;
69         
70 public:
71         // ----------------------------------------
72         // initialize
73         // ----------------------------------------
74         
75         VM(EMU* parent_emu);
76         ~VM();
77         
78         // ----------------------------------------
79         // for emulation class
80         // ----------------------------------------
81         
82         // drive virtual machine
83         void reset();
84         void special_reset();
85         void run();
86         
87 #ifdef USE_DEBUGGER
88         // debugger
89         DEVICE *get_cpu(int index);
90 #endif
91         
92         // draw screen
93         void draw_screen();
94         int access_lamp();
95         
96         // sound generation
97         void initialize_sound(int rate, int samples);
98         uint16* create_sound(int* extra_frames);
99         int sound_buffer_ptr();
100         
101         // notify key
102         void key_down(int code, bool repeat);
103         void key_up(int code);
104         
105         // user interface
106         void open_disk(int drv, _TCHAR* file_path, int bank);
107         void close_disk(int drv);
108         bool disk_inserted(int drv);
109         bool now_skip();
110         
111         void update_config();
112         void save_state(FILEIO* state_fio);
113         bool load_state(FILEIO* state_fio);
114         
115         // ----------------------------------------
116         // for each device
117         // ----------------------------------------
118         
119         // devices
120         DEVICE* get_device(int id);
121         DEVICE* dummy;
122         DEVICE* first_device;
123         DEVICE* last_device;
124 };
125
126 #endif