OSDN Git Service

[VM] Apply VM_TEMPLATE to all VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mycomz80a / mycomz80a.h
1 /*
2         Japan Electronics College MYCOMZ-80A Emulator 'eMYCOMZ-80A'
3
4         Author : Takeda.Toshiya
5         Date   : 2009.05.13-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _MYCOMZ80A_H_
11 #define _MYCOMZ80A_H_
12
13 #define DEVICE_NAME             "Japan Electronics College MYCOMZ-80A"
14 #define CONFIG_NAME             "mycomz80a"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60.58
18 #define LINES_PER_FRAME         260
19 #define CHARS_PER_LINE          64
20 #define HD46505_CHAR_CLOCK      1008000
21 #define CPU_CLOCKS              2500000
22 #define SCREEN_WIDTH            640
23 #define SCREEN_HEIGHT           400
24 #define WINDOW_HEIGHT_ASPECT    480
25 #define SUPPORT_VARIABLE_TIMING
26 #define HAS_MSM5832
27
28 // device informations for win32
29 #define USE_TAPE                1
30 #define USE_TAPE_BUTTON
31 #define NOTIFY_KEY_DOWN
32 #define USE_KEY_LOCKED
33 #define USE_SHIFT_NUMPAD_KEY
34 #define USE_ALT_F10_KEY
35 #define USE_AUTO_KEY            5
36 #define USE_AUTO_KEY_RELEASE    6
37 #define USE_AUTO_KEY_CAPS
38 #define USE_AUTO_KEY_NUMPAD
39 #define USE_SCREEN_FILTER
40 #define USE_SCANLINE
41
42 #define USE_SOUND_VOLUME        3
43 #define SUPPORT_TV_RENDER
44 #define USE_DEBUGGER
45 #define USE_STATE
46 #define USE_CPU_Z80
47
48 #include "../../common.h"
49 #include "../../fileio.h"
50 #include "../vm_template.h"
51
52 #ifdef USE_SOUND_VOLUME
53 static const _TCHAR *sound_device_caption[] = {
54         _T("PSG"), _T("CMT (Signal)"), _T("Noise (CMT)"),
55 };
56 #endif
57
58 class csp_state_utils;
59 class EMU;
60 class DEVICE;
61 class EVENT;
62
63 class DATAREC;
64 class HD46505;
65 class I8255;
66 class IO;
67 class MSM5832;
68 class SN76489AN;
69 class Z80;
70
71 class DISPLAY;
72 class KEYBOARD;
73 class MEMORY;
74
75 class VM : public VM_TEMPLATE
76 {
77 protected:
78         //EMU* emu;
79         //csp_state_utils *state_entry;
80         
81         // devices
82         //EVENT* event;
83         
84         DATAREC* drec;
85         HD46505* crtc;
86         I8255* pio1;
87         I8255* pio2;
88         I8255* pio3;
89         IO* io;
90         MSM5832* rtc;
91         SN76489AN* psg;
92         Z80* cpu;
93         
94         DISPLAY* display;
95         KEYBOARD* keyboard;
96         MEMORY* memory;
97         
98 public:
99         // ----------------------------------------
100         // initialize
101         // ----------------------------------------
102         
103         VM(EMU* parent_emu);
104         ~VM();
105         
106         // ----------------------------------------
107         // for emulation class
108         // ----------------------------------------
109         
110         // drive virtual machine
111         void reset();
112         void run();
113         double get_frame_rate();
114         
115 #ifdef USE_DEBUGGER
116         // debugger
117         DEVICE *get_cpu(int index);
118 #endif
119         
120         // draw screen
121         void draw_screen();
122         
123         // sound generation
124         void initialize_sound(int rate, int samples);
125         uint16_t* create_sound(int* extra_frames);
126         int get_sound_buffer_ptr();
127 #ifdef USE_SOUND_VOLUME
128         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
129 #endif
130         
131         // notify key
132         void key_down(int code, bool repeat);
133         void key_up(int code);
134         bool get_caps_locked();
135         bool get_kana_locked();
136         
137         // user interface
138         void play_tape(int drv, const _TCHAR* file_path);
139         void rec_tape(int drv, const _TCHAR* file_path);
140         void close_tape(int drv);
141         bool is_tape_inserted(int drv);
142         bool is_tape_playing(int drv);
143         bool is_tape_recording(int drv);
144         int get_tape_position(int drv);
145         const _TCHAR* get_tape_message(int drv);
146         void push_play(int drv);
147         void push_stop(int drv);
148         void push_fast_forward(int drv);
149         void push_fast_rewind(int drv);
150         void push_apss_forward(int drv) {}
151         void push_apss_rewind(int drv) {}
152         bool is_frame_skippable();
153         
154         void update_config();
155         void decl_state();
156         void save_state(FILEIO* state_fio);
157         bool load_state(FILEIO* state_fio);
158         
159         // ----------------------------------------
160         // for each device
161         // ----------------------------------------
162         
163         // devices
164         DEVICE* get_device(int id);
165         //DEVICE* dummy;
166         //DEVICE* first_device;
167         //DEVICE* last_device;
168 };
169
170 #endif