OSDN Git Service

Merge branch 'master' of github.com:Artanejp/common_source_project-fm7
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc100 / pc100.h
1 /*
2         NEC PC-100 Emulator 'ePC-100'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.07.12 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PC100_H_
11 #define _PC100_H_
12
13 #define DEVICE_NAME             "NEC PC-100"
14 #define CONFIG_NAME             "pc100"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          55.4
18 #define LINES_PER_FRAME         544
19 #define CPU_CLOCKS              6988800
20 #define SCREEN_WIDTH            720
21 #define SCREEN_HEIGHT           512
22 #define WINDOW_HEIGHT_ASPECT    540
23 //720
24 #define MAX_DRIVE               4
25 #define HAS_I86
26 #define I8259_MAX_CHIPS         1
27 #define MSM58321_START_DAY      -9
28 #define MSM58321_START_YEAR     1980
29 #define UPD765A_NO_ST0_AT_FOR_SEEK
30 #define MEMORY_ADDR_MAX         0x100000
31 #define MEMORY_BANK_SIZE        0x8000
32 #define IO_ADDR_MAX             0x10000
33
34 // device informations for win32
35 #define USE_FD1
36 #define USE_FD2
37 #define NOTIFY_KEY_DOWN
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_MONITOR_TYPE        2
43 #define USE_CRT_FILTER
44 #define USE_SCREEN_ROTATE
45 #define USE_ACCESS_LAMP
46 #define USE_SOUND_FILES 2
47 #define USE_SOUND_FILES_FDD
48 #if defined(USE_SOUND_FILES)
49 #define USE_SOUND_VOLUME        3
50 #else
51 #define USE_SOUND_VOLUME        2
52 #endif
53 #define USE_MOUSE
54 #define USE_DEBUGGER
55 #define USE_STATE
56
57 #include "../../common.h"
58 #include "../../fileio.h"
59
60 #ifdef USE_SOUND_VOLUME
61 static const _TCHAR *sound_device_caption[] = {
62         _T("Beep #1"), _T("Beep #2"),
63 #if defined(USE_SOUND_FILES)
64         _T("FDD SEEK"),
65 #endif
66 };
67 #endif
68
69 class EMU;
70 class DEVICE;
71 class EVENT;
72
73 class AND;
74 class BEEP;
75 class I8251;
76 class I8255;
77 class I8259;
78 class I86;
79 class IO;
80 class MEMORY;
81 class MSM58321;
82 class PCM1BIT;
83 class UPD765A;
84
85 class CRTC;
86 class IOCTRL;
87 class KANJI;
88
89 class VM
90 {
91 protected:
92         EMU* emu;
93         
94         // devices
95         EVENT* event;
96         
97         AND* and_drq;
98         BEEP* beep;
99         I8251* sio;
100         I8255* pio0;
101         I8255* pio1;
102         I8259* pic;     // includes 2chips
103         I86* cpu;
104         IO* io;
105         MEMORY* memory;
106         MSM58321* rtc;
107         PCM1BIT* pcm;
108         UPD765A* fdc;
109         
110         CRTC* crtc;
111         IOCTRL* ioctrl;
112         KANJI* kanji;
113         
114         // memory
115         uint8_t ram[0xc0000];   // Main RAM 768KB
116         uint8_t ipl[0x8000];    // IPL 32KB
117         
118 public:
119         // ----------------------------------------
120         // initialize
121         // ----------------------------------------
122         
123         VM(EMU* parent_emu);
124         ~VM();
125         
126         // ----------------------------------------
127         // for emulation class
128         // ----------------------------------------
129         
130         // drive virtual machine
131         void reset();
132         void run();
133         
134 #ifdef USE_DEBUGGER
135         // debugger
136         DEVICE *get_cpu(int index);
137 #endif
138         
139         // draw screen
140         void draw_screen();
141         uint32_t get_access_lamp_status();
142         
143         // sound generation
144         void initialize_sound(int rate, int samples);
145         uint16_t* create_sound(int* extra_frames);
146         int get_sound_buffer_ptr();
147 #ifdef USE_SOUND_VOLUME
148         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
149 #endif
150         
151         // notify key
152         void key_down(int code, bool repeat);
153         void key_up(int code);
154         
155         // user interface
156         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
157         void close_floppy_disk(int drv);
158         bool is_floppy_disk_inserted(int drv);
159         void is_floppy_disk_protected(int drv, bool value);
160         bool is_floppy_disk_protected(int drv);
161         bool is_frame_skippable();
162         
163         void update_config();
164         void save_state(FILEIO* state_fio);
165         bool load_state(FILEIO* state_fio);
166         
167         // ----------------------------------------
168         // for each device
169         // ----------------------------------------
170         
171         // devices
172         DEVICE* get_device(int id);
173         DEVICE* dummy;
174         DEVICE* first_device;
175         DEVICE* last_device;
176 };
177
178 #endif