Cleanups & fix for missing acknowledgment of a5200 button 2 inputs (MT5591) - from Fabio. (nw)

This commit is contained in:
Scott Stone 2014-09-10 08:48:37 +00:00
parent 4842f0443f
commit 9b115b70f1
8 changed files with 143 additions and 66 deletions

View File

@ -30,6 +30,8 @@ public:
: atari_common_state(mconfig, type, tag),
m_maincpu(*this, "maincpu") { }
TIMER_DEVICE_CALLBACK_MEMBER( bartop_interrupt );
virtual void machine_reset();
required_device<cpu_device> m_maincpu;
};
@ -48,12 +50,12 @@ ADDRESS_MAP_END
#define JOYSTICK_SENSITIVITY 200
static INPUT_PORTS_START(bartop52)
PORT_START("djoy_b") /* IN3 digital joystick buttons (GTIA button bits) */
PORT_START("djoy_b")
PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1)
PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2)
PORT_BIT(0x04, 0x04, IPT_UNUSED)
PORT_BIT(0x08, 0x08, IPT_UNUSED)
PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1)
PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1)
PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
PORT_BIT(0x40, 0x40, IPT_UNUSED)
PORT_BIT(0x80, 0x80, IPT_UNUSED)
@ -107,12 +109,16 @@ void bartop52_state::machine_reset()
pokey->write(15,0);
}
TIMER_DEVICE_CALLBACK_MEMBER( bartop52_state::bartop_interrupt )
{
m_antic->generic_interrupt(4);
}
static MACHINE_CONFIG_START( a5200, bartop52_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
MCFG_CPU_PROGRAM_MAP(a5200_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a5200_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", bartop52_state, bartop_interrupt, "screen", 0, 1)
MCFG_DEVICE_ADD("gtia", ATARI_GTIA, 0)

View File

@ -63,6 +63,7 @@ public:
DECLARE_READ8_MEMBER(pia_pb_r);
WRITE8_MEMBER(pia_pb_w) { mmu(data); }
WRITE_LINE_MEMBER(pia_cb2_w) { } // This is used by Floppy drive on Atari 8bits Home Computers
TIMER_DEVICE_CALLBACK_MEMBER(mf_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(mcu_timer_proc);
int atari_input_disabled();
virtual void machine_reset();
@ -405,12 +406,16 @@ void maxaflex_state::machine_reset()
output_set_digit_value(2, 0x00);
}
TIMER_DEVICE_CALLBACK_MEMBER( maxaflex_state::mf_interrupt )
{
m_antic->generic_interrupt(2);
}
static MACHINE_CONFIG_START( maxaflex, maxaflex_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
MCFG_CPU_PROGRAM_MAP(a600xl_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800xl_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", maxaflex_state, mf_interrupt, "screen", 0, 1)
MCFG_CPU_ADD("mcu", M68705, 3579545)
MCFG_CPU_PROGRAM_MAP(mcu_mem)

View File

@ -29,18 +29,13 @@ public:
virtual void video_start();
TIMER_DEVICE_CALLBACK_MEMBER( a400_interrupt );
TIMER_DEVICE_CALLBACK_MEMBER( a800_interrupt );
TIMER_DEVICE_CALLBACK_MEMBER( a800xl_interrupt );
TIMER_DEVICE_CALLBACK_MEMBER( a5200_interrupt );
DECLARE_PALETTE_INIT(atari);
POKEY_INTERRUPT_CB_MEMBER(interrupt_cb);
POKEY_KEYBOARD_CB_MEMBER(a5200_keypads);
POKEY_KEYBOARD_CB_MEMBER(a800_keyboard);
private:
protected:
required_device<gtia_device> m_gtia;
required_device<antic_device> m_antic;
};

View File

@ -168,7 +168,11 @@ POKEY_KEYBOARD_CB_MEMBER(atari_common_state::a5200_keypads)
ret |= ((machine().root_device().ioport(tag[0])->read_safe(0) & 0x01) ? 0x02 : 0x00);
break;
case pokey_device::POK_KEY_CTRL:
break;
case pokey_device::POK_KEY_SHIFT:
// button 2 from joypads
ipt = machine().root_device().ioport("djoy_b")->read() & (0x10 << ((k543210 >> 3) & 0x03));
ret |= !ipt ? 0x02 : 0;
break;
}

View File

@ -25,7 +25,27 @@ const device_type ATARI_ANTIC = &device_creator<antic_device>;
antic_device::antic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, ATARI_ANTIC, "Atari ANTIC", tag, owner, clock, "antic", __FILE__),
m_gtia_tag(NULL)
m_gtia_tag(NULL),
m_tv_artifacts(0),
m_render1(0),
m_render2(0),
m_render3(0),
m_cmd(0),
m_steal_cycles(0),
m_vscrol_old(0),
m_hscrol_old(0),
m_modelines(0),
m_chbase(0),
m_chand(0),
m_chxor(0),
m_scanline(0),
m_pfwidth(0),
m_dpage(0),
m_doffs(0),
m_vpage(0),
m_voffs(0),
m_pmbase_s(0),
m_pmbase_d(0)
{
}
@ -38,14 +58,10 @@ void antic_device::device_start()
{
m_gtia = machine().device<gtia_device>(m_gtia_tag);
assert(m_gtia);
/* save states */
save_pointer(NAME((UINT8 *) &m_r), sizeof(m_r));
save_pointer(NAME((UINT8 *) &m_w), sizeof(m_w));
m_bitmap = auto_bitmap_ind16_alloc(machine(), machine().first_screen()->width(), machine().first_screen()->height());
m_cclk_expand = auto_alloc_array(machine(), UINT32, 21 * 256);
m_cclk_expand = auto_alloc_array_clear(machine(), UINT32, 21 * 256);
m_pf_21 = &m_cclk_expand[ 0 * 256];
m_pf_x10b = &m_cclk_expand[ 1 * 256];
@ -75,13 +91,44 @@ void antic_device::device_start()
cclk_init();
for (int i = 0; i < 64; i++)
m_prio_table[i] = auto_alloc_array(machine(), UINT8, 8*256);
m_prio_table[i] = auto_alloc_array_clear(machine(), UINT8, 8*256);
LOG(("atari prio_init\n"));
prio_init();
for (int i = 0; i < machine().first_screen()->height(); i++)
m_video[i] = auto_alloc_clear(machine(), VIDEO);
/* save states */
save_pointer(NAME((UINT8 *) &m_r), sizeof(m_r));
save_pointer(NAME((UINT8 *) &m_w), sizeof(m_w));
// TODO: save VIDEO items
save_item(NAME(m_tv_artifacts));
save_item(NAME(m_render1));
save_item(NAME(m_render2));
save_item(NAME(m_render3));
save_item(NAME(m_cmd));
save_item(NAME(m_steal_cycles));
save_item(NAME(m_vscrol_old));
save_item(NAME(m_hscrol_old));
save_item(NAME(m_modelines));
save_item(NAME(m_chbase));
save_item(NAME(m_chand));
save_item(NAME(m_chxor));
save_item(NAME(m_scanline));
save_item(NAME(m_pfwidth));
save_item(NAME(m_dpage));
save_item(NAME(m_doffs));
save_item(NAME(m_vpage));
save_item(NAME(m_voffs));
save_item(NAME(m_pmbase_s));
save_item(NAME(m_pmbase_d));
save_item(NAME(m_cclock));
save_item(NAME(m_pmbits));
save_pointer(NAME(m_cclk_expand), 21 * 256);
save_pointer(NAME(m_used_colors), 21 * 256);
}
@ -109,11 +156,9 @@ void antic_device::device_reset()
m_r.penv = 0x00;
m_r.antic0e = 0xff;
m_r.nmist = 0x1f;
m_render1 = 0;
m_render2 = 0;
m_render3 = 0;
m_tv_artifacts = 0;
memset(m_cclock, 0, sizeof(m_cclock));
memset(m_pmbits, 0, sizeof(m_pmbits));
}

View File

@ -28,32 +28,6 @@ void atari_common_state::video_start()
}
/**************************************************************
*
* Interrupts
*
**************************************************************/
TIMER_DEVICE_CALLBACK_MEMBER( atari_common_state::a400_interrupt )
{
m_antic->generic_interrupt(4);
}
TIMER_DEVICE_CALLBACK_MEMBER( atari_common_state::a800_interrupt )
{
m_antic->generic_interrupt(4);
}
TIMER_DEVICE_CALLBACK_MEMBER( atari_common_state::a800xl_interrupt )
{
m_antic->generic_interrupt(2);
}
TIMER_DEVICE_CALLBACK_MEMBER( atari_common_state::a5200_interrupt )
{
m_antic->generic_interrupt(4);
}
/**************************************************************
*
* Palette

View File

@ -161,6 +161,7 @@ void gtia_device::device_start()
save_item(NAME(m_r.gtia1d));
save_item(NAME(m_r.gtia1e));
save_item(NAME(m_r.cons));
save_item(NAME(m_w.hposp0));
save_item(NAME(m_w.hposp1));
save_item(NAME(m_w.hposp2));
@ -194,6 +195,30 @@ void gtia_device::device_start()
save_item(NAME(m_w.hitclr));
save_item(NAME(m_w.cons));
save_item(NAME(m_h.grafp0));
save_item(NAME(m_h.grafp1));
save_item(NAME(m_h.grafp2));
save_item(NAME(m_h.grafp3));
save_item(NAME(m_h.grafm0));
save_item(NAME(m_h.grafm1));
save_item(NAME(m_h.grafm2));
save_item(NAME(m_h.grafm3));
save_item(NAME(m_h.hitclr_frames));
save_item(NAME(m_h.sizem));
save_item(NAME(m_h.usedp));
save_item(NAME(m_h.usedm0));
save_item(NAME(m_h.usedm1));
save_item(NAME(m_h.usedm2));
save_item(NAME(m_h.usedm3));
save_item(NAME(m_h.vdelay_m0));
save_item(NAME(m_h.vdelay_m1));
save_item(NAME(m_h.vdelay_m2));
save_item(NAME(m_h.vdelay_m3));
save_item(NAME(m_h.vdelay_p0));
save_item(NAME(m_h.vdelay_p1));
save_item(NAME(m_h.vdelay_p2));
save_item(NAME(m_h.vdelay_p3));
save_item(NAME(m_lumpf1));
save_item(NAME(m_huepm0));
save_item(NAME(m_huepm1));
@ -203,6 +228,8 @@ void gtia_device::device_start()
save_item(NAME(m_huepf2));
save_item(NAME(m_huebk));
save_item(NAME(m_color_lookup));
machine().save().register_postload(save_prepost_delegate(FUNC(gtia_device::gtia_postload), this));
}
@ -217,6 +244,9 @@ void gtia_device::device_reset()
for (int i = 0; i < 32; i++)
write(machine().driver_data()->generic_space(), i, 0);
memset(&m_r, 0, sizeof(m_r));
memset(&m_h, 0, sizeof(m_h));
memset(m_color_lookup, 0, sizeof(m_color_lookup));
if (is_ntsc())
m_r.pal = 0xff;
else

View File

@ -46,7 +46,6 @@
#include "sound/pokey.h"
#include "includes/atari.h"
#include "machine/atarifdc.h"
#include "video/gtia.h"
#include "bus/a800/a800_slot.h"
#include "bus/a800/a800_carts.h"
@ -287,6 +286,10 @@ public:
DECLARE_READ8_MEMBER(xegs_high_r);
DECLARE_WRITE8_MEMBER(xegs_high_w);
TIMER_DEVICE_CALLBACK_MEMBER(a400_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(a800xl_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(a5200_interrupt);
protected:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
@ -663,11 +666,11 @@ static INPUT_PORTS_START( atari_digital_joystick2 )
PORT_START("djoy_b")
PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1)
PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2)
PORT_BIT(0x04, 0x04, IPT_UNUSED)
PORT_BIT(0x08, 0x08, IPT_UNUSED)
PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1)
PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1)
PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
PORT_BIT(0x40, 0x40, IPT_UNUSED)
PORT_BIT(0x80, 0x80, IPT_UNUSED)
INPUT_PORTS_END
@ -697,13 +700,13 @@ static INPUT_PORTS_START( atari_digital_joystick4 )
PORT_START("djoy_b")
PORT_BIT(0x01, 0x01, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1)
PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
PORT_BIT(0x04, 0x04, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON3) PORT_PLAYER(3)
PORT_BIT(0x08, 0x08, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON4) PORT_PLAYER(4)
PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1)
PORT_BIT(0x02, 0x02, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2)
PORT_BIT(0x04, 0x04, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(3)
PORT_BIT(0x08, 0x08, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(4)
PORT_BIT(0x10, 0x10, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(1)
PORT_BIT(0x20, 0x20, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
PORT_BIT(0x40, 0x40, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON3) PORT_PLAYER(3)
PORT_BIT(0x80, 0x80, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON4) PORT_PLAYER(4)
PORT_BIT(0x40, 0x40, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(3)
PORT_BIT(0x80, 0x80, IPT_BUTTON2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(4)
INPUT_PORTS_END
@ -1927,6 +1930,21 @@ void a400_state::setup_cart(a800_cart_slot_device *slot)
}
TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a400_interrupt )
{
m_antic->generic_interrupt(4);
}
TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a800xl_interrupt )
{
m_antic->generic_interrupt(2);
}
TIMER_DEVICE_CALLBACK_MEMBER( a400_state::a5200_interrupt )
{
m_antic->generic_interrupt(4);
}
MACHINE_RESET_MEMBER( a400_state, a400 )
{
pokey_device *pokey = machine().device<pokey_device>("pokey");
@ -2103,7 +2121,7 @@ static MACHINE_CONFIG_DERIVED( a400, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a400_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a400_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1)
MCFG_MACHINE_START_OVERRIDE( a400_state, a400 )
@ -2118,7 +2136,7 @@ static MACHINE_CONFIG_DERIVED( a400pal, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a400_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a400_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1)
MCFG_MACHINE_START_OVERRIDE( a400_state, a400 )
@ -2133,7 +2151,7 @@ static MACHINE_CONFIG_DERIVED( a800, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a400_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1)
MCFG_MACHINE_START_OVERRIDE( a400_state, a800 )
@ -2150,7 +2168,7 @@ static MACHINE_CONFIG_DERIVED( a800pal, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a400_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a400_interrupt, "screen", 0, 1)
MCFG_MACHINE_START_OVERRIDE( a400_state, a800 )
@ -2167,7 +2185,7 @@ static MACHINE_CONFIG_DERIVED( a600xl, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a600xl_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800xl_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a800xl_interrupt, "screen", 0, 1)
MCFG_DEVICE_MODIFY("pia")
MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a600xl_pia_pb_w))
@ -2188,7 +2206,7 @@ static MACHINE_CONFIG_DERIVED( a800xl, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a800xl_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800xl_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a800xl_interrupt, "screen", 0, 1)
MCFG_DEVICE_MODIFY("pia")
MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a800xl_pia_pb_w))
@ -2259,7 +2277,7 @@ static MACHINE_CONFIG_DERIVED( a5200, atari_common_nodac )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a5200_mem)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a5200_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a400_state, a5200_interrupt, "screen", 0, 1)
// FIXME: should there be anything connected where other system have the fdc?
MCFG_SOUND_MODIFY("pokey")