OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[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_DRIVE_TYPE          2
36 #define USE_FLOPPY_DISK         2
37 #define NOTIFY_KEY_DOWN
38 #define USE_KEY_LOCKED
39 #define USE_SHIFT_NUMPAD_KEY
40 #define USE_ALT_F10_KEY
41 #define USE_AUTO_KEY            5
42 #define USE_AUTO_KEY_RELEASE    6
43 #define USE_AUTO_KEY_NUMPAD
44 #define USE_MONITOR_TYPE        2
45 #define USE_SCREEN_FILTER
46 #define USE_SOUND_VOLUME        3
47 #define USE_MOUSE
48 #define USE_DEBUGGER
49 #define USE_STATE
50 #define USE_CPU_I286
51
52 #include "../../common.h"
53 #include "../../fileio.h"
54 #include "../vm_template.h"
55
56 #ifdef USE_SOUND_VOLUME
57 static const _TCHAR *sound_device_caption[] = {
58         _T("Beep #1"), _T("Beep #2"), _T("Noise (FDD)"),
59 };
60 #endif
61
62 class csp_state_utils;
63 class EMU;
64 class DEVICE;
65 class EVENT;
66
67 class AND;
68 class BEEP;
69 class I8251;
70 class I8255;
71 class I8259;
72 class I286;
73 class IO;
74 class MEMORY;
75 class MSM58321;
76 class PCM1BIT;
77 class UPD765A;
78
79 namespace PC100 {
80         class CRTC;
81         class IOCTRL;
82         class KANJI;
83 }
84
85 class VM : public VM_TEMPLATE
86 {
87 protected:
88         //EMU* emu;
89         //csp_state_utils *state_entry;
90         
91         // devices
92         //EVENT* event;
93         
94         AND* and_drq;
95         BEEP* beep;
96         I8251* sio;
97         I8255* pio0;
98         I8255* pio1;
99         I8259* pic;     // includes 2chips
100         I286* cpu;
101         IO* io;
102         MEMORY* memory;
103         MSM58321* rtc;
104         PCM1BIT* pcm;
105         UPD765A* fdc;
106         
107         PC100::CRTC* crtc;
108         PC100::IOCTRL* ioctrl;
109         PC100::KANJI* kanji;
110         
111         // memory
112         uint8_t ram[0xc0000];   // Main RAM 768KB
113         uint8_t ipl[0x8000];    // IPL 32KB
114         
115 public:
116         // ----------------------------------------
117         // initialize
118         // ----------------------------------------
119         
120         VM(EMU* parent_emu);
121         ~VM();
122         
123         // ----------------------------------------
124         // for emulation class
125         // ----------------------------------------
126         
127         // drive virtual machine
128         void reset();
129         void run();
130         
131 #ifdef USE_DEBUGGER
132         // debugger
133         DEVICE *get_cpu(int index);
134 #endif
135         
136         // draw screen
137         void draw_screen();
138         
139         // sound generation
140         void initialize_sound(int rate, int samples);
141         uint16_t* create_sound(int* extra_frames);
142         int get_sound_buffer_ptr();
143 #ifdef USE_SOUND_VOLUME
144         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
145 #endif
146         
147         // notify key
148         void key_down(int code, bool repeat);
149         void key_up(int code);
150         bool get_caps_locked();
151         bool get_kana_locked();
152         
153         // user interface
154         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
155         void close_floppy_disk(int drv);
156         bool is_floppy_disk_inserted(int drv);
157         void is_floppy_disk_protected(int drv, bool value);
158         bool is_floppy_disk_protected(int drv);
159         uint32_t is_floppy_disk_accessed();
160         bool is_frame_skippable();
161         
162         void update_config();
163         bool process_state(FILEIO* state_fio, bool loading);
164         
165         // ----------------------------------------
166         // for each device
167         // ----------------------------------------
168         
169         // devices
170         DEVICE* get_device(int id);
171         //DEVICE* dummy;
172         //DEVICE* first_device;
173         //DEVICE* last_device;
174 };
175
176 #endif