OSDN Git Service

c0ecf172bfc22283edb12ea9649062440e272270
[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_FLOPPY_DISK         4
30 #define NOTIFY_KEY_DOWN
31 #define USE_ALT_F10_KEY
32 #define USE_AUTO_KEY            6
33 #define USE_AUTO_KEY_RELEASE    10
34 #define USE_SOUND_VOLUME        1
35 #define USE_DEBUGGER
36 #define USE_STATE
37 #define USE_CPU_Z80
38
39 #include "../../common.h"
40 #include "../../fileio.h"
41
42 #ifdef USE_SOUND_VOLUME
43 static const _TCHAR *sound_device_caption[] = {
44         _T("Beep"),
45 };
46 #endif
47
48 class EMU;
49 class DEVICE;
50 class EVENT;
51
52 class BEEP;
53 class I8251;
54 class PTF20;
55 class Z80;
56
57 class IO;
58 class MEMORY;
59
60 class VM
61 {
62 protected:
63         EMU* emu;
64         
65         // devices
66         EVENT* event;
67         
68         BEEP* beep;
69         I8251* sio;
70         PTF20* tf20;
71         Z80* cpu;
72         
73         IO* io;
74         MEMORY* memory;
75         
76 public:
77         // ----------------------------------------
78         // initialize
79         // ----------------------------------------
80         
81         VM(EMU* parent_emu);
82         ~VM();
83         
84         // ----------------------------------------
85         // for emulation class
86         // ----------------------------------------
87         
88         // drive virtual machine
89         void reset();
90         void special_reset();
91         void run();
92         
93 #ifdef USE_DEBUGGER
94         // debugger
95         DEVICE *get_cpu(int index);
96 #endif
97         
98         // draw screen
99         void draw_screen();
100         
101         // sound generation
102         void initialize_sound(int rate, int samples);
103         uint16_t* create_sound(int* extra_frames);
104         int get_sound_buffer_ptr();
105 #ifdef USE_SOUND_VOLUME
106         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
107 #endif
108         
109         // notify key
110         void key_down(int code, bool repeat);
111         void key_up(int code);
112         
113         // user interface
114         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
115         void close_floppy_disk(int drv);
116         bool is_floppy_disk_inserted(int drv);
117         void is_floppy_disk_protected(int drv, bool value);
118         bool is_floppy_disk_protected(int drv);
119         uint32_t is_floppy_disk_accessed();
120         bool is_frame_skippable();
121         
122         void update_config();
123         void save_state(FILEIO* state_fio);
124         bool load_state(FILEIO* state_fio);
125         
126         // ----------------------------------------
127         // for each device
128         // ----------------------------------------
129         
130         // devices
131         DEVICE* get_device(int id);
132         DEVICE* dummy;
133         DEVICE* first_device;
134         DEVICE* last_device;
135 };
136
137 #endif