OSDN Git Service

[General][VM] Merge upstream, 2015-04-10.
[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 // Nonintelligent ram disk
28 #define DEVICE_TYPE_DEFAULT     2
29 #define USE_FD1
30 #define USE_FD2
31 #define USE_FD3
32 #define USE_FD4
33 #define NOTIFY_KEY_DOWN
34 #define USE_ALT_F10_KEY
35 #define USE_AUTO_KEY            6
36 #define USE_AUTO_KEY_RELEASE    10
37 #define USE_ACCESS_LAMP
38 #define USE_DEBUGGER
39 #define USE_STATE
40
41 #include "../../common.h"
42 #include "../../fileio.h"
43
44 class EMU;
45 class DEVICE;
46 class EVENT;
47
48 class BEEP;
49 class I8251;
50 class PTF20;
51 class Z80;
52
53 class IO;
54 class MEMORY;
55
56 class VM
57 {
58 protected:
59         EMU* emu;
60         
61         // devices
62         EVENT* event;
63         
64         BEEP* beep;
65         I8251* sio;
66         PTF20* tf20;
67         Z80* cpu;
68         
69         IO* io;
70         MEMORY* memory;
71         
72 public:
73         // ----------------------------------------
74         // initialize
75         // ----------------------------------------
76         
77         VM(EMU* parent_emu);
78         ~VM();
79         
80         // ----------------------------------------
81         // for emulation class
82         // ----------------------------------------
83         
84         // drive virtual machine
85         void reset();
86         void special_reset();
87         void run();
88         
89 #ifdef USE_DEBUGGER
90         // debugger
91         DEVICE *get_cpu(int index);
92 #endif
93         
94         // draw screen
95         void draw_screen();
96         int access_lamp();
97         
98         // sound generation
99         void initialize_sound(int rate, int samples);
100         uint16* create_sound(int* extra_frames);
101         int sound_buffer_ptr();
102         
103         // notify key
104         void key_down(int code, bool repeat);
105         void key_up(int code);
106         
107         // user interface
108         void open_disk(int drv, _TCHAR* file_path, int bank);
109         void close_disk(int drv);
110         bool disk_inserted(int drv);
111         bool now_skip();
112         
113         void update_config();
114         void save_state(FILEIO* state_fio);
115         bool load_state(FILEIO* state_fio);
116         
117         // ----------------------------------------
118         // for each device
119         // ----------------------------------------
120         
121         // devices
122         DEVICE* get_device(int id);
123         DEVICE* dummy;
124         DEVICE* first_device;
125         DEVICE* last_device;
126 };
127
128 #endif