OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz3500 / mz3500.h
1 /*
2         SHARP MZ-3500 Emulator 'EmuZ-3500'
3
4         Author : Takeda.Toshiya
5         Date   : 2010.08.31-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _MZ3500_H_
11 #define _MZ3500_H_
12
13 #define DEVICE_NAME             "SHARP MZ-3500"
14 #define CONFIG_NAME             "mz3500"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          47.3
18 #define LINES_PER_FRAME         441
19 #define CPU_CLOCKS              4000000
20 #define SCREEN_WIDTH            640
21 #define SCREEN_HEIGHT           400
22 #define WINDOW_HEIGHT_ASPECT    480
23 #define MAX_DRIVE               4
24 #define UPD765A_WAIT_RESULT7
25 #define UPD765A_EXT_DRVSEL
26 #define UPD7220_HORIZ_FREQ      20920
27 #define IO_ADDR_MAX             0x100
28 #define PRINTER_STROBE_RISING_EDGE
29 #define SUPPORT_VARIABLE_TIMING
30
31 // device informations for win32
32 #define USE_SPECIAL_RESET
33 #define USE_DIPSWITCH
34 #define DIPSWITCH_DEFAULT       0x1fd
35 #define USE_FLOPPY_DISK         4
36 #define NOTIFY_KEY_DOWN
37 #define USE_KEY_LOCKED
38 #define USE_SHIFT_NUMPAD_KEY
39 #define USE_ALT_F10_KEY
40 #define USE_AUTO_KEY            5
41 #define USE_AUTO_KEY_RELEASE    6
42 #define USE_AUTO_KEY_NUMPAD
43 #define USE_MONITOR_TYPE        4
44 #define USE_SCREEN_FILTER
45 #define USE_SCANLINE
46 #define USE_SOUND_VOLUME        2
47 #define USE_PRINTER
48 #define USE_PRINTER_TYPE        4
49 #define USE_DEBUGGER
50 #define USE_STATE
51 #define USE_CPU_Z80
52
53 #include "../../common.h"
54 #include "../../fileio.h"
55 #include "../vm_template.h"
56
57 #ifdef USE_SOUND_VOLUME
58 static const _TCHAR *sound_device_caption[] = {
59         _T("Beep"), _T("Noise (FDD)"),
60 };
61 #endif
62
63 class csp_state_utils;
64 class EMU;
65 class DEVICE;
66 class EVENT;
67
68 class I8251;
69 class I8253;
70 class I8255;
71 class IO;
72 class LS244;
73 class NOT;
74 class PCM1BIT;
75 class UPD1990A;
76 class UPD7220;
77 class UPD765A;
78 class Z80;
79
80 namespace MZ3500 {
81         class MAIN;
82         class SUB;
83         class KEYBOARD;
84 }
85
86 class VM : public VM_TEMPLATE
87 {
88 protected:
89         //EMU* emu;
90         //csp_state_utils *state_entry;
91         
92         // devices
93         //EVENT* event;
94         
95         // for main cpu
96         IO* mainio;
97         UPD765A* fdc;
98         Z80* maincpu;
99         MZ3500::MAIN* mainbus;
100         
101         // for sub cpu
102         DEVICE* printer;
103         I8251* sio;
104         I8253* pit;
105         I8255* pio;
106         IO* subio;
107         LS244* ls244;
108         NOT* not_data0;
109         NOT* not_data1;
110         NOT* not_data2;
111         NOT* not_data3;
112         NOT* not_data4;
113         NOT* not_data5;
114         NOT* not_data6;
115         NOT* not_data7;
116         NOT* not_busy;
117         PCM1BIT* pcm;
118         UPD1990A* rtc;
119         UPD7220* gdc_chr;
120         UPD7220* gdc_gfx;
121         Z80* subcpu;
122         MZ3500::SUB* subbus;
123         MZ3500::KEYBOARD* kbd;
124         
125         uint8_t halt;
126         
127 public:
128         // ----------------------------------------
129         // initialize
130         // ----------------------------------------
131         
132         VM(EMU* parent_emu);
133         ~VM();
134         
135         // ----------------------------------------
136         // for emulation class
137         // ----------------------------------------
138         
139         // drive virtual machine
140         void reset();
141         void special_reset();
142         void run();
143         double get_frame_rate();
144         
145 #ifdef USE_DEBUGGER
146         // debugger
147         DEVICE *get_cpu(int index);
148 #endif
149         
150         // draw screen
151         void draw_screen();
152         
153         // sound generation
154         void initialize_sound(int rate, int samples);
155         uint16_t* create_sound(int* extra_frames);
156         int get_sound_buffer_ptr();
157 #ifdef USE_SOUND_VOLUME
158         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
159 #endif
160         
161         // notify key
162         void key_down(int code, bool repeat);
163         void key_up(int code);
164         bool get_caps_locked();
165         bool get_kana_locked();
166         
167         // user interface
168         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
169         void close_floppy_disk(int drv);
170         bool is_floppy_disk_inserted(int drv);
171         void is_floppy_disk_protected(int drv, bool value);
172         bool is_floppy_disk_protected(int drv);
173         uint32_t is_floppy_disk_accessed();
174         bool is_frame_skippable();
175         
176         void update_config();
177         bool process_state(FILEIO* state_fio, bool loading);
178         
179         // ----------------------------------------
180         // for each device
181         // ----------------------------------------
182         
183         // devices
184         DEVICE* get_device(int id);
185         //DEVICE* dummy;
186         //DEVICE* first_device;
187         //DEVICE* last_device;
188 };
189
190 #endif