trunk/src/mame/layout/kenseim.lay
| r0 | r30768 | |
| 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> |
trunk/src/mame/drivers/kenseim.c
| r30767 | r30768 | |
| 31 | 31 | #include "machine/z80ctc.h" |
| 32 | 32 | #include "includes/cps1.h" |
| 33 | 33 | #include "machine/i8255.h" |
| 34 | #include "kenseim.lh" |
| 34 | 35 | |
| 35 | | |
| 36 | 36 | class kenseim_state : public cps_state |
| 37 | 37 | { |
| 38 | 38 | public: |
| r30767 | r30768 | |
| 45 | 45 | DECLARE_READ16_MEMBER(kensei_dsw_r); |
| 46 | 46 | DECLARE_DRIVER_INIT(kenseim); |
| 47 | 47 | |
| 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; } |
| 50 | 50 | // DECLARE_READ8_MEMBER(portc_default_r) { logerror("%s read port C but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 51 | 51 | DECLARE_READ8_MEMBER(portc_r); |
| 52 | 52 | // DECLARE_READ8_MEMBER(portd_default_r) { logerror("%s read port D but no handler assigned\n", machine().describe_context()); return 0xff; } |
| r30767 | r30768 | |
| 63 | 63 | DECLARE_READ8_MEMBER(i8255_portb_default_r) { logerror("%s i8255 read port B but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 64 | 64 | DECLARE_READ8_MEMBER(i8255_portc_default_r) { logerror("%s i8255 read port C but no handler assigned\n", machine().describe_context()); return 0xff; } |
| 65 | 65 | |
| 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); |
| 69 | 84 | }; |
| 70 | 85 | |
| 86 | void 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 | } |
| 71 | 91 | |
| 92 | // could be wrong |
| 93 | WRITE8_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 | |
| 72 | 131 | READ8_MEMBER(kenseim_state::portd_r) |
| 73 | 132 | { |
| 74 | 133 | // 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; |
| 77 | 136 | } |
| 78 | 137 | |
| 79 | 138 | READ8_MEMBER(kenseim_state::portc_r) |
| 80 | 139 | { |
| 81 | 140 | // 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(); |
| 83 | 145 | } |
| 84 | 146 | |
| 85 | 147 | |
| 86 | 148 | READ16_MEMBER(kenseim_state::cps1_kensei_r) |
| 87 | 149 | { |
| 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; |
| 90 | 162 | } |
| 91 | 163 | |
| 92 | 164 | WRITE16_MEMBER(kenseim_state::cps1_kensei_w) |
| 93 | 165 | { |
| 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 | } |
| 95 | 180 | } |
| 96 | 181 | |
| 97 | 182 | /* |
| r30767 | r30768 | |
| 170 | 255 | static ADDRESS_MAP_START( kenseim_map, AS_PROGRAM, 8, kenseim_state ) |
| 171 | 256 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 172 | 257 | |
| 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 |
| 174 | 259 | |
| 175 | | AM_RANGE(0xf000, 0xffff) AM_RAM |
| 260 | AM_RANGE(0x8000, 0xffff) AM_RAM |
| 176 | 261 | ADDRESS_MAP_END |
| 177 | 262 | |
| 178 | 263 | static ADDRESS_MAP_START( kenseim_io_map, AS_IO, 8, kenseim_state ) |
| 179 | 264 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 180 | 265 | AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("gamecpu_ctc", z80ctc_device, read, write) |
| 181 | 266 | |
| 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 | |
| 183 | 270 | ADDRESS_MAP_END |
| 184 | 271 | |
| 185 | 272 | |
| r30767 | r30768 | |
| 197 | 284 | |
| 198 | 285 | if (offset > 0) |
| 199 | 286 | { |
| 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); |
| 201 | 288 | |
| 202 | 289 | int in = ioport(dswname[offset])->read(); |
| 203 | 290 | return (in << 8) | 0xff; |
| r30767 | r30768 | |
| 205 | 292 | else |
| 206 | 293 | { // connected to the other board instead of IN0? (or at least some bits are) |
| 207 | 294 | |
| 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 | |
| 210 | 316 | return (in << 8) | 0xff; |
| 211 | 317 | |
| 212 | 318 | } |
| r30767 | r30768 | |
| 233 | 339 | MCFG_DEVICE_ADD("gamecpu_ctc", Z80CTC, XTAL_16MHz/2 ) // part of the tmpz84? |
| 234 | 340 | MCFG_Z80CTC_INTR_CB(INPUTLINE("gamecpu", INPUT_LINE_IRQ0)) |
| 235 | 341 | |
| 342 | // the MB89363B seems to be 2 * i8255? |
| 236 | 343 | MCFG_DEVICE_ADD("i8255", I8255, 0) // MB89363B! |
| 237 | 344 | MCFG_I8255_IN_PORTA_CB(READ8(kenseim_state, i8255_porta_default_r)) |
| 238 | 345 | MCFG_I8255_IN_PORTB_CB(READ8(kenseim_state, i8255_portb_default_r)) |
| 239 | 346 | MCFG_I8255_IN_PORTC_CB(READ8(kenseim_state, i8255_portc_default_r)) |
| 240 | 347 | MCFG_I8255_OUT_PORTA_CB(WRITE8(kenseim_state, i8255_porta_default_w)) |
| 241 | 348 | 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)) |
| 243 | 350 | |
| 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 | |
| 244 | 360 | MCFG_QUANTUM_PERFECT_CPU("maincpu") |
| 245 | 361 | MACHINE_CONFIG_END |
| 246 | 362 | |
| r30767 | r30768 | |
| 369 | 485 | m_maincpu->space(AS_PROGRAM).install_write_handler(0x800030, 0x800037, write16_delegate(FUNC(kenseim_state::cps1_kensei_w),this)); |
| 370 | 486 | |
| 371 | 487 | DRIVER_INIT_CALL(cps1); |
| 488 | |
| 489 | m_led_serial_data = 0; |
| 490 | m_led_clock = 0; |
| 491 | m_led_latch = 0; |
| 492 | |
| 372 | 493 | } |
| 373 | 494 | |
| 374 | 495 | |
| 375 | 496 | // 1994.04.18 is from extra PCB rom, Siguma or Sigma? (Siguma is in the ROM) |
| 376 | 497 | // 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 ) |
| 378 | 499 | |