trunk/src/mess/drivers/hh_hmcs40.c
| r244802 | r244803 | |
| 31 | 31 | |
| 32 | 32 | // devices |
| 33 | 33 | required_device<cpu_device> m_maincpu; |
| 34 | | optional_ioport_array<3> m_inp_matrix; // max 3 |
| 34 | optional_ioport_array<7> m_inp_matrix; // max 7 |
| 35 | 35 | optional_device<speaker_sound_device> m_speaker; |
| 36 | 36 | |
| 37 | 37 | // misc common |
| 38 | 38 | UINT16 m_inp_mux; |
| 39 | 39 | |
| 40 | | UINT8 read_inputs(int columns); |
| 40 | UINT16 read_inputs(int columns); |
| 41 | 41 | |
| 42 | 42 | virtual void machine_start(); |
| 43 | 43 | |
| r244802 | r244803 | |
| 59 | 59 | void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); |
| 60 | 60 | |
| 61 | 61 | // game-specific handlers |
| 62 | DECLARE_WRITE8_MEMBER(alnattck_plate_w); |
| 63 | DECLARE_READ16_MEMBER(alnattck_d_r); |
| 64 | DECLARE_WRITE16_MEMBER(alnattck_d_w); |
| 62 | 65 | }; |
| 63 | 66 | |
| 64 | 67 | |
| r244802 | r244803 | |
| 160 | 163 | } |
| 161 | 164 | |
| 162 | 165 | |
| 163 | | UINT8 hh_hmcs40_state::read_inputs(int columns) |
| 166 | UINT16 hh_hmcs40_state::read_inputs(int columns) |
| 164 | 167 | { |
| 165 | | UINT8 ret = 0; |
| 168 | UINT16 ret = 0; |
| 166 | 169 | |
| 167 | 170 | // read selected input rows |
| 168 | 171 | for (int i = 0; i < columns; i++) |
| r244802 | r244803 | |
| 190 | 193 | |
| 191 | 194 | ***************************************************************************/ |
| 192 | 195 | |
| 196 | WRITE8_MEMBER(hh_hmcs40_state::alnattck_plate_w) |
| 197 | { |
| 198 | // R0x-R3x, D0-D3: vfd matrix plate |
| 199 | int shift = offset * 4; |
| 200 | m_plate = (m_plate & ~(0xf << shift)) | (data << shift); |
| 201 | |
| 202 | // update display |
| 203 | UINT32 plate = BITSWAP16((UINT16)m_plate,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15) | (m_plate & 0xf0000); |
| 204 | |
| 205 | display_matrix(20, 10, plate, m_grid); |
| 206 | } |
| 207 | |
| 208 | READ16_MEMBER(hh_hmcs40_state::alnattck_d_r) |
| 209 | { |
| 210 | // D5: inputs |
| 211 | return (offset == 5) ? (read_inputs(7) << 5 & 0x20) : 0; |
| 212 | } |
| 213 | |
| 214 | WRITE16_MEMBER(hh_hmcs40_state::alnattck_d_w) |
| 215 | { |
| 216 | // D4: speaker out |
| 217 | m_speaker->level_w(data >> 4 & 1); |
| 218 | |
| 219 | // D7-D13: input mux |
| 220 | m_inp_mux = data >> 7 & 0x7f; |
| 221 | |
| 222 | // D6-D15: vfd matrix grid |
| 223 | m_grid = data >> 6 & 0x3ff; |
| 224 | |
| 225 | // D0-D3: plate 16-19 (update display there) |
| 226 | alnattck_plate_w(space, 4, data & 0xf); |
| 227 | } |
| 228 | |
| 229 | |
| 193 | 230 | static INPUT_PORTS_START( alnattck ) |
| 231 | PORT_START("IN.0") // D5 D7 |
| 232 | PORT_CONFNAME( 0x01, 0x00, "Skill" ) |
| 233 | PORT_CONFSETTING( 0x00, "1" ) |
| 234 | PORT_CONFSETTING( 0x01, "2" ) |
| 235 | |
| 236 | PORT_START("IN.1") // D5 D8 |
| 237 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) |
| 238 | |
| 239 | PORT_START("IN.2") // D5 D9 |
| 240 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) |
| 241 | |
| 242 | PORT_START("IN.3") // D5 D10 |
| 243 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) |
| 244 | |
| 245 | PORT_START("IN.4") // D5 D11 |
| 246 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) |
| 247 | |
| 248 | PORT_START("IN.5") // D5 D12 |
| 249 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Move") |
| 250 | |
| 251 | PORT_START("IN.6") // D5 D13 |
| 252 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Fire") |
| 194 | 253 | INPUT_PORTS_END |
| 195 | 254 | |
| 196 | 255 | |
| r244802 | r244803 | |
| 199 | 258 | /* basic machine hardware */ |
| 200 | 259 | MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. |
| 201 | 260 | |
| 202 | | // MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) |
| 261 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) |
| 203 | 262 | MCFG_DEFAULT_LAYOUT(layout_alnattck) |
| 204 | 263 | |
| 205 | 264 | /* no video! */ |