diff options
Diffstat (limited to 'src/mame/drivers/wico.cpp')
-rw-r--r-- | src/mame/drivers/wico.cpp | 260 |
1 files changed, 150 insertions, 110 deletions
diff --git a/src/mame/drivers/wico.cpp b/src/mame/drivers/wico.cpp index c898ab72e99..2accfd1371f 100644 --- a/src/mame/drivers/wico.cpp +++ b/src/mame/drivers/wico.cpp @@ -2,16 +2,14 @@ // copyright-holders:Robbbert /************************************************************************** - PINBALL - Wico's only game : Af-tor +PINBALL +Schematic and PinMAME used as references. - Schematic and PinMAME used as references. - Code for the interrupts/timers was derived from PinMAME. +Machines by this manufacturer: Af-tor, Big Top, Whirlwind Play Booster. - Af-Tor was the first pinball to use alphanumeric displays. - Each display has 12 segments, but are programmed with 8-bit codes. - This makes some of the letters look rather odd, but it is still - readable. +Af-Tor was the first pinball to use alphanumeric displays. +Each display has 12 segments, but are programmed with 8-bit codes. +This makes some of the letters look rather odd, but it is still readable. a a _ _ @@ -20,21 +18,18 @@ d d - Press 9 to enter service/selftest. Press 1 to step through the tests. - When you reach the audit stages, press 6 to advance and 5 to clear. - In the switch test, it will report any closed dip as a failure. You can - ignore these. - The game has 2 balls, for multiball feature, so the outhole doesn't - work because it thinks the 2nd ball is in play somewhere. - - To activate the end-of-ball, hold down X then hold down num-9. - - -ToDo: -- Add outhole/saucer sound +Press num-0 to enter service/selftest. Press 1 to step through the tests. +When you reach the audit stages, press 6 to advance and 5 to clear. +In the switch test, it will report any closed dip as a failure. You can +ignore these. +The game has 2 balls, for multiball feature, so the outhole doesn't +work because it thinks the 2nd ball is in play somewhere. +To activate the end-of-ball, hold down X then tap END. +Status: +- Working ***************************************************************************/ @@ -48,6 +43,7 @@ ToDo: #include "wico.lh" +namespace { class wico_state : public genpin_class { @@ -57,23 +53,25 @@ public: , m_ccpu(*this, "ccpu") , m_hcpu(*this, "hcpu") , m_shared_ram(*this, "sharedram") + , m_io_keyboard(*this, "X%d", 0U) , m_digits(*this, "digit%u", 0U) + , m_io_outputs(*this, "out%u", 0U) { } void wico(machine_config &config); private: - uint8_t lampst_r(); - uint8_t switch_r(offs_t offset); - void muxen_w(uint8_t data); - void muxld_w(uint8_t data); - void csols_w(uint8_t data); - void msols_w(uint8_t data); - void dled0_w(uint8_t data); - void dled1_w(uint8_t data); - void zcres_w(uint8_t data); - void wdogcl_w(uint8_t data); - uint8_t gentmrcl_r(); + u8 lampst_r(); + u8 switch_r(offs_t offset); + void muxen_w(u8 data); + void muxld_w(u8 data); + void csols_w(u8 data); + void msols_w(u8 data); + void dled0_w(u8 data); + void dled1_w(u8 data); + void zcres_w(u8 data); + void wdogcl_w(u8 data); + u8 gentmrcl_r(); TIMER_DEVICE_CALLBACK_MEMBER(irq_housekeeping); TIMER_DEVICE_CALLBACK_MEMBER(firq_housekeeping); void ccpu_map(address_map &map); @@ -83,14 +81,16 @@ private: bool m_gten; bool m_disp_on; bool m_diag_on; - uint8_t m_firqtimer; - uint8_t m_diag_segments; + u8 m_firqtimer; + u8 m_diag_segments; + virtual void machine_start() override; virtual void machine_reset() override; - virtual void machine_start() override { m_digits.resolve(); } required_device<cpu_device> m_ccpu; required_device<cpu_device> m_hcpu; - required_shared_ptr<uint8_t> m_shared_ram; + required_shared_ptr<u8> m_shared_ram; + required_ioport_array<16> m_io_keyboard; output_finder<48> m_digits; + output_finder<176> m_io_outputs; // (8+36) solenoids + 4 spares + 128 lamps }; // housekeeping cpu @@ -123,8 +123,8 @@ void wico_state::ccpu_map(address_map &map) //map(0x1fe0, 0x1fe0).w(FUNC(wico_state::muxld_w)); // to display module //map(0x1fe1, 0x1fe1).w(FUNC(wico_state::store_w)); // enable save to nvram map(0x1fe2, 0x1fe2).w(FUNC(wico_state::muxen_w)); // digit to display on diagnostic LED; d0=L will disable main displays - map(0x1fe3, 0x1fe3).w(FUNC(wico_state::csols_w)); // solenoid column - map(0x1fe4, 0x1fe4).w(FUNC(wico_state::msols_w)); // solenoid row + map(0x1fe3, 0x1fe3).w(FUNC(wico_state::csols_w)); // continuous solenoids + map(0x1fe4, 0x1fe4).w(FUNC(wico_state::msols_w)); // matrix solenoids map(0x1fe5, 0x1fe5).w("sn76494", FUNC(sn76494_device::write)); map(0x1fe6, 0x1fe6).w(FUNC(wico_state::wdogcl_w)); // watchdog clear map(0x1fe7, 0x1fe7).w(FUNC(wico_state::zcres_w)); // enable IRQ on hcpu @@ -146,68 +146,68 @@ static INPUT_PORTS_START( wico ) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) // Clear button PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) // Advance button PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START1) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top Lane 4") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top Lane 3") PORT_CODE(KEYCODE_W) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top Lane 2") PORT_CODE(KEYCODE_E) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top Lane 1") PORT_CODE(KEYCODE_R) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Top Lane 4") PORT_CODE(KEYCODE_A) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Top Lane 3") PORT_CODE(KEYCODE_B) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Top Lane 2") PORT_CODE(KEYCODE_C) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Top Lane 1") PORT_CODE(KEYCODE_D) PORT_START("X1") PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bumper BR") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bumper BL") PORT_CODE(KEYCODE_U) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bumper TR") PORT_CODE(KEYCODE_I) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bumper TL") PORT_CODE(KEYCODE_O) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Target BR") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Target BL") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Target TR") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Target TL") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bumper BR") PORT_CODE(KEYCODE_E) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bumper BL") PORT_CODE(KEYCODE_F) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bumper TR") PORT_CODE(KEYCODE_G) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Bumper TL") PORT_CODE(KEYCODE_H) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Target BR") PORT_CODE(KEYCODE_I) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Target BL") PORT_CODE(KEYCODE_J) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Target TR") PORT_CODE(KEYCODE_K) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Target TL") PORT_CODE(KEYCODE_L) PORT_START("X3") PORT_START("X4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Oil Pit Release") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Oil Pit Target") PORT_CODE(KEYCODE_C) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Waterhole Release") PORT_CODE(KEYCODE_V) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Outhole") PORT_CODE(KEYCODE_X) // not working - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Spinner") PORT_CODE(KEYCODE_B) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Rollunder") PORT_CODE(KEYCODE_N) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Spinner") PORT_CODE(KEYCODE_M) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Oil Pit Release") PORT_CODE(KEYCODE_M) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Oil Pit Target") PORT_CODE(KEYCODE_N) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Waterhole Release") PORT_CODE(KEYCODE_O) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Outhole") PORT_CODE(KEYCODE_X) // press END as well + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Spinner") PORT_CODE(KEYCODE_P) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Rollunder") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Spinner") PORT_CODE(KEYCODE_R) PORT_START("X5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L SLingshot") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Slingshot") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Drop Bank E") PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Drop Bank P") PORT_CODE(KEYCODE_S) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Drop Bank A") PORT_CODE(KEYCODE_D) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Drop Bank C") PORT_CODE(KEYCODE_F) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Drop Bank S") PORT_CODE(KEYCODE_G) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Drop Bank E") PORT_CODE(KEYCODE_H) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L SLingshot") PORT_CODE(KEYCODE_S) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Slingshot") PORT_CODE(KEYCODE_T) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Drop Bank E") PORT_CODE(KEYCODE_U) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Drop Bank P") PORT_CODE(KEYCODE_V) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Drop Bank A") PORT_CODE(KEYCODE_W) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Drop Bank C") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Drop Bank S") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Drop Bank E") PORT_CODE(KEYCODE_COMMA) PORT_START("X6") PORT_START("X7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Target Zone E") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Target Zone D") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Target Zone I") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Target Zone R") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Target Zone T") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Target Zone S") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Target Zone A") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Target Zone F") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Target Zone E") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Target Zone D") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Target Zone I") PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Target Zone R") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Target Zone T") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Target Zone S") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Target Zone A") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Target Zone F") PORT_CODE(KEYCODE_BACKSLASH) PORT_START("X8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Outlane Target") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Outlane Target") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Rollover R Outlane") PORT_CODE(KEYCODE_J) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Rollover M Outlane") PORT_CODE(KEYCODE_K) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Rollover L Outlane") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Rollover R Outlane") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Rollover M Outlane") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L Rollover L Outlane") PORT_CODE(KEYCODE_SLASH) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Outlane Target") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Outlane Target") PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Rollover R Outlane") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Rollover M Outlane") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Rollover L Outlane") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Rollover R Outlane") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Rollover M Outlane") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("L Rollover L Outlane") PORT_CODE(KEYCODE_PGUP) PORT_START("X9") - PORT_START("XA") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_TILT1) PORT_NAME("Door Slam") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_TILT) PORT_NAME("Playfield Tilt") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_TILT) PORT_NAME("Pendulum Tilt") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R Flipper Lane Change") PORT_CODE(KEYCODE_RSHIFT) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ball Feed Middle") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ball Feed Lower") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("10 points") PORT_CODE(KEYCODE_COLON) - PORT_START("XB") - PORT_START("XC") + PORT_START("X10") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_NAME("Door Slam") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_NAME("Playfield Tilt") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Pendulum Tilt") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("R Flipper Lane Change") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Ball Feed Middle") PORT_CODE(KEYCODE_PGDN) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Ball Feed Lower") PORT_CODE(KEYCODE_END) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("10 points") PORT_CODE(KEYCODE_HOME) + PORT_START("X11") + PORT_START("X12") PORT_DIPNAME( 0x0f, 0x00, "Chute 1" ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) @@ -237,7 +237,7 @@ static INPUT_PORTS_START( wico ) PORT_DIPNAME( 0x80, 0x00, "Free Play" ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_START("XD") + PORT_START("X13") PORT_DIPNAME( 0x0f, 0x00, "Chute 2" ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) @@ -266,7 +266,7 @@ static INPUT_PORTS_START( wico ) PORT_DIPSETTING( 0x40, "2" ) PORT_DIPSETTING( 0x80, "1" ) PORT_DIPSETTING( 0xc0, "0" ) - PORT_START("XE") + PORT_START("X14") PORT_DIPNAME( 0x01, 0x00, "Reset left outlane gate" ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) @@ -290,7 +290,7 @@ static INPUT_PORTS_START( wico ) PORT_DIPNAME( 0x80, 0x80, "One extra ball per ball" ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_START("XF") + PORT_START("X15") PORT_DIPNAME( 0x03, 0x00, "Special bonus" ) PORT_DIPSETTING( 0x00, "Free Game" ) PORT_DIPSETTING( 0x01, "Extra Ball" ) @@ -311,35 +311,48 @@ static INPUT_PORTS_START( wico ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x40, DEF_STR( On ) ) // This is a dip and a pushbutton in parallel. - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Self Test") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Self Test") INPUT_PORTS_END // diagnostic display off -void wico_state::dled0_w(uint8_t data) +void wico_state::dled0_w(u8 data) { m_diag_on = 0; m_digits[9] = 0; } // diagnostic display on -void wico_state::dled1_w(uint8_t data) +void wico_state::dled1_w(u8 data) { m_diag_on = 1; m_digits[9] = m_diag_segments; } -void wico_state::csols_w(uint8_t data) +// Continuous solenoids (d7 = flipper enable) +// 7 solenoids + flipen +void wico_state::csols_w(u8 data) { + for (u8 i = 0; i < 8; i++) + m_io_outputs[i] = BIT(data, i); } -void wico_state::msols_w(uint8_t data) +// Matrix solenoids +// d0,1,2 = 1 to 6; d3,4,5 = 1 to 6; total 36 solenoids +void wico_state::msols_w(u8 data) { + u8 k = BIT(data, 3, 3) - 1; + if (k < 6) + for (u8 i = 0; i < 6; i++) + m_io_outputs[8+k*6+i] = (BIT(data, 0, 3) == (i+1)); + // Outhole + if (data == 0x1c) + m_samples->start(0, 5); } // write to diagnostic display -void wico_state::muxen_w(uint8_t data) +void wico_state::muxen_w(u8 data) { - static const uint8_t patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71 }; // MC14495 + static const u8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71 }; // MC14495 m_diag_segments = patterns[data>>4]; @@ -352,30 +365,28 @@ void wico_state::muxen_w(uint8_t data) } // reset digit/scan counter -void wico_state::muxld_w(uint8_t data) +void wico_state::muxld_w(u8 data) { } // enable zero-crossing interrupt -void wico_state::zcres_w(uint8_t data) +void wico_state::zcres_w(u8 data) { m_zcen = 1; } // enable firq -uint8_t wico_state::gentmrcl_r() +u8 wico_state::gentmrcl_r() { m_gten = 1; return 0xff; } // read a switch row -uint8_t wico_state::switch_r(offs_t offset) +u8 wico_state::switch_r(offs_t offset) { - char kbdrow[8]; offset = m_shared_ram[0x95]; - sprintf(kbdrow,"X%X",offset); - uint8_t data = ioport(kbdrow)->read(); + u8 data = m_io_keyboard[offset]->read(); // Reflex solenoids - operated directly by the switches without needing the cpu if ((offset==2) && (data & 15)) @@ -388,7 +399,7 @@ uint8_t wico_state::switch_r(offs_t offset) } // write digits in main display -uint8_t wico_state::lampst_r() +u8 wico_state::lampst_r() { int i, j; for (i = 0; i < 5; i++) @@ -399,11 +410,19 @@ uint8_t wico_state::lampst_r() j = 0; m_digits[i * 10 + (m_shared_ram[0x96] & 7)] = bitswap<16>(j, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0); } + // Lamps + for (i = 0; i < 16; i++) + { + u8 k = m_shared_ram[0x46+i]; + for (j = 0; j < 8; j++) + m_io_outputs[48+i*8+j] = BIT(k, j); + } + return 0xff; } // reset watchdog and enable housekeeping cpu -void wico_state::wdogcl_w(uint8_t data) +void wico_state::wdogcl_w(u8 data) { m_hcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); } @@ -429,8 +448,27 @@ TIMER_DEVICE_CALLBACK_MEMBER( wico_state::firq_housekeeping ) } } +void wico_state::machine_start() +{ + genpin_class::machine_start(); + + m_digits.resolve(); + m_io_outputs.resolve(); + + save_item(NAME(m_zcen)); + save_item(NAME(m_gten)); + save_item(NAME(m_disp_on)); + save_item(NAME(m_diag_on)); + save_item(NAME(m_firqtimer)); + save_item(NAME(m_diag_segments)); +} + void wico_state::machine_reset() { + genpin_class::machine_reset(); + for (u8 i = 0; i < m_io_outputs.size(); i++) + m_io_outputs[i] = 0; + m_hcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); m_zcen = 0; m_gten = 0; @@ -478,4 +516,6 @@ ROM_END / Big Top (1977) /-------------------------------------------------------------------*/ -GAME(1984, aftor, 0, wico, wico, wico_state, empty_init, ROT0, "Wico", "Af-Tor", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) +} // Anonymous namespace + +GAME(1984, aftor, 0, wico, wico, wico_state, empty_init, ROT0, "Wico", "Af-Tor", MACHINE_IS_SKELETON_MECHANICAL ) |