OSDN Git Service

89e7ae91a266809e6861746982904269c8338034
[csp-qt/common_source_project-fm7.git] / source / src / vm / qc10 / qc10.h
1 /*
2         EPSON QC-10 Emulator 'eQC-10'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.02.13 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _QC10_H_
11 #define _QC10_H_
12
13 #ifdef _COLOR_MONITOR
14 #define DEVICE_NAME             "EPSON QC-10 with color monitor subboard"
15 #define CONFIG_NAME             "qc10cms"
16 #else
17 #define DEVICE_NAME             "EPSON QC-10"
18 #define CONFIG_NAME             "qc10"
19 #endif
20
21 // device informations for virtual machine
22 #ifdef _COLOR_MONITOR
23 #define FRAMES_PER_SEC          56.92
24 #define LINES_PER_FRAME         441
25 #define UPD7220_HORIZ_FREQ      25100
26 #else
27 #define FRAMES_PER_SEC          45.84
28 #define LINES_PER_FRAME         421
29 #define UPD7220_HORIZ_FREQ      19300
30 #endif
31 #define CPU_CLOCKS              3993600
32 #define SCREEN_WIDTH            640
33 #define SCREEN_HEIGHT           400
34 #define WINDOW_HEIGHT_ASPECT    480
35 #define MAX_DRIVE               4
36 #define I8259_MAX_CHIPS         2
37 #define HAS_UPD7201
38 #define UPD7220_FIXED_PITCH
39 #define UPD765A_DMA_MODE
40 //#define SINGLE_MODE_DMA
41 #define SUPPORT_VARIABLE_TIMING
42
43 // device informations for win32
44 #define USE_DIPSWITCH
45 #define DIPSWITCH_DEFAULT       0x1f
46 #define USE_FLOPPY_DISK         2
47 #define NOTIFY_KEY_DOWN
48 #define USE_SHIFT_NUMPAD_KEY
49 #define USE_ALT_F10_KEY
50 #ifdef _COLOR_MONITOR
51 #define USE_SCREEN_FILTER
52 #endif
53 #define USE_SOUND_VOLUME        2
54 #define USE_DEBUGGER
55 #define USE_STATE
56 #define USE_CPU_Z80
57
58 #include "../../common.h"
59 #include "../../fileio.h"
60 #include "../vm_template.h"
61
62 #ifdef USE_SOUND_VOLUME
63 static const _TCHAR *sound_device_caption[] = {
64         _T("Beep"), _T("Noise (FDD)"),
65 };
66 #endif
67
68 class csp_state_utils;
69
70 class EMU;
71 class DEVICE;
72 class EVENT;
73
74 class HD146818P;
75 class I8237;
76 class I8253;
77 class I8255;
78 class I8259;
79 class IO;
80 class PCM1BIT;
81 class UPD7220;
82 class UPD765A;
83 class Z80;
84 class Z80SIO;
85
86 class DISPLAY;
87 class FLOPPY;
88 class KEYBOARD;
89 class MEMORY;
90 class MFONT;
91
92 class VM : public VM_TEMPLATE
93 {
94 protected:
95         //EMU* emu;
96         //csp_state_utils* state_entry;
97         
98         // devices
99         //EVENT* event;
100         
101         HD146818P* rtc;
102         I8237* dma0;
103         I8237* dma1;
104         I8253* pit0;
105         I8253* pit1;
106         I8255* pio;
107         I8259* pic;     // includes 2chips
108         IO* io;
109         PCM1BIT* pcm;
110         UPD7220* gdc;
111         UPD765A* fdc;
112         Z80* cpu;
113         Z80SIO* sio;
114         
115         DISPLAY* display;
116         FLOPPY* floppy;
117         KEYBOARD* keyboard;
118         MEMORY* memory;
119         MFONT* mfont;
120         
121 public:
122         // ----------------------------------------
123         // initialize
124         // ----------------------------------------
125         
126         VM(EMU* parent_emu);
127         ~VM();
128         
129         // ----------------------------------------
130         // for emulation class
131         // ----------------------------------------
132         
133         // drive virtual machine
134         void reset();
135         void run();
136         double get_frame_rate();
137         
138 #ifdef USE_DEBUGGER
139         // debugger
140         DEVICE *get_cpu(int index);
141 #endif
142         
143         // draw screen
144         void draw_screen();
145         
146         // sound generation
147         void initialize_sound(int rate, int samples);
148         uint16_t* create_sound(int* extra_frames);
149         int get_sound_buffer_ptr();
150 #ifdef USE_SOUND_VOLUME
151         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
152 #endif
153         
154         // notify key
155         void key_down(int code, bool repeat);
156         void key_up(int code);
157         
158         // user interface
159         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
160         void close_floppy_disk(int drv);
161         bool is_floppy_disk_inserted(int drv);
162         void is_floppy_disk_protected(int drv, bool value);
163         bool is_floppy_disk_protected(int drv);
164         uint32_t is_floppy_disk_accessed();
165         bool is_frame_skippable();
166         
167         void update_config();
168         void decl_state();
169         void save_state(FILEIO* state_fio);
170         bool load_state(FILEIO* state_fio);
171         
172         // ----------------------------------------
173         // for each device
174         // ----------------------------------------
175         
176         // devices
177         DEVICE* get_device(int id);
178         //DEVICE* dummy;
179         //DEVICE* first_device;
180         //DEVICE* last_device;
181 };
182
183 #endif