mirror of
https://github.com/holub/mame
synced 2025-05-02 20:46:41 +03:00
Added uPD4990A clone to the uPD1990A, renamed uPD4990A -> uPD4990A_OLD for the time being (core used by Neo-Geo / Neo-Print, will be nuked at some point)
This commit is contained in:
parent
6f9f67c02c
commit
9952023cae
@ -84,8 +84,8 @@ struct upd4990a_state
|
||||
INLINE upd4990a_state *get_safe_token(device_t *device)
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert((device->type() == UPD4990A));
|
||||
return (upd4990a_state *)downcast<upd4990a_device *>(device)->token();
|
||||
assert((device->type() == UPD4990A_OLD));
|
||||
return (upd4990a_state *)downcast<upd4990a_old_device *>(device)->token();
|
||||
}
|
||||
|
||||
INLINE UINT8 convert_to_bcd(int val)
|
||||
@ -520,10 +520,10 @@ static DEVICE_RESET( upd4990a )
|
||||
upd4990a->command_line = 0;
|
||||
}
|
||||
|
||||
const device_type UPD4990A = &device_creator<upd4990a_device>;
|
||||
const device_type UPD4990A_OLD = &device_creator<upd4990a_old_device>;
|
||||
|
||||
upd4990a_device::upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, UPD4990A, "NEC uPD4990A", tag, owner, clock)
|
||||
upd4990a_old_device::upd4990a_old_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, UPD4990A_OLD, "NEC uPD4990A", tag, owner, clock)
|
||||
{
|
||||
m_token = global_alloc_clear(upd4990a_state);
|
||||
}
|
||||
@ -534,7 +534,7 @@ upd4990a_device::upd4990a_device(const machine_config &mconfig, const char *tag,
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd4990a_device::device_config_complete()
|
||||
void upd4990a_old_device::device_config_complete()
|
||||
{
|
||||
}
|
||||
|
||||
@ -542,7 +542,7 @@ void upd4990a_device::device_config_complete()
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd4990a_device::device_start()
|
||||
void upd4990a_old_device::device_start()
|
||||
{
|
||||
DEVICE_START_NAME( upd4990a )(this);
|
||||
}
|
||||
@ -551,7 +551,7 @@ void upd4990a_device::device_start()
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd4990a_device::device_reset()
|
||||
void upd4990a_old_device::device_reset()
|
||||
{
|
||||
DEVICE_RESET_NAME( upd4990a )(this);
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __PD4990A_H__
|
||||
#define __PD4990A_H__
|
||||
#ifndef __PD4990A_OLD_H__
|
||||
#define __PD4990A_OLD_H__
|
||||
|
||||
#include "devlegcy.h"
|
||||
|
||||
@ -16,11 +16,11 @@
|
||||
MACROS / CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
class upd4990a_device : public device_t
|
||||
class upd4990a_old_device : public device_t
|
||||
{
|
||||
public:
|
||||
upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~upd4990a_device() { global_free(m_token); }
|
||||
upd4990a_old_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~upd4990a_old_device() { global_free(m_token); }
|
||||
|
||||
// access to legacy token
|
||||
void *token() const { assert(m_token != NULL); return m_token; }
|
||||
@ -34,11 +34,11 @@ private:
|
||||
void *m_token;
|
||||
};
|
||||
|
||||
extern const device_type UPD4990A;
|
||||
extern const device_type UPD4990A_OLD;
|
||||
|
||||
|
||||
#define MCFG_UPD4990A_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, UPD4990A, 0)
|
||||
#define MCFG_UPD4990A_OLD_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, UPD4990A_OLD, 0)
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
// device type definition
|
||||
const device_type UPD1990A = &device_creator<upd1990a_device>;
|
||||
const device_type UPD4990A = &device_creator<upd4990a_device>;
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -53,21 +54,35 @@ enum
|
||||
// upd1990a_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
upd1990a_device::upd1990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, UPD1990A, "uPD1990A", tag, owner, clock),
|
||||
upd1990a_rtc_device::upd1990a_rtc_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, type, name, tag, owner, clock),
|
||||
device_rtc_interface(mconfig, *this),
|
||||
m_data_out(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
upd1990a_device::upd1990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: upd1990a_rtc_device(mconfig, UPD1990A, "uPD1990A", tag, owner, clock)
|
||||
{
|
||||
m_device_type = TYPE_UPD1990A;
|
||||
}
|
||||
|
||||
|
||||
upd4990a_device::upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: upd1990a_rtc_device(mconfig, UPD4990A, "uPD4990A", tag, owner, clock)
|
||||
{
|
||||
m_device_type = TYPE_UPD4990A;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd1990a_device::device_config_complete()
|
||||
void upd1990a_rtc_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const upd1990a_interface *intf = reinterpret_cast<const upd1990a_interface *>(static_config());
|
||||
@ -87,7 +102,7 @@ void upd1990a_device::device_config_complete()
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd1990a_device::device_start()
|
||||
void upd1990a_rtc_device::device_start()
|
||||
{
|
||||
// resolve callbacks
|
||||
m_out_data_func.resolve(m_out_data_cb, *this);
|
||||
@ -119,7 +134,7 @@ void upd1990a_device::device_start()
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd1990a_device::device_reset()
|
||||
void upd1990a_rtc_device::device_reset()
|
||||
{
|
||||
set_current_time(machine());
|
||||
}
|
||||
@ -129,7 +144,7 @@ void upd1990a_device::device_reset()
|
||||
// device_timer - handler timer events
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd1990a_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
void upd1990a_rtc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
@ -194,7 +209,7 @@ void upd1990a_device::device_timer(emu_timer &timer, device_timer_id id, int par
|
||||
// rtc_clock_updated -
|
||||
//-------------------------------------------------
|
||||
|
||||
void upd1990a_device::rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second)
|
||||
void upd1990a_rtc_device::rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second)
|
||||
{
|
||||
m_time_counter[0] = convert_to_bcd(second);
|
||||
m_time_counter[1] = convert_to_bcd(minute);
|
||||
@ -208,7 +223,7 @@ void upd1990a_device::rtc_clock_updated(int year, int month, int day, int day_of
|
||||
// oe_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( upd1990a_device::oe_w )
|
||||
WRITE_LINE_MEMBER( upd1990a_rtc_device::oe_w )
|
||||
{
|
||||
if (LOG) logerror("uPD1990A '%s' OE %u\n", tag(), state);
|
||||
|
||||
@ -220,7 +235,7 @@ WRITE_LINE_MEMBER( upd1990a_device::oe_w )
|
||||
// cs_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( upd1990a_device::cs_w )
|
||||
WRITE_LINE_MEMBER( upd1990a_rtc_device::cs_w )
|
||||
{
|
||||
if (LOG) logerror("uPD1990A '%s' CS %u\n", tag(), state);
|
||||
|
||||
@ -232,7 +247,7 @@ WRITE_LINE_MEMBER( upd1990a_device::cs_w )
|
||||
// stb_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( upd1990a_device::stb_w )
|
||||
WRITE_LINE_MEMBER( upd1990a_rtc_device::stb_w )
|
||||
{
|
||||
if (LOG) logerror("uPD1990A '%s' STB %u\n", tag(), state);
|
||||
|
||||
@ -380,7 +395,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w )
|
||||
// clk_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( upd1990a_device::clk_w )
|
||||
WRITE_LINE_MEMBER( upd1990a_rtc_device::clk_w )
|
||||
{
|
||||
if (LOG) logerror("uPD1990A '%s' CLK %u\n", tag(), state);
|
||||
|
||||
@ -422,7 +437,7 @@ WRITE_LINE_MEMBER( upd1990a_device::clk_w )
|
||||
// c0_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( upd1990a_device::c0_w )
|
||||
WRITE_LINE_MEMBER( upd1990a_rtc_device::c0_w )
|
||||
{
|
||||
if (LOG) logerror("uPD1990A '%s' C0 %u\n", tag(), state);
|
||||
|
||||
@ -434,7 +449,7 @@ WRITE_LINE_MEMBER( upd1990a_device::c0_w )
|
||||
// c1_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( upd1990a_device::c1_w )
|
||||
WRITE_LINE_MEMBER( upd1990a_rtc_device::c1_w )
|
||||
{
|
||||
if (LOG) logerror("uPD1990A '%s' C1 %u\n", tag(), state);
|
||||
|
||||
@ -446,7 +461,7 @@ WRITE_LINE_MEMBER( upd1990a_device::c1_w )
|
||||
// c2_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( upd1990a_device::c2_w )
|
||||
WRITE_LINE_MEMBER( upd1990a_rtc_device::c2_w )
|
||||
{
|
||||
if (LOG) logerror("uPD1990A '%s' C2 %u\n", tag(), state);
|
||||
|
||||
@ -458,7 +473,7 @@ WRITE_LINE_MEMBER( upd1990a_device::c2_w )
|
||||
// data_in_w -
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE_LINE_MEMBER( upd1990a_device::data_in_w )
|
||||
WRITE_LINE_MEMBER( upd1990a_rtc_device::data_in_w )
|
||||
{
|
||||
if (LOG) logerror("uPD1990A '%s' DATA IN %u\n", tag(), state);
|
||||
|
||||
@ -470,7 +485,7 @@ WRITE_LINE_MEMBER( upd1990a_device::data_in_w )
|
||||
// data_out_r -
|
||||
//-------------------------------------------------
|
||||
|
||||
READ_LINE_MEMBER( upd1990a_device::data_out_r )
|
||||
READ_LINE_MEMBER( upd1990a_rtc_device::data_out_r )
|
||||
{
|
||||
return m_data_out;
|
||||
}
|
||||
@ -480,7 +495,7 @@ READ_LINE_MEMBER( upd1990a_device::data_out_r )
|
||||
// tp_r -
|
||||
//-------------------------------------------------
|
||||
|
||||
READ_LINE_MEMBER( upd1990a_device::tp_r )
|
||||
READ_LINE_MEMBER( upd1990a_rtc_device::tp_r )
|
||||
{
|
||||
return m_tp;
|
||||
}
|
||||
|
@ -61,13 +61,13 @@ struct upd1990a_interface
|
||||
|
||||
// ======================> upd1990a_device
|
||||
|
||||
class upd1990a_device : public device_t,
|
||||
public device_rtc_interface,
|
||||
public upd1990a_interface
|
||||
class upd1990a_rtc_device : public device_t,
|
||||
public device_rtc_interface,
|
||||
public upd1990a_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
upd1990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
upd1990a_rtc_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( oe_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( cs_w );
|
||||
@ -89,6 +89,11 @@ protected:
|
||||
|
||||
// device_rtc_interface overrides
|
||||
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second);
|
||||
enum {
|
||||
TYPE_UPD1990A = 0,
|
||||
TYPE_UPD4990A
|
||||
};
|
||||
int m_device_type;
|
||||
|
||||
private:
|
||||
static const device_timer_id TIMER_CLOCK = 0;
|
||||
@ -119,10 +124,21 @@ private:
|
||||
emu_timer *m_timer_test_mode;
|
||||
};
|
||||
|
||||
class upd1990a_device : public upd1990a_rtc_device
|
||||
{
|
||||
public:
|
||||
upd1990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
|
||||
class upd4990a_device : public upd1990a_rtc_device
|
||||
{
|
||||
public:
|
||||
upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type UPD1990A;
|
||||
|
||||
|
||||
extern const device_type UPD4990A;
|
||||
|
||||
#endif
|
||||
|
@ -1437,7 +1437,7 @@ MACHINE_CONFIG_START( neogeo_base, neogeo_state )
|
||||
MCFG_SOUND_ROUTE(2, "rspeaker", 1.0)
|
||||
|
||||
/* NEC uPD4990A RTC */
|
||||
MCFG_UPD4990A_ADD("upd4990a")
|
||||
MCFG_UPD4990A_OLD_ADD("upd4990a")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( neogeo, neogeo_base )
|
||||
|
@ -471,7 +471,7 @@ static MACHINE_CONFIG_START( neoprint, neoprint_state )
|
||||
MCFG_CPU_PROGRAM_MAP(neoprint_audio_map)
|
||||
MCFG_CPU_IO_MAP(neoprint_audio_io_map)
|
||||
|
||||
MCFG_UPD4990A_ADD("upd4990a")
|
||||
MCFG_UPD4990A_OLD_ADD("upd4990a")
|
||||
MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
|
||||
MCFG_GFXDECODE(neoprint)
|
||||
@ -511,7 +511,7 @@ static MACHINE_CONFIG_START( nprsp, neoprint_state )
|
||||
MCFG_CPU_PROGRAM_MAP(neoprint_audio_map)
|
||||
MCFG_CPU_IO_MAP(neoprint_audio_io_map)
|
||||
|
||||
MCFG_UPD4990A_ADD("upd4990a")
|
||||
MCFG_UPD4990A_OLD_ADD("upd4990a")
|
||||
MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
|
||||
MCFG_GFXDECODE(neoprint)
|
||||
|
@ -2149,7 +2149,7 @@ static INPUT_PORTS_START( pc8001 )
|
||||
PORT_DIPNAME( 0x08, 0x00, "Auto-boot floppy at start-up" )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_device, data_out_r)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_rtc_device, data_out_r)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_CUSTOM ) PORT_VBLANK("screen")
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
|
@ -2732,7 +2732,7 @@ static INPUT_PORTS_START( pc9801 )
|
||||
PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(" un 7-8") PORT_CHANGED_MEMBER(DEVICE_SELF, pc9801_state, key_stroke, 0x7f) PORT_IMPULSE(1)
|
||||
|
||||
PORT_START("DSW1")
|
||||
PORT_BIT(0x0001, IP_ACTIVE_HIGH,IPT_SPECIAL) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_device, data_out_r)
|
||||
PORT_BIT(0x0001, IP_ACTIVE_HIGH,IPT_SPECIAL) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_rtc_device, data_out_r)
|
||||
PORT_DIPNAME( 0x0002, 0x0000, "DSW1" ) // error beep if OFF
|
||||
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
|
Loading…
Reference in New Issue
Block a user