OSDN Git Service

[General] Convert sourcecode's CRLF format: DOS(WINDOWS) to Unix, to apply patches...
[csp-qt/common_source_project-fm7.git] / source / src / vm / hc40 / hc40.h
1 /*
2         EPSON HC-40 Emulator 'eHC-40'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.02.23 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _HC40_H_
11 #define _HC40_H_
12
13 #define DEVICE_NAME             "EPSON HC-40"
14 #define CONFIG_NAME             "hc40"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          72
18 #define LINES_PER_FRAME         64
19 #define CPU_CLOCKS              3686400
20 #define SCREEN_WIDTH            240
21 #define SCREEN_HEIGHT           64
22 #define MAX_DRIVE               4
23
24 // device informations for win32
25 #define WINDOW_WIDTH            (SCREEN_WIDTH * 2)
26 #define WINDOW_HEIGHT           (SCREEN_HEIGHT * 2)
27
28 #define USE_SPECIAL_RESET
29 #define USE_FD1
30 #define USE_FD2
31 #define USE_FD3
32 #define USE_FD4
33 #define USE_TAPE
34 #define NOTIFY_KEY_DOWN
35 #define USE_ALT_F10_KEY
36 #define USE_AUTO_KEY            6
37 #define USE_AUTO_KEY_RELEASE    10
38 #define USE_ACCESS_LAMP
39 #define USE_DEBUGGER
40
41 #include "../../common.h"
42
43 class EMU;
44 class DEVICE;
45 class EVENT;
46
47 class BEEP;
48 class DATAREC;
49 class TF20;
50 class Z80;
51
52 class IO;
53 class MEMORY;
54
55 class VM
56 {
57 protected:
58         EMU* emu;
59         
60         // devices
61         EVENT* event;
62         
63         BEEP* beep;
64         DATAREC* drec;
65         TF20* tf20;
66         Z80* cpu;
67         
68         IO* io;
69         MEMORY* memory;
70         
71 public:
72         // ----------------------------------------
73         // initialize
74         // ----------------------------------------
75         
76         VM(EMU* parent_emu);
77         ~VM();
78         
79         // ----------------------------------------
80         // for emulation class
81         // ----------------------------------------
82         
83         // drive virtual machine
84         void reset();
85         void special_reset();
86         void run();
87         
88 #ifdef USE_DEBUGGER
89         // debugger
90         DEVICE *get_cpu(int index);
91 #endif
92         
93         // draw screen
94         void draw_screen();
95         int access_lamp();
96         
97         // sound generation
98         void initialize_sound(int rate, int samples);
99         uint16* create_sound(int* extra_frames);
100         int sound_buffer_ptr();
101         
102         // notify key
103         void key_down(int code, bool repeat);
104         void key_up(int code);
105         
106         // user interface
107         void open_disk(int drv, _TCHAR* file_path, int offset);
108         void close_disk(int drv);
109         bool disk_inserted(int drv);
110         void play_tape(_TCHAR* file_path);
111         void rec_tape(_TCHAR* file_path);
112         void close_tape();
113         bool tape_inserted();
114         bool now_skip();
115         
116         void update_config();
117         
118         // ----------------------------------------
119         // for each device
120         // ----------------------------------------
121         
122         // devices
123         DEVICE* get_device(int id);
124         DEVICE* dummy;
125         DEVICE* first_device;
126         DEVICE* last_device;
127 };
128
129 #endif