OSDN Git Service

[VM][STATE][WIP] Apply csp_state_utils:: to some VMs.This is WIP.
[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
55 #ifdef USE_SOUND_VOLUME
56 static const _TCHAR *sound_device_caption[] = {
57         _T("Beep #1"), _T("Beep #2"), _T("Noise (FDD)"),
58 };
59 #endif
60
61 class csp_state_utils;
62 class EMU;
63 class DEVICE;
64 class EVENT;
65
66 class AND;
67 class BEEP;
68 class I8251;
69 class I8255;
70 class I8259;
71 class I286;
72 class IO;
73 class MEMORY;
74 class MSM58321;
75 class PCM1BIT;
76 class UPD765A;
77
78 class CRTC;
79 class IOCTRL;
80 class KANJI;
81
82 class VM
83 {
84 protected:
85         EMU* emu;
86         csp_state_utils *state_entry;
87         
88         // devices
89         EVENT* event;
90         
91         AND* and_drq;
92         BEEP* beep;
93         I8251* sio;
94         I8255* pio0;
95         I8255* pio1;
96         I8259* pic;     // includes 2chips
97         I286* cpu;
98         IO* io;
99         MEMORY* memory;
100         MSM58321* rtc;
101         PCM1BIT* pcm;
102         UPD765A* fdc;
103         
104         CRTC* crtc;
105         IOCTRL* ioctrl;
106         KANJI* kanji;
107         
108         // memory
109         uint8_t ram[0xc0000];   // Main RAM 768KB
110         uint8_t ipl[0x8000];    // IPL 32KB
111         
112 public:
113         // ----------------------------------------
114         // initialize
115         // ----------------------------------------
116         
117         VM(EMU* parent_emu);
118         ~VM();
119         
120         // ----------------------------------------
121         // for emulation class
122         // ----------------------------------------
123         
124         // drive virtual machine
125         void reset();
126         void run();
127         
128 #ifdef USE_DEBUGGER
129         // debugger
130         DEVICE *get_cpu(int index);
131 #endif
132         
133         // draw screen
134         void draw_screen();
135         
136         // sound generation
137         void initialize_sound(int rate, int samples);
138         uint16_t* create_sound(int* extra_frames);
139         int get_sound_buffer_ptr();
140 #ifdef USE_SOUND_VOLUME
141         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
142 #endif
143         
144         // notify key
145         void key_down(int code, bool repeat);
146         void key_up(int code);
147         bool get_caps_locked();
148         bool get_kana_locked();
149         
150         // user interface
151         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
152         void close_floppy_disk(int drv);
153         bool is_floppy_disk_inserted(int drv);
154         void is_floppy_disk_protected(int drv, bool value);
155         bool is_floppy_disk_protected(int drv);
156         uint32_t is_floppy_disk_accessed();
157         bool is_frame_skippable();
158         
159         void update_config();
160         void decl_state();
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