OSDN Git Service

[VM][WIP] Use namespace to devices per VMs.
[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_MODE_BASE        2
26 #define USE_SPECIAL_RESET
27 #define USE_FLOPPY_DISK         4
28 #define USE_TAPE                1
29 #define USE_TAPE_BUTTON
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                3
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"), _T("CMT (Signal)"), _T("Noise (CMT)"),
46 };
47 #endif
48
49 class csp_state_utils;
50 class EMU;
51 class DEVICE;
52 class EVENT;
53
54 class BEEP;
55 class DATAREC;
56 class PTF20;
57 class Z80;
58
59 namespace HC40 {
60         class IO;
61         class MEMORY;
62 }
63 class VM : public VM_TEMPLATE
64 {
65 protected:
66         //EMU* emu;
67         //csp_state_utils *state_entry;
68         
69         // devices
70         //EVENT* event;
71         
72         BEEP* beep;
73         DATAREC* drec;
74         PTF20* tf20;
75         Z80* cpu;
76         
77         HC40::IO* io;
78         HC40::MEMORY* memory;
79         
80 public:
81         // ----------------------------------------
82         // initialize
83         // ----------------------------------------
84         
85         VM(EMU* parent_emu);
86         ~VM();
87         
88         // ----------------------------------------
89         // for emulation class
90         // ----------------------------------------
91         
92         // drive virtual machine
93         void reset();
94         void special_reset();
95         void run();
96         
97 #ifdef USE_DEBUGGER
98         // debugger
99         DEVICE *get_cpu(int index);
100 #endif
101         
102         // draw screen
103         void draw_screen();
104         
105         // sound generation
106         void initialize_sound(int rate, int samples);
107         uint16_t* create_sound(int* extra_frames);
108         int get_sound_buffer_ptr();
109 #ifdef USE_SOUND_VOLUME
110         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
111 #endif
112         
113         // notify key
114         void key_down(int code, bool repeat);
115         void key_up(int code);
116         
117         // user interface
118         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
119         void close_floppy_disk(int drv);
120         bool is_floppy_disk_inserted(int drv);
121         void is_floppy_disk_protected(int drv, bool value);
122         bool is_floppy_disk_protected(int drv);
123         uint32_t is_floppy_disk_accessed();
124         void play_tape(int drv, const _TCHAR* file_path);
125         void rec_tape(int drv, const _TCHAR* file_path);
126         void close_tape(int drv);
127         bool is_tape_inserted(int drv);
128         bool is_tape_playing(int drv);
129         bool is_tape_recording(int drv);
130         int get_tape_position(int drv);
131         const _TCHAR* get_tape_message(int drv);
132         void push_play(int drv);
133         void push_stop(int drv);
134         void push_fast_forward(int drv);
135         void push_fast_rewind(int drv);
136         void push_apss_forward(int drv) {}
137         void push_apss_rewind(int drv) {}
138         bool is_frame_skippable();
139         
140         void update_config();
141         bool process_state(FILEIO* state_fio, bool loading);
142         
143         // ----------------------------------------
144         // for each device
145         // ----------------------------------------
146         
147         // devices
148         DEVICE* get_device(int id);
149         //DEVICE* dummy;
150         //DEVICE* first_device;
151         //DEVICE* last_device;
152 };
153
154 #endif