OSDN Git Service

e2b4dbe51d127ccda99aeaec15d53f5df9f87a05
[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 #define USE_STATE
46
47 #include "../../common.h"
48
49 class EMU;
50 class DEVICE;
51 class EVENT;
52
53 class BEEP;
54 class HD146818P;
55 class I8255;
56 class MC6800;
57 class TF20;
58 class UPD765A;
59 class Z80;
60 class Z80SIO;
61
62 class MEMORY;
63
64 class FILEIO;
65
66 class VM
67 {
68 protected:
69         EMU* emu;
70         
71         // devices
72         EVENT* event;
73         
74         BEEP* beep;
75         HD146818P* rtc;
76         MC6800* cpu;
77         
78         TF20* tf20;
79         I8255* pio_tf20;
80         UPD765A* fdc_tf20;
81         Z80* cpu_tf20;
82         Z80SIO* sio_tf20;
83         
84         MEMORY* memory;
85         
86 public:
87         // ----------------------------------------
88         // initialize
89         // ----------------------------------------
90         
91         VM(EMU* parent_emu);
92         ~VM();
93         
94         // ----------------------------------------
95         // for emulation class
96         // ----------------------------------------
97         
98         // drive virtual machine
99         void reset();
100         void notify_power_off();
101         void run();
102         
103 #ifdef USE_DEBUGGER
104         // debugger
105         DEVICE *get_cpu(int index);
106 #endif
107         
108         // draw screen
109         void draw_screen();
110         int access_lamp();
111         
112         // sound generation
113         void initialize_sound(int rate, int samples);
114         uint16* create_sound(int* extra_frames);
115         int sound_buffer_ptr();
116         
117         // notify key
118         void key_down(int code, bool repeat);
119         void key_up(int code);
120         
121         // user interface
122         void open_disk(int drv, _TCHAR* file_path, int bank);
123         void close_disk(int drv);
124         bool disk_inserted(int drv);
125         bool is_write_protect_fd(int drv);
126         void write_protect_fd(int drv, bool flag);
127         void play_tape(_TCHAR* file_path);
128         void rec_tape(_TCHAR* file_path);
129         void close_tape();
130         bool tape_inserted();
131         int get_tape_ptr(void);
132
133         bool now_skip();
134         
135         void update_config();
136         void save_state(FILEIO* state_fio);
137         bool load_state(FILEIO* state_fio);
138         
139         // ----------------------------------------
140         // for each device
141         // ----------------------------------------
142         
143         // devices
144         DEVICE* get_device(int id);
145         DEVICE* dummy;
146         DEVICE* first_device;
147         DEVICE* last_device;
148 };
149
150 #endif