summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nicola Salmoria <nicola@mamedev.org>2008-05-29 08:02:46 +0000
committer Nicola Salmoria <nicola@mamedev.org>2008-05-29 08:02:46 +0000
commitceeb086b24102d67084bdf99825b2ba1452032d7 (patch)
treed57dc7b03c0d51d5c2e96b08900dc5a67731cc43
parent65934e7aa5f3ae7c7644162c7cf0752e2fbc12dc (diff)
removed meaningless service_coin_lockout_w function
updated the zaxxon driver to correctly handle the coin enable lines
-rw-r--r--src/emu/inptport.c25
-rw-r--r--src/emu/machine/generic.c15
-rw-r--r--src/emu/machine/generic.h4
-rw-r--r--src/mame/drivers/zaxxon.c53
4 files changed, 49 insertions, 48 deletions
diff --git a/src/emu/inptport.c b/src/emu/inptport.c
index c9cba5b9557..e4e0b2d882a 100644
--- a/src/emu/inptport.c
+++ b/src/emu/inptport.c
@@ -613,7 +613,7 @@ INLINE void *error_buf_append(char *errorbuf, int errorbuflen, const char *forma
if (strlen(format) + 25 < bytesleft)
vsprintf(&errorbuf[curlen], format, va);
va_end(va);
-
+
return NULL;
}
@@ -881,8 +881,8 @@ void input_field_set_user_settings(const input_field_config *field, const input_
/*-------------------------------------------------
- input_field_select_previous_setting - select
- the previous item for a DIP switch or
+ input_field_select_previous_setting - select
+ the previous item for a DIP switch or
configuration field
-------------------------------------------------*/
@@ -890,7 +890,7 @@ void input_field_select_previous_setting(const input_field_config *field)
{
const input_setting_config *setting, *prevsetting;
int found_match = FALSE;
-
+
/* only makes sense if we have settings */
assert(field->settinglist != NULL);
@@ -924,7 +924,7 @@ void input_field_select_previous_setting(const input_field_config *field)
/*-------------------------------------------------
input_field_select_next_setting - select the
- next item for a DIP switch or
+ next item for a DIP switch or
configuration field
-------------------------------------------------*/
@@ -2330,13 +2330,6 @@ static int frame_get_digital_field_state(const input_field_config *field)
ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field));
return FALSE;
}
-
- /* skip locked-out service inputs */
- if (field->type >= IPT_SERVICE1 && field->type <= IPT_SERVICE4 && servicecoinlockedout[field->type - IPT_SERVICE1])
- {
- ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field));
- return FALSE;
- }
}
return curstate;
}
@@ -2932,7 +2925,7 @@ static input_port_config *port_config_detokenize(input_port_config *listhead, co
break;
}
}
-
+
/* insert any pending fields */
if (curfield != NULL)
field_config_insert(curfield, &maskbits, errorbuf, errorbuflen);
@@ -3013,7 +3006,7 @@ static input_field_config *field_config_alloc(input_port_config *port, int type,
{
input_field_config *config;
int seqtype;
-
+
/* allocate memory */
config = malloc_or_die(sizeof(*config));
memset(config, 0, sizeof(*config));
@@ -3033,8 +3026,8 @@ static input_field_config *field_config_alloc(input_port_config *port, int type,
/*-------------------------------------------------
field_config_insert - insert an allocated
- input port field config, replacing any
- intersecting fields already present and
+ input port field config, replacing any
+ intersecting fields already present and
inserting at the correct sorted location
-------------------------------------------------*/
diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c
index 39c4479daeb..2034cd98314 100644
--- a/src/emu/machine/generic.c
+++ b/src/emu/machine/generic.c
@@ -24,7 +24,6 @@
UINT32 dispensed_tickets;
UINT32 coin_count[COIN_COUNTERS];
UINT32 coinlockedout[COIN_COUNTERS];
-UINT32 servicecoinlockedout[COIN_COUNTERS];
static UINT32 lastcoin[COIN_COUNTERS];
/* generic NVRAM */
@@ -70,13 +69,11 @@ void generic_machine_init(running_machine *machine)
{
lastcoin[counternum] = 0;
coinlockedout[counternum] = 0;
- servicecoinlockedout[counternum] = 0;
}
/* register coin save state */
state_save_register_item_array("coin", 0, coin_count);
state_save_register_item_array("coin", 0, coinlockedout);
- state_save_register_item_array("coin", 0, servicecoinlockedout);
state_save_register_item_array("coin", 0, lastcoin);
/* reset NVRAM size and pointers */
@@ -212,18 +209,6 @@ void coin_lockout_w(int num,int on)
/*-------------------------------------------------
- service_coin_lockout_w - locks out one coin input
--------------------------------------------------*/
-
-void service_coin_lockout_w(int num,int on)
-{
- if (num >= COIN_COUNTERS) return;
-
- servicecoinlockedout[num] = on;
-}
-
-
-/*-------------------------------------------------
coin_lockout_global_w - locks out all the coin
inputs
-------------------------------------------------*/
diff --git a/src/emu/machine/generic.h b/src/emu/machine/generic.h
index 54e812e0d46..96d39ac33c7 100644
--- a/src/emu/machine/generic.h
+++ b/src/emu/machine/generic.h
@@ -39,7 +39,6 @@
extern UINT32 dispensed_tickets;
extern UINT32 coin_count[COIN_COUNTERS];
extern UINT32 coinlockedout[COIN_COUNTERS];
-extern UINT32 servicecoinlockedout[COIN_COUNTERS];
extern size_t generic_nvram_size;
extern UINT8 *generic_nvram;
@@ -68,9 +67,6 @@ void coin_counter_w(int num, int on);
/* enable/disable coin lockout for a particular coin */
void coin_lockout_w(int num, int on);
-/* enable/disable coin lockout for a particular coin */
-void service_coin_lockout_w(int num, int on);
-
/* enable/disable global coin lockout */
void coin_lockout_global_w(int on);
diff --git a/src/mame/drivers/zaxxon.c b/src/mame/drivers/zaxxon.c
index 188545ac879..444b76ba68d 100644
--- a/src/mame/drivers/zaxxon.c
+++ b/src/mame/drivers/zaxxon.c
@@ -342,6 +342,8 @@
*************************************/
static UINT8 int_enabled;
+static UINT8 coin_status[3];
+static UINT8 coin_enable[3];
static UINT8 razmataz_dial_pos[2];
static UINT16 razmataz_counter;
@@ -388,6 +390,8 @@ static MACHINE_START( zaxxon )
{
/* register for save states */
state_save_register_global(int_enabled);
+ state_save_register_global_array(coin_status);
+ state_save_register_global_array(coin_enable);
}
@@ -453,15 +457,28 @@ static WRITE8_HANDLER( zaxxon_coin_counter_w )
}
-static WRITE8_HANDLER( zaxxon_coin_lockout_w )
+// There is no external coin lockout circuitry; instead, the pcb simply latches
+// the coin input, which then needs to be explicitly cleared by the game.
+static WRITE8_HANDLER( zaxxon_coin_enable_w )
{
- if (offset < 2)
- coin_lockout_w(offset, ~data & 0x01);
- else
- service_coin_lockout_w(offset, ~data & 0x01);
+ coin_enable[offset] = data & 1;
+ if (!coin_enable[offset])
+ coin_status[offset] = 0;
+}
+
+
+static INPUT_CHANGED( zaxxon_coin_inserted )
+{
+ if (newval)
+ coin_status[(int)param] = coin_enable[(int)param];
}
+static CUSTOM_INPUT( zaxxon_coin_r )
+{
+ return coin_status[(int)param];
+}
+
/*************************************
@@ -481,7 +498,7 @@ static ADDRESS_MAP_START( zaxxon_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x18fc) AM_READ_PORT("DSW02")
AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x18fc) AM_READ_PORT("DSW03")
AM_RANGE(0xc100, 0xc100) AM_MIRROR(0x18ff) AM_READ_PORT("SW100")
- AM_RANGE(0xc000, 0xc002) AM_MIRROR(0x18f8) AM_WRITE(zaxxon_coin_lockout_w)
+ AM_RANGE(0xc000, 0xc002) AM_MIRROR(0x18f8) AM_WRITE(zaxxon_coin_enable_w)
AM_RANGE(0xc003, 0xc004) AM_MIRROR(0x18f8) AM_WRITE(zaxxon_coin_counter_w)
AM_RANGE(0xc006, 0xc006) AM_MIRROR(0x18f8) AM_WRITE(zaxxon_flipscreen_w)
AM_RANGE(0xe03c, 0xe03f) AM_MIRROR(0x1f00) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
@@ -504,7 +521,7 @@ static ADDRESS_MAP_START( congo_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x1fc4) AM_READ_PORT("DSW02")
AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x1fc4) AM_READ_PORT("DSW03")
AM_RANGE(0xc008, 0xc008) AM_MIRROR(0x1fc7) AM_READ_PORT("SW100")
- AM_RANGE(0xc018, 0xc01a) AM_MIRROR(0x1fc0) AM_WRITE(zaxxon_coin_lockout_w)
+ AM_RANGE(0xc018, 0xc01a) AM_MIRROR(0x1fc0) AM_WRITE(zaxxon_coin_enable_w)
AM_RANGE(0xc01b, 0xc01c) AM_MIRROR(0x1fc0) AM_WRITE(zaxxon_coin_counter_w)
AM_RANGE(0xc01d, 0xc01d) AM_MIRROR(0x1fc0) AM_WRITE(zaxxon_bg_enable_w)
AM_RANGE(0xc01e, 0xc01e) AM_MIRROR(0x1fc0) AM_WRITE(zaxxon_flipscreen_w)
@@ -558,9 +575,14 @@ static INPUT_PORTS_START( zaxxon )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)0)
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)1)
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)2)
+
+ PORT_START_TAG("COIN")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(zaxxon_coin_inserted, (void *)0)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(zaxxon_coin_inserted, (void *)1)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CHANGED(zaxxon_coin_inserted, (void *)2)
PORT_START_TAG("SERVICESW")
PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH ) PORT_CHANGED(service_switch, 0)
@@ -742,9 +764,14 @@ static INPUT_PORTS_START( razmataz )
PORT_START_TAG("SW100")
PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)0)
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)1)
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)2)
+
+ PORT_START_TAG("COIN")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(zaxxon_coin_inserted, (void *)0)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(zaxxon_coin_inserted, (void *)1)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CHANGED(zaxxon_coin_inserted, (void *)2)
PORT_START_TAG("SERVICESW")
PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH )