OSDN Git Service

59903cf7684f2143e0172446a9c1c78e999c11e4
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz2800 / mz2800.h
1 /*
2         SHARP MZ-2800 Emulator 'EmuZ-2800'
3
4         Author : Takeda.Toshiya
5         Date   : 2007.08.13 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _MZ2800_H_
11 #define _MZ2800_H_
12
13 #define DEVICE_NAME             "SHARP MZ-2800"
14 #define CONFIG_NAME             "mz2800"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          55.4
18 #define LINES_PER_FRAME         440
19 #define CHARS_PER_LINE          108
20 #define CPU_CLOCKS              8000000
21 #define SCREEN_WIDTH            640
22 #define SCREEN_HEIGHT           400
23 #define WINDOW_HEIGHT_ASPECT    480
24 #define MAX_DRIVE               4
25 #define HAS_I286
26 #define I8259_MAX_CHIPS         2
27 #define SINGLE_MODE_DMA
28 #define HAS_RP5C15
29 #define IO_ADDR_MAX             0x8000
30 #define SCSI_HOST_AUTO_ACK
31
32 // device informations for win32
33 #define USE_FLOPPY_DISK         4
34 #define USE_HARD_DISK           2
35 #define USE_SHIFT_NUMPAD_KEY
36 #define USE_ALT_F10_KEY
37 #define USE_AUTO_KEY            5
38 #define USE_AUTO_KEY_RELEASE    6
39 #define USE_AUTO_KEY_NUMPAD
40 #define USE_SCREEN_FILTER
41 #define USE_SOUND_VOLUME        4
42 #define USE_JOYSTICK
43 #define USE_MOUSE
44 #define USE_PRINTER
45 #define USE_PRINTER_TYPE        4
46 #define USE_DEBUGGER
47 #define USE_STATE
48 #define USE_CPU_I286
49
50 #include "../../common.h"
51 #include "../../fileio.h"
52 #include "../vm_template.h"
53
54 #ifdef USE_SOUND_VOLUME
55 static const _TCHAR *sound_device_caption[] = {
56         _T("OPN (FM)"), _T("OPN (PSG)"), _T("Beep"), _T("Noise (FDD)"),
57 };
58 #endif
59
60 class csp_state_utils;
61 class EMU;
62 class DEVICE;
63 class EVENT;
64
65 class I8253;
66 class I8255;
67 class I8259;
68 class I286;
69 class IO;
70 class MB8877;
71 class NOT;
72 class PCM1BIT;
73 class RP5C01;
74 class SASI_HDD;
75 class SCSI_HOST;
76 class UPD71071;
77 class YM2203;
78 class Z80PIO;
79 class Z80SIO;
80
81 class CRTC;
82 class FLOPPY;
83 class JOYSTICK;
84 class KEYBOARD;
85 class MZ2800_MEMORY;
86 class MOUSE;
87 class PRINTER;
88 class RESET;
89 class SASI;
90 class SERIAL;
91 class SYSPORT;
92
93 class VM : public VM_TEMPLATE
94 {
95 protected:
96         //EMU* emu;
97         //csp_state_utils *state_entry;
98         
99         // devices
100         //EVENT* event;
101         
102         I8253* pit;
103         I8255* pio0;
104         I8259* pic;
105         I286* cpu;
106         IO* io;
107         MB8877* fdc;
108         NOT* not_busy;
109         PCM1BIT* pcm;
110         RP5C01* rtc;
111         SASI_HDD* sasi_hdd[4];
112         SCSI_HOST* sasi_host;
113         UPD71071* dma;
114         YM2203* opn;
115         Z80PIO* pio1;
116         Z80SIO* sio;
117         
118         CRTC* crtc;
119         FLOPPY* floppy;
120         JOYSTICK* joystick;
121         KEYBOARD* keyboard;
122         MZ2800_MEMORY* memory;
123         MOUSE* mouse;
124         PRINTER* printer;
125         RESET* rst;
126         SASI* sasi;
127         SERIAL* serial;
128         SYSPORT* sysport;
129         
130 public:
131         // ----------------------------------------
132         // initialize
133         // ----------------------------------------
134         
135         VM(EMU* parent_emu);
136         ~VM();
137         
138         // ----------------------------------------
139         // for emulation class
140         // ----------------------------------------
141         
142         // drive virtual machine
143         void reset();
144         void cpu_reset();
145         void run();
146         
147 #ifdef USE_DEBUGGER
148         // debugger
149         DEVICE *get_cpu(int index);
150 #endif
151         
152         // draw screen
153         void draw_screen();
154         
155         // sound generation
156         void initialize_sound(int rate, int samples);
157         uint16_t* create_sound(int* extra_frames);
158         int get_sound_buffer_ptr();
159 #ifdef USE_SOUND_VOLUME
160         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
161 #endif
162         
163         // user interface
164         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
165         void close_floppy_disk(int drv);
166         bool is_floppy_disk_inserted(int drv);
167         void is_floppy_disk_protected(int drv, bool value);
168         bool is_floppy_disk_protected(int drv);
169         uint32_t is_floppy_disk_accessed();
170         void open_hard_disk(int drv, const _TCHAR* file_path);
171         void close_hard_disk(int drv);
172         bool is_hard_disk_inserted(int drv);
173         uint32_t is_hard_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