Previous 199869 Revisions Next

r30768 Sunday 1st June, 2014 at 23:51:49 UTC by David Haywood
add some leds (nw)
[src/mame]mame.mak
[src/mame/drivers]kenseim.c
[src/mame/layout]kenseim.lay*

trunk/src/mame/mame.mak
r30767r30768
26382638
26392639$(DRIVERS)/kas89.o:     $(LAYOUT)/kas89.lh
26402640
2641$(DRIVERS)/kenseim.o:   $(LAYOUT)/kenseim.lh
2642
26412643$(DRIVERS)/kingdrby.o:  $(LAYOUT)/kingdrby.lh
26422644
26432645$(DRIVERS)/kungfur.o:   $(LAYOUT)/kungfur.lh
trunk/src/mame/layout/kenseim.lay
r0r30768
1<?xml version="1.0"?>
2<mamelayout version="2">
3
4   <element name="powerled">
5      <rect state ="0">
6         <bounds x="0" y="0" width="7" height="7" />
7         <color red="0.2" green="0.2" blue="0.2" />
8      </rect>
9      <rect state ="1">
10         <bounds x="0" y="0" width="7" height="7" />
11         <color red="1.0" green="0.2" blue="0.2" />
12      </rect>
13
14   </element>
15
16
17   <view name="Adder,VFD and Lamps">
18
19      <backdrop name="lamp1" element="powerled" state="0">
20         <bounds x="10" y="245" width="7" height="7"/>
21      </backdrop>
22      <backdrop name="lamp2" element="powerled" state="0">
23         <bounds x="20" y="245" width="7" height="7"/>
24      </backdrop>
25      <backdrop name="lamp3" element="powerled" state="0">
26         <bounds x="30" y="245" width="7" height="7"/>
27      </backdrop>
28      <backdrop name="lamp4" element="powerled" state="0">
29         <bounds x="40" y="245" width="7" height="7"/>
30      </backdrop>
31      <backdrop name="lamp5" element="powerled" state="0">
32         <bounds x="50" y="245" width="7" height="7"/>
33      </backdrop>
34      <backdrop name="lamp6" element="powerled" state="0">
35         <bounds x="60" y="245" width="7" height="7"/>
36      </backdrop>
37      <backdrop name="lamp7" element="powerled" state="0">
38         <bounds x="70" y="245" width="7" height="7"/>
39      </backdrop>
40      <backdrop name="lamp8" element="powerled" state="0">
41         <bounds x="80" y="245" width="7" height="7"/>
42      </backdrop>
43      <backdrop name="lamp9" element="powerled" state="0">
44         <bounds x="90" y="245" width="7" height="7"/>
45      </backdrop>
46      <backdrop name="lamp10" element="powerled" state="0">
47         <bounds x="100" y="245" width="7" height="7"/>
48      </backdrop>
49
50      <backdrop name="lamp11" element="powerled" state="0">
51         <bounds x="210" y="245" width="7" height="7"/>
52      </backdrop>
53      <backdrop name="lamp12" element="powerled" state="0">
54         <bounds x="220" y="245" width="7" height="7"/>
55      </backdrop>
56      <backdrop name="lamp13" element="powerled" state="0">
57         <bounds x="230" y="245" width="7" height="7"/>
58      </backdrop>
59      <backdrop name="lamp14" element="powerled" state="0">
60         <bounds x="240" y="245" width="7" height="7"/>
61      </backdrop>
62      <backdrop name="lamp15" element="powerled" state="0">
63         <bounds x="250" y="245" width="7" height="7"/>
64      </backdrop>
65      <backdrop name="lamp16" element="powerled" state="0">
66         <bounds x="260" y="245" width="7" height="7"/>
67      </backdrop>
68      <backdrop name="lamp17" element="powerled" state="0">
69         <bounds x="270" y="245" width="7" height="7"/>
70      </backdrop>
71      <backdrop name="lamp18" element="powerled" state="0">
72         <bounds x="280" y="245" width="7" height="7"/>
73      </backdrop>
74      <backdrop name="lamp19" element="powerled" state="0">
75         <bounds x="290" y="245" width="7" height="7"/>
76      </backdrop>
77      <backdrop name="lamp20" element="powerled" state="0">
78         <bounds x="300" y="245" width="7" height="7"/>
79      </backdrop>
80
81
82
83      <screen index="0">
84         <bounds x="0" y="0" width="320" height="240" />
85      </screen>
86   </view>
87</mamelayout>
Property changes on: trunk/src/mame/layout/kenseim.lay
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mame/drivers/kenseim.c
r30767r30768
3131#include "machine/z80ctc.h"
3232#include "includes/cps1.h"
3333#include "machine/i8255.h"
34#include "kenseim.lh"
3435
35
3636class kenseim_state : public cps_state
3737{
3838public:
r30767r30768
4545   DECLARE_READ16_MEMBER(kensei_dsw_r);
4646   DECLARE_DRIVER_INIT(kenseim);
4747
48   DECLARE_READ8_MEMBER(porta_default_r) { logerror("%s read port A but no handler assigned\n", machine().describe_context()); return 0xff; }
49   DECLARE_READ8_MEMBER(portb_default_r) { logerror("%s read port B but no handler assigned\n", machine().describe_context()); return 0xff; }
48   DECLARE_READ8_MEMBER(porta_default_r) { logerror("%s read port A but no handler assigned\n", machine().describe_context()); return 0x00; }
49   DECLARE_READ8_MEMBER(portb_default_r) { logerror("%s read port B but no handler assigned\n", machine().describe_context()); return 0x00; }
5050//   DECLARE_READ8_MEMBER(portc_default_r) { logerror("%s read port C but no handler assigned\n", machine().describe_context()); return 0xff; }
5151   DECLARE_READ8_MEMBER(portc_r);
5252//   DECLARE_READ8_MEMBER(portd_default_r) { logerror("%s read port D but no handler assigned\n", machine().describe_context()); return 0xff; }
r30767r30768
6363   DECLARE_READ8_MEMBER(i8255_portb_default_r) { logerror("%s i8255 read port B but no handler assigned\n", machine().describe_context()); return 0xff; }
6464   DECLARE_READ8_MEMBER(i8255_portc_default_r) { logerror("%s i8255 read port C but no handler assigned\n", machine().describe_context()); return 0xff; }
6565
66   DECLARE_WRITE8_MEMBER(i8255_porta_default_w) { logerror("%s i8255 write %02x to port A but no handler assigned\n", machine().describe_context(), data); }
67   DECLARE_WRITE8_MEMBER(i8255_portb_default_w) { logerror("%s i8255 write %02x to port B but no handler assigned\n", machine().describe_context(), data); }
68   DECLARE_WRITE8_MEMBER(i8255_portc_default_w) { logerror("%s i8255 write %02x to port C but no handler assigned\n", machine().describe_context(), data); }
66   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?)
67   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?)
68//   DECLARE_WRITE8_MEMBER(i8255_portc_default_w) { logerror("%s i8255 write %02x to port C but no handler assigned\n", machine().describe_context(), data); } // leds??
69   DECLARE_WRITE8_MEMBER(i8255_portc_w);
70
71   DECLARE_READ8_MEMBER(i8255_portd_default_r) { logerror("%s i8255 read port D but no handler assigned\n", machine().describe_context()); return 0xff; }
72   DECLARE_READ8_MEMBER(i8255_porte_default_r) { logerror("%s i8255 read port E but no handler assigned\n", machine().describe_context()); return 0xff; }
73   DECLARE_READ8_MEMBER(i8255_portf_default_r) { logerror("%s i8255 read port F but no handler assigned\n", machine().describe_context()); return 0xff; }
74
75   DECLARE_WRITE8_MEMBER(i8255_portd_default_w) { logerror("%s i8255 write %02x to port D but no handler assigned\n", machine().describe_context(), data); }
76   DECLARE_WRITE8_MEMBER(i8255_porte_default_w) { logerror("%s i8255 write %02x to port E but no handler assigned\n", machine().describe_context(), data); }
77   DECLARE_WRITE8_MEMBER(i8255_portf_default_w) { logerror("%s i8255 write %02x to port F but no handler assigned\n", machine().describe_context(), data); }
78
79
80   UINT32 m_led_serial_data;
81   int m_led_clock;
82   int m_led_latch;
83   void set_leds(UINT32 ledstates);
6984};
7085
86void kenseim_state::set_leds(UINT32 ledstates)
87{
88   for (int i=0; i<20; i++)
89      output_set_lamp_value(i+1, ((ledstates & (1 << i)) != 0));   
90}
7191
92// could be wrong
93WRITE8_MEMBER(kenseim_state::i8255_portc_w)
94{
95   // I'm guessing these are the 20 'power meter' LEDs, 10 for each player? (it writes 42 tiles, with the last write being some terminator?)
96
97//   printf("%s i8255 write %02x to port C but no handler assigned (serial data?)\n", machine().describe_context(), data);
98
99   if (data & 0x08)
100   {
101
102      if (data & 0x02)
103      {
104         if (data & 0x04)
105         {
106            // send and reset? maybe?
107            //printf("led write reset?\n");
108            m_led_latch = 0;
109            set_leds(m_led_serial_data);
110            m_led_serial_data = 0;
111         }
112         else if (!(m_led_clock & 0x02))
113         {
114            //printf("write data bit %d\n", m_led_latch & 1);
115            m_led_serial_data = (m_led_serial_data << 1) | (m_led_latch & 1);
116         }
117
118      }
119      else
120      {
121         m_led_latch = data & 0x5;
122         //printf("set latch %02x\n", m_led_latch);
123      }
124
125      m_led_clock = data & 0x02;
126   }
127
128}
129
130
72131READ8_MEMBER(kenseim_state::portd_r)
73132{
74133   // 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.
75   //logerror("%s read port D\n", machine().describe_context());
76   return rand();// 0x80;
134   logerror("%s read port D\n", machine().describe_context());
135   return 0x00;// rand();// 0x80;
77136}
78137
79138READ8_MEMBER(kenseim_state::portc_r)
80139{
81140   // bits 0x09 checked at 1171
82   return rand();
141   logerror("%s read port C\n", machine().describe_context());
142
143   return 0x00;//
144   //return 0x09;// rand();
83145}
84146
85147
86148READ16_MEMBER(kenseim_state::cps1_kensei_r)
87149{
88   logerror("%s cps1_kensei_r offs %04x, (%04x)\n", machine().describe_context(), offset *2, mem_mask);
89   return rand();
150   //
151   static int i = 0;
152   
153   int ret;
154
155   ret = ((i & 0xf0) >> 4) | ((i & 0x0f) << 8);
156
157   if (mem_mask & 0xff00) i++;
158
159   logerror("%s cps1_kensei_r offs %04x, (%04x) (68k reading command port %04x)\n", machine().describe_context(), offset *2, mem_mask, ret);
160
161   return ret | 0xf0f0;
90162}
91163
92164WRITE16_MEMBER(kenseim_state::cps1_kensei_w)
93165{
94   logerror("%s cps1_kensei_w offs %04x, %04x (%04x)\n", machine().describe_context(), offset *2, data, mem_mask);
166   if (mem_mask == 0xff00)
167   {
168
169      data >>= 8;;
170
171      logerror("%s cps1_kensei_w offs %04x, %02x (from 68k?)\n", machine().describe_context(), offset * 2, data);
172
173      if ((data != 0x02) && (data != 0x03) && (data != 0x04) && (data != 0x05) && (data != 0x83))
174         logerror("  ^^ (unknown?)\n");
175   }
176   else
177   {
178      logerror("%s cps1_kensei_w offs %04x, %04x (%04x) (other byte)\n", machine().describe_context(), offset * 2, data, mem_mask);
179   }
95180}
96181
97182/*
r30767r30768
170255static ADDRESS_MAP_START( kenseim_map, AS_PROGRAM, 8, kenseim_state )
171256   AM_RANGE(0x0000, 0x7fff) AM_ROM
172257
173   AM_RANGE(0x8000, 0x81ff) AM_RAM // ? size unknown, code just wipes ram until the compare fails
258//   AM_RANGE(0x8000, 0x81ff) AM_RAM // ? size unknown, code just wipes ram until the compare fails
174259
175   AM_RANGE(0xf000, 0xffff) AM_RAM
260   AM_RANGE(0x8000, 0xffff) AM_RAM
176261ADDRESS_MAP_END
177262
178263static ADDRESS_MAP_START( kenseim_io_map, AS_IO, 8, kenseim_state )
179264   ADDRESS_MAP_GLOBAL_MASK(0xff)
180265   AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("gamecpu_ctc", z80ctc_device, read, write)
181266
182   AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("i8255", i8255_device, read, write)
267   AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("i8255",   i8255_device, read, write)
268   AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("i8255_2", i8255_device, read, write)
269
183270ADDRESS_MAP_END
184271
185272
r30767r30768
197284   
198285   if (offset > 0)
199286   {
200      logerror("%s kensei_dsw_r offs %04x, (%04x)\n", machine().describe_context(), offset *2, mem_mask);
287      //logerror("%s kensei_dsw_r offs %04x, (%04x)\n", machine().describe_context(), offset *2, mem_mask);
201288
202289      int in = ioport(dswname[offset])->read();
203290      return (in << 8) | 0xff;
r30767r30768
205292   else
206293   {  // connected to the other board instead of IN0? (or at least some bits are)
207294
208      logerror("%s kensei_dsw_r offs %04x (comms?), (%04x)\n", machine().describe_context(), offset *2, mem_mask);
209      int in = ((rand() & 0xff) & ~0x20) | 0x40; // 0x20 causes 'comamnd wait' message - 0x40 is still service mode? (valid or leftover - test mode trigger should be on sub pcb?)
295      static int togglecount = 0;
296     
297      togglecount++;
298
299
300
301      int in = 0x00;
302      in |= 0x40; // don't want cps1 test mode (leftover)
303     
304      if (togglecount == 3)
305      {
306         in |= 0x10; // won't read commands otherwise?
307         togglecount = 0;
308      }   
309     
310     
311      //in |= 0x20;
312
313      logerror("%s kensei_dsw_r offs %04x (comms?), (%04x) (returning %02x)\n", machine().describe_context(), offset *2, mem_mask, in);
314
315
210316      return (in << 8) | 0xff;
211317
212318   }
r30767r30768
233339   MCFG_DEVICE_ADD("gamecpu_ctc", Z80CTC, XTAL_16MHz/2 ) // part of the tmpz84?
234340   MCFG_Z80CTC_INTR_CB(INPUTLINE("gamecpu", INPUT_LINE_IRQ0))
235341   
342   // the MB89363B seems to be 2 * i8255?
236343   MCFG_DEVICE_ADD("i8255", I8255, 0) // MB89363B!
237344   MCFG_I8255_IN_PORTA_CB(READ8(kenseim_state, i8255_porta_default_r))
238345   MCFG_I8255_IN_PORTB_CB(READ8(kenseim_state, i8255_portb_default_r))
239346   MCFG_I8255_IN_PORTC_CB(READ8(kenseim_state, i8255_portc_default_r))
240347   MCFG_I8255_OUT_PORTA_CB(WRITE8(kenseim_state, i8255_porta_default_w))
241348   MCFG_I8255_OUT_PORTB_CB(WRITE8(kenseim_state, i8255_portb_default_w))
242   MCFG_I8255_OUT_PORTC_CB(WRITE8(kenseim_state, i8255_portc_default_w))
349   MCFG_I8255_OUT_PORTC_CB(WRITE8(kenseim_state, i8255_portc_w))
243350
351   MCFG_DEVICE_ADD("i8255_2", I8255, 0) // MB89363B!
352   MCFG_I8255_IN_PORTA_CB(READ8(kenseim_state, i8255_portd_default_r))
353   MCFG_I8255_IN_PORTB_CB(READ8(kenseim_state, i8255_porte_default_r))
354   MCFG_I8255_IN_PORTC_CB(READ8(kenseim_state, i8255_portf_default_r))
355   MCFG_I8255_OUT_PORTA_CB(WRITE8(kenseim_state, i8255_portd_default_w))
356   MCFG_I8255_OUT_PORTB_CB(WRITE8(kenseim_state, i8255_porte_default_w))
357   MCFG_I8255_OUT_PORTC_CB(WRITE8(kenseim_state, i8255_portf_default_w))
358
359
244360   MCFG_QUANTUM_PERFECT_CPU("maincpu")
245361MACHINE_CONFIG_END
246362
r30767r30768
369485   m_maincpu->space(AS_PROGRAM).install_write_handler(0x800030, 0x800037, write16_delegate(FUNC(kenseim_state::cps1_kensei_w),this));
370486
371487   DRIVER_INIT_CALL(cps1);
488
489   m_led_serial_data = 0;
490   m_led_clock = 0;
491   m_led_latch = 0;
492
372493}
373494
374495
375496 // 1994.04.18 is from extra PCB rom, Siguma or Sigma? (Siguma is in the ROM)
376497 // 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
377 GAME( 1994, kenseim,       0,        kenseim, kenseim,      kenseim_state,   kenseim,     ROT0,   "Sigma / Togo / Capcom", "Kensei Mogura (1994.04.18, Ver 1.00)", GAME_NOT_WORKING )
498 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 )
378499

Previous 199869 Revisions Next


© 1997-2024 The MAME Team