OSDN Git Service

[VM][STATE] Apply statesub.h to VM::foo_state() with remained VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc98ha / pc98ha.h
1 /*
2         NEC PC-98LT Emulator 'ePC-98LT'
3         NEC PC-98HA Emulator 'eHANDY98'
4
5         Author : Takeda.Toshiya
6         Date   : 2008.06.09 -
7
8         [ virtual machine ]
9 */
10
11 #ifndef _PC98HA_H_
12 #define _PC98HA_H_
13
14 #ifdef _PC98HA
15 #define DEVICE_NAME             "NEC PC-98HA"
16 #define CONFIG_NAME             "pc98ha"
17 #else
18 #define DEVICE_NAME             "NEC PC-98LT"
19 #define CONFIG_NAME             "pc98lt"
20 #endif
21
22 // device informations for virtual machine
23 #define FRAMES_PER_SEC          56.4
24 #define LINES_PER_FRAME         440
25 #ifdef _PC98HA
26 #define CPU_CLOCKS              10000000
27 #else
28 #define CPU_CLOCKS              8000000
29 #endif
30 #define SCREEN_WIDTH            640
31 #define SCREEN_HEIGHT           400
32 #define MAX_DRIVE               1
33 #define HAS_V30
34 #define I86_PSEUDO_BIOS
35 #define I8259_MAX_CHIPS         1
36 //#define UPD765A_DMA_MODE
37 //#define SINGLE_MODE_DMA
38 #define IO_ADDR_MAX             0x10000
39 #define IOBUS_RETURN_ADDR
40 #ifdef _PC98HA
41 //#define DOCKING_STATION
42 #endif
43
44 // device informations for win32
45 #define USE_FLOPPY_DISK         1
46 #define NOTIFY_KEY_DOWN
47 #define USE_KEY_LOCKED
48 #define USE_SHIFT_NUMPAD_KEY
49 #define USE_ALT_F10_KEY
50 #define USE_AUTO_KEY            5
51 #define USE_AUTO_KEY_RELEASE    6
52 #define USE_AUTO_KEY_NUMPAD
53 #define USE_SOUND_VOLUME        2
54 #define USE_PRINTER
55 #define USE_PRINTER_TYPE        3
56 #define USE_DEBUGGER
57 #define USE_STATE
58 #define USE_CPU_I286
59
60 #include "../../common.h"
61 #include "../../fileio.h"
62
63 #ifdef USE_SOUND_VOLUME
64 static const _TCHAR *sound_device_caption[] = {
65         _T("Beep"), _T("Noise (FDD)"),
66 };
67 #endif
68
69 class csp_state_utils;
70
71 class EMU;
72 class DEVICE;
73 class EVENT;
74
75 class BEEP;
76 class I8251;
77 class I8253;
78 class I8255;
79 class I8259;
80 //#if defined(HAS_V30) || defined(HAS_I86)
81 //class I86;
82 //#else
83 class I286;
84 //#endif
85 class IO;
86 class NOT;
87 #ifdef _PC98HA
88 class UPD4991A;
89 #else
90 class UPD1990A;
91 #endif
92 class UPD71071;
93 class UPD765A;
94
95 class BIOS;
96 class CALENDAR;
97 class FLOPPY;
98 class KEYBOARD;
99 class MEMORY;
100 class NOTE;
101
102 class VM
103 {
104 protected:
105         EMU* emu;
106         csp_state_utils *state_entry;
107         
108         // devices
109         EVENT* event;
110         
111         BEEP* beep;
112         DEVICE* printer;
113         I8251* sio_rs;
114         I8251* sio_kbd;
115         I8253* pit;
116         I8255* pio_sys;
117         I8255* pio_prn;
118         I8259* pic;
119 //#if defined(HAS_V30) || defined(HAS_I86)
120 //      I86* cpu;
121 //#else
122         I286* cpu;
123 //#endif
124         IO* io;
125         NOT* not_busy;
126 #ifdef _PC98HA
127         UPD4991A* rtc;
128 #else
129         UPD1990A* rtc;
130 #endif
131         UPD71071* dma;
132         UPD765A* fdc;
133         
134         BIOS* bios;
135         CALENDAR* calendar;
136         FLOPPY* floppy;
137         KEYBOARD* keyboard;
138         MEMORY* memory;
139         NOTE* note;
140         
141 public:
142         // ----------------------------------------
143         // initialize
144         // ----------------------------------------
145         
146         VM(EMU* parent_emu);
147         ~VM();
148         
149         // ----------------------------------------
150         // for emulation class
151         // ----------------------------------------
152         
153         // drive virtual machine
154         void reset();
155         void run();
156         
157 #ifdef USE_DEBUGGER
158         // debugger
159         DEVICE *get_cpu(int index);
160 #endif
161         
162         // draw screen
163         void draw_screen();
164         
165         // sound generation
166         void initialize_sound(int rate, int samples);
167         uint16_t* create_sound(int* extra_frames);
168         int get_sound_buffer_ptr();
169 #ifdef USE_SOUND_VOLUME
170         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
171 #endif
172         
173         // notify key
174         void key_down(int code, bool repeat);
175         void key_up(int code);
176         bool get_caps_locked();
177         bool get_kana_locked();
178         
179         // user interface
180         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
181         void close_floppy_disk(int drv);
182         bool is_floppy_disk_inserted(int drv);
183         void is_floppy_disk_protected(int drv, bool value);
184         bool is_floppy_disk_protected(int drv);
185         uint32_t is_floppy_disk_accessed();
186         bool is_frame_skippable();
187         
188         void update_config();
189         void decl_state();
190         void save_state(FILEIO* state_fio);
191         bool load_state(FILEIO* state_fio);
192         
193         // ----------------------------------------
194         // for each device
195         // ----------------------------------------
196         
197         // devices
198         DEVICE* get_device(int id);
199         DEVICE* dummy;
200         DEVICE* first_device;
201         DEVICE* last_device;
202 };
203
204 #endif