summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/sms.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/sms.cpp')
-rw-r--r--src/mame/drivers/sms.cpp399
1 files changed, 181 insertions, 218 deletions
diff --git a/src/mame/drivers/sms.cpp b/src/mame/drivers/sms.cpp
index df706904160..9b9852492c3 100644
--- a/src/mame/drivers/sms.cpp
+++ b/src/mame/drivers/sms.cpp
@@ -301,7 +301,7 @@ void sms_state::sg1000m3_io(address_map &map)
{
map.global_mask(0xff);
map.unmap_value_high();
- map(0x40, 0x7f).rw(FUNC(sms_state::sms_count_r), FUNC(sms_state::sms_psg_w));
+ map(0x40, 0x7f).r(FUNC(sms_state::sms_count_r)).w(m_vdp, FUNC(sega315_5124_device::psg_w));
map(0x80, 0x80).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::data_read), FUNC(sega315_5124_device::data_write));
map(0x81, 0x81).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::control_read), FUNC(sega315_5124_device::control_write));
map(0xc0, 0xc7).mirror(0x38).rw(FUNC(sms_state::sg1000m3_peripheral_r), FUNC(sms_state::sg1000m3_peripheral_w));
@@ -313,7 +313,7 @@ void sms_state::sms_io(address_map &map)
map.unmap_value_high();
map(0x00, 0x00).mirror(0x3e).w(FUNC(sms_state::sms_mem_control_w));
map(0x01, 0x01).mirror(0x3e).w(FUNC(sms_state::sms_io_control_w));
- map(0x40, 0x7f).rw(FUNC(sms_state::sms_count_r), FUNC(sms_state::sms_psg_w));
+ map(0x40, 0x7f).r(FUNC(sms_state::sms_count_r)).w(m_vdp, FUNC(sega315_5124_device::psg_w));
map(0x80, 0x80).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::data_read), FUNC(sega315_5124_device::data_write));
map(0x81, 0x81).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::control_read), FUNC(sega315_5124_device::control_write));
map(0xc0, 0xc0).mirror(0x3e).r(FUNC(sms_state::sms_input_port_dc_r));
@@ -331,7 +331,7 @@ void sms_state::smskr_io(address_map &map)
map.unmap_value_high();
map(0x3e, 0x3e).w(FUNC(sms_state::sms_mem_control_w));
map(0x3f, 0x3f).w(FUNC(sms_state::sms_io_control_w));
- map(0x40, 0x7f).rw(FUNC(sms_state::sms_count_r), FUNC(sms_state::sms_psg_w));
+ map(0x40, 0x7f).r(FUNC(sms_state::sms_count_r)).w(m_vdp, FUNC(sega315_5124_device::psg_w));
map(0x80, 0x80).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::data_read), FUNC(sega315_5124_device::data_write));
map(0x81, 0x81).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::control_read), FUNC(sega315_5124_device::control_write));
map(0xc0, 0xc0).mirror(0x3e).r(FUNC(sms_state::sms_input_port_dc_r));
@@ -347,7 +347,7 @@ void sms_state::smsj_io(address_map &map)
map.unmap_value_high();
map(0x3e, 0x3e).w(FUNC(sms_state::sms_mem_control_w));
map(0x3f, 0x3f).w(FUNC(sms_state::sms_io_control_w));
- map(0x40, 0x7f).rw(FUNC(sms_state::sms_count_r), FUNC(sms_state::sms_psg_w));
+ map(0x40, 0x7f).r(FUNC(sms_state::sms_count_r)).w(m_vdp, FUNC(sega315_5124_device::psg_w));
map(0x80, 0x80).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::data_read), FUNC(sega315_5124_device::data_write));
map(0x81, 0x81).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::control_read), FUNC(sega315_5124_device::control_write));
map(0xc0, 0xc0).r(FUNC(sms_state::sms_input_port_dc_r));
@@ -371,7 +371,7 @@ void sms_state::gg_io(address_map &map)
map(0x06, 0x06).w(FUNC(sms_state::gg_psg_stereo_w));
map(0x3e, 0x3e).w(FUNC(sms_state::sms_mem_control_w));
map(0x3f, 0x3f).w(FUNC(sms_state::sms_io_control_w));
- map(0x40, 0x7f).rw(FUNC(sms_state::sms_count_r), FUNC(sms_state::gg_psg_w));
+ map(0x40, 0x7f).r(FUNC(sms_state::sms_count_r)).w(m_vdp, FUNC(sega315_5124_device::psg_w));
map(0x80, 0x80).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::data_read), FUNC(sega315_5124_device::data_write));
map(0x81, 0x81).mirror(0x3e).rw(m_vdp, FUNC(sega315_5124_device::control_read), FUNC(sega315_5124_device::control_write));
map(0xc0, 0xc0).r(FUNC(sms_state::sms_input_port_dc_r));
@@ -493,35 +493,33 @@ static INPUT_PORTS_START( gg )
INPUT_PORTS_END
-MACHINE_CONFIG_START(sms_state::sms_base)
+void sms_state::sms_base(machine_config &config)
+{
/* basic machine hardware */
SPEAKER(config, "mono").front_center();
- MCFG_SMS_CARTRIDGE_ADD("slot", sms_cart, nullptr)
+ SMS_CART_SLOT(config, "slot", sms_cart, nullptr);
- MCFG_SOFTWARE_LIST_ADD("cart_list","sms")
+ SOFTWARE_LIST(config, "cart_list").set_original("sms");
- MCFG_SMS_CONTROL_PORT_ADD(CONTROL1_TAG, sms_control_port_devices, "joypad")
- MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(*this, sms_state, sms_ctrl1_th_input))
- MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_state, sms_pixel_color))
+ SMS_CONTROL_PORT(config, m_port_ctrl1, sms_control_port_devices, "joypad");
+ m_port_ctrl1->th_input_handler().set(FUNC(sms_state::sms_ctrl1_th_input));
+ m_port_ctrl1->pixel_handler().set(FUNC(sms_state::sms_pixel_color));
- MCFG_SMS_CONTROL_PORT_ADD(CONTROL2_TAG, sms_control_port_devices, "joypad")
- MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(*this, sms_state, sms_ctrl2_th_input))
- MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_state, sms_pixel_color))
-MACHINE_CONFIG_END
+ SMS_CONTROL_PORT(config, m_port_ctrl2, sms_control_port_devices, "joypad");
+ m_port_ctrl2->th_input_handler().set(FUNC(sms_state::sms_ctrl2_th_input));
+ m_port_ctrl2->pixel_handler().set(FUNC(sms_state::sms_pixel_color));
+}
-MACHINE_CONFIG_START(sms_state::sms_ntsc_base)
+void sms_state::sms_ntsc_base(machine_config &config)
+{
sms_base(config);
- MCFG_DEVICE_ADD("maincpu", Z80, XTAL(10'738'635)/3)
- MCFG_DEVICE_PROGRAM_MAP(sms_mem)
- MCFG_DEVICE_IO_MAP(sms_io)
-
- MCFG_QUANTUM_TIME(attotime::from_hz(60))
+ Z80(config, m_maincpu, XTAL(10'738'635)/3);
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms_mem);
+ m_maincpu->set_addrmap(AS_IO, &sms_state::sms_io);
- /* actually, PSG is embedded in the VDP chip */
- MCFG_DEVICE_ADD("segapsg", SEGAPSG, XTAL(10'738'635)/3)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
-MACHINE_CONFIG_END
+ config.m_minimum_quantum = attotime::from_hz(60);
+}
/*
For SMS drivers, the ratio between CPU and pixel clocks, set through dividers, is 2/3. The
@@ -578,11 +576,12 @@ MACHINE_CONFIG_START(sms_state::sms2_ntsc)
MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(XTAL(10'738'635)/2)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms)
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0)
- MCFG_SEGA315_5246_SET_SCREEN("screen")
- MCFG_SEGA315_5246_IS_PAL(false)
- MCFG_SEGA315_5246_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
+ SEGA315_5246(config, m_vdp, XTAL(10'738'635));
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(false);
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(ALL_OUTPUTS, "mono", 1.00);
m_has_bios_full = true;
MACHINE_CONFIG_END
@@ -591,8 +590,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(sms_state::sms1_ntsc)
sms_ntsc_base(config);
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms1_mem); // This adds the SegaScope handlers for 3-D glasses
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -614,85 +612,54 @@ MACHINE_CONFIG_START(sms_state::sms1_ntsc)
MCFG_VIDEO_START_OVERRIDE(sms_state,sms1)
MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1)
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0)
- MCFG_SEGA315_5124_SET_SCREEN("screen")
- MCFG_SEGA315_5124_IS_PAL(false)
- MCFG_SEGA315_5124_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
+ SEGA315_5124(config, m_vdp, XTAL(10'738'635));
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(false);
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(ALL_OUTPUTS, "mono", 1.00);
// card and expansion slots, not present in Master System II
- MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
- MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
+ SMS_CARD_SLOT(config, "mycard", sms_cart, nullptr);
+ SMS_EXPANSION_SLOT(config, "smsexp", sms_expansion_devices, nullptr);
m_has_bios_full = true;
m_has_pwr_led = true;
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(smssdisp_state::sms_sdisp)
+void smssdisp_state::sms_sdisp(machine_config &config)
+{
sms1_ntsc(config);
- MCFG_DEVICE_MODIFY("sms_vdp")
- MCFG_SEGA315_5124_INT_CB(WRITELINE(*this, smssdisp_state, sms_store_int_callback))
+ m_vdp->irq().set(FUNC(smssdisp_state::sms_store_int_callback));
- MCFG_DEVICE_ADD("control", Z80, XTAL(10'738'635)/3)
- MCFG_DEVICE_PROGRAM_MAP(sms_store_mem)
+ Z80(config, m_control_cpu, XTAL(10'738'635)/3);
+ m_control_cpu->set_addrmap(AS_PROGRAM, &smssdisp_state::sms_store_mem);
/* Both CPUs seem to communicate with the VDP etc? */
- MCFG_DEVICE_IO_MAP(sms_io)
-
- MCFG_DEVICE_REMOVE("mycard")
- MCFG_DEVICE_REMOVE("smsexp")
-
- MCFG_SMS_CARTRIDGE_ADD("slot2", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot3", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot4", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot5", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot6", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot7", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot8", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot9", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot10", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot11", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot12", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot13", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot14", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot15", sms_cart, nullptr)
- MCFG_SMS_CARTRIDGE_ADD("slot16", sms_cart, nullptr)
-
- MCFG_SMS_CARD_ADD("slot17", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot18", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot19", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot20", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot21", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot22", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot23", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot24", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot25", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot26", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot27", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot28", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot29", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot30", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot31", sms_cart, nullptr)
- MCFG_SMS_CARD_ADD("slot32", sms_cart, nullptr)
+ m_control_cpu->set_addrmap(AS_IO, &smssdisp_state::sms_io);
+
+ config.device_remove("mycard");
+ config.device_remove("smsexp");
+
+ for (int i = 1; i < 16; i++)
+ SMS_CART_SLOT(config, m_slots[i], sms_cart, nullptr);
+ for (int i = 0; i < 16; i++)
+ SMS_CARD_SLOT(config, m_cards[i], sms_cart, nullptr);
m_has_bios_full = false;
- m_is_sdisp = true;
m_has_pwr_led = false;
-MACHINE_CONFIG_END
+}
-MACHINE_CONFIG_START(sms_state::sms_pal_base)
+void sms_state::sms_pal_base(machine_config &config)
+{
sms_base(config);
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", Z80, MASTER_CLOCK_PAL/15)
- MCFG_DEVICE_PROGRAM_MAP(sms_mem)
- MCFG_DEVICE_IO_MAP(sms_io)
-
- MCFG_QUANTUM_TIME(attotime::from_hz(50))
+ Z80(config, m_maincpu, MASTER_CLOCK_PAL/15);
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms_mem);
+ m_maincpu->set_addrmap(AS_IO, &sms_state::sms_io);
- /* actually, PSG is embedded in the VDP chip */
- MCFG_DEVICE_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PAL/15)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
-MACHINE_CONFIG_END
+ config.m_minimum_quantum = attotime::from_hz(50);
+}
MACHINE_CONFIG_START(sms_state::sms2_pal)
sms_pal_base(config);
@@ -702,11 +669,12 @@ MACHINE_CONFIG_START(sms_state::sms2_pal)
MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PAL/10)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms)
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0)
- MCFG_SEGA315_5246_SET_SCREEN("screen")
- MCFG_SEGA315_5246_IS_PAL(true)
- MCFG_SEGA315_5246_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
+ SEGA315_5246(config, m_vdp, MASTER_CLOCK_PAL/5);
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(true);
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(ALL_OUTPUTS, "mono", 1.00);
m_has_bios_full = true;
MACHINE_CONFIG_END
@@ -714,8 +682,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(sms_state::sms1_pal)
sms_pal_base(config);
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms1_mem); // This adds the SegaScope handlers for 3-D glasses
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -737,34 +704,32 @@ MACHINE_CONFIG_START(sms_state::sms1_pal)
MCFG_VIDEO_START_OVERRIDE(sms_state,sms1)
MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1)
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0)
- MCFG_SEGA315_5124_SET_SCREEN("screen")
- MCFG_SEGA315_5124_IS_PAL(true)
- MCFG_SEGA315_5124_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
+ SEGA315_5124(config, m_vdp, MASTER_CLOCK_PAL/5);
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(true);
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(ALL_OUTPUTS, "mono", 1.00);
// card and expansion slots, not present in Master System II
- MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
- MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
+ SMS_CARD_SLOT(config, "mycard", sms_cart, nullptr);
+ SMS_EXPANSION_SLOT(config, "smsexp", sms_expansion_devices, nullptr);
m_has_bios_full = true;
m_has_pwr_led = true;
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(sms_state::sms_paln_base)
+void sms_state::sms_paln_base(machine_config &config)
+{
sms_base(config);
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", Z80, MASTER_CLOCK_PALN/3)
- MCFG_DEVICE_PROGRAM_MAP(sms_mem)
- MCFG_DEVICE_IO_MAP(sms_io)
-
- MCFG_QUANTUM_TIME(attotime::from_hz(50))
+ Z80(config, m_maincpu, MASTER_CLOCK_PALN/3);
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms_mem);
+ m_maincpu->set_addrmap(AS_IO, &sms_state::sms_io);
- /* actually, PSG is embedded in the VDP chip */
- MCFG_DEVICE_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PALN/3)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
-MACHINE_CONFIG_END
+ config.m_minimum_quantum = attotime::from_hz(50);
+}
MACHINE_CONFIG_START(sms_state::sms3_paln)
sms_paln_base(config);
@@ -774,11 +739,12 @@ MACHINE_CONFIG_START(sms_state::sms3_paln)
MCFG_SCREEN_SMS_PAL_RAW_PARAMS(MASTER_CLOCK_PALN/2)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms)
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0)
- MCFG_SEGA315_5246_SET_SCREEN("screen")
- MCFG_SEGA315_5246_IS_PAL(true)
- MCFG_SEGA315_5246_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
+ SEGA315_5246(config, m_vdp, MASTER_CLOCK_PALN);
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(true);
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(ALL_OUTPUTS, "mono", 1.00);
m_has_bios_full = true;
MACHINE_CONFIG_END
@@ -786,8 +752,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(sms_state::sms1_paln)
sms_paln_base(config);
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms1_mem); // This adds the SegaScope handlers for 3-D glasses
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -809,35 +774,33 @@ MACHINE_CONFIG_START(sms_state::sms1_paln)
MCFG_VIDEO_START_OVERRIDE(sms_state,sms1)
MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1)
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0)
- MCFG_SEGA315_5124_SET_SCREEN("screen")
- MCFG_SEGA315_5124_IS_PAL(true)
- MCFG_SEGA315_5124_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
+ SEGA315_5124(config, m_vdp, MASTER_CLOCK_PALN);
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(true);
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(ALL_OUTPUTS, "mono", 1.00);
// card and expansion slots, not present in Tec Toy Master System III
- MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
- MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
+ SMS_CARD_SLOT(config, "mycard", sms_cart, nullptr);
+ SMS_EXPANSION_SLOT(config, "smsexp", sms_expansion_devices, nullptr);
m_has_bios_full = true;
m_has_pwr_led = true;
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(sms_state::sms_br_base)
+void sms_state::sms_br_base(machine_config &config)
+{
sms_base(config);
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", Z80, MASTER_CLOCK_PALM/3)
- MCFG_DEVICE_PROGRAM_MAP(sms_mem)
- MCFG_DEVICE_IO_MAP(sms_io)
+ Z80(config, m_maincpu, MASTER_CLOCK_PALM/3);
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms_mem);
+ m_maincpu->set_addrmap(AS_IO, &sms_state::sms_io);
// PAL-M has near the same frequency of NTSC
- MCFG_QUANTUM_TIME(attotime::from_hz(60))
-
- /* actually, PSG is embedded in the VDP chip */
- MCFG_DEVICE_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PALM/3)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
-MACHINE_CONFIG_END
+ config.m_minimum_quantum = attotime::from_hz(60);
+}
MACHINE_CONFIG_START(sms_state::sms3_br)
sms_br_base(config);
@@ -847,11 +810,12 @@ MACHINE_CONFIG_START(sms_state::sms3_br)
MCFG_SCREEN_SMS_NTSC_RAW_PARAMS(MASTER_CLOCK_PALM/2)
MCFG_SCREEN_UPDATE_DRIVER(sms_state, screen_update_sms)
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5246, 0)
- MCFG_SEGA315_5246_SET_SCREEN("screen")
- MCFG_SEGA315_5246_IS_PAL(false) // PAL-M has same line count of NTSC
- MCFG_SEGA315_5246_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5246_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
+ SEGA315_5246(config, m_vdp, MASTER_CLOCK_PALM);
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(false); // PAL-M has same line count of NTSC
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(ALL_OUTPUTS, "mono", 1.00);
m_has_bios_full = true;
MACHINE_CONFIG_END
@@ -859,8 +823,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(sms_state::sms1_br)
sms_br_base(config);
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_PROGRAM_MAP(sms1_mem) // This adds the SegaScope handlers for 3-D glasses
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms1_mem); // This adds the SegaScope handlers for 3-D glasses
/* video hardware */
// PAL-M height/width parameters are the same of NTSC screens.
@@ -883,106 +846,108 @@ MACHINE_CONFIG_START(sms_state::sms1_br)
MCFG_VIDEO_START_OVERRIDE(sms_state,sms1)
MCFG_VIDEO_RESET_OVERRIDE(sms_state,sms1)
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5124, 0)
- MCFG_SEGA315_5124_SET_SCREEN("screen")
- MCFG_SEGA315_5124_IS_PAL(false) // PAL-M has same line count of NTSC
- MCFG_SEGA315_5124_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5124_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
+ SEGA315_5124(config, m_vdp, MASTER_CLOCK_PALM);
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(false); // PAL-M has same line count of NTSC
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(ALL_OUTPUTS, "mono", 1.00);
// card and expansion slots, not present in Tec Toy Master System III
- MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
- MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
+ SMS_CARD_SLOT(config, "mycard", sms_cart, nullptr);
+ SMS_EXPANSION_SLOT(config, "smsexp", sms_expansion_devices, nullptr);
m_has_bios_full = true;
m_has_pwr_led = true;
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(sms_state::sms2_kr)
+void sms_state::sms2_kr(machine_config &config)
+{
sms2_ntsc(config);
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_IO_MAP(smskr_io)
- MCFG_DEVICE_REMOVE("slot")
- MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr)
- MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000")
+ m_maincpu->set_addrmap(AS_IO, &sms_state::smskr_io);
+
+ config.device_remove("slot");
+ SG1000MK3_CART_SLOT(config, "slot", sg1000mk3_cart, nullptr);
+ SOFTWARE_LIST(config, "cart_list2").set_original("sg1000");
// Despite having a Japanese cartridge slot, this version is detected as Export region.
m_has_jpn_sms_cart_slot = true;
-MACHINE_CONFIG_END
+}
-MACHINE_CONFIG_START(sms_state::sms1_kr)
+void sms_state::sms1_kr(machine_config &config)
+{
sms1_ntsc(config);
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_IO_MAP(smskr_io)
+
+ m_maincpu->set_addrmap(AS_IO, &sms_state::smskr_io);
// need to replace the cartridge slot with the Japanese version, so to
// keep the usual media order, remove and reinsert all of them.
- MCFG_DEVICE_REMOVE("slot")
- MCFG_DEVICE_REMOVE("mycard")
- MCFG_DEVICE_REMOVE("smsexp")
- MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr)
- MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
- MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr)
+ config.device_remove("slot");
+ config.device_remove("mycard");
+ config.device_remove("smsexp");
+ SG1000MK3_CART_SLOT(config, "slot", sg1000mk3_cart, nullptr);
+ SMS_CARD_SLOT(config, "mycard", sms_cart, nullptr);
+ SMS_EXPANSION_SLOT(config, "smsexp", sms_expansion_devices, nullptr);
- MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000")
+ SOFTWARE_LIST(config, "cart_list2").set_original("sg1000");
- MCFG_DEVICE_MODIFY("sms_vdp")
- MCFG_SEGA315_5124_CSYNC_CB(WRITELINE(*this, sms_state, sms_csync_callback))
+ m_vdp->csync().set(FUNC(sms_state::sms_csync_callback));
m_has_bios_full = false;
m_has_bios_2000 = true;
m_ioctrl_region_is_japan = true;
m_has_jpn_sms_cart_slot = true;
-MACHINE_CONFIG_END
+}
-MACHINE_CONFIG_START(sms_state::smsj)
+void sms_state::smsj(machine_config &config)
+{
sms1_kr(config);
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_IO_MAP(smsj_io)
- MCFG_DEVICE_ADD("ym2413", YM2413, XTAL(10'738'635)/3)
+ m_maincpu->set_addrmap(AS_IO, &sms_state::smsj_io);
+
+ YM2413(config, m_ym, XTAL(10'738'635)/3);
// if this output gain is changed, the gain set when unmute the output need
// to be changed too, probably along the gain set for the Mark III FM Unit.
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+ m_ym->add_route(ALL_OUTPUTS, "mono", 1.00);
m_is_smsj = true;
-MACHINE_CONFIG_END
+}
-MACHINE_CONFIG_START(sms_state::sg1000m3)
+void sms_state::sg1000m3(machine_config &config)
+{
sms1_ntsc(config);
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_IO_MAP(sg1000m3_io)
+
+ m_maincpu->set_addrmap(AS_IO, &sms_state::sg1000m3_io);
// Remove and reinsert all media slots, as done with the sms1_kr config,
// and also replace the expansion slot with the SG-1000 version.
- MCFG_DEVICE_REMOVE("slot")
- MCFG_DEVICE_REMOVE("mycard")
- MCFG_DEVICE_REMOVE("smsexp")
- MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr)
- MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr)
- MCFG_SG1000_EXPANSION_ADD("sgexp", sg1000_expansion_devices, nullptr, false)
+ config.device_remove("slot");
+ config.device_remove("mycard");
+ config.device_remove("smsexp");
+ SG1000MK3_CART_SLOT(config, "slot", sg1000mk3_cart, nullptr);
+ SMS_CARD_SLOT(config, "mycard", sms_cart, nullptr);
+ SG1000_EXPANSION_SLOT(config, "sgexp", sg1000_expansion_devices, nullptr, false);
- MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000")
+ SOFTWARE_LIST(config, "cart_list2").set_original("sg1000");
// Mark III does not have TH connected.
- MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL1_TAG)
- MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NOOP)
- MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL2_TAG)
- MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NOOP)
+ m_port_ctrl1->th_input_handler().set_nop();
+ m_port_ctrl2->th_input_handler().set_nop();
m_has_bios_full = false;
m_is_mark_iii = true;
m_has_jpn_sms_cart_slot = true;
-MACHINE_CONFIG_END
+}
MACHINE_CONFIG_START(sms_state::gamegear)
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", Z80, MASTER_CLOCK_GG/9)
- MCFG_DEVICE_PROGRAM_MAP(sms_mem)
- MCFG_DEVICE_IO_MAP(gg_io)
+ Z80(config, m_maincpu, MASTER_CLOCK_GG/9);
+ m_maincpu->set_addrmap(AS_PROGRAM, &sms_state::sms_mem);
+ m_maincpu->set_addrmap(AS_IO, &sms_state::gg_io);
- MCFG_QUANTUM_TIME(attotime::from_hz(60))
+ config.m_minimum_quantum = attotime::from_hz(60);
/* video hardware */
MCFG_SCREEN_ADD("screen", LCD)
@@ -992,41 +957,39 @@ MACHINE_CONFIG_START(sms_state::gamegear)
MCFG_VIDEO_START_OVERRIDE(sms_state,gamegear)
MCFG_VIDEO_RESET_OVERRIDE(sms_state,gamegear)
- /* VDP chip of the Gamegear 2 ASIC version */
- MCFG_DEVICE_ADD("sms_vdp", SEGA315_5377, 0)
- MCFG_SEGA315_5377_SET_SCREEN("screen")
- MCFG_SEGA315_5377_IS_PAL(false)
- MCFG_SEGA315_5377_INT_CB(INPUTLINE("maincpu", 0))
- MCFG_SEGA315_5377_PAUSE_CB(WRITELINE(*this, sms_state, sms_pause_callback))
-
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- /* actually, PSG is embedded in the VDP chip */
- MCFG_DEVICE_ADD("gamegear", GAMEGEAR, MASTER_CLOCK_GG/9)
- MCFG_SOUND_ROUTE(0, "lspeaker", 1.00)
- MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)
+ /* VDP chip of the Gamegear 2 ASIC version */
+ SEGA315_5377(config, m_vdp, MASTER_CLOCK_GG/3);
+ m_vdp->set_screen(m_main_scr);
+ m_vdp->set_is_pal(false);
+ m_vdp->irq().set_inputline(m_maincpu, 0);
+ m_vdp->pause().set(FUNC(sms_state::sms_pause_callback));
+ m_vdp->add_route(0, "lspeaker", 1.00);
+ m_vdp->add_route(1, "rspeaker", 1.00);
/* cartridge */
- MCFG_GG_CARTRIDGE_ADD("slot", gg_cart, nullptr)
+ GAMEGEAR_CART_SLOT(config, "slot", gg_cart, nullptr);
- MCFG_SOFTWARE_LIST_ADD("cart_list", "gamegear")
+ SOFTWARE_LIST(config, "cart_list").set_original("gamegear");
- MCFG_GG_EXT_PORT_ADD("ext", gg_ext_port_devices, nullptr)
- MCFG_GG_EXT_PORT_TH_INPUT_HANDLER(WRITELINE(*this, sms_state, gg_ext_th_input))
+ GG_EXT_PORT(config, m_port_gg_ext, gg_ext_port_devices, nullptr);
+ m_port_gg_ext->th_input_handler().set(FUNC(sms_state::gg_ext_th_input));
// only for GG-TV mod (may be simulated with a driver modified with SMS screen settings)
- //MCFG_GG_EXT_PORT_PIXEL_HANDLER(READ32(*this, sms_state, sms_pixel_color))
+ //m_port_gg_ext->pixel_handler().set(FUNC(sms_state::sms_pixel_color));
m_is_gamegear = true;
m_has_bios_0400 = true;
m_has_pwr_led = true;
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(sms_state::gamegeaj)
+void sms_state::gamegeaj(machine_config &config)
+{
gamegear(config);
m_ioctrl_region_is_japan = true;
-MACHINE_CONFIG_END
+}
ROM_START(sms1)