OSDN Git Service

[General][Qt] Merge upstream, datarecorder with sound.
[csp-qt/common_source_project-fm7.git] / source / src / vm / x07 / x07.h
1 /*
2         CANON X-07 Emulator 'eX-07'
3
4         Author : Takeda.Toshiya
5         Date   : 2007.12.26 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _X07_H_
11 #define _X07_H_
12
13 #define DEVICE_NAME             "CANON X-07"
14 #define CONFIG_NAME             "x07"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60
18 #define LINES_PER_FRAME         262
19 #define CPU_CLOCKS              3840000
20 #define CPU_START_ADDR          0xc3c3
21 #define SCREEN_WIDTH            120
22 #define SCREEN_HEIGHT           32
23 #define TV_SCREEN_WIDTH         256
24 #define TV_SCREEN_HEIGHT        192
25 #define HAS_NSC800
26 #define MEMORY_ADDR_MAX         0x10000
27 #define MEMORY_BANK_SIZE        0x800
28
29 // device informations for win32
30 #define WINDOW_WIDTH            (SCREEN_WIDTH * 2)
31 #define WINDOW_HEIGHT           (SCREEN_HEIGHT * 2)
32 #define TV_WINDOW_WIDTH         TV_SCREEN_WIDTH
33 #define TV_WINDOW_HEIGHT        TV_SCREEN_HEIGHT
34
35 #define USE_TAPE
36 #define TAPE_BINARY_ONLY
37 #define NOTIFY_KEY_DOWN
38 #define USE_ALT_F10_KEY
39 #define USE_AUTO_KEY            6
40 #define USE_AUTO_KEY_RELEASE    10
41 #define USE_AUTO_KEY_CAPS
42 #define USE_DEBUGGER
43 #define USE_STATE
44
45 #include "../../common.h"
46
47 class EMU;
48 class DEVICE;
49 class EVENT;
50
51 class BEEP;
52 class MEMORY;
53 class Z80;
54
55 class IO;
56
57 #include "../../fileio.h"
58
59 class VM
60 {
61 protected:
62         EMU* emu;
63         
64         // devices
65         EVENT* event;
66         
67         BEEP* beep;
68         MEMORY* memory;
69         Z80* cpu;
70         
71         IO* io;
72         
73         // memory
74 //      uint8 c3[0x2000];
75         uint8 ram[0x6000];
76         uint8 app[0x2000];
77         uint8 vram[0x1800];
78         uint8 tv[0x1000];
79         uint8 bas[0x5000];
80         
81 public:
82         // ----------------------------------------
83         // initialize
84         // ----------------------------------------
85         
86         VM(EMU* parent_emu);
87         ~VM();
88         
89         // ----------------------------------------
90         // for emulation class
91         // ----------------------------------------
92         
93         // drive virtual machine
94         void reset();
95         void run();
96         
97 #ifdef USE_DEBUGGER
98         // debugger
99         DEVICE *get_cpu(int index);
100 #endif
101         
102         // draw screen
103         void draw_screen();
104         
105         // sound generation
106         void initialize_sound(int rate, int samples);
107         uint16* create_sound(int* extra_frames);
108         int sound_buffer_ptr();
109         
110         // notify key
111         void key_down(int code, bool repeat);
112         void key_up(int code);
113         
114         // user interface
115         void play_tape(_TCHAR* file_path);
116         void rec_tape(_TCHAR* file_path);
117         void close_tape();
118         bool tape_inserted();
119         bool now_skip();
120         
121         void update_config();
122         void save_state(FILEIO* state_fio);
123         bool load_state(FILEIO* state_fio);
124         
125         // ----------------------------------------
126         // for each device
127         // ----------------------------------------
128         
129         // devices
130         DEVICE* get_device(int id);
131         DEVICE* dummy;
132         DEVICE* first_device;
133         DEVICE* last_device;
134 };
135
136 #endif