removed some atari legacy code (nw)

This commit is contained in:
Miodrag Milanovic 2014-03-17 15:15:01 +00:00
parent 841b2cb5e9
commit cf9949729c
8 changed files with 170 additions and 192 deletions

View File

@ -17,12 +17,6 @@
// MACROS
//**************************************************************************
#define MCFG_MACHINE_START(_func) \
driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_START, MACHINE_START_NAME(_func));
#define MCFG_MACHINE_RESET(_func) \
driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_RESET, MACHINE_RESET_NAME(_func));
#define MCFG_VIDEO_START(_func) \
driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_START, VIDEO_START_NAME(_func));

View File

@ -21,15 +21,13 @@
#include "sound/speaker.h"
#include "sound/pokey.h"
#include "video/gtia.h"
#include "drivlgcy.h"
#include "scrlegcy.h"
class bartop52_state : public driver_device
class bartop52_state : public atari_common_state
{
public:
bartop52_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
: atari_common_state(mconfig, type, tag),
m_maincpu(*this, "maincpu") { }
required_device<cpu_device> m_maincpu;
@ -123,7 +121,7 @@ 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_ADD_SCANLINE("scantimer", a5200_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a5200_interrupt, "screen", 0, 1)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@ -131,13 +129,11 @@ static MACHINE_CONFIG_START( a5200, bartop52_state )
MCFG_SCREEN_VISIBLE_AREA(MIN_X, MAX_X, MIN_Y, MAX_Y)
MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ)
MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ)
MCFG_SCREEN_UPDATE_STATIC(atari)
MCFG_SCREEN_UPDATE_DRIVER(atari_common_state, screen_update_atari)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 256)
MCFG_PALETTE_INIT_LEGACY(atari)
MCFG_VIDEO_START(atari)
MCFG_PALETTE_INIT_OWNER(atari_common_state, atari)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -18,17 +18,15 @@
#include "sound/pokey.h"
#include "machine/6821pia.h"
#include "video/gtia.h"
#include "drivlgcy.h"
#include "scrlegcy.h"
#include "maxaflex.lh"
class maxaflex_state : public driver_device
class maxaflex_state : public atari_common_state
{
public:
maxaflex_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
: atari_common_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_mcu(*this, "mcu"),
m_speaker(*this, "speaker") { }
@ -62,12 +60,13 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
DECLARE_READ8_MEMBER(maxaflex_atari_pia_pa_r);
DECLARE_READ8_MEMBER(maxaflex_atari_pia_pb_r);
WRITE8_MEMBER(a600xl_pia_pb_w) { a600xl_mmu(machine(), data); }
WRITE8_MEMBER(a600xl_pia_pb_w) { a600xl_mmu(data); }
WRITE_LINE_MEMBER(atari_pia_cb2_w) { } // This is used by Floppy drive on Atari 8bits Home Computers
DECLARE_DRIVER_INIT(a600xl);
DECLARE_MACHINE_RESET(supervisor_board);
TIMER_DEVICE_CALLBACK_MEMBER(mcu_timer_proc);
int atari_input_disabled();
virtual void machine_start();
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_mcu;
required_device<speaker_sound_device> m_speaker;
@ -392,12 +391,16 @@ READ8_MEMBER(maxaflex_state::maxaflex_atari_pia_pb_r)
}
void maxaflex_state::machine_start()
{
atari_machine_start();
}
static MACHINE_CONFIG_START( a600xl, maxaflex_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
MCFG_CPU_PROGRAM_MAP(a600xl_mem)
MCFG_TIMER_ADD_SCANLINE("scantimer", a800xl_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800xl_interrupt, "screen", 0, 1)
MCFG_CPU_ADD("mcu", M68705, 3579545)
MCFG_CPU_PROGRAM_MAP(mcu_mem)
@ -416,15 +419,13 @@ static MACHINE_CONFIG_START( a600xl, maxaflex_state )
MCFG_SCREEN_VISIBLE_AREA(MIN_X, MAX_X, MIN_Y, MAX_Y)
MCFG_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ)
MCFG_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ)
MCFG_SCREEN_UPDATE_STATIC(atari)
MCFG_SCREEN_UPDATE_DRIVER(atari_common_state, screen_update_atari)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 256)
MCFG_PALETTE_INIT_LEGACY(atari)
MCFG_PALETTE_INIT_OWNER(atari_common_state, atari)
MCFG_DEFAULT_LAYOUT(layout_maxaflex)
MCFG_VIDEO_START(atari)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -437,8 +438,6 @@ static MACHINE_CONFIG_START( a600xl, maxaflex_state )
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_MACHINE_START( atarixl )
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( maxaflex, a600xl )

View File

@ -15,18 +15,49 @@
#include "machine/6821pia.h"
#include "sound/pokey.h"
/*----------- defined in machine/atari.c -----------*/
void a600xl_mmu(running_machine &machine, UINT8 new_mmu);
class atari_common_state : public driver_device
{
public:
atari_common_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
tv_artifacts(0) { }
void a600xl_mmu(UINT8 new_mmu);
/* This is needed in MESS as well for Atari 8bit drivers */
void atari_machine_start(running_machine &machine);
/* This is needed in MESS as well for Atari 8bit drivers */
void atari_machine_start();
MACHINE_START( atarixl );
virtual void video_start();
UINT32 screen_update_atari(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
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);
private:
UINT32 tv_artifacts ;
void prio_init();
void cclk_init();
void artifacts_gfx(UINT8 *src, UINT8 *dst, int width);
void artifacts_txt(UINT8 * src, UINT8 * dst, int width);
void antic_linerefresh();
int cycle();
void after(int cycles, timer_expired_delegate function);
TIMER_CALLBACK_MEMBER( antic_issue_dli );
TIMER_CALLBACK_MEMBER( antic_line_done );
TIMER_CALLBACK_MEMBER( antic_steal_cycles );
TIMER_CALLBACK_MEMBER( antic_scanline_render );
inline void LMS(int new_cmd);
void antic_scanline_dma(int param);
void generic_atari_interrupt(int button_count);
};
void atari_interrupt_cb(pokey_device *device, int mask);
POKEY_KEYBOARD_HANDLER(atari_a800_keyboard);
POKEY_KEYBOARD_HANDLER(atari_a5200_keypads);
@ -578,19 +609,4 @@ ANTIC_RENDERER( antic_mode_f_32 );
ANTIC_RENDERER( antic_mode_f_40 );
ANTIC_RENDERER( antic_mode_f_48 );
/*----------- defined in video/atari.c -----------*/
extern char atari_frame_message[64+1];
extern int atari_frame_counter;
extern VIDEO_START( atari );
extern SCREEN_UPDATE_IND16( atari );
TIMER_DEVICE_CALLBACK( a400_interrupt );
TIMER_DEVICE_CALLBACK( a800_interrupt );
TIMER_DEVICE_CALLBACK( a800xl_interrupt );
TIMER_DEVICE_CALLBACK( a5200_interrupt );
extern PALETTE_INIT( atari );
#endif /* ATARI_H */

View File

@ -58,20 +58,20 @@ void atari_interrupt_cb(pokey_device *device, int mask)
*
**************************************************************/
void a600xl_mmu(running_machine &machine, UINT8 new_mmu)
void atari_common_state::a600xl_mmu(UINT8 new_mmu)
{
/* check if self-test ROM changed */
if ( new_mmu & 0x80 )
{
logerror("%s MMU SELFTEST RAM\n", machine.system().name);
machine.device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x5000, 0x57ff);
logerror("%s MMU SELFTEST RAM\n", machine().system().name);
machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x5000, 0x57ff);
}
else
{
logerror("%s MMU SELFTEST ROM\n", machine.system().name);
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5000, 0x57ff, "bank2");
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x5000, 0x57ff);
machine.root_device().membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x5000);
logerror("%s MMU SELFTEST ROM\n", machine().system().name);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5000, 0x57ff, "bank2");
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x5000, 0x57ff);
machine().root_device().membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x5000);
}
}
@ -256,37 +256,26 @@ static void _antic_reset(running_machine &machine)
}
void atari_machine_start(running_machine &machine)
void atari_common_state::atari_machine_start()
{
gtia_interface gtia_intf;
/* GTIA */
memset(&gtia_intf, 0, sizeof(gtia_intf));
if (machine.root_device().ioport("console") != NULL)
if (machine().root_device().ioport("console") != NULL)
gtia_intf.console_read = console_read;
if (machine.device<dac_device>("dac") != NULL)
if (machine().device<dac_device>("dac") != NULL)
gtia_intf.console_write = console_write;
gtia_init(machine, &gtia_intf);
gtia_init(machine(), &gtia_intf);
/* pokey */
machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(pokey_reset), &machine));
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));
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));
machine().save().save_pointer(NAME((UINT8 *) &antic.r), sizeof(antic.r));
machine().save().save_pointer(NAME((UINT8 *) &antic.w), sizeof(antic.w));
}
/*************************************
*
* Atari 600XL
*
*************************************/
MACHINE_START( atarixl )
{
atari_machine_start(machine);
}

View File

@ -14,12 +14,6 @@
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
char atari_frame_message[64+1];
int atari_frame_counter;
/* flag for displaying television artifacts in ANTIC mode F (15) */
static UINT32 tv_artifacts = 0;
/*************************************************************************
* The priority tables tell which playfield, player or missile colors
* have precedence about the others, depending on the contents of the
@ -410,7 +404,7 @@ static const UINT8 _pm_colors[32][8*2*8] = {
* prio_init
* Initialize player/missile priority lookup tables
************************************************************************/
static void prio_init(void)
void atari_common_state::prio_init()
{
int i, j, pm, p, c;
const UINT8 * prio;
@ -448,7 +442,7 @@ static void prio_init(void)
* cclk_init
* Initialize "color clock" lookup tables
************************************************************************/
static void cclk_init(void)
void atari_common_state::cclk_init()
{
static const UINT8 _pf_21[4] = {T00,T01,T10,T11};
static const UINT8 _pf_1b[4] = {G00,G01,G10,G11};
@ -706,18 +700,18 @@ static void cclk_init(void)
* atari_vh_start
* Initialize the ATARI800 video emulation
************************************************************************/
VIDEO_START( atari )
void atari_common_state::video_start()
{
palette_device *m_palette = machine.first_screen()->palette();
palette_device *m_palette = machine().first_screen()->palette();
int i;
LOG(("atari antic_vh_start\n"));
memset(&antic, 0, sizeof(antic));
antic.bitmap = auto_bitmap_ind16_alloc(machine, machine.first_screen()->width(), machine.first_screen()->height());
antic.bitmap = auto_bitmap_ind16_alloc(machine(), machine().first_screen()->width(), machine().first_screen()->height());
antic.renderer = antic_mode_0_xx;
antic.cclk_expand = auto_alloc_array(machine, UINT32, 21 * 256);
antic.cclk_expand = auto_alloc_array(machine(), UINT32, 21 * 256);
antic.pf_21 = &antic.cclk_expand[ 0 * 256];
antic.pf_x10b = &antic.cclk_expand[ 1 * 256];
@ -729,7 +723,7 @@ VIDEO_START( atari )
antic.pf_gtia2 = &antic.cclk_expand[19 * 256];
antic.pf_gtia3 = &antic.cclk_expand[20 * 256];
antic.used_colors = auto_alloc_array(machine, UINT8, 21 * 256);
antic.used_colors = auto_alloc_array(machine(), UINT8, 21 * 256);
memset(antic.used_colors, 0, 21 * 256 * sizeof(UINT8));
@ -752,15 +746,15 @@ VIDEO_START( atari )
for( i = 0; i < 64; i++ )
{
antic.prio_table[i] = auto_alloc_array(machine, UINT8, 8*256);
antic.prio_table[i] = auto_alloc_array(machine(), UINT8, 8*256);
}
LOG(("atari prio_init\n"));
prio_init();
for( i = 0; i < machine.first_screen()->height(); i++ )
for( i = 0; i < machine().first_screen()->height(); i++ )
{
antic.video[i] = auto_alloc_clear(machine, VIDEO);
antic.video[i] = auto_alloc_clear(machine(), VIDEO);
}
}
@ -769,7 +763,7 @@ VIDEO_START( atari )
* Refresh screen bitmap.
* Note: Actual drawing is done scanline wise during atari_interrupt
************************************************************************/
SCREEN_UPDATE_IND16( atari )
UINT32 atari_common_state::screen_update_atari(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
UINT32 new_tv_artifacts;
@ -780,17 +774,11 @@ SCREEN_UPDATE_IND16( atari )
{
tv_artifacts = new_tv_artifacts;
}
if( atari_frame_counter > 0 )
{
if( --atari_frame_counter )
{
// ui_draw_text(atari_frame_message, 0, height - 10);
}
}
return 0;
}
static void artifacts_gfx(UINT8 *src, UINT8 *dst, int width)
void atari_common_state::artifacts_gfx(UINT8 *src, UINT8 *dst, int width)
{
int x;
UINT8 n, bits = 0;
@ -864,7 +852,7 @@ static void artifacts_gfx(UINT8 *src, UINT8 *dst, int width)
}
}
static void artifacts_txt(UINT8 * src, UINT8 * dst, int width)
void atari_common_state::artifacts_txt(UINT8 * src, UINT8 * dst, int width)
{
int x;
UINT8 n, bits = 0;
@ -939,7 +927,7 @@ static void artifacts_txt(UINT8 * src, UINT8 * dst, int width)
}
static void antic_linerefresh(running_machine &machine)
void atari_common_state::antic_linerefresh()
{
int x, y;
UINT8 *src;
@ -947,7 +935,7 @@ static void antic_linerefresh(running_machine &machine)
UINT32 scanline[4 + (HCHARS * 2) + 4];
/* increment the scanline */
if( ++antic.scanline == machine.first_screen()->height() )
if( ++antic.scanline == machine().first_screen()->height() )
{
/* and return to the top if the frame was complete */
antic.scanline = 0;
@ -1047,30 +1035,30 @@ static void antic_linerefresh(running_machine &machine)
draw_scanline8(*antic.bitmap, 12, y, MIN(antic.bitmap->width() - 12, sizeof(scanline)), (const UINT8 *) scanline, NULL);
}
static int cycle(running_machine &machine)
int atari_common_state::cycle()
{
return machine.first_screen()->hpos() * CYCLES_PER_LINE / machine.first_screen()->width();
return machine().first_screen()->hpos() * CYCLES_PER_LINE / machine().first_screen()->width();
}
static void after(running_machine &machine, int cycles, timer_expired_func function, const char *funcname)
void atari_common_state::after(int cycles, timer_expired_delegate function)
{
attotime duration = machine.first_screen()->scan_period() * cycles / CYCLES_PER_LINE;
(void)funcname;
LOG((" after %3d (%5.1f us) %s\n", cycles, duration.as_double() * 1.0e6, funcname));
machine.scheduler().timer_set(duration, function, funcname);
attotime duration = machine().first_screen()->scan_period() * cycles / CYCLES_PER_LINE;
//(void)funcname;
//LOG((" after %3d (%5.1f us) %s\n", cycles, duration.as_double() * 1.0e6, funcname));
machine().scheduler().timer_set(duration, function);
}
static TIMER_CALLBACK( antic_issue_dli )
TIMER_CALLBACK_MEMBER( atari_common_state::antic_issue_dli )
{
if( antic.w.nmien & DLI_NMI )
{
LOG((" @cycle #%3d issue DLI\n", cycle(machine)));
LOG((" @cycle #%3d issue DLI\n", cycle()));
antic.r.nmist |= DLI_NMI;
machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
else
{
LOG((" @cycle #%3d DLI not enabled\n", cycle(machine)));
LOG((" @cycle #%3d DLI not enabled\n", cycle()));
}
}
@ -1128,23 +1116,23 @@ static const atari_renderer_func renderer[2][19][5] = {
* Antic Line Done
*
*****************************************************************************/
static TIMER_CALLBACK( antic_line_done )
TIMER_CALLBACK_MEMBER( atari_common_state::antic_line_done )
{
LOG((" @cycle #%3d antic_line_done\n", cycle(machine)));
LOG((" @cycle #%3d antic_line_done\n", cycle()));
if( antic.w.wsync )
{
LOG((" @cycle #%3d release WSYNC\n", cycle(machine)));
LOG((" @cycle #%3d release WSYNC\n", cycle()));
/* release the CPU if it was actually waiting for HSYNC */
machine.scheduler().trigger(TRIGGER_HSYNC);
machine().scheduler().trigger(TRIGGER_HSYNC);
/* and turn off the 'wait for hsync' flag */
antic.w.wsync = 0;
}
LOG((" @cycle #%3d release CPU\n", cycle(machine)));
LOG((" @cycle #%3d release CPU\n", cycle()));
/* release the CPU (held for emulating cycles stolen by ANTIC DMA) */
machine.scheduler().trigger(TRIGGER_STEAL);
machine().scheduler().trigger(TRIGGER_STEAL);
/* refresh the display (translate color clocks to pixels) */
antic_linerefresh(machine);
antic_linerefresh();
}
/*****************************************************************************
@ -1156,12 +1144,12 @@ static TIMER_CALLBACK( antic_line_done )
* TRIGGER_HSYNC if WSYNC (D01A) was accessed
*
*****************************************************************************/
static TIMER_CALLBACK( antic_steal_cycles )
TIMER_CALLBACK_MEMBER( atari_common_state::antic_steal_cycles )
{
LOG((" @cycle #%3d steal %d cycles\n", cycle(machine), antic.steal_cycles));
after(machine, antic.steal_cycles, FUNC(antic_line_done));
LOG((" @cycle #%3d steal %d cycles\n", cycle(), antic.steal_cycles));
after(antic.steal_cycles, timer_expired_delegate(FUNC(atari_common_state::antic_line_done),this));
antic.steal_cycles = 0;
machine.device("maincpu")->execute().spin_until_trigger(TRIGGER_STEAL );
machine().device("maincpu")->execute().spin_until_trigger(TRIGGER_STEAL );
}
@ -1173,12 +1161,12 @@ static TIMER_CALLBACK( antic_steal_cycles )
* of the GTIA if enabled (DMA_PLAYER or DMA_MISSILE)
*
*****************************************************************************/
static TIMER_CALLBACK( antic_scanline_render )
TIMER_CALLBACK_MEMBER( atari_common_state::antic_scanline_render )
{
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
VIDEO *video = antic.video[antic.scanline];
LOG((" @cycle #%3d render mode $%X lines to go #%d\n", cycle(machine), (antic.cmd & 0x0f), antic.modelines));
LOG((" @cycle #%3d render mode $%X lines to go #%d\n", cycle(), (antic.cmd & 0x0f), antic.modelines));
(*antic.renderer)(space, video);
@ -1230,12 +1218,12 @@ static TIMER_CALLBACK( antic_scanline_render )
antic.steal_cycles += CYCLES_REFRESH;
LOG((" run CPU for %d cycles\n", CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles));
after(machine, CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles, FUNC(antic_steal_cycles));
after(CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles, timer_expired_delegate(FUNC(atari_common_state::antic_steal_cycles),this));
}
INLINE void LMS(running_machine &machine, int new_cmd)
void atari_common_state::LMS(int new_cmd)
{
/**************************************************************
* If the LMS bit (load memory scan) of the current display
@ -1245,7 +1233,7 @@ INLINE void LMS(running_machine &machine, int new_cmd)
**************************************************************/
if( new_cmd & ANTIC_LMS )
{
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
int addr = RDANTIC(space);
antic.doffs = (antic.doffs + 1) & DOFFS;
addr += 256 * RDANTIC(space);
@ -1268,10 +1256,10 @@ INLINE void LMS(running_machine &machine, int new_cmd)
* if so, read a new command and set up the renderer function
*
*****************************************************************************/
static void antic_scanline_dma(running_machine &machine, int param)
void atari_common_state::antic_scanline_dma(int param)
{
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
LOG((" @cycle #%3d DMA fetch\n", cycle(machine)));
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
LOG((" @cycle #%3d DMA fetch\n", cycle()));
if (antic.scanline == VBL_END)
antic.r.nmist &= ~VBL_NMI;
if( antic.w.dmactl & DMA_ANTIC )
@ -1342,7 +1330,7 @@ static void antic_scanline_dma(running_machine &machine, int param)
{
/* remove the DLI bit */
new_cmd &= ~ANTIC_DLI;
after(machine, CYCLES_DLI_NMI, FUNC(antic_issue_dli));
after(CYCLES_DLI_NMI, timer_expired_delegate(FUNC(atari_common_state::antic_issue_dli),this));
}
/* load memory scan bit set ? */
if( new_cmd & ANTIC_LMS )
@ -1355,7 +1343,7 @@ static void antic_scanline_dma(running_machine &machine, int param)
/* produce empty scanlines until vblank start */
antic.modelines = VBL_START + 1 - antic.scanline;
if( antic.modelines < 0 )
antic.modelines = machine.first_screen()->height() - antic.scanline;
antic.modelines = machine().first_screen()->height() - antic.scanline;
LOG((" JVB $%04x\n", antic.dpage|antic.doffs));
}
else
@ -1371,77 +1359,77 @@ static void antic_scanline_dma(running_machine &machine, int param)
}
break;
case 0x02:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.chbase = (antic.w.chbash & 0xfc) << 8;
antic.modelines = 8 - (vscrol_subtract & 7);
if( antic.w.chactl & 4 ) /* decrement chbasl? */
antic.w.chbasl = antic.modelines - 1;
break;
case 0x03:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.chbase = (antic.w.chbash & 0xfc) << 8;
antic.modelines = 10 - (vscrol_subtract & 9);
if( antic.w.chactl & 4 ) /* decrement chbasl? */
antic.w.chbasl = antic.modelines - 1;
break;
case 0x04:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.chbase = (antic.w.chbash & 0xfc) << 8;
antic.modelines = 8 - (vscrol_subtract & 7);
if( antic.w.chactl & 4 ) /* decrement chbasl? */
antic.w.chbasl = antic.modelines - 1;
break;
case 0x05:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.chbase = (antic.w.chbash & 0xfc) << 8;
antic.modelines = 16 - (vscrol_subtract & 15);
if( antic.w.chactl & 4 ) /* decrement chbasl? */
antic.w.chbasl = antic.modelines - 1;
break;
case 0x06:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.chbase = (antic.w.chbash & 0xfe) << 8;
antic.modelines = 8 - (vscrol_subtract & 7);
if( antic.w.chactl & 4 ) /* decrement chbasl? */
antic.w.chbasl = antic.modelines - 1;
break;
case 0x07:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.chbase = (antic.w.chbash & 0xfe) << 8;
antic.modelines = 16 - (vscrol_subtract & 15);
if( antic.w.chactl & 4 ) /* decrement chbasl? */
antic.w.chbasl = antic.modelines - 1;
break;
case 0x08:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.modelines = 8 - (vscrol_subtract & 7);
break;
case 0x09:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.modelines = 4 - (vscrol_subtract & 3);
break;
case 0x0a:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.modelines = 4 - (vscrol_subtract & 3);
break;
case 0x0b:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.modelines = 2 - (vscrol_subtract & 1);
break;
case 0x0c:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.modelines = 1;
break;
case 0x0d:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.modelines = 2 - (vscrol_subtract & 1);
break;
case 0x0e:
LMS(machine, new_cmd);
LMS(new_cmd);
antic.modelines = 1;
break;
case 0x0f:
LMS(machine, new_cmd);
LMS(new_cmd);
/* bits 6+7 of the priority select register determine */
/* if newer GTIA or plain graphics modes are used */
switch (gtia.w.prior >> 6)
@ -1474,9 +1462,9 @@ static void antic_scanline_dma(running_machine &machine, int param)
antic.r.nmist &= ~DLI_NMI;
if( antic.modelines == 1 && (antic.cmd & antic.w.nmien & DLI_NMI) )
after(machine, CYCLES_DLI_NMI, FUNC(antic_issue_dli));
after(CYCLES_DLI_NMI, timer_expired_delegate(FUNC(atari_common_state::antic_issue_dli),this));
after(machine, CYCLES_HSTART, FUNC(antic_scanline_render));
after(CYCLES_HSTART, timer_expired_delegate(FUNC(atari_common_state::antic_scanline_render),this));
}
/*****************************************************************************
@ -1488,21 +1476,21 @@ static void antic_scanline_dma(running_machine &machine, int param)
*
*****************************************************************************/
static void generic_atari_interrupt(running_machine &machine, int button_count)
void atari_common_state::generic_atari_interrupt(int button_count)
{
int button_port, i;
LOG(("ANTIC #%3d @cycle #%d scanline interrupt\n", antic.scanline, cycle(machine)));
LOG(("ANTIC #%3d @cycle #%d scanline interrupt\n", antic.scanline, cycle()));
if( antic.scanline < VBL_START )
{
antic_scanline_dma(machine, 0);
antic_scanline_dma(0);
return;
}
if( antic.scanline == VBL_START )
{
button_port = machine.root_device().ioport("djoy_b")->read_safe(0);
button_port = machine().root_device().ioport("djoy_b")->read_safe(0);
/* specify buttons relevant to this Atari variant */
for (i = 0; i < button_count; i++)
@ -1520,7 +1508,7 @@ static void generic_atari_interrupt(running_machine &machine, int button_count)
}
/* do nothing new for the rest of the frame */
antic.modelines = machine.first_screen()->height() - VBL_START;
antic.modelines = machine().first_screen()->height() - VBL_START;
antic.renderer = antic_mode_0_xx;
/* if the CPU want's to be interrupted at vertical blank... */
@ -1529,34 +1517,34 @@ static void generic_atari_interrupt(running_machine &machine, int button_count)
LOG((" cause VBL NMI\n"));
/* set the VBL NMI status bit */
antic.r.nmist |= VBL_NMI;
machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
}
/* refresh the display (translate color clocks to pixels) */
antic_linerefresh(machine);
antic_linerefresh();
}
TIMER_DEVICE_CALLBACK( a400_interrupt )
TIMER_DEVICE_CALLBACK_MEMBER( atari_common_state::a400_interrupt )
{
generic_atari_interrupt(timer.machine(), 4);
generic_atari_interrupt(4);
}
TIMER_DEVICE_CALLBACK( a800_interrupt )
TIMER_DEVICE_CALLBACK_MEMBER( atari_common_state::a800_interrupt )
{
generic_atari_interrupt(timer.machine(), 4);
generic_atari_interrupt(4);
}
TIMER_DEVICE_CALLBACK( a800xl_interrupt )
TIMER_DEVICE_CALLBACK_MEMBER( atari_common_state::a800xl_interrupt )
{
generic_atari_interrupt(timer.machine(), 2);
generic_atari_interrupt(2);
}
TIMER_DEVICE_CALLBACK( a5200_interrupt )
TIMER_DEVICE_CALLBACK_MEMBER( atari_common_state::a5200_interrupt )
{
generic_atari_interrupt(timer.machine(), 4);
generic_atari_interrupt(4);
}
/**************************************************************
@ -1651,7 +1639,7 @@ static const UINT8 atari_palette[256*3] =
/* Initialise the palette */
PALETTE_INIT( atari )
PALETTE_INIT_MEMBER(atari_common_state, atari)
{
int i;

View File

@ -49,8 +49,6 @@
#include "sound/dac.h"
#include "machine/ram.h"
#include "hashfile.h"
#include "drivlgcy.h"
#include "scrlegcy.h"
#define ATARI_5200 0
#define ATARI_400 1
@ -262,11 +260,11 @@ enum
};
class a400_state : public driver_device
class a400_state : public atari_common_state
{
public:
a400_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
: atari_common_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ram(*this, RAM_TAG),
m_pia(*this, "pia"),
@ -326,7 +324,7 @@ public:
void ms_atari_machine_start(int type, int has_cart);
void ms_atari800xl_machine_start(int type, int has_cart);
WRITE8_MEMBER(a600xl_pia_pb_w) { a600xl_mmu(machine(), data); }
WRITE8_MEMBER(a600xl_pia_pb_w) { a600xl_mmu(data); }
protected:
required_device<cpu_device> m_maincpu;
@ -2000,7 +1998,7 @@ MACHINE_START_MEMBER( a400_state, xegs )
UINT8 *cart = m_region_user1->base();
UINT8 *cpu = m_region_maincpu->base();
atari_machine_start(machine());
atari_machine_start();
space.install_write_handler(0xd500, 0xd5ff, write8_delegate(FUNC(a400_state::xegs_bankswitch),this));
if (m_xegs_cart)
@ -2344,28 +2342,28 @@ DEVICE_IMAGE_UNLOAD_MEMBER( a400_state, xegs_cart )
MACHINE_START_MEMBER( a400_state, a400 )
{
atari_machine_start(machine());
atari_machine_start();
ms_atari_machine_start(ATARI_400, TRUE);
}
MACHINE_START_MEMBER( a400_state, a800 )
{
atari_machine_start(machine());
atari_machine_start();
ms_atari_machine_start(ATARI_800, TRUE);
}
MACHINE_START_MEMBER( a400_state, a800xl )
{
atari_machine_start(machine());
atari_machine_start();
ms_atari800xl_machine_start(ATARI_800XL, TRUE);
}
MACHINE_START_MEMBER( a400_state, a5200 )
{
atari_machine_start(machine());
atari_machine_start();
ms_atari_machine_start(ATARI_800XL, TRUE);
}
@ -2481,14 +2479,12 @@ static MACHINE_CONFIG_START( atari_common_nodac, a400_state )
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1))
MCFG_SCREEN_VISIBLE_AREA(MIN_X, MAX_X, MIN_Y, MAX_Y)
MCFG_SCREEN_UPDATE_STATIC(atari)
MCFG_SCREEN_UPDATE_DRIVER(atari_common_state, screen_update_atari)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", sizeof(atari_palette) / 3)
MCFG_PALETTE_INIT_OWNER(a400_state, a400)
MCFG_VIDEO_START(atari)
MCFG_DEVICE_ADD("pia", PIA6821, 0)
MCFG_PIA_READPA_HANDLER(IOPORT("djoy_0_1"))
MCFG_PIA_READPB_HANDLER(IOPORT("djoy_2_3"))
@ -2522,7 +2518,7 @@ static MACHINE_CONFIG_DERIVED( a400, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a400_mem)
MCFG_TIMER_ADD_SCANLINE("scantimer", a400_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a400_interrupt, "screen", 0, 1)
MCFG_MACHINE_START_OVERRIDE( a400_state, a400 )
@ -2541,7 +2537,7 @@ static MACHINE_CONFIG_DERIVED( a400pal, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a400_mem)
MCFG_TIMER_ADD_SCANLINE("scantimer", a400_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a400_interrupt, "screen", 0, 1)
MCFG_MACHINE_START_OVERRIDE( a400_state, a400 )
@ -2560,7 +2556,7 @@ static MACHINE_CONFIG_DERIVED( a800, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a800_mem)
MCFG_TIMER_ADD_SCANLINE("scantimer", a800_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800_interrupt, "screen", 0, 1)
MCFG_MACHINE_START_OVERRIDE( a400_state, a800 )
@ -2579,7 +2575,7 @@ static MACHINE_CONFIG_DERIVED( a800pal, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a800_mem)
MCFG_TIMER_ADD_SCANLINE("scantimer", a800_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800_interrupt, "screen", 0, 1)
MCFG_MACHINE_START_OVERRIDE( a400_state, a800 )
@ -2598,7 +2594,7 @@ static MACHINE_CONFIG_DERIVED( a600xl, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a600xl_mem) // FIXME?
MCFG_TIMER_ADD_SCANLINE("scantimer", a800xl_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800xl_interrupt, "screen", 0, 1)
MCFG_DEVICE_MODIFY("pia")
MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a600xl_pia_pb_w))
@ -2624,7 +2620,7 @@ static MACHINE_CONFIG_DERIVED( a800xl, atari_common )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a800xl_mem)
MCFG_TIMER_ADD_SCANLINE("scantimer", a800xl_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a800xl_interrupt, "screen", 0, 1)
MCFG_DEVICE_MODIFY("pia")
MCFG_PIA_WRITEPB_HANDLER(WRITE8(a400_state, a800xl_pia_pb_w))
@ -2690,7 +2686,7 @@ static MACHINE_CONFIG_DERIVED( a5200, atari_common_nodac )
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_PROGRAM_MAP(a5200_mem)
MCFG_TIMER_ADD_SCANLINE("scantimer", a5200_interrupt, "screen", 0, 1)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", atari_common_state, a5200_interrupt, "screen", 0, 1)
MCFG_DEVICE_REMOVE("pokey")
MCFG_POKEY_ADD("pokey", FREQ_17_EXACT)

View File

@ -397,13 +397,13 @@ void atari_fdc_device::add_serin(UINT8 data, int with_checksum)
static void ATTR_PRINTF(1,2) atari_set_frame_message(const char *fmt, ...)
{
va_list arg;
va_start(arg, fmt);
//va_list arg;
//va_start(arg, fmt);
vsprintf(atari_frame_message, fmt, arg);
atari_frame_counter = 30; /* FIXME */
//vsprintf(atari_frame_message, fmt, arg);
//atari_frame_counter = 30; /* FIXME */
va_end(arg);
//va_end(arg);
}
void atari_fdc_device::a800_serial_command()