Skip to content

Commit

Permalink
Allow per-device internal layouts and remove some more MCFG_ macros.
Browse files Browse the repository at this point in the history
Input and screen tags are now resolved relative to a layout's owner
device.

Easy way to demonstrate is with: mame64 intlc440 -tty ie15

Previously you'd only get the IE15 terminal's layout and you'd be unable
to use the INTELLEC 4/40 front panel.  Now you'll get the choice of
layouts from both the system and the terminal device in video options.
  • Loading branch information
cuavas committed Jul 16, 2018
1 parent 0e210f4 commit f18c7cd
Show file tree
Hide file tree
Showing 347 changed files with 935 additions and 976 deletions.
38 changes: 25 additions & 13 deletions scripts/build/complay.py
Expand Up @@ -166,37 +166,49 @@ def checkColorChannel(self, attrs, name):
except:
self.handleError('Element color attribute %s "%s" is not numeric' % (name, attrs[name]))

def checkTag(self, tag, element, attr):
if '' == tag:
self.handleError('Element %s attribute %s is empty', (element, attr))
else:
if tag.find('^') >= 0:
self.handleError('Element %s attribute %s "%s" contains parent device reference' % (element, attr, tag))
if ':' == tag[-1]:
self.handleError('Element %s attribute %s "%s" ends with separator' % (element, attr, tag))
if tag.find('::') >= 0:
self.handleError('Element %s attribute %s "%s" contains double separator' % (element, attr, tag))

def checkGroupViewItem(self, name, attrs):
if name in self.OBJECTS:
if 'element' not in attrs:
self.handleError('Element %s missing attribute element', (name, ))
elif attrs['element'] not in self.referenced_elements:
self.referenced_elements[attrs['element']] = self.formatLocation()
if 'inputtag' in attrs:
if 'inputmask' not in attrs:
self.handleError('Element %s has inputtag without inputmask attribute' % (name, ))
self.checkTag(attrs['inputtag'], name, 'inputtag')
if 'inputmask' in attrs:
try:
int(attrs['inputmask'], 0)
except:
self.handleError('Element %s attribute inputmask "%s" is not an integer' % (name, attrs['inputmask']))
self.in_object = True
self.have_bounds.append(False)
elif 'screen' == name:
if 'index' in attrs:
try:
index = long(attrs['index'])
index = long(attrs['index'], 0)
if 0 > index:
self.handleError('Element screen attribute index "%s" is negative' % (attrs['index'], ))
except:
self.handleError('Element screen attribute index "%s" is not an integer' % (attrs['index'], ))
if 'tag' in attrs:
self.handleError('Element screen has both index and tag attributes');
self.handleError('Element screen has both index and tag attributes')
if 'tag' in attrs:
tag = attrs['tag']
if '' == tag:
self.handleError('Element screen attribute tag is empty')
else:
if self.BADTAGPATTERN.search(tag):
self.handleError('Element screen attribute tag "%s" contains invalid characters' % (tag, ));
if tag.find('^') >= 0:
self.handleError('Element screen attribute tag "%s" contains parent device reference' % (tag, ));
if ':' == tag[-1]:
self.handleError('Element screen attribute tag "%s" ends with separator' % (tag, ));
if tag.find('::') >= 0:
self.handleError('Element screen attribute tag "%s" contains double separator' % (tag, ));
self.checkTag(tag, name, 'tag')
if self.BADTAGPATTERN.search(tag):
self.handleError('Element screen attribute tag "%s" contains invalid characters' % (tag, ))
self.in_object = True
self.have_bounds.append(False)
elif 'group' == name:
Expand Down
2 changes: 1 addition & 1 deletion src/devices/bus/centronics/epson_ex800.cpp
Expand Up @@ -227,7 +227,7 @@ void epson_ex800_device::device_add_mconfig(machine_config &config)
upd.pc_in_cb().set(FUNC(epson_ex800_device::portc_r));
upd.pc_out_cb().set(FUNC(epson_ex800_device::portc_w));

config.m_default_layout = &layout_ex800;
config.set_default_layout(layout_ex800);

/* audio hardware */
SPEAKER(config, "mono").front_center();
Expand Down
22 changes: 10 additions & 12 deletions src/devices/bus/centronics/epson_lx800.cpp
Expand Up @@ -66,7 +66,8 @@ void epson_lx800_device::lx800_mem(address_map &map)
// device_add_mconfig - add device configuration
//-------------------------------------------------

MACHINE_CONFIG_START(epson_lx800_device::device_add_mconfig)
void epson_lx800_device::device_add_mconfig(machine_config &config)
{
/* basic machine hardware */
upd7810_device &upd(UPD7810(config, m_maincpu, 14.7456_MHz_XTAL));
upd.set_addrmap(AS_PROGRAM, &epson_lx800_device::lx800_mem);
Expand All @@ -82,20 +83,20 @@ MACHINE_CONFIG_START(epson_lx800_device::device_add_mconfig)
upd.an4_func().set(FUNC(epson_lx800_device::an4_r));
upd.an5_func().set(FUNC(epson_lx800_device::an5_r));

MCFG_DEFAULT_LAYOUT(layout_lx800)
config.set_default_layout(layout_lx800);

/* audio hardware */
SPEAKER(config, "mono").front_center();
BEEP(config, m_beep, 4000); // ?
m_beep->add_route(ALL_OUTPUTS, "mono", 0.05);

/* gate array */
MCFG_DEVICE_ADD("ic3b", E05A03, 0)
MCFG_E05A03_PE_LP_CALLBACK(WRITELINE(*this, epson_lx800_device, paperempty_led_w))
MCFG_E05A03_RESO_CALLBACK(WRITELINE(*this, epson_lx800_device, reset_w))
MCFG_E05A03_PE_CALLBACK(WRITELINE(*this, epson_lx800_device, centronics_pe_w))
MCFG_E05A03_DATA_CALLBACK(READ8(*this, epson_lx800_device, centronics_data_r))
MACHINE_CONFIG_END
e05a03_device &ic3b(E05A03(config, "ic3b", 0));
ic3b.pe_lp_wr_callback().set(FUNC(epson_lx800_device::paperempty_led_w));
ic3b.reso_wr_callback().set(FUNC(epson_lx800_device::reset_w));
ic3b.pe_wr_callback().set(FUNC(epson_lx800_device::centronics_pe_w));
ic3b.data_rd_callback().set(FUNC(epson_lx800_device::centronics_data_r));
}


//-------------------------------------------------
Expand Down Expand Up @@ -184,10 +185,7 @@ ioport_constructor epson_lx800_device::device_input_ports() const
//-------------------------------------------------

epson_lx800_device::epson_lx800_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, EPSON_LX800, tag, owner, clock),
device_centronics_peripheral_interface(mconfig, *this),
m_maincpu(*this, "maincpu"),
m_beep(*this, "beeper")
epson_lx800_device(mconfig, EPSON_LX800, tag, owner, clock)
{
}

Expand Down
2 changes: 0 additions & 2 deletions src/devices/bus/centronics/epson_lx800.h
Expand Up @@ -71,6 +71,4 @@ class epson_lx800_device : public device_t, public device_centronics_peripheral
// device type definition
DECLARE_DEVICE_TYPE(EPSON_LX800, epson_lx800_device)



#endif // MAME_BUS_CENTRONICS_EPSON_LX800_H
2 changes: 1 addition & 1 deletion src/devices/bus/centronics/epson_lx810l.cpp
Expand Up @@ -127,7 +127,7 @@ MACHINE_CONFIG_START(epson_lx810l_device::device_add_mconfig)
upd.co0_func().set(FUNC(epson_lx810l_device::co0_w));
upd.co1_func().set("dac", FUNC(dac_bit_interface::write));

// MCFG_DEFAULT_LAYOUT(layout_lx800)
// config.set_default_layout(layout_lx800);

/* video hardware (simulates paper) */
MCFG_SCREEN_ADD("screen", RASTER)
Expand Down
122 changes: 24 additions & 98 deletions src/devices/cpu/mcs40/mcs40.h
Expand Up @@ -24,80 +24,6 @@ enum



/***********************************************************************
CONFIGURATION MACROS
***********************************************************************/

#define MCS40CB_BUSCYCLE(cls, fnc) \
mcs40_cpu_device_base::bus_cycle_delegate((&cls::fnc), (#cls "::" #fnc), DEVICE_SELF, (cls *)nullptr)


#define MCFG_I4004_BUS_CYCLE_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_bus_cycle_cb((MCS40CB_##obj));

#define MCFG_I4004_SYNC_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_sync_cb(DEVCB_##obj);

#define MCFG_I4004_CM_ROM_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_cm_rom_cb(DEVCB_##obj);

#define MCFG_I4004_CM_RAM0_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_cm_ram_cb<0>(DEVCB_##obj);

#define MCFG_I4004_CM_RAM1_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_cm_ram_cb<1>(DEVCB_##obj);

#define MCFG_I4004_CM_RAM2_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_cm_ram_cb<2>(DEVCB_##obj);

#define MCFG_I4004_CM_RAM3_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_cm_ram_cb<3>(DEVCB_##obj);

#define MCFG_I4004_4289_PM_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_4289_pm_cb(DEVCB_##obj);

#define MCFG_I4004_4289_F_L_CB(obj) \
downcast<i4004_cpu_device &>(*device).set_4289_f_l_cb(DEVCB_##obj);


#define MCFG_I4040_BUS_CYCLE_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_bus_cycle_cb((MCS40CB_##obj));

#define MCFG_I4040_SYNC_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_sync_cb(DEVCB_##obj);

#define MCFG_I4040_CM_ROM0_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_cm_rom_cb<0>(DEVCB_##obj);

#define MCFG_I4040_CM_ROM1_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_cm_rom_cb<1>(DEVCB_##obj);

#define MCFG_I4040_CM_RAM0_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_cm_ram_cb<0>(DEVCB_##obj);

#define MCFG_I4040_CM_RAM1_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_cm_ram_cb<1>(DEVCB_##obj);

#define MCFG_I4040_CM_RAM2_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_cm_ram_cb<2>(DEVCB_##obj);

#define MCFG_I4040_CM_RAM3_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_cm_ram_cb<3>(DEVCB_##obj);

#define MCFG_I4040_CY_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_cy_cb(DEVCB_##obj);

#define MCFG_I4040_STP_ACK_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_stp_ack_cb(DEVCB_##obj);

#define MCFG_I4040_4289_PM_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_4289_pm_cb(DEVCB_##obj);

#define MCFG_I4040_4289_F_L_CB(obj) \
downcast<i4040_cpu_device &>(*device).set_4289_f_l_cb(DEVCB_##obj);



/***********************************************************************
TYPE DEFINITIONS
***********************************************************************/
Expand Down Expand Up @@ -125,9 +51,9 @@ class mcs40_cpu_device_base : public cpu_device
template <typename... T> void set_ram_status_map(T &&... args) { set_addrmap(AS_RAM_STATUS, std::forward<T>(args)...); }
template <typename... T> void set_ram_ports_map(T &&... args) { set_addrmap(AS_RAM_PORTS, std::forward<T>(args)...); }
template <typename... T> void set_program_memory_map(T &&... args) { set_addrmap(AS_PROGRAM_MEMORY, std::forward<T>(args)...); }
template <typename Obj> void set_bus_cycle_cb(Obj &&cb) { m_bus_cycle_cb = std::forward<Obj>(cb); }
template <typename Obj> devcb_base &set_4289_pm_cb(Obj &&cb) { return m_4289_pm_cb.set_callback(std::forward<Obj>(cb)); }
template <typename Obj> devcb_base &set_4289_f_l_cb(Obj &&cb) { return m_4289_f_l_cb.set_callback(std::forward<Obj>(cb)); }
template <typename... T> void set_bus_cycle_cb(T &&... args) { m_bus_cycle_cb = bus_cycle_delegate(std::forward<T>(args)...); }
auto i4289_pm_cb() { return m_4289_pm_cb.bind(); }
auto i4289_f_l_cb() { return m_4289_f_l_cb.bind(); }

// chip select outputs
u8 get_cm_rom() const { return m_cm_rom; }
Expand Down Expand Up @@ -211,11 +137,11 @@ class mcs40_cpu_device_base : public cpu_device
void set_stp(int state);

// configuration helpers
template <typename Obj> devcb_base &set_sync_cb(Obj &&cb) { return m_sync_cb.set_callback(std::forward<Obj>(cb)); }
template <unsigned N, typename Obj> devcb_base &set_cm_rom_cb(Obj &&cb) { return m_cm_rom_cb[N].set_callback(std::forward<Obj>(cb)); }
template <unsigned N, typename Obj> devcb_base &set_cm_ram_cb(Obj &&cb) { return m_cm_ram_cb[N].set_callback(std::forward<Obj>(cb)); }
template <typename Obj> devcb_base &set_cy_cb(Obj &&cb) { return m_cy_cb.set_callback(std::forward<Obj>(cb)); }
template <typename Obj> devcb_base &set_stp_ack_cb(Obj &&cb) { return m_stp_ack_cb.set_callback(std::forward<Obj>(cb)); }
auto sync_cb() { return m_sync_cb.bind(); }
template <unsigned N> auto cm_rom_cb() { return m_cm_rom_cb[N].bind(); }
template <unsigned N> auto cm_ram_cb() { return m_cm_ram_cb[N].bind(); }
auto cy_cb() { return m_cy_cb.bind(); }
auto stp_ack_cb() { return m_stp_ack_cb.bind(); }

private:
enum
Expand Down Expand Up @@ -322,9 +248,9 @@ class i4004_cpu_device : public mcs40_cpu_device_base
{
public:
// configuration helpers
template <typename Obj> devcb_base &set_sync_cb(Obj &&cb) { return mcs40_cpu_device_base::set_sync_cb(std::forward<Obj>(cb)); }
template <typename Obj> devcb_base &set_cm_rom_cb(Obj &&cb) { return set_cm_rom_cb<0>(std::forward<Obj>(cb)); }
template <unsigned N, typename Obj> devcb_base &set_cm_ram_cb(Obj &&cb) { return mcs40_cpu_device_base::set_cm_ram_cb<N>(std::forward<Obj>(cb)); }
auto sync_cb() { return mcs40_cpu_device_base::sync_cb(); }
auto cm_rom_cb() { return cm_rom_cb<0>(); }
template <unsigned N> auto cm_ram_cb() { return mcs40_cpu_device_base::cm_ram_cb<N>(); }

i4004_cpu_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);

Expand All @@ -345,21 +271,21 @@ class i4004_cpu_device : public mcs40_cpu_device_base
virtual u8 do_io(u8 opr, u8 opa) override;

// configuration helpers
using mcs40_cpu_device_base::set_sync_cb;
using mcs40_cpu_device_base::set_cm_rom_cb;
using mcs40_cpu_device_base::set_cm_ram_cb;
using mcs40_cpu_device_base::sync_cb;
using mcs40_cpu_device_base::cm_rom_cb;
using mcs40_cpu_device_base::cm_ram_cb;
};


class i4040_cpu_device : public i4004_cpu_device
{
public:
// configuration helpers
template <typename Obj> devcb_base &set_sync_cb(Obj &&cb) { return i4004_cpu_device::set_sync_cb(std::forward<Obj>(cb)); }
template <unsigned N, typename Obj> devcb_base &set_cm_rom_cb(Obj &&cb) { return set_cm_rom_cb<N>(std::forward<Obj>(cb)); }
template <unsigned N, typename Obj> devcb_base &set_cm_ram_cb(Obj &&cb) { return set_cm_ram_cb<N>(std::forward<Obj>(cb)); }
template <typename Obj> devcb_base &set_cy_cb(Obj &&cb) { return i4004_cpu_device::set_cy_cb(std::forward<Obj>(cb)); }
template <typename Obj> devcb_base &set_stp_ack_cb(Obj &&cb) { return i4004_cpu_device::set_stp_ack_cb(std::forward<Obj>(cb)); }
auto sync_cb() { return i4004_cpu_device::sync_cb(); }
template <unsigned N> auto cm_rom_cb() { return cm_rom_cb<N>(); }
template <unsigned N> auto cm_ram_cb() { return cm_ram_cb<N>(); }
auto cy_cb() { return i4004_cpu_device::cy_cb(); }
auto stp_ack_cb() { return i4004_cpu_device::stp_ack_cb(); }

i4040_cpu_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);

Expand All @@ -375,11 +301,11 @@ class i4040_cpu_device : public i4004_cpu_device
virtual cycle do_cycle1(u8 opr, u8 opa, pmem &program_op) override;

// configuration helpers
using mcs40_cpu_device_base::set_sync_cb;
using mcs40_cpu_device_base::set_cm_rom_cb;
using mcs40_cpu_device_base::set_cm_ram_cb;
using mcs40_cpu_device_base::set_cy_cb;
using mcs40_cpu_device_base::set_stp_ack_cb;
using mcs40_cpu_device_base::sync_cb;
using mcs40_cpu_device_base::cm_rom_cb;
using mcs40_cpu_device_base::cm_ram_cb;
using mcs40_cpu_device_base::cy_cb;
using mcs40_cpu_device_base::stp_ack_cb;
};


Expand Down
30 changes: 5 additions & 25 deletions src/devices/machine/e05a03.h
Expand Up @@ -11,26 +11,6 @@

#pragma once

/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/

#define MCFG_E05A03_NLQ_LP_CALLBACK(_write) \
downcast<e05a03_device &>(*device).set_nlq_lp_wr_callback(DEVCB_##_write);

#define MCFG_E05A03_PE_LP_CALLBACK(_write) \
downcast<e05a03_device &>(*device).set_pe_lp_wr_callback(DEVCB_##_write);

#define MCFG_E05A03_RESO_CALLBACK(_write) \
downcast<e05a03_device &>(*device).set_reso_wr_callback(DEVCB_##_write);

#define MCFG_E05A03_PE_CALLBACK(_write) \
downcast<e05a03_device &>(*device).set_pe_wr_callback(DEVCB_##_write);

#define MCFG_E05A03_DATA_CALLBACK(_read) \
downcast<e05a03_device &>(*device).set_data_rd_callback(DEVCB_##_read);


/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
Expand All @@ -40,11 +20,11 @@ class e05a03_device : public device_t
public:
e05a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

template <class Object> devcb_base &set_nlq_lp_wr_callback(Object &&cb) { return m_write_nlq_lp.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_pe_lp_wr_callback(Object &&cb) { return m_write_pe_lp.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_reso_wr_callback(Object &&cb) { return m_write_reso.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_pe_wr_callback(Object &&cb) { return m_write_pe.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_data_rd_callback(Object &&cb) { return m_read_data.set_callback(std::forward<Object>(cb)); }
auto nlq_lp_wr_callback() { return m_write_nlq_lp.bind(); }
auto pe_lp_wr_callback() { return m_write_pe_lp.bind(); }
auto reso_wr_callback() { return m_write_reso.bind(); }
auto pe_wr_callback() { return m_write_pe.bind(); }
auto data_rd_callback() { return m_read_data.bind(); }

DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( read );
Expand Down
2 changes: 1 addition & 1 deletion src/devices/machine/ie15.cpp
Expand Up @@ -574,7 +574,7 @@ MACHINE_CONFIG_START(ie15_device::ie15core)
MCFG_DEVICE_PROGRAM_MAP(ie15_mem)
MCFG_DEVICE_IO_MAP(ie15_io)

MCFG_DEFAULT_LAYOUT(layout_ie15)
config.set_default_layout(layout_ie15);

/* Devices */
MCFG_DEVICE_ADD("keyboard", IE15_KEYBOARD, 0)
Expand Down
2 changes: 1 addition & 1 deletion src/devices/video/gba_lcd.cpp
Expand Up @@ -1810,7 +1810,7 @@ MACHINE_CONFIG_START(gba_lcd_device::device_add_mconfig)
MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, gba_lcd_device, screen_update)
MCFG_SCREEN_PALETTE("palette")

MCFG_DEFAULT_LAYOUT(layout_lcd)
config.set_default_layout(layout_lcd);
MCFG_PALETTE_ADD("palette", 32768)
MCFG_PALETTE_INIT_OWNER(gba_lcd_device, gba)
MACHINE_CONFIG_END
13 changes: 2 additions & 11 deletions src/devices/video/hlcd0538.h
Expand Up @@ -40,23 +40,14 @@
*/


// C/R pins (0538: d0-d7 for rows)
#define MCFG_HLCD0538_WRITE_COLS_CB(_devcb) \
downcast<hlcd0538_device &>(*device).set_write_cols_callback(DEVCB_##_devcb);

// INTERRUPT pin
#define MCFG_HLCD0538_INTERRUPT_CB(_devcb) \
downcast<hlcd0538_device &>(*device).set_write_interrupt_callback(DEVCB_##_devcb);


class hlcd0538_device : public device_t
{
public:
hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);

// configuration helpers
template <typename Object> devcb_base &set_write_cols_callback(Object &&cb) { return m_write_cols.set_callback(std::forward<Object>(cb)); }
template <typename Object> devcb_base &set_write_interrupt_callback(Object &&cb) { return m_write_interrupt.set_callback(std::forward<Object>(cb)); }
auto write_cols_callback() { return m_write_cols.bind(); } // C/R pins (0538: d0-d7 for rows)
auto write_interrupt_callback() { return m_write_interrupt.bind(); } // INTERRUPT pin

DECLARE_WRITE_LINE_MEMBER(write_clk);
DECLARE_WRITE_LINE_MEMBER(write_lcd);
Expand Down

0 comments on commit f18c7cd

Please sign in to comment.