OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc6001 / joystick.cpp
1 /*
2         NEC PC-6001 Emulator 'yaPC-6001'
3         NEC PC-6001mkII Emulator 'yaPC-6201'
4         NEC PC-6001mkIISR Emulator 'yaPC-6401'
5         NEC PC-6601 Emulator 'yaPC-6601'
6         NEC PC-6601SR Emulator 'yaPC-6801'
7
8         Author : tanam
9         Date   : 2013.07.15-
10
11         [ joystick ]
12 */
13
14 #include "joystick.h"
15 #if defined(_PC6001MK2SR) || defined(_PC6601SR)
16 #include "../ym2203.h"
17 #else
18 #include "../ay_3_891x.h"
19 #endif
20
21 namespace PC6001 {
22
23 void JOYSTICK::initialize()
24 {
25         joy_stat = emu->get_joy_buffer();
26         
27         // register event to update the key status
28         register_frame_event(this);
29 }
30
31 void JOYSTICK::event_frame()
32 {
33 #if defined(_PC6001MK2SR) || defined(_PC6601SR)
34         d_psg->write_signal(SIG_YM2203_PORT_A, ~(joy_stat[0] & 0x3f), 0xff);
35         d_psg->write_signal(SIG_YM2203_PORT_B, ~(joy_stat[1] & 0x1f), 0xff);
36 #else
37         d_psg->write_signal(SIG_AY_3_891X_PORT_A, ~(joy_stat[0] & 0x3f), 0xff);
38         d_psg->write_signal(SIG_AY_3_891X_PORT_B, ~(joy_stat[1] & 0x1f), 0xff);
39 #endif
40 }
41
42 }