OSDN Git Service

ddbeeb40b285a80b7778f281e93314e10f11a806
[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 #include "../vm_template.h"
63
64 #ifdef USE_SOUND_VOLUME
65 static const _TCHAR *sound_device_caption[] = {
66         _T("Beep"), _T("Noise (FDD)"),
67 };
68 #endif
69
70 class csp_state_utils;
71
72 class EMU;
73 class DEVICE;
74 class EVENT;
75
76 class BEEP;
77 class I8251;
78 class I8253;
79 class I8255;
80 class I8259;
81 //#if defined(HAS_V30) || defined(HAS_I86)
82 //class I86;
83 //#else
84 class I286;
85 //#endif
86 class IO;
87 class NOT;
88 #ifdef _PC98HA
89 class UPD4991A;
90 #else
91 class UPD1990A;
92 #endif
93 class UPD71071;
94 class UPD765A;
95
96 class BIOS;
97 class CALENDAR;
98 class FLOPPY;
99 class KEYBOARD;
100 class PC98LT_MEMORY;
101 class NOTE;
102
103 class VM : public VM_TEMPLATE
104 {
105 protected:
106         //EMU* emu;
107         //csp_state_utils *state_entry;
108         
109         // devices
110         //EVENT* event;
111         
112         BEEP* beep;
113         DEVICE* printer;
114         I8251* sio_rs;
115         I8251* sio_kbd;
116         I8253* pit;
117         I8255* pio_sys;
118         I8255* pio_prn;
119         I8259* pic;
120 //#if defined(HAS_V30) || defined(HAS_I86)
121 //      I86* cpu;
122 //#else
123         I286* cpu;
124 //#endif
125         IO* io;
126         NOT* not_busy;
127 #ifdef _PC98HA
128         UPD4991A* rtc;
129 #else
130         UPD1990A* rtc;
131 #endif
132         UPD71071* dma;
133         UPD765A* fdc;
134         
135         BIOS* bios;
136         CALENDAR* calendar;
137         FLOPPY* floppy;
138         KEYBOARD* keyboard;
139         PC98LT_MEMORY* memory;
140         NOTE* note;
141         
142 public:
143         // ----------------------------------------
144         // initialize
145         // ----------------------------------------
146         
147         VM(EMU* parent_emu);
148         ~VM();
149         
150         // ----------------------------------------
151         // for emulation class
152         // ----------------------------------------
153         
154         // drive virtual machine
155         void reset();
156         void run();
157         
158 #ifdef USE_DEBUGGER
159         // debugger
160         DEVICE *get_cpu(int index);
161 #endif
162         
163         // draw screen
164         void draw_screen();
165         
166         // sound generation
167         void initialize_sound(int rate, int samples);
168         uint16_t* create_sound(int* extra_frames);
169         int get_sound_buffer_ptr();
170 #ifdef USE_SOUND_VOLUME
171         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
172 #endif
173         
174         // notify key
175         void key_down(int code, bool repeat);
176         void key_up(int code);
177         bool get_caps_locked();
178         bool get_kana_locked();
179         
180         // user interface
181         void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
182         void close_floppy_disk(int drv);
183         bool is_floppy_disk_inserted(int drv);
184         void is_floppy_disk_protected(int drv, bool value);
185         bool is_floppy_disk_protected(int drv);
186         uint32_t is_floppy_disk_accessed();
187         bool is_frame_skippable();
188         
189         void update_config();
190         bool process_state(FILEIO* state_fio, bool loading);
191         
192         // ----------------------------------------
193         // for each device
194         // ----------------------------------------
195         
196         // devices
197         DEVICE* get_device(int id);
198         //DEVICE* dummy;
199         //DEVICE* first_device;
200         //DEVICE* last_device;
201 };
202
203 #endif