OSDN Git Service

[General] Merge upstream 2015-01-31 , pc8801ma is still not working correct.
[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 #define HAS_UPD7201
25
26 // device informations for win32
27 #define WINDOW_WIDTH            (SCREEN_WIDTH * 3)
28 #define WINDOW_HEIGHT           (SCREEN_HEIGHT * 3)
29
30 #define USE_DIPSWITCH
31 #define DIPSWITCH_DEFAULT       0x0f
32 #define USE_FD1
33 #define USE_FD2
34 #define USE_TAPE
35 #define TAPE_BINARY_ONLY
36 #define NOTIFY_KEY_DOWN
37 #define USE_ALT_F10_KEY
38 #define USE_AUTO_KEY            6
39 #define USE_AUTO_KEY_RELEASE    12
40 #define USE_AUTO_KEY_CAPS
41 #define DONT_KEEEP_KEY_PRESSED
42 #define USE_POWER_OFF
43 #define USE_ACCESS_LAMP
44 #define USE_DEBUGGER
45
46 #include "../../common.h"
47
48 class EMU;
49 class DEVICE;
50 class EVENT;
51
52 class BEEP;
53 class HD146818P;
54 class I8255;
55 class MC6800;
56 class TF20;
57 class UPD765A;
58 class Z80;
59 class Z80SIO;
60
61 class MEMORY;
62
63 class VM
64 {
65 protected:
66         EMU* emu;
67         
68         // devices
69         EVENT* event;
70         
71         BEEP* beep;
72         HD146818P* rtc;
73         MC6800* cpu;
74         
75         TF20* tf20;
76         I8255* pio_tf20;
77         UPD765A* fdc_tf20;
78         Z80* cpu_tf20;
79         Z80SIO* sio_tf20;
80         
81         MEMORY* memory;
82         
83 public:
84         // ----------------------------------------
85         // initialize
86         // ----------------------------------------
87         
88         VM(EMU* parent_emu);
89         ~VM();
90         
91         // ----------------------------------------
92         // for emulation class
93         // ----------------------------------------
94         
95         // drive virtual machine
96         void reset();
97         void notify_power_off();
98         void run();
99         
100 #ifdef USE_DEBUGGER
101         // debugger
102         DEVICE *get_cpu(int index);
103 #endif
104         
105         // draw screen
106         void draw_screen();
107         int access_lamp();
108         
109         // sound generation
110         void initialize_sound(int rate, int samples);
111         uint16* create_sound(int* extra_frames);
112         int sound_buffer_ptr();
113         
114         // notify key
115         void key_down(int code, bool repeat);
116         void key_up(int code);
117         
118         // user interface
119         void open_disk(int drv, _TCHAR* file_path, int bank);
120         void close_disk(int drv);
121         bool disk_inserted(int drv);
122         bool is_write_protect_fd(int drv);
123         void write_protect_fd(int drv, bool flag);
124         void play_tape(_TCHAR* file_path);
125         void rec_tape(_TCHAR* file_path);
126         void close_tape();
127         bool tape_inserted();
128         int get_tape_ptr(void);
129
130         bool now_skip();
131         
132         void update_config();
133         
134         // ----------------------------------------
135         // for each device
136         // ----------------------------------------
137         
138         // devices
139         DEVICE* get_device(int id);
140         DEVICE* dummy;
141         DEVICE* first_device;
142         DEVICE* last_device;
143 };
144
145 #endif