OSDN Git Service

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