mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
(MESS) atari400.c: start attempt to untangle a bit the video &
machine code. nw.
This commit is contained in:
parent
c34d606c05
commit
8707f8f6a4
@ -30,6 +30,8 @@ public:
|
||||
: atari_common_state(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu") { }
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
required_device<cpu_device> m_maincpu;
|
||||
};
|
||||
|
||||
@ -100,6 +102,25 @@ static INPUT_PORTS_START(bartop52)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
void bartop52_state::machine_start()
|
||||
{
|
||||
/* GTIA */
|
||||
gtia_interface gtia_intf;
|
||||
memset(>ia_intf, 0, sizeof(gtia_intf));
|
||||
gtia_init(machine(), >ia_intf);
|
||||
|
||||
/* ANTIC */
|
||||
antic_start(machine());
|
||||
}
|
||||
|
||||
void bartop52_state::machine_reset()
|
||||
{
|
||||
pokey_device *pokey = machine().device<pokey_device>("pokey");
|
||||
pokey->write(15,0);
|
||||
antic_reset();
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( a5200, bartop52_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(mcu_timer_proc);
|
||||
int atari_input_disabled();
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_mcu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
@ -405,9 +406,23 @@ READ8_MEMBER(maxaflex_state::maxaflex_atari_pia_pb_r)
|
||||
|
||||
void maxaflex_state::machine_start()
|
||||
{
|
||||
atari_machine_start();
|
||||
/* GTIA */
|
||||
gtia_interface gtia_intf;
|
||||
memset(>ia_intf, 0, sizeof(gtia_intf));
|
||||
gtia_init(machine(), >ia_intf);
|
||||
|
||||
/* ANTIC */
|
||||
antic_start(machine());
|
||||
}
|
||||
|
||||
void maxaflex_state::machine_reset()
|
||||
{
|
||||
pokey_device *pokey = machine().device<pokey_device>("pokey");
|
||||
pokey->write(15,0);
|
||||
antic_reset();
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( a600xl, maxaflex_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
|
||||
|
@ -23,9 +23,6 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
tv_artifacts(0) { }
|
||||
|
||||
/* This is needed in MESS as well for Atari 8bit drivers */
|
||||
void atari_machine_start();
|
||||
|
||||
virtual void video_start();
|
||||
UINT32 screen_update_atari(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
@ -562,6 +559,7 @@ struct ANTIC {
|
||||
|
||||
extern ANTIC antic;
|
||||
|
||||
void antic_start(running_machine &machine);
|
||||
void antic_reset(void);
|
||||
|
||||
|
||||
@ -610,5 +608,14 @@ ANTIC_RENDERER( antic_mode_e_48 );
|
||||
ANTIC_RENDERER( antic_mode_f_32 );
|
||||
ANTIC_RENDERER( antic_mode_f_40 );
|
||||
ANTIC_RENDERER( antic_mode_f_48 );
|
||||
ANTIC_RENDERER( gtia_mode_1_32 );
|
||||
ANTIC_RENDERER( gtia_mode_1_40 );
|
||||
ANTIC_RENDERER( gtia_mode_1_48 );
|
||||
ANTIC_RENDERER( gtia_mode_2_32 );
|
||||
ANTIC_RENDERER( gtia_mode_2_40 );
|
||||
ANTIC_RENDERER( gtia_mode_2_48 );
|
||||
ANTIC_RENDERER( gtia_mode_3_32 );
|
||||
ANTIC_RENDERER( gtia_mode_3_40 );
|
||||
ANTIC_RENDERER( gtia_mode_3_48 );
|
||||
|
||||
#endif /* ATARI_H */
|
||||
|
@ -13,14 +13,11 @@
|
||||
#include "includes/atari.h"
|
||||
#include "sound/pokey.h"
|
||||
#include "sound/dac.h"
|
||||
#include "video/gtia.h"
|
||||
|
||||
#define VERBOSE_POKEY 1
|
||||
#define VERBOSE_SERIAL 1
|
||||
#define VERBOSE_TIMERS 1
|
||||
|
||||
static void pokey_reset(running_machine &machine);
|
||||
|
||||
void atari_interrupt_cb(pokey_device *device, int mask)
|
||||
{
|
||||
if (VERBOSE_POKEY)
|
||||
@ -194,63 +191,3 @@ POKEY_KEYBOARD_HANDLER(atari_a5200_keypads)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Generic Atari Code
|
||||
*
|
||||
*************************************/
|
||||
|
||||
|
||||
static void pokey_reset(running_machine &machine)
|
||||
{
|
||||
pokey_device *pokey = downcast<pokey_device *>(machine.device("pokey"));
|
||||
pokey->write(15,0);
|
||||
}
|
||||
|
||||
|
||||
static UINT8 console_read(address_space &space)
|
||||
{
|
||||
return space.machine().root_device().ioport("console")->read();
|
||||
}
|
||||
|
||||
|
||||
static void console_write(address_space &space, UINT8 data)
|
||||
{
|
||||
dac_device *dac = space.machine().device<dac_device>("dac");
|
||||
if (data & 0x08)
|
||||
dac->write_unsigned8((UINT8)-120);
|
||||
else
|
||||
dac->write_unsigned8(+120);
|
||||
}
|
||||
|
||||
|
||||
static void _antic_reset(running_machine &machine)
|
||||
{
|
||||
antic_reset();
|
||||
}
|
||||
|
||||
|
||||
void atari_common_state::atari_machine_start()
|
||||
{
|
||||
gtia_interface gtia_intf;
|
||||
|
||||
/* GTIA */
|
||||
memset(>ia_intf, 0, sizeof(gtia_intf));
|
||||
if (machine().root_device().ioport("console") != NULL)
|
||||
gtia_intf.console_read = console_read;
|
||||
if (machine().device<dac_device>("dac") != NULL)
|
||||
gtia_intf.console_write = console_write;
|
||||
gtia_init(machine(), >ia_intf);
|
||||
|
||||
/* pokey */
|
||||
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(pokey_reset), &machine()));
|
||||
|
||||
/* ANTIC */
|
||||
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(_antic_reset), &machine()));
|
||||
|
||||
/* save states */
|
||||
machine().save().save_pointer(NAME((UINT8 *) &antic.r), sizeof(antic.r));
|
||||
machine().save().save_pointer(NAME((UINT8 *) &antic.w), sizeof(antic.w));
|
||||
}
|
||||
|
@ -20,6 +20,13 @@
|
||||
|
||||
ANTIC antic;
|
||||
|
||||
void antic_start(running_machine &machine)
|
||||
{
|
||||
/* save states */
|
||||
machine.save().save_pointer(NAME((UINT8 *) &antic.r), sizeof(antic.r));
|
||||
machine.save().save_pointer(NAME((UINT8 *) &antic.w), sizeof(antic.w));
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* Reset ANTIC
|
||||
@ -585,3 +592,75 @@ ANTIC_RENDERER( antic_mode_f_48 )
|
||||
REP48(MODEF);
|
||||
POST_GFX(48);
|
||||
}
|
||||
|
||||
/************* ANTIC mode 0F : GTIA mode 1 ********************
|
||||
* graphics mode 8x1:16 (32/40/48 byte per line)
|
||||
***************************************************************/
|
||||
#define GTIA1(s) COPY4(dst, antic.pf_gtia1[video->data[s]])
|
||||
|
||||
ANTIC_RENDERER( gtia_mode_1_32 )
|
||||
{
|
||||
PREPARE_GFXG1(space, 32);
|
||||
REP32(GTIA1);
|
||||
POST_GFX(32);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_1_40 )
|
||||
{
|
||||
PREPARE_GFXG1(space, 40);
|
||||
REP40(GTIA1);
|
||||
POST_GFX(40);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_1_48 )
|
||||
{
|
||||
PREPARE_GFXG1(space, 48);
|
||||
REP48(GTIA1);
|
||||
POST_GFX(48);
|
||||
}
|
||||
|
||||
/************* ANTIC mode 0F : GTIA mode 2 ********************
|
||||
* graphics mode 8x1:16 (32/40/48 byte per line)
|
||||
***************************************************************/
|
||||
#define GTIA2(s) COPY4(dst, antic.pf_gtia2[video->data[s]])
|
||||
|
||||
ANTIC_RENDERER( gtia_mode_2_32 )
|
||||
{
|
||||
PREPARE_GFXG2(space, 32);
|
||||
REP32(GTIA2);
|
||||
POST_GFX(32);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_2_40 )
|
||||
{
|
||||
PREPARE_GFXG2(space, 40);
|
||||
REP40(GTIA2);
|
||||
POST_GFX(40);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_2_48 )
|
||||
{
|
||||
PREPARE_GFXG2(space, 48);
|
||||
REP48(GTIA2);
|
||||
POST_GFX(48);
|
||||
}
|
||||
|
||||
/************* ANTIC mode 0F : GTIA mode 3 ********************
|
||||
* graphics mode 8x1:16 (32/40/48 byte per line)
|
||||
***************************************************************/
|
||||
#define GTIA3(s) COPY4(dst, antic.pf_gtia3[video->data[s]])
|
||||
|
||||
ANTIC_RENDERER( gtia_mode_3_32 )
|
||||
{
|
||||
PREPARE_GFXG3(space, 32);
|
||||
REP32(GTIA3);
|
||||
POST_GFX(32);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_3_40 )
|
||||
{
|
||||
PREPARE_GFXG3(space, 40);
|
||||
REP40(GTIA3);
|
||||
POST_GFX(40);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_3_48 )
|
||||
{
|
||||
PREPARE_GFXG3(space, 48);
|
||||
REP48(GTIA3);
|
||||
POST_GFX(48);
|
||||
}
|
||||
|
@ -1068,75 +1068,3 @@ void gtia_render(VIDEO *video)
|
||||
gtia.w.grafp3[1] = gtia.w.grafp3[0];
|
||||
gtia.w.grafm[1] = gtia.w.grafm[0];
|
||||
}
|
||||
|
||||
/************* ANTIC mode 0F : GTIA mode 1 ********************
|
||||
* graphics mode 8x1:16 (32/40/48 byte per line)
|
||||
***************************************************************/
|
||||
#define GTIA1(s) COPY4(dst, antic.pf_gtia1[video->data[s]])
|
||||
|
||||
ANTIC_RENDERER( gtia_mode_1_32 )
|
||||
{
|
||||
PREPARE_GFXG1(space, 32);
|
||||
REP32(GTIA1);
|
||||
POST_GFX(32);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_1_40 )
|
||||
{
|
||||
PREPARE_GFXG1(space, 40);
|
||||
REP40(GTIA1);
|
||||
POST_GFX(40);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_1_48 )
|
||||
{
|
||||
PREPARE_GFXG1(space, 48);
|
||||
REP48(GTIA1);
|
||||
POST_GFX(48);
|
||||
}
|
||||
|
||||
/************* ANTIC mode 0F : GTIA mode 2 ********************
|
||||
* graphics mode 8x1:16 (32/40/48 byte per line)
|
||||
***************************************************************/
|
||||
#define GTIA2(s) COPY4(dst, antic.pf_gtia2[video->data[s]])
|
||||
|
||||
ANTIC_RENDERER( gtia_mode_2_32 )
|
||||
{
|
||||
PREPARE_GFXG2(space, 32);
|
||||
REP32(GTIA2);
|
||||
POST_GFX(32);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_2_40 )
|
||||
{
|
||||
PREPARE_GFXG2(space, 40);
|
||||
REP40(GTIA2);
|
||||
POST_GFX(40);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_2_48 )
|
||||
{
|
||||
PREPARE_GFXG2(space, 48);
|
||||
REP48(GTIA2);
|
||||
POST_GFX(48);
|
||||
}
|
||||
|
||||
/************* ANTIC mode 0F : GTIA mode 3 ********************
|
||||
* graphics mode 8x1:16 (32/40/48 byte per line)
|
||||
***************************************************************/
|
||||
#define GTIA3(s) COPY4(dst, antic.pf_gtia3[video->data[s]])
|
||||
|
||||
ANTIC_RENDERER( gtia_mode_3_32 )
|
||||
{
|
||||
PREPARE_GFXG3(space, 32);
|
||||
REP32(GTIA3);
|
||||
POST_GFX(32);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_3_40 )
|
||||
{
|
||||
PREPARE_GFXG3(space, 40);
|
||||
REP40(GTIA3);
|
||||
POST_GFX(40);
|
||||
}
|
||||
ANTIC_RENDERER( gtia_mode_3_48 )
|
||||
{
|
||||
PREPARE_GFXG3(space, 48);
|
||||
REP48(GTIA3);
|
||||
POST_GFX(48);
|
||||
}
|
||||
|
@ -135,15 +135,6 @@ extern gtia_struct gtia;
|
||||
|
||||
void gtia_init(running_machine &machine, const gtia_interface *intf);
|
||||
|
||||
ANTIC_RENDERER( gtia_mode_1_32 );
|
||||
ANTIC_RENDERER( gtia_mode_1_40 );
|
||||
ANTIC_RENDERER( gtia_mode_1_48 );
|
||||
ANTIC_RENDERER( gtia_mode_2_32 );
|
||||
ANTIC_RENDERER( gtia_mode_2_40 );
|
||||
ANTIC_RENDERER( gtia_mode_2_48 );
|
||||
ANTIC_RENDERER( gtia_mode_3_32 );
|
||||
ANTIC_RENDERER( gtia_mode_3_40 );
|
||||
ANTIC_RENDERER( gtia_mode_3_48 );
|
||||
void gtia_render(VIDEO *video);
|
||||
|
||||
#endif /* __GTIA_H__ */
|
||||
|
@ -260,7 +260,9 @@ public:
|
||||
DECLARE_MACHINE_START(a800xl);
|
||||
DECLARE_MACHINE_START(a5200);
|
||||
DECLARE_PALETTE_INIT(a400);
|
||||
|
||||
|
||||
DECLARE_MACHINE_RESET(a400);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(a600xl_pia_pb_w);
|
||||
DECLARE_WRITE8_MEMBER(a800xl_pia_pb_w);
|
||||
|
||||
@ -299,6 +301,10 @@ protected:
|
||||
|
||||
void setup_ram(int bank,UINT32 size);
|
||||
void setup_cart(int type);
|
||||
|
||||
// start helper (until GTIA & ANTIC are device-fied)
|
||||
void common_start();
|
||||
void a5200_start();
|
||||
};
|
||||
|
||||
|
||||
@ -1857,10 +1863,55 @@ void a400_state::setup_cart(int type)
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 console_read(address_space &space)
|
||||
{
|
||||
return space.machine().root_device().ioport("console")->read();
|
||||
}
|
||||
|
||||
static void console_write(address_space &space, UINT8 data)
|
||||
{
|
||||
dac_device *dac = space.machine().device<dac_device>("dac");
|
||||
if (data & 0x08)
|
||||
dac->write_unsigned8((UINT8)-120);
|
||||
else
|
||||
dac->write_unsigned8(+120);
|
||||
}
|
||||
|
||||
|
||||
void a400_state::common_start()
|
||||
{
|
||||
/* GTIA */
|
||||
gtia_interface gtia_intf;
|
||||
gtia_intf.console_read = console_read;
|
||||
gtia_intf.console_write = console_write;
|
||||
gtia_init(machine(), >ia_intf);
|
||||
|
||||
/* ANTIC */
|
||||
antic_start(machine());
|
||||
}
|
||||
|
||||
void a400_state::a5200_start()
|
||||
{
|
||||
/* GTIA */
|
||||
gtia_interface gtia_intf;
|
||||
memset(>ia_intf, 0, sizeof(gtia_intf));
|
||||
gtia_init(machine(), >ia_intf);
|
||||
|
||||
/* ANTIC */
|
||||
antic_start(machine());
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER( a400_state, a400 )
|
||||
{
|
||||
pokey_device *pokey = machine().device<pokey_device>("pokey");
|
||||
pokey->write(15,0);
|
||||
antic_reset();
|
||||
}
|
||||
|
||||
|
||||
MACHINE_START_MEMBER( a400_state, a400 )
|
||||
{
|
||||
atari_machine_start();
|
||||
common_start();
|
||||
setup_ram(0, m_ram->size());
|
||||
setup_ram(1, m_ram->size());
|
||||
setup_ram(2, m_ram->size());
|
||||
@ -1873,7 +1924,7 @@ MACHINE_START_MEMBER( a400_state, a400 )
|
||||
|
||||
MACHINE_START_MEMBER( a400_state, a800 )
|
||||
{
|
||||
atari_machine_start();
|
||||
common_start();
|
||||
setup_ram(0, m_ram->size());
|
||||
setup_ram(1, m_ram->size());
|
||||
setup_ram(2, m_ram->size());
|
||||
@ -1888,7 +1939,7 @@ MACHINE_START_MEMBER( a400_state, a800xl )
|
||||
{
|
||||
m_mmu = 0xfd;
|
||||
m_ext_bank = 0x03; // only used by a130xe
|
||||
atari_machine_start();
|
||||
common_start();
|
||||
setup_cart(m_cartslot->get_cart_type());
|
||||
|
||||
save_item(NAME(m_cart_disabled));
|
||||
@ -1900,7 +1951,7 @@ MACHINE_START_MEMBER( a400_state, a800xl )
|
||||
|
||||
MACHINE_START_MEMBER( a400_state, a5200 )
|
||||
{
|
||||
atari_machine_start();
|
||||
a5200_start();
|
||||
setup_cart(m_cartslot->get_cart_type());
|
||||
|
||||
save_item(NAME(m_cart_disabled));
|
||||
@ -1947,6 +1998,8 @@ static MACHINE_CONFIG_START( atari_common_nodac, a400_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
|
||||
|
||||
MCFG_MACHINE_RESET_OVERRIDE( a400_state, a400 )
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1))
|
||||
|
Loading…
Reference in New Issue
Block a user