trunk/src/mame/drivers/kenseim.c
| r30814 | r30815 | |
| 138 | 138 | |
| 139 | 139 | DECLARE_WRITE8_MEMBER(i8255_portc_w); // 20x LEDs |
| 140 | 140 | |
| 141 | // likely |
| 142 | |
| 143 | DECLARE_READ8_MEMBER(i8255_portd_r); // mole input 1? |
| 144 | DECLARE_READ8_MEMBER(i8255_porte_r); // mole input 2? |
| 145 | |
| 141 | 146 | // uncertain |
| 142 | | |
| 143 | | // DECLARE_READ8_MEMBER(portc_default_r) { logerror("%s read port C but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 147 | DECLARE_WRITE8_MEMBER(portc_w); |
| 148 | DECLARE_WRITE8_MEMBER(portd_w); |
| 144 | 149 | DECLARE_READ8_MEMBER(portc_r); |
| 145 | | // DECLARE_READ8_MEMBER(portd_default_r) { logerror("%s read port D but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 146 | 150 | DECLARE_READ8_MEMBER(portd_r); |
| 151 | DECLARE_WRITE8_MEMBER(porte_w); |
| 152 | |
| 153 | WRITE8_MEMBER(i8255_porta_w); // maybe molesa output? (6-bits?) |
| 154 | WRITE8_MEMBER(i8255_portb_w); // maybe molesb output? (6-bits?) |
| 155 | WRITE8_MEMBER(i8255_portf_w); // maybe strobe output? |
| 156 | |
| 147 | 157 | DECLARE_READ8_MEMBER(porte_default_r) { logerror("%s read port E but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 148 | 158 | |
| 149 | 159 | DECLARE_WRITE8_MEMBER(porta_default_w) { logerror("%s write %02x to port A but no handler assigned\n", machine().describe_context(), data); } |
| 150 | 160 | DECLARE_WRITE8_MEMBER(portb_default_w) { logerror("%s write %02x to port B but no handler assigned\n", machine().describe_context(), data); } |
| 151 | | // DECLARE_WRITE8_MEMBER(portc_default_w) { logerror("%s write %02x to port C but no handler assigned\n", machine().describe_context(), data); } |
| 152 | | DECLARE_WRITE8_MEMBER(portc_w); |
| 153 | | // DECLARE_WRITE8_MEMBER(portd_default_w) { logerror("%s write %02x to port D but no handler assigned\n", machine().describe_context(), data); } |
| 154 | | DECLARE_WRITE8_MEMBER(portd_w); |
| 155 | | DECLARE_WRITE8_MEMBER(porte_default_w) { logerror("%s write %02x to port E but no handler assigned\n", machine().describe_context(), data); } |
| 156 | 161 | |
| 162 | |
| 163 | |
| 157 | 164 | DECLARE_READ8_MEMBER(i8255_porta_default_r) { logerror("%s i8255 read port A but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 158 | 165 | DECLARE_READ8_MEMBER(i8255_portb_default_r) { logerror("%s i8255 read port B but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 159 | 166 | DECLARE_READ8_MEMBER(i8255_portc_default_r) { logerror("%s i8255 read port C but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 160 | 167 | |
| 161 | | DECLARE_WRITE8_MEMBER(i8255_porta_default_w) { logerror("%s i8255 write %02x to port A but no handler assigned\n", machine().describe_context(), data); } // maybe molesa output? (6-bits?) |
| 162 | | DECLARE_WRITE8_MEMBER(i8255_portb_default_w) { logerror("%s i8255 write %02x to port B but no handler assigned\n", machine().describe_context(), data); } // maybe molesb output? (6-bits?) |
| 163 | 168 | |
| 164 | | DECLARE_READ8_MEMBER(i8255_portd_default_r) { logerror("%s i8255 read port D but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 165 | | DECLARE_READ8_MEMBER(i8255_porte_default_r) { logerror("%s i8255 read port E but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 166 | 169 | DECLARE_READ8_MEMBER(i8255_portf_default_r) { logerror("%s i8255 read port F but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 167 | 170 | |
| 168 | 171 | DECLARE_WRITE8_MEMBER(i8255_portd_default_w) { logerror("%s i8255 write %02x to port D but no handler assigned\n", machine().describe_context(), data); } |
| 169 | 172 | DECLARE_WRITE8_MEMBER(i8255_porte_default_w) { logerror("%s i8255 write %02x to port E but no handler assigned\n", machine().describe_context(), data); } |
| 170 | | DECLARE_WRITE8_MEMBER(i8255_portf_default_w) { logerror("%s i8255 write %02x to port F but no handler assigned\n", machine().describe_context(), data); } |
| 171 | 173 | |
| 172 | 174 | |
| 173 | 175 | UINT32 m_led_serial_data; |
| r30814 | r30815 | |
| 220 | 222 | |
| 221 | 223 | } |
| 222 | 224 | |
| 225 | // i8255 ports D and E tend to be used together in the code, and the input gets masked with 6 bits (0x3f) |
| 226 | READ8_MEMBER(kenseim_state::i8255_portd_r) |
| 227 | { |
| 228 | logerror("%s i8255 read port D (mole matrix / sensors input 1?)\n", machine().describe_context()); |
| 229 | //return 0xff; |
| 230 | return rand();// 0x00; |
| 231 | } |
| 232 | |
| 233 | READ8_MEMBER(kenseim_state::i8255_porte_r) |
| 234 | { |
| 235 | logerror("%s i8255 read port E (mole matrix / sensors input 2?)\n", machine().describe_context()); |
| 236 | //return 0xff; |
| 237 | return rand();// 0x00; |
| 238 | } |
| 239 | |
| 240 | WRITE8_MEMBER(kenseim_state::i8255_porta_w) // maybe molesa output? (6-bits?) |
| 241 | { |
| 242 | logerror("%s i8255 write %02x to port A (mole output 1?)\n", machine().describe_context(), data); |
| 243 | } |
| 244 | |
| 245 | WRITE8_MEMBER(kenseim_state::i8255_portb_w) // maybe molesb output? (6-bits?) |
| 246 | { |
| 247 | logerror("%s i8255 write %02x to port B (mole output 2?)\n", machine().describe_context(), data); |
| 248 | } |
| 249 | |
| 250 | WRITE8_MEMBER(kenseim_state::i8255_portf_w) |
| 251 | { |
| 252 | // typically written when the 'moles' output is, maybe the 2 strobes? |
| 253 | logerror("%s i8255 write %02x to port F (strobe?)\n", machine().describe_context(), data); |
| 254 | } |
| 255 | |
| 256 | |
| 223 | 257 | WRITE8_MEMBER(kenseim_state::portc_w) |
| 224 | 258 | { |
| 225 | 259 | logerror("%s write %02x to port C\n", machine().describe_context(), data); |
| r30814 | r30815 | |
| 230 | 264 | logerror("%s write %02x to port D\n", machine().describe_context(), data); |
| 231 | 265 | } |
| 232 | 266 | |
| 267 | WRITE8_MEMBER(kenseim_state::porte_w) |
| 268 | { |
| 269 | // only access is at 0ABE, surrounded by port D reads / writes |
| 270 | logerror("%s write %02x to port E\n", machine().describe_context(), data); |
| 271 | } |
| 233 | 272 | |
| 234 | | |
| 235 | 273 | READ8_MEMBER(kenseim_state::portd_r) |
| 236 | 274 | { |
| 237 | 275 | // comms port maybe? checks for 0x10 (bit 4,a) to be clear in a tight loop (092B) then for bit 0x80 to be set in another tight loop (0933) then at (0947) it checks that bits 0xe0 aren't set. |
| r30814 | r30815 | |
| 282 | 320 | |
| 283 | 321 | data >>= 8;; |
| 284 | 322 | |
| 285 | | logerror("%s cps1_kensei_w offs %04x, %02x (from 68k?)\n", machine().describe_context(), offset * 2, data); |
| 323 | logerror("%s cps1_kensei_w offs %04x (from 68k to DRIVE BOARD via CN2) (%02x) (%d ACK, %d ST4, %d ST3, %d ST2) \n", machine().describe_context(), offset * 2, data, (data & 0x01), ((data & 0x02)>>1),((data & 0x04)>>2),((data & 0x08)>>3) ); |
| 286 | 324 | |
| 287 | | if ((data != 0x02) && (data != 0x03) && (data != 0x04) && (data != 0x05) && (data != 0x83)) |
| 288 | | logerror(" ^^ (unknown?)\n"); |
| 325 | |
| 326 | if (data & 0xf0) |
| 327 | logerror(" ^^ (unknown? %02x)\n", data & 0xf0); |
| 289 | 328 | } |
| 290 | 329 | else |
| 291 | 330 | { |
| r30814 | r30815 | |
| 411 | 450 | togglecount++; |
| 412 | 451 | |
| 413 | 452 | |
| 414 | | |
| 415 | 453 | int in = 0x00; |
| 416 | | in |= 0x40; // don't want cps1 test mode (leftover) |
| 454 | in |= 0x40; // don't want cps1 test mode (leftover) (not connected) |
| 417 | 455 | |
| 456 | in |= 0x04;// line D9 |
| 457 | |
| 418 | 458 | if (togglecount == 3) |
| 419 | 459 | { |
| 420 | | in |= 0x10; // won't read commands otherwise? |
| 460 | in |= 0x10; // won't read commands otherwise? (REQ line) |
| 421 | 461 | togglecount = 0; |
| 422 | 462 | } |
| 423 | 463 | |
| 424 | 464 | |
| 425 | | //in |= 0x20; |
| 465 | //in |= 0x20; // LVm line |
| 426 | 466 | |
| 427 | 467 | logerror("%s kensei_dsw_r offs %04x (comms?), (%04x) (returning %02x)\n", machine().describe_context(), offset *2, mem_mask, in); |
| 428 | 468 | |
| r30814 | r30815 | |
| 438 | 478 | MCFG_CPU_ADD("gamecpu", TMPZ84C011, XTAL_16MHz/2) // tmpz84c011 - divider unknown |
| 439 | 479 | MCFG_CPU_PROGRAM_MAP(kenseim_map) |
| 440 | 480 | MCFG_CPU_IO_MAP(kenseim_io_map) |
| 441 | | MCFG_TMPZ84C011_PORTA_WRITE_CALLBACK(WRITE8(kenseim_state, porta_default_w)) |
| 442 | | MCFG_TMPZ84C011_PORTB_WRITE_CALLBACK(WRITE8(kenseim_state, portb_default_w)) |
| 481 | MCFG_TMPZ84C011_PORTA_WRITE_CALLBACK(WRITE8(kenseim_state, porta_default_w)) // unused? |
| 482 | MCFG_TMPZ84C011_PORTB_WRITE_CALLBACK(WRITE8(kenseim_state, portb_default_w)) // unused? |
| 443 | 483 | MCFG_TMPZ84C011_PORTC_WRITE_CALLBACK(WRITE8(kenseim_state, portc_w)) |
| 444 | 484 | MCFG_TMPZ84C011_PORTD_WRITE_CALLBACK(WRITE8(kenseim_state, portd_w)) |
| 445 | | MCFG_TMPZ84C011_PORTE_WRITE_CALLBACK(WRITE8(kenseim_state, porte_default_w)) |
| 485 | MCFG_TMPZ84C011_PORTE_WRITE_CALLBACK(WRITE8(kenseim_state, porte_w)) |
| 446 | 486 | MCFG_TMPZ84C011_PORTA_READ_CALLBACK(READ8(kenseim_state, porta_r)) |
| 447 | 487 | MCFG_TMPZ84C011_PORTB_READ_CALLBACK(READ8(kenseim_state, portb_r)) |
| 448 | 488 | MCFG_TMPZ84C011_PORTC_READ_CALLBACK(READ8(kenseim_state, portc_r)) |
| 449 | 489 | MCFG_TMPZ84C011_PORTD_READ_CALLBACK(READ8(kenseim_state, portd_r)) |
| 450 | | MCFG_TMPZ84C011_PORTE_READ_CALLBACK(READ8(kenseim_state, porte_default_r)) |
| 490 | MCFG_TMPZ84C011_PORTE_READ_CALLBACK(READ8(kenseim_state, porte_default_r)) // unused? |
| 451 | 491 | MCFG_CPU_CONFIG(daisy_chain_gamecpu) |
| 452 | 492 | |
| 453 | 493 | MCFG_DEVICE_ADD("gamecpu_ctc", Z80CTC, XTAL_16MHz/2 ) // part of the tmpz84? |
| r30814 | r30815 | |
| 458 | 498 | MCFG_I8255_IN_PORTA_CB(READ8(kenseim_state, i8255_porta_default_r)) |
| 459 | 499 | MCFG_I8255_IN_PORTB_CB(READ8(kenseim_state, i8255_portb_default_r)) |
| 460 | 500 | MCFG_I8255_IN_PORTC_CB(READ8(kenseim_state, i8255_portc_default_r)) |
| 461 | | MCFG_I8255_OUT_PORTA_CB(WRITE8(kenseim_state, i8255_porta_default_w)) |
| 462 | | MCFG_I8255_OUT_PORTB_CB(WRITE8(kenseim_state, i8255_portb_default_w)) |
| 501 | MCFG_I8255_OUT_PORTA_CB(WRITE8(kenseim_state, i8255_porta_w)) |
| 502 | MCFG_I8255_OUT_PORTB_CB(WRITE8(kenseim_state, i8255_portb_w)) |
| 463 | 503 | MCFG_I8255_OUT_PORTC_CB(WRITE8(kenseim_state, i8255_portc_w)) |
| 464 | 504 | |
| 465 | 505 | MCFG_DEVICE_ADD("i8255_2", I8255, 0) // MB89363B! |
| 466 | | MCFG_I8255_IN_PORTA_CB(READ8(kenseim_state, i8255_portd_default_r)) |
| 467 | | MCFG_I8255_IN_PORTB_CB(READ8(kenseim_state, i8255_porte_default_r)) |
| 506 | MCFG_I8255_IN_PORTA_CB(READ8(kenseim_state, i8255_portd_r)) |
| 507 | MCFG_I8255_IN_PORTB_CB(READ8(kenseim_state, i8255_porte_r)) |
| 468 | 508 | MCFG_I8255_IN_PORTC_CB(READ8(kenseim_state, i8255_portf_default_r)) |
| 469 | 509 | MCFG_I8255_OUT_PORTA_CB(WRITE8(kenseim_state, i8255_portd_default_w)) |
| 470 | 510 | MCFG_I8255_OUT_PORTB_CB(WRITE8(kenseim_state, i8255_porte_default_w)) |
| 471 | | MCFG_I8255_OUT_PORTC_CB(WRITE8(kenseim_state, i8255_portf_default_w)) |
| 511 | MCFG_I8255_OUT_PORTC_CB(WRITE8(kenseim_state, i8255_portf_w)) |
| 472 | 512 | |
| 473 | 513 | |
| 474 | 514 | MCFG_QUANTUM_PERFECT_CPU("maincpu") |
| 475 | 515 | MACHINE_CONFIG_END |
| 476 | 516 | |
| 517 | /* how the DRIVE PCB connects to the inputs, see comments after each line |
| 477 | 518 | |
| 519 | PORT_START("IN0") |
| 520 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) // n/c |
| 521 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) // n/c |
| 522 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) // D9 |
| 523 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c? |
| 524 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) // REQ |
| 525 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) // LVm |
| 526 | PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) // n/c |
| 527 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c? |
| 528 | |
| 529 | PORT_START("IN1") |
| 530 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) // D5 |
| 531 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) // D6 |
| 532 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) // D7 |
| 533 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) // D8 |
| 534 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // n/c |
| 535 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // n/c |
| 536 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) // n/c |
| 537 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c? |
| 538 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) // D1 |
| 539 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) // D2 |
| 540 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) // D3 |
| 541 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) // D4 |
| 542 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) // n/c |
| 543 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) // n/c |
| 544 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) // n/c |
| 545 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c? |
| 546 | */ |
| 547 | |
| 478 | 548 | static INPUT_PORTS_START( kenseim ) |
| 479 | 549 | // the regular CPS1 input ports are used for comms with the extra board |
| 480 | 550 | PORT_START("IN0") |