OSDN Git Service

[VM] Remove define value for before commit.
[csp-qt/common_source_project-fm7.git] / source / src / vm / fp1100 / fp1100.h
1 /*
2         CASIO FP-1100 Emulator 'eFP-1100'
3
4         Author : Takeda.Toshiya
5         Date   : 2010.06.18-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _FP1100_H_
11 #define _FP1100_H_
12
13 #define DEVICE_NAME             "CASIO FP-1100"
14 #define CONFIG_NAME             "fp1100"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          59.77
18 #define LINES_PER_FRAME         261
19 #define CHARS_PER_LINE          128
20 #define HD46505_CHAR_CLOCK      998400
21 #define CPU_CLOCKS              3993600
22 #define SUB_CPU_CLOCKS          1996800
23 //#define Z80_MEMORY_WAIT
24 #define Z80_IO_WAIT
25 #define SCREEN_WIDTH            640
26 #define SCREEN_HEIGHT           400
27 #define WINDOW_HEIGHT_ASPECT    480
28 #define MAX_DRIVE               4
29 #define SUPPORT_VARIABLE_TIMING
30
31 // device informations for win32
32 #define SUPPORT_TV_RENDER
33 #define USE_TAPE1
34 #define USE_TAPE_BAUD
35 #define USE_FD1
36 #define USE_FD2
37 //#define USE_FD3
38 //#define USE_FD4
39
40 #define NOTIFY_KEY_DOWN
41 #define USE_SHIFT_NUMPAD_KEY
42 #define USE_ALT_F10_KEY
43 #define USE_AUTO_KEY_SHIFT      2
44 #define USE_AUTO_KEY            5
45 #define USE_AUTO_KEY_RELEASE    6
46 #define USE_AUTO_KEY_CAPS
47 #define USE_AUTO_KEY_NUMPAD
48 #define USE_SCREEN_FILTER
49 #define USE_SCANLINE
50 #define USE_SOUND_VOLUME        4
51 #define USE_DEBUGGER
52 #define USE_STATE
53
54 #include "../../common.h"
55 #include "../../fileio.h"
56
57 #ifdef USE_SOUND_VOLUME
58 static const _TCHAR *sound_device_caption[] = {
59         _T("Beep"), _T("CMT (Signal)"), _T("Noise (FDD)"), _T("Noise (CMT)"),
60 };
61 #endif
62
63 class EMU;
64 class DEVICE;
65 class EVENT;
66
67 class BEEP;
68 class DATAREC;
69 class HD46505;
70 class UPD765A;
71 class UPD7801;
72 class Z80;
73
74 class MAIN;
75 class SUB;
76 class FDCPACK;
77 class RAMPACK;
78 class ROMPACK;
79
80 class VM
81 {
82 protected:
83         EMU* emu;
84         
85         // devices
86         EVENT* event;
87         
88         BEEP* beep;
89         DATAREC* drec;
90         HD46505* crtc;
91         UPD765A* fdc;
92         UPD7801* subcpu;
93         Z80* maincpu;
94         
95         MAIN* mainbus;
96         SUB* subbus;
97         FDCPACK* fdcpack;
98         RAMPACK* rampack1;
99         RAMPACK* rampack2;
100         RAMPACK* rampack3;
101         RAMPACK* rampack4;
102         RAMPACK* rampack5;
103         RAMPACK* rampack6;
104         ROMPACK* rompack;
105         
106 public:
107         // ----------------------------------------
108         // initialize
109         // ----------------------------------------
110         
111         VM(EMU* parent_emu);
112         ~VM();
113         
114         // ----------------------------------------
115         // for emulation class
116         // ----------------------------------------
117         
118         // drive virtual machine
119         void reset();
120         void run();
121         double get_frame_rate();
122         
123 #ifdef USE_DEBUGGER
124         // debugger
125         DEVICE *get_cpu(int index);
126 #endif
127         
128         // draw screen
129         void draw_screen();
130         
131         // sound generation
132         void initialize_sound(int rate, int samples);
133         uint16_t* create_sound(int* extra_frames);
134         int get_sound_buffer_ptr();
135 #ifdef USE_SOUND_VOLUME
136         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
137 #endif
138         
139         // notify key
140         void key_down(int code, bool repeat);
141         void key_up(int code);
142         
143         // user interface
144         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
145         void close_floppy_disk(int drv);
146         bool is_floppy_disk_inserted(int drv);
147         void is_floppy_disk_protected(int drv, bool value);
148         bool is_floppy_disk_protected(int drv);
149         uint32_t is_floppy_disk_accessed();
150         void play_tape(int drv, const _TCHAR* file_path);
151         void rec_tape(int drv, const _TCHAR* file_path);
152         void close_tape(int drv);
153         bool is_tape_inserted(int drv);
154         bool is_tape_playing(int drv);
155         bool is_tape_recording(int drv);
156         int get_tape_position(int drv);
157         const _TCHAR* get_tape_message(int drv);
158         bool is_frame_skippable();
159         
160         void update_config();
161         void save_state(FILEIO* state_fio);
162         bool load_state(FILEIO* state_fio);
163         
164         // ----------------------------------------
165         // for each device
166         // ----------------------------------------
167         
168         // devices
169         DEVICE* get_device(int id);
170         DEVICE* dummy;
171         DEVICE* first_device;
172         DEVICE* last_device;
173 };
174
175 #endif