trunk/src/mess/drivers/alnchase.c
| r243516 | r243517 | |
| 5 | 5 | Tomy Alien Chase (manufactured in Japan) |
| 6 | 6 | * boards are labeled TN-16 |
| 7 | 7 | * NEC uCOM-43 MCU, labeled D553C 258 |
| 8 | | * red/green VFD display with color overlay, 2-sided (opposing player sees a mirrored image) |
| 8 | * red/green VFD display with color overlay, 2-sided* |
| 9 | |
| 10 | *Player one views the VFD from the front (grid+filament side) while the |
| 11 | opposite player views it from the back side (through the conductive traces), |
| 12 | basically a mirror-image. |
| 13 | |
| 14 | This is a space-themed tabletop VFD electronic game. To start, simply |
| 15 | press [UP]. Hold a joystick direction to move around. |
| 9 | 16 | |
| 17 | NOTE!: MESS external artwork is required to be able to play |
| 10 | 18 | |
| 11 | 19 | ***************************************************************************/ |
| 12 | 20 | |
| r243516 | r243517 | |
| 23 | 31 | alnchase_state(const machine_config &mconfig, device_type type, const char *tag) |
| 24 | 32 | : driver_device(mconfig, type, tag), |
| 25 | 33 | m_maincpu(*this, "maincpu"), |
| 34 | m_button_matrix(*this, "IN"), |
| 26 | 35 | m_speaker(*this, "speaker") |
| 27 | 36 | { } |
| 28 | 37 | |
| 29 | 38 | required_device<cpu_device> m_maincpu; |
| 39 | required_ioport_array<2> m_button_matrix; |
| 30 | 40 | required_device<speaker_sound_device> m_speaker; |
| 31 | 41 | |
| 42 | UINT8 m_input_mux; |
| 43 | UINT32 m_plate; |
| 44 | UINT16 m_grid; |
| 45 | |
| 46 | DECLARE_READ8_MEMBER(input_r); |
| 47 | DECLARE_WRITE8_MEMBER(display_w); |
| 48 | DECLARE_WRITE8_MEMBER(port_e_w); |
| 49 | |
| 50 | UINT32 m_vfd_state[0x10]; |
| 51 | void update_vfd(); |
| 52 | |
| 32 | 53 | virtual void machine_start(); |
| 33 | 54 | }; |
| 34 | 55 | |
| 35 | 56 | |
| 36 | 57 | |
| 58 | /*************************************************************************** |
| 59 | |
| 60 | Display |
| 61 | |
| 62 | ***************************************************************************/ |
| 63 | |
| 64 | void alnchase_state::update_vfd() |
| 65 | { |
| 66 | for (int i = 0; i < 9; i++) |
| 67 | if (m_grid & (1 << i) && m_vfd_state[i] != m_plate) |
| 68 | { |
| 69 | // on difference, send to output |
| 70 | for (int j = 0; j < 17; j++) |
| 71 | output_set_lamp_value(i*100 + j, m_plate >> j & 1); |
| 72 | |
| 73 | m_vfd_state[i] = m_plate; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | |
| 78 | |
| 79 | /*************************************************************************** |
| 80 | |
| 81 | I/O |
| 82 | |
| 83 | ***************************************************************************/ |
| 84 | |
| 85 | READ8_MEMBER(alnchase_state::input_r) |
| 86 | { |
| 87 | UINT8 inp = 0; |
| 88 | |
| 89 | // read selected button rows |
| 90 | for (int i = 0; i < 2; i++) |
| 91 | if (m_input_mux >> i & 1) |
| 92 | inp |= m_button_matrix[i]->read(); |
| 93 | |
| 94 | return inp; |
| 95 | } |
| 96 | |
| 97 | WRITE8_MEMBER(alnchase_state::display_w) |
| 98 | { |
| 99 | int shift; |
| 100 | |
| 101 | if (offset <= NEC_UCOM4_PORTE) |
| 102 | { |
| 103 | // C/D/E0: vfd matrix grid |
| 104 | shift = (offset - NEC_UCOM4_PORTC) * 4; |
| 105 | m_grid = (m_grid & ~(0xf << shift)) | (data << shift); |
| 106 | |
| 107 | // C0(grid 0): input enable PL1 |
| 108 | // D0(grid 4): input enable PL2 |
| 109 | m_input_mux = (m_grid & 1) | (m_grid >> 3 & 2); |
| 110 | } |
| 111 | |
| 112 | if (offset >= NEC_UCOM4_PORTE) |
| 113 | { |
| 114 | // E23/F/G/H/I: vfd matrix plate |
| 115 | shift = (offset - NEC_UCOM4_PORTE) * 4; |
| 116 | m_plate = ((m_plate << 2 & ~(0xf << shift)) | (data << shift)) >> 2; |
| 117 | } |
| 118 | |
| 119 | update_vfd(); |
| 120 | } |
| 121 | |
| 122 | WRITE8_MEMBER(alnchase_state::port_e_w) |
| 123 | { |
| 124 | display_w(space, offset, data); |
| 125 | |
| 126 | // E1: speaker out |
| 127 | m_speaker->level_w(data >> 1 & 1); |
| 128 | } |
| 129 | |
| 130 | |
| 131 | |
| 132 | /*************************************************************************** |
| 133 | |
| 134 | Inputs |
| 135 | |
| 136 | ***************************************************************************/ |
| 137 | |
| 138 | /* physical button layout and labels is like this: |
| 139 | |
| 140 | POWER SOUND LEVEL PLAYER |
| 141 | ON ON PRO TWO START |
| 142 | o o | | |
| 143 | | | | | [joystick] |
| 144 | | | o o |
| 145 | OFF OFF AMA ONE GAME 0,1,2,3 |
| 146 | |
| 147 | 1 PLAYER SIDE |
| 148 | |
| 149 | other player side only has a joystick |
| 150 | */ |
| 151 | |
| 37 | 152 | static INPUT_PORTS_START( alnchase ) |
| 153 | PORT_START("IN.0") // C0 port A |
| 154 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) |
| 155 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) |
| 156 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) |
| 157 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) |
| 158 | |
| 159 | PORT_START("IN.1") // D0 port A |
| 160 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) // on non-mirrored view, swap P2 left/right |
| 161 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) // " |
| 162 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 163 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 164 | |
| 165 | PORT_START("SW") // port B |
| 166 | PORT_CONFNAME( 0x01, 0x01, "Players" ) |
| 167 | PORT_CONFSETTING( 0x01, "1" ) |
| 168 | PORT_CONFSETTING( 0x00, "2" ) |
| 169 | PORT_CONFNAME( 0x02, 0x00, DEF_STR( Difficulty ) ) |
| 170 | PORT_CONFSETTING( 0x00, "Amateur" ) |
| 171 | PORT_CONFSETTING( 0x02, "Professional" ) |
| 172 | PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 38 | 173 | INPUT_PORTS_END |
| 39 | 174 | |
| 40 | 175 | |
| r243516 | r243517 | |
| 47 | 182 | |
| 48 | 183 | void alnchase_state::machine_start() |
| 49 | 184 | { |
| 185 | // zerofill |
| 186 | memset(m_vfd_state, 0, sizeof(m_vfd_state)); |
| 187 | m_input_mux = 0; |
| 188 | m_plate = 0; |
| 189 | m_grid = 0; |
| 190 | |
| 191 | // register for savestates |
| 192 | save_item(NAME(m_vfd_state)); |
| 193 | save_item(NAME(m_input_mux)); |
| 194 | save_item(NAME(m_plate)); |
| 195 | save_item(NAME(m_grid)); |
| 50 | 196 | } |
| 51 | 197 | |
| 52 | 198 | |
| r243516 | r243517 | |
| 54 | 200 | |
| 55 | 201 | /* basic machine hardware */ |
| 56 | 202 | MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) |
| 203 | MCFG_UCOM4_READ_A_CB(READ8(alnchase_state, input_r)) |
| 204 | MCFG_UCOM4_READ_B_CB(IOPORT("SW")) |
| 205 | MCFG_UCOM4_WRITE_C_CB(WRITE8(alnchase_state, display_w)) |
| 206 | MCFG_UCOM4_WRITE_D_CB(WRITE8(alnchase_state, display_w)) |
| 207 | MCFG_UCOM4_WRITE_E_CB(WRITE8(alnchase_state, port_e_w)) |
| 208 | MCFG_UCOM4_WRITE_F_CB(WRITE8(alnchase_state, display_w)) |
| 209 | MCFG_UCOM4_WRITE_G_CB(WRITE8(alnchase_state, display_w)) |
| 210 | MCFG_UCOM4_WRITE_H_CB(WRITE8(alnchase_state, display_w)) |
| 211 | MCFG_UCOM4_WRITE_I_CB(WRITE8(alnchase_state, display_w)) |
| 57 | 212 | |
| 58 | 213 | MCFG_DEFAULT_LAYOUT(layout_alnchase) |
| 59 | 214 | |
| r243516 | r243517 | |
| 79 | 234 | ROM_END |
| 80 | 235 | |
| 81 | 236 | |
| 82 | | CONS( 1984, alnchase, 0, 0, alnchase, alnchase, driver_device, 0, "Tomy", "Alien Chase", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) |
| 237 | CONS( 1984, alnchase, 0, 0, alnchase, alnchase, driver_device, 0, "Tomy", "Alien Chase", GAME_NOT_WORKING ) |