2 NEC TK-80BS (COMPO BS/80) Emulator 'eTK-80BS'
4 Author : Takeda.Toshiya
13 #define DEVICE_NAME "NEC TK-80BS"
14 #define CONFIG_NAME "tk80bs"
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC 59.9
18 #define LINES_PER_FRAME 262
19 #define CPU_CLOCKS 2048000
21 #define I8255_AUTO_HAND_SHAKE
22 #define SCREEN_WIDTH 784
23 #define SCREEN_HEIGHT 428
24 #define MEMORY_ADDR_MAX 0x10000
25 #define MEMORY_BANK_SIZE 0x200
26 #define IO_ADDR_MAX 0x10000
28 // device informations for win32
29 #define ONE_BOARD_MICRO_COMPUTER
30 #define MAX_BUTTONS 25
31 //#define MAX_DRAW_RANGES 9
32 #define USE_BOOT_MODE 2
33 //#define USE_DIPSWITCH
34 //#define DIPSWITCH_DEFAULT 0
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 SUPPORT_ROMA_KANA_CONVERSION
45 #define USE_SOUND_VOLUME 2
49 #include "../../common.h"
50 #include "../../fileio.h"
52 #ifdef USE_SOUND_VOLUME
53 static const _TCHAR *sound_device_caption[] = {
54 _T("Beep #1"), _T("Beep #2"),
59 const _TCHAR* caption;
65 // virtual key codes 0x80-0x8f and 0x98-0x9f are not used in pc keyboard
66 {_T("0"), 523 + 46 * 0, 190 + 46 * 4, 40, 40, 20, 0x80},
67 {_T("1"), 523 + 46 * 1, 190 + 46 * 4, 40, 40, 20, 0x81},
68 {_T("2"), 523 + 46 * 2, 190 + 46 * 4, 40, 40, 20, 0x82},
69 {_T("3"), 523 + 46 * 3, 190 + 46 * 4, 40, 40, 20, 0x83},
70 {_T("4"), 523 + 46 * 0, 190 + 46 * 3, 40, 40, 20, 0x84},
71 {_T("5"), 523 + 46 * 1, 190 + 46 * 3, 40, 40, 20, 0x85},
72 {_T("6"), 523 + 46 * 2, 190 + 46 * 3, 40, 40, 20, 0x86},
73 {_T("7"), 523 + 46 * 3, 190 + 46 * 3, 40, 40, 20, 0x87},
74 {_T("8"), 523 + 46 * 0, 190 + 46 * 2, 40, 40, 20, 0x88},
75 {_T("9"), 523 + 46 * 1, 190 + 46 * 2, 40, 40, 20, 0x89},
76 {_T("A"), 523 + 46 * 2, 190 + 46 * 2, 40, 40, 20, 0x8a},
77 {_T("B"), 523 + 46 * 3, 190 + 46 * 2, 40, 40, 20, 0x8b},
78 {_T("C"), 523 + 46 * 0, 190 + 46 * 1, 40, 40, 20, 0x8c},
79 {_T("D"), 523 + 46 * 1, 190 + 46 * 1, 40, 40, 20, 0x8d},
80 {_T("E"), 523 + 46 * 2, 190 + 46 * 1, 40, 40, 20, 0x8e},
81 {_T("F"), 523 + 46 * 3, 190 + 46 * 1, 40, 40, 20, 0x8f},
82 {_T("RET"), 523 + 46 * 0, 190 + 46 * 0, 40, 40, 9, 0x98},
83 {_T("RUN"), 523 + 46 * 1, 190 + 46 * 0, 40, 40, 9, 0x99},
84 {_T("STORE\nDATA"), 523 + 46 * 2, 190 + 46 * 0, 40, 40, 9, 0x9a},
85 {_T("LOAD\nDATA"), 523 + 46 * 3, 190 + 46 * 0, 40, 40, 9, 0x9b},
86 {_T("RESET"), 523 + 46 * 4, 190 + 46 * 0, 40, 40, 9, 0x00},
87 {_T("ADRS\nSET"), 523 + 46 * 4, 190 + 46 * 1, 40, 40, 9, 0x9c},
88 {_T("READ\nINCR"), 523 + 46 * 4, 190 + 46 * 2, 40, 40, 9, 0x9d},
89 {_T("READ\nDECR"), 523 + 46 * 4, 190 + 46 * 3, 40, 40, 9, 0x9e},
90 {_T("WRITE\nINCR"), 523 + 46 * 4, 190 + 46 * 4, 40, 40, 9, 0x9f},
96 {461 + 36 * 0, 28, 33, 46}, // 7-seg LEDs
97 {461 + 36 * 1, 28, 33, 46},
98 {461 + 36 * 2, 28, 33, 46},
99 {461 + 36 * 3, 28, 33, 46},
100 {618 + 36 * 0, 28, 33, 46},
101 {618 + 36 * 1, 28, 33, 46},
102 {618 + 36 * 2, 28, 33, 46},
103 {618 + 36 * 3, 28, 33, 46},
104 {4, 158, 512, 256}, // CRT
146 uint8_t basic[0x2000];
147 uint8_t bsmon[0x1000];
148 uint8_t ram[0x5000]; // with TK-M20K
154 // ----------------------------------------
156 // ----------------------------------------
161 // ----------------------------------------
162 // for emulation class
163 // ----------------------------------------
165 // drive virtual machine
171 DEVICE *get_cpu(int index);
176 int max_draw_ranges();
179 void initialize_sound(int rate, int samples);
180 uint16_t* create_sound(int* extra_frames);
181 int get_sound_buffer_ptr();
182 #ifdef USE_SOUND_VOLUME
183 void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
187 void key_down(int code, bool repeat);
188 void key_up(int code);
191 void load_binary(int drv, const _TCHAR* file_path);
192 void save_binary(int drv, const _TCHAR* file_path);
193 void play_tape(const _TCHAR* file_path);
194 void rec_tape(const _TCHAR* file_path);
196 bool is_tape_inserted();
197 bool is_frame_skippable();
199 void update_config();
200 void save_state(FILEIO* state_fio);
201 bool load_state(FILEIO* state_fio);
203 // ----------------------------------------
205 // ----------------------------------------
208 DEVICE* get_device(int id);
210 DEVICE* first_device;