OSDN Git Service

[VM] TRY:Use namespace {VMNAME} to separate around VMs. This feature still apply...
[csp-qt/common_source_project-fm7.git] / source / src / vm / babbage2nd / keyboard.cpp
1 /*
2         Gijutsu-Hyoron-Sha Babbage-2nd Emulator 'eBabbage-2nd'
3
4         Author : Takeda.Toshiya
5         Date   : 2009.12.26 -
6
7         [ keyboard ]
8 */
9
10 #include "keyboard.h"
11 #include "../z80pio.h"
12
13 namespace BABBAGE2ND {
14 void KEYBOARD::key_down(int code)
15 {
16         if(0x30 <= code && code <= 0x39) {
17                 code -= 0x30;
18                 d_pio->write_signal(SIG_Z80PIO_PORT_A, code, 0x1f);
19         } else if(0x41 <= code && code <= 0x46) {
20                 code = (code - 0x41) + 0x0a;
21                 d_pio->write_signal(SIG_Z80PIO_PORT_A, code, 0x1f);
22         } else if(0x70 <= code && code <= 0x73) {
23                 code = (0x73 - code) + 0x10;
24                 d_pio->write_signal(SIG_Z80PIO_PORT_A, code, 0x1f);
25         } else if(code == 0x74) {
26                 vm->reset();
27         }
28 }
29 }