mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
megadriv: reducing input tag lookups. nw.
This commit is contained in:
parent
6fc9a5a5a6
commit
864275206c
@ -650,6 +650,26 @@ static MACHINE_CONFIG_START( megadrvb, md_boot_state )
|
||||
MCFG_FRAGMENT_ADD(md_ntsc)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_START_MEMBER(md_boot_state, md_6button)
|
||||
{
|
||||
MACHINE_START_CALL_MEMBER(megadriv);
|
||||
|
||||
m_io_pad_6b[0] = ioport("EXTRA1");
|
||||
m_io_pad_6b[1] = ioport("EXTRA2");
|
||||
m_io_pad_6b[2] = ioport("IN0");
|
||||
m_io_pad_6b[3] = ioport("UNK");
|
||||
|
||||
// setup timers for 6 button pads
|
||||
for (int i = 0; i < 3; i++)
|
||||
m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this), (void*)(FPTR)i);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( megadrvb_6b, md_boot_state )
|
||||
MCFG_FRAGMENT_ADD(md_ntsc)
|
||||
MCFG_MACHINE_START_OVERRIDE(md_boot_state, md_6button)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
@ -738,7 +758,6 @@ DRIVER_INIT_MEMBER(md_boot_state,aladmdb)
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x220000, 0x220001, write16_delegate(FUNC(md_boot_state::aladmdb_w),this));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x330000, 0x330001, read16_delegate(FUNC(md_boot_state::aladmdb_r),this));
|
||||
|
||||
m_megadrive_6buttons_pad = 0;
|
||||
DRIVER_INIT_CALL(megadrij);
|
||||
}
|
||||
|
||||
@ -787,8 +806,10 @@ DRIVER_INIT_MEMBER(md_boot_state,mk3mdb)
|
||||
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770070, 0x770075, read16_delegate(FUNC(md_boot_state::mk3mdb_dsw_r),this));
|
||||
|
||||
m_megadrive_6buttons_pad = 1;
|
||||
DRIVER_INIT_CALL(megadriv);
|
||||
// 6 button game, so overwrite 3 button io handlers
|
||||
m_megadrive_io_read_data_port_ptr = read8_delegate(FUNC(md_base_state::megadrive_io_read_data_port_6button),this);
|
||||
m_megadrive_io_write_data_port_ptr = write16_delegate(FUNC(md_base_state::megadrive_io_write_data_port_6button),this);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(md_boot_state,ssf2mdb)
|
||||
@ -801,8 +822,10 @@ DRIVER_INIT_MEMBER(md_boot_state,ssf2mdb)
|
||||
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770070, 0x770075, read16_delegate(FUNC(md_boot_state::ssf2mdb_dsw_r),this));
|
||||
|
||||
m_megadrive_6buttons_pad = 1;
|
||||
DRIVER_INIT_CALL(megadrij);
|
||||
// 6 button game, so overwrite 3 button io handlers
|
||||
m_megadrive_io_read_data_port_ptr = read8_delegate(FUNC(md_base_state::megadrive_io_read_data_port_6button),this);
|
||||
m_megadrive_io_write_data_port_ptr = write16_delegate(FUNC(md_base_state::megadrive_io_write_data_port_6button),this);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(md_boot_state,srmdb)
|
||||
@ -830,7 +853,6 @@ DRIVER_INIT_MEMBER(md_boot_state,srmdb)
|
||||
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770070, 0x770075, read16_delegate(FUNC(md_boot_state::srmdb_dsw_r),this));
|
||||
|
||||
m_megadrive_6buttons_pad = 0;
|
||||
DRIVER_INIT_CALL(megadriv);
|
||||
}
|
||||
|
||||
@ -842,7 +864,6 @@ DRIVER_INIT_MEMBER(md_boot_state,topshoot)
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x200046, 0x200047, "IN2");
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x200048, 0x200049, "IN3");
|
||||
|
||||
m_megadrive_6buttons_pad = 0;
|
||||
DRIVER_INIT_CALL(megadriv);
|
||||
}
|
||||
|
||||
@ -852,8 +873,8 @@ DRIVER_INIT_MEMBER(md_boot_state,topshoot)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1993, aladmdb, 0, megadrvb, aladmdb, md_boot_state, aladmdb, ROT0, "bootleg / Sega", "Aladdin (bootleg of Japanese Megadrive version)", 0)
|
||||
GAME( 1996, mk3mdb, 0, megadrvb, mk3mdb, md_boot_state, mk3mdb, ROT0, "bootleg / Midway", "Mortal Kombat 3 (bootleg of Megadrive version)", 0)
|
||||
GAME( 1994, ssf2mdb, 0, megadrvb, ssf2mdb, md_boot_state, ssf2mdb, ROT0, "bootleg / Capcom", "Super Street Fighter II - The New Challengers (bootleg of Japanese MegaDrive version)", 0)
|
||||
GAME( 1993, srmdb, 0, megadrvb, srmdb, md_boot_state, srmdb, ROT0, "bootleg / Konami", "Sunset Riders (bootleg of Megadrive version)", 0)
|
||||
GAME( 1995, topshoot, 0, md_bootleg, topshoot, md_boot_state, topshoot, ROT0, "Sun Mixing", "Top Shooter", 0)
|
||||
GAME( 1993, aladmdb, 0, megadrvb, aladmdb, md_boot_state, aladmdb, ROT0, "bootleg / Sega", "Aladdin (bootleg of Japanese Megadrive version)", 0)
|
||||
GAME( 1996, mk3mdb, 0, megadrvb_6b, mk3mdb, md_boot_state, mk3mdb, ROT0, "bootleg / Midway", "Mortal Kombat 3 (bootleg of Megadrive version)", 0)
|
||||
GAME( 1994, ssf2mdb, 0, megadrvb_6b, ssf2mdb, md_boot_state, ssf2mdb, ROT0, "bootleg / Capcom", "Super Street Fighter II - The New Challengers (bootleg of Japanese MegaDrive version)", 0)
|
||||
GAME( 1993, srmdb, 0, megadrvb, srmdb, md_boot_state, srmdb, ROT0, "bootleg / Konami", "Sunset Riders (bootleg of Megadrive version)", 0)
|
||||
GAME( 1995, topshoot, 0, md_bootleg, topshoot, md_boot_state, topshoot, ROT0, "Sun Mixing", "Top Shooter", 0)
|
||||
|
@ -66,8 +66,7 @@ public:
|
||||
m_vdp(*this,"gen_vdp"),
|
||||
m_32x(*this,"sega32x"),
|
||||
m_segacd(*this,"segacd"),
|
||||
m_megadrive_ram(*this,"megadrive_ram"),
|
||||
m_megadrive_6buttons_pad(0)
|
||||
m_megadrive_ram(*this,"megadrive_ram")
|
||||
{ }
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_device<cpu_device> m_z80snd;
|
||||
@ -77,6 +76,10 @@ public:
|
||||
optional_device<sega_segacd_device> m_segacd;
|
||||
optional_shared_ptr<UINT16> m_megadrive_ram;
|
||||
|
||||
ioport_port *m_io_reset;
|
||||
ioport_port *m_io_pad_3b[4];
|
||||
ioport_port *m_io_pad_6b[4];
|
||||
|
||||
int m_other_hacks; // misc hacks
|
||||
genesis_z80_vars m_genz80;
|
||||
int m_pal;
|
||||
@ -122,13 +125,11 @@ public:
|
||||
UINT8 m_megadrive_io_data_regs[3];
|
||||
UINT8 m_megadrive_io_ctrl_regs[3];
|
||||
UINT8 m_megadrive_io_tx_regs[3];
|
||||
int m_megadrive_6buttons_pad;
|
||||
read8_delegate m_megadrive_io_read_data_port_ptr;
|
||||
write16_delegate m_megadrive_io_write_data_port_ptr;
|
||||
|
||||
|
||||
TIMER_CALLBACK_MEMBER( io_timeout_timer_callback );
|
||||
void init_megadri6_io();
|
||||
void megadrive_reset_io();
|
||||
DECLARE_READ8_MEMBER(megadrive_io_read_data_port_6button);
|
||||
DECLARE_READ8_MEMBER(megadrive_io_read_data_port_3button);
|
||||
@ -183,6 +184,8 @@ public:
|
||||
DECLARE_READ16_MEMBER( topshoot_200051_r );
|
||||
DECLARE_READ16_MEMBER(puckpkmna_70001c_r);
|
||||
DECLARE_READ16_MEMBER(puckpkmna_4b2476_r);
|
||||
|
||||
DECLARE_MACHINE_START( md_6button );
|
||||
};
|
||||
|
||||
|
||||
|
@ -91,20 +91,12 @@ WRITE8_MEMBER(md_base_state::megadriv_68k_YM2612_write)
|
||||
}
|
||||
}
|
||||
|
||||
// this is used by 6 button pads and gets installed in machine_start for drivers requiring it
|
||||
TIMER_CALLBACK_MEMBER(md_base_state::io_timeout_timer_callback)
|
||||
{
|
||||
m_io_stage[(int)(FPTR)ptr] = -1;
|
||||
}
|
||||
|
||||
void md_base_state::init_megadri6_io()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<3; i++)
|
||||
{
|
||||
m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this), (void*)(FPTR)i);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -216,8 +208,6 @@ READ8_MEMBER(md_base_state::megadrive_io_read_data_port_6button)
|
||||
{
|
||||
int portnum = offset;
|
||||
UINT8 retdata, helper = (m_megadrive_io_ctrl_regs[portnum] & 0x3f) | 0xc0; // bits 6 & 7 always come from m_megadrive_io_data_regs
|
||||
static const char *const pad3names[] = { "PAD1", "PAD2", "IN0", "UNK" };
|
||||
static const char *const pad6names[] = { "EXTRA1", "EXTRA2", "IN0", "UNK" };
|
||||
|
||||
if (m_megadrive_io_data_regs[portnum] & 0x40)
|
||||
{
|
||||
@ -225,14 +215,14 @@ READ8_MEMBER(md_base_state::megadrive_io_read_data_port_6button)
|
||||
{
|
||||
/* here we read B, C & the additional buttons */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper) |
|
||||
(((ioport(pad3names[portnum])->read_safe(0) & 0x30) |
|
||||
(ioport(pad6names[portnum])->read_safe(0) & 0x0f)) & ~helper);
|
||||
(((m_io_pad_3b[portnum]->read_safe(0) & 0x30) |
|
||||
(m_io_pad_6b[portnum]->read_safe(0) & 0x0f)) & ~helper);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* here we read B, C & the directional buttons */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper) |
|
||||
((ioport(pad3names[portnum])->read_safe(0) & 0x3f) & ~helper);
|
||||
((m_io_pad_3b[portnum]->read_safe(0) & 0x3f) & ~helper);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -241,20 +231,20 @@ READ8_MEMBER(md_base_state::megadrive_io_read_data_port_6button)
|
||||
{
|
||||
/* here we read ((Start & A) >> 2) | 0x00 */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper) |
|
||||
(((ioport(pad3names[portnum])->read_safe(0) & 0xc0) >> 2) & ~helper);
|
||||
(((m_io_pad_3b[portnum]->read_safe(0) & 0xc0) >> 2) & ~helper);
|
||||
}
|
||||
else if (m_io_stage[portnum]==2)
|
||||
{
|
||||
/* here we read ((Start & A) >> 2) | 0x0f */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper) |
|
||||
((((ioport(pad3names[portnum])->read_safe(0) & 0xc0) >> 2) | 0x0f) & ~helper);
|
||||
((((m_io_pad_3b[portnum]->read_safe(0) & 0xc0) >> 2) | 0x0f) & ~helper);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* here we read ((Start & A) >> 2) | Up and Down */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper) |
|
||||
((((ioport(pad3names[portnum])->read_safe(0) & 0xc0) >> 2) |
|
||||
(ioport(pad3names[portnum])->read_safe(0) & 0x03)) & ~helper);
|
||||
((((m_io_pad_3b[portnum]->read_safe(0) & 0xc0) >> 2) |
|
||||
(m_io_pad_3b[portnum]->read_safe(0) & 0x03)) & ~helper);
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,20 +259,19 @@ READ8_MEMBER(md_base_state::megadrive_io_read_data_port_3button)
|
||||
{
|
||||
int portnum = offset;
|
||||
UINT8 retdata, helper = (m_megadrive_io_ctrl_regs[portnum] & 0x7f) | 0x80; // bit 7 always comes from m_megadrive_io_data_regs
|
||||
static const char *const pad3names[] = { "PAD1", "PAD2", "IN0", "UNK" };
|
||||
|
||||
if (m_megadrive_io_data_regs[portnum] & 0x40)
|
||||
{
|
||||
/* here we read B, C & the directional buttons */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper) |
|
||||
(((ioport(pad3names[portnum])->read_safe(0) & 0x3f) | 0x40) & ~helper);
|
||||
(((m_io_pad_3b[portnum]->read_safe(0) & 0x3f) | 0x40) & ~helper);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* here we read ((Start & A) >> 2) | Up and Down */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper) |
|
||||
((((ioport(pad3names[portnum])->read_safe(0) & 0xc0) >> 2) |
|
||||
(ioport(pad3names[portnum])->read_safe(0) & 0x03) | 0x40) & ~helper);
|
||||
((((m_io_pad_3b[portnum]->read_safe(0) & 0xc0) >> 2) |
|
||||
(m_io_pad_3b[portnum]->read_safe(0) & 0x03) | 0x40) & ~helper);
|
||||
}
|
||||
|
||||
return retdata;
|
||||
@ -296,18 +285,18 @@ UINT8 md_base_state::megatech_bios_port_cc_dc_r(int offset, int ctrl)
|
||||
if (ctrl == 0x55)
|
||||
{
|
||||
/* A keys */
|
||||
retdata = ((ioport("PAD1")->read() & 0x40) >> 2) |
|
||||
((ioport("PAD2")->read() & 0x40) >> 4) | 0xeb;
|
||||
retdata = ((m_io_pad_3b[0]->read() & 0x40) >> 2) |
|
||||
((m_io_pad_3b[1]->read() & 0x40) >> 4) | 0xeb;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (offset == 0)
|
||||
{
|
||||
retdata = (ioport("PAD1")->read() & 0x3f) | ((ioport("PAD2")->read() & 0x03) << 6);
|
||||
retdata = (m_io_pad_3b[0]->read() & 0x3f) | ((m_io_pad_3b[1]->read() & 0x03) << 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
retdata = ((ioport("PAD2")->read() & 0x3c) >> 2) | 0xf0;
|
||||
retdata = ((m_io_pad_3b[1]->read() & 0x3c) >> 2) | 0xf0;
|
||||
}
|
||||
|
||||
}
|
||||
@ -867,8 +856,11 @@ VIDEO_START_MEMBER(md_base_state,megadriv)
|
||||
|
||||
MACHINE_START_MEMBER(md_base_state,megadriv)
|
||||
{
|
||||
if (m_megadrive_6buttons_pad)
|
||||
init_megadri6_io();
|
||||
m_io_reset = ioport("RESET");
|
||||
m_io_pad_3b[0] = ioport("PAD1");
|
||||
m_io_pad_3b[1] = ioport("PAD2");
|
||||
m_io_pad_3b[2] = ioport("IN0");
|
||||
m_io_pad_3b[3] = ioport("UNK");
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(md_base_state,megadriv)
|
||||
@ -1152,19 +1144,8 @@ void md_base_state::megadriv_init_common()
|
||||
|
||||
m68k_set_tas_callback(machine().device("maincpu"), megadriv_tas_callback);
|
||||
|
||||
// the drivers which need 6 buttons pad set this to 1 in their init befare calling the megadrive init
|
||||
if (m_megadrive_6buttons_pad)
|
||||
{
|
||||
m_megadrive_io_read_data_port_ptr = read8_delegate(FUNC(md_base_state::megadrive_io_read_data_port_6button),this);
|
||||
m_megadrive_io_write_data_port_ptr = write16_delegate(FUNC(md_base_state::megadrive_io_write_data_port_6button),this);
|
||||
mame_printf_debug("6 button game\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_megadrive_io_read_data_port_ptr = read8_delegate(FUNC(md_base_state::megadrive_io_read_data_port_3button),this);
|
||||
m_megadrive_io_write_data_port_ptr = write16_delegate(FUNC(md_base_state::megadrive_io_write_data_port_3button),this);
|
||||
mame_printf_debug("3 button game\n");
|
||||
}
|
||||
m_megadrive_io_read_data_port_ptr = read8_delegate(FUNC(md_base_state::megadrive_io_read_data_port_3button),this);
|
||||
m_megadrive_io_write_data_port_ptr = write16_delegate(FUNC(md_base_state::megadrive_io_write_data_port_3button),this);
|
||||
|
||||
{
|
||||
/* only really useful on official games, ea games etc. don't bother
|
||||
@ -1334,7 +1315,7 @@ void mtech_state::megatech_set_megadrive_z80_as_megadrive_z80(const char* tag)
|
||||
|
||||
void md_base_state::screen_eof_megadriv(screen_device &screen, bool state)
|
||||
{
|
||||
if (screen.ioport(":RESET")->read_safe(0x00) & 0x01)
|
||||
if (m_io_reset->read_safe(0x00) & 0x01)
|
||||
m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
|
||||
|
||||
// rising edge
|
||||
|
@ -24,6 +24,10 @@ public:
|
||||
m_slotcart(*this, "mdslot")
|
||||
{ }
|
||||
|
||||
ioport_port *m_io_ctrlr;
|
||||
ioport_port *m_io_pad3b[4];
|
||||
ioport_port *m_io_pad6b[2][4];
|
||||
|
||||
optional_device<md_cart_slot_device> m_slotcart;
|
||||
|
||||
DECLARE_DRIVER_INIT(mess_md_common);
|
||||
@ -44,7 +48,12 @@ public:
|
||||
pico_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: md_cons_state(mconfig, type, tag),
|
||||
m_picocart(*this, "picoslot") { }
|
||||
|
||||
|
||||
ioport_port *m_io_page;
|
||||
ioport_port *m_io_pad;
|
||||
ioport_port *m_io_penx;
|
||||
ioport_port *m_io_peny;
|
||||
|
||||
optional_device<pico_cart_slot_device> m_picocart;
|
||||
UINT8 m_page_register;
|
||||
|
||||
@ -66,11 +75,6 @@ public:
|
||||
READ8_MEMBER(md_cons_state::mess_md_io_read_data_port)
|
||||
{
|
||||
int portnum = offset;
|
||||
static const char *const pad6names[2][4] = {
|
||||
{ "PAD1_6B", "PAD2_6B", "UNUSED", "UNUSED" },
|
||||
{ "EXTRA1", "EXTRA2", "UNUSED", "UNUSED" }
|
||||
};
|
||||
static const char *const pad3names[4] = { "PAD1_3B", "PAD2_3B", "UNUSED", "UNUSED" };
|
||||
|
||||
UINT8 retdata;
|
||||
int controller;
|
||||
@ -80,11 +84,11 @@ READ8_MEMBER(md_cons_state::mess_md_io_read_data_port)
|
||||
switch (portnum)
|
||||
{
|
||||
case 0:
|
||||
controller = (ioport("CTRLSEL")->read() & 0x0f);
|
||||
controller = (m_io_ctrlr->read() & 0x0f);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
controller = (ioport("CTRLSEL")->read() & 0xf0);
|
||||
controller = (m_io_ctrlr->read() & 0xf0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -101,14 +105,14 @@ READ8_MEMBER(md_cons_state::mess_md_io_read_data_port)
|
||||
{
|
||||
/* here we read B, C & the additional buttons */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) |
|
||||
(((ioport(pad6names[0][portnum])->read_safe(0) & 0x30) |
|
||||
(ioport(pad6names[1][portnum])->read_safe(0) & 0x0f)) & ~helper_6b);
|
||||
(((m_io_pad6b[0][portnum]->read_safe(0) & 0x30) |
|
||||
(m_io_pad6b[1][portnum]->read_safe(0) & 0x0f)) & ~helper_6b);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* here we read B, C & the directional buttons */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) |
|
||||
((ioport(pad6names[0][portnum])->read_safe(0) & 0x3f) & ~helper_6b);
|
||||
((m_io_pad6b[0][portnum]->read_safe(0) & 0x3f) & ~helper_6b);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -117,20 +121,20 @@ READ8_MEMBER(md_cons_state::mess_md_io_read_data_port)
|
||||
{
|
||||
/* here we read ((Start & A) >> 2) | 0x00 */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) |
|
||||
(((ioport(pad6names[0][portnum])->read_safe(0) & 0xc0) >> 2) & ~helper_6b);
|
||||
(((m_io_pad6b[0][portnum]->read_safe(0) & 0xc0) >> 2) & ~helper_6b);
|
||||
}
|
||||
else if (m_io_stage[portnum]==2)
|
||||
{
|
||||
/* here we read ((Start & A) >> 2) | 0x0f */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) |
|
||||
((((ioport(pad6names[0][portnum])->read_safe(0) & 0xc0) >> 2) | 0x0f) & ~helper_6b);
|
||||
((((m_io_pad6b[0][portnum]->read_safe(0) & 0xc0) >> 2) | 0x0f) & ~helper_6b);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* here we read ((Start & A) >> 2) | Up and Down */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) |
|
||||
((((ioport(pad6names[0][portnum])->read_safe(0) & 0xc0) >> 2) |
|
||||
(ioport(pad6names[0][portnum])->read_safe(0) & 0x03)) & ~helper_6b);
|
||||
((((m_io_pad6b[0][portnum]->read_safe(0) & 0xc0) >> 2) |
|
||||
(m_io_pad6b[0][portnum]->read_safe(0) & 0x03)) & ~helper_6b);
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,14 +158,14 @@ READ8_MEMBER(md_cons_state::mess_md_io_read_data_port)
|
||||
{
|
||||
/* here we read B, C & the directional buttons */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper_3b) |
|
||||
(((ioport(pad3names[portnum])->read_safe(0) & 0x3f) | 0x40) & ~helper_3b);
|
||||
(((m_io_pad3b[portnum]->read_safe(0) & 0x3f) | 0x40) & ~helper_3b);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* here we read ((Start & A) >> 2) | Up and Down */
|
||||
retdata = (m_megadrive_io_data_regs[portnum] & helper_3b) |
|
||||
((((ioport(pad3names[portnum])->read_safe(0) & 0xc0) >> 2) |
|
||||
(ioport(pad3names[portnum])->read_safe(0) & 0x03) | 0x40) & ~helper_3b);
|
||||
((((m_io_pad3b[portnum]->read_safe(0) & 0xc0) >> 2) |
|
||||
(m_io_pad3b[portnum]->read_safe(0) & 0x03) | 0x40) & ~helper_3b);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,11 +181,11 @@ WRITE16_MEMBER(md_cons_state::mess_md_io_write_data_port)
|
||||
switch (portnum)
|
||||
{
|
||||
case 0:
|
||||
controller = (ioport("CTRLSEL")->read() & 0x0f);
|
||||
controller = (m_io_ctrlr->read() & 0x0f);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
controller = (ioport("CTRLSEL")->read() & 0xf0);
|
||||
controller = (m_io_ctrlr->read() & 0xf0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -196,7 +200,7 @@ WRITE16_MEMBER(md_cons_state::mess_md_io_write_data_port)
|
||||
if (((m_megadrive_io_data_regs[portnum] & 0x40) == 0x00) && ((data & 0x40) == 0x40))
|
||||
{
|
||||
m_io_stage[portnum]++;
|
||||
m_io_timeout[portnum]->adjust(machine().device<cpu_device>("maincpu")->cycles_to_attotime(8192));
|
||||
m_io_timeout[portnum]->adjust(m_maincpu->cycles_to_attotime(8192));
|
||||
}
|
||||
|
||||
}
|
||||
@ -318,7 +322,24 @@ UINT16 vdp_get_word_from_68k_mem_console(running_machine &machine, UINT32 source
|
||||
|
||||
MACHINE_START_MEMBER(md_cons_state,ms_megadriv )
|
||||
{
|
||||
init_megadri6_io();
|
||||
static const char *const pad6names[2][4] = {
|
||||
{ "PAD1_6B", "PAD2_6B", "UNUSED", "UNUSED" },
|
||||
{ "EXTRA1", "EXTRA2", "UNUSED", "UNUSED" }
|
||||
};
|
||||
static const char *const pad3names[4] = { "PAD1_3B", "PAD2_3B", "UNUSED", "UNUSED" };
|
||||
|
||||
m_io_ctrlr = ioport("CTRLSEL");
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
m_io_pad3b[i] = ioport(pad3names[i]);
|
||||
m_io_pad6b[0][i] = ioport(pad6names[0][i]);
|
||||
m_io_pad6b[1][i] = ioport(pad6names[1][i]);
|
||||
}
|
||||
|
||||
// setup timers for 6 button pads
|
||||
for (int i = 0; i < 3; i++)
|
||||
m_io_timeout[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(md_base_state::io_timeout_timer_callback),this), (void*)(FPTR)i);
|
||||
|
||||
vdp_get_word_from_68k_mem = vdp_get_word_from_68k_mem_console;
|
||||
|
||||
@ -886,13 +907,13 @@ UINT16 pico_state::pico_read_penpos(int pen)
|
||||
switch (pen)
|
||||
{
|
||||
case PICO_PENX:
|
||||
penpos = ioport("PENX")->read_safe(0);
|
||||
penpos = m_io_penx->read_safe(0);
|
||||
penpos |= 0x6;
|
||||
penpos = penpos * 320 / 255;
|
||||
penpos += 0x3d;
|
||||
break;
|
||||
case PICO_PENY:
|
||||
penpos = ioport("PENY")->read_safe(0);
|
||||
penpos = m_io_peny->read_safe(0);
|
||||
penpos |= 0x6;
|
||||
penpos = penpos * 251 / 255;
|
||||
penpos += 0x1fc;
|
||||
@ -912,7 +933,7 @@ READ16_HANDLER(pico_state::pico_68k_io_read )
|
||||
retdata = (m_export << 6) | (m_pal << 5);
|
||||
break;
|
||||
case 1:
|
||||
retdata = ioport("PAD")->read_safe(0);
|
||||
retdata = m_io_pad->read_safe(0);
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -945,7 +966,7 @@ READ16_HANDLER(pico_state::pico_68k_io_read )
|
||||
either page 5 or page 6 is often unused.
|
||||
*/
|
||||
{
|
||||
UINT8 tmp = ioport("PAGE")->read_safe(0);
|
||||
UINT8 tmp = m_io_page->read_safe(0);
|
||||
if (tmp == 2 && m_page_register != 0x3f)
|
||||
{
|
||||
m_page_register <<= 1;
|
||||
@ -1017,6 +1038,11 @@ SLOT_INTERFACE_END
|
||||
|
||||
MACHINE_START_MEMBER(pico_state,pico)
|
||||
{
|
||||
m_io_page = ioport("PAGE");
|
||||
m_io_pad = ioport("PAD");
|
||||
m_io_penx = ioport("PENX");
|
||||
m_io_peny = ioport("PENY");
|
||||
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_picocart));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_picocart));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_picocart));
|
||||
|
Loading…
Reference in New Issue
Block a user