mm58274c: updated to use inline configs. nw.

This commit is contained in:
Fabio Priuli 2014-04-14 05:05:30 +00:00
parent 1940f1c3b1
commit b7746b9921
10 changed files with 59 additions and 120 deletions

View File

@ -594,12 +594,6 @@ void snug_bwg_device::device_config_complete()
if (subdevice("3")!=NULL) m_floppy[3] = static_cast<floppy_image_device*>(subdevice("3")->first_subdevice()); if (subdevice("3")!=NULL) m_floppy[3] = static_cast<floppy_image_device*>(subdevice("3")->first_subdevice());
} }
static const mm58274c_interface bwg_mm58274c_interface =
{
1, /* mode 24*/
0 /* first day of week */
};
INPUT_PORTS_START( bwg_fdc ) INPUT_PORTS_START( bwg_fdc )
PORT_START( "BWGDIP1" ) PORT_START( "BWGDIP1" )
PORT_DIPNAME( 0x01, 0x00, "BwG step rate" ) PORT_DIPNAME( 0x01, 0x00, "BwG step rate" )
@ -634,7 +628,10 @@ MACHINE_CONFIG_FRAGMENT( bwg_fdc )
MCFG_WD1773x_ADD(FDC_TAG, XTAL_8MHz) MCFG_WD1773x_ADD(FDC_TAG, XTAL_8MHz)
MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(snug_bwg_device, fdc_irq_w)) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(snug_bwg_device, fdc_irq_w))
MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(snug_bwg_device, fdc_drq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(snug_bwg_device, fdc_drq_w))
MCFG_MM58274C_ADD(CLOCK_TAG, bwg_mm58274c_interface)
MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0)
MCFG_MM58274C_MODE24(1) // 24 hour
MCFG_MM58274C_DAY1(0) // sunday
MCFG_FLOPPY_DRIVE_ADD("0", bwg_floppies, "525dd", snug_bwg_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("0", bwg_floppies, "525dd", snug_bwg_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("1", bwg_floppies, "525dd", snug_bwg_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("1", bwg_floppies, "525dd", snug_bwg_device::floppy_formats)
@ -1115,12 +1112,6 @@ const wd17xx_interface bwgleg_wd17xx_interface =
{ PFLOPPY_0, PFLOPPY_1, PFLOPPY_2, PFLOPPY_3 } { PFLOPPY_0, PFLOPPY_1, PFLOPPY_2, PFLOPPY_3 }
}; };
static const mm58274c_interface floppyleg_mm58274c_interface =
{
1, /* mode 24*/
0 /* first day of week */
};
INPUT_PORTS_START( bwg_fdc_legacy ) INPUT_PORTS_START( bwg_fdc_legacy )
PORT_START( "BWGDIP1" ) PORT_START( "BWGDIP1" )
PORT_DIPNAME( 0x01, 0x00, "BwG step rate" ) PORT_DIPNAME( 0x01, 0x00, "BwG step rate" )
@ -1142,7 +1133,10 @@ INPUT_PORTS_END
MACHINE_CONFIG_FRAGMENT( bwg_fdc_legacy ) MACHINE_CONFIG_FRAGMENT( bwg_fdc_legacy )
MCFG_WD1773_ADD(FDCLEG_TAG, bwgleg_wd17xx_interface ) MCFG_WD1773_ADD(FDCLEG_TAG, bwgleg_wd17xx_interface )
MCFG_MM58274C_ADD(CLOCK_TAG, floppyleg_mm58274c_interface)
MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0)
MCFG_MM58274C_MODE24(1) // 24 hour
MCFG_MM58274C_DAY1(0) // sunday
MACHINE_CONFIG_END MACHINE_CONFIG_END
ROM_START( bwg_fdc_legacy ) ROM_START( bwg_fdc_legacy )

View File

@ -435,12 +435,6 @@ const smc92x4_interface ti99_smc92x4_interface =
FALSE, /* do not use the full track layout */ FALSE, /* do not use the full track layout */
}; };
static const mm58274c_interface floppy_mm58274c_interface =
{
1, /* mode 24*/
0 /* first day of week */
};
MACHINE_CONFIG_FRAGMENT( ti99_hfdc ) MACHINE_CONFIG_FRAGMENT( ti99_hfdc )
MCFG_SMC92X4_ADD(FDC_TAG, ti99_smc92x4_interface ) MCFG_SMC92X4_ADD(FDC_TAG, ti99_smc92x4_interface )
MCFG_SMC92X4_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_device, intrq_w)) MCFG_SMC92X4_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_device, intrq_w))
@ -449,7 +443,10 @@ MACHINE_CONFIG_FRAGMENT( ti99_hfdc )
MCFG_SMC92X4_AUXBUS_IN_CALLBACK(READ8(myarc_hfdc_device, auxbus_in)) MCFG_SMC92X4_AUXBUS_IN_CALLBACK(READ8(myarc_hfdc_device, auxbus_in))
MCFG_SMC92X4_DMA_IN_CALLBACK(READ8(myarc_hfdc_device, read_buffer)) MCFG_SMC92X4_DMA_IN_CALLBACK(READ8(myarc_hfdc_device, read_buffer))
MCFG_SMC92X4_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_device, write_buffer)) MCFG_SMC92X4_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_device, write_buffer))
MCFG_MM58274C_ADD(CLOCK_TAG, floppy_mm58274c_interface)
MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0)
MCFG_MM58274C_MODE24(1) // 24 hour
MCFG_MM58274C_DAY1(0) // sunday
MACHINE_CONFIG_END MACHINE_CONFIG_END
ROM_START( ti99_hfdc ) ROM_START( ti99_hfdc )

View File

@ -46,31 +46,13 @@ const device_type MM58274C = &device_creator<mm58274c_device>;
mm58274c_device::mm58274c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) mm58274c_device::mm58274c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MM58274C, "National Semiconductor MM58274C", tag, owner, clock, "mm58274c", __FILE__) : device_t(mconfig, MM58274C, "National Semiconductor MM58274C", tag, owner, clock, "mm58274c", __FILE__),
m_mode24(0),
m_day1(0)
{ {
} }
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void mm58274c_device::device_config_complete()
{
// inherit a copy of the static data
const mm58274c_interface *intf = reinterpret_cast<const mm58274c_interface *>(static_config());
if (intf != NULL)
*static_cast<mm58274c_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_mode24 = 0;
m_day1 = 0;
}
}
//------------------------------------------------- //-------------------------------------------------
// device_start - device-specific startup // device_start - device-specific startup
//------------------------------------------------- //-------------------------------------------------

View File

@ -1,32 +1,19 @@
#ifndef __MM58274C_H__ #ifndef __MM58274C_H__
#define __MM58274C_H__ #define __MM58274C_H__
/*
Initializes the clock chip.
day1 must be set to a value from 0 (sunday), 1 (monday) ...
to 6 (saturday) and is needed to correctly retrieve the day-of-week
from the host system clock.
*/
struct mm58274c_interface
{
int m_mode24; /* 24/12 mode */
int m_day1; /* first day of week */
};
/*************************************************************************** /***************************************************************************
MACROS MACROS
***************************************************************************/ ***************************************************************************/
class mm58274c_device : public device_t, class mm58274c_device : public device_t
public mm58274c_interface
{ {
public: public:
mm58274c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); mm58274c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~mm58274c_device() {} ~mm58274c_device() {}
static void set_mode24(device_t &device, int mode) { downcast<mm58274c_device &>(device).m_mode24 = mode; }
static void set_day1(device_t &device, int day) { downcast<mm58274c_device &>(device).m_day1 = day; }
DECLARE_READ8_MEMBER(read); DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write); DECLARE_WRITE8_MEMBER(write);
@ -35,12 +22,19 @@ public:
protected: protected:
// device-level overrides // device-level overrides
virtual void device_config_complete();
virtual void device_start(); virtual void device_start();
virtual void device_reset(); virtual void device_reset();
private: private:
// internal state // internal state
// Initializion the clock chip:
// m_day1 must be set to a value from 0 (sunday), 1 (monday)...
// to 6 (saturday) and is needed to correctly retrieve the
// day-of-week from the host system clock.
int m_mode24; /* 24/12 mode */
int m_day1; /* first day of week */
attotime interrupt_period_table(int val); attotime interrupt_period_table(int val);
int m_status; /* status register (*read* from address 0 = control register) */ int m_status; /* status register (*read* from address 0 = control register) */
@ -49,7 +43,6 @@ private:
int m_clk_set; /* clock setting register */ int m_clk_set; /* clock setting register */
int m_int_ctl; /* interrupt control register */ int m_int_ctl; /* interrupt control register */
int m_wday; /* day of the week (1-7 (1=day1 as set in init)) */ int m_wday; /* day of the week (1-7 (1=day1 as set in init)) */
int m_years1; /* years (BCD: 0-99) */ int m_years1; /* years (BCD: 0-99) */
int m_years2; int m_years2;
@ -80,4 +73,11 @@ extern const device_type MM58274C;
MCFG_DEVICE_ADD(_tag, MM58274C, 0) \ MCFG_DEVICE_ADD(_tag, MM58274C, 0) \
MCFG_DEVICE_CONFIG(_intrf) MCFG_DEVICE_CONFIG(_intrf)
#define MCFG_MM58274C_MODE24(_mode) \
mm58274c_device::set_mode24(*device, _mode);
#define MCFG_MM58274C_DAY1(_day) \
mm58274c_device::set_day1(*device, _day);
#endif #endif

View File

@ -624,17 +624,6 @@ static I8274_INTERFACE( mpsc_intf )
}; };
//-------------------------------------------------
// mm58274c_interface rtc_intf
//-------------------------------------------------
static const mm58274c_interface rtc_intf =
{
0, /* mode 24*/
1 /* first day of week */
};
//------------------------------------------------- //-------------------------------------------------
// cassette_interface compis_cassette_interface // cassette_interface compis_cassette_interface
//------------------------------------------------- //-------------------------------------------------
@ -745,7 +734,11 @@ static MACHINE_CONFIG_START( compis, compis_state )
MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd))
MCFG_I8274_ADD(I8274_TAG, XTAL_16MHz/4, mpsc_intf) MCFG_I8274_ADD(I8274_TAG, XTAL_16MHz/4, mpsc_intf)
MCFG_MM58274C_ADD(MM58174A_TAG, rtc_intf)
MCFG_DEVICE_ADD(MM58174A_TAG, MM58274C, 0)
MCFG_MM58274C_MODE24(0) // 12 hour
MCFG_MM58274C_DAY1(1) // monday
MCFG_CASSETTE_ADD(CASSETTE_TAG, compis_cassette_interface) MCFG_CASSETTE_ADD(CASSETTE_TAG, compis_cassette_interface)
MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", compis_state, tape_tick, attotime::from_hz(44100)) MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", compis_state, tape_tick, attotime::from_hz(44100))

View File

@ -190,13 +190,6 @@ INPUT_PORTS_END
/* init with simple, fixed, B/W palette */ /* init with simple, fixed, B/W palette */
/* Is the palette black on white or white on black??? */ /* Is the palette black on white or white on black??? */
static const mm58274c_interface concept_mm58274c_interface =
{
0, /* mode 24*/
1 /* first day of week */
};
SLOT_INTERFACE_START( concept_exp_devices ) SLOT_INTERFACE_START( concept_exp_devices )
SLOT_INTERFACE("fdc", CONCEPT_FDC) SLOT_INTERFACE("fdc", CONCEPT_FDC)
SLOT_INTERFACE("hdc", CONCEPT_HDC) SLOT_INTERFACE("hdc", CONCEPT_HDC)
@ -227,7 +220,9 @@ static MACHINE_CONFIG_START( concept, concept_state )
/* no sound? */ /* no sound? */
/* rtc */ /* rtc */
MCFG_MM58274C_ADD("mm58274c", concept_mm58274c_interface) MCFG_DEVICE_ADD("mm58274c", MM58274C, 0)
MCFG_MM58274C_MODE24(0) // 12 hour
MCFG_MM58274C_DAY1(1) // monday
/* via */ /* via */
MCFG_DEVICE_ADD("via6522_0", VIA6522, 1022750) MCFG_DEVICE_ADD("via6522_0", VIA6522, 1022750)

View File

@ -686,12 +686,6 @@ WRITE_LINE_MEMBER( geneve_state::dbin_line )
m_mapper->dbin_in(state); m_mapper->dbin_in(state);
} }
static const mm58274c_interface geneve_mm58274c_interface =
{
1, /* mode 24*/
0 /* first day of week */
};
DRIVER_INIT_MEMBER(geneve_state,geneve) DRIVER_INIT_MEMBER(geneve_state,geneve)
{ {
} }
@ -754,7 +748,9 @@ static MACHINE_CONFIG_START( geneve_60hz, geneve_state )
MCFG_GENEVE_READY_HANDLER( WRITELINE(geneve_state, mapper_ready) ) MCFG_GENEVE_READY_HANDLER( WRITELINE(geneve_state, mapper_ready) )
// Clock // Clock
MCFG_MM58274C_ADD(GCLOCK_TAG, geneve_mm58274c_interface) MCFG_DEVICE_ADD(GCLOCK_TAG, MM58274C, 0)
MCFG_MM58274C_MODE24(1) // 24 hour
MCFG_MM58274C_DAY1(0) // sunday
// Peripheral expansion box (Geneve composition) // Peripheral expansion box (Geneve composition)
MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_GEN, 0) MCFG_DEVICE_ADD( PERIBOX_TAG, PERIBOX_GEN, 0)

View File

@ -344,17 +344,6 @@ PALETTE_INIT_MEMBER(hunter2_state, hunter2)
palette.set_pen_color(1, rgb_t(92, 83, 88)); palette.set_pen_color(1, rgb_t(92, 83, 88));
} }
//-------------------------------------------------
// mm58274c_interface rtc_intf
//-------------------------------------------------
// this is all guess
static const mm58274c_interface rtc_intf =
{
0, /* mode 24*/
1 /* first day of week */
};
WRITE_LINE_MEMBER(hunter2_state::timer0_out) WRITE_LINE_MEMBER(hunter2_state::timer0_out)
{ {
if(state == ASSERT_LINE) if(state == ASSERT_LINE)
@ -411,7 +400,11 @@ static MACHINE_CONFIG_START( hunter2, hunter2_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
/* Devices */ /* Devices */
MCFG_MM58274C_ADD("rtc", rtc_intf) MCFG_DEVICE_ADD("rtc", MM58274C, 0)
// this is all guess
MCFG_MM58274C_MODE24(0) // 12 hour
MCFG_MM58274C_DAY1(1) // monday
//MCFG_TIMER_DRIVER_ADD_PERIODIC("hunter_a", hunter2_state, a_timer, attotime::from_hz(61)) //MCFG_TIMER_DRIVER_ADD_PERIODIC("hunter_a", hunter2_state, a_timer, attotime::from_hz(61))
MCFG_NSC810_ADD("iotimer",XTAL_4MHz,XTAL_4MHz) MCFG_NSC810_ADD("iotimer",XTAL_4MHz,XTAL_4MHz)

View File

@ -316,17 +316,6 @@ static SLOT_INTERFACE_START( v6809_floppies )
SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
SLOT_INTERFACE_END SLOT_INTERFACE_END
//-------------------------------------------------
// mm58274c_interface rtc_intf
//-------------------------------------------------
// this is all guess
static const mm58274c_interface rtc_intf =
{
0, /* mode 24*/
1 /* first day of week */
};
// *** Machine **** // *** Machine ****
@ -379,7 +368,11 @@ static MACHINE_CONFIG_START( v6809, v6809_state )
MCFG_DEVICE_ADD("acia_clock", CLOCK, 10) MCFG_DEVICE_ADD("acia_clock", CLOCK, 10)
MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v6809_state, write_acia_clock)) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(v6809_state, write_acia_clock))
MCFG_MM58274C_ADD("rtc", rtc_intf) MCFG_DEVICE_ADD("rtc", MM58274C, 0)
// this is all guess
MCFG_MM58274C_MODE24(0) // 12 hour
MCFG_MM58274C_DAY1(1) // monday
MCFG_MB8876x_ADD("fdc", XTAL_16MHz / 16) MCFG_MB8876x_ADD("fdc", XTAL_16MHz / 16)
MCFG_FLOPPY_DRIVE_ADD("fdc:0", v6809_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:0", v6809_floppies, "525dd", floppy_image_device::default_floppy_formats)
MACHINE_CONFIG_END MACHINE_CONFIG_END

View File

@ -747,12 +747,6 @@ I8275_DRAW_CHARACTER_MEMBER(wicat_state::wicat_display_pixels)
} }
} }
static mm58274c_interface wicat_rtc_intf =
{
0, // 12 hour
1 // first day
};
AM9517A_INTERFACE( wicat_videodma_intf ) AM9517A_INTERFACE( wicat_videodma_intf )
{ {
DEVCB_DRIVER_LINE_MEMBER(wicat_state,dma_hrq_w), // m_out_hreq_cb; DEVCB_DRIVER_LINE_MEMBER(wicat_state,dma_hrq_w), // m_out_hreq_cb;
@ -776,7 +770,9 @@ static MACHINE_CONFIG_START( wicat, wicat_state )
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(wicat_state, via_b_w)) MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(wicat_state, via_b_w))
MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M68K_IRQ_1)) MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M68K_IRQ_1))
MCFG_MM58274C_ADD("rtc",wicat_rtc_intf) // actually an MM58174AN, but should be compatible MCFG_DEVICE_ADD("rtc", MM58274C, 0) // actually an MM58174AN, but should be compatible
MCFG_MM58274C_MODE24(0) // 12 hour
MCFG_MM58274C_DAY1(1) // monday
// internal terminal // internal terminal
MCFG_DEVICE_ADD("uart0", MC2661, XTAL_5_0688MHz) // connected to terminal board MCFG_DEVICE_ADD("uart0", MC2661, XTAL_5_0688MHz) // connected to terminal board