OSDN Git Service

[VM] Apply VM_TEMPLATE to all VMs.
[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_MODE_BASE        3
28 #define USE_DIPSWITCH
29 #define DIPSWITCH_DEFAULT       0x0f
30 #define USE_FLOPPY_DISK         2
31 #define USE_TAPE                1
32 #define TAPE_BINARY_ONLY
33 #define NOTIFY_KEY_DOWN
34 #define USE_ALT_F10_KEY
35 #define USE_AUTO_KEY            6
36 #define USE_AUTO_KEY_RELEASE    12
37 #define USE_AUTO_KEY_CAPS
38 #define DONT_KEEEP_KEY_PRESSED
39 #define USE_NOTIFY_POWER_OFF
40 #define USE_SOUND_VOLUME                2
41 #define USE_DEBUGGER
42 #define USE_STATE
43 #define USE_CPU_HD6301
44 #define USE_CPU_Z80
45
46 #include "../../common.h"
47 #include "../../fileio.h"
48 #include "../vm_template.h"
49
50 #ifdef USE_SOUND_VOLUME
51 static const _TCHAR *sound_device_caption[] = {
52         _T("Beep"), _T("Noise (FDD)"),
53 };
54 #endif
55
56 class csp_state_utils;
57 class EMU;
58 class DEVICE;
59 class EVENT;
60
61 class BEEP;
62 class HD146818P;
63 class I8255;
64 //class MC6800;
65 class HD6301;
66 class TF20;
67 class UPD765A;
68 class Z80;
69 class Z80SIO;
70
71 class MEMORY;
72
73 class VM : public VM_TEMPLATE
74 {
75 protected:
76         //EMU* emu;
77         //csp_state_utils *state_entry;
78         
79         // devices
80         //EVENT* event;
81         
82         BEEP* beep;
83         HD146818P* rtc;
84         //MC6800* cpu;
85         HD6301* cpu;
86         
87         TF20* tf20;
88         I8255* pio_tf20;
89         UPD765A* fdc_tf20;
90         Z80* cpu_tf20;
91         Z80SIO* sio_tf20;
92         
93         MEMORY* memory;
94         
95 public:
96         // ----------------------------------------
97         // initialize
98         // ----------------------------------------
99         
100         VM(EMU* parent_emu);
101         ~VM();
102         
103         // ----------------------------------------
104         // for emulation class
105         // ----------------------------------------
106         
107         // drive virtual machine
108         void reset();
109         void notify_power_off();
110         void run();
111         
112 #ifdef USE_DEBUGGER
113         // debugger
114         DEVICE *get_cpu(int index);
115 #endif
116         
117         // draw screen
118         void draw_screen();
119         
120         // sound generation
121         void initialize_sound(int rate, int samples);
122         uint16_t* create_sound(int* extra_frames);
123         int get_sound_buffer_ptr();
124 #ifdef USE_SOUND_VOLUME
125         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
126 #endif
127         
128         // notify key
129         void key_down(int code, bool repeat);
130         void key_up(int code);
131         
132         // user interface
133         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
134         void close_floppy_disk(int drv);
135         bool is_floppy_disk_inserted(int drv);
136         void is_floppy_disk_protected(int drv, bool value);
137         bool is_floppy_disk_protected(int drv);
138         uint32_t is_floppy_disk_accessed();
139         void play_tape(int drv, const _TCHAR* file_path);
140         void rec_tape(int drv, const _TCHAR* file_path);
141         void close_tape(int drv);
142         bool is_tape_inserted(int drv);
143         bool is_frame_skippable();
144         
145         void update_config();
146         void decl_state();
147         void save_state(FILEIO* state_fio);
148         bool load_state(FILEIO* state_fio);
149         
150         // ----------------------------------------
151         // for each device
152         // ----------------------------------------
153         
154         // devices
155         DEVICE* get_device(int id);
156         //DEVICE* dummy;
157         //DEVICE* first_device;
158         //DEVICE* last_device;
159 };
160
161 #endif