OSDN Git Service

[VM][STATE] Apply new framework to some 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 class CRTC;
80 class IOCTRL;
81 class KANJI;
82
83 class VM : public VM_TEMPLATE
84 {
85 protected:
86         //EMU* emu;
87         //csp_state_utils *state_entry;
88         
89         // devices
90         //EVENT* event;
91         
92         AND* and_drq;
93         BEEP* beep;
94         I8251* sio;
95         I8255* pio0;
96         I8255* pio1;
97         I8259* pic;     // includes 2chips
98         I286* cpu;
99         IO* io;
100         MEMORY* memory;
101         MSM58321* rtc;
102         PCM1BIT* pcm;
103         UPD765A* fdc;
104         
105         CRTC* crtc;
106         IOCTRL* ioctrl;
107         KANJI* kanji;
108         
109         // memory
110         uint8_t ram[0xc0000];   // Main RAM 768KB
111         uint8_t ipl[0x8000];    // IPL 32KB
112         
113 public:
114         // ----------------------------------------
115         // initialize
116         // ----------------------------------------
117         
118         VM(EMU* parent_emu);
119         ~VM();
120         
121         // ----------------------------------------
122         // for emulation class
123         // ----------------------------------------
124         
125         // drive virtual machine
126         void reset();
127         void run();
128         
129 #ifdef USE_DEBUGGER
130         // debugger
131         DEVICE *get_cpu(int index);
132 #endif
133         
134         // draw screen
135         void draw_screen();
136         
137         // sound generation
138         void initialize_sound(int rate, int samples);
139         uint16_t* create_sound(int* extra_frames);
140         int get_sound_buffer_ptr();
141 #ifdef USE_SOUND_VOLUME
142         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
143 #endif
144         
145         // notify key
146         void key_down(int code, bool repeat);
147         void key_up(int code);
148         bool get_caps_locked();
149         bool get_kana_locked();
150         
151         // user interface
152         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
153         void close_floppy_disk(int drv);
154         bool is_floppy_disk_inserted(int drv);
155         void is_floppy_disk_protected(int drv, bool value);
156         bool is_floppy_disk_protected(int drv);
157         uint32_t is_floppy_disk_accessed();
158         bool is_frame_skippable();
159         
160         void update_config();
161         bool process_state(FILEIO* state_fio, bool loading);
162         
163         // ----------------------------------------
164         // for each device
165         // ----------------------------------------
166         
167         // devices
168         DEVICE* get_device(int id);
169         //DEVICE* dummy;
170         //DEVICE* first_device;
171         //DEVICE* last_device;
172 };
173
174 #endif