trunk/src/mess/drivers/uzebox.c
| r243324 | r243325 | |
| 9 | 9 | TODO: |
| 10 | 10 | - Sound |
| 11 | 11 | - SDCard |
| 12 | | - Mouse |
| 13 | 12 | |
| 14 | 13 | ****************************************************************************/ |
| 15 | 14 | |
| r243324 | r243325 | |
| 18 | 17 | #include "sound/dac.h" |
| 19 | 18 | #include "bus/generic/slot.h" |
| 20 | 19 | #include "bus/generic/carts.h" |
| 20 | #include "bus/snes_ctrl/ctrl.h" |
| 21 | 21 | |
| 22 | 22 | // overclocked to 8 * NTSC burst frequency |
| 23 | 23 | #define MASTER_CLOCK 28618180 |
| r243324 | r243325 | |
| 30 | 30 | uzebox_state(const machine_config &mconfig, device_type type, const char *tag) |
| 31 | 31 | : driver_device(mconfig, type, tag), |
| 32 | 32 | m_maincpu(*this, "maincpu"), |
| 33 | | m_cart(*this, "cartslot") |
| 33 | m_cart(*this, "cartslot"), |
| 34 | m_ctrl1(*this, "ctrl1"), |
| 35 | m_ctrl2(*this, "ctrl2") |
| 34 | 36 | { } |
| 35 | 37 | |
| 36 | 38 | required_device<avr8_device> m_maincpu; |
| 37 | 39 | required_device<generic_slot_device> m_cart; |
| 40 | required_device<snes_control_port_device> m_ctrl1; |
| 41 | required_device<snes_control_port_device> m_ctrl2; |
| 38 | 42 | |
| 39 | 43 | DECLARE_READ8_MEMBER(port_a_r); |
| 40 | 44 | DECLARE_WRITE8_MEMBER(port_a_w); |
| r243324 | r243325 | |
| 59 | 63 | UINT8 m_port_b; |
| 60 | 64 | UINT8 m_port_c; |
| 61 | 65 | UINT8 m_port_d; |
| 62 | | UINT16 m_joy_data[2]; |
| 63 | 66 | bitmap_rgb32 m_bitmap; |
| 64 | 67 | }; |
| 65 | 68 | |
| r243324 | r243325 | |
| 80 | 83 | m_port_b = 0; |
| 81 | 84 | m_port_c = 0; |
| 82 | 85 | m_port_d = 0; |
| 83 | | m_joy_data[0] = m_joy_data[1] = 0; |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | 88 | |
| r243324 | r243325 | |
| 92 | 94 | // ---- --x- SNES controller P2 data |
| 93 | 95 | // ---- ---x SNES controller P1 data |
| 94 | 96 | |
| 95 | | UINT8 changed = m_port_a ^ data; |
| 97 | m_ctrl1->write_strobe(BIT(data, 2)); |
| 98 | m_ctrl2->write_strobe(BIT(data, 2)); |
| 96 | 99 | |
| 97 | | if (changed & data & 0x04) |
| 100 | UINT8 changed = m_port_a ^ data; |
| 101 | if ((changed & data & 0x08) || (changed & (~data) & 0x04)) |
| 98 | 102 | { |
| 99 | | m_joy_data[0] = ioport("P1")->read(); |
| 100 | | m_joy_data[1] = ioport("P2")->read(); |
| 103 | m_port_a &= ~0x03; |
| 104 | m_port_a |= m_ctrl1->read_pin4() ? 0 : 0x01; |
| 105 | m_port_a |= m_ctrl2->read_pin4() ? 0 : 0x02; |
| 101 | 106 | } |
| 102 | | else if (changed & 0x08) |
| 103 | | { |
| 104 | | if (changed & data & 0x08) |
| 105 | | { |
| 106 | | m_joy_data[0] >>= 1; |
| 107 | | m_joy_data[1] >>= 1; |
| 108 | | } |
| 109 | 107 | |
| 110 | | m_port_a = (m_joy_data[0] & 0x01) | ((m_joy_data[1] & 0x01) << 1); |
| 111 | | } |
| 112 | | |
| 113 | 108 | m_port_a = (data & 0x0c) | (m_port_a & 0x03); |
| 114 | 109 | } |
| 115 | 110 | |
| r243324 | r243325 | |
| 207 | 202 | \****************************************************/ |
| 208 | 203 | |
| 209 | 204 | static INPUT_PORTS_START( uzebox ) |
| 210 | | PORT_START( "P1" ) |
| 211 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button B") PORT_PLAYER(1) |
| 212 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button Y") PORT_PLAYER(1) |
| 213 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1) |
| 214 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("P1 Start") PORT_PLAYER(1) |
| 215 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 216 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 217 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| 218 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| 219 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Button A") PORT_PLAYER(1) |
| 220 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Button X") PORT_PLAYER(1) |
| 221 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Button L") PORT_PLAYER(1) |
| 222 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Button R") PORT_PLAYER(1) |
| 223 | | PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | | |
| 225 | | PORT_START( "P2" ) |
| 226 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button B") PORT_PLAYER(2) |
| 227 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button Y") PORT_PLAYER(2) |
| 228 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2) |
| 229 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 Start") |
| 230 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 231 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 232 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 233 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 234 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Button A") PORT_PLAYER(2) |
| 235 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Button X") PORT_PLAYER(2) |
| 236 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Button L") PORT_PLAYER(2) |
| 237 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Button R") PORT_PLAYER(2) |
| 238 | | PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 239 | | |
| 240 | 205 | PORT_START("AD725_CE") |
| 241 | 206 | PORT_CONFNAME( 0x01, 0x00, "AD725 CE" ) |
| 242 | 207 | PORT_CONFSETTING( 0x00, "VCC" ) |
| r243324 | r243325 | |
| 324 | 289 | MCFG_GENERIC_MANDATORY |
| 325 | 290 | MCFG_GENERIC_LOAD(uzebox_state, uzebox_cart) |
| 326 | 291 | |
| 292 | MCFG_SNES_CONTROL_PORT_ADD("ctrl1", snes_control_port_devices, "joypad") |
| 293 | MCFG_SNES_CONTROL_PORT_ADD("ctrl2", snes_control_port_devices, "joypad") |
| 294 | |
| 327 | 295 | MCFG_SOFTWARE_LIST_ADD("eprom_list","uzebox") |
| 328 | 296 | MACHINE_CONFIG_END |
| 329 | 297 | |