trunk/src/mess/drivers/hh_melps4.c
| r248491 | r248492 | |
| 36 | 36 | UINT16 m_inp_mux; // multiplexed inputs mask |
| 37 | 37 | |
| 38 | 38 | UINT8 read_inputs(int columns); |
| 39 | DECLARE_INPUT_CHANGED_MEMBER(reset_button); |
| 39 | 40 | |
| 40 | 41 | // display common |
| 41 | 42 | int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) |
| r248491 | r248492 | |
| 188 | 189 | } |
| 189 | 190 | |
| 190 | 191 | |
| 192 | // generic input handlers |
| 193 | |
| 191 | 194 | UINT8 hh_melps4_state::read_inputs(int columns) |
| 192 | 195 | { |
| 193 | 196 | UINT8 ret = 0; |
| r248491 | r248492 | |
| 200 | 203 | return ret; |
| 201 | 204 | } |
| 202 | 205 | |
| 206 | INPUT_CHANGED_MEMBER(hh_melps4_state::reset_button) |
| 207 | { |
| 208 | // for when reset button is directly tied to MCU reset pin |
| 209 | m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); |
| 210 | } |
| 203 | 211 | |
| 204 | 212 | |
| 213 | |
| 205 | 214 | /*************************************************************************** |
| 206 | 215 | |
| 207 | 216 | Minidrivers (subclass, I/O, Inputs, Machine Config) |
| r248491 | r248492 | |
| 231 | 240 | DECLARE_WRITE16_MEMBER(grid_w); |
| 232 | 241 | DECLARE_WRITE_LINE_MEMBER(speaker_w); |
| 233 | 242 | DECLARE_READ16_MEMBER(input_r); |
| 234 | | |
| 235 | | DECLARE_INPUT_CHANGED_MEMBER(reset_button); |
| 236 | 243 | }; |
| 237 | 244 | |
| 238 | 245 | // handlers |
| r248491 | r248492 | |
| 246 | 253 | |
| 247 | 254 | WRITE8_MEMBER(cfrogger_state::plate_w) |
| 248 | 255 | { |
| 256 | // F0,F1: input mux |
| 257 | if (offset == MELPS4_PORTF) |
| 258 | m_inp_mux = data & 3; |
| 259 | |
| 249 | 260 | // Sx,Fx,Gx: vfd matrix plate |
| 250 | 261 | int mask = (offset == MELPS4_PORTS) ? 0xff : 0xf; // port S is 8-bit |
| 251 | 262 | int shift = (offset == MELPS4_PORTS) ? 0 : (offset + 1) * 4; |
| 252 | 263 | m_plate = (m_plate & ~(mask << shift)) | (data << shift); |
| 253 | 264 | prepare_display(); |
| 254 | | |
| 255 | | // F0,F1: input mux |
| 256 | | m_inp_mux = m_plate >> 8 & 3; |
| 257 | 265 | } |
| 258 | 266 | |
| 259 | 267 | WRITE16_MEMBER(cfrogger_state::grid_w) |
| r248491 | r248492 | |
| 281 | 289 | // config |
| 282 | 290 | |
| 283 | 291 | static INPUT_PORTS_START( cfrogger ) |
| 284 | | PORT_START("IN.0") // F0 port K |
| 292 | PORT_START("IN.0") // F0 port K0,K1 |
| 285 | 293 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) |
| 286 | 294 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) |
| 287 | 295 | |
| 288 | | PORT_START("IN.1") // F1 port K |
| 296 | PORT_START("IN.1") // F1 port K0,K1 |
| 289 | 297 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) |
| 290 | 298 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) |
| 291 | 299 | |
| r248491 | r248492 | |
| 295 | 303 | PORT_CONFSETTING( 0x08, "2" ) |
| 296 | 304 | |
| 297 | 305 | PORT_START("IN.3") // fake |
| 298 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, cfrogger_state, reset_button, NULL) |
| 306 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_melps4_state, reset_button, NULL) |
| 299 | 307 | INPUT_PORTS_END |
| 300 | 308 | |
| 301 | | INPUT_CHANGED_MEMBER(cfrogger_state::reset_button) |
| 302 | | { |
| 303 | | // reset button is directly tied to MCU reset pin |
| 304 | | m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); |
| 305 | | } |
| 306 | | |
| 307 | | |
| 308 | 309 | static MACHINE_CONFIG_START( cfrogger, cfrogger_state ) |
| 309 | 310 | |
| 310 | 311 | /* basic machine hardware */ |
| r248491 | r248492 | |
| 333 | 334 | |
| 334 | 335 | /*************************************************************************** |
| 335 | 336 | |
| 337 | Gakken Jungler (manufactured in Japan) |
| 338 | * PCB label Konami Gakken GR503 |
| 339 | * Mitsubishi M58846-702P MCU |
| 340 | * cyan/red/green VFD display Itron CP5143GLR SGA, with light-yellow color overlay |
| 341 | |
| 342 | NOTE!: MESS external artwork is recommended |
| 343 | |
| 344 | ***************************************************************************/ |
| 345 | |
| 346 | class gjungler_state : public hh_melps4_state |
| 347 | { |
| 348 | public: |
| 349 | gjungler_state(const machine_config &mconfig, device_type type, const char *tag) |
| 350 | : hh_melps4_state(mconfig, type, tag) |
| 351 | { } |
| 352 | |
| 353 | void prepare_display(); |
| 354 | DECLARE_WRITE8_MEMBER(plate_w); |
| 355 | DECLARE_WRITE16_MEMBER(grid_w); |
| 356 | DECLARE_WRITE_LINE_MEMBER(speaker_w); |
| 357 | DECLARE_READ16_MEMBER(input_r); |
| 358 | }; |
| 359 | |
| 360 | // handlers |
| 361 | |
| 362 | void gjungler_state::prepare_display() |
| 363 | { |
| 364 | UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0,1); |
| 365 | UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,8,9,10,11,17,16,15,14,13,12,0,7,1,6,2,5,3,4); |
| 366 | display_matrix(18, 12, plate, grid); |
| 367 | } |
| 368 | |
| 369 | WRITE8_MEMBER(gjungler_state::plate_w) |
| 370 | { |
| 371 | // G0,G1: input mux |
| 372 | if (offset == MELPS4_PORTG) |
| 373 | m_inp_mux = data & 3; |
| 374 | |
| 375 | // Sx,Fx,Gx,U: vfd matrix plate |
| 376 | int mask = (offset == MELPS4_PORTS) ? 0xff : 0xf; // port S is 8-bit |
| 377 | int shift = (offset == MELPS4_PORTS) ? 0 : (offset + 1) * 4; |
| 378 | m_plate = (m_plate & ~(mask << shift)) | (data << shift); |
| 379 | prepare_display(); |
| 380 | } |
| 381 | |
| 382 | WRITE16_MEMBER(gjungler_state::grid_w) |
| 383 | { |
| 384 | // D0-D11: vfd matrix grid |
| 385 | m_grid = data; |
| 386 | prepare_display(); |
| 387 | } |
| 388 | |
| 389 | WRITE_LINE_MEMBER(gjungler_state::speaker_w) |
| 390 | { |
| 391 | // T: speaker out |
| 392 | m_speaker->level_w(state); |
| 393 | } |
| 394 | |
| 395 | READ16_MEMBER(gjungler_state::input_r) |
| 396 | { |
| 397 | // K0,K1: multiplexed inputs |
| 398 | // K2,K3: fixed inputs |
| 399 | return (m_inp_matrix[2]->read() & 0xc) | (read_inputs(2) & 3); |
| 400 | } |
| 401 | |
| 402 | |
| 403 | // config |
| 404 | |
| 405 | static INPUT_PORTS_START( gjungler ) |
| 406 | PORT_START("IN.0") // G0 port K0,K1 |
| 407 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) |
| 408 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) |
| 409 | |
| 410 | PORT_START("IN.1") // G1 port K0,K1 |
| 411 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) |
| 412 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) |
| 413 | |
| 414 | PORT_START("IN.2") // K2,K3 |
| 415 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) |
| 416 | PORT_CONFNAME( 0x08, 0x00, "Game Mode" ) |
| 417 | PORT_CONFSETTING( 0x00, "A" ) |
| 418 | PORT_CONFSETTING( 0x08, "B" ) |
| 419 | |
| 420 | PORT_START("IN.3") // fake |
| 421 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_melps4_state, reset_button, NULL) |
| 422 | INPUT_PORTS_END |
| 423 | |
| 424 | static MACHINE_CONFIG_START( gjungler, gjungler_state ) |
| 425 | |
| 426 | /* basic machine hardware */ |
| 427 | MCFG_CPU_ADD("maincpu", M58846, XTAL_600kHz) |
| 428 | MCFG_MELPS4_READ_K_CB(READ16(gjungler_state, input_r)) |
| 429 | MCFG_MELPS4_WRITE_S_CB(WRITE8(gjungler_state, plate_w)) |
| 430 | MCFG_MELPS4_WRITE_F_CB(WRITE8(gjungler_state, plate_w)) |
| 431 | MCFG_MELPS4_WRITE_G_CB(WRITE8(gjungler_state, plate_w)) |
| 432 | MCFG_MELPS4_WRITE_U_CB(WRITE8(gjungler_state, plate_w)) |
| 433 | MCFG_MELPS4_WRITE_D_CB(WRITE16(gjungler_state, grid_w)) |
| 434 | MCFG_MELPS4_WRITE_T_CB(WRITELINE(gjungler_state, speaker_w)) |
| 435 | |
| 436 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_melps4_state, display_decay_tick, attotime::from_msec(1)) |
| 437 | MCFG_DEFAULT_LAYOUT(layout_hh_melps4_test) |
| 438 | |
| 439 | /* no video! */ |
| 440 | |
| 441 | /* sound hardware */ |
| 442 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 443 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| 444 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 445 | MACHINE_CONFIG_END |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | |
| 451 | /*************************************************************************** |
| 452 | |
| 336 | 453 | Game driver(s) |
| 337 | 454 | |
| 338 | 455 | ***************************************************************************/ |
| r248491 | r248492 | |
| 343 | 460 | ROM_END |
| 344 | 461 | |
| 345 | 462 | |
| 463 | ROM_START( gjungler ) |
| 464 | ROM_REGION( 0x1000, "maincpu", 0 ) |
| 465 | ROM_LOAD( "m58846-702p", 0x0000, 0x1000, CRC(94ab7060) SHA1(3389bc115d1df8d01a30611fa9e95a900d32b29b) ) |
| 466 | ROM_END |
| 346 | 467 | |
| 468 | |
| 469 | |
| 347 | 470 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ |
| 348 | 471 | CONS( 1981, cfrogger, 0, 0, cfrogger, cfrogger, driver_device, 0, "Coleco", "Frogger (Coleco)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK ) |
| 472 | |
| 473 | CONS( 1982, gjungler, 0, 0, gjungler, gjungler, driver_device, 0, "Gakken / Konami", "Jungler (Gakken)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK | GAME_NOT_WORKING ) |