trunk/src/mess/machine/vcs_wheel.c
| r20497 | r20498 | |
| 49 | 49 | |
| 50 | 50 | vcs_wheel_device::vcs_wheel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 51 | 51 | device_t(mconfig, VCS_WHEEL, "Driving Wheel", tag, owner, clock), |
| 52 | | device_vcs_control_port_interface(mconfig, *this) |
| 52 | device_vcs_control_port_interface(mconfig, *this), |
| 53 | m_joy(*this, "JOY"), |
| 54 | m_wheel(*this, "WHEEL") |
| 53 | 55 | { |
| 54 | 56 | } |
| 55 | 57 | |
| r20497 | r20498 | |
| 71 | 73 | { |
| 72 | 74 | static const UINT8 driving_lookup[4] = { 0x00, 0x02, 0x03, 0x01 }; |
| 73 | 75 | |
| 74 | | return ioport("JOY")->read() | driving_lookup[ ( ioport("WHEEL")->read() & 0x18 ) >> 3 ]; |
| 76 | return m_joy->read() | driving_lookup[ ( m_wheel->read() & 0x18 ) >> 3 ]; |
| 75 | 77 | } |
trunk/src/mess/machine/vcs_lightpen.c
| r20497 | r20498 | |
| 58 | 58 | |
| 59 | 59 | vcs_lightpen_device::vcs_lightpen_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 60 | 60 | device_t(mconfig, VCS_LIGHTPEN, "Light Pen", tag, owner, clock), |
| 61 | | device_vcs_control_port_interface(mconfig, *this) |
| 61 | device_vcs_control_port_interface(mconfig, *this), |
| 62 | m_joy(*this, "JOY"), |
| 63 | m_lightx(*this, "LIGHTX"), |
| 64 | m_lighty(*this, "LIGHTY") |
| 62 | 65 | { |
| 63 | 66 | } |
| 64 | 67 | |
| r20497 | r20498 | |
| 78 | 81 | |
| 79 | 82 | UINT8 vcs_lightpen_device::vcs_joy_r() |
| 80 | 83 | { |
| 81 | | return ioport("JOY")->read(); |
| 84 | return m_joy->read(); |
| 82 | 85 | } |
trunk/src/mess/machine/vcs_joybooster.c
| r20497 | r20498 | |
| 59 | 59 | |
| 60 | 60 | vcs_joystick_booster_device::vcs_joystick_booster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 61 | 61 | device_t(mconfig, VCS_JOYSTICK_BOOSTER, "Digital joystick with Boostergrip", tag, owner, clock), |
| 62 | | device_vcs_control_port_interface(mconfig, *this) |
| 62 | device_vcs_control_port_interface(mconfig, *this), |
| 63 | m_joy(*this, "JOY"), |
| 64 | m_potx(*this, "POTX"), |
| 65 | m_poty(*this, "POTY") |
| 63 | 66 | { |
| 64 | 67 | } |
| 65 | 68 | |
| r20497 | r20498 | |
| 79 | 82 | |
| 80 | 83 | UINT8 vcs_joystick_booster_device::vcs_joy_r() |
| 81 | 84 | { |
| 82 | | return ioport("JOY")->read(); |
| 85 | return m_joy->read(); |
| 83 | 86 | } |
| 84 | 87 | |
| 85 | 88 | UINT8 vcs_joystick_booster_device::vcs_pot_x_r() |
| 86 | 89 | { |
| 87 | | return ioport("POTX")->read(); |
| 90 | return m_potx->read(); |
| 88 | 91 | } |
| 89 | 92 | |
| 90 | 93 | UINT8 vcs_joystick_booster_device::vcs_pot_y_r() |
| 91 | 94 | { |
| 92 | | return ioport("POTY")->read(); |
| 95 | return m_poty->read(); |
| 93 | 96 | } |
trunk/src/mess/machine/vcs_keypad.c
| r20497 | r20498 | |
| 56 | 56 | |
| 57 | 57 | vcs_keypad_device::vcs_keypad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 58 | 58 | device_t(mconfig, VCS_KEYPAD, "Keypad", tag, owner, clock), |
| 59 | | device_vcs_control_port_interface(mconfig, *this) |
| 59 | device_vcs_control_port_interface(mconfig, *this), |
| 60 | m_keypad(*this, "KEYPAD") |
| 60 | 61 | { |
| 61 | 62 | } |
| 62 | 63 | |
| r20497 | r20498 | |
| 82 | 83 | { |
| 83 | 84 | if ( ! ( ( m_column >> i ) & 0x01 ) ) |
| 84 | 85 | { |
| 85 | | if ( ( ioport("KEYPAD")->read() >> 3*i ) & 0x04 ) |
| 86 | if ( ( m_keypad->read() >> 3*i ) & 0x04 ) |
| 86 | 87 | { |
| 87 | 88 | return 0xff; |
| 88 | 89 | } |
| r20497 | r20498 | |
| 106 | 107 | { |
| 107 | 108 | if ( ! ( ( m_column >> i ) & 0x01 ) ) |
| 108 | 109 | { |
| 109 | | if ( ( ioport("KEYPAD")->read() >> 3*i ) & 0x01 ) |
| 110 | if ( ( m_keypad->read() >> 3*i ) & 0x01 ) |
| 110 | 111 | { |
| 111 | 112 | return 0; |
| 112 | 113 | } |
| r20497 | r20498 | |
| 125 | 126 | { |
| 126 | 127 | if ( ! ( ( m_column >> i ) & 0x01 ) ) |
| 127 | 128 | { |
| 128 | | if ( ( ioport("KEYPAD")->read() >> 3*i ) & 0x02 ) |
| 129 | if ( ( m_keypad->read() >> 3*i ) & 0x02 ) |
| 129 | 130 | { |
| 130 | 131 | return 0; |
| 131 | 132 | } |
trunk/src/mess/machine/vcs_keypad.h
| r20497 | r20498 | |
| 25 | 25 | // ======================> vcs_keypad_device |
| 26 | 26 | |
| 27 | 27 | class vcs_keypad_device : public device_t, |
| 28 | | public device_vcs_control_port_interface |
| 28 | public device_vcs_control_port_interface |
| 29 | 29 | { |
| 30 | 30 | public: |
| 31 | 31 | // construction/destruction |
| r20497 | r20498 | |
| 45 | 45 | virtual UINT8 vcs_pot_x_r(); |
| 46 | 46 | virtual UINT8 vcs_pot_y_r(); |
| 47 | 47 | |
| 48 | virtual bool has_pot_x() { return true; } |
| 49 | virtual bool has_pot_y() { return true; } |
| 50 | |
| 51 | private: |
| 52 | required_ioport m_keypad; |
| 53 | |
| 48 | 54 | UINT8 m_column; |
| 49 | 55 | }; |
| 50 | 56 | |
trunk/src/mess/machine/vcs_joy.c
| r20497 | r20498 | |
| 50 | 50 | |
| 51 | 51 | vcs_joystick_device::vcs_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 52 | 52 | device_t(mconfig, VCS_JOYSTICK, "Digital joystick", tag, owner, clock), |
| 53 | | device_vcs_control_port_interface(mconfig, *this) |
| 53 | device_vcs_control_port_interface(mconfig, *this), |
| 54 | m_joy(*this, "JOY") |
| 54 | 55 | { |
| 55 | 56 | } |
| 56 | 57 | |
| r20497 | r20498 | |
| 70 | 71 | |
| 71 | 72 | UINT8 vcs_joystick_device::vcs_joy_r() |
| 72 | 73 | { |
| 73 | | return ioport("JOY")->read(); |
| 74 | return m_joy->read(); |
| 74 | 75 | } |
trunk/src/mess/machine/vcs_paddles.c
| r20497 | r20498 | |
| 53 | 53 | |
| 54 | 54 | vcs_paddles_device::vcs_paddles_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 55 | 55 | device_t(mconfig, VCS_PADDLES, "Digital paddles", tag, owner, clock), |
| 56 | | device_vcs_control_port_interface(mconfig, *this) |
| 56 | device_vcs_control_port_interface(mconfig, *this), |
| 57 | m_joy(*this, "JOY"), |
| 58 | m_potx(*this, "POTX"), |
| 59 | m_poty(*this, "POTY") |
| 57 | 60 | { |
| 58 | 61 | } |
| 59 | 62 | |
| r20497 | r20498 | |
| 73 | 76 | |
| 74 | 77 | UINT8 vcs_paddles_device::vcs_joy_r() |
| 75 | 78 | { |
| 76 | | return ioport("JOY")->read(); |
| 79 | return m_joy->read(); |
| 77 | 80 | } |
| 78 | 81 | |
| 79 | 82 | |
| r20497 | r20498 | |
| 83 | 86 | |
| 84 | 87 | UINT8 vcs_paddles_device::vcs_pot_x_r() |
| 85 | 88 | { |
| 86 | | return ioport("POTX")->read(); |
| 89 | return m_potx->read(); |
| 87 | 90 | } |
| 88 | 91 | |
| 89 | 92 | |
| r20497 | r20498 | |
| 93 | 96 | |
| 94 | 97 | UINT8 vcs_paddles_device::vcs_pot_y_r() |
| 95 | 98 | { |
| 96 | | return ioport("POTY")->read(); |
| 99 | return m_poty->read(); |
| 97 | 100 | } |
trunk/src/mess/machine/vcsctrl.c
| r20497 | r20498 | |
| 53 | 53 | //------------------------------------------------- |
| 54 | 54 | |
| 55 | 55 | vcs_control_port_device::vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 56 | | device_t(mconfig, VCS_CONTROL_PORT, "Atari VCS control port", tag, owner, clock), |
| 57 | | device_slot_interface(mconfig, *this) |
| 56 | device_t(mconfig, VCS_CONTROL_PORT, "Atari VCS control port", tag, owner, clock), |
| 57 | device_slot_interface(mconfig, *this) |
| 58 | 58 | { |
| 59 | 59 | } |
| 60 | 60 | |
| r20497 | r20498 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | | UINT8 vcs_control_port_device::joy_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_joy_r(); return data; } |
| 81 | UINT8 vcs_control_port_device::joy_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_joy_r(); return data; } |
| 82 | 82 | READ8_MEMBER( vcs_control_port_device::joy_r ) { return joy_r(); } |
| 83 | | UINT8 vcs_control_port_device::pot_x_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_pot_x_r(); return data; } |
| 83 | UINT8 vcs_control_port_device::pot_x_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_pot_x_r(); return data; } |
| 84 | 84 | READ8_MEMBER( vcs_control_port_device::pot_x_r ) { return pot_x_r(); } |
| 85 | | UINT8 vcs_control_port_device::pot_y_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_pot_y_r(); return data; } |
| 85 | UINT8 vcs_control_port_device::pot_y_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_pot_y_r(); return data; } |
| 86 | 86 | READ8_MEMBER( vcs_control_port_device::pot_y_r ) { return pot_y_r(); } |
| 87 | | void vcs_control_port_device::joy_w( UINT8 data ) { if ( m_device != NULL ) m_device->vcs_joy_w( data ); } |
| 87 | void vcs_control_port_device::joy_w( UINT8 data ) { if ( exists() ) m_device->vcs_joy_w( data ); } |
| 88 | 88 | WRITE8_MEMBER( vcs_control_port_device::joy_w ) { joy_w(data); } |
| 89 | bool vcs_control_port_device::exists() { return m_device != NULL; } |
| 90 | bool vcs_control_port_device::has_pot_x() { return exists() && m_device->has_pot_x(); } |
| 91 | bool vcs_control_port_device::has_pot_y() { return exists() && m_device->has_pot_y(); } |
| 89 | 92 | |
| 90 | | |
| 91 | 93 | //------------------------------------------------- |
| 92 | 94 | // SLOT_INTERFACE( vcs_control_port_devices ) |
| 93 | 95 | //------------------------------------------------- |
trunk/src/mess/machine/vcsctrl.h
| r20497 | r20498 | |
| 68 | 68 | void joy_w( UINT8 data ); |
| 69 | 69 | DECLARE_WRITE8_MEMBER( joy_w ); |
| 70 | 70 | |
| 71 | bool exists(); |
| 72 | bool has_pot_x(); |
| 73 | bool has_pot_y(); |
| 74 | |
| 71 | 75 | protected: |
| 72 | 76 | // device-level overrides |
| 73 | 77 | virtual void device_start(); |
| r20497 | r20498 | |
| 91 | 95 | virtual UINT8 vcs_pot_y_r() { return 0xff; }; |
| 92 | 96 | virtual void vcs_joy_w(UINT8 data) { }; |
| 93 | 97 | |
| 98 | virtual bool has_pot_x() { return false; } |
| 99 | virtual bool has_pot_y() { return false; } |
| 100 | |
| 94 | 101 | protected: |
| 95 | 102 | vcs_control_port_device *m_port; |
| 96 | 103 | }; |
trunk/src/mess/drivers/c64.c
| r20497 | r20498 | |
| 8 | 8 | - IRQ (WRONG $DC0D) |
| 9 | 9 | - NMI (WRONG $DD0D) |
| 10 | 10 | - some CIA tests |
| 11 | | |
| 12 | 11 | - 64C PLA dump |
| 13 | | - Multiscreen crashes on boot |
| 14 | 12 | |
| 15 | | 805A: lda $01 |
| 16 | | 805C: and #$FE |
| 17 | | 805E: sta $01 |
| 18 | | 8060: m6502_brk#$00 <-- BOOM! |
| 19 | | |
| 20 | 13 | */ |
| 21 | 14 | |
| 22 | 15 | #include "includes/c64.h" |
| r20497 | r20498 | |
| 512 | 505 | { |
| 513 | 506 | case 1: data = m_joy1->pot_x_r(); break; |
| 514 | 507 | case 2: data = m_joy2->pot_x_r(); break; |
| 515 | | case 3: break; // TODO pot1 and pot2 in series |
| 508 | case 3: |
| 509 | if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) |
| 510 | { |
| 511 | data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); |
| 512 | } |
| 513 | else if (m_joy1->has_pot_x()) |
| 514 | { |
| 515 | data = m_joy1->pot_x_r(); |
| 516 | } |
| 517 | else if (m_joy2->has_pot_x()) |
| 518 | { |
| 519 | data = m_joy2->pot_x_r(); |
| 520 | } |
| 521 | break; |
| 516 | 522 | } |
| 517 | 523 | |
| 518 | 524 | return data; |
| r20497 | r20498 | |
| 526 | 532 | { |
| 527 | 533 | case 1: data = m_joy1->pot_y_r(); break; |
| 528 | 534 | case 2: data = m_joy2->pot_y_r(); break; |
| 529 | | case 3: break; // TODO pot1 and pot2 in series |
| 535 | case 3: |
| 536 | if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) |
| 537 | { |
| 538 | data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); |
| 539 | } |
| 540 | else if (m_joy1->has_pot_y()) |
| 541 | { |
| 542 | data = m_joy1->pot_y_r(); |
| 543 | } |
| 544 | else if (m_joy2->has_pot_y()) |
| 545 | { |
| 546 | data = m_joy2->pot_y_r(); |
| 547 | } |
| 548 | break; |
| 530 | 549 | } |
| 531 | 550 | |
| 532 | 551 | return data; |
trunk/src/mess/drivers/c128.c
| r20497 | r20498 | |
| 927 | 927 | { |
| 928 | 928 | case 1: data = m_joy1->pot_x_r(); break; |
| 929 | 929 | case 2: data = m_joy2->pot_x_r(); break; |
| 930 | | case 3: break; // TODO pot1 and pot2 in series |
| 930 | case 3: |
| 931 | if (m_joy1->has_pot_x() && m_joy2->has_pot_x()) |
| 932 | { |
| 933 | data = 1 / (1 / m_joy1->pot_x_r() + 1 / m_joy2->pot_x_r()); |
| 934 | } |
| 935 | else if (m_joy1->has_pot_x()) |
| 936 | { |
| 937 | data = m_joy1->pot_x_r(); |
| 938 | } |
| 939 | else if (m_joy2->has_pot_x()) |
| 940 | { |
| 941 | data = m_joy2->pot_x_r(); |
| 942 | } |
| 943 | break; |
| 931 | 944 | } |
| 932 | 945 | |
| 933 | 946 | return data; |
| r20497 | r20498 | |
| 941 | 954 | { |
| 942 | 955 | case 1: data = m_joy1->pot_y_r(); break; |
| 943 | 956 | case 2: data = m_joy2->pot_y_r(); break; |
| 944 | | case 3: break; // TODO pot1 and pot2 in series |
| 957 | case 3: |
| 958 | if (m_joy1->has_pot_y() && m_joy2->has_pot_y()) |
| 959 | { |
| 960 | data = 1 / (1 / m_joy1->pot_y_r() + 1 / m_joy2->pot_y_r()); |
| 961 | } |
| 962 | else if (m_joy1->has_pot_y()) |
| 963 | { |
| 964 | data = m_joy1->pot_y_r(); |
| 965 | } |
| 966 | else if (m_joy2->has_pot_y()) |
| 967 | { |
| 968 | data = m_joy2->pot_y_r(); |
| 969 | } |
| 970 | break; |
| 945 | 971 | } |
| 946 | 972 | |
| 947 | 973 | return data; |