OSDN Git Service

[VM][Qt] Fix definition of screen aspects.
[csp-qt/common_source_project-fm7.git] / source / src / vm / tk80bs / tk80bs.h
1 /*
2         NEC TK-80BS (COMPO BS/80) Emulator 'eTK-80BS'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.08.26 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _TK80BS_H_
11 #define _TK80BS_H_
12
13 #define DEVICE_NAME             "NEC TK-80BS"
14 #define CONFIG_NAME             "tk80bs"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          59.9
18 #define LINES_PER_FRAME         262
19 #define CPU_CLOCKS              2048000
20 //#define CPU_START_ADDR                0xf000
21 #define HAS_I8080
22 #define I8255_AUTO_HAND_SHAKE
23 #define SCREEN_WIDTH            256
24 #define SCREEN_HEIGHT           164
25 #define MEMORY_ADDR_MAX         0x10000
26 #define MEMORY_BANK_SIZE        0x200
27 #define IO_ADDR_MAX             0x10000
28 #define SCREEN_WIDTH_ASPECT SCREEN_WIDTH 
29 #define SCREEN_HEIGHT_ASPECT SCREEN_HEIGHT
30 #define WINDOW_WIDTH_ASPECT 256
31 #define WINDOW_HEIGHT_ASPECT 192 
32
33 // device informations for win32
34 #define USE_BOOT_MODE           2
35 #define USE_TAPE
36 #define TAPE_BINARY_ONLY
37 #define USE_BINARY_FILE1
38 #define NOTIFY_KEY_DOWN
39 #define USE_ALT_F10_KEY
40 #define USE_AUTO_KEY            5
41 #define USE_AUTO_KEY_RELEASE    6
42 #define USE_AUTO_KEY_NO_CAPS
43 #define USE_DEBUGGER
44
45 #include "../../common.h"
46 #include "../../fileio.h"
47
48 class EMU;
49 class DEVICE;
50 class EVENT;
51
52 class I8251;
53 class I8255;
54 class IO;
55 class MEMORY;
56 class PCM1BIT;
57 class I8080;
58
59 class CMT;
60 class DISPLAY;
61 class KEYBOARD;
62
63 class VM
64 {
65 protected:
66         EMU* emu;
67         
68         // devices
69         EVENT* event;
70         
71         I8251* sio_b;
72         I8255* pio_b;
73         I8255* pio_t;
74         IO* memio;
75         MEMORY* memory;
76         PCM1BIT* pcm0;
77         PCM1BIT* pcm1;
78         I8080* cpu;
79         
80         CMT* cmt;
81         DISPLAY* display;
82         KEYBOARD* keyboard;
83         
84         // memory
85         uint8 mon[0x800];
86         uint8 ext[0x7000];
87         uint8 basic[0x2000];
88         uint8 bsmon[0x1000];
89         uint8 ram[0x5000];      // with TK-M20K
90         uint8 vram[0x200];
91         
92         int boot_mode;
93         
94 public:
95         // ----------------------------------------
96         // initialize
97         // ----------------------------------------
98         
99         VM(EMU* parent_emu);
100         ~VM();
101         
102         // ----------------------------------------
103         // for emulation class
104         // ----------------------------------------
105         
106         // drive virtual machine
107         void reset();
108         void run();
109         
110 #ifdef USE_DEBUGGER
111         // debugger
112         DEVICE *get_cpu(int index);
113 #endif
114         
115         // draw screen
116         void draw_screen();
117         
118         // sound generation
119         void initialize_sound(int rate, int samples);
120         uint16* create_sound(int* extra_frames);
121         int sound_buffer_ptr();
122         
123         // notify key
124         void key_down(int code, bool repeat);
125         void key_up(int code);
126         
127         // user interface
128         void load_binary(int drv, _TCHAR* file_path);
129         void save_binary(int drv, _TCHAR* file_path);
130         void play_tape(_TCHAR* file_path);
131         void rec_tape(_TCHAR* file_path);
132         void close_tape();
133         bool tape_inserted();
134         bool now_skip();
135         
136         void update_config();
137         
138         // ----------------------------------------
139         // for each device
140         // ----------------------------------------
141         
142         // devices
143         DEVICE* get_device(int id);
144         DEVICE* dummy;
145         DEVICE* first_device;
146         DEVICE* last_device;
147 };
148
149 #endif