Previous 199869 Revisions Next

r30871 Friday 6th June, 2014 at 23:43:19 UTC by hap
fixed comms, attract mode works now
[src/mame/drivers]kenseim.c

trunk/src/mame/drivers/kenseim.c
r30870r30871
185185   WRITE8_MEMBER(i8255_portb_w); // maybe molesb output? (6-bits?)
186186   WRITE8_MEMBER(i8255_portf_w); // maybe strobe output?
187187
188
189   DECLARE_READ8_MEMBER(i8255_porta_default_r) { logerror("%s i8255 read port A but no handler assigned\n", machine().describe_context()); return 0xff; }
190   DECLARE_READ8_MEMBER(i8255_portb_default_r) { logerror("%s i8255 read port B but no handler assigned\n", machine().describe_context()); return 0xff; }
191   DECLARE_READ8_MEMBER(i8255_portc_default_r) { logerror("%s i8255 read port C but no handler assigned\n", machine().describe_context()); return 0xff; }
192
193
194   DECLARE_READ8_MEMBER(i8255_portf_default_r) { logerror("%s i8255 read port F but no handler assigned\n", machine().describe_context()); return 0xff; }
195
196   DECLARE_WRITE8_MEMBER(i8255_portd_default_w) { logerror("%s i8255 write %02x to port D but no handler assigned\n", machine().describe_context(), data); }
197   DECLARE_WRITE8_MEMBER(i8255_porte_default_w) { logerror("%s i8255 write %02x to port E but no handler assigned\n", machine().describe_context(), data); }
198
199
200188   // unused based on port direction assignments
201189   //DECLARE_READ8_MEMBER(porte_default_r) { logerror("%s read port E but no handler assigned\n", machine().describe_context()); return 0xff; }
202190   //DECLARE_WRITE8_MEMBER(porta_default_w) { logerror("%s write %02x to port A but no handler assigned\n", machine().describe_context(), data); }
r30870r30871
207195   UINT8 m_to_68k_cmd_req;
208196   UINT8 m_to_68k_cmd_LVm;
209197   
210   UINT8 m_to_68k_cmd_flags;
211198
212199   int m_from68k_ack;
213200   int m_from68k_st4;
r30870r30871
279266// i8255 ports D and E tend to be used together in the code, and the input gets masked with 6 bits (0x3f)
280267READ8_MEMBER(kenseim_state::i8255_portd_r)
281268{
269   return 0xff;
270   
282271   logerror("%s i8255 read port D (mole matrix / sensors input 1?)\n", machine().describe_context());
283272   static int i = 0;
284273   i++;
r30870r30871
290279
291280READ8_MEMBER(kenseim_state::i8255_porte_r)
292281{
282   return 0xff;
283   
293284   logerror("%s i8255 read port E (mole matrix / sensors input 2?)\n", machine().describe_context());
294285   static int i = 0;
295286   i++;
r30870r30871
301292
302293WRITE8_MEMBER(kenseim_state::i8255_porta_w) // maybe molesa output? (6-bits?)
303294{
304   logerror("%s i8255 write %02x to port A (mole output 1?)\n", machine().describe_context(), data);
295   //logerror("%s i8255 write %02x to port A (mole output 1?)\n", machine().describe_context(), data);
305296}
306297
307298WRITE8_MEMBER(kenseim_state::i8255_portb_w) // maybe molesb output? (6-bits?)
308299{
309   logerror("%s i8255 write %02x to port B (mole output 2?)\n", machine().describe_context(), data);
300   //logerror("%s i8255 write %02x to port B (mole output 2?)\n", machine().describe_context(), data);
310301}
311302
312303WRITE8_MEMBER(kenseim_state::i8255_portf_w)
313304{
314305   // typically written when the 'moles' output is, maybe the 2 strobes?
315   logerror("%s i8255 write %02x to port F (strobe?)\n", machine().describe_context(), data);
306   //logerror("%s i8255 write %02x to port F (strobe?)\n", machine().describe_context(), data);
316307}
317308
318309
r30870r30871
369360
370361CUSTOM_INPUT_MEMBER(kenseim_state::kenseim_cmd_9_r)
371362{
372   return (m_to_68k_cmd_d9 & 0x1); // bit 9 of command?
363   return m_to_68k_cmd_d9; // bit 9 of command?
373364}
374365
375366CUSTOM_INPUT_MEMBER(kenseim_state::kenseim_cmd_req_r)
376367{
377   logerror("%s kenseim_cmd_req_r\n", machine().describe_context());
368   //logerror("%s kenseim_cmd_req_r\n", machine().describe_context());
378369   return m_to_68k_cmd_req;
379370}
380371
381372CUSTOM_INPUT_MEMBER(kenseim_state::kenseim_cmd_LVm_r)
382373{
383   // needed for COMMAND WAIT message..
384374   return m_to_68k_cmd_LVm;;
385375}
386376
r30870r30871
404394      m_from68k_st2 = (data & 0x0400) >> 10;
405395      m_from68k_st3 = (data & 0x0800) >> 11;
406396   
407      printf("%s cps1_kensei_w offs %04x (from 68k to DRIVE BOARD via CN2) (%02x) (%d ACK,  %d ST4,  %d ST2,  %d ST3) \n", machine().describe_context(), offset * 2, data, m_from68k_ack, m_from68k_st4, m_from68k_st2, m_from68k_st3 );
397      //printf("%s cps1_kensei_w offs %04x (from 68k to DRIVE BOARD via CN2) (%02x) (%d ACK,  %d ST4,  %d ST2,  %d ST3) \n", machine().describe_context(), offset * 2, data, m_from68k_ack, m_from68k_st4, m_from68k_st2, m_from68k_st3 );
408398
409399   }
410400   else
r30870r30871
420410WRITE8_MEMBER(kenseim_state::portd_w)
421411{
422412   // port direction is set to 4-in 4-out
423   m_to_68k_cmd_flags = data & 0xf;
424
425   // bit 0x4, 0x02 bit 0x1 used.
426   // wrong
427
428   m_to_68k_cmd_req = (m_to_68k_cmd_flags&0x2)>>1;
429   m_to_68k_cmd_LVm = ((m_to_68k_cmd_flags & 0x4) >> 2) ^ 1;
430   m_to_68k_cmd_d9 = (m_to_68k_cmd_flags&0x1)>>0;
431
432   printf("%s write %01x to port D (%02x unmasked) (from DRIVE BOARD to 68k command flags?)\n", machine().describe_context(), data & 0x0f, data) ;
413   // d0: D9
414   // d1: REQ
415   // d2: LVm
416   // d3: N/C
417   m_to_68k_cmd_d9 = data >> 0 & 1;
418   m_to_68k_cmd_req = data >> 1 & 1;
419   m_to_68k_cmd_LVm = data >> 2 & 1;
433420}
434421
435422WRITE8_MEMBER(kenseim_state::porte_w)
436423{
437   // only access is at 0ABE, surrounded by port D reads / writes
424   // DT1-DT8
438425   m_to_68k_cmd_low = data;
439   printf("%s write %02x to port E (from DRIVE BOARD to 68k command bits?)\n", machine().describe_context(), data);
440426}
441427
442428/* Z80 side COMMS reads */
r30870r30871
444430READ8_MEMBER(kenseim_state::portd_r)
445431{
446432   // port direction is set to 4-in 4-out
447//   int ret = rand() & 0xf0;
448
449   int ret;
450
451   int in10 = m_from68k_ack; // loop at 0x929 - 0x92e waits for this to be 0
452   int in80 = m_from68k_st4; // loop at 0x931 - 0x936 then waits for this to be 1
453
454   int in20 = m_from68k_st3;
455   int in40 = m_from68k_st2;
456
457   ret = (in10 << 4) | (in20 << 5) | (in40 << 6) | (in80 << 7);
458
459   // 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.
460   logerror("%s read port D (returning %02x)\n", machine().describe_context(), ret);
461   return ret;
433   // d4: ACK
434   // d5: ST2
435   // d6: ST3
436   // d7: ST4
437   return (m_from68k_ack << 4) | (m_from68k_st2 << 5) | (m_from68k_st3 << 6) | (m_from68k_st4 << 7);
462438}
463439
464440
r30870r30871
581557   
582558   // the MB89363B seems to be 2 * i8255?
583559   MCFG_DEVICE_ADD("i8255", I8255, 0) // MB89363B!
584   MCFG_I8255_IN_PORTA_CB(READ8(kenseim_state, i8255_porta_default_r))
585   MCFG_I8255_IN_PORTB_CB(READ8(kenseim_state, i8255_portb_default_r))
586   MCFG_I8255_IN_PORTC_CB(READ8(kenseim_state, i8255_portc_default_r))
560   // always $80: all ports set as output
587561   MCFG_I8255_OUT_PORTA_CB(WRITE8(kenseim_state, i8255_porta_w))
588562   MCFG_I8255_OUT_PORTB_CB(WRITE8(kenseim_state, i8255_portb_w))
589563   MCFG_I8255_OUT_PORTC_CB(WRITE8(kenseim_state, i8255_portc_w))
590564
591565   MCFG_DEVICE_ADD("i8255_2", I8255, 0) // MB89363B!
566   // always $92: port A and B as input, port C as output
592567   MCFG_I8255_IN_PORTA_CB(READ8(kenseim_state, i8255_portd_r))
593568   MCFG_I8255_IN_PORTB_CB(READ8(kenseim_state, i8255_porte_r))
594   MCFG_I8255_IN_PORTC_CB(READ8(kenseim_state, i8255_portf_default_r))
595   MCFG_I8255_OUT_PORTA_CB(WRITE8(kenseim_state, i8255_portd_default_w))
596   MCFG_I8255_OUT_PORTB_CB(WRITE8(kenseim_state, i8255_porte_default_w))
597569   MCFG_I8255_OUT_PORTC_CB(WRITE8(kenseim_state, i8255_portf_w))
598570
599571
r30870r30871
605577   PORT_START("IN0")
606578   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_COIN1*/ ) // n/c
607579   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_COIN2*/ ) // n/c
608   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_9_r, NULL) //   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) // D9
580   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_9_r, NULL) //   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) // D9
609581   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c?
610   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_req_r, NULL) //   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) // REQ
611   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_LVm_r, NULL) //   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) // LVm
582   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_req_r, NULL) //   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) // REQ
583   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_LVm_r, NULL) //   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) // LVm
612584   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) n/c
613585   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c?
614586
r30870r30871
617589//   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) // D6
618590//   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) // D7
619591//   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) // D8
620   PORT_BIT( 0x000f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_5678_r, NULL)
592   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_5678_r, NULL)
621593   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED/*IPT_BUTTON1*/ ) /*PORT_PLAYER(1)*/ // n/c
622594   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED/*IPT_BUTTON2*/ ) /*PORT_PLAYER(1)*/ // n/c
623595   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED/*IPT_BUTTON3*/ ) /*PORT_PLAYER(1)*/ // n/c
r30870r30871
627599//   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) // D2
628600//   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) // D3
629601//   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) // D4
630   PORT_BIT( 0x0f00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_1234_r, NULL)
602   PORT_BIT( 0x0f00, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_1234_r, NULL)
631603   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_BUTTON1*/ ) /*PORT_PLAYER(2)*/ // n/c
632604   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_BUTTON2*/ ) /*PORT_PLAYER(2)*/ // n/c
633605   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_BUTTON3*/ ) /*PORT_PLAYER(2)*/ // n/c
r30870r30871
654626   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "CPSA SW(B):7" )
655627   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "CPSA SW(B):8" )
656628
657   PORT_START("DSWC")                         
629   PORT_START("DSWC")
658630   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "CPSA SW(C):1" )
659631   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "CPSA SW(C):2" )
660632   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "CPSA SW(C):3" )
r30870r30871
672644
673645   // the extra board has 2 dip banks used for most game options
674646   PORT_START("DSW1")
675   PORT_DIPNAME( 0x03, 0x00, "Coinage" )                            PORT_DIPLOCATION("DRV SW(1):1,2")
647   PORT_DIPNAME( 0x03, 0x03, "Coinage" )                            PORT_DIPLOCATION("DRV SW(1):1,2")
676648   PORT_DIPSETTING(    0x00, "0" )
677649   PORT_DIPSETTING(    0x01, "1" )
678650   PORT_DIPSETTING(    0x02, "2" )
679651   PORT_DIPSETTING(    0x03, "3" )
680   PORT_DIPNAME( 0x0c, 0x00, "Head Appear Once Ratio" )             PORT_DIPLOCATION("DRV SW(1):3,4")
652   PORT_DIPNAME( 0x0c, 0x0c, "Head Appear Once Ratio" )             PORT_DIPLOCATION("DRV SW(1):3,4")
681653   PORT_DIPSETTING(    0x00, "0" )
682654   PORT_DIPSETTING(    0x04, "1" )
683655   PORT_DIPSETTING(    0x08, "2" )
684656   PORT_DIPSETTING(    0x0c, "3" )
685   PORT_DIPNAME( 0x30, 0x00, "Strength of Computer" )               PORT_DIPLOCATION("DRV SW(1):5,6")
657   PORT_DIPNAME( 0x30, 0x30, "Strength of Computer" )               PORT_DIPLOCATION("DRV SW(1):5,6")
686658   PORT_DIPSETTING(    0x00, "0" )
687659   PORT_DIPSETTING(    0x10, "1" )
688660   PORT_DIPSETTING(    0x20, "2" )
689661   PORT_DIPSETTING(    0x30, "3" )
690   PORT_DIPNAME( 0x40, 0x00, "Game Time" )                          PORT_DIPLOCATION("DRV SW(1):7")
662   PORT_DIPNAME( 0x40, 0x40, "Game Time" )                          PORT_DIPLOCATION("DRV SW(1):7")
691663   PORT_DIPSETTING(    0x00, "0" )
692664   PORT_DIPSETTING(    0x40, "1" )
693   PORT_DIPNAME( 0x80, 0x00, "VS Bison" )                           PORT_DIPLOCATION("DRV SW(1):8")
665   PORT_DIPNAME( 0x80, 0x80, "VS Bison" )                           PORT_DIPLOCATION("DRV SW(1):8")
694666   PORT_DIPSETTING(    0x00, "0" )
695667   PORT_DIPSETTING(    0x80, "1" )
696668
697669   PORT_START("DSW2")
698   PORT_DIPNAME( 0x01, 0x00, "Unknown 1 (1-bit)" )                           PORT_DIPLOCATION("DRV SW(2):1")  // manual lists unused, but see code at  0x0E9E
670   PORT_DIPNAME( 0x01, 0x01, "Unknown 1 (1-bit)" )                           PORT_DIPLOCATION("DRV SW(2):1")  // manual lists unused, but see code at  0x0E9E
699671   PORT_DIPSETTING(    0x00, "0" )
700672   PORT_DIPSETTING(    0x01, "1" )
701   PORT_DIPNAME( 0x06, 0x00, "Unknown 2 (2-bit)" )                           PORT_DIPLOCATION("DRV SW(2):2,3")  // ^^
673   PORT_DIPNAME( 0x06, 0x06, "Unknown 2 (2-bit)" )                           PORT_DIPLOCATION("DRV SW(2):2,3")  // ^^
702674   PORT_DIPSETTING(    0x00, "0" )
703675   PORT_DIPSETTING(    0x02, "1" )
704676   PORT_DIPSETTING(    0x04, "2" )
705677   PORT_DIPSETTING(    0x06, "3" )
706   PORT_DIPNAME( 0x18, 0x00, "Unknown 3 (2-bit)" )                           PORT_DIPLOCATION("DRV SW(2):4,5")  // ^^
678   PORT_DIPNAME( 0x18, 0x18, "Unknown 3 (2-bit)" )                           PORT_DIPLOCATION("DRV SW(2):4,5")  // ^^
707679   PORT_DIPSETTING(    0x00, "0" )
708680   PORT_DIPSETTING(    0x08, "1" )
709681   PORT_DIPSETTING(    0x10, "2" )
710682   PORT_DIPSETTING(    0x18, "3" )
711683   PORT_DIPUNUSED( 0x20, 0x20 )                                      PORT_DIPLOCATION("DRV SW(2):6") // appears unused
712684   PORT_DIPUNUSED( 0x40, 0x40 )                                      PORT_DIPLOCATION("DRV SW(2):7") // apeears unused
713   PORT_DIPNAME( 0x80, 0x00, "Test Mode" )                           PORT_DIPLOCATION("DRV SW(2):8")
714   PORT_DIPSETTING(    0x00, "0" )
715   PORT_DIPSETTING(    0x80, "1" )
685   PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "DRV SW(2):8" )
716686
717687   PORT_START("CAB-IN")
718688   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
r30870r30871
779749   m_led_serial_data = 0;
780750   m_led_clock = 0;
781751   m_led_latch = 0;
752}
782753
783}
784754
755// 1994.04.18 is from extra PCB rom, Siguma or Sigma? (Siguma is in the ROM)
756// the CPS1 board roms contain "M O G U R A   9 2 0 9 2 4" strings suggesting that part of the code was developed earlier
757GAMEL( 1994, kenseim,       0,        kenseim, kenseim,      kenseim_state,   kenseim,     ROT0,   "Sigma / Togo / Capcom", "Ken Sei Mogura (1994.04.18, Ver 1.00)", GAME_NOT_WORKING, layout_kenseim )
785758
786 // 1994.04.18 is from extra PCB rom, Siguma or Sigma? (Siguma is in the ROM)
787 // the CPS1 board roms contain "M O G U R A   9 2 0 9 2 4" strings suggesting that part of the code was developed earlier
788 GAMEL( 1994, kenseim,       0,        kenseim, kenseim,      kenseim_state,   kenseim,     ROT0,   "Sigma / Togo / Capcom", "Kensei Mogura (1994.04.18, Ver 1.00)", GAME_NOT_WORKING, layout_kenseim )
789

Previous 199869 Revisions Next


© 1997-2024 The MAME Team