Previous 199869 Revisions Next

r19672 Tuesday 18th December, 2012 at 18:09:34 UTC by Angelo Salese
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)
[src/emu/machine]pd4990a.c pd4990a.h upd1990a.c upd1990a.h
[src/mame/drivers]neogeo.c neoprint.c
[src/mess/drivers]pc8801.c pc9801.c

trunk/src/mame/drivers/neoprint.c
r19671r19672
471471   MCFG_CPU_PROGRAM_MAP(neoprint_audio_map)
472472   MCFG_CPU_IO_MAP(neoprint_audio_io_map)
473473
474   MCFG_UPD4990A_ADD("upd4990a")
474   MCFG_UPD4990A_OLD_ADD("upd4990a")
475475   MCFG_NVRAM_ADD_0FILL("nvram")
476476
477477   MCFG_GFXDECODE(neoprint)
r19671r19672
511511   MCFG_CPU_PROGRAM_MAP(neoprint_audio_map)
512512   MCFG_CPU_IO_MAP(neoprint_audio_io_map)
513513
514   MCFG_UPD4990A_ADD("upd4990a")
514   MCFG_UPD4990A_OLD_ADD("upd4990a")
515515   MCFG_NVRAM_ADD_0FILL("nvram")
516516
517517   MCFG_GFXDECODE(neoprint)
trunk/src/mame/drivers/neogeo.c
r19671r19672
14371437   MCFG_SOUND_ROUTE(2, "rspeaker", 1.0)
14381438
14391439   /* NEC uPD4990A RTC */
1440   MCFG_UPD4990A_ADD("upd4990a")
1440   MCFG_UPD4990A_OLD_ADD("upd4990a")
14411441MACHINE_CONFIG_END
14421442
14431443static MACHINE_CONFIG_DERIVED( neogeo, neogeo_base )
trunk/src/emu/machine/upd1990a.c
r19671r19672
2121
2222// device type definition
2323const device_type UPD1990A = &device_creator<upd1990a_device>;
24const device_type UPD4990A = &device_creator<upd4990a_device>;
2425
2526
2627//**************************************************************************
r19671r19672
5354//  upd1990a_device - constructor
5455//-------------------------------------------------
5556
56upd1990a_device::upd1990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
57    : device_t(mconfig, UPD1990A, "uPD1990A", tag, owner, clock),
57upd1990a_rtc_device::upd1990a_rtc_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock)
58   : device_t(mconfig, type, name, tag, owner, clock),
5859      device_rtc_interface(mconfig, *this),
5960      m_data_out(0)
6061{
6162}
6263
6364
65upd1990a_device::upd1990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
66      : upd1990a_rtc_device(mconfig, UPD1990A, "uPD1990A", tag, owner, clock)
67{
68   m_device_type = TYPE_UPD1990A;
69}
70
71
72upd4990a_device::upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
73      : upd1990a_rtc_device(mconfig, UPD4990A, "uPD4990A", tag, owner, clock)
74{
75   m_device_type = TYPE_UPD4990A;
76}
77
78
6479//-------------------------------------------------
6580//  device_config_complete - perform any
6681//  operations now that the configuration is
6782//  complete
6883//-------------------------------------------------
6984
70void upd1990a_device::device_config_complete()
85void upd1990a_rtc_device::device_config_complete()
7186{
7287   // inherit a copy of the static data
7388   const upd1990a_interface *intf = reinterpret_cast<const upd1990a_interface *>(static_config());
r19671r19672
87102//  device_start - device-specific startup
88103//-------------------------------------------------
89104
90void upd1990a_device::device_start()
105void upd1990a_rtc_device::device_start()
91106{
92107   // resolve callbacks
93108   m_out_data_func.resolve(m_out_data_cb, *this);
r19671r19672
119134//  device_reset - device-specific reset
120135//-------------------------------------------------
121136
122void upd1990a_device::device_reset()
137void upd1990a_rtc_device::device_reset()
123138{
124139   set_current_time(machine());
125140}
r19671r19672
129144//  device_timer - handler timer events
130145//-------------------------------------------------
131146
132void upd1990a_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
147void upd1990a_rtc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
133148{
134149   switch (id)
135150   {
r19671r19672
194209//  rtc_clock_updated -
195210//-------------------------------------------------
196211
197void upd1990a_device::rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second)
212void upd1990a_rtc_device::rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second)
198213{
199214   m_time_counter[0] = convert_to_bcd(second);
200215   m_time_counter[1] = convert_to_bcd(minute);
r19671r19672
208223//  oe_w -
209224//-------------------------------------------------
210225
211WRITE_LINE_MEMBER( upd1990a_device::oe_w )
226WRITE_LINE_MEMBER( upd1990a_rtc_device::oe_w )
212227{
213228   if (LOG) logerror("uPD1990A '%s' OE %u\n", tag(), state);
214229
r19671r19672
220235//  cs_w -
221236//-------------------------------------------------
222237
223WRITE_LINE_MEMBER( upd1990a_device::cs_w )
238WRITE_LINE_MEMBER( upd1990a_rtc_device::cs_w )
224239{
225240   if (LOG) logerror("uPD1990A '%s' CS %u\n", tag(), state);
226241
r19671r19672
232247//  stb_w -
233248//-------------------------------------------------
234249
235WRITE_LINE_MEMBER( upd1990a_device::stb_w )
250WRITE_LINE_MEMBER( upd1990a_rtc_device::stb_w )
236251{
237252   if (LOG) logerror("uPD1990A '%s' STB %u\n", tag(), state);
238253
r19671r19672
380395//  clk_w -
381396//-------------------------------------------------
382397
383WRITE_LINE_MEMBER( upd1990a_device::clk_w )
398WRITE_LINE_MEMBER( upd1990a_rtc_device::clk_w )
384399{
385400   if (LOG) logerror("uPD1990A '%s' CLK %u\n", tag(), state);
386401
r19671r19672
422437//  c0_w -
423438//-------------------------------------------------
424439
425WRITE_LINE_MEMBER( upd1990a_device::c0_w )
440WRITE_LINE_MEMBER( upd1990a_rtc_device::c0_w )
426441{
427442   if (LOG) logerror("uPD1990A '%s' C0 %u\n", tag(), state);
428443
r19671r19672
434449//  c1_w -
435450//-------------------------------------------------
436451
437WRITE_LINE_MEMBER( upd1990a_device::c1_w )
452WRITE_LINE_MEMBER( upd1990a_rtc_device::c1_w )
438453{
439454   if (LOG) logerror("uPD1990A '%s' C1 %u\n", tag(), state);
440455
r19671r19672
446461//  c2_w -
447462//-------------------------------------------------
448463
449WRITE_LINE_MEMBER( upd1990a_device::c2_w )
464WRITE_LINE_MEMBER( upd1990a_rtc_device::c2_w )
450465{
451466   if (LOG) logerror("uPD1990A '%s' C2 %u\n", tag(), state);
452467
r19671r19672
458473//  data_in_w -
459474//-------------------------------------------------
460475
461WRITE_LINE_MEMBER( upd1990a_device::data_in_w )
476WRITE_LINE_MEMBER( upd1990a_rtc_device::data_in_w )
462477{
463478   if (LOG) logerror("uPD1990A '%s' DATA IN %u\n", tag(), state);
464479
r19671r19672
470485//  data_out_r -
471486//-------------------------------------------------
472487
473READ_LINE_MEMBER( upd1990a_device::data_out_r )
488READ_LINE_MEMBER( upd1990a_rtc_device::data_out_r )
474489{
475490   return m_data_out;
476491}
r19671r19672
480495//  tp_r -
481496//-------------------------------------------------
482497
483READ_LINE_MEMBER( upd1990a_device::tp_r )
498READ_LINE_MEMBER( upd1990a_rtc_device::tp_r )
484499{
485500   return m_tp;
486501}
trunk/src/emu/machine/upd1990a.h
r19671r19672
6161
6262// ======================> upd1990a_device
6363
64class upd1990a_device :   public device_t,
65                  public device_rtc_interface,
66                        public upd1990a_interface
64class upd1990a_rtc_device :   public device_t,
65                      public device_rtc_interface,
66                            public upd1990a_interface
6767{
6868public:
6969    // construction/destruction
70    upd1990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
70   upd1990a_rtc_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock);
7171
7272   DECLARE_WRITE_LINE_MEMBER( oe_w );
7373   DECLARE_WRITE_LINE_MEMBER( cs_w );
r19671r19672
8989
9090   // device_rtc_interface overrides
9191   virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second);
92   enum {
93         TYPE_UPD1990A = 0,
94         TYPE_UPD4990A
95   };
96   int m_device_type;
9297
9398private:
9499   static const device_timer_id TIMER_CLOCK = 0;
r19671r19672
119124   emu_timer *m_timer_test_mode;
120125};
121126
127class upd1990a_device : public upd1990a_rtc_device
128{
129public:
130   upd1990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
131};
122132
133
134class upd4990a_device : public upd1990a_rtc_device
135{
136public:
137   upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
138};
139
123140// device type definition
124141extern const device_type UPD1990A;
142extern const device_type UPD4990A;
125143
126
127
128144#endif
trunk/src/emu/machine/pd4990a.c
r19671r19672
8484INLINE upd4990a_state *get_safe_token(device_t *device)
8585{
8686   assert(device != NULL);
87   assert((device->type() == UPD4990A));
88   return (upd4990a_state *)downcast<upd4990a_device *>(device)->token();
87   assert((device->type() == UPD4990A_OLD));
88   return (upd4990a_state *)downcast<upd4990a_old_device *>(device)->token();
8989}
9090
9191INLINE UINT8 convert_to_bcd(int val)
r19671r19672
520520   upd4990a->command_line = 0;
521521}
522522
523const device_type UPD4990A = &device_creator<upd4990a_device>;
523const device_type UPD4990A_OLD = &device_creator<upd4990a_old_device>;
524524
525upd4990a_device::upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
526   : device_t(mconfig, UPD4990A, "NEC uPD4990A", tag, owner, clock)
525upd4990a_old_device::upd4990a_old_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
526   : device_t(mconfig, UPD4990A_OLD, "NEC uPD4990A", tag, owner, clock)
527527{
528528   m_token = global_alloc_clear(upd4990a_state);
529529}
r19671r19672
534534//  complete
535535//-------------------------------------------------
536536
537void upd4990a_device::device_config_complete()
537void upd4990a_old_device::device_config_complete()
538538{
539539}
540540
r19671r19672
542542//  device_start - device-specific startup
543543//-------------------------------------------------
544544
545void upd4990a_device::device_start()
545void upd4990a_old_device::device_start()
546546{
547547   DEVICE_START_NAME( upd4990a )(this);
548548}
r19671r19672
551551//  device_reset - device-specific reset
552552//-------------------------------------------------
553553
554void upd4990a_device::device_reset()
554void upd4990a_old_device::device_reset()
555555{
556556   DEVICE_RESET_NAME( upd4990a )(this);
557557}
trunk/src/emu/machine/pd4990a.h
r19671r19672
66
77***************************************************************************/
88
9#ifndef __PD4990A_H__
10#define __PD4990A_H__
9#ifndef __PD4990A_OLD_H__
10#define __PD4990A_OLD_H__
1111
1212#include "devlegcy.h"
1313
r19671r19672
1616    MACROS / CONSTANTS
1717***************************************************************************/
1818
19class upd4990a_device : public device_t
19class upd4990a_old_device : public device_t
2020{
2121public:
22   upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
23   ~upd4990a_device() { global_free(m_token); }
22   upd4990a_old_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
23   ~upd4990a_old_device() { global_free(m_token); }
2424
2525   // access to legacy token
2626   void *token() const { assert(m_token != NULL); return m_token; }
r19671r19672
3434   void *m_token;
3535};
3636
37extern const device_type UPD4990A;
37extern const device_type UPD4990A_OLD;
3838
3939
40#define MCFG_UPD4990A_ADD(_tag) \
41   MCFG_DEVICE_ADD(_tag, UPD4990A, 0)
40#define MCFG_UPD4990A_OLD_ADD(_tag) \
41   MCFG_DEVICE_ADD(_tag, UPD4990A_OLD, 0)
4242
4343
4444/***************************************************************************
trunk/src/mess/drivers/pc8801.c
r19671r19672
21492149   PORT_DIPNAME( 0x08, 0x00, "Auto-boot floppy at start-up" )
21502150   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
21512151   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2152   PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_device, data_out_r)
2152   PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_rtc_device, data_out_r)
21532153   PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_CUSTOM ) PORT_VBLANK("screen")
21542154   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
21552155
trunk/src/mess/drivers/pc9801.c
r19671r19672
27322732   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)
27332733
27342734   PORT_START("DSW1")
2735   PORT_BIT(0x0001, IP_ACTIVE_HIGH,IPT_SPECIAL) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_device, data_out_r)
2735   PORT_BIT(0x0001, IP_ACTIVE_HIGH,IPT_SPECIAL) PORT_READ_LINE_DEVICE_MEMBER("upd1990a", upd1990a_rtc_device, data_out_r)
27362736   PORT_DIPNAME( 0x0002, 0x0000, "DSW1" ) // error beep if OFF
27372737   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
27382738   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team