OSDN Git Service

[General] Convert sourcecode's CRLF format: DOS(WINDOWS) to Unix, to apply patches...
[csp-qt/common_source_project-fm7.git] / source / src / vm / j3100 / j3100.h
1 /*
2         TOSHIBA J-3100GT Emulator 'eJ-3100GT'
3         TOSHIBA J-3100SL Emulator 'eJ-3100SL'
4
5         Author : Takeda.Toshiya
6         Date   : 2011.08.16-
7
8         [ virtual machine ]
9 */
10
11 #ifndef _J3100_H_
12 #define _J3100_H_
13
14 #if defined(_J3100GT)
15 #define DEVICE_NAME             "TOSHIBA J-3100GT"
16 #define CONFIG_NAME             "j3100gt"
17 #elif defined(_J3100SL)
18 #define DEVICE_NAME             "TOSHIBA J-3100SL"
19 #define CONFIG_NAME             "j3100sl"
20 #endif
21
22 // device informations for virtual machine
23
24 #if defined(_J3100SL) || defined(_J3100SS) || defined(_J3100SE)
25 #define TYPE_SL
26 #endif
27
28 // TODO: check refresh rate
29 #define FRAMES_PER_SEC          59.9
30 // \97v\92²\8d¸
31 #define LINES_PER_FRAME         440
32 #define CHARS_PER_LINE          54
33 #define CPU_CLOCKS              9545456
34 #define SCREEN_WIDTH            640
35 #define SCREEN_HEIGHT           400
36 #define MAX_DRIVE               2
37 #define UPD765A_SENCE_INTSTAT_RESULT
38 #define UPD765A_EXT_DRVSEL
39 #ifdef TYPE_SL
40 #define HAS_I86
41 #define I8259_MAX_CHIPS         1
42 #else
43 #define HAS_I286
44 #define I8259_MAX_CHIPS         2
45 #endif
46 #if !(defined(_J3100SS) || defined(_J3100SE))
47 #define HAS_I8254
48 #endif
49 #define SINGLE_MODE_DMA
50 #define IO_ADDR_MAX             0x10000
51
52 // device informations for win32
53 #define USE_FD1
54 #define USE_FD2
55 #define NOTIFY_KEY_DOWN
56 #define USE_ALT_F10_KEY
57 #define USE_AUTO_KEY            5
58 #define USE_AUTO_KEY_RELEASE    6
59 #define USE_ACCESS_LAMP
60
61 #include "../../common.h"
62
63 class EMU;
64 class DEVICE;
65 class EVENT;
66
67 class HD46505;
68 class I8237;
69 //class I8250;
70 class I8253;
71 class I8259;
72 class I86;
73 class IO;
74 class PCM1BIT;
75 class UPD765A;
76 #ifdef TYPE_SL
77 class RP5C01;
78 #else
79 class HD146818P;
80 #endif
81
82 class DISPLAY;
83 class DMAREG;
84 class FLOPPY;
85 class KEYBOARD;
86 class MEMORY;
87 class SASI;
88 class SYSTEM;
89
90 class VM
91 {
92 protected:
93         EMU* emu;
94         
95         // devices
96         EVENT* event;
97         
98         HD46505* crtc;
99         I8237* dma;
100 //      I8250* sio;
101         I8253* pit;
102         I8259* pic;
103         I86* cpu;
104         IO* io;
105         PCM1BIT* pcm;
106         UPD765A* fdc;
107 #ifdef TYPE_SL
108         RP5C01* rtc;
109 #else
110         HD146818P* rtc;
111         I8237* dma2;
112 #endif
113         
114         DISPLAY* display;
115         DMAREG* dmareg;
116         FLOPPY* floppy;
117         KEYBOARD* keyboard;
118         MEMORY* memory;
119         SASI* sasi;
120         SYSTEM* system;
121         
122 public:
123         // ----------------------------------------
124         // initialize
125         // ----------------------------------------
126         
127         VM(EMU* parent_emu);
128         ~VM();
129         
130         // ----------------------------------------
131         // for emulation class
132         // ----------------------------------------
133         
134         // drive virtual machine
135         void reset();
136         void notify_power_off();
137         void run();
138         
139         // draw screen
140         void draw_screen();
141         int access_lamp();
142         
143         // sound generation
144         void initialize_sound(int rate, int samples);
145         uint16* create_sound(int* extra_frames);
146         int sound_buffer_ptr();
147         
148         // notify key
149         void key_down(int code, bool repeat);
150         void key_up(int code);
151         
152         // user interface
153         void open_disk(int drv, _TCHAR* file_path, int offset);
154         void close_disk(int drv);
155         bool disk_inserted(int drv);
156         bool now_skip();
157         
158         void update_config();
159         
160         // ----------------------------------------
161         // for each device
162         // ----------------------------------------
163         
164         // devices
165         DEVICE* get_device(int id);
166         DEVICE* dummy;
167         DEVICE* first_device;
168         DEVICE* last_device;
169 };
170
171 #endif