trunk/src/mame/drivers/mlanding.c
r22511 | r22512 | |
4 | 4 | |
5 | 5 | driver by Tomasz Slanina, Phil Bennett & Angelo Salese, based on early work by David Haywood |
6 | 6 | |
7 | | Dual 68k + 2xZ80 + tms DSP |
| 7 | Dual 68k + 2xZ80 + TMS32025 DSP |
| 8 | YM2151, msm5205 |
| 9 | TC0140SYT, other Taito ICs unknown |
8 | 10 | no other hardware info.. |
9 | 11 | |
10 | 12 | TODO: |
| 13 | - Analog controls are very stiff; |
11 | 14 | - Palette banking; |
12 | 15 | - Comms between the five CPUs; |
13 | | - Gameplay looks stiff; |
| 16 | - What is the unknown ROM ml_b0936 for?; |
| 17 | - Emulate 'mecha drive' (motors); |
14 | 18 | - Needs a custom artwork for the cloche status; |
15 | 19 | - clean-ups! |
16 | 20 | |
r22511 | r22512 | |
339 | 343 | m_mechacpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
340 | 344 | } |
341 | 345 | |
| 346 | |
342 | 347 | READ16_MEMBER(mlanding_state::ml_analog1_lsb_r) |
343 | 348 | { |
344 | | return ioport("STICKX")->read() & 0xff; |
| 349 | return ioport("STICK1")->read() & 0xff; |
345 | 350 | } |
346 | 351 | |
347 | 352 | READ16_MEMBER(mlanding_state::ml_analog2_lsb_r) |
348 | 353 | { |
349 | | return ioport("STICKY")->read() & 0xff; |
| 354 | return ioport("STICK2")->read() & 0xff; |
350 | 355 | } |
351 | 356 | |
352 | 357 | READ16_MEMBER(mlanding_state::ml_analog3_lsb_r) |
353 | 358 | { |
354 | | return (ioport("STICKZ")->read() & 0xff); |
| 359 | return ioport("STICK3")->read() & 0xff; |
355 | 360 | } |
356 | 361 | |
357 | | /* |
358 | | PORT_START("IN3") |
359 | | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) //high bits of counter 3 |
360 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_TOGGLE |
361 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Slot Down") PORT_TOGGLE |
362 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Slot Up") PORT_TOGGLE |
363 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
364 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
365 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
366 | | |
367 | | PORT_START("IN4") |
368 | | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) //high bits of counter 2 |
369 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_TOGGLE |
370 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_TOGGLE |
371 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_TOGGLE |
372 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
373 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
374 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
375 | | */ |
376 | | |
377 | 362 | /* high bits of analog inputs + "limiters"/ADC converters. */ |
378 | 363 | READ16_MEMBER(mlanding_state::ml_analog1_msb_r) |
379 | 364 | { |
380 | | return ((ioport("STICKY")->read() & 0xf00)>>8) | (ioport("IN2")->read() & 0xf0); |
| 365 | // d0-d3: counter 1 high bits |
| 366 | // d4: handle left |
| 367 | // d5: slot down |
| 368 | // d6: slot up |
| 369 | // d7: ? |
| 370 | UINT8 throttle = ioport("STICK1")->read(); |
| 371 | UINT16 x = ioport("STICK2")->read(); |
| 372 | |
| 373 | UINT8 res = 0xf0; |
| 374 | |
| 375 | if (throttle & 0x80) |
| 376 | res ^= 0x2f; |
| 377 | else if (throttle > 0) |
| 378 | res ^= 0x40; |
| 379 | |
| 380 | if (!(x & 0x800) && x > 0) |
| 381 | res ^= 0x10; |
| 382 | |
| 383 | return res; |
381 | 384 | } |
382 | 385 | |
383 | 386 | READ16_MEMBER(mlanding_state::ml_analog2_msb_r) |
384 | 387 | { |
385 | | UINT8 res; |
386 | | UINT16 y_adc,x_adc; |
387 | | |
388 | | y_adc = ioport("STICKY")->read(); |
389 | | x_adc = ioport("STICKZ")->read(); |
390 | | |
391 | | res = 0; |
392 | | |
393 | | if(x_adc == 0 || (!(x_adc & 0x800))) |
394 | | res = 0x20; |
395 | | |
396 | | if(y_adc == 0) |
397 | | res|= 0x50; |
398 | | else if(y_adc & 0x800) |
399 | | res|= 0x10; |
400 | | else |
401 | | res|= 0x40; |
402 | | |
403 | | // popmessage("%04x %04x",x_adc,y_adc); |
404 | | |
405 | | return ((ioport("STICKZ")->read() & 0xf00)>>8) | res; |
| 388 | // d0-d3: counter 2 high bits |
| 389 | // d4-d7: ? |
| 390 | return (ioport("STICK2")->read() >> 8 & 0x0f) | 0xf0; |
406 | 391 | } |
407 | 392 | |
408 | 393 | READ16_MEMBER(mlanding_state::ml_analog3_msb_r) |
409 | 394 | { |
410 | | UINT8 z_adc,res; |
411 | | UINT16 x_adc; |
| 395 | // d0-d3: counter 3 high bits |
| 396 | // d4: handle up |
| 397 | // d5: handle right |
| 398 | // d6: handle down |
| 399 | // d7: ? |
| 400 | UINT16 x = ioport("STICK2")->read(); |
| 401 | UINT16 y = ioport("STICK3")->read(); |
| 402 | |
| 403 | UINT8 res = (y >> 8 & 0x0f) | 0xf0; |
412 | 404 | |
413 | | z_adc = ioport("STICKX")->read(); |
414 | | x_adc = ioport("STICKZ")->read(); |
| 405 | if (y & 0x800) |
| 406 | res ^= 0x40; |
| 407 | else if (y > 0) |
| 408 | res ^= 0x10; |
| 409 | |
| 410 | if (x & 0x800) |
| 411 | res ^= 0x20; |
| 412 | |
| 413 | return res; |
| 414 | } |
415 | 415 | |
416 | | res = 0; |
417 | 416 | |
418 | | if(z_adc == 0) |
419 | | res = 0x60; |
420 | | else if(z_adc & 0x80) |
421 | | res = 0x20; |
422 | | else |
423 | | res = 0x40; |
424 | 417 | |
425 | | if(x_adc & 0x800 || x_adc == 0) |
426 | | res|= 0x10; |
427 | 418 | |
428 | | return ((ioport("STICKX")->read() & 0xf00)>>8) | res; |
429 | | } |
430 | | |
431 | | |
432 | 419 | READ16_MEMBER(mlanding_state::ml_power_ram_r) |
433 | 420 | { |
434 | 421 | return m_power_ram[offset * 2] << 8 | m_power_ram[offset * 2 + 1]; |
r22511 | r22512 | |
463 | 450 | AM_RANGE(0x290000, 0x290001) AM_READ_PORT("IN1") |
464 | 451 | AM_RANGE(0x290002, 0x290003) AM_READ_PORT("IN0") |
465 | 452 | |
466 | | AM_RANGE(0x240004, 0x240005) AM_NOP //watchdog ?? |
| 453 | AM_RANGE(0x240004, 0x240005) AM_READNOP // watchdog? |
467 | 454 | AM_RANGE(0x240006, 0x240007) AM_READ(io1_r) // vblank ? |
468 | 455 | AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(ml_output_w) |
469 | 456 | |
470 | | /* */ |
471 | | AM_RANGE(0x2b0000, 0x2b0001) AM_READ(ml_analog1_lsb_r) //-40 .. 40 analog controls ? |
472 | | AM_RANGE(0x2b0004, 0x2b0005) AM_READ(ml_analog2_lsb_r) //-40 .. 40 analog controls ? |
473 | | AM_RANGE(0x2b0006, 0x2b0007) AM_READ(ml_analog1_msb_r) // tested in service mode, dips? |
474 | | AM_RANGE(0x2c0000, 0x2c0001) AM_READ(ml_analog3_lsb_r) //-60 .. 60 analog controls ? |
475 | | AM_RANGE(0x2c0002, 0x2c0003) AM_READ(ml_analog2_msb_r) |
476 | | AM_RANGE(0x2b0002, 0x2b0003) AM_READ(ml_analog3_msb_r) // IN2/IN3 could be switched |
| 457 | AM_RANGE(0x2b0000, 0x2b0001) AM_READ(ml_analog1_lsb_r) |
| 458 | AM_RANGE(0x2b0002, 0x2b0003) AM_READ(ml_analog1_msb_r) |
| 459 | AM_RANGE(0x2b0004, 0x2b0005) AM_READ(ml_analog2_lsb_r) |
| 460 | AM_RANGE(0x2b0006, 0x2b0007) AM_READ(ml_analog2_msb_r) |
| 461 | |
| 462 | AM_RANGE(0x2c0000, 0x2c0001) AM_READ(ml_analog3_lsb_r) |
| 463 | AM_RANGE(0x2c0002, 0x2c0003) AM_READ(ml_analog3_msb_r) |
477 | 464 | ADDRESS_MAP_END |
478 | 465 | |
479 | 466 | |
r22511 | r22512 | |
671 | 658 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
672 | 659 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
673 | 660 | |
674 | | PORT_START("IN2") |
675 | | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) //high bits of counter 1 |
676 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
677 | | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
678 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
679 | | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
680 | | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
681 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
682 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
683 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
684 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
685 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
686 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
687 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 661 | PORT_START("STICK1") /* Stick 1 (3) */ |
| 662 | PORT_BIT( 0x00ff, 0x0000, IPT_AD_STICK_Z ) PORT_MINMAX(0x0080,0x007f) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x10) PORT_PLAYER(1) PORT_REVERSE |
688 | 663 | |
689 | | PORT_START("IN3") |
690 | | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) //high bits of counter 3 |
691 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_TOGGLE |
692 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Slot Down") PORT_TOGGLE |
693 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Slot Up") PORT_TOGGLE |
694 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
695 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
696 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 664 | PORT_START("STICK2") /* Stick 2 (4) */ |
| 665 | PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_X ) PORT_MINMAX(0x0800,0x07ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x80) PORT_PLAYER(1) |
697 | 666 | |
698 | | PORT_START("IN4") |
699 | | PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) //high bits of counter 2 |
700 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_TOGGLE |
701 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_TOGGLE |
702 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_TOGGLE |
703 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
704 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
705 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
706 | | |
707 | | PORT_START("STICKX") /* Stick 1 (3) */ |
708 | | PORT_BIT( 0x00ff, 0x0000, IPT_AD_STICK_Z ) PORT_MINMAX(0x0080,0x007f) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_REVERSE |
709 | | |
710 | | PORT_START("STICKY") /* Stick 2 (4) */ |
711 | | PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_Y ) PORT_MINMAX(0x0800,0x07ff) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1) |
712 | | |
713 | | PORT_START("STICKZ") /* Stick 3 (5) */ |
714 | | PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_X ) PORT_MINMAX(0x0800,0x07ff) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1) |
| 667 | PORT_START("STICK3") /* Stick 3 (5) */ |
| 668 | PORT_BIT( 0x0fff, 0x0000, IPT_AD_STICK_Y ) PORT_MINMAX(0x0800,0x07ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(0x80) PORT_PLAYER(1) |
715 | 669 | INPUT_PORTS_END |
716 | 670 | |
717 | 671 | static const msm5205_interface msm5205_config = |