summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Roberto Fresca <robbie@robertofresca.com>2018-12-05 23:06:03 +0100
committer Roberto Fresca <robbie@robertofresca.com>2018-12-05 23:06:03 +0100
commitdb7e370bd8c7b2653c8c149776eafb80c9478d01 (patch)
treed05ce6b636cabb4656322b69ee91a450dd7192dc
parentccd87f82eccea439f54cea6b765178d1dea409c9 (diff)
New working machines
-------------------- Super Ball (Version EC-3.50 N322) [Grull Osgo] Super Ball (Version EC-3.50 N165) [Grull Osgo]
-rw-r--r--scripts/target/mame/arcade.lua1
-rw-r--r--src/mame/arcade.flt1
-rw-r--r--src/mame/drivers/rulechan.cpp845
-rw-r--r--src/mame/layout/rulechan.lay459
-rw-r--r--src/mame/mame.lst4
5 files changed, 1310 insertions, 0 deletions
diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua
index 628ed456a37..4dce34bce63 100644
--- a/scripts/target/mame/arcade.lua
+++ b/scripts/target/mame/arcade.lua
@@ -4796,6 +4796,7 @@ files {
MAME_DIR .. "src/mame/drivers/re900.cpp",
MAME_DIR .. "src/mame/drivers/rgum.cpp",
MAME_DIR .. "src/mame/drivers/roul.cpp",
+ MAME_DIR .. "src/mame/drivers/rulechan.cpp",
MAME_DIR .. "src/mame/drivers/savquest.cpp",
MAME_DIR .. "src/mame/drivers/sanremo.cpp",
MAME_DIR .. "src/mame/drivers/sanremmg.cpp",
diff --git a/src/mame/arcade.flt b/src/mame/arcade.flt
index 2f75379a9d9..8f88f0f84fa 100644
--- a/src/mame/arcade.flt
+++ b/src/mame/arcade.flt
@@ -997,6 +997,7 @@ route16.cpp
rowamet.cpp
royalmah.cpp
rpunch.cpp
+rulechan.cpp
runaway.cpp
rungun.cpp
s11.cpp
diff --git a/src/mame/drivers/rulechan.cpp b/src/mame/drivers/rulechan.cpp
new file mode 100644
index 00000000000..5eac5855c19
--- /dev/null
+++ b/src/mame/drivers/rulechan.cpp
@@ -0,0 +1,845 @@
+// license:BSD-3-Clause
+// copyright-holders: Grull Osgo.
+/********************************************************************
+
+ Electrochance.
+ 6-player Electromechanical Roulette.
+
+ Copyright 199x by Electro Chance.
+ Industria Argentina.
+
+ Driver by Grull Osgo.
+
+ 2 sets dumped:
+
+*********************************************************************
+
+ PCB specs: Hardware not available
+
+*********************************************************************
+
+ Edge Connector:
+
+
+ Solder side | | Components
+ -----------------|--|-----------------
+ +5Vcc |01| GND
+ +5Vcc |02| -5Vcc
+ Player 2 |03| Player 1
+ Player 4 |04| Player 3
+ Player 6 |06| Player 5
+ |07|
+ |08| Left
+ Right |09| Down
+ Credits IN |10| Credits OUT
+ Bet |11| Up
+ |12|
+ |13|
+ |14|
+ |15|
+ |16|
+ |17|
+ |18| +5VCC
+ Counter IN |19|
+ |20| Counter OUT
+ Operator Key |21|
+ |22| Programming
+ |23|
+ Green |24| Sync
+ Blue |25| Red
+ +12Vcc |26| Speaker
+ +5Vcc |27| GND
+ +5Vcc |28| GND
+
+ DIP Switches:
+
+ .---------------------------------------+-----+-----+-----+-----+-----+-----+-----+-----.
+ | DIP Switches | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
+ +---------------------------------------+-----+-----+-----+-----+-----+-----+-----+-----+
+ +---------------------------------------+-----+-----------------------------------------+
+ | Reset total No | OFF | |
+ | (Full Reset) Si | ON | |
+ '---------------------------------------+-----+-----+-----------------------------------+
+ | Repite No | | OFF | |
+ | Si | | ON | |
+ +---------------------------------------+-----+-----+-----+-----------------------------+
+ | Demo No | | | OFF | |
+ | Si | | | ON | |
+ +---------------------------------------+-----+-----+-----+-----+-----------------------+
+ | Acceso a Pagina No | | OFF | |
+ | (settings access) Si | | ON | |
+ +---------------------------------------+-----------------+-----+-----+-----------------+
+ | Test plato No | | OFF | |
+ | Si | | ON | |
+ +---------------------------------------+-----------------------+-----+-----+-----------+
+ | Inmovilizar No | | OFF | |
+ | Si | | ON | |
+ +---------------------------------------+-----------------------------+-----+-----+-----+
+ | Doble cero No | | OFF | |
+ | (Jackpot program) Si | | ON | |
+ +---------------------------------------+-----------------------------------+-----+-----+
+ | Castellano No | | OFF |
+ | Si | | ON |
+ +---------------------------------------+-----------------------------------------+-----+
+
+*********************************************************************
+
+ Game Initialization
+ -------------------
+ (You must enable "LAMPS" layout for this procedure)
+
+ When the game runs by the very first time (no nvram yet), it will
+ complain about "DATA ERROR" in a blue message window. After a few
+ seconds, it will bring up another red window with the "HARD ERROR 02"
+ message.
+
+ So, we must initialize the game following the next instructions:
+
+ 1.- Toggle on "Operator Key" (turn to green).
+ 2.- Press once "Page Key". It will show a green window titled
+ "CONTROL ADMINISTRATIVO" and a message with a security token.
+ 3.- Press again "Page Key". It will bring up a new window where we
+ must type a password. At this time, in the layout, under the
+ roulette leds will appear the password we need (six numeric digits).
+ 4.- Ingress the required paswword using the credits in (IN1....IN6)
+ and credits out (OUT1...OUT6) buttons following the key assignment
+ indications located under the password field.
+ Use the "E" button to finish once all numbers were typed.
+ Use the "B" button clear last digit typed, in case of mistake.
+ 5.- Once finished that, and the the game will reboot and will be
+ ready to play. Also, password showed on layout will dissapear.
+
+ In case that, by unknown reason, the game asks for
+ "CONTROL ADMINISTRATIVO" again, follow the instructions starting
+ from step "1". After that we will can play again.
+*********************************************************************/
+
+
+/*********************************************************************
+
+ Dev notes:
+
+ Again, this driver was written based on a couple of ROM dumps and a
+ lot of reverse engineering, with no harware available, but guessing
+ that this firmware and hardware are similar to others well known
+ roulettes like Lucky Ball, Lucky Roulette, Corona, Re900, etc...
+
+ The most exciting part of this work was discover that this game runs
+ with an electromechanical roulette, not a tipical LED roulette. It
+ added an extra challenge to the work, wich implies a full develop
+ of an electromechanical part simulation, objective that finally
+ could be reached.
+
+ Surprisingly, this game firmware includes a full communications
+ module, accesible via RS232 serial interface, that let the users
+ some useful things like reconfigure hardware and game options or
+ get different kinds of reports, like accounting, statistics and
+ many other technical items. All this tasks are performed from a
+ PC running a D.O.S. program provided by the maker and fortunately
+ still available. Even more, there is another stand alone D.O.S.
+ software provided by the maker, and also still available, to get
+ the passwords needed when hardware fails or administrative tasks
+ are required.
+
+ Another interesting thing found on this game is that it can be
+ configured for a single or a double zero roulette, depending on
+ what kind of roulette has attached.
+
+*********************************************************************/
+
+#define CPU_CLOCK XTAL(8'000'000)
+#define VID_CLOCK XTAL(10'730'000)
+#define TMS_CLOCK XTAL(1'750'000)
+#define VDP_MEM 0x20000 // 4x 4464 (64K x 4 DRAM)
+
+#include <conio.h>
+#include "emu.h"
+#include "cpu/z80/z80.h"
+#include "machine/nvram.h"
+#include "machine/eepromser.h"
+#include "machine/timer.h"
+#include "video/v9938.h"
+#include "sound/ay8910.h"
+#include "screen.h"
+#include "speaker.h"
+#include "rulechan.lh"
+
+#define BIT2 BIT(m_p30,2)
+#define BIT3 BIT(m_p30,3)
+#define BIT4 BIT(m_p30,4)
+#define BIT5 BIT(m_p30,5)
+
+#define SND_FLG 0xf009
+#define RAM_PSW 0xf078
+
+#define BALLIN (m_ballin>=2)
+#define MOTORON (m_p32!=0xf0)
+#define LEDNOTNUM (m_led!=m_num)
+
+class rulechan_state : public driver_device
+{
+public:
+ rulechan_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_v9938(*this, "v9938")
+ , m_maincpu(*this, "maincpu")
+ , m_eeprom(*this, "eeprom")
+ , m_aux(*this, "AUX")
+ , m_dsw(*this, "DSW")
+ , m_tty(*this, "TTY")
+ , m_keymx(*this, "IN%u", 0)
+ , m_lamps(*this, "lamp%u", 0U)
+ , m_digits(*this, "digit%u", 0U)
+ { }
+
+ void rulechan(machine_config &config);
+ void rulechan_init();
+
+private:
+
+ DECLARE_READ8_MEMBER(port0_r);
+ DECLARE_WRITE8_MEMBER(port0_w);
+ DECLARE_READ8_MEMBER(port2_r);
+ DECLARE_READ8_MEMBER(port3_r);
+ DECLARE_READ8_MEMBER(port30_r);
+ DECLARE_READ8_MEMBER(port31_r);
+ DECLARE_WRITE8_MEMBER(port31_w);
+ DECLARE_WRITE8_MEMBER(port32_w);
+ DECLARE_READ8_MEMBER(port40_r);
+ DECLARE_WRITE8_MEMBER(port40_w);
+ DECLARE_READ8_MEMBER(port41_r);
+ DECLARE_READ8_MEMBER(psg_portA_r);
+ DECLARE_READ8_MEMBER(psg_portB_r);
+
+ TIMER_DEVICE_CALLBACK_MEMBER( ball_speed );
+ TIMER_DEVICE_CALLBACK_MEMBER( wheel_speed );
+
+ uint8_t m_sline;
+ uint8_t m_stat;
+ uint8_t m_p30;
+ uint8_t m_p31;
+ uint8_t m_p32;
+ uint8_t m_step;
+ uint8_t m_updn2;
+ uint8_t m_updn3;
+ uint8_t m_updn4;
+ uint8_t m_num;
+ uint8_t m_spin;
+ uint8_t m_tspin;
+ uint8_t d_spin;
+ uint8_t m_ballin;
+ uint8_t m_led;
+ uint32_t m_lastk=0;
+ uint8_t m_pass[6];
+ uint8_t m_sndsrt[10]= { 0x0a, 0x0e, 0x06, 0x0a, 0x0b, 0x48, 0x0c, 0x00, 0x0d, 0x01 };
+
+ required_device<v9938_device> m_v9938;
+ required_device<cpu_device> m_maincpu;
+ required_device<eeprom_serial_93cxx_device> m_eeprom;
+ required_ioport m_aux;
+ required_ioport m_dsw;
+ required_ioport m_tty;
+ required_ioport_array<6> m_keymx;
+
+ void main_io(address_map &map);
+ void main_map(address_map &map);
+ void sound_sort();
+ void sound_off();
+
+ virtual void machine_start() override { m_lamps.resolve(); m_digits.resolve(); }
+ output_finder<63> m_lamps;
+ output_finder<6> m_digits;
+};
+
+/* BCD to Seven Segment Decoder */
+
+static uint8_t dec_7seg(int data)
+{
+ uint8_t segment;
+ switch (data)
+ {
+ case 0: segment = 0x3f; break;
+ case 1: segment = 0x06; break;
+ case 2: segment = 0x5b; break;
+ case 3: segment = 0x4f; break;
+ case 4: segment = 0x66; break;
+ case 5: segment = 0x6d; break;
+ case 6: segment = 0x7d; break;
+ case 7: segment = 0x07; break;
+ case 8: segment = 0x7f; break;
+ case 9: segment = 0x6f; break;
+ default: segment = 0x00;
+ }
+
+ return segment;
+}
+
+/**************************************
+* Memory Map *
+**************************************/
+
+void rulechan_state::main_map(address_map &map)
+{
+ map(0x0000, 0xdfff).rom();
+ map(0xe000, 0xffff).ram().share("nvram");
+}
+
+void rulechan_state::main_io(address_map &map)
+{
+ map.global_mask(0xff);
+
+ map(0x00, 0x00).rw(FUNC(rulechan_state::port0_r),FUNC(rulechan_state::port0_w)); /* Matrix scan line selector - Must be 0xf0 at power up */
+ map(0x01, 0x01).portw("EEPROMOUT"); /* eeprom ok */
+ map(0x02, 0x02).r(FUNC(rulechan_state::port2_r)); /* Matriz button read */
+ map(0x03, 0x03).r(FUNC(rulechan_state::port3_r));
+ map(0x10, 0x11).w("ay8910", FUNC(ay8910_device::address_data_w)); /* sound ok */
+ map(0x12, 0x12).r("ay8910", FUNC(ay8910_device::data_r)); /* ports ok */
+ map(0x20, 0x23).rw(m_v9938, FUNC(v9938_device::read), FUNC(v9938_device::write)); /* video ok */
+ map(0x30, 0x30).r(FUNC(rulechan_state::port30_r)); /* wheel control */
+ map(0x31, 0x31).rw(FUNC(rulechan_state::port31_r),FUNC(rulechan_state::port31_w)); /* wheel control - read: Must be 0x00 at power up*/
+ map(0x32, 0x32).w(FUNC(rulechan_state::port32_w)); /* wheel control */
+ map(0x40, 0x40).rw(FUNC(rulechan_state::port40_r),FUNC(rulechan_state::port40_w)); /* RS232 - tty console - Data Unknown serial device */
+ map(0x41, 0x41).r(FUNC(rulechan_state::port41_r)); /* RS232 - tty console - Status Unknown serial device */
+ map(0x42, 0x43).nopr().nopw();
+ map(0x60, 0x60).nopw(); /* Watchdog */
+}
+
+/****************
+* Read Handlers *
+****************/
+
+READ8_MEMBER(rulechan_state::port0_r)
+{
+ return 0xf0;
+}
+
+READ8_MEMBER(rulechan_state::port2_r)
+{
+ return m_keymx[m_sline]->read();
+}
+
+READ8_MEMBER(rulechan_state::port3_r)
+{
+ return 0xff;
+}
+
+/******************************
+ Port 30 - Wheel control *
+* bit 2 - ball detector *
+* bit 3 - step detector *
+* bit 4 - Zero detector *
+* bit 5 - Ball in shotter *
+******************************/
+
+READ8_MEMBER(rulechan_state::port30_r)
+{
+ return m_p30;
+}
+
+READ8_MEMBER(rulechan_state::port31_r)
+{
+ return 0x00;
+}
+
+/**********************
+* Port 40h *
+* serial data port *
+**********************/
+
+READ8_MEMBER(rulechan_state::port40_r)
+{
+ uint8_t retval;
+ uint32_t inp;
+ inp=m_tty->read();
+ switch (inp)
+ {
+ case 0x00000001:retval=0x31;break;
+ case 0x00000002:retval=0x32;break;
+ case 0x00000004:retval=0x33;break;
+ case 0x00000008:retval=0x34;break;
+ case 0x00000010:retval=0x35;break;
+ case 0x00000020:retval=0x36;break;
+ case 0x00000040:retval=0x37;break;
+ case 0x00000080:retval=0x38;break;
+ case 0x00000100:retval=0x39;break;
+ case 0x00000200:retval=0x30;break;
+ case 0x00000400:retval=0x0d;break;
+ case 0x00000800:retval=0x3a;break;
+ case 0x00001000:retval=0x08;break;
+ case 0x00002000:retval=0x20;break;
+ case 0x00004000:retval=0x52;break;
+ case 0x00008000:retval=0x53;break;
+ case 0x00010000:retval=0x54;break;
+ case 0x00020000:retval=0x56;break;
+ case 0x00040000:retval=0x4b;break;
+ case 0x00080000:retval=0x57;break;
+ case 0x00100000:retval=0x55;break;
+ case 0x00200000:retval=0x58;break;
+ case 0x00400000:retval=0x4e;break;
+ case 0x00800000:retval=0x59;break;
+ case 0x01000000:retval=0x5a;break;
+ case 0x02000000:retval=0x51;break;
+ case 0x04000000:retval=0x6c;break;
+ case 0x08000000:retval=0x48;break;
+ case 0x10000000:retval=0x49;break;
+ case 0x20000000:retval=0x4a;break;
+ case 0x40000000:retval=0x4f;break;
+ case 0x80000000:retval=0x70;break;
+ default: retval=0;
+ }
+ m_stat &= 0xf7; /* down rx enable */
+ m_stat|= 0x10; /* up tx enable */
+ if (inp) m_lastk = inp;
+ return retval;
+}
+
+/**********************
+* Port 41h *
+* serial port status *
+* bit 3 = rx ready *
+* bit 4 - tx ready *
+***********************/
+
+READ8_MEMBER(rulechan_state::port41_r) /* console port status- bit 3 = rx ready / bit 4 - tx ready */
+{
+ uint32_t keys;
+ keys=m_tty->read();
+ if(!keys) { m_stat&=0xf7; m_lastk=0;}
+ else
+ if(keys == m_lastk) m_stat&=0xf7;
+ else m_stat|=0x08;
+ return m_stat;
+}
+
+READ8_MEMBER(rulechan_state::psg_portA_r)
+{
+ m_lamps[60] = (BIT(m_aux->read(), 3))?0:1; /* Show Operator Key via layout lamp */
+ m_lamps[61] = (BIT(m_aux->read(), 7))?0:1; /* Show Page Key via layout lamp */
+ return m_aux->read(); /* Operator Key read */
+}
+
+READ8_MEMBER(rulechan_state::psg_portB_r)
+{
+ return m_dsw->read(); /* DipSw read */
+}
+
+/***********************
+* Write Handlers *
+***********************/
+
+WRITE8_MEMBER(rulechan_state::port0_w)
+{
+ m_sline = data & 0x07; /* Matrix scan line selector */
+ if (m_sline>5) m_sline=0;
+}
+
+/****************************************
+ Port 31 - Wheel driver *
+* bit 1 - Port 32 Data Latch impulse *
+* bit 4 - ball drop control *
+* bit 7 - ball shooter *
+****************************************/
+
+WRITE8_MEMBER(rulechan_state::port31_w)
+{
+ m_p31=data;
+ if( BIT(m_p31,4)) { m_p30|=0x20; m_ballin=0;} /* Drop ball....ball in shooter */
+ if(BIT(m_p31,7)) /* Shoot ball */
+ {
+ m_p30&=0xdf; /* ball out.... */
+ m_num = machine().rand() % 37; /* sort winning number */
+ //logerror("shooting ball 2d\n", m_num);
+ }
+}
+
+/****************************************
+ Port 32h - Motor Control *
+* *
+* data latch for speed control ... *
+* *
+****************************************/
+
+WRITE8_MEMBER(rulechan_state::port32_w)
+{
+ m_p32=data;
+}
+
+/**********************
+* Port 40h *
+* serial data port *
+**********************/
+
+WRITE8_MEMBER(rulechan_state::port40_w)
+{
+ printf("%c",data); /* Serial data out - Console */
+}
+
+/************************************************
+* Extra Sound - Roulette spinning ball *
+************************************************/
+
+void rulechan_state::sound_off()
+{
+ m_maincpu->space(AS_IO).write_byte(0x10, 0x07);
+ m_maincpu->space(AS_IO).write_byte(0x11, m_maincpu->space(AS_PROGRAM).read_byte(SND_FLG) | 0x20);
+ m_maincpu->space(AS_IO).write_byte(0x10, 0x0e);
+}
+
+void rulechan_state::sound_sort()
+{
+ for (int i=0;i<5;i++)
+ {
+ m_maincpu->space(AS_IO).write_byte(0x10, m_sndsrt[(2*i)]);
+ m_maincpu->space(AS_IO).write_byte(0x11, m_sndsrt[(2*i)+1]);
+ }
+ m_maincpu->space(AS_IO).write_byte(0x10, 0x07);
+ m_maincpu->space(AS_IO).write_byte(0x11, m_maincpu->space(AS_PROGRAM).read_byte(SND_FLG) & 0xdf);
+ m_maincpu->space(AS_IO).write_byte(0x10, 0x0e);
+}
+
+/***********************
+* Wheel Simulation *
+***********************/
+TIMER_DEVICE_CALLBACK_MEMBER(rulechan_state::wheel_speed)
+{
+ if(m_step==0)
+ {
+ if((BIT4) & (m_updn4==0))
+ {
+ m_p30&=0xef;
+ m_updn4=1;
+ //logerror("1:port_p30:- Reset bit 4 pulse start -%2x cont_pasos:%2d\n",m_p30, m_step);
+ return;
+ }
+
+ if((!BIT4) & (m_updn4==1))
+ {
+ m_p30|=0x10;
+
+ //logerror("2:port_p30:- Set bit 4 -%2x cont_pasos:%2d\n",m_p30, m_step);
+ return;
+ }
+
+ if((BIT4) & (m_updn4==1))
+ {
+ m_updn4=0;
+ m_step++;
+ //logerror("3:port_p30:-end mark for reset bit 4 -%2x cont_pasos:%2d\n",m_p30, m_step);
+ return;
+ }
+ }
+ else
+ {
+
+ if(BIT3 & (m_updn3==0))
+ {
+ m_p30&=0xf7;
+ //logerror("4:port_p30:-reset bit 3 -%2x cont_pasos:%2d\n",m_p30, m_step);
+ return;
+ }
+
+ if(!BIT3 & (m_updn3==0))
+ {
+ if(!BIT2)
+ {
+ m_p30|= 0x04;
+ //logerror("5:port_p30:-set bit 2 -%2x cont_pasos:%2d\n",m_p30, m_step);
+ return;
+ }
+ else
+ {
+ if((m_step-1==m_num) & (m_updn2==0))
+ {
+ if(!BIT5) /* ball in pocket? */
+ {
+ m_p30&= 0xfb;
+ m_updn2=1;
+ m_ballin++;
+ logerror("Ball In Pocket m_num:%2x\n", m_num);
+ return;
+ }
+ }
+ }
+ m_updn2=0;
+ m_updn3=1;
+ }
+ if(!BIT3 & (m_updn3==1))
+ {
+ m_p30|=0x08;
+ m_updn3=0;
+ m_step++;
+ if (m_step==39){ m_step=0;m_p30|=0x1c;}
+ //logerror("6:port_p30:-set bit 3 -%2x cont_pasos:%2d \n",m_p30, m_step);
+ return;
+ }
+ }
+}
+
+/***********************
+* Ball Simulation *
+***********************/
+
+TIMER_DEVICE_CALLBACK_MEMBER(rulechan_state::ball_speed)
+{
+ if(MOTORON)
+ {
+ if(d_spin==0)
+ {
+ m_tspin++;
+ d_spin=m_spin;
+ if(BALLIN) m_tspin=37; /* braking ball once per number step */
+ if(m_tspin==37) { m_tspin=0; m_spin++; d_spin=m_spin;} /* braking ball once per round */
+ if( (!BALLIN) | (LEDNOTNUM & BALLIN ) )
+ {
+ m_led++;if(m_led==37) m_led=0;
+ for (int i=0;i<37;i++) m_lamps[i+20] = (m_led==i) ? 1:0; /* update roulette led lamps */
+ sound_sort();
+ }
+ }
+ else
+ {
+ d_spin--; /* burn cycles */
+ sound_off();
+ }
+ }
+ else
+ {
+ for (int i=0;i<37;i++) m_lamps[i+20] = (m_num==i) ? 1:0;
+ m_spin=d_spin=m_tspin=m_ballin=0;
+ }
+/* Ball simulation finished */
+
+/* if needed, get pass and shows it on layout*/
+ m_pass[0]= m_maincpu->space(AS_PROGRAM).read_byte(RAM_PSW);
+ if((m_pass[0]<=0x39)& (m_pass[0]>=0x30))
+ {
+ for(int i=0;i<6;i++)
+ {
+ m_pass[i]= m_maincpu->space(AS_PROGRAM).read_byte(RAM_PSW+i);
+ m_lamps[10+i] = dec_7seg(m_pass[i] - 0x30);
+ }
+ }
+ else
+ for(int i=0;i<6;i++) m_lamps[10+i] = dec_7seg(0xff);
+}
+
+/**************************************
+* Input Ports *
+**************************************/
+
+static INPUT_PORTS_START( rulechan )
+
+ PORT_START("IN0")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P1 Key-In") PORT_CODE(KEYCODE_1)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P1 Key-Out") PORT_CODE(KEYCODE_Z)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 )
+
+ PORT_START("IN1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P2 Key-In") PORT_CODE(KEYCODE_2)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P2 Key-Out") PORT_CODE(KEYCODE_X)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("IN2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P3 Key-In") PORT_CODE(KEYCODE_3)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P3 Key-Out") PORT_CODE(KEYCODE_C)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("IN3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P4 Key-In") PORT_CODE(KEYCODE_4)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P4 Key-Out") PORT_CODE(KEYCODE_V)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("IN4")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P5 Key-In") PORT_CODE(KEYCODE_5)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P5 Key-Out") PORT_CODE(KEYCODE_B)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Bet") PORT_CODE(KEYCODE_LCONTROL)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Up") PORT_CODE(KEYCODE_UP)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("IN5")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P6 Key-In") PORT_CODE(KEYCODE_6)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P6 Key-Out") PORT_CODE(KEYCODE_N)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("AUX")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Tilt 1") PORT_CODE(KEYCODE_7)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Tilt 2") PORT_CODE(KEYCODE_8)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_TOGGLE PORT_CODE(KEYCODE_0)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) /* bit 6 is EEPROM data */
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CODE(KEYCODE_9)
+
+ PORT_START("TTY")
+ PORT_BIT( 0x000000001, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)
+ PORT_BIT( 0x000000002, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)
+ PORT_BIT( 0x000000004, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)
+ PORT_BIT( 0x000000008, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)
+ PORT_BIT( 0x000000010, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)
+ PORT_BIT( 0x000000020, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)
+ PORT_BIT( 0x000000040, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)
+ PORT_BIT( 0x000000080, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD)
+ PORT_BIT( 0x000000100, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD)
+ PORT_BIT( 0x000000200, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD)
+ PORT_BIT( 0x000000400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("EN") PORT_CODE(KEYCODE_ENTER)
+ PORT_BIT( 0x000000800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(":") PORT_CODE(KEYCODE_COLON)
+ PORT_BIT( 0x000001000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE)
+ PORT_BIT( 0x000002000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SP") PORT_CODE(KEYCODE_SPACE)
+ PORT_BIT( 0x000004000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R)
+ PORT_BIT( 0x000008000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S)
+ PORT_BIT( 0x000010000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T)
+ PORT_BIT( 0x000020000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_M)
+ PORT_BIT( 0x000040000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K)
+ PORT_BIT( 0x000080000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W)
+ PORT_BIT( 0x000100000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U)
+ PORT_BIT( 0x000200000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_D)
+ PORT_BIT( 0x000400000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_F)
+ PORT_BIT( 0x000800000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
+ PORT_BIT( 0x001000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_A)
+ PORT_BIT( 0x002000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
+ PORT_BIT( 0x004000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("l") PORT_CODE(KEYCODE_L)
+ PORT_BIT( 0x008000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H)
+ PORT_BIT( 0x010000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I)
+ PORT_BIT( 0x020000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J)
+ PORT_BIT( 0x040000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O)
+ PORT_BIT( 0x080000000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("p") PORT_CODE(KEYCODE_RCONTROL)
+
+ PORT_START("DSW")
+ PORT_DIPNAME( 0x01, 0x01, "Borrado Total" ) PORT_DIPLOCATION("DSW:1")
+ PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x02, 0x02, "Repite" ) PORT_DIPLOCATION("DSW:2")
+ PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x04, 0x04, "Demo" ) PORT_DIPLOCATION("DSW:3")
+ PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x08, 0x08, "Acceso" ) PORT_DIPLOCATION("DSW:4")
+ PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x10, 0x10, "Test de Plato" ) PORT_DIPLOCATION("DSW:5")
+ PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x20, 0x20, "Inmoviliza" ) PORT_DIPLOCATION("DSW:6")
+ PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x40, 0x40, "Doble Cero" ) PORT_DIPLOCATION("DSW:7")
+ PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x80, 0x80, "Castellano" ) PORT_DIPLOCATION("DSW:8")
+ PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_START( "EEPROMOUT" )
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, di_write) /* bit 3 is data (active high) */
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write) /* bit 4 is clock (active high) */
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, cs_write) /* bit 5 is cs */
+
+INPUT_PORTS_END
+
+/**************************************
+* Machine Driver *
+**************************************/
+
+MACHINE_CONFIG_START(rulechan_state::rulechan)
+
+ /* basic machine hardware */
+ Z80(config, m_maincpu, CPU_CLOCK);
+ m_maincpu->set_addrmap(AS_PROGRAM, &rulechan_state::main_map);
+ m_maincpu->set_addrmap(AS_IO, &rulechan_state::main_io);
+ m_maincpu->set_periodic_int(FUNC(rulechan_state::irq0_line_hold), attotime::from_hz(120));
+
+ /* nvram */
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
+
+ /* eeprom */
+ EEPROM_93C46_8BIT(config, "eeprom");
+
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("ball_speed", rulechan_state, ball_speed, attotime::from_hz(60))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("wheel_speed", rulechan_state, wheel_speed, attotime::from_hz(60))
+
+ /* video hardware */
+ v9938_device &v9938(V9938(config, "v9938", VID_CLOCK));
+ v9938.set_screen_ntsc("screen");
+ v9938.set_vram_size(VDP_MEM);
+ //v9938.int_cb().set_inputline("maincpu", 0);
+ SCREEN(config, "screen", SCREEN_TYPE_RASTER);
+
+ /* sound hardware */
+ SPEAKER(config, "mono").front_center();
+ ay8910_device &ay_re900(AY8910(config, "ay8910", TMS_CLOCK)); /* From TMS9128NL - Pin 37 (GROMCLK) */
+ ay_re900.port_a_read_callback().set(FUNC(rulechan_state::psg_portA_r));
+ ay_re900.port_b_read_callback().set(FUNC(rulechan_state::psg_portB_r));
+ ay_re900.add_route(ALL_OUTPUTS, "mono", 0.5);
+
+MACHINE_CONFIG_END
+
+/**************************************
+* ROM Load *
+**************************************/
+
+ROM_START( rulechan )
+ ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_LOAD( "eprom322", 0x00000, 0x10000, CRC(a78e106f) SHA1(23e25ca60296e8002df9b9cf16ad8fe8a1e6c93b) )
+ ROM_REGION(0x80, "eeprom", 0)
+ ROM_LOAD( "eeprom.322", 0x0000, 0x0080, CRC(ded905d2) SHA1(999e8e54a31a232092c4345434b93358226d1144) )
+
+ROM_END
+
+ROM_START( rulechab )
+ ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_LOAD( "eprom165", 0x00000, 0x10000, CRC(1669f266) SHA1(14e70b91e260e3bc338870936954e09c182fe591) )
+ ROM_REGION(0x80, "eeprom", 0)
+ ROM_LOAD( "eeprom.165", 0x0000, 0x0080, CRC(042ac516) SHA1(a32d82acb438cceda0f03b58be6977eeb589836c) )
+ROM_END
+
+/************************
+* Driver Init *
+************************/
+void rulechan_state::rulechan_init()
+{
+ m_p30=0x3c;
+ m_p32=0Xf0; /* Motor off at startup */
+ m_step=0;
+ m_stat=0;
+ m_updn2=0;
+ m_updn3=0;
+ m_updn4=0;
+}
+
+/**************************************
+* Game Driver(s) *
+**************************************/
+
+// YEAR NAME PARENT MACHINE INPUT STATE INIT ROT COMPANY FULLNAME FLAGS LAYOUT
+GAMEL(1991, rulechan, 0, rulechan, rulechan, rulechan_state, rulechan_init, ROT0, "ElectroChance", "Super Ball (Version EC-3.50 N322)", MACHINE_SUPPORTS_SAVE, layout_rulechan)
+GAMEL(1991, rulechab, 0, rulechan, rulechan, rulechan_state, rulechan_init, ROT0, "ElectroChance", "Super Ball (Version EC-3.50 N165)", MACHINE_SUPPORTS_SAVE, layout_rulechan)
+
diff --git a/src/mame/layout/rulechan.lay b/src/mame/layout/rulechan.lay
new file mode 100644
index 00000000000..8aa58259373
--- /dev/null
+++ b/src/mame/layout/rulechan.lay
@@ -0,0 +1,459 @@
+<?xml version="1.0"?>
+<mamelayout version="2">
+
+ <element name="DIGIT" defstate="0">
+ <led7seg><color red="0.0" green="0.45" blue="0.45" /></led7seg>
+ </element>
+ <element name="BALL0">
+ <disk state = "0">
+ <color red="0.0" green="0.3" blue="0" />
+ </disk>
+ <disk state = "1">
+ <color red="0" green="1" blue="0" />
+ </disk>
+ </element>
+ <element name="BALL">
+ <disk state = "0">
+ <color red="0.3" green="0" blue="0" />
+ </disk>
+ <disk state = "1">
+ <color red="1" green="0" blue="0" />
+ </disk>
+ </element>
+ <element name="BOT"><disk><color red="0" green="0.4" blue="0" /></disk></element>
+ <element name="BBET"><disk><color red="0" green="0.4" blue="0" /></disk><text string="Bet"><color red="0.0" green="0.2" blue="0.0" /></text></element>
+ <element name="B_UP"><disk><color red="0" green="0.4" blue="0" /></disk><text string="Up"><color red="0.0" green="0.2" blue="0.0" /></text></element>
+ <element name="BDWN"><disk><color red="0" green="0.4" blue="0" /></disk><text string="Down"><color red="0.0" green="0.2" blue="0.0" /></text></element>
+ <element name="BLEF"><disk><color red="0" green="0.4" blue="0" /></disk><text string="Left"><color red="0.0" green="0.2" blue="0.0" /></text></element>
+ <element name="BRIG"><disk><color red="0" green="0.4" blue="0" /></disk><text string="Right"><color red="0.0" green="0.2" blue="0.0" /></text></element>
+
+ <element name="L0" defstate="1">
+ <rect state="0">
+ <color red="0.7" green="0.0" blue="0.0" />
+ </rect>
+ <text state ="0" string="Operator Key">
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <rect state="1">
+ <color red="0.0" green="0.7" blue="0.0" />
+ </rect>
+ <text state ="1" string="Operator Key">
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+ <element name="L00" defstate="1">
+ <rect state="0">
+ <color red="0.7" green="0.0" blue="0.0" />
+ </rect>
+ <text state ="0" string="Page Key">
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <rect state="1">
+ <color red="0.0" green="0.7" blue="0.0" />
+ </rect>
+ <text state ="1" string="Page Key">
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+ <element name="LI1" defstate="0">
+ <rect state="1">
+ <color red="0.0" green="0.7" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.0" green="0.3" blue="0.0" />
+ </rect>
+ <text string="IN 1">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LI2" defstate="0">
+ <rect state="1">
+ <color red="0.0" green="0.7" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.0" green="0.3" blue="0.0" />
+ </rect>
+ <text string="IN 2">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LI3" defstate="0">
+ <rect state="1">
+ <color red="0.0" green="0.7" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.0" green="0.3" blue="0.0" />
+ </rect>
+ <text string="IN 3">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LI4" defstate="0">
+ <rect state="1">
+ <color red="0.0" green="0.7" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.0" green="0.3" blue="0.0" />
+ </rect>
+ <text string="IN 4">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LI5" defstate="0">
+ <rect state="1">
+ <color red="0.0" green="0.7" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.0" green="0.3" blue="0.0" />
+ </rect>
+ <text string="IN 5">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LI6" defstate="0">
+ <rect state="1">
+ <color red="0.0" green="0.7" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.0" green="0.3" blue="0.0" />
+ </rect>
+ <text string="IN 6">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LO1" defstate="0">
+ <rect state="1">
+ <color red="0.7" green="0.0" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.3" green="0.0" blue="0.0" />
+ </rect>
+ <text string="OUT 1">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LO2" defstate="0">
+ <rect state="1">
+ <color red="0.7" green="0.0" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.3" green="0.0" blue="0.0" />
+ </rect>
+ <text string="OUT 2">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LO3" defstate="0">
+ <rect state="1">
+ <color red="0.7" green="0.0" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.3" green="0.0" blue="0.0" />
+ </rect>
+ <text string="OUT 3">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LO4" defstate="0">
+ <rect state="1">
+ <color red="0.7" green="0.0" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.3" green="0.0" blue="0.0" />
+ </rect>
+ <text string="OUT 4">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LO5" defstate="0">
+ <rect state="1">
+ <color red="0.7" green="0.0" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.3" green="0.0" blue="0.0" />
+ </rect>
+ <text string="OUT 5">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <element name="LO6" defstate="0">
+ <rect state="1">
+ <color red="0.7" green="0.0" blue="0.0" />
+ </rect>
+ <rect state="0">
+ <color red="0.3" green="0.0" blue="0.0" />
+ </rect>
+ <text string="OUT 6">
+ <color red="0.0" green="0.0" blue="0.0" />
+ <bounds x="0" y="0.1" width="1" height="0.8" />
+ </text>
+ </element>
+ <view name="Lamps">
+ <screen index="0">
+ <bounds left="100" top="0" right="832" bottom="1072" />
+ </screen>
+
+ <bezel name="lamp10" element="DIGIT"><bounds x="1140" y="550" width="20" height="30" /><orientation rotate="0" /></bezel>
+ <bezel name="lamp11" element="DIGIT"><bounds x="1160" y="550" width="20" height="30" /><orientation rotate="0" /></bezel>
+ <bezel name="lamp12" element="DIGIT"><bounds x="1180" y="550" width="20" height="30" /><orientation rotate="0" /></bezel>
+ <bezel name="lamp13" element="DIGIT"><bounds x="1200" y="550" width="20" height="30" /><orientation rotate="0" /></bezel>
+ <bezel name="lamp14" element="DIGIT"><bounds x="1220" y="550" width="20" height="30" /><orientation rotate="0" /></bezel>
+ <bezel name="lamp15" element="DIGIT"><bounds x="1240" y="550" width="20" height="30" /><orientation rotate="0" /></bezel>
+
+ <bezel element="BBET" inputtag="IN0" inputmask="0x04" >
+ <bounds x="270" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BDWN" inputtag="IN0" inputmask="0x08">
+ <bounds x="174" y="75" width="42" height="42" />
+ </bezel>
+ <bezel element="B_UP" inputtag="IN0" inputmask="0x10" >
+ <bounds x="174" y="25" width="42" height="42" />
+ </bezel>
+ <bezel element="BLEF" inputtag="IN0" inputmask="0x20">
+ <bounds x="126" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BRIG" inputtag="IN0" inputmask="0x40" >
+ <bounds x="222" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BBET" inputtag="IN1" inputmask="0x04" >
+ <bounds x="514" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BDWN" inputtag="IN1" inputmask="0x08">
+ <bounds x="418" y="75" width="42" height="42" />
+ </bezel>
+ <bezel element="B_UP" inputtag="IN1" inputmask="0x10" >
+ <bounds x="418" y="25" width="42" height="42" />
+ </bezel>
+ <bezel element="BLEF" inputtag="IN1" inputmask="0x20">
+ <bounds x="370" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BRIG" inputtag="IN1" inputmask="0x40" >
+ <bounds x="466" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BBET" inputtag="IN2" inputmask="0x04" >
+ <bounds x="758" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BDWN" inputtag="IN2" inputmask="0x08">
+ <bounds x="662" y="75" width="42" height="42" />
+ </bezel>
+ <bezel element="B_UP" inputtag="IN2" inputmask="0x10" >
+ <bounds x="662" y="25" width="42" height="42" />
+ </bezel>
+ <bezel element="BLEF" inputtag="IN2" inputmask="0x20">
+ <bounds x="614" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BRIG" inputtag="IN2" inputmask="0x40" >
+ <bounds x="710" y="50" width="42" height="42" />
+ </bezel>
+ <bezel element="BBET" inputtag="IN3" inputmask="0x04" >
+ <bounds x="758" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel element="BDWN" inputtag="IN3" inputmask="0x08">
+ <bounds x="662" y="1025" width="42" height="42" />
+ </bezel>
+ <bezel element="B_UP" inputtag="IN3" inputmask="0x10" >
+ <bounds x="662" y="975" width="42" height="42" />
+ </bezel>
+ <bezel element="BLEF" inputtag="IN3" inputmask="0x20">
+ <bounds x="614" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel element="BRIG" inputtag="IN3" inputmask="0x40" >
+ <bounds x="710" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel element="BBET" inputtag="IN4" inputmask="0x04" >
+ <bounds x="514" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel element="BDWN" inputtag="IN4" inputmask="0x08">
+ <bounds x="418" y="1025" width="42" height="42" />
+ </bezel>
+ <bezel element="B_UP" inputtag="IN4" inputmask="0x10" >
+ <bounds x="418" y="975" width="42" height="42" />
+ </bezel>
+ <bezel element="BLEF" inputtag="IN4" inputmask="0x20">
+ <bounds x="370" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel element="BRIG" inputtag="IN4" inputmask="0x40" >
+ <bounds x="466" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel element="BBET" inputtag="IN5" inputmask="0x04" >
+ <bounds x="270" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel element="BDWN" inputtag="IN5" inputmask="0x08">
+ <bounds x="174" y="1025" width="42" height="42" />
+ </bezel>
+ <bezel element="B_UP" inputtag="IN5" inputmask="0x10" >
+ <bounds x="174" y="975" width="42" height="42" />
+ </bezel>
+ <bezel element="BLEF" inputtag="IN5" inputmask="0x20">
+ <bounds x="126" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel element="BRIG" inputtag="IN5" inputmask="0x40" >
+ <bounds x="222" y="1000" width="42" height="42" />
+ </bezel>
+ <bezel name="lamp60" element="L0" inputtag="AUX" inputmask="0x08" >
+ <bounds x="1000" y="870" width="200" height="45" />
+ </bezel>
+ <bezel name="lamp61" element="L00" inputtag="AUX" inputmask="0x80" >
+ <bounds x="1270" y="870" width="200" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LI1" inputtag="IN0" inputmask="0x01" >
+ <bounds x="1000" y="950" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LO1" inputtag="IN0" inputmask="0x02">
+ <bounds x="1000" y="1000" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LI2" inputtag="IN1" inputmask="0x01" >
+ <bounds x="1080" y="950" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LO2" inputtag="IN1" inputmask="0x02">
+ <bounds x="1080" y="1000" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LI3" inputtag="IN2" inputmask="0x01" >
+ <bounds x="1160" y="950" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LO3" inputtag="IN2" inputmask="0x02">
+ <bounds x="1160" y="1000" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LI4" inputtag="IN3" inputmask="0x01" >
+ <bounds x="1240" y="950" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LO4" inputtag="IN3" inputmask="0x02">
+ <bounds x="1240" y="1000" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LI5" inputtag="IN4" inputmask="0x01" >
+ <bounds x="1320" y="950" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LO5" inputtag="IN4" inputmask="0x02">
+ <bounds x="1320" y="1000" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LI6" inputtag="IN5" inputmask="0x01" >
+ <bounds x="1400" y="950" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp60" element="LO6" inputtag="IN5" inputmask="0x02">
+ <bounds x="1400" y="1000" width="70" height="45" />
+ </bezel>
+ <bezel name="lamp20" element="BALL0">
+ <bounds x="1321.5755279531" y="319.178830824334" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp56" element="BALL">
+ <bounds x="1332.56513467655" y="335.702636395822" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp55" element="BALL">
+ <bounds x="1340.60412921523" y="353.84601461785" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp54" element="BALL">
+ <bounds x="1345.46124433281" y="373.087013532536" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp53" element="BALL">
+ <bounds x="1346.9967496707" y="392.872104633103" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp52" element="BALL">
+ <bounds x="1345.16647153601" y="412.632106871213" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp51" element="BALL">
+ <bounds x="1340.0230636983" y="431.798560959421" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp50" element="BALL">
+ <bounds x="1331.71449263647" y="449.820082909883" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp49" element="BALL">
+ <bounds x="1320.4797808126" y="466.178226347788" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp48" element="BALL">
+ <bounds x="1306.64213043088" y="480.402397269624" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp47" element="BALL">
+ <bounds x="1290.59962549863" y="492.083392175853" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp46" element="BALL">
+ <bounds x="1272.81377967425" y="500.885170110556" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp45" element="BALL">
+ <bounds x="1253.7962593595" y="506.554519947908" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp44" element="BALL">
+ <bounds x="1234.09416398871" y="508.928344815248" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp43" element="BALL">
+ <bounds x="1214.27428697419" y="507.938354093155" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp42" element="BALL">
+ <bounds x="1194.90681009169" y="503.613028012232" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp41" element="BALL">
+ <bounds x="1176.54890038884" y="496.076798328726" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp40" element="BALL">
+ <bounds x="1159.72868150364" y="485.546468649452" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp39" element="BALL">
+ <bounds x="1144.93004050891" y="472.32497738676" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp38" element="BALL">
+ <bounds x="1132.57870736225" y="456.792682771969" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp37" element="BALL">
+ <bounds x="1123.03000743027" y="439.396420641569" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp36" element="BALL">
+ <bounds x="1116.55863942476" y="420.636649783757" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp35" element="BALL">
+ <bounds x="1113.35077282082" y="401.053054650283" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp34" element="BALL">
+ <bounds x="1113.49869210012" y="381.209019617376" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp33" element="BALL">
+ <bounds x="1116.99814189431" y="361.675421442988" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp32" element="BALL">
+ <bounds x="1123.74844940422" y="343.014206181865" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp31" element="BALL">
+ <bounds x="1133.55542057307" y="325.762223020679" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp30" element="BALL">
+ <bounds x="1146.13692669582" y="310.415780104371" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp29" element="BALL">
+ <bounds x="1161.13102074843" y="297.416366654444" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp28" element="BALL">
+ <bounds x="1178.10634994466" y="287.137952127882" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp27" element="BALL">
+ <bounds x="1196.57456497046" y="279.876227796751" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp26" element="BALL">
+ <bounds x="1216.00436890452" y="275.840100248669" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp25" element="BALL">
+ <bounds x="1235.83680166342" y="275.145681524636" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp24" element="BALL">
+ <bounds x="1255.5013202655" y="277.812948787016" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp23" element="BALL">
+ <bounds x="1274.43221231367" y="283.765169612954" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp22" element="BALL">
+ <bounds x="1292.08487051111" y="292.831109446467" width="16" height="16" />
+ </bezel>
+ <bezel name="lamp21" element="BALL">
+ <bounds x="1307.95146002158" y="304.749957704861" width="16" height="16" />
+ </bezel>
+
+ </view>
+</mamelayout>
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index 1f306f90b3b..62d298040a7 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -33375,6 +33375,10 @@ rt1715w //
qwak // (proto) (c) 1982
runaway // (proto) (c) 1982
+@source:rulechan.cpp
+rulechan // 1992 ElectroChance
+rulechab // 1992 ElectroChance
+
@source:rungun.cpp
rungun // GX247 (c) 1993 (World)
runguna // GX247 (c) 1993 (World)