OSDN Git Service

[VM][Qt] Add FM16PI.
[csp-qt/common_source_project-fm7.git] / source / src / vm / fm16pi / fm16pi.h
1 /*
2         FUJITSU FM16pi Emulator 'eFM16pi'
3
4         Author : Takeda.Toshiya
5         Date   : 2010.12.25-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _FM16PI_H_
11 #define _FM16PI_H_
12
13 #define DEVICE_NAME             "FUJITSU FM16pi"
14 #define CONFIG_NAME             "fm16pi"
15
16 // device informations for virtual machine
17
18 // TODO: check refresh rate
19 #define FRAMES_PER_SEC          60
20 #define LINES_PER_FRAME         220
21 #define CPU_CLOCKS              4915200
22 #define SCREEN_WIDTH            640
23 #define SCREEN_HEIGHT           200
24 #define MAX_DRIVE               4
25 #define HAS_I86
26 #define I8259_MAX_CHIPS         1
27 #define MEMORY_ADDR_MAX         0x100000
28 #define MEMORY_BANK_SIZE        0x4000
29 #define IO_ADDR_MAX             0x10000
30
31 // device informations for win32
32 #define USE_FD1
33 #define USE_FD2
34 #define NOTIFY_KEY_DOWN
35 #define USE_ALT_F10_KEY
36 #define USE_AUTO_KEY            5
37 #define USE_AUTO_KEY_RELEASE    6
38 #define USE_POWER_OFF
39 #define USE_ACCESS_LAMP
40 #define USE_DEBUGGER
41 #define USE_STATE
42
43 #include "../../common.h"
44 #include "../../fileio.h"
45
46 class EMU;
47 class DEVICE;
48 class EVENT;
49
50 class I8251;
51 class I8253;
52 class I8255;
53 class I8259;
54 class I286;
55 class IO;
56 class MB8877;
57 class MEMORY;
58 class MSM58321;
59 class NOT;
60 class PCM1BIT;
61
62 class SUB;
63
64 class VM
65 {
66 protected:
67         EMU* emu;
68         
69         // devices
70         EVENT* event;
71         
72         I8251* sio;
73         I8253* pit;
74         I8255* pio;
75         I8259* pic;
76         I286* cpu;
77         IO* io;
78         MB8877* fdc;
79         MEMORY* memory;
80         MSM58321* rtc;
81         NOT* d_not;
82         PCM1BIT* pcm;
83         
84         SUB* sub;
85         
86         // memory
87         uint8 ram[0x80000];
88         uint8 kanji[0x40000];
89         uint8 cart[0x40000];
90         
91 public:
92         // ----------------------------------------
93         // initialize
94         // ----------------------------------------
95         
96         VM(EMU* parent_emu);
97         ~VM();
98         
99         // ----------------------------------------
100         // for emulation class
101         // ----------------------------------------
102         
103         // drive virtual machine
104         void reset();
105         void notify_power_off();
106         void run();
107         
108 #ifdef USE_DEBUGGER
109         // debugger
110         DEVICE *get_cpu(int index);
111 #endif
112         
113         // draw screen
114         void draw_screen();
115         int access_lamp();
116         
117         // sound generation
118         void initialize_sound(int rate, int samples);
119         uint16* create_sound(int* extra_frames);
120         int sound_buffer_ptr();
121         
122         // notify key
123         void key_down(int code, bool repeat);
124         void key_up(int code);
125         
126         // user interface
127         void open_disk(int drv, _TCHAR* file_path, int bank);
128         void close_disk(int drv);
129         bool disk_inserted(int drv);
130         bool now_skip();
131         
132         void update_config();
133         void save_state(FILEIO* state_fio);
134         bool load_state(FILEIO* state_fio);
135         
136         // ----------------------------------------
137         // for each device
138         // ----------------------------------------
139         
140         // devices
141         DEVICE* get_device(int id);
142         DEVICE* dummy;
143         DEVICE* first_device;
144         DEVICE* last_device;
145 };
146
147 #endif