OSDN Git Service

720b36ea7cc7ec0946bada4801def942ba4898ef
[csp-qt/common_source_project-fm7.git] / source / src / vm / hc20 / hc20.h
1 /*
2         EPSON HC-20 Emulator 'eHC-20'
3
4         Author : Takeda.Toshiya
5         Date   : 2011.05.23-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _HC20_H_
11 #define _HC20_H_
12
13 #define DEVICE_NAME             "EPSON HC-20"
14 #define CONFIG_NAME             "hc20"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          72
18 #define LINES_PER_FRAME         64
19 #define CPU_CLOCKS              614400
20 #define SCREEN_WIDTH            120
21 #define SCREEN_HEIGHT           32
22 #define MAX_DRIVE               2
23 #define HAS_HD6301
24
25 // device informations for win32
26 #define WINDOW_WIDTH            (SCREEN_WIDTH * 3)
27 #define WINDOW_HEIGHT           (SCREEN_HEIGHT * 3)
28
29 #define USE_DIPSWITCH
30 #define DIPSWITCH_DEFAULT       0x07
31 #define USE_FD1
32 #define USE_FD2
33 #define USE_TAPE
34 #define TAPE_BINARY_ONLY
35 #define NOTIFY_KEY_DOWN
36 #define USE_ALT_F10_KEY
37 #define USE_AUTO_KEY            6
38 #define USE_AUTO_KEY_RELEASE    12
39 #define USE_AUTO_KEY_CAPS
40 #define DONT_KEEEP_KEY_PRESSED
41 #define USE_POWER_OFF
42 #define USE_ACCESS_LAMP
43 #define USE_DEBUGGER
44
45 #include "../../common.h"
46
47 class EMU;
48 class DEVICE;
49 class EVENT;
50
51 class BEEP;
52 class HD146818P;
53 class MC6800;
54 class TF20;
55
56 class MEMORY;
57
58 class VM
59 {
60 protected:
61         EMU* emu;
62         
63         // devices
64         EVENT* event;
65         
66         BEEP* beep;
67         HD146818P* rtc;
68         MC6800* cpu;
69         TF20* tf20;
70         
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 notify_power_off();
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, _TCHAR* file_path, int bank);
110         void close_disk(int drv);
111         bool disk_inserted(int drv);
112         bool is_write_protect_fd(int drv);
113         void write_protect_fd(int drv, bool flag);
114         void play_tape(_TCHAR* file_path);
115         void rec_tape(_TCHAR* file_path);
116         void close_tape();
117         bool tape_inserted();
118         int get_tape_ptr(void);
119
120         bool now_skip();
121         
122         void update_config();
123         
124         // ----------------------------------------
125         // for each device
126         // ----------------------------------------
127         
128         // devices
129         DEVICE* get_device(int id);
130         DEVICE* dummy;
131         DEVICE* first_device;
132         DEVICE* last_device;
133 };
134
135 #endif