From 7e4070f563b5b60842ddd3080df4fb59487e2af8 Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Mon, 17 Dec 2018 01:30:26 +0100 Subject: -bus/gameboy/gb_slot, ieee488/hp9895, psx/gamebooster, snes/sgb: Removed MCFG and MACHINE_CONFIG macros. [Ryan Holtz] -cpu/jaguar, lh5801, lr35902, z80: Removed MCFG macros. [Ryan Holtz] -video/sed1520: Removed MCFG macros. [Ryan Holtz] -drivers/gb, jaguar, monty, osborne1, pc1500, pc2000, popeye: Removed MACHINE_CONFIG macros. [Ryan Holtz] --- src/devices/bus/gameboy/gb_slot.h | 32 ++++--- src/devices/bus/ieee488/hp9895.cpp | 19 ++-- src/devices/bus/psx/gamebooster.cpp | 11 ++- src/devices/bus/snes/sgb.cpp | 38 ++++---- src/devices/bus/snes/sgb.h | 3 +- src/devices/cpu/jaguar/jaguar.h | 10 +- src/devices/cpu/lh5801/lh5801.h | 6 +- src/devices/cpu/lr35902/lr35902.h | 29 ++---- src/devices/cpu/z80/z80.h | 12 --- src/devices/imagedev/chd_cd.h | 2 +- src/devices/machine/netlist.h | 10 ++ src/devices/video/hd44780.h | 11 +++ src/devices/video/sed1520.h | 18 ++-- src/mame/drivers/gb.cpp | 181 +++++++++++++++++------------------- src/mame/drivers/jaguar.cpp | 148 +++++++++++++++-------------- src/mame/drivers/monty.cpp | 40 ++++---- src/mame/drivers/n64.cpp | 3 +- src/mame/drivers/osborne1.cpp | 54 +++++------ src/mame/drivers/pc1500.cpp | 34 +++---- src/mame/drivers/pc2000.cpp | 138 ++++++++++++++------------- src/mame/drivers/popeye.cpp | 82 ++++++++-------- src/mame/includes/gb.h | 4 +- src/mame/includes/osborne1.h | 2 +- src/mame/includes/popeye.h | 7 +- src/mame/video/popeye.cpp | 4 +- 25 files changed, 442 insertions(+), 456 deletions(-) diff --git a/src/devices/bus/gameboy/gb_slot.h b/src/devices/bus/gameboy/gb_slot.h index 3ee8d27d4e0..ef734e6f99e 100644 --- a/src/devices/bus/gameboy/gb_slot.h +++ b/src/devices/bus/gameboy/gb_slot.h @@ -164,6 +164,15 @@ class gb_cart_slot_device : public gb_cart_slot_device_base { public: // construction/destruction + template + gb_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : gb_cart_slot_device(mconfig, tag, owner, (uint32_t)0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } gb_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; @@ -174,6 +183,15 @@ class megaduck_cart_slot_device : public gb_cart_slot_device_base { public: // construction/destruction + template + megaduck_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : megaduck_cart_slot_device(mconfig, tag, owner, (uint32_t)0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } megaduck_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // image-level overrides @@ -192,20 +210,6 @@ public: DECLARE_DEVICE_TYPE(GB_CART_SLOT, gb_cart_slot_device) DECLARE_DEVICE_TYPE(MEGADUCK_CART_SLOT, megaduck_cart_slot_device) - -/*************************************************************************** - DEVICE CONFIGURATION MACROS - ***************************************************************************/ - #define GBSLOT_ROM_REGION_TAG ":cart:rom" -#define MCFG_GB_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ - MCFG_DEVICE_ADD(_tag, GB_CART_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - -#define MCFG_MEGADUCK_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ - MCFG_DEVICE_ADD(_tag, MEGADUCK_CART_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - #endif // MAME_BUS_GAMEBOY_GB_SLOT_H diff --git a/src/devices/bus/ieee488/hp9895.cpp b/src/devices/bus/ieee488/hp9895.cpp index 72d99ce1c4f..2e15e9d4279 100644 --- a/src/devices/bus/ieee488/hp9895.cpp +++ b/src/devices/bus/ieee488/hp9895.cpp @@ -885,11 +885,12 @@ const tiny_rom_entry *hp9895_device::device_rom_region() const return ROM_NAME(hp9895); } -MACHINE_CONFIG_START(hp9895_device::device_add_mconfig) - MCFG_DEVICE_ADD("cpu" , Z80 , 4000000) - MCFG_DEVICE_PROGRAM_MAP(z80_program_map) - MCFG_DEVICE_IO_MAP(z80_io_map) - MCFG_Z80_SET_REFRESH_CALLBACK(WRITE8(*this, hp9895_device , z80_m1_w)) +void hp9895_device::device_add_mconfig(machine_config &config) +{ + Z80(config, m_cpu, 4000000); + m_cpu->set_addrmap(AS_PROGRAM, &hp9895_device::z80_program_map); + m_cpu->set_addrmap(AS_IO, &hp9895_device::z80_io_map); + m_cpu->refresh_cb().set(FUNC(hp9895_device::z80_m1_w)); PHI(config, m_phi, 0); m_phi->signal_write_cb().set(FUNC(hp9895_device::phi_eoi_w)); @@ -905,8 +906,6 @@ MACHINE_CONFIG_START(hp9895_device::device_add_mconfig) m_phi->int_write_cb().set(FUNC(hp9895_device::phi_int_w)); m_phi->sys_cntrl_read_cb().set_constant(0); - MCFG_FLOPPY_DRIVE_ADD("floppy0" , hp9895_floppies , "8dsdd" , hp9895_floppy_formats) - MCFG_SLOT_FIXED(true) - MCFG_FLOPPY_DRIVE_ADD("floppy1" , hp9895_floppies , "8dsdd" , hp9895_floppy_formats) - MCFG_SLOT_FIXED(true) -MACHINE_CONFIG_END + FLOPPY_CONNECTOR(config, "floppy0", hp9895_floppies, "8dsdd", hp9895_floppy_formats).set_fixed(true); + FLOPPY_CONNECTOR(config, "floppy1", hp9895_floppies, "8dsdd", hp9895_floppy_formats).set_fixed(true); +} diff --git a/src/devices/bus/psx/gamebooster.cpp b/src/devices/bus/psx/gamebooster.cpp index 230ebfea49b..3513f7714e2 100644 --- a/src/devices/bus/psx/gamebooster.cpp +++ b/src/devices/bus/psx/gamebooster.cpp @@ -150,10 +150,11 @@ static void gb_cart(device_slot_interface &device) // device.option_add_internal("rom_unk01", GB_ROM_UNK01); } -MACHINE_CONFIG_START(psx_gamebooster_device::device_add_mconfig) +void psx_gamebooster_device::device_add_mconfig(machine_config &config) +{ /* cartslot */ - MCFG_GB_CARTRIDGE_ADD("gbslot", gb_cart, nullptr) + GB_CART_SLOT(config, m_cartslot, gb_cart, nullptr); - MCFG_SOFTWARE_LIST_ADD("cart_list","gameboy") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gbc_list","gbcolor") -MACHINE_CONFIG_END + SOFTWARE_LIST(config, "cart_list").set_original("gameboy"); + SOFTWARE_LIST(config, "gbc_list").set_compatible("gbcolor"); +} diff --git a/src/devices/bus/snes/sgb.cpp b/src/devices/bus/snes/sgb.cpp index 9556e29ab7b..1a50f504f01 100644 --- a/src/devices/bus/snes/sgb.cpp +++ b/src/devices/bus/snes/sgb.cpp @@ -161,18 +161,19 @@ static void supergb_cart(device_slot_interface &device) } -MACHINE_CONFIG_START(sns_rom_sgb1_device::device_add_mconfig) - MCFG_DEVICE_ADD("sgb_cpu", LR35902, 4295454) /* 4.295454 MHz */ - MCFG_DEVICE_PROGRAM_MAP(supergb_map) - MCFG_LR35902_TIMER_CB(WRITE8(*this, sns_rom_sgb_device, gb_timer_callback)) - MCFG_LR35902_HALT_BUG +void sns_rom_sgb1_device::device_add_mconfig(machine_config &config) +{ + LR35902(config, m_sgb_cpu, 4295454); /* 4.295454 MHz */ + m_sgb_cpu->set_addrmap(AS_PROGRAM, &sns_rom_sgb1_device::supergb_map); + m_sgb_cpu->timer_cb().set(FUNC(sns_rom_sgb_device::gb_timer_callback)); + m_sgb_cpu->set_halt_bug(true); - MCFG_DEVICE_ADD("sgb_ppu", SGB_PPU, "sgb_cpu") + SGB_PPU(config, m_sgb_ppu, m_sgb_cpu); - MCFG_DEVICE_ADD("sgb_apu", DMG_APU, 4295454) + DMG_APU(config, m_sgb_apu, 4295454); - MCFG_GB_CARTRIDGE_ADD("gb_slot", supergb_cart, nullptr) -MACHINE_CONFIG_END + GB_CART_SLOT(config, m_cartslot, supergb_cart, nullptr); +} ROM_START( supergb ) @@ -187,18 +188,19 @@ const tiny_rom_entry *sns_rom_sgb1_device::device_rom_region() const } -MACHINE_CONFIG_START(sns_rom_sgb2_device::device_add_mconfig) - MCFG_DEVICE_ADD("sgb_cpu", LR35902, XTAL(4'194'304)) /* 4.194MHz derived from clock on sgb2 pcb */ - MCFG_DEVICE_PROGRAM_MAP(supergb_map) - MCFG_LR35902_TIMER_CB(WRITE8(*this, sns_rom_sgb_device, gb_timer_callback)) - MCFG_LR35902_HALT_BUG +void sns_rom_sgb2_device::device_add_mconfig(machine_config &config) +{ + LR35902(config, m_sgb_cpu, XTAL(4'194'304)); /* 4.194MHz derived from clock on sgb2 pcb */ + m_sgb_cpu->set_addrmap(AS_PROGRAM, &sns_rom_sgb2_device::supergb_map); + m_sgb_cpu->timer_cb().set(FUNC(sns_rom_sgb_device::gb_timer_callback)); + m_sgb_cpu->set_halt_bug(true); - MCFG_DEVICE_ADD("sgb_ppu", SGB_PPU, "sgb_cpu") + SGB_PPU(config, m_sgb_ppu, m_sgb_cpu); - MCFG_DEVICE_ADD("sgb_apu", DMG_APU, XTAL(4'194'304)) + DMG_APU(config, m_sgb_apu, XTAL(4'194'304)); - MCFG_GB_CARTRIDGE_ADD("gb_slot", supergb_cart, nullptr) -MACHINE_CONFIG_END + GB_CART_SLOT(config, m_cartslot, supergb_cart, nullptr); +} ROM_START( supergb2 ) diff --git a/src/devices/bus/snes/sgb.h b/src/devices/bus/snes/sgb.h index 8238b2e3de8..c49ebaa44e3 100644 --- a/src/devices/bus/snes/sgb.h +++ b/src/devices/bus/snes/sgb.h @@ -51,11 +51,12 @@ protected: void supergb_map(address_map &map); -private: required_device m_sgb_cpu; required_device m_sgb_apu; required_device m_sgb_ppu; required_device m_cartslot; + +private: required_memory_region m_region_bios; void lcd_render(uint32_t *source); diff --git a/src/devices/cpu/jaguar/jaguar.h b/src/devices/cpu/jaguar/jaguar.h index 79c6b77bc1c..befb5a73334 100644 --- a/src/devices/cpu/jaguar/jaguar.h +++ b/src/devices/cpu/jaguar/jaguar.h @@ -60,14 +60,6 @@ enum -/*************************************************************************** - CONFIGURATION -***************************************************************************/ - -#define MCFG_JAGUAR_IRQ_HANDLER(_devcb) \ - downcast(*device).set_int_func(DEVCB_##_devcb); - - /*************************************************************************** INTERRUPT CONSTANTS ***************************************************************************/ @@ -96,7 +88,7 @@ public: ~jaguar_cpu_device(); // configuration helpers - template devcb_base &set_int_func(Object &&cb) { return m_cpu_interrupt.set_callback(std::forward(cb)); } + auto irq() { return m_cpu_interrupt.bind(); } virtual DECLARE_WRITE32_MEMBER(ctrl_w) = 0; virtual DECLARE_READ32_MEMBER(ctrl_r) = 0; diff --git a/src/devices/cpu/lh5801/lh5801.h b/src/devices/cpu/lh5801/lh5801.h index 02a359b6cb1..cb3237027b3 100644 --- a/src/devices/cpu/lh5801/lh5801.h +++ b/src/devices/cpu/lh5801/lh5801.h @@ -60,10 +60,6 @@ enum }; -#define MCFG_LH5801_IN(_devcb) \ - downcast(*device).set_in_func(DEVCB_##_devcb); - - class lh5801_cpu_device : public cpu_device { public: @@ -71,7 +67,7 @@ public: lh5801_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration helpers - template devcb_base &set_in_func(Object &&cb) { return m_in_func.set_callback(std::forward(cb)); } + auto in_func() { return m_in_func.bind(); } protected: // device-level overrides diff --git a/src/devices/cpu/lr35902/lr35902.h b/src/devices/cpu/lr35902/lr35902.h index ab70377a21e..a15462080c8 100644 --- a/src/devices/cpu/lr35902/lr35902.h +++ b/src/devices/cpu/lr35902/lr35902.h @@ -5,23 +5,6 @@ #pragma once - -#define MCFG_LR35902_TIMER_CB(_devcb) \ - downcast(*device).set_timer_cb(DEVCB_##_devcb); - -// The first release of this CPU has a bug where the programcounter -// is not incremented properly after an interrupt after the halt opcode. -// This was fixed in a newer revision. -#define MCFG_LR35902_HALT_BUG \ - downcast(*device).set_halt_bug(true); - -// The GameBoy has a bug where OAM data gets corrupted if you inc/dec -// a 16-bit register in the $fe** region. -// note: oldval is in hiword, newval is in loword -#define MCFG_LR35902_INCDEC16_CB(_devcb) \ - downcast(*device).set_incdec16_cb(DEVCB_##_devcb); - - enum { LR35902_PC=1, LR35902_SP, LR35902_A, LR35902_F, LR35902_B, LR35902_C, LR35902_D, LR35902_E, LR35902_H, LR35902_L, @@ -40,8 +23,16 @@ public: lr35902_cpu_device(const machine_config &mconfig, const char *_tag, device_t *_owner, uint32_t _clock); // configuration helpers - template devcb_base &set_timer_cb(Object &&cb) { return m_timer_func.set_callback(std::forward(cb)); } - template devcb_base &set_incdec16_cb(Object &&cb) { return m_incdec16_func.set_callback(std::forward(cb)); } + auto timer_cb() { return m_timer_func.bind(); } + + // The GameBoy has a bug where OAM data gets corrupted if you inc/dec + // a 16-bit register in the $fe** region. + // note: oldval is in hiword, newval is in loword + auto incdec16_cb() { return m_incdec16_func.bind(); } + + // The first release of this CPU has a bug where the programcounter + // is not incremented properly after an interrupt after the halt opcode. + // This was fixed in a newer revision. void set_halt_bug(bool has_halt_bug) { m_has_halt_bug = has_halt_bug; } uint8_t get_speed(); diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h index 3a95d183b4a..55de3771f7a 100644 --- a/src/devices/cpu/z80/z80.h +++ b/src/devices/cpu/z80/z80.h @@ -7,15 +7,6 @@ #include "machine/z80daisy.h" -#define MCFG_Z80_SET_IRQACK_CALLBACK(_devcb) \ - downcast(*device).set_irqack_cb(DEVCB_##_devcb); - -#define MCFG_Z80_SET_REFRESH_CALLBACK(_devcb) \ - downcast(*device).set_refresh_cb(DEVCB_##_devcb); - -#define MCFG_Z80_SET_HALT_CALLBACK(_devcb) \ - downcast(*device).set_halt_cb(DEVCB_##_devcb); - enum { NSC800_RSTA = INPUT_LINE_IRQ0 + 1, @@ -45,9 +36,6 @@ public: template void set_memory_map(T &&... args) { set_addrmap(AS_PROGRAM, std::forward(args)...); } template void set_m1_map(T &&... args) { set_addrmap(AS_OPCODES, std::forward(args)...); } template void set_io_map(T &&... args) { set_addrmap(AS_IO, std::forward(args)...); } - template devcb_base &set_irqack_cb(Object &&cb) { return m_irqack_cb.set_callback(std::forward(cb)); } - template devcb_base &set_refresh_cb(Object &&cb) { return m_refresh_cb.set_callback(std::forward(cb)); } - template devcb_base &set_halt_cb(Object &&cb) { return m_halt_cb.set_callback(std::forward(cb)); } auto irqack_cb() { return m_irqack_cb.bind(); } auto refresh_cb() { return m_refresh_cb.bind(); } auto halt_cb() { return m_halt_cb.bind(); } diff --git a/src/devices/imagedev/chd_cd.h b/src/devices/imagedev/chd_cd.h index 5de6f514293..0be8a274cac 100644 --- a/src/devices/imagedev/chd_cd.h +++ b/src/devices/imagedev/chd_cd.h @@ -27,7 +27,7 @@ class cdrom_image_device : public device_t, { public: // construction/destruction - cdrom_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + cdrom_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~cdrom_image_device(); void set_interface(const char *interface) { m_interface = interface; } diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h index 828e2497af6..46d7fbef7b5 100644 --- a/src/devices/machine/netlist.h +++ b/src/devices/machine/netlist.h @@ -468,6 +468,11 @@ class netlist_mame_stream_input_device : public device_t, public netlist_mame_su { public: // construction/destruction + netlist_mame_stream_input_device(const machine_config &mconfig, const char *tag, device_t *owner, int channel, const char *param_name) + : netlist_mame_stream_input_device(mconfig, tag, owner, (uint32_t)0) + { + set_params(channel, param_name); + } netlist_mame_stream_input_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); void set_params(int channel, const char *param_name); @@ -489,6 +494,11 @@ class netlist_mame_stream_output_device : public device_t, public netlist_mame_s { public: // construction/destruction + netlist_mame_stream_output_device(const machine_config &mconfig, const char *tag, device_t *owner, int channel, const char *out_name) + : netlist_mame_stream_output_device(mconfig, tag, owner, (uint32_t)0) + { + set_params(channel, out_name); + } netlist_mame_stream_output_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); void set_params(int channel, const char *out_name); diff --git a/src/devices/video/hd44780.h b/src/devices/video/hd44780.h index bcf5a683a88..65544ef6828 100644 --- a/src/devices/video/hd44780.h +++ b/src/devices/video/hd44780.h @@ -44,6 +44,17 @@ public: // static configuration helpers void set_lcd_size(int lines, int chars) { m_lines = lines; m_chars = chars; } template void set_pixel_update_cb(T &&... args) { m_pixel_update_cb = pixel_update_delegate(std::forward(args)...); } + void set_pixel_update_cb(pixel_update_delegate callback) { m_pixel_update_cb = callback; } + template void set_pixel_update_cb(const char *devname, + void (FunctionClass::*callback)(bitmap_ind16 &, uint8_t, uint8_t, uint8_t, uint8_t, int), const char *name) + { + set_pixel_update_cb(pixel_update_delegate(callback, name, devname, static_cast(nullptr))); + } + template void set_pixel_update_cb( + void (FunctionClass::*callback)(bitmap_ind16 &, uint8_t, uint8_t, uint8_t, uint8_t, int), const char *name) + { + set_pixel_update_cb(pixel_update_delegate(callback, name, nullptr, static_cast(nullptr))); + } // device interface virtual void write(offs_t offset, u8 data); diff --git a/src/devices/video/sed1520.h b/src/devices/video/sed1520.h index 1c7b60e040e..9ca1358713e 100644 --- a/src/devices/video/sed1520.h +++ b/src/devices/video/sed1520.h @@ -15,10 +15,6 @@ #define SED1520CB_UPDATE(cls, fnc) sed1520_device::screen_update_delegate((&cls::fnc), (#cls "::" #fnc), DEVICE_SELF, ((cls *)nullptr)) #define SED1520CB_DEVUPDATE(tag, cls, fnc) sed1520_device::screen_update_delegate((&cls::fnc), (#cls "::" #fnc), (tag), ((cls *)nullptr)) -#define MCFG_SED1520_ADD(tag, cb) \ - MCFG_DEVICE_ADD(tag, SED1520, 0) \ - downcast(*device).set_screen_update_cb(SED1520CB_##cb); - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -34,10 +30,20 @@ public: typedef device_delegate screen_update_delegate; // construction/destruction - sed1520_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + sed1520_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); // sconfiguration helpers - template void set_screen_update_cb(Object &&cb) { m_screen_update_cb = std::forward(cb); } + void set_screen_update_cb(screen_update_delegate callback) { m_screen_update_cb = callback; } + template void set_screen_update_cb(const char *devname, + uint32_t (FunctionClass::*callback)(bitmap_ind16 &, const rectangle &, uint8_t *, int, int), const char *name) + { + set_screen_update_cb(screen_update_delegate(callback, name, devname, static_cast(nullptr))); + } + template void set_screen_update_cb( + uint32_t (FunctionClass::*callback)(bitmap_ind16 &, const rectangle &, uint8_t *, int, int), const char *name) + { + set_screen_update_cb(screen_update_delegate(callback, name, nullptr, static_cast(nullptr))); + } // device interface virtual DECLARE_WRITE8_MEMBER(write); diff --git a/src/mame/drivers/gb.cpp b/src/mame/drivers/gb.cpp index a54bd86061a..2fe407b629a 100644 --- a/src/mame/drivers/gb.cpp +++ b/src/mame/drivers/gb.cpp @@ -576,26 +576,22 @@ PALETTE_INIT_MEMBER(gb_state, gbp) PALETTE_INIT_MEMBER(gb_state, sgb) { - int r, g, b; - for (int i = 0; i < 32768; i++) { - r = (i & 0x1F) << 3; - g = ((i >> 5) & 0x1F) << 3; - b = ((i >> 10) & 0x1F) << 3; + int r = (i & 0x1F) << 3; + int g = ((i >> 5) & 0x1F) << 3; + int b = ((i >> 10) & 0x1F) << 3; palette.set_pen_color(i, r, g, b); } } PALETTE_INIT_MEMBER(gb_state, gbc) { - int r, g, b; - for (int i = 0; i < 32768; i++) { - r = (i & 0x1F) << 3; - g = ((i >> 5) & 0x1F) << 3; - b = ((i >> 10) & 0x1F) << 3; + int r = (i & 0x1F) << 3; + int g = ((i >> 5) & 0x1F) << 3; + int b = ((i >> 10) & 0x1F) << 3; palette.set_pen_color(i, r, g, b); } } @@ -607,51 +603,50 @@ PALETTE_INIT_MEMBER(megaduck_state, megaduck) } -MACHINE_CONFIG_START(gb_state::gameboy) - +void gb_state::gameboy(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", LR35902, XTAL(4'194'304)) - MCFG_DEVICE_PROGRAM_MAP(gameboy_map) - MCFG_LR35902_TIMER_CB( WRITE8( *this, gb_state, gb_timer_callback ) ) - MCFG_LR35902_HALT_BUG + LR35902(config, m_maincpu, XTAL(4'194'304)); + m_maincpu->set_addrmap(AS_PROGRAM, &gb_state::gameboy_map); + m_maincpu->timer_cb().set(FUNC(gb_state::gb_timer_callback)); + m_maincpu->set_halt_bug(true); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); screen.set_refresh_hz(DMG_FRAMES_PER_SECOND); screen.set_vblank_time(0); screen.set_screen_update("ppu", FUNC(dmg_ppu_device::screen_update)); - screen.set_palette("palette"); + screen.set_palette(m_palette); // screen.set_size(20*8, 18*8); screen.set_size(458, 154); screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1); - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(gb_state,gb) + GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty); + PALETTE(config, m_palette, 4).set_init(FUNC(gb_state::palette_init_gb)); - MCFG_DEVICE_ADD("ppu", DMG_PPU, "maincpu") + DMG_PPU(config, m_ppu, m_maincpu); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("apu", DMG_APU, XTAL(4'194'304)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + DMG_APU(config, m_apu, XTAL(4'194'304)); + m_apu->add_route(0, "lspeaker", 0.50); + m_apu->add_route(1, "rspeaker", 0.50); /* cartslot */ - MCFG_GB_CARTRIDGE_ADD("gbslot", gb_cart, nullptr) - - MCFG_SOFTWARE_LIST_ADD("cart_list","gameboy") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gbc_list","gbcolor") -MACHINE_CONFIG_END + GB_CART_SLOT(config, m_cartslot, gb_cart, nullptr); + SOFTWARE_LIST(config, "cart_list").set_original("gameboy"); + SOFTWARE_LIST(config, "gbc_list").set_compatible("gbcolor"); +} -MACHINE_CONFIG_START(gb_state::supergb) +void gb_state::supergb(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", LR35902, 4295454) /* 4.295454 MHz, derived from SNES xtal */ - MCFG_DEVICE_PROGRAM_MAP(sgb_map) - MCFG_LR35902_TIMER_CB( WRITE8(*this, gb_state, gb_timer_callback ) ) - MCFG_LR35902_HALT_BUG + LR35902(config, m_maincpu, 4295454); /* 4.295454 MHz, derived from SNES xtal */ + m_maincpu->set_addrmap(AS_PROGRAM, &gb_state::sgb_map); + m_maincpu->timer_cb().set(FUNC(gb_state::gb_timer_callback)); + m_maincpu->set_halt_bug(true); MCFG_MACHINE_START_OVERRIDE(gb_state, sgb) MCFG_MACHINE_RESET_OVERRIDE(gb_state, sgb) @@ -662,36 +657,34 @@ MACHINE_CONFIG_START(gb_state::supergb) screen.set_refresh_hz(SGB_FRAMES_PER_SECOND); screen.set_vblank_time(0); screen.set_screen_update("ppu", FUNC(dmg_ppu_device::screen_update)); - screen.set_palette("palette"); + screen.set_palette(m_palette); screen.set_size(32*8, 28*8); screen.set_visarea(0*8, 32*8-1, 0*8, 28*8-1); - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) - MCFG_PALETTE_ADD("palette", 32768) - MCFG_PALETTE_INIT_OWNER(gb_state,sgb) + GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty); + PALETTE(config, m_palette, 32768).set_init(FUNC(gb_state::palette_init_sgb)); - MCFG_DEVICE_ADD("ppu", SGB_PPU, "maincpu") + SGB_PPU(config, m_ppu, m_maincpu); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("apu", DMG_APU, 4295454) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + DMG_APU(config, m_apu, 4295454); + m_apu->add_route(0, "lspeaker", 0.50); + m_apu->add_route(1, "rspeaker", 0.50); /* cartslot */ - MCFG_GB_CARTRIDGE_ADD("gbslot", gb_cart, nullptr) - - MCFG_SOFTWARE_LIST_ADD("cart_list","gameboy") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gbc_list","gbcolor") -MACHINE_CONFIG_END + GB_CART_SLOT(config, m_cartslot, gb_cart, nullptr); + SOFTWARE_LIST(config, "cart_list").set_original("gameboy"); + SOFTWARE_LIST(config, "gbc_list").set_compatible("gbcolor"); +} -MACHINE_CONFIG_START(gb_state::supergb2) +void gb_state::supergb2(machine_config &config) +{ gameboy(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(sgb_map) + m_maincpu->set_addrmap(AS_PROGRAM, &gb_state::sgb_map); MCFG_MACHINE_START_OVERRIDE(gb_state, sgb) MCFG_MACHINE_RESET_OVERRIDE(gb_state, sgb) @@ -702,32 +695,28 @@ MACHINE_CONFIG_START(gb_state::supergb2) screen.set_size(32*8, 28*8); screen.set_visarea(0*8, 32*8-1, 0*8, 28*8-1); - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(32768) - MCFG_PALETTE_INIT_OWNER(gb_state,sgb) - - MCFG_DEVICE_REMOVE("ppu") - MCFG_DEVICE_ADD("ppu", SGB_PPU, "maincpu") -MACHINE_CONFIG_END + m_palette->set_entries(32768); + m_palette->set_init(FUNC(gb_state::palette_init_sgb)); + SGB_PPU(config.replace(), m_ppu, m_maincpu); +} -MACHINE_CONFIG_START(gb_state::gbpocket) +void gb_state::gbpocket(machine_config &config) +{ gameboy(config); /* video hardware */ - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(gb_state,gbp) + m_palette->set_init(FUNC(gb_state::palette_init_gbp)); - MCFG_DEVICE_REMOVE("ppu") - MCFG_DEVICE_ADD("ppu", MGB_PPU, "maincpu") -MACHINE_CONFIG_END - -MACHINE_CONFIG_START(gb_state::gbcolor) + MGB_PPU(config.replace(), m_ppu, m_maincpu); +} +void gb_state::gbcolor(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", LR35902, XTAL(4'194'304)) // todo XTAL(8'388'000) - MCFG_DEVICE_PROGRAM_MAP(gbc_map) - MCFG_LR35902_TIMER_CB( WRITE8(*this, gb_state, gb_timer_callback ) ) + LR35902(config, m_maincpu, XTAL(4'194'304)); // todo XTAL(8'388'000) + m_maincpu->set_addrmap(AS_PROGRAM, &gb_state::gbc_map); + m_maincpu->timer_cb().set(FUNC(gb_state::gb_timer_callback)); MCFG_MACHINE_START_OVERRIDE(gb_state,gbc) MCFG_MACHINE_RESET_OVERRIDE(gb_state,gbc) @@ -737,73 +726,71 @@ MACHINE_CONFIG_START(gb_state::gbcolor) screen.set_refresh_hz(DMG_FRAMES_PER_SECOND); screen.set_vblank_time(0); screen.set_screen_update("ppu", FUNC(dmg_ppu_device::screen_update)); - screen.set_palette("palette"); + screen.set_palette(m_palette); // screen.set_size(20*8, 18*8); screen.set_size(458, 154); screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1); - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) + GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty); - MCFG_PALETTE_ADD("palette", 32768) - MCFG_PALETTE_INIT_OWNER(gb_state,gbc) + PALETTE(config, m_palette, 32768).set_init(FUNC(gb_state::palette_init_gbc)); - MCFG_DEVICE_ADD("ppu", CGB_PPU, "maincpu") + CGB_PPU(config, m_ppu, m_maincpu); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("apu", CGB04_APU, XTAL(4'194'304)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + CGB04_APU(config, m_apu, XTAL(4'194'304)); + m_apu->add_route(0, "lspeaker", 0.50); + m_apu->add_route(1, "rspeaker", 0.50); /* internal ram */ RAM(config, RAM_TAG).set_default_size("48K"); /* 2 pages of 8KB VRAM, 8 pages of 4KB RAM */ /* cartslot */ - MCFG_GB_CARTRIDGE_ADD("gbslot", gb_cart, nullptr) - - MCFG_SOFTWARE_LIST_ADD("cart_list","gbcolor") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gb_list","gameboy") -MACHINE_CONFIG_END + GB_CART_SLOT(config, "gbslot", gb_cart, nullptr); -MACHINE_CONFIG_START(megaduck_state::megaduck) + SOFTWARE_LIST(config, "cart_list").set_original("gbcolor"); + SOFTWARE_LIST(config, "gb_list").set_compatible("gameboy"); +} +void megaduck_state::megaduck(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", LR35902, XTAL(4'194'304)) /* 4.194304 MHz */ - MCFG_DEVICE_PROGRAM_MAP(megaduck_map) - MCFG_LR35902_TIMER_CB( WRITE8(*this, gb_state, gb_timer_callback ) ) - MCFG_LR35902_HALT_BUG + LR35902(config, m_maincpu, XTAL(4'194'304)); /* 4.194304 MHz */ + m_maincpu->set_addrmap(AS_PROGRAM, &megaduck_state::megaduck_map); + m_maincpu->timer_cb().set(FUNC(gb_state::gb_timer_callback)); + m_maincpu->set_halt_bug(true); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); screen.set_refresh_hz(DMG_FRAMES_PER_SECOND); screen.set_vblank_time(0); screen.set_screen_update("ppu", FUNC(dmg_ppu_device::screen_update)); - screen.set_palette("palette"); + screen.set_palette(m_palette); screen.set_size(20*8, 18*8); screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1); MCFG_MACHINE_START_OVERRIDE(megaduck_state, megaduck) MCFG_MACHINE_RESET_OVERRIDE(megaduck_state, megaduck) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) + GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty); - MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(megaduck_state,megaduck) + PALETTE(config, m_palette, 4).set_init(FUNC(megaduck_state::palette_init_megaduck)); - MCFG_DEVICE_ADD("ppu", DMG_PPU, "maincpu") + DMG_PPU(config, m_ppu, m_maincpu); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("apu", DMG_APU, XTAL(4'194'304)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) + DMG_APU(config, m_apu, XTAL(4'194'304)); + m_apu->add_route(0, "lspeaker", 0.50); + m_apu->add_route(1, "rspeaker", 0.50); /* cartslot */ - MCFG_MEGADUCK_CARTRIDGE_ADD("duckslot", megaduck_cart, nullptr) - MCFG_SOFTWARE_LIST_ADD("cart_list", "megaduck") -MACHINE_CONFIG_END + MEGADUCK_CART_SLOT(config, m_cartslot, megaduck_cart, nullptr); + SOFTWARE_LIST(config, "cart_list").set_original("megaduck"); +} /*************************************************************************** diff --git a/src/mame/drivers/jaguar.cpp b/src/mame/drivers/jaguar.cpp index 8fcfb2723fc..d85a7e570f6 100644 --- a/src/mame/drivers/jaguar.cpp +++ b/src/mame/drivers/jaguar.cpp @@ -1838,19 +1838,19 @@ INPUT_PORTS_END * *************************************/ -MACHINE_CONFIG_START(jaguar_state::cojagr3k) - +void jaguar_state::cojagr3k(machine_config &config) +{ /* basic machine hardware */ R3041(config, m_maincpu, R3000_CLOCK).set_endianness(ENDIANNESS_BIG); m_maincpu->set_addrmap(AS_PROGRAM, &jaguar_state::r3000_map); - MCFG_DEVICE_ADD("gpu", JAGUARGPU, COJAG_CLOCK/2) - MCFG_JAGUAR_IRQ_HANDLER(WRITELINE(*this, jaguar_state, gpu_cpu_int)) - MCFG_DEVICE_PROGRAM_MAP(gpu_map) + JAGUARGPU(config, m_gpu, COJAG_CLOCK/2); + m_gpu->irq().set(FUNC(jaguar_state::gpu_cpu_int)); + m_gpu->set_addrmap(AS_PROGRAM, &jaguar_state::gpu_map); - MCFG_DEVICE_ADD("dsp", JAGUARDSP, COJAG_CLOCK/2) - MCFG_JAGUAR_IRQ_HANDLER(WRITELINE(*this, jaguar_state, dsp_cpu_int)) - MCFG_DEVICE_PROGRAM_MAP(dsp_map) + JAGUARDSP(config, m_dsp, COJAG_CLOCK/2); + m_dsp->irq().set(FUNC(jaguar_state::dsp_cpu_int)); + m_dsp->set_addrmap(AS_PROGRAM, &jaguar_state::dsp_map); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); @@ -1860,108 +1860,106 @@ MACHINE_CONFIG_START(jaguar_state::cojagr3k) m_ide->irq_handler().set(FUNC(jaguar_state::external_int)); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(COJAG_PIXEL_CLOCK/2, 456, 42, 402, 262, 17, 257) - MCFG_SCREEN_UPDATE_DRIVER(jaguar_state,screen_update) + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(COJAG_PIXEL_CLOCK/2, 456, 42, 402, 262, 17, 257); + m_screen->set_screen_update(FUNC(jaguar_state::screen_update)); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("ldac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) // unknown DAC - MCFG_DEVICE_ADD("rdac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) // unknown DAC - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE(0, "ldac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "ldac", -1.0, DAC_VREF_NEG_INPUT) - MCFG_SOUND_ROUTE(0, "rdac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "rdac", -1.0, DAC_VREF_NEG_INPUT) -MACHINE_CONFIG_END - -MACHINE_CONFIG_START(jaguar_state::cojagr3k_rom) - cojagr3k(config); - - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(r3000_rom_map) + DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // unknown DAC + DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // unknown DAC + voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0)); + vref.set_output(5.0); + vref.add_route(0, "ldac", 1.0, DAC_VREF_POS_INPUT); + vref.add_route(0, "ldac", -1.0, DAC_VREF_NEG_INPUT); + vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT); + vref.add_route(0, "rdac", -1.0, DAC_VREF_NEG_INPUT); +} - MCFG_DEVICE_MODIFY("gpu") - MCFG_DEVICE_PROGRAM_MAP(gpu_rom_map) +void jaguar_state::cojagr3k_rom(machine_config &config) +{ + cojagr3k(config); - MCFG_DEVICE_MODIFY("dsp") - MCFG_DEVICE_PROGRAM_MAP(dsp_rom_map) + m_maincpu->set_addrmap(AS_PROGRAM, &jaguar_state::r3000_rom_map); + m_gpu->set_addrmap(AS_PROGRAM, &jaguar_state::gpu_rom_map); + m_dsp->set_addrmap(AS_PROGRAM, &jaguar_state::dsp_rom_map); - MCFG_DEVICE_MODIFY("ide:0") - MCFG_SLOT_DEFAULT_OPTION(nullptr) -MACHINE_CONFIG_END + m_ide->slot(0).set_default_option(nullptr); +} -MACHINE_CONFIG_START(jaguar_state::cojag68k) +void jaguar_state::cojag68k(machine_config &config) +{ cojagr3k(config); /* basic machine hardware */ - MCFG_DEVICE_REPLACE("maincpu", M68EC020, M68K_CLOCK/2) - MCFG_DEVICE_PROGRAM_MAP(m68020_map) -MACHINE_CONFIG_END - - -MACHINE_CONFIG_START(jaguar_state::jaguar) + M68EC020(config.replace(), m_maincpu, M68K_CLOCK/2); + m_maincpu->set_addrmap(AS_PROGRAM, &jaguar_state::m68020_map); +} +void jaguar_state::jaguar(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, JAGUAR_CLOCK/2) - MCFG_DEVICE_PROGRAM_MAP(jaguar_map) - MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER(jaguar_state,jaguar_irq_callback) + M68000(config, m_maincpu, JAGUAR_CLOCK/2); + m_maincpu->set_addrmap(AS_PROGRAM, &jaguar_state::jaguar_map); + m_maincpu->set_irq_acknowledge_callback(FUNC(jaguar_state::jaguar_irq_callback)); - MCFG_DEVICE_ADD("gpu", JAGUARGPU, JAGUAR_CLOCK) - MCFG_JAGUAR_IRQ_HANDLER(WRITELINE(*this, jaguar_state, gpu_cpu_int)) - MCFG_DEVICE_PROGRAM_MAP(jag_gpu_map) + JAGUARGPU(config, m_gpu, JAGUAR_CLOCK); + m_gpu->irq().set(FUNC(jaguar_state::gpu_cpu_int)); + m_gpu->set_addrmap(AS_PROGRAM, &jaguar_state::jag_gpu_map); - MCFG_DEVICE_ADD("dsp", JAGUARDSP, JAGUAR_CLOCK) - MCFG_JAGUAR_IRQ_HANDLER(WRITELINE(*this, jaguar_state, dsp_cpu_int)) - MCFG_DEVICE_PROGRAM_MAP(jag_dsp_map) + JAGUARDSP(config, m_dsp, JAGUAR_CLOCK); + m_dsp->irq().set(FUNC(jaguar_state::dsp_cpu_int)); + m_dsp->set_addrmap(AS_PROGRAM, &jaguar_state::jag_dsp_map); // MCFG_NVRAM_HANDLER(jaguar) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(JAGUAR_CLOCK, 456, 42, 402, 262, 17, 257) - MCFG_SCREEN_UPDATE_DRIVER(jaguar_state,screen_update) + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(JAGUAR_CLOCK, 456, 42, 402, 262, 17, 257); + m_screen->set_screen_update(FUNC(jaguar_state::screen_update)); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("ldac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) // unknown DAC - MCFG_DEVICE_ADD("rdac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) // unknown DAC - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE(0, "ldac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "ldac", -1.0, DAC_VREF_NEG_INPUT) - MCFG_SOUND_ROUTE(0, "rdac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "rdac", -1.0, DAC_VREF_NEG_INPUT) + DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); // unknown DAC + DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); // unknown DAC + voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0)); + vref.set_output(5.0); + vref.add_route(0, "ldac", 1.0, DAC_VREF_POS_INPUT); + vref.add_route(0, "ldac", -1.0, DAC_VREF_NEG_INPUT); + vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT); + vref.add_route(0, "rdac", -1.0, DAC_VREF_NEG_INPUT); /* quickload */ - MCFG_QUICKLOAD_ADD("quickload", jaguar_state, jaguar, "abs,bin,cof,jag,prg", 2) + quickload_image_device &quickload(QUICKLOAD(config, "quickload", 0)); + quickload.set_handler(snapquick_load_delegate(&QUICKLOAD_LOAD_NAME(jaguar_state, jaguar), this), "abs,bin,cof,jag,prg", 0); /* cartridge */ - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "jaguar_cart") - MCFG_GENERIC_EXTENSIONS("j64,rom,bin") - MCFG_GENERIC_LOAD(jaguar_state, jaguar_cart) + generic_cartslot_device &cartslot(GENERIC_CARTSLOT(config, "cartslot", generic_plain_slot, "jaguar_cart", "j64,rom,bin")); + cartslot.set_device_load(device_image_load_delegate(&jaguar_state::device_image_load_jaguar_cart, this)); /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list","jaguar") + SOFTWARE_LIST(config, "cart_list").set_original("jaguar"); - EEPROM_93C46_16BIT(config, "eeprom"); -MACHINE_CONFIG_END + EEPROM_93C46_16BIT(config, m_eeprom); +} -MACHINE_CONFIG_START(jaguar_state::jaguarcd) +void jaguar_state::jaguarcd(machine_config &config) +{ jaguar(config); - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(jaguarcd_map) + m_maincpu->set_addrmap(AS_PROGRAM, &jaguar_state::jaguarcd_map); - MCFG_DEVICE_MODIFY("gpu") - MCFG_JAGUAR_IRQ_HANDLER(WRITELINE(*this, jaguar_state, gpu_cpu_int)) - MCFG_DEVICE_PROGRAM_MAP(jagcd_gpu_map) + m_gpu->irq().set(FUNC(jaguar_state::gpu_cpu_int)); + m_gpu->set_addrmap(AS_PROGRAM, &jaguar_state::jagcd_gpu_map); - MCFG_DEVICE_MODIFY("dsp") - MCFG_JAGUAR_IRQ_HANDLER(WRITELINE(*this, jaguar_state, dsp_cpu_int)) - MCFG_DEVICE_PROGRAM_MAP(jagcd_dsp_map) + m_dsp->irq().set(FUNC(jaguar_state::dsp_cpu_int)); + m_dsp->set_addrmap(AS_PROGRAM, &jaguar_state::jagcd_dsp_map); - MCFG_CDROM_ADD("cdrom") - MCFG_CDROM_INTERFACE("jag_cdrom") -MACHINE_CONFIG_END + CDROM(config, "cdrom").set_interface("jag_cdrom"); +} /************************************* * diff --git a/src/mame/drivers/monty.cpp b/src/mame/drivers/monty.cpp index aa9555b0fda..a9a6f567dac 100644 --- a/src/mame/drivers/monty.cpp +++ b/src/mame/drivers/monty.cpp @@ -69,7 +69,7 @@ private: void monty_io(address_map &map); void monty_mem(address_map &map); - required_device m_maincpu; + required_device m_maincpu; required_device m_speaker; required_device m_sed0; // TODO: This isn't actually a SED1520, it's a SED1503F //required_device m_sed1; // TODO: Also, there are 2 SED1503Fs on the board - one is flipped upside down @@ -264,35 +264,35 @@ SED1520_UPDATE_CB(monty_state::screen_update) // TODO: Additional machine definition - Master Monty has a different memory layout -MACHINE_CONFIG_START(monty_state::monty) +void monty_state::monty(machine_config &config) +{ // Basic machine hardware - MCFG_DEVICE_ADD("maincpu", Z80, 3580000) // Ceramic resonator labeled 3.58MT - MCFG_DEVICE_PROGRAM_MAP(monty_mem) - MCFG_DEVICE_IO_MAP(monty_io) - MCFG_Z80_SET_HALT_CALLBACK(WRITELINE(*this, monty_state, halt_changed)) + Z80(config, m_maincpu, 3580000); // Ceramic resonator labeled 3.58MT + m_maincpu->set_addrmap(AS_PROGRAM, &monty_state::monty_mem); + m_maincpu->set_addrmap(AS_IO, &monty_state::monty_io); + m_maincpu->halt_cb().set(FUNC(monty_state::halt_changed)); // Video hardware - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // Not accurate - MCFG_SCREEN_SIZE(50, 32) // Two SED1503s (42x16 pixels) control the top and bottom halves - MCFG_SCREEN_VISIBLE_AREA(0, 50-1, 0, 32-1) - MCFG_SCREEN_UPDATE_DRIVER(monty_state, lcd_update) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_refresh_hz(50); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // Not accurate + screen.set_size(50, 32); // Two SED1503s (42x16 pixels) control the top and bottom halves + screen.set_visarea(0, 50-1, 0, 32-1); + screen.set_screen_update(FUNC(monty_state::lcd_update)); /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50); // LCD controller interfaces - MCFG_SED1520_ADD("sed1520_0", UPDATE(monty_state, screen_update)) -MACHINE_CONFIG_END + SED1520(config, m_sed0).set_screen_update_cb(FUNC(monty_state::screen_update)); +} -MACHINE_CONFIG_START(monty_state::mmonty) +void monty_state::mmonty(machine_config &config) +{ monty(config); - MCFG_DEVICE_MODIFY( "maincpu" ) - MCFG_DEVICE_PROGRAM_MAP(mmonty_mem) -MACHINE_CONFIG_END + m_maincpu->set_addrmap(AS_PROGRAM, &monty_state::mmonty_mem); +} // ROM definitions diff --git a/src/mame/drivers/n64.cpp b/src/mame/drivers/n64.cpp index a7e8b51103e..b43391bf9c9 100644 --- a/src/mame/drivers/n64.cpp +++ b/src/mame/drivers/n64.cpp @@ -467,8 +467,7 @@ void n64_mess_state::n64(machine_config &config) N64PERIPH(config, m_rcp_periphs, 0); /* cartridge */ - generic_cartslot_device &cartslot(GENERIC_CARTSLOT(config, "cartslot", generic_plain_slot, "n64_cart")); - cartslot.set_extensions("v64,z64,rom,n64,bin"); + generic_cartslot_device &cartslot(GENERIC_CARTSLOT(config, "cartslot", generic_plain_slot, "n64_cart", "v64,z64,rom,n64,bin")); cartslot.set_must_be_loaded(true); cartslot.set_device_load(device_image_load_delegate(&n64_mess_state::device_image_load_n64_cart, this)); diff --git a/src/mame/drivers/osborne1.cpp b/src/mame/drivers/osborne1.cpp index a16de6ec54f..15653f27b1b 100644 --- a/src/mame/drivers/osborne1.cpp +++ b/src/mame/drivers/osborne1.cpp @@ -283,19 +283,22 @@ static GFXDECODE_START( gfx_osborne1 ) GFXDECODE_END -MACHINE_CONFIG_START(osborne1_state::osborne1) - MCFG_DEVICE_ADD(m_maincpu, Z80, MAIN_CLOCK/4) - MCFG_DEVICE_PROGRAM_MAP(osborne1_mem) - MCFG_DEVICE_OPCODES_MAP(osborne1_op) - MCFG_DEVICE_IO_MAP(osborne1_io) - MCFG_Z80_SET_IRQACK_CALLBACK(WRITELINE(*this, osborne1_state, irqack_w)) - - MCFG_SCREEN_ADD_MONOCHROME(m_screen, RASTER, rgb_t::green()) - MCFG_SCREEN_UPDATE_DRIVER(osborne1_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, 1024, 0, 104*8, 260, 0, 24*10) - MCFG_SCREEN_PALETTE("palette") - MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_osborne1) - MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette") +void osborne1_state::osborne1(machine_config &config) +{ + Z80(config, m_maincpu, MAIN_CLOCK/4); + m_maincpu->set_addrmap(AS_PROGRAM, &osborne1_state::osborne1_mem); + m_maincpu->set_addrmap(AS_OPCODES, &osborne1_state::osborne1_op); + m_maincpu->set_addrmap(AS_IO, &osborne1_state::osborne1_io); + m_maincpu->irqack_cb().set(FUNC(osborne1_state::irqack_w)); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_color(rgb_t::green()); + m_screen->set_screen_update(FUNC(osborne1_state::screen_update)); + m_screen->set_raw(MAIN_CLOCK, 1024, 0, 104*8, 260, 0, 24*10); + m_screen->set_palette("palette"); + + GFXDECODE(config, m_gfxdecode, "palette", gfx_osborne1); + PALETTE(config, "palette", 3).set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight)); SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); @@ -310,8 +313,8 @@ MACHINE_CONFIG_START(osborne1_state::osborne1) m_pia0->cb2_handler().set(m_ieee, FUNC(ieee488_device::host_ren_w)); m_pia0->irqa_handler().set(FUNC(osborne1_state::ieee_pia_irq_a_func)); - MCFG_IEEE488_BUS_ADD() - MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_pia0, pia6821_device, ca2_w)) + IEEE488(config, m_ieee, 0); + m_ieee->srq_callback().set(m_pia0, FUNC(pia6821_device::ca2_w)); PIA6821(config, m_pia1); m_pia1->writepa_handler().set(FUNC(osborne1_state::video_pia_port_a_w)); @@ -332,23 +335,22 @@ MACHINE_CONFIG_START(osborne1_state::osborne1) MB8877(config, m_fdc, MAIN_CLOCK/16); m_fdc->set_force_ready(true); - MCFG_FLOPPY_DRIVE_ADD(m_floppy0, osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(m_floppy1, osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + FLOPPY_CONNECTOR(config, m_floppy0, osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats); + FLOPPY_CONNECTOR(config, m_floppy1, osborne1_floppies, "525ssdd", floppy_image_device::default_floppy_formats); // internal ram RAM(config, RAM_TAG).set_default_size("68K"); // 64kB main RAM and 4kbit video attribute RAM - MCFG_SOFTWARE_LIST_ADD("flop_list","osborne1") -MACHINE_CONFIG_END + SOFTWARE_LIST(config, "flop_list").set_original("osborne1"); +} -MACHINE_CONFIG_START(osborne1nv_state::osborne1nv) +void osborne1nv_state::osborne1nv(machine_config &config) +{ osborne1(config); - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_IO_MAP(osborne1nv_io) + m_maincpu->set_addrmap(AS_IO, &osborne1nv_state::osborne1nv_io); - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_NO_PALETTE - MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + m_screen->set_palette(finder_base::DUMMY_TAG); + m_screen->set_screen_update("crtc", FUNC(mc6845_device::screen_update)); sy6545_1_device &crtc(SY6545_1(config, "crtc", XTAL(12'288'000)/8)); crtc.set_screen(m_screen); @@ -356,7 +358,7 @@ MACHINE_CONFIG_START(osborne1nv_state::osborne1nv) crtc.set_char_width(8); crtc.set_update_row_callback(FUNC(osborne1nv_state::crtc_update_row), this); crtc.set_on_update_addr_change_callback(FUNC(osborne1nv_state::crtc_update_addr_changed), this); -MACHINE_CONFIG_END +} ROM_START( osborne1 ) diff --git a/src/mame/drivers/pc1500.cpp b/src/mame/drivers/pc1500.cpp index cd00ea495f4..4a19eb5fd1b 100644 --- a/src/mame/drivers/pc1500.cpp +++ b/src/mame/drivers/pc1500.cpp @@ -38,7 +38,7 @@ public: void pc1500(machine_config &config); private: - required_device m_maincpu; + required_device m_maincpu; required_device m_rtc; required_shared_ptr m_lcd_data; @@ -270,23 +270,23 @@ PALETTE_INIT_MEMBER(pc1500_state, pc1500) palette.set_pen_color(1, rgb_t(92, 83, 88)); } -MACHINE_CONFIG_START(pc1500_state::pc1500) - MCFG_DEVICE_ADD("maincpu", LH5801, 1300000) //1.3 MHz - MCFG_DEVICE_PROGRAM_MAP( pc1500_mem ) - MCFG_DEVICE_IO_MAP( pc1500_mem_io ) - MCFG_LH5801_IN(READ8(*this, pc1500_state,pc1500_kb_r)) - - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate - MCFG_SCREEN_UPDATE_DRIVER(pc1500_state, screen_update) - MCFG_SCREEN_SIZE(156, 8) - MCFG_SCREEN_VISIBLE_AREA(0, 156-1, 0, 7-1) - MCFG_SCREEN_PALETTE("palette") +void pc1500_state::pc1500(machine_config &config) +{ + LH5801(config, m_maincpu, 1300000); // 1.3 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &pc1500_state::pc1500_mem); + m_maincpu->set_addrmap(AS_IO, &pc1500_state::pc1500_mem_io); + m_maincpu->in_func().set(FUNC(pc1500_state::pc1500_kb_r)); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_refresh_hz(50); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate + screen.set_screen_update(FUNC(pc1500_state::screen_update)); + screen.set_size(156, 8); + screen.set_visarea(0, 156-1, 0, 7-1); + screen.set_palette("palette"); config.set_default_layout(layout_pc1500); - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pc1500_state, pc1500) + PALETTE(config, "palette", 2).set_init(FUNC(pc1500_state::palette_init_pc1500)); lh5810_device &ioports(LH5810(config, "lh5810")); ioports.porta_r().set(FUNC(pc1500_state::port_a_r)); @@ -296,7 +296,7 @@ MACHINE_CONFIG_START(pc1500_state::pc1500) ioports.out_int().set_inputline("maincpu", LH5801_LINE_MI); UPD1990A(config, m_rtc); -MACHINE_CONFIG_END +} ROM_START( pc1500 ) diff --git a/src/mame/drivers/pc2000.cpp b/src/mame/drivers/pc2000.cpp index d93948e7fb8..1d690b99170 100644 --- a/src/mame/drivers/pc2000.cpp +++ b/src/mame/drivers/pc2000.cpp @@ -39,6 +39,7 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_lcdc(*this, "hd44780") + , m_screen(*this, "screen") , m_beep(*this, "beeper") , m_cart(*this, "cartslot") , m_bank0(*this, "bank0") @@ -69,6 +70,7 @@ protected: required_device m_maincpu; optional_device m_lcdc; + required_device m_screen; required_device m_beep; required_device m_cart; optional_memory_bank m_bank0; @@ -878,45 +880,45 @@ DEVICE_IMAGE_LOAD_MEMBER( pc2000_state, pc2000_cart ) return image_init_result::PASS; } -MACHINE_CONFIG_START(pc2000_state::pc2000) +void pc2000_state::pc2000(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",Z80, XTAL(4'000'000)) /* probably not accurate */ - MCFG_DEVICE_PROGRAM_MAP(pc2000_mem) - MCFG_DEVICE_IO_MAP(pc2000_io) - MCFG_DEVICE_PERIODIC_INT_DRIVER(pc2000_state, irq0_line_hold, 50) + Z80(config, m_maincpu, XTAL(4'000'000)); /* probably not accurate */ + m_maincpu->set_addrmap(AS_PROGRAM, &pc2000_state::pc2000_mem); + m_maincpu->set_addrmap(AS_IO, &pc2000_state::pc2000_io); + m_maincpu->set_periodic_int(FUNC(pc2000_state::irq0_line_hold), attotime::from_hz(50)); /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) - MCFG_SCREEN_SIZE(120, 18) //2x20 chars - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18-1) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_LCD); + m_screen->set_refresh_hz(50); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ + m_screen->set_screen_update("hd44780", FUNC(hd44780_device::screen_update)); + m_screen->set_size(120, 18); //2x20 chars + m_screen->set_visarea(0, 120-1, 0, 18-1); + m_screen->set_palette("palette"); - MCFG_PALETTE_ADD("palette", 2) - MCFG_PALETTE_INIT_OWNER(pc2000_state, pc2000) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pc2000) + PALETTE(config, "palette", 2).set_init(FUNC(pc2000_state::palette_init_pc2000)); + GFXDECODE(config, "gfxdecode", "palette", gfx_pc2000); - MCFG_HD44780_ADD("hd44780") - MCFG_HD44780_LCD_SIZE(2, 20) + HD44780(config, m_lcdc, 0); + m_lcdc->set_lcd_size(2, 20); /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD( "beeper", BEEP, 3250 ) - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + BEEP(config, m_beep, 3250).add_route(ALL_OUTPUTS, "mono", 1.00); - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "genius_cart") - MCFG_GENERIC_LOAD(pc2000_state, pc2000_cart) + generic_cartslot_device &cartslot(GENERIC_CARTSLOT(config, "cartslot", generic_plain_slot, "genius_cart")); + cartslot.set_device_load(device_image_load_delegate(&pc2000_state::device_image_load_pc2000_cart, this)); - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("pc1000_cart", "pc1000") -MACHINE_CONFIG_END + SOFTWARE_LIST(config, "pc1000_cart").set_compatible("pc1000"); +} -MACHINE_CONFIG_START(pc2000_state::gl2000) +void pc2000_state::gl2000(machine_config &config) +{ pc2000(config); - MCFG_SOFTWARE_LIST_ADD("cart_list", "gl2000") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") -MACHINE_CONFIG_END + SOFTWARE_LIST(config, "cart_list").set_original("gl2000"); + SOFTWARE_LIST(config, "misterx_cart").set_compatible("misterx"); +} HD44780_PIXEL_UPDATE(gl4004_state::gl4000_pixel_update) { @@ -935,70 +937,66 @@ HD44780_PIXEL_UPDATE(gl4004_state::gl4000_pixel_update) } } -MACHINE_CONFIG_START(gl3000s_state::gl3000s) +void gl3000s_state::gl3000s(machine_config &config) +{ pc2000(config); - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_IO_MAP(gl3000s_io) + m_maincpu->set_addrmap(AS_IO, &gl3000s_state::gl3000s_io); - MCFG_DEVICE_REMOVE("hd44780") - MCFG_SED1520_ADD("sed1520_l", UPDATE(gl3000s_state, screen_update_left)) // left panel is 59 pixels (0-58) - MCFG_SED1520_ADD("sed1520_r", UPDATE(gl3000s_state, screen_update_right)) // right panel is 61 pixels (59-119) + config.device_remove("hd44780"); + SED1520(config, "sed1520_l").set_screen_update_cb(FUNC(gl3000s_state::screen_update_left)); // left panel is 59 pixels (0-58) + SED1520(config, "sed1520_r").set_screen_update_cb(FUNC(gl3000s_state::screen_update_right)); // right panel is 61 pixels (59-119) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(120, 24) - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 24-1) - MCFG_SCREEN_UPDATE_DRIVER( gl3000s_state, screen_update ) + m_screen->set_size(120, 24); + m_screen->set_visarea(0, 120-1, 0, 24-1); + m_screen->set_screen_update(FUNC(gl3000s_state::screen_update)); config.set_default_layout(layout_gl3000s); + config.device_remove("gfxdecode"); - MCFG_DEVICE_REMOVE("gfxdecode") - - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") + SOFTWARE_LIST(config, "gl2000_cart").set_compatible("gl2000"); + SOFTWARE_LIST(config, "misterx_cart").set_compatible("misterx"); MACHINE_CONFIG_END -MACHINE_CONFIG_START(gl4004_state::gl4000) +void gl4004_state::gl4000(machine_config &config) +{ pc2000(config); - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(120, 36) // 4x20 chars - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 36-1) + m_screen->set_size(120, 36); // 4x20 chars + m_screen->set_visarea(0, 120-1, 0, 36-1); - MCFG_DEVICE_MODIFY("hd44780") - MCFG_HD44780_LCD_SIZE(4, 20) - MCFG_HD44780_PIXEL_UPDATE_CB(gl4004_state,gl4000_pixel_update) + m_lcdc->set_lcd_size(4, 20); + m_lcdc->set_pixel_update_cb(FUNC(gl4004_state::gl4000_pixel_update)); - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") -MACHINE_CONFIG_END + SOFTWARE_LIST(config, "gl2000_cart").set_compatible("gl2000"); + SOFTWARE_LIST(config, "misterx_cart").set_compatible("misterx"); +} -MACHINE_CONFIG_START(pc1000_state::misterx) +void pc1000_state::misterx(machine_config &config) +{ pc2000(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(pc1000_mem) - MCFG_DEVICE_IO_MAP(pc1000_io) - MCFG_DEVICE_PERIODIC_INT_DRIVER(pc1000_state, irq0_line_hold, 10) + m_maincpu->set_addrmap(AS_PROGRAM, &pc1000_state::pc1000_mem); + m_maincpu->set_addrmap(AS_IO, &pc1000_state::pc1000_io); + m_maincpu->set_periodic_int(FUNC(pc1000_state::irq0_line_hold), attotime::from_hz(10)); /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(120, 9) //1x20 chars - MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 9-1) + m_screen->set_size(120, 9); //1x20 chars + m_screen->set_visarea(0, 120-1, 0, 9-1); - MCFG_DEVICE_MODIFY("hd44780") - MCFG_HD44780_LCD_SIZE(1, 20) - MCFG_HD44780_PIXEL_UPDATE_CB(pc1000_state,pc1000_pixel_update) + m_lcdc->set_lcd_size(1, 20); + m_lcdc->set_pixel_update_cb(FUNC(pc1000_state::pc1000_pixel_update)); /* Software lists */ - MCFG_SOFTWARE_LIST_ADD("cart_list", "misterx") -MACHINE_CONFIG_END + SOFTWARE_LIST(config, "cart_list").set_original("misterx"); +} -MACHINE_CONFIG_START(pc1000_state::pc1000) +void pc1000_state::pc1000(machine_config &config) +{ misterx(config); - MCFG_SOFTWARE_LIST_REMOVE("cart_list") - MCFG_SOFTWARE_LIST_REMOVE("pc1000_cart") - MCFG_SOFTWARE_LIST_ADD("cart_list", "pc1000") - MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") -MACHINE_CONFIG_END + config.device_remove("cart_list"); + config.device_remove("pc1000_cart"); + SOFTWARE_LIST(config, "cart_list").set_original("pc1000"); + SOFTWARE_LIST(config, "misterx_cart").set_compatible("misterx"); +} /* ROM definition */ ROM_START( pc2000 ) diff --git a/src/mame/drivers/popeye.cpp b/src/mame/drivers/popeye.cpp index 1a98cdafd96..89087ba1c05 100644 --- a/src/mame/drivers/popeye.cpp +++ b/src/mame/drivers/popeye.cpp @@ -17,7 +17,6 @@ Notes: #include "emu.h" #include "includes/popeye.h" -#include "cpu/z80/z80.h" #include "machine/eepromser.h" #include "machine/netlist.h" #include "netlist/devices/net_lib.h" @@ -586,67 +585,66 @@ WRITE8_MEMBER(tnx1_state::popeye_portB_w) m_dswbit = (data & 0x0e) >> 1; } -MACHINE_CONFIG_START(tnx1_state::config) +void tnx1_state::config(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, XTAL(8'000'000)/2) /* 4 MHz */ - MCFG_DEVICE_PROGRAM_MAP(maincpu_program_map) - MCFG_DEVICE_IO_MAP(maincpu_io_map) - MCFG_Z80_SET_REFRESH_CALLBACK(WRITE8(*this, tnx1_state, refresh_w)) + Z80(config, m_maincpu, XTAL(8'000'000)/2); /* 4 MHz */ + m_maincpu->set_addrmap(AS_PROGRAM, &tnx1_state::maincpu_program_map); + m_maincpu->set_addrmap(AS_IO, &tnx1_state::maincpu_io_map); + m_maincpu->refresh_cb().set(FUNC(tnx1_state::refresh_w)); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*16, 32*16) - MCFG_SCREEN_VISIBLE_AREA(0*16, 32*16-1, 2*16, 30*16-1) - MCFG_SCREEN_UPDATE_DRIVER(tnx1_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tnx1_state, screen_vblank)) - - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_popeye) - MCFG_PALETTE_ADD("palette", 16+16*2+8*4) - MCFG_PALETTE_INIT_OWNER(tnx1_state, palette_init) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(32*16, 32*16); + screen.set_visarea(0*16, 32*16-1, 2*16, 30*16-1); + screen.set_screen_update(FUNC(tnx1_state::screen_update)); + screen.set_palette(m_palette); + screen.screen_vblank().set(FUNC(tnx1_state::screen_vblank)); + + GFXDECODE(config, m_gfxdecode, m_palette, gfx_popeye); + PALETTE(config, m_palette, 16+16*2+8*4).set_init(FUNC(tnx1_state::palette_init_tnx1)); /* sound hardware */ SPEAKER(config, "mono").front_center(); - ay8910_device &aysnd(AY8910(config, "aysnd", XTAL(8'000'000)/4)); - aysnd.port_a_read_callback().set_ioport("DSW0"); - aysnd.port_b_write_callback().set(FUNC(tnx1_state::popeye_portB_w)); - aysnd.add_route(ALL_OUTPUTS, "mono", 0.40); - -MACHINE_CONFIG_END + AY8910(config, m_aysnd, XTAL(8'000'000)/4); + m_aysnd->port_a_read_callback().set_ioport("DSW0"); + m_aysnd->port_b_write_callback().set(FUNC(tnx1_state::popeye_portB_w)); + m_aysnd->add_route(ALL_OUTPUTS, "mono", 0.40); +} -MACHINE_CONFIG_START(tpp2_state::config) +void tpp2_state::config(machine_config &config) +{ tpp1_state::config(config); - auto &aysnd(*subdevice("aysnd")); - aysnd.reset_routes(); - aysnd.set_flags(AY8910_RESISTOR_OUTPUT); /* Does tnx1, tpp1 & popeyebl have the same filtering? */ - aysnd.set_resistors_load(2000.0, 2000.0, 2000.0); - aysnd.add_route(0, "snd_nl", 1.0, 0); - aysnd.add_route(1, "snd_nl", 1.0, 1); - aysnd.add_route(2, "snd_nl", 1.0, 2); + m_aysnd->reset_routes(); + m_aysnd->set_flags(AY8910_RESISTOR_OUTPUT); /* Does tnx1, tpp1 & popeyebl have the same filtering? */ + m_aysnd->set_resistors_load(2000.0, 2000.0, 2000.0); + m_aysnd->add_route(0, "snd_nl", 1.0, 0); + m_aysnd->add_route(1, "snd_nl", 1.0, 1); + m_aysnd->add_route(2, "snd_nl", 1.0, 2); /* NETLIST configuration using internal AY8910 resistor values */ - MCFG_DEVICE_ADD("snd_nl", NETLIST_SOUND, 48000) - MCFG_NETLIST_SETUP(nl_popeye) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + netlist_mame_sound_device &snd_nl(NETLIST_SOUND(config, "snd_nl", 48000)); + snd_nl.set_constructor(netlist_nl_popeye); + snd_nl.add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_NETLIST_STREAM_INPUT("snd_nl", 0, "R_AY1_1.R") - MCFG_NETLIST_STREAM_INPUT("snd_nl", 1, "R_AY1_2.R") - MCFG_NETLIST_STREAM_INPUT("snd_nl", 2, "R_AY1_3.R") + NETLIST_STREAM_INPUT(config, "snd_nl:cin0", 0, "R_AY1_1.R"); + NETLIST_STREAM_INPUT(config, "snd_nl:cin1", 1, "R_AY1_2.R"); + NETLIST_STREAM_INPUT(config, "snd_nl:cin2", 2, "R_AY1_3.R"); - MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "ROUT.1") - MCFG_NETLIST_ANALOG_MULT_OFFSET(30000.0, -65000.0) -MACHINE_CONFIG_END + netlist_mame_stream_output_device &nl_out(NETLIST_STREAM_OUTPUT(config, "snd_nl:cout0", 0, "ROUT.1")); + nl_out.set_mult_offset(30000.0, -65000.0); +} /*************************************************************************** - Game driver(s) + Game ROMset(s) ***************************************************************************/ diff --git a/src/mame/includes/gb.h b/src/mame/includes/gb.h index 09a585e9aff..f2d9828ec0f 100644 --- a/src/mame/includes/gb.h +++ b/src/mame/includes/gb.h @@ -32,7 +32,8 @@ public: m_inputs(*this, "INPUTS"), m_bios_hack(*this, "SKIP_CHECK"), m_ram(*this, RAM_TAG), - m_ppu(*this, "ppu") + m_ppu(*this, "ppu"), + m_palette(*this, "palette") { } uint8_t m_gb_io[0x10]; @@ -116,6 +117,7 @@ protected: required_ioport m_bios_hack; optional_device m_ram; required_device m_ppu; + required_device m_palette; void gb_timer_increment(); void gb_timer_check_irq(); diff --git a/src/mame/includes/osborne1.h b/src/mame/includes/osborne1.h index d38f1ae8fd7..5bcfbbceef7 100644 --- a/src/mame/includes/osborne1.h +++ b/src/mame/includes/osborne1.h @@ -75,6 +75,7 @@ protected: required_device m_ram; required_device m_screen; + required_device m_maincpu; private: DECLARE_WRITE8_MEMBER(bank_0xxx_w); @@ -99,7 +100,6 @@ private: u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; required_device m_gfxdecode; required_device m_speaker; required_device m_pia0; diff --git a/src/mame/includes/popeye.h b/src/mame/includes/popeye.h index 28f47e396ad..61d69021234 100644 --- a/src/mame/includes/popeye.h +++ b/src/mame/includes/popeye.h @@ -2,6 +2,7 @@ // copyright-holders:smf, Nicola Salmoria, Couriersud // thanks-to: Marc Lafontaine +#include "cpu/z80/z80.h" #include "sound/ay8910.h" #include "video/resnet.h" #include "emupal.h" @@ -26,7 +27,7 @@ public: virtual void config(machine_config &config); protected: - required_device m_maincpu; + required_device m_maincpu; required_device m_aysnd; required_device m_gfxdecode; required_device m_palette; @@ -67,7 +68,7 @@ protected: TILE_GET_INFO_MEMBER(get_fg_tile_info); virtual void driver_start() override; virtual void video_start() override; - virtual DECLARE_PALETTE_INIT(palette_init); + virtual DECLARE_PALETTE_INIT(tnx1); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); virtual DECLARE_WRITE_LINE_MEMBER(screen_vblank); void update_palette(); @@ -86,7 +87,7 @@ class tpp1_state : public tnx1_state { using tnx1_state::tnx1_state; protected: - virtual DECLARE_PALETTE_INIT(palette_init) override; + virtual DECLARE_PALETTE_INIT(tnx1) override; virtual void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) override; static const res_net_info tpp1_bak_mb7051_net_info; diff --git a/src/mame/video/popeye.cpp b/src/mame/video/popeye.cpp index 31078090302..7e7c99ec69d 100644 --- a/src/mame/video/popeye.cpp +++ b/src/mame/video/popeye.cpp @@ -121,7 +121,7 @@ const res_net_info tnx1_state::obj_mb7052_net_info = }; -PALETTE_INIT_MEMBER(tpp1_state, palette_init) +PALETTE_INIT_MEMBER(tpp1_state, tnx1) { /* Two of the PROM address pins are tied together */ for (int i = 0; i < 0x20; i++) @@ -135,7 +135,7 @@ PALETTE_INIT_MEMBER(tpp1_state, palette_init) update_palette(); } -PALETTE_INIT_MEMBER(tnx1_state, palette_init) +PALETTE_INIT_MEMBER(tnx1_state, tnx1) { /* Two of the PROM address pins are tied together and one is not connected... */ for (int i = 0;i < 0x100;i++) -- cgit v1.2.3