OSDN Git Service

[VM][General] Merge upstream 2015-09-23.
[csp-qt/common_source_project-fm7.git] / source / src / vm / sc3000 / sc3000.h
1 /*
2         SEGA SC-3000 Emulator 'eSC-3000'
3
4         Author : Takeda.Toshiya
5         Date   : 2010.08.17-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _SC3000_H_
11 #define _SC3000_H_
12
13 #define DEVICE_NAME             "SEGA SC-3000"
14 #define CONFIG_NAME             "sc3000"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60
18 #define LINES_PER_FRAME         262
19 #define CPU_CLOCKS              3579545
20 #define SCREEN_WIDTH            256
21 #define SCREEN_HEIGHT           192
22 #define TMS9918A_VRAM_SIZE      0x4000
23 #define TMS9918A_LIMIT_SPRITES
24 #define MAX_DRIVE               4
25
26 // device informations for win32
27 #define USE_CART1
28 #define USE_FD1
29 #define USE_TAPE
30 #define USE_ALT_F10_KEY
31 #define USE_AUTO_KEY            5
32 #define USE_AUTO_KEY_RELEASE    8
33 #define USE_AUTO_KEY_CAPS
34 #define USE_ACCESS_LAMP
35 #define USE_DEBUGGER
36 #define USE_STATE
37
38 #include "../../common.h"
39 #include "../../fileio.h"
40
41 class EMU;
42 class DEVICE;
43 class EVENT;
44
45 class DATAREC;
46 class I8251;
47 class I8255;
48 class IO;
49 class SN76489AN;
50 class TMS9918A;
51 class UPD765A;
52 class Z80;
53
54 class KEYBOARD;
55 class MEMORY;
56
57 class VM
58 {
59 protected:
60         EMU* emu;
61         
62         // devices
63         EVENT* event;
64         
65         DATAREC* drec;
66         I8251* sio;
67         I8255* pio_k;
68         I8255* pio_f;
69         IO* io;
70         SN76489AN* psg;
71         TMS9918A* vdp;
72         UPD765A* fdc;
73         Z80* cpu;
74         
75         KEYBOARD* key;
76         MEMORY* memory;
77         
78 public:
79         // ----------------------------------------
80         // initialize
81         // ----------------------------------------
82         
83         VM(EMU* parent_emu);
84         ~VM();
85         
86         // ----------------------------------------
87         // for emulation class
88         // ----------------------------------------
89         
90         // drive virtual machine
91         void reset();
92         void run();
93         
94 #ifdef USE_DEBUGGER
95         // debugger
96         DEVICE *get_cpu(int index);
97 #endif
98         
99         // draw screen
100         void draw_screen();
101         int access_lamp();
102         
103         // sound generation
104         void initialize_sound(int rate, int samples);
105         uint16* create_sound(int* extra_frames);
106         int sound_buffer_ptr();
107         
108         // user interface
109         void open_cart(int drv, const _TCHAR* file_path);
110         void close_cart(int drv);
111         bool cart_inserted(int drv);
112         void open_disk(int drv, const _TCHAR* file_path, int bank);
113         void close_disk(int drv);
114         bool disk_inserted(int drv);
115         void set_disk_protected(int drv, bool value);
116         bool get_disk_protected(int drv);
117         void play_tape(const _TCHAR* file_path);
118         void rec_tape(const _TCHAR* file_path);
119         void close_tape();
120         bool tape_inserted();
121         bool now_skip();
122         
123         void update_config();
124         void save_state(FILEIO* state_fio);
125         bool load_state(FILEIO* state_fio);
126         
127         // ----------------------------------------
128         // for each device
129         // ----------------------------------------
130         
131         // devices
132         DEVICE* get_device(int id);
133         DEVICE* dummy;
134         DEVICE* first_device;
135         DEVICE* last_device;
136 };
137
138 #endif