OSDN Git Service

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