diff options
author | Zsolt Vasvari <zsoltvas@mamedev.org> | 2008-03-10 05:12:49 +0000 |
---|---|---|
committer | Zsolt Vasvari <zsoltvas@mamedev.org> | 2008-03-10 05:12:49 +0000 |
commit | 6e3be05912764a80d637eed64f4b729e4b689c56 (patch) | |
tree | a026d4b946ab0ce6d15de44cb548f4bf9e4e2dab | |
parent | 0862cce4533c015cbfe078d63ae5c0cdabdf0c8b (diff) |
Makes atarigen and tms34061 handle based
51 files changed, 528 insertions, 375 deletions
diff --git a/src/emu/video.c b/src/emu/video.c index 90f3f5b5576..f0ac1bb1e3a 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -910,12 +910,6 @@ void video_screen_update_partial(const device_config *screen, int scanline) internal_state->last_partial_scan = scanline + 1; } -void video_screen_update_partial_scrnum(int scrnum, int scanline) -{ - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); - video_screen_update_partial(internal_state->device, scanline); -} - /*------------------------------------------------- video_screen_update_now - perform an update @@ -1096,12 +1090,6 @@ attotime video_screen_get_time_until_pos(const device_config *screen, int vpos, return attotime_make(0, targetdelta - curdelta); } -attotime video_screen_get_time_until_pos_scrnum(int scrnum, int vpos, int hpos) -{ - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); - return video_screen_get_time_until_pos(internal_state->device, vpos, hpos); -} - /*------------------------------------------------- video_screen_get_time_until_vblank_start - diff --git a/src/emu/video.h b/src/emu/video.h index c8232746c84..8875be3e436 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -124,7 +124,6 @@ void video_screen_set_visarea(const device_config *screen, int min_x, int max_x, /* force a partial update of the screen up to and including the requested scanline */ void video_screen_update_partial(const device_config *screen, int scanline); -void video_screen_update_partial_scrnum(int scrnum, int scanline); /* force an update from the last beam position up to the current beam position */ void video_screen_update_now(const device_config *screen); @@ -150,7 +149,6 @@ const rectangle *video_screen_get_visible_area(const device_config *screen); /* return the time when the beam will reach a particular H,V position */ attotime video_screen_get_time_until_pos(const device_config *screen, int vpos, int hpos); -attotime video_screen_get_time_until_pos_scrnum(int scrnum, int vpos, int hpos); /* return the time when the beam will reach the start of VBLANK */ attotime video_screen_get_time_until_vblank_start(const device_config *screen); diff --git a/src/emu/video/tms34061.c b/src/emu/video/tms34061.c index bf8a0c396ea..0c3859d67d3 100644 --- a/src/emu/video/tms34061.c +++ b/src/emu/video/tms34061.c @@ -25,17 +25,17 @@ struct tms34061_data { - UINT16 regs[TMS34061_REGCOUNT]; - UINT16 xmask; - UINT8 yshift; - UINT32 vrammask; - UINT8 * vram; - UINT8 * latchram; - UINT8 latchdata; - UINT8 * shiftreg; - emu_timer * timer; + UINT16 regs[TMS34061_REGCOUNT]; + UINT16 xmask; + UINT8 yshift; + UINT32 vrammask; + UINT8 * vram; + UINT8 * latchram; + UINT8 latchdata; + UINT8 * shiftreg; + emu_timer * timer; struct tms34061_interface intf; - running_machine *machine; + const device_config *screen; }; @@ -79,8 +79,8 @@ void tms34061_start(running_machine *machine, const struct tms34061_interface *i { /* reset the data */ memset(&tms34061, 0, sizeof(tms34061)); - tms34061.machine = machine; tms34061.intf = *interface; + tms34061.screen = device_list_find_by_tag(machine->config->devicelist, VIDEO_SCREEN, tms34061.intf.screen_tag); tms34061.vrammask = tms34061.intf.vramsize - 1; /* allocate memory for VRAM */ @@ -137,9 +137,9 @@ INLINE void update_interrupts(void) { /* if the status bit is set, and ints are enabled, turn it on */ if ((tms34061.regs[TMS34061_STATUS] & 0x0001) && (tms34061.regs[TMS34061_CONTROL1] & 0x0400)) - (*tms34061.intf.interrupt)(tms34061.machine, ASSERT_LINE); + (*tms34061.intf.interrupt)(tms34061.screen->machine, ASSERT_LINE); else - (*tms34061.intf.interrupt)(tms34061.machine, CLEAR_LINE); + (*tms34061.intf.interrupt)(tms34061.screen->machine, CLEAR_LINE); } } @@ -147,7 +147,7 @@ INLINE void update_interrupts(void) static TIMER_CALLBACK( tms34061_interrupt ) { /* set timer for next frame */ - timer_adjust_oneshot(tms34061.timer, video_screen_get_frame_period_scrnum(tms34061.intf.scrnum), 0); + timer_adjust_oneshot(tms34061.timer, video_screen_get_frame_period(tms34061.screen), 0); /* set the interrupt bit in the status reg */ tms34061.regs[TMS34061_STATUS] |= 1; @@ -164,7 +164,7 @@ static TIMER_CALLBACK( tms34061_interrupt ) * *************************************/ -static WRITE8_HANDLER( register_w ) +static void register_w(offs_t offset, UINT8 data) { int scanline; int regnum = offset >> 2; @@ -172,7 +172,7 @@ static WRITE8_HANDLER( register_w ) /* certain registers affect the display directly */ if ((regnum >= TMS34061_HORENDSYNC && regnum <= TMS34061_DISPSTART) || (regnum == TMS34061_CONTROL2)) - video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); + video_screen_update_partial(tms34061.screen, video_screen_get_vpos(tms34061.screen)); /* store the hi/lo half */ if (offset & 0x02) @@ -193,7 +193,7 @@ static WRITE8_HANDLER( register_w ) if (scanline < 0) scanline += tms34061.regs[TMS34061_VERTOTAL]; - timer_adjust_oneshot(tms34061.timer, video_screen_get_time_until_pos_scrnum(tms34061.intf.scrnum, scanline, tms34061.regs[TMS34061_HORSTARTBLNK]), 0); + timer_adjust_oneshot(tms34061.timer, video_screen_get_time_until_pos(tms34061.screen, scanline, tms34061.regs[TMS34061_HORSTARTBLNK]), 0); break; /* XY offset: set the X and Y masks */ @@ -232,7 +232,7 @@ static WRITE8_HANDLER( register_w ) * *************************************/ -static READ8_HANDLER( register_r ) +static UINT8 register_r(offs_t offset) { int regnum = offset >> 2; UINT16 result; @@ -251,7 +251,7 @@ static READ8_HANDLER( register_r ) /* vertical count register: return the current scanline */ case TMS34061_VERCOUNTER: - result = (video_screen_get_vpos(machine->primary_screen)+ tms34061.regs[TMS34061_VERENDBLNK]) % tms34061.regs[TMS34061_VERTOTAL]; + result = (video_screen_get_vpos(tms34061.screen)+ tms34061.regs[TMS34061_VERENDBLNK]) % tms34061.regs[TMS34061_VERTOTAL]; break; } @@ -351,7 +351,7 @@ INLINE void adjust_xyaddress(int offset) } -static WRITE8_HANDLER( xypixel_w ) +static void xypixel_w(int offset, UINT8 data) { /* determine the offset, then adjust it */ offs_t pixeloffs = tms34061.regs[TMS34061_XYADDRESS]; @@ -370,7 +370,7 @@ static WRITE8_HANDLER( xypixel_w ) } -static READ8_HANDLER( xypixel_r ) +static UINT8 xypixel_r(int offset) { /* determine the offset, then adjust it */ offs_t pixeloffs = tms34061.regs[TMS34061_XYADDRESS]; @@ -395,7 +395,7 @@ static READ8_HANDLER( xypixel_r ) * *************************************/ -void tms34061_w(running_machine *machine, int col, int row, int func, UINT8 data) +void tms34061_w(int col, int row, int func, UINT8 data) { offs_t offs; @@ -405,12 +405,12 @@ void tms34061_w(running_machine *machine, int col, int row, int func, UINT8 data /* both 0 and 2 map to register access */ case 0: case 2: - register_w(machine, col, data); + register_w(col, data); break; /* function 1 maps to XY access; col is the address adjustment */ case 1: - xypixel_w(machine, col, data); + xypixel_w(col, data); break; /* function 3 maps to direct access */ @@ -454,7 +454,7 @@ void tms34061_w(running_machine *machine, int col, int row, int func, UINT8 data } -UINT8 tms34061_r(running_machine *machine, int col, int row, int func) +UINT8 tms34061_r(int col, int row, int func) { int result = 0; offs_t offs; @@ -465,12 +465,12 @@ UINT8 tms34061_r(running_machine *machine, int col, int row, int func) /* both 0 and 2 map to register access */ case 0: case 2: - result = register_r(machine, col); + result = register_r(col); break; /* function 1 maps to XY access; col is the address adjustment */ case 1: - result = xypixel_r(machine, col); + result = xypixel_r(col); break; /* funtion 3 maps to direct access */ diff --git a/src/emu/video/tms34061.h b/src/emu/video/tms34061.h index df4bf418905..82eea0d08da 100644 --- a/src/emu/video/tms34061.h +++ b/src/emu/video/tms34061.h @@ -37,10 +37,10 @@ enum /* interface structure */ struct tms34061_interface { - int scrnum; /* the screen we are acting on */ - UINT8 rowshift; /* VRAM address is (row << rowshift) | col */ - UINT32 vramsize; /* size of video RAM */ - void (*interrupt)(running_machine *machine, int state); /* interrupt gen callback */ + const char *screen_tag; /* the screen we are acting on */ + UINT8 rowshift; /* VRAM address is (row << rowshift) | col */ + UINT32 vramsize; /* size of video RAM */ + void (*interrupt)(running_machine *machine, int state); /* interrupt gen callback */ }; @@ -59,8 +59,8 @@ struct tms34061_display void tms34061_start(running_machine *machine, const struct tms34061_interface *interface); /* reads/writes to the 34061 */ -UINT8 tms34061_r(running_machine *machine, int col, int row, int func); -void tms34061_w(running_machine *machine, int col, int row, int func, UINT8 data); +UINT8 tms34061_r(int col, int row, int func); +void tms34061_w(int col, int row, int func, UINT8 data); /* latch settings */ READ8_HANDLER( tms34061_latch_r ); diff --git a/src/mame/drivers/arcadecl.c b/src/mame/drivers/arcadecl.c index 4d24525976e..a81efbb5683 100644 --- a/src/mame/drivers/arcadecl.c +++ b/src/mame/drivers/arcadecl.c @@ -67,7 +67,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "arcadecl.h" #include "sound/okim6295.h" @@ -96,11 +95,11 @@ static void update_interrupts(running_machine *machine) } -static void scanline_update(running_machine *machine, int scrnum, int scanline) +static void scanline_update(const device_config *screen, int scanline) { /* generate 32V signals */ if ((scanline & 32) == 0) - atarigen_scanline_int_gen(machine, 0); + atarigen_scanline_int_gen(screen->machine, 0); } @@ -115,7 +114,7 @@ static MACHINE_RESET( arcadecl ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, scanline_update, 32); + atarigen_scanline_timer_reset(machine->primary_screen, scanline_update, 32); } @@ -158,7 +157,7 @@ static WRITE16_HANDLER( latch_w ) if (ACCESSING_LSB) { OKIM6295_set_bank_base(0, (data & 0x80) ? 0x40000 : 0x00000); - atarigen_set_oki6295_vol(Machine, (data & 0x001f) * 100 / 0x1f); + atarigen_set_oki6295_vol(machine, (data & 0x001f) * 100 / 0x1f); } } diff --git a/src/mame/drivers/atarig1.c b/src/mame/drivers/atarig1.c index 78902914d06..150bbdcf965 100644 --- a/src/mame/drivers/atarig1.c +++ b/src/mame/drivers/atarig1.c @@ -75,7 +75,7 @@ static MACHINE_RESET( atarig1 ) atarigen_eeprom_reset(); atarigen_slapstic_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, atarig1_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, atarig1_scanline_update, 8); atarijsa_reset(); } diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c index 7aecfe8083a..ea262a34529 100644 --- a/src/mame/drivers/atarig42.c +++ b/src/mame/drivers/atarig42.c @@ -19,7 +19,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "machine/asic65.h" #include "audio/atarijsa.h" @@ -70,7 +69,7 @@ static MACHINE_RESET( atarig42 ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, atarig42_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, atarig42_scanline_update, 8); atarijsa_reset(); } @@ -120,7 +119,7 @@ static WRITE16_HANDLER( io_latch_w ) if (ACCESSING_LSB) { /* bit 4 resets the sound CPU */ - cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); if (!(data & 0x10)) atarijsa_reset(); /* bit 5 is /XRESET, probably related to the ASIC */ diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c index cb7b3de2864..880701a9a38 100644 --- a/src/mame/drivers/atarigt.c +++ b/src/mame/drivers/atarigt.c @@ -77,7 +77,7 @@ static MACHINE_RESET( atarigt ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, atarigt_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, atarigt_scanline_update, 8); } diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c index 79d5dccfb46..3095246110b 100644 --- a/src/mame/drivers/atarigx2.c +++ b/src/mame/drivers/atarigx2.c @@ -20,7 +20,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" #include "video/atarirle.h" @@ -68,7 +67,7 @@ static MACHINE_RESET( atarigx2 ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, atarigx2_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, atarigx2_scanline_update, 8); atarijsa_reset(); } @@ -145,7 +144,7 @@ static WRITE32_HANDLER( latch_w ) /* lower byte */ if (!(mem_mask & 0x00ff0000)) - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (data & 0x100000) ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (data & 0x100000) ? CLEAR_LINE : ASSERT_LINE); } @@ -1147,7 +1146,7 @@ static READ32_HANDLER( atarigx2_protection_r ) if (lookup_table[i][0] == 0xffffffff) { if (last_write_offset*2 >= 0x700 && last_write_offset*2 < 0x720) - result = mame_rand(Machine) << 16; + result = mame_rand(machine) << 16; else result = 0xffff << 16; logerror("%06X:Unhandled protection R@%04X = %04X\n", activecpu_get_previouspc(), offset, result); diff --git a/src/mame/drivers/atarisy1.c b/src/mame/drivers/atarisy1.c index a023511bfd1..578a4b20b63 100644 --- a/src/mame/drivers/atarisy1.c +++ b/src/mame/drivers/atarisy1.c @@ -203,7 +203,7 @@ static TIMER_CALLBACK( delayed_joystick_int ) { joystick_value = param; joystick_int = 1; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); } @@ -229,7 +229,7 @@ static READ16_HANDLER( joystick_r ) /* clear any existing interrupt and set a timer for a new one */ joystick_int = 0; timer_adjust_oneshot(joystick_timer, ATTOTIME_IN_USEC(50), newval); - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); return joystick_value; } diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c index 8e640da2d69..bc2ee960f94 100644 --- a/src/mame/drivers/atarisy2.c +++ b/src/mame/drivers/atarisy2.c @@ -213,14 +213,14 @@ static void update_interrupts(running_machine *machine) * *************************************/ -static void scanline_update(running_machine *machine, int scrnum, int scanline) +static void scanline_update(const device_config *screen, int scanline) { - if (scanline <= machine->screen[scrnum].height) + if (scanline <= video_screen_get_height(screen)) { /* generate the 32V interrupt (IRQ 2) */ if ((scanline % 64) == 0) if (interrupt_enable & 4) - atarigen_scanline_int_gen(machine, 0); + atarigen_scanline_int_gen(screen->machine, 0); } } @@ -263,7 +263,7 @@ static MACHINE_RESET( atarisy2 ) slapstic_reset(); atarigen_interrupt_reset(update_interrupts); atarigen_sound_io_reset(1); - atarigen_scanline_timer_reset(0, scanline_update, 64); + atarigen_scanline_timer_reset(machine->primary_screen, scanline_update, 64); memory_set_opbase_handler(0, atarisy2_opbase_handler); tms5220_data_strobe = 1; @@ -294,7 +294,7 @@ static WRITE16_HANDLER( int0_ack_w ) { /* reset sound IRQ */ p2portrd_state = 0; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); } @@ -302,7 +302,7 @@ static WRITE16_HANDLER( int1_ack_w ) { /* reset sound CPU */ if (ACCESSING_LSB) - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE); } @@ -636,7 +636,7 @@ static READ16_HANDLER( sound_r ) { /* clear the p2portwr state on a p1portrd */ p2portwr_state = 0; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); /* handle it normally otherwise */ return atarigen_sound_r(machine,offset,0); @@ -647,7 +647,7 @@ static WRITE8_HANDLER( sound_6502_w ) { /* clock the state through */ p2portwr_state = (interrupt_enable & 2) != 0; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); /* handle it normally otherwise */ atarigen_6502_sound_w(machine, offset, data); @@ -658,7 +658,7 @@ static READ8_HANDLER( sound_6502_r ) { /* clock the state through */ p2portrd_state = (interrupt_enable & 1) != 0; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); /* handle it normally otherwise */ return atarigen_6502_sound_r(machine, offset); diff --git a/src/mame/drivers/badlands.c b/src/mame/drivers/badlands.c index fdb655c4121..00cd4801086 100644 --- a/src/mame/drivers/badlands.c +++ b/src/mame/drivers/badlands.c @@ -134,13 +134,13 @@ static void update_interrupts(running_machine *machine) } -static void scanline_update(running_machine *machine, int scrnum, int scanline) +static void scanline_update(const device_config *screen, int scanline) { /* sound IRQ is on 32V */ if (scanline & 32) - atarigen_6502_irq_ack_r(machine, 0); + atarigen_6502_irq_ack_r(screen->machine, 0); else if (!(readinputport(0) & 0x40)) - atarigen_6502_irq_gen(machine, 0); + atarigen_6502_irq_gen(screen->machine, 0); } @@ -150,7 +150,7 @@ static MACHINE_RESET( badlands ) atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, scanline_update, 32); + atarigen_scanline_timer_reset(machine->primary_screen, scanline_update, 32); atarigen_sound_io_reset(1); memcpy(bank_base, &bank_source_data[0x0000], 0x1000); diff --git a/src/mame/drivers/batman.c b/src/mame/drivers/batman.c index f967e86b666..85ce7934a9b 100644 --- a/src/mame/drivers/batman.c +++ b/src/mame/drivers/batman.c @@ -18,7 +18,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" #include "batman.h" @@ -60,9 +59,9 @@ static void update_interrupts(running_machine *machine) static MACHINE_RESET( batman ) { atarigen_eeprom_reset(); - atarivc_reset(0, atarivc_eof_data, 2); + atarivc_reset(machine->primary_screen, atarivc_eof_data, 2); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, batman_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, batman_scanline_update, 8); atarijsa_reset(); atarigen_init_save_state(); state_save_register_global(latch_data); @@ -73,6 +72,25 @@ static MACHINE_RESET( batman ) /************************************* * + * Video controller access + * + *************************************/ + +static READ16_HANDLER( batman_atarivc_r ) +{ + return atarivc_r(machine->primary_screen, offset); +} + + +static WRITE16_HANDLER( batman_atarivc_w ) +{ + atarivc_w(machine->primary_screen, offset, data, mem_mask); +} + + + +/************************************* + * * I/O handling * *************************************/ @@ -93,9 +111,9 @@ static WRITE16_HANDLER( latch_w ) /* bit 4 is connected to the /RESET pin on the 6502 */ if (latch_data & 0x0010) - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, CLEAR_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE); else - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, ASSERT_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE); /* alpha bank is selected by the upper 4 bits */ if ((oldword ^ latch_data) & 0x7000) @@ -132,7 +150,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x260060, 0x260061) AM_MIRROR(0x11ff8e) AM_WRITE(atarigen_eeprom_enable_w) AM_RANGE(0x2a0000, 0x2a0001) AM_MIRROR(0x11fffe) AM_WRITE(watchdog_reset16_w) AM_RANGE(0x3e0000, 0x3e0fff) AM_MIRROR(0x100000) AM_READWRITE(SMH_RAM, atarigen_666_paletteram_w) AM_BASE(&paletteram16) - AM_RANGE(0x3effc0, 0x3effff) AM_MIRROR(0x100000) AM_READWRITE(atarivc_r, atarivc_w) AM_BASE(&atarivc_data) + AM_RANGE(0x3effc0, 0x3effff) AM_MIRROR(0x100000) AM_READWRITE(batman_atarivc_r, batman_atarivc_w) AM_BASE(&atarivc_data) AM_RANGE(0x3f0000, 0x3f1fff) AM_MIRROR(0x100000) AM_WRITE(atarigen_playfield2_latched_msb_w) AM_BASE(&atarigen_playfield2) AM_RANGE(0x3f2000, 0x3f3fff) AM_MIRROR(0x100000) AM_WRITE(atarigen_playfield_latched_lsb_w) AM_BASE(&atarigen_playfield) AM_RANGE(0x3f4000, 0x3f5fff) AM_MIRROR(0x100000) AM_WRITE(atarigen_playfield_dual_upper_w) AM_BASE(&atarigen_playfield_upper) diff --git a/src/mame/drivers/blstroid.c b/src/mame/drivers/blstroid.c index 5cb427e727d..0a66a92a6fd 100644 --- a/src/mame/drivers/blstroid.c +++ b/src/mame/drivers/blstroid.c @@ -18,7 +18,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" #include "blstroid.h" @@ -53,7 +52,7 @@ static MACHINE_RESET( blstroid ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, blstroid_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, blstroid_scanline_update, 8); atarijsa_reset(); } @@ -69,7 +68,7 @@ static READ16_HANDLER( inputs_r ) { int temp = readinputport(2 + (offset & 1)); if (atarigen_cpu_to_sound_ready) temp ^= 0x0040; - if (atarigen_get_hblank(Machine, 0)) temp ^= 0x0010; + if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0010; return temp; } diff --git a/src/mame/drivers/cyberbal.c b/src/mame/drivers/cyberbal.c index 545fa82238f..4dbfd1fa992 100644 --- a/src/mame/drivers/cyberbal.c +++ b/src/mame/drivers/cyberbal.c @@ -20,7 +20,6 @@ #include "driver.h" -#include "deprecat.h" #include "rendlay.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" @@ -39,7 +38,6 @@ static void update_interrupts(running_machine *machine) { int newstate1 = 0; int newstate2 = 0; - int temp; if (atarigen_sound_int_state) newstate1 |= 1; @@ -55,11 +53,6 @@ static void update_interrupts(running_machine *machine) cpunum_set_input_line(machine, 2, newstate2, ASSERT_LINE); else cpunum_set_input_line(machine, 2, 7, CLEAR_LINE); - - /* check for screen swapping */ - temp = readinputport(2); - if (temp & 1) cyberbal_set_screen(0); - else if (temp & 2) cyberbal_set_screen(1); } @@ -68,16 +61,13 @@ static MACHINE_RESET( cyberbal ) atarigen_eeprom_reset(); atarigen_slapstic_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, cyberbal_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, cyberbal_scanline_update, 8); atarigen_sound_io_reset(1); cyberbal_sound_reset(); /* CPU 2 doesn't run until reset */ cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, ASSERT_LINE); - - /* make sure we're pointing to the right screen by default */ - cyberbal_set_screen(0); } @@ -101,11 +91,8 @@ static MACHINE_RESET( cyberb2p ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(cyberb2p_update_interrupts); - atarigen_scanline_timer_reset(0, cyberbal_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, cyberbal_scanline_update, 8); atarijsa_reset(); - - /* make sure we're pointing to the only screen */ - cyberbal_set_screen(0); } @@ -149,7 +136,7 @@ static READ16_HANDLER( sound_state_r ) static WRITE16_HANDLER( p2_reset_w ) { - cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, CLEAR_LINE); + cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, CLEAR_LINE); } @@ -1032,15 +1019,15 @@ static DRIVER_INIT( cyberb2p ) * *************************************/ -GAMEL( 1988, cyberbal, 0, cyberbal, cyberbal, cyberbal, ROT0, "Atari Games", "Cyberball (rev 4)", 0, layout_dualhsxs ) -GAMEL( 1988, cyberba2, cyberbal, cyberbal, cyberbal, cyberbal, ROT0, "Atari Games", "Cyberball (rev 2)", 0, layout_dualhsxs ) -GAMEL( 1988, cyberbap, cyberbal, cyberbal, cyberbal, cyberbal, ROT0, "Atari Games", "Cyberball (prototype)", 0, layout_dualhsxs ) +GAMEL(1988, cyberbal, 0, cyberbal, cyberbal, cyberbal, ROT0, "Atari Games", "Cyberball (rev 4)", 0, layout_dualhsxs ) +GAMEL(1988, cyberba2, cyberbal, cyberbal, cyberbal, cyberbal, ROT0, "Atari Games", "Cyberball (rev 2)", 0, layout_dualhsxs ) +GAMEL(1988, cyberbap, cyberbal, cyberbal, cyberbal, cyberbal, ROT0, "Atari Games", "Cyberball (prototype)", 0, layout_dualhsxs ) GAME( 1989, cyberb2p, cyberbal, cyberb2p, cyberb2p, cyberb2p, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 4)", 0 ) GAME( 1989, cyberb23, cyberbal, cyberb2p, cyberb2p, cyberb2p, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 3)", 0 ) GAME( 1989, cyberb22, cyberbal, cyberb2p, cyberb2p, cyberb2p, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 2)", 0 ) GAME( 1989, cyberb21, cyberbal, cyberb2p, cyberb2p, cyberb2p, ROT0, "Atari Games", "Cyberball 2072 (2 player, rev 1)", 0 ) -GAMEL( 1989, cyberbt, cyberbal, cyberbal, cyberbal, cyberbt, ROT0, "Atari Games", "Tournament Cyberball 2072 (rev 2)", 0, layout_dualhsxs ) -GAMEL( 1989, cyberbt1, cyberbal, cyberbal, cyberbal, cyberbt, ROT0, "Atari Games", "Tournament Cyberball 2072 (rev 1)", 0, layout_dualhsxs ) +GAMEL(1989, cyberbt, cyberbal, cyberbal, cyberbal, cyberbt, ROT0, "Atari Games", "Tournament Cyberball 2072 (rev 2)", 0, layout_dualhsxs ) +GAMEL(1989, cyberbt1, cyberbal, cyberbal, cyberbal, cyberbt, ROT0, "Atari Games", "Tournament Cyberball 2072 (rev 1)", 0, layout_dualhsxs ) diff --git a/src/mame/drivers/eprom.c b/src/mame/drivers/eprom.c index 044c4dd9b19..d4a6aafb5c8 100644 --- a/src/mame/drivers/eprom.c +++ b/src/mame/drivers/eprom.c @@ -20,7 +20,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" #include "eprom.h" @@ -69,7 +68,7 @@ static MACHINE_RESET( klaxp ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, eprom_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, eprom_scanline_update, 8); atarijsa_reset(); atarigen_init_save_state(); } @@ -123,9 +122,9 @@ static WRITE16_HANDLER( eprom_latch_w ) if (ACCESSING_LSB) { if (data & 1) - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, CLEAR_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE); else - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, ASSERT_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE); } } diff --git a/src/mame/drivers/gauntlet.c b/src/mame/drivers/gauntlet.c index 04fcdbd0ec8..9f193071fd0 100644 --- a/src/mame/drivers/gauntlet.c +++ b/src/mame/drivers/gauntlet.c @@ -119,7 +119,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "sound/5220intf.h" #include "sound/2151intf.h" @@ -162,13 +161,13 @@ static void update_interrupts(running_machine *machine) } -static void scanline_update(running_machine *machine, int scrnum, int scanline) +static void scanline_update(const device_config *screen, int scanline) { /* sound IRQ is on 32V */ if (scanline & 32) - atarigen_6502_irq_gen(machine, 0); + atarigen_6502_irq_gen(screen->machine, 0); else - atarigen_6502_irq_ack_r(machine, 0); + atarigen_6502_irq_ack_r(screen->machine, 0); } @@ -180,7 +179,7 @@ static MACHINE_RESET( gauntlet ) atarigen_eeprom_reset(); atarigen_slapstic_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, scanline_update, 32); + atarigen_scanline_timer_reset(machine->primary_screen, scanline_update, 32); atarigen_sound_io_reset(1); } @@ -217,7 +216,7 @@ static WRITE16_HANDLER( sound_reset_w ) if ((oldword ^ sound_reset_val) & 1) { - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (sound_reset_val & 1) ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (sound_reset_val & 1) ? CLEAR_LINE : ASSERT_LINE); atarigen_sound_reset(); } } @@ -299,9 +298,9 @@ static WRITE8_HANDLER( sound_ctl_w ) static WRITE8_HANDLER( mixer_w ) { - atarigen_set_ym2151_vol(Machine, (data & 7) * 100 / 7); - atarigen_set_pokey_vol(Machine, ((data >> 3) & 3) * 100 / 3); - atarigen_set_tms5220_vol(Machine, ((data >> 5) & 7) * 100 / 7); + atarigen_set_ym2151_vol(machine, (data & 7) * 100 / 7); + atarigen_set_pokey_vol(machine, ((data >> 3) & 3) * 100 / 3); + atarigen_set_tms5220_vol(machine, ((data >> 5) & 7) * 100 / 7); } diff --git a/src/mame/drivers/klax.c b/src/mame/drivers/klax.c index d76ee129bf4..7665bf1ef62 100644 --- a/src/mame/drivers/klax.c +++ b/src/mame/drivers/klax.c @@ -44,11 +44,11 @@ static void update_interrupts(running_machine *machine) } -static void scanline_update(running_machine *machine, int scrnum, int scanline) +static void scanline_update(const device_config *screen, int scanline) { /* generate 32V signals */ if ((scanline & 32) == 0 && !(readinputport(0) & 0x800)) - atarigen_scanline_int_gen(machine, 0); + atarigen_scanline_int_gen(screen->machine, 0); } @@ -70,7 +70,7 @@ static MACHINE_RESET( klax ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, scanline_update, 32); + atarigen_scanline_timer_reset(machine->primary_screen, scanline_update, 32); } diff --git a/src/mame/drivers/offtwall.c b/src/mame/drivers/offtwall.c index 307882c53cc..1205a33dd4b 100644 --- a/src/mame/drivers/offtwall.c +++ b/src/mame/drivers/offtwall.c @@ -18,7 +18,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" #include "offtwall.h" @@ -57,7 +56,7 @@ static void update_interrupts(running_machine *machine) static MACHINE_RESET( offtwall ) { atarigen_eeprom_reset(); - atarivc_reset(0, atarivc_eof_data, 1); + atarivc_reset(machine->primary_screen, atarivc_eof_data, 1); atarigen_interrupt_reset(update_interrupts); atarijsa_reset(); } @@ -66,6 +65,25 @@ static MACHINE_RESET( offtwall ) /************************************* * + * Video controller access + * + *************************************/ + +static READ16_HANDLER( offtwall_atarivc_r ) +{ + return atarivc_r(machine->primary_screen, offset); +} + + +static WRITE16_HANDLER( offtwall_atarivc_w ) +{ + atarivc_w(machine->primary_screen, offset, data, mem_mask); +} + + + +/************************************* + * * I/O handling * *************************************/ @@ -84,7 +102,7 @@ static WRITE16_HANDLER( io_latch_w ) if (ACCESSING_LSB) { /* bit 4 resets the sound CPU */ - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); if (!(data & 0x10)) atarijsa_reset(); } @@ -273,7 +291,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x260060, 0x260061) AM_WRITE(atarigen_eeprom_enable_w) AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(watchdog_reset16_w) AM_RANGE(0x3e0000, 0x3e0fff) AM_READWRITE(SMH_RAM, atarigen_666_paletteram_w) AM_BASE(&paletteram16) - AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(atarivc_r, atarivc_w) AM_BASE(&atarivc_data) + AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(offtwall_atarivc_r, offtwall_atarivc_w) AM_BASE(&atarivc_data) AM_RANGE(0x3f4000, 0x3f5eff) AM_READWRITE(SMH_RAM, atarigen_playfield_latched_msb_w) AM_BASE(&atarigen_playfield) AM_RANGE(0x3f5f00, 0x3f5f7f) AM_RAM AM_BASE(&atarivc_eof_data) AM_RANGE(0x3f5f80, 0x3f5fff) AM_READWRITE(SMH_RAM, atarimo_0_slipram_w) AM_BASE(&atarimo_0_slipram) diff --git a/src/mame/drivers/rampart.c b/src/mame/drivers/rampart.c index e1f983195d1..e56671196f8 100644 --- a/src/mame/drivers/rampart.c +++ b/src/mame/drivers/rampart.c @@ -23,7 +23,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "rampart.h" #include "sound/okim6295.h" @@ -53,11 +52,11 @@ static void update_interrupts(running_machine *machine) } -static void scanline_update(running_machine *machine, int scrnum, int scanline) +static void scanline_update(const device_config *screen, int scanline) { /* generate 32V signals */ if ((scanline & 32) == 0) - atarigen_scanline_int_gen(machine, 0); + atarigen_scanline_int_gen(screen->machine, 0); } @@ -73,7 +72,7 @@ static MACHINE_RESET( rampart ) atarigen_eeprom_reset(); atarigen_slapstic_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, scanline_update, 32); + atarigen_scanline_timer_reset(machine->primary_screen, scanline_update, 32); } @@ -153,10 +152,10 @@ static WRITE16_HANDLER( latch_w ) /* lower byte being modified? */ if (ACCESSING_LSB) { - atarigen_set_oki6295_vol(Machine, (data & 0x0020) ? 100 : 0); + atarigen_set_oki6295_vol(machine, (data & 0x0020) ? 100 : 0); if (!(data & 0x0010)) sndti_reset(SOUND_OKIM6295, 0); - atarigen_set_ym2413_vol(Machine, ((data >> 1) & 7) * 100 / 7); + atarigen_set_ym2413_vol(machine, ((data >> 1) & 7) * 100 / 7); if (!(data & 0x0001)) sndti_reset(SOUND_YM2413, 0); } diff --git a/src/mame/drivers/relief.c b/src/mame/drivers/relief.c index 399c6c7d77d..526c673f2be 100644 --- a/src/mame/drivers/relief.c +++ b/src/mame/drivers/relief.c @@ -18,7 +18,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "relief.h" #include "sound/okim6295.h" @@ -60,6 +59,25 @@ static void update_interrupts(running_machine *machine) /************************************* * + * Video controller access + * + *************************************/ + +static READ16_HANDLER( relief_atarivc_r ) +{ + return atarivc_r(machine->primary_screen, offset); +} + + +static WRITE16_HANDLER( relief_atarivc_w ) +{ + atarivc_w(machine->primary_screen, offset, data, mem_mask); +} + + + +/************************************* + * * Initialization * *************************************/ @@ -67,7 +85,7 @@ static void update_interrupts(running_machine *machine) static MACHINE_RESET( relief ) { atarigen_eeprom_reset(); - atarivc_reset(0, atarivc_eof_data, 2); + atarivc_reset(machine->primary_screen, atarivc_eof_data, 2); atarigen_interrupt_reset(update_interrupts); OKIM6295_set_bank_base(0, 0); @@ -88,7 +106,7 @@ static READ16_HANDLER( special_port2_r ) { int result = readinputport(2); if (atarigen_cpu_to_sound_ready) result ^= 0x0020; - if (!(result & 0x0080) || atarigen_get_hblank(Machine, 0)) result ^= 0x0001; + if (!(result & 0x0080) || atarigen_get_hblank(machine->primary_screen)) result ^= 0x0001; return result; } @@ -105,7 +123,7 @@ static WRITE16_HANDLER( audio_control_w ) if (ACCESSING_LSB) { ym2413_volume = (data >> 1) & 15; - atarigen_set_ym2413_vol(Machine, (ym2413_volume * overall_volume * 100) / (127 * 15)); + atarigen_set_ym2413_vol(machine, (ym2413_volume * overall_volume * 100) / (127 * 15)); adpcm_bank_base = (0x040000 * ((data >> 6) & 3)) | (adpcm_bank_base & 0x100000); } if (ACCESSING_MSB) @@ -120,8 +138,8 @@ static WRITE16_HANDLER( audio_volume_w ) if (ACCESSING_LSB) { overall_volume = data & 127; - atarigen_set_ym2413_vol(Machine, (ym2413_volume * overall_volume * 100) / (127 * 15)); - atarigen_set_oki6295_vol(Machine, overall_volume * 100 / 127); + atarigen_set_ym2413_vol(machine, (ym2413_volume * overall_volume * 100) / (127 * 15)); + atarigen_set_oki6295_vol(machine, overall_volume * 100 / 127); } } @@ -188,7 +206,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x260012, 0x260013) AM_READ(input_port_3_word_r) AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(watchdog_reset16_w) AM_RANGE(0x3e0000, 0x3e0fff) AM_READWRITE(SMH_RAM, atarigen_666_paletteram_w) AM_BASE(&paletteram16) - AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(atarivc_r, atarivc_w) AM_BASE(&atarivc_data) + AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(relief_atarivc_r, relief_atarivc_w) AM_BASE(&atarivc_data) AM_RANGE(0x3f0000, 0x3f1fff) AM_READWRITE(SMH_RAM, atarigen_playfield2_latched_msb_w) AM_BASE(&atarigen_playfield2) AM_RANGE(0x3f2000, 0x3f3fff) AM_READWRITE(SMH_RAM, atarigen_playfield_latched_lsb_w) AM_BASE(&atarigen_playfield) AM_RANGE(0x3f4000, 0x3f5fff) AM_READWRITE(SMH_RAM, atarigen_playfield_dual_upper_w) AM_BASE(&atarigen_playfield_upper) diff --git a/src/mame/drivers/shuuz.c b/src/mame/drivers/shuuz.c index 08f824c2aea..ab5e6fc8af4 100644 --- a/src/mame/drivers/shuuz.c +++ b/src/mame/drivers/shuuz.c @@ -18,7 +18,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "shuuz.h" #include "sound/okim6295.h" @@ -48,6 +47,25 @@ static void update_interrupts(running_machine *machine) /************************************* * + * Video controller access + * + *************************************/ + +static READ16_HANDLER( shuuz_atarivc_r ) +{ + return atarivc_r(machine->primary_screen, offset); +} + + +static WRITE16_HANDLER( shuuz_atarivc_w ) +{ + atarivc_w(machine->primary_screen, offset, data, mem_mask); +} + + + +/************************************* + * * Initialization * *************************************/ @@ -55,7 +73,7 @@ static void update_interrupts(running_machine *machine) static MACHINE_RESET( shuuz ) { atarigen_eeprom_reset(); - atarivc_reset(0, atarivc_eof_data, 1); + atarivc_reset(machine->primary_screen, atarivc_eof_data, 1); atarigen_interrupt_reset(update_interrupts); } @@ -124,7 +142,7 @@ static READ16_HANDLER( special_port0_r ) { int result = readinputport(0); - if ((result & 0x0800) && atarigen_get_hblank(Machine, 0)) + if ((result & 0x0800) && atarigen_get_hblank(machine->primary_screen)) result &= ~0x0800; return result; @@ -149,7 +167,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x106000, 0x106001) AM_READWRITE(adpcm_r, adpcm_w) AM_RANGE(0x107000, 0x107007) AM_NOP AM_RANGE(0x3e0000, 0x3e087f) AM_READWRITE(SMH_RAM, atarigen_666_paletteram_w) AM_BASE(&paletteram16) - AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(atarivc_r, atarivc_w) AM_BASE(&atarivc_data) + AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(shuuz_atarivc_r, shuuz_atarivc_w) AM_BASE(&atarivc_data) AM_RANGE(0x3f4000, 0x3f5eff) AM_READWRITE(SMH_RAM, atarigen_playfield_latched_msb_w) AM_BASE(&atarigen_playfield) AM_RANGE(0x3f5f00, 0x3f5f7f) AM_RAM AM_BASE(&atarivc_eof_data) AM_RANGE(0x3f5f80, 0x3f5fff) AM_READWRITE(SMH_RAM, atarimo_0_slipram_w) AM_BASE(&atarimo_0_slipram) diff --git a/src/mame/drivers/skullxbo.c b/src/mame/drivers/skullxbo.c index 9c8a35bcce9..e758834dcae 100644 --- a/src/mame/drivers/skullxbo.c +++ b/src/mame/drivers/skullxbo.c @@ -18,7 +18,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" #include "skullxbo.h" @@ -55,7 +54,7 @@ static TIMER_CALLBACK( irq_gen ) } -static void alpha_row_update(running_machine *machine, int scrnum, int scanline) +static void alpha_row_update(const device_config *screen, int scanline) { UINT16 *check = &atarigen_alpha[(scanline / 8) * 64 + 42]; @@ -63,7 +62,8 @@ static void alpha_row_update(running_machine *machine, int scrnum, int scanline) /* the interrupt occurs on the HBLANK of the 6th scanline following */ if (check < &atarigen_alpha[0x7c0] && (*check & 0x8000)) { - attotime period = video_screen_get_time_until_pos_scrnum(scrnum, video_screen_get_vpos_scrnum(scrnum) + 6, machine->screen[scrnum].width * 0.9); + int width = video_screen_get_width(screen); + attotime period = video_screen_get_time_until_pos(screen, video_screen_get_vpos(screen) + 6, width * 0.9); timer_set(period, NULL, 0, irq_gen); } @@ -76,7 +76,7 @@ static MACHINE_RESET( skullxbo ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, alpha_row_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, alpha_row_update, 8); atarijsa_reset(); } @@ -92,7 +92,7 @@ static READ16_HANDLER( special_port1_r ) { int temp = readinputport(1); if (atarigen_cpu_to_sound_ready) temp ^= 0x0040; - if (atarigen_get_hblank(Machine, 0)) temp ^= 0x0010; + if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0010; return temp; } diff --git a/src/mame/drivers/thunderj.c b/src/mame/drivers/thunderj.c index 49ab029c84f..f32629a4d8e 100644 --- a/src/mame/drivers/thunderj.c +++ b/src/mame/drivers/thunderj.c @@ -18,7 +18,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" #include "thunderj.h" @@ -60,7 +59,7 @@ static void update_interrupts(running_machine *machine) static MACHINE_RESET( thunderj ) { atarigen_eeprom_reset(); - atarivc_reset(0, atarivc_eof_data, 2); + atarivc_reset(machine->primary_screen, atarivc_eof_data, 2); atarigen_interrupt_reset(update_interrupts); atarijsa_reset(); @@ -96,9 +95,9 @@ static WRITE16_HANDLER( latch_w ) { /* 0 means hold CPU 2's reset low */ if (data & 1) - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, CLEAR_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE); else - cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, ASSERT_LINE); + cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE); /* bits 2-5 are the alpha bank */ if (thunderj_alpha_tile_bank != ((data >> 2) & 7)) @@ -160,7 +159,7 @@ static READ16_HANDLER( shared_ram_r ) * *************************************/ -static READ16_HANDLER( thunderj_video_control_r ) +static READ16_HANDLER( thunderj_atarivc_r ) { /* Sigh. CPU #1 reads the video controller register twice per frame, once at the beginning of interrupt and once near the end. It stores these values in a @@ -180,7 +179,13 @@ static READ16_HANDLER( thunderj_video_control_r ) if (cpu_readmem24bew_word(0x163482) > 0xfff) mame_printf_debug("You're screwed!");*/ - return atarivc_r(machine,offset,0); + return atarivc_r(machine->primary_screen, offset); +} + + +static WRITE16_HANDLER( thunderj_atarivc_w ) +{ + atarivc_w(machine->primary_screen, offset, data, mem_mask); } @@ -205,7 +210,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x360020, 0x360021) AM_WRITE(atarigen_sound_reset_w) AM_RANGE(0x360030, 0x360031) AM_WRITE(atarigen_sound_w) AM_RANGE(0x3e0000, 0x3e0fff) AM_READWRITE(SMH_RAM, atarigen_666_paletteram_w) AM_BASE(&paletteram16) - AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(thunderj_video_control_r, atarivc_w) AM_BASE(&atarivc_data) + AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(thunderj_atarivc_r, thunderj_atarivc_w) AM_BASE(&atarivc_data) AM_RANGE(0x3f0000, 0x3f1fff) AM_READWRITE(SMH_RAM, atarigen_playfield2_latched_msb_w) AM_BASE(&atarigen_playfield2) AM_RANGE(0x3f2000, 0x3f3fff) AM_READWRITE(SMH_RAM, atarigen_playfield_latched_lsb_w) AM_BASE(&atarigen_playfield) AM_RANGE(0x3f4000, 0x3f5fff) AM_READWRITE(SMH_RAM, atarigen_playfield_dual_upper_w) AM_BASE(&atarigen_playfield_upper) diff --git a/src/mame/drivers/toobin.c b/src/mame/drivers/toobin.c index 3cb6092b68b..8d4a9167aa7 100644 --- a/src/mame/drivers/toobin.c +++ b/src/mame/drivers/toobin.c @@ -18,7 +18,6 @@ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "audio/atarijsa.h" #include "toobin.h" @@ -82,7 +81,7 @@ static WRITE16_HANDLER( interrupt_scan_w ) if (oldword != newword) { interrupt_scan[offset] = newword; - atarigen_scanline_int_set(0, newword & 0x1ff); + atarigen_scanline_int_set(machine->primary_screen, newword & 0x1ff); } } @@ -97,7 +96,7 @@ static WRITE16_HANDLER( interrupt_scan_w ) static READ16_HANDLER( special_port1_r ) { int result = readinputport(1); - if (atarigen_get_hblank(Machine, 0)) result ^= 0x8000; + if (atarigen_get_hblank(machine->primary_screen)) result ^= 0x8000; if (atarigen_cpu_to_sound_ready) result ^= 0x2000; return result; } diff --git a/src/mame/drivers/vindictr.c b/src/mame/drivers/vindictr.c index 02a178a8fd8..48cfb9243df 100644 --- a/src/mame/drivers/vindictr.c +++ b/src/mame/drivers/vindictr.c @@ -50,7 +50,7 @@ static MACHINE_RESET( vindictr ) { atarigen_eeprom_reset(); atarigen_interrupt_reset(update_interrupts); - atarigen_scanline_timer_reset(0, vindictr_scanline_update, 8); + atarigen_scanline_timer_reset(machine->primary_screen, vindictr_scanline_update, 8); atarijsa_reset(); } diff --git a/src/mame/includes/atarig1.h b/src/mame/includes/atarig1.h index 844e13c5a47..711f601148f 100644 --- a/src/mame/includes/atarig1.h +++ b/src/mame/includes/atarig1.h @@ -11,6 +11,6 @@ WRITE16_HANDLER( atarig1_mo_control_w ); VIDEO_START( atarig1 ); VIDEO_UPDATE( atarig1 ); -void atarig1_scanline_update(running_machine *machine, int scrnum, int scanline); +void atarig1_scanline_update(const device_config *screen, int scanline); extern UINT8 atarig1_pitfight; diff --git a/src/mame/includes/atarig42.h b/src/mame/includes/atarig42.h index cffb2f878d4..7f245f53cf8 100644 --- a/src/mame/includes/atarig42.h +++ b/src/mame/includes/atarig42.h @@ -15,5 +15,5 @@ VIDEO_UPDATE( atarig42 ); WRITE16_HANDLER( atarig42_mo_control_w ); -void atarig42_scanline_update(running_machine *machine, int scrnum, int scanline); +void atarig42_scanline_update(const device_config *screen, int scanline); diff --git a/src/mame/includes/atarigt.h b/src/mame/includes/atarigt.h index ce2039786d6..e9cd1e85c8e 100644 --- a/src/mame/includes/atarigt.h +++ b/src/mame/includes/atarigt.h @@ -19,4 +19,4 @@ UINT16 atarigt_colorram_r(offs_t address); VIDEO_START( atarigt ); VIDEO_UPDATE( atarigt ); -void atarigt_scanline_update(running_machine *machine, int scrnum, int scanline); +void atarigt_scanline_update(const device_config *screen, int scanline); diff --git a/src/mame/includes/atarigx2.h b/src/mame/includes/atarigx2.h index 5f8abeeef8d..942bb79c580 100644 --- a/src/mame/includes/atarigx2.h +++ b/src/mame/includes/atarigx2.h @@ -15,4 +15,4 @@ VIDEO_UPDATE( atarigx2 ); WRITE16_HANDLER( atarigx2_mo_control_w ); -void atarigx2_scanline_update(running_machine *machine, int scrnum, int scanline); +void atarigx2_scanline_update(const device_config *screen, int scanline); diff --git a/src/mame/includes/batman.h b/src/mame/includes/batman.h index 60ddebfbcde..e2298b36908 100644 --- a/src/mame/includes/batman.h +++ b/src/mame/includes/batman.h @@ -11,4 +11,4 @@ extern UINT8 batman_alpha_tile_bank; VIDEO_START( batman ); VIDEO_UPDATE( batman ); -void batman_scanline_update(running_machine *machine, int scrnum, int scanline); +void batman_scanline_update(const device_config *screen, int scanline); diff --git a/src/mame/includes/blstroid.h b/src/mame/includes/blstroid.h index 2b92de8b5a8..2ecc14665fe 100644 --- a/src/mame/includes/blstroid.h +++ b/src/mame/includes/blstroid.h @@ -9,6 +9,6 @@ VIDEO_START( blstroid ); VIDEO_UPDATE( blstroid ); -void blstroid_scanline_update(running_machine *machine, int scrnum, int scanline); +void blstroid_scanline_update(const device_config *screen, int scanline); extern UINT16 *blstroid_priorityram; diff --git a/src/mame/includes/cyberbal.h b/src/mame/includes/cyberbal.h index 952cd86882e..89e0c7d1219 100644 --- a/src/mame/includes/cyberbal.h +++ b/src/mame/includes/cyberbal.h @@ -25,8 +25,6 @@ WRITE16_HANDLER( cyberbal_sound_68k_dac_w ); /*----------- defined in video/cyberbal.c -----------*/ -void cyberbal_set_screen(int which); - READ16_HANDLER( cyberbal_paletteram_0_r ); READ16_HANDLER( cyberbal_paletteram_1_r ); WRITE16_HANDLER( cyberbal_paletteram_0_w ); @@ -36,7 +34,7 @@ VIDEO_START( cyberbal ); VIDEO_START( cyberb2p ); VIDEO_UPDATE( cyberbal ); -void cyberbal_scanline_update(running_machine *machine, int scrnum, int scanline); +void cyberbal_scanline_update(const device_config *screen, int scanline); extern UINT16 *cyberbal_paletteram_0; extern UINT16 *cyberbal_paletteram_1; diff --git a/src/mame/includes/eprom.h b/src/mame/includes/eprom.h index fc057b13085..657cf524c97 100644 --- a/src/mame/includes/eprom.h +++ b/src/mame/includes/eprom.h @@ -12,4 +12,4 @@ VIDEO_UPDATE( eprom ); VIDEO_START( guts ); VIDEO_UPDATE( guts ); -void eprom_scanline_update(running_machine *machine, int scrnum, int scanline); +void eprom_scanline_update(const device_config *screen, int scanline); diff --git a/src/mame/includes/vindictr.h b/src/mame/includes/vindictr.h index 12344887150..7e3fa9f461e 100644 --- a/src/mame/includes/vindictr.h +++ b/src/mame/includes/vindictr.h @@ -11,4 +11,4 @@ WRITE16_HANDLER( vindictr_paletteram_w ); VIDEO_START( vindictr ); VIDEO_UPDATE( vindictr ); -void vindictr_scanline_update(running_machine *machine, int scrnum, int scanline); +void vindictr_scanline_update(const device_config *screen, int scanline); diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c index b50923ba0d5..abc8f0517a5 100644 --- a/src/mame/machine/atarigen.c +++ b/src/mame/machine/atarigen.c @@ -66,33 +66,38 @@ struct atarivc_state_desc atarivc_state; ***************************************************************************/ static atarigen_int_func update_int_callback; -static emu_timer * scanline_interrupt_timer; -static UINT8 eeprom_unlocked; +static UINT8 eeprom_unlocked; -static UINT8 atarigen_slapstic_num; -static UINT16 * atarigen_slapstic; -static UINT8 atarigen_slapstic_bank; -static void * atarigen_slapstic_bank0; +static UINT8 atarigen_slapstic_num; +static UINT16 * atarigen_slapstic; +static UINT8 atarigen_slapstic_bank; +static void * atarigen_slapstic_bank0; -static UINT8 sound_cpu_num; -static UINT8 atarigen_cpu_to_sound; -static UINT8 atarigen_sound_to_cpu; -static UINT8 timed_int; -static UINT8 ym2151_int; +static UINT8 sound_cpu_num; +static UINT8 atarigen_cpu_to_sound; +static UINT8 atarigen_sound_to_cpu; +static UINT8 timed_int; +static UINT8 ym2151_int; -static atarigen_scanline_func scanline_callback; -static UINT32 scanlines_per_callback; +static atarigen_scanline_func scanline_callback; +static UINT32 scanlines_per_callback; -static UINT32 actual_vc_latch0; -static UINT32 actual_vc_latch1; -static UINT8 atarivc_playfields; +static UINT32 actual_vc_latch0; +static UINT32 actual_vc_latch1; +static UINT8 atarivc_playfields; -static UINT32 playfield_latch; -static UINT32 playfield2_latch; +static UINT32 playfield_latch; +static UINT32 playfield2_latch; -static emu_timer * scanline_timer[ATARIMO_MAX]; -static emu_timer * atarivc_eof_update_timer[ATARIMO_MAX]; +static const device_config * scanline_interrupt_timer_screens[ATARIMO_MAX]; +static emu_timer * scanline_interrupt_timers[ATARIMO_MAX]; + +static const device_config * scanline_timer_screens[ATARIMO_MAX]; +static emu_timer * scanline_timers[ATARIMO_MAX]; + +static const device_config * atarivc_eof_update_timer_screens[ATARIMO_MAX]; +static emu_timer * atarivc_eof_update_timers[ATARIMO_MAX]; @@ -105,7 +110,7 @@ static TIMER_CALLBACK( scanline_interrupt_callback ); static void decompress_eeprom_word(const UINT16 *data); static void decompress_eeprom_byte(const UINT16 *data); -static void update_6502_irq(void); +static void update_6502_irq(running_machine *machine); static TIMER_CALLBACK( delayed_sound_reset ); static TIMER_CALLBACK( delayed_sound_w ); static TIMER_CALLBACK( delayed_6502_sound_w ); @@ -114,7 +119,7 @@ static void atarigen_set_vol(running_machine *machine, int volume, sound_type ty static TIMER_CALLBACK( scanline_timer_callback ); -static void atarivc_common_w(running_machine *machine, int scrnum, offs_t offset, UINT16 newword); +static void atarivc_common_w(const device_config *screen, offs_t offset, UINT16 newword); static TIMER_CALLBACK( unhalt_cpu ); @@ -140,14 +145,15 @@ void atarigen_interrupt_reset(atarigen_int_func update_int) /* reset the interrupt states */ atarigen_video_int_state = atarigen_sound_int_state = atarigen_scanline_int_state = 0; - scanline_interrupt_timer = NULL; - /* create timers */ + /* clear the timers */ for (i = 0; i < ATARIMO_MAX; i++) - scanline_timer[i] = timer_alloc(scanline_timer_callback, NULL); - - /* create a timer for scanlines */ - scanline_interrupt_timer = timer_alloc(scanline_interrupt_callback, NULL); + { + scanline_interrupt_timer_screens[i] = NULL; + scanline_interrupt_timers[i] = NULL; + scanline_timer_screens[i] = NULL; + scanline_timers[i] = NULL; + } } @@ -157,21 +163,57 @@ void atarigen_interrupt_reset(atarigen_int_func update_int) states. ---------------------------------------------------------------*/ -void atarigen_update_interrupts(void) +void atarigen_update_interrupts(running_machine *machine) { - (*update_int_callback)(Machine); + (*update_int_callback)(machine); } +/*--------------------------------------------------------------- + get_scanline_interrupt_timer_for_screen: Retrieves or + creates a scanline interrupt timer. +---------------------------------------------------------------*/ + +static emu_timer *get_scanline_interrupt_timer_for_screen(const device_config *screen) +{ + int i; + + /* find the index of the timer that matches the screen */ + for (i = 0; i < ATARIMO_MAX; i++) + { + /* matching */ + if (scanline_interrupt_timer_screens[i] == screen) + break; + + /* no more */ + if (scanline_interrupt_timer_screens[i] == NULL) + break; + } + + /* check that we still have room */ + assert(i != ATARIMO_MAX); + + /* need to create? */ + if (scanline_interrupt_timer_screens[i] == NULL) + { + scanline_interrupt_timer_screens[i] = screen; + scanline_interrupt_timers[i] = timer_alloc(scanline_interrupt_callback, (void *)screen); + } + + /* found it */ + return scanline_interrupt_timers[i]; +} + /*--------------------------------------------------------------- atarigen_scanline_int_set: Sets the scanline when the next scanline interrupt should be generated. ---------------------------------------------------------------*/ -void atarigen_scanline_int_set(int scrnum, int scanline) +void atarigen_scanline_int_set(const device_config *screen, int scanline) { - timer_adjust_oneshot(scanline_interrupt_timer, video_screen_get_time_until_pos_scrnum(scrnum, scanline, 0), scrnum); + emu_timer *timer = get_scanline_interrupt_timer_for_screen(screen); + timer_adjust_oneshot(timer, video_screen_get_time_until_pos(screen, scanline, 0), 0); } @@ -195,13 +237,13 @@ INTERRUPT_GEN( atarigen_scanline_int_gen ) WRITE16_HANDLER( atarigen_scanline_int_ack_w ) { atarigen_scanline_int_state = 0; - (*update_int_callback)(Machine); + (*update_int_callback)(machine); } WRITE32_HANDLER( atarigen_scanline_int_ack32_w ) { atarigen_scanline_int_state = 0; - (*update_int_callback)(Machine); + (*update_int_callback)(machine); } @@ -225,13 +267,13 @@ INTERRUPT_GEN( atarigen_sound_int_gen ) WRITE16_HANDLER( atarigen_sound_int_ack_w ) { atarigen_sound_int_state = 0; - (*update_int_callback)(Machine); + (*update_int_callback)(machine); } WRITE32_HANDLER( atarigen_sound_int_ack32_w ) { atarigen_sound_int_state = 0; - (*update_int_callback)(Machine); + (*update_int_callback)(machine); } @@ -255,13 +297,13 @@ INTERRUPT_GEN( atarigen_video_int_gen ) WRITE16_HANDLER( atarigen_video_int_ack_w ) { atarigen_video_int_state = 0; - (*update_int_callback)(Machine); + (*update_int_callback)(machine); } WRITE32_HANDLER( atarigen_video_int_ack32_w ) { atarigen_video_int_state = 0; - (*update_int_callback)(Machine); + (*update_int_callback)(machine); } @@ -271,11 +313,14 @@ WRITE32_HANDLER( atarigen_video_int_ack32_w ) static TIMER_CALLBACK( scanline_interrupt_callback ) { + const device_config *screen = ptr; + emu_timer *timer = get_scanline_interrupt_timer_for_screen(screen); + /* generate the interrupt */ atarigen_scanline_int_gen(machine, 0); /* set a new timer to go off at the same scan line next frame */ - timer_adjust_oneshot(scanline_interrupt_timer, video_screen_get_frame_period_scrnum(param), param); + timer_adjust_oneshot(timer, video_screen_get_frame_period(screen), 0); } @@ -563,7 +608,7 @@ void atarigen_sound_io_reset(int cpu_num) INTERRUPT_GEN( atarigen_6502_irq_gen ) { timed_int = 1; - update_6502_irq(); + update_6502_irq(machine); } @@ -575,14 +620,14 @@ INTERRUPT_GEN( atarigen_6502_irq_gen ) READ8_HANDLER( atarigen_6502_irq_ack_r ) { timed_int = 0; - update_6502_irq(); + update_6502_irq(machine); return 0; } WRITE8_HANDLER( atarigen_6502_irq_ack_w ) { timed_int = 0; - update_6502_irq(); + update_6502_irq(machine); } @@ -594,7 +639,7 @@ WRITE8_HANDLER( atarigen_6502_irq_ack_w ) void atarigen_ym2151_irq_gen(int irq) { ym2151_int = irq; - update_6502_irq(); + update_6502_irq(Machine); } @@ -694,7 +739,7 @@ WRITE8_HANDLER( atarigen_6502_sound_w ) READ8_HANDLER( atarigen_6502_sound_r ) { atarigen_cpu_to_sound_ready = 0; - cpunum_set_input_line(Machine, sound_cpu_num, INPUT_LINE_NMI, CLEAR_LINE); + cpunum_set_input_line(machine, sound_cpu_num, INPUT_LINE_NMI, CLEAR_LINE); return atarigen_cpu_to_sound; } @@ -706,12 +751,12 @@ READ8_HANDLER( atarigen_6502_sound_r ) the atarigen_ym2151_irq_gen() callback. ---------------------------------------------------------------*/ -void update_6502_irq(void) +static void update_6502_irq(running_machine *machine) { if (timed_int || ym2151_int) - cpunum_set_input_line(Machine, sound_cpu_num, M6502_IRQ_LINE, ASSERT_LINE); + cpunum_set_input_line(machine, sound_cpu_num, M6502_IRQ_LINE, ASSERT_LINE); else - cpunum_set_input_line(Machine, sound_cpu_num, M6502_IRQ_LINE, CLEAR_LINE); + cpunum_set_input_line(machine, sound_cpu_num, M6502_IRQ_LINE, CLEAR_LINE); } @@ -842,10 +887,46 @@ void atarigen_set_oki6295_vol(running_machine *machine, int volume) ***************************************************************************/ /*--------------------------------------------------------------- + get_scanline_timer_for_screen: Retrieves or + creates the the scanline timer. +---------------------------------------------------------------*/ + +static emu_timer *get_scanline_timer_for_screen(const device_config *screen) +{ + int i; + + /* find the index of the timer that matches the screen */ + for (i = 0; i < ATARIMO_MAX; i++) + { + /* matching */ + if (scanline_timer_screens[i] == screen) + break; + + /* no more */ + if (scanline_timer_screens[i] == NULL) + break; + } + + /* check that we still have room */ + assert(i != ATARIMO_MAX); + + /* need to create? */ + if (scanline_timer_screens[i] == NULL) + { + scanline_timer_screens[i] = screen; + scanline_timers[i] = timer_alloc(scanline_timer_callback, (void *)screen); + } + + /* found it */ + return scanline_timers[i]; +} + + +/*--------------------------------------------------------------- atarigen_scanline_timer_reset: Sets up the scanline timer. ---------------------------------------------------------------*/ -void atarigen_scanline_timer_reset(int scrnum, atarigen_scanline_func update_graphics, int frequency) +void atarigen_scanline_timer_reset(const device_config *screen, atarigen_scanline_func update_graphics, int frequency) { /* set the scanline callback */ scanline_callback = update_graphics; @@ -853,30 +934,33 @@ void atarigen_scanline_timer_reset(int scrnum, atarigen_scanline_func update_gra /* set a timer to go off at scanline 0 */ if (scanline_callback != NULL) - timer_adjust_oneshot(scanline_timer[scrnum], video_screen_get_time_until_pos_scrnum(scrnum, 0, 0), (scrnum << 16) | 0); + { + emu_timer *timer = get_scanline_timer_for_screen(screen); + timer_adjust_oneshot(timer, video_screen_get_time_until_pos(screen, 0, 0), 0); + } } /*--------------------------------------------------------------- - scanline_timer: Called once every n scanlines to generate - the periodic callback to the main system. + scanline_timer_callback: Called once every n scanlines + to generate the periodic callback to the main system. ---------------------------------------------------------------*/ static TIMER_CALLBACK( scanline_timer_callback ) { - int scanline = param & 0x0fff; - int scrnum = param >> 16; + const device_config *screen = ptr; + int scanline = param; /* callback */ if (scanline_callback != NULL) { - (*scanline_callback)(machine, scrnum, scanline); + (*scanline_callback)(screen, scanline); /* generate another */ scanline += scanlines_per_callback; - if (scanline >= machine->screen[scrnum].height) + if (scanline >= video_screen_get_height(screen)) scanline = 0; - timer_adjust_oneshot(scanline_timer[scrnum], video_screen_get_time_until_pos_scrnum(scrnum, scanline, 0), (scrnum << 16) | scanline); + timer_adjust_oneshot(get_scanline_timer_for_screen(screen), video_screen_get_time_until_pos(screen, scanline, 0), scanline); } } @@ -887,19 +971,56 @@ static TIMER_CALLBACK( scanline_timer_callback ) ***************************************************************************/ /*--------------------------------------------------------------- + get_scanline_timer_for_screen: Retrieves or + creates the the scanline timer. +---------------------------------------------------------------*/ + +static emu_timer *get_atarivc_eof_update_timer_for_screen(const device_config *screen) +{ + int i; + + /* find the index of the timer that matches the screen */ + for (i = 0; i < ATARIMO_MAX; i++) + { + /* matching */ + if (atarivc_eof_update_timer_screens[i] == screen) + break; + + /* no more */ + if (atarivc_eof_update_timer_screens[i] == NULL) + break; + } + + /* check that we still have room */ + assert(i != ATARIMO_MAX); + + /* need to create? */ + if (atarivc_eof_update_timer_screens[i] == NULL) + { + atarivc_eof_update_timer_screens[i] = screen; + atarivc_eof_update_timers[i] = timer_alloc(atarivc_eof_update, (void *)screen); + } + + /* found it */ + return atarivc_eof_update_timers[i]; +} + + +/*--------------------------------------------------------------- atarivc_eof_update: Callback that slurps up data and feeds it into the video controller registers every refresh. ---------------------------------------------------------------*/ static TIMER_CALLBACK( atarivc_eof_update ) { - int scrnum = param; + const device_config *screen = ptr; + emu_timer *timer = get_atarivc_eof_update_timer_for_screen(screen); int i; /* echo all the commands to the video controller */ for (i = 0; i < 0x1c; i++) if (atarivc_eof_data[i]) - atarivc_common_w(machine, scrnum, i, atarivc_eof_data[i]); + atarivc_common_w(screen, i, atarivc_eof_data[i]); /* update the scroll positions */ atarimo_set_xscroll(0, atarivc_state.mo_xscroll); @@ -913,7 +1034,7 @@ static TIMER_CALLBACK( atarivc_eof_update ) tilemap_set_scrollx(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_xscroll); tilemap_set_scrolly(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_yscroll); } - timer_adjust_oneshot(atarivc_eof_update_timer[scrnum], video_screen_get_time_until_pos_scrnum(scrnum, 0, 0), scrnum); + timer_adjust_oneshot(timer, video_screen_get_time_until_pos(screen, 0, 0), 0); /* use this for debugging the video controller values */ #if 0 @@ -936,8 +1057,10 @@ static TIMER_CALLBACK( atarivc_eof_update ) atarivc_reset: Initializes the video controller. ---------------------------------------------------------------*/ -void atarivc_reset(int scrnum, UINT16 *eof_data, int playfields) +void atarivc_reset(const device_config *screen, UINT16 *eof_data, int playfields) { + int i; + /* this allows us to manually reset eof_data to NULL if it's not used */ atarivc_eof_data = eof_data; atarivc_playfields = playfields; @@ -950,11 +1073,19 @@ void atarivc_reset(int scrnum, UINT16 *eof_data, int playfields) atarivc_state.latch1 = atarivc_state.latch2 = -1; actual_vc_latch0 = actual_vc_latch1 = -1; - atarivc_eof_update_timer[scrnum] = timer_alloc(atarivc_eof_update, NULL); + /* clear the timers */ + for (i = 0; i < ATARIMO_MAX; i++) + { + atarivc_eof_update_timer_screens[i] = NULL; + atarivc_eof_update_timers[i] = NULL; + } /* start a timer to go off a little before scanline 0 */ if (atarivc_eof_data) - timer_adjust_oneshot(atarivc_eof_update_timer[scrnum], video_screen_get_time_until_pos_scrnum(scrnum, 0, 0), scrnum); + { + emu_timer *timer = get_atarivc_eof_update_timer_for_screen(screen); + timer_adjust_oneshot(timer, video_screen_get_time_until_pos(screen, 0, 0), 0); + } } @@ -963,13 +1094,13 @@ void atarivc_reset(int scrnum, UINT16 *eof_data, int playfields) atarivc_w: Handles an I/O write to the video controller. ---------------------------------------------------------------*/ -WRITE16_HANDLER( atarivc_w ) +void atarivc_w(const device_config *screen, offs_t offset, UINT16 data, UINT16 mem_mask) { int oldword = atarivc_data[offset]; int newword = oldword; COMBINE_DATA(&newword); - atarivc_common_w(machine, 0, offset, newword); /* need to support scrnum */ + atarivc_common_w(screen, offset, newword); } @@ -979,7 +1110,7 @@ WRITE16_HANDLER( atarivc_w ) write. ---------------------------------------------------------------*/ -static void atarivc_common_w(running_machine *machine, int scrnum, offs_t offset, UINT16 newword) +static void atarivc_common_w(const device_config *screen, offs_t offset, UINT16 newword) { int oldword = atarivc_data[offset]; atarivc_data[offset] = newword; @@ -997,7 +1128,7 @@ static void atarivc_common_w(running_machine *machine, int scrnum, offs_t offset /* set the scanline interrupt here */ case 0x03: if (oldword != newword) - atarigen_scanline_int_set(scrnum, newword & 0x1ff); + atarigen_scanline_int_set(screen, newword & 0x1ff); break; /* latch enable */ @@ -1013,7 +1144,7 @@ static void atarivc_common_w(running_machine *machine, int scrnum, offs_t offset /* check for palette banking */ if (atarivc_state.palette_bank != (((newword & 0x0400) >> 10) ^ 1)) { - video_screen_update_partial_scrnum(scrnum, video_screen_get_vpos_scrnum(scrnum)); + video_screen_update_partial(screen, video_screen_get_vpos(screen)); atarivc_state.palette_bank = ((newword & 0x0400) >> 10) ^ 1; } break; @@ -1070,7 +1201,7 @@ static void atarivc_common_w(running_machine *machine, int scrnum, offs_t offset /* scanline IRQ ack here */ case 0x1e: - atarigen_scanline_int_ack_w(machine, 0, 0, 0); + atarigen_scanline_int_ack_w(screen->machine, 0, 0, 0); break; /* log anything else */ @@ -1087,7 +1218,7 @@ static void atarivc_common_w(running_machine *machine, int scrnum, offs_t offset atarivc_r: Handles an I/O read from the video controller. ---------------------------------------------------------------*/ -READ16_HANDLER( atarivc_r ) +UINT16 atarivc_r(const device_config *screen, offs_t offset) { logerror("vc_r(%02X)\n", offset); @@ -1095,11 +1226,11 @@ READ16_HANDLER( atarivc_r ) /* also sets bit 0x4000 if we're in VBLANK */ if (offset == 0) { - int result = video_screen_get_vpos(machine->primary_screen); /* need to support scrum */ + int result = video_screen_get_vpos(screen); if (result > 255) result = 255; - if (result > Machine->screen[0].visarea.max_y) /* need to support scrum */ + if (result > video_screen_get_visible_area(screen)->max_y) result |= 0x4000; return result; @@ -1287,9 +1418,9 @@ WRITE16_HANDLER( atarigen_playfield2_latched_msb_w ) 10% of the scanline period. ---------------------------------------------------------------*/ -int atarigen_get_hblank(running_machine *machine, int scrnum) +int atarigen_get_hblank(const device_config *screen) { - return (video_screen_get_hpos_scrnum(scrnum) > (machine->screen[scrnum].width * 9 / 10)); + return (video_screen_get_hpos(screen) > (video_screen_get_width(screen) * 9 / 10)); } @@ -1302,17 +1433,17 @@ WRITE16_HANDLER( atarigen_halt_until_hblank_0_w ) { /* halt the CPU until the next HBLANK */ int hpos = video_screen_get_hpos(machine->primary_screen); /* need to support scrnum */ - int hblank = Machine->screen[0].width * 9 / 10; + int hblank = machine->screen[0].width * 9 / 10; double fraction; /* if we're in hblank, set up for the next one */ if (hpos >= hblank) - hblank += Machine->screen[0].width; + hblank += machine->screen[0].width; /* halt and set a timer to wake up */ - fraction = (double)(hblank - hpos) / (double)Machine->screen[0].width; + fraction = (double)(hblank - hpos) / (double)machine->screen[0].width; timer_set(double_to_attotime(attotime_to_double(video_screen_get_scan_period(machine->primary_screen)) * fraction), NULL, 0, unhalt_cpu); - cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, ASSERT_LINE); + cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE); } @@ -1331,7 +1462,7 @@ WRITE16_HANDLER( atarigen_666_paletteram_w ) g = ((newword >> 4) & 0x3e) | ((newword >> 15) & 1); b = ((newword << 1) & 0x3e) | ((newword >> 15) & 1); - palette_set_color_rgb(Machine, offset, pal6bit(r), pal6bit(g), pal6bit(b)); + palette_set_color_rgb(machine, offset, pal6bit(r), pal6bit(g), pal6bit(b)); } @@ -1355,7 +1486,7 @@ WRITE16_HANDLER( atarigen_expanded_666_paletteram_w ) g = ((newword >> 4) & 0x3e) | ((newword >> 15) & 1); b = ((newword << 1) & 0x3e) | ((newword >> 15) & 1); - palette_set_color_rgb(Machine, palentry & 0x1ff, pal6bit(r), pal6bit(g), pal6bit(b)); + palette_set_color_rgb(machine, palentry & 0x1ff, pal6bit(r), pal6bit(g), pal6bit(b)); } } @@ -1378,7 +1509,7 @@ WRITE32_HANDLER( atarigen_666_paletteram32_w ) g = ((newword >> 4) & 0x3e) | ((newword >> 15) & 1); b = ((newword << 1) & 0x3e) | ((newword >> 15) & 1); - palette_set_color_rgb(Machine, offset * 2, pal6bit(r), pal6bit(g), pal6bit(b)); + palette_set_color_rgb(machine, offset * 2, pal6bit(r), pal6bit(g), pal6bit(b)); } if (ACCESSING_LSW32) @@ -1389,7 +1520,7 @@ WRITE32_HANDLER( atarigen_666_paletteram32_w ) g = ((newword >> 4) & 0x3e) | ((newword >> 15) & 1); b = ((newword << 1) & 0x3e) | ((newword >> 15) & 1); - palette_set_color_rgb(Machine, offset * 2 + 1, pal6bit(r), pal6bit(g), pal6bit(b)); + palette_set_color_rgb(machine, offset * 2 + 1, pal6bit(r), pal6bit(g), pal6bit(b)); } } diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h index cff80eb47ab..0fed5eb2711 100644 --- a/src/mame/machine/atarigen.h +++ b/src/mame/machine/atarigen.h @@ -30,7 +30,7 @@ typedef void (*atarigen_int_func)(running_machine *machine); -typedef void (*atarigen_scanline_func)(running_machine *machine, int scrnum, int scanline); +typedef void (*atarigen_scanline_func)(const device_config *screen, int scanline); struct atarivc_state_desc { @@ -96,9 +96,9 @@ extern struct atarivc_state_desc atarivc_state; ---------------------------------------------------------------*/ void atarigen_interrupt_reset(atarigen_int_func update_int); -void atarigen_update_interrupts(void); +void atarigen_update_interrupts(running_machine *machine); -void atarigen_scanline_int_set(int scrnum, int scanline); +void atarigen_scanline_int_set(const device_config *screen, int scanline); INTERRUPT_GEN( atarigen_scanline_int_gen ); WRITE16_HANDLER( atarigen_scanline_int_ack_w ); WRITE32_HANDLER( atarigen_scanline_int_ack32_w ); @@ -182,10 +182,10 @@ void atarigen_set_oki6295_vol(running_machine *machine, int volume); VIDEO CONTROLLER ---------------------------------------------------------------*/ -void atarivc_reset(int scrnum, UINT16 *eof_data, int playfields); +void atarivc_reset(const device_config *screen, UINT16 *eof_data, int playfields); -WRITE16_HANDLER( atarivc_w ); -READ16_HANDLER( atarivc_r ); +void atarivc_w(const device_config *screen, offs_t offset, UINT16 data, UINT16 mem_mask); +UINT16 atarivc_r(const device_config *screen, offs_t offset); INLINE void atarivc_update_pf_xscrolls(void) { @@ -218,8 +218,8 @@ WRITE16_HANDLER( atarigen_playfield2_latched_msb_w ); VIDEO HELPERS ---------------------------------------------------------------*/ -void atarigen_scanline_timer_reset(int scrnum, atarigen_scanline_func update_graphics, int frequency); -int atarigen_get_hblank(running_machine *machine, int scrnum); +void atarigen_scanline_timer_reset(const device_config *screen, atarigen_scanline_func update_graphics, int frequency); +int atarigen_get_hblank(const device_config *screen); WRITE16_HANDLER( atarigen_halt_until_hblank_0_w ); WRITE16_HANDLER( atarigen_666_paletteram_w ); WRITE16_HANDLER( atarigen_expanded_666_paletteram_w ); diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index 530c7917474..a68b8283966 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -244,28 +244,28 @@ static void hd68k_update_interrupts(running_machine *machine) INTERRUPT_GEN( hd68k_irq_gen ) { irq_state = 1; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); } WRITE16_HANDLER( hd68k_irq_ack_w ) { irq_state = 0; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); } void hdgsp_irq_gen(int state) { gsp_irq_state = state; - atarigen_update_interrupts(); + atarigen_update_interrupts(Machine); } void hdmsp_irq_gen(int state) { msp_irq_state = state; - atarigen_update_interrupts(); + atarigen_update_interrupts(Machine); } @@ -351,7 +351,7 @@ READ16_HANDLER( hd68k_port0_r ) 0x8000 = SW1 #1 */ int temp = readinputport(0); - if (atarigen_get_hblank(Machine, 0)) temp ^= 0x0002; + if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0002; temp ^= 0x0018; /* both EOCs always high for now */ return temp; } @@ -533,12 +533,12 @@ WRITE16_HANDLER( hd68k_nwr_w ) case 6: /* /GSPRES */ logerror("Write to /GSPRES(%d)\n", data); if (hdcpu_gsp != -1) - cpunum_set_input_line(Machine, hdcpu_gsp, INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_gsp, INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE); break; case 7: /* /MSPRES */ logerror("Write to /MSPRES(%d)\n", data); if (hdcpu_msp != -1) - cpunum_set_input_line(Machine, hdcpu_msp, INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_msp, INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE); break; } } @@ -627,7 +627,7 @@ static TIMER_CALLBACK( duart_callback ) logerror("DUART interrupt generated\n"); duart_read_data[0x05] |= 0x08; duart_irq_state = (duart_read_data[0x05] & duart_write_data[0x05]) != 0; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); } timer_adjust_oneshot(duart_timer, attotime_mul(duart_clock_period(), 65536), 0); } @@ -670,7 +670,7 @@ READ16_HANDLER( hd68k_duart_r ) } duart_read_data[0x05] &= ~0x08; duart_irq_state = (duart_read_data[0x05] & duart_write_data[0x05]) != 0; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); return 0x00ff; } return 0x00ff; @@ -873,7 +873,7 @@ WRITE16_HANDLER( hd68k_adsp_data_w ) { logerror("%06X:ADSP sync address written (%04X)\n", activecpu_get_previouspc(), data); timer_call_after_resynch(NULL, 0, 0); - cpu_triggerint(Machine, hdcpu_adsp); + cpu_triggerint(machine, hdcpu_adsp); } else logerror("%06X:ADSP W@%04X (%04X)\n", activecpu_get_previouspc(), offset, data); @@ -984,10 +984,10 @@ WRITE16_HANDLER( hd68k_adsp_control_w ) adsp_br = !val; logerror("ADSP /BR = %d\n", !adsp_br); if (adsp_br || adsp_halt) - cpunum_set_input_line(Machine, hdcpu_adsp, INPUT_LINE_HALT, ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_adsp, INPUT_LINE_HALT, ASSERT_LINE); else { - cpunum_set_input_line(Machine, hdcpu_adsp, INPUT_LINE_HALT, CLEAR_LINE); + cpunum_set_input_line(machine, hdcpu_adsp, INPUT_LINE_HALT, CLEAR_LINE); /* a yield in this case is not enough */ /* we would need to increase the interleaving otherwise */ /* note that this only affects the test mode */ @@ -1001,10 +1001,10 @@ WRITE16_HANDLER( hd68k_adsp_control_w ) adsp_halt = !val; logerror("ADSP /HALT = %d\n", !adsp_halt); if (adsp_br || adsp_halt) - cpunum_set_input_line(Machine, hdcpu_adsp, INPUT_LINE_HALT, ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_adsp, INPUT_LINE_HALT, ASSERT_LINE); else { - cpunum_set_input_line(Machine, hdcpu_adsp, INPUT_LINE_HALT, CLEAR_LINE); + cpunum_set_input_line(machine, hdcpu_adsp, INPUT_LINE_HALT, CLEAR_LINE); /* a yield in this case is not enough */ /* we would need to increase the interleaving otherwise */ /* note that this only affects the test mode */ @@ -1014,7 +1014,7 @@ WRITE16_HANDLER( hd68k_adsp_control_w ) case 7: logerror("ADSP reset = %d\n", val); - cpunum_set_input_line(Machine, hdcpu_adsp, INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_adsp, INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); cpu_yield(); break; @@ -1029,7 +1029,7 @@ WRITE16_HANDLER( hd68k_adsp_irq_clear_w ) { logerror("%06X:68k clears ADSP interrupt\n", activecpu_get_previouspc()); adsp_irq_state = 0; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); } @@ -1100,7 +1100,7 @@ WRITE16_HANDLER( hdadsp_special_w ) case 6: /* /GINT */ logerror("%04X:ADSP signals interrupt\n", activecpu_get_previouspc()); adsp_irq_state = 1; - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); break; case 7: /* /MP */ @@ -1155,10 +1155,10 @@ WRITE16_HANDLER( hd68k_ds3_control_w ) /* the ADSP at the next instruction boundary */ adsp_br = !val; if (adsp_br) - cpunum_set_input_line(Machine, hdcpu_adsp, INPUT_LINE_HALT, ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_adsp, INPUT_LINE_HALT, ASSERT_LINE); else { - cpunum_set_input_line(Machine, hdcpu_adsp, INPUT_LINE_HALT, CLEAR_LINE); + cpunum_set_input_line(machine, hdcpu_adsp, INPUT_LINE_HALT, CLEAR_LINE); /* a yield in this case is not enough */ /* we would need to increase the interleaving otherwise */ /* note that this only affects the test mode */ @@ -1167,7 +1167,7 @@ WRITE16_HANDLER( hd68k_ds3_control_w ) break; case 3: - cpunum_set_input_line(Machine, hdcpu_adsp, INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_adsp, INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); if (val && !ds3_reset) { ds3_gflag = 0; @@ -1265,7 +1265,7 @@ WRITE16_HANDLER( hd68k_ds3_gdata_w ) COMBINE_DATA(&ds3_g68data); ds3_g68flag = 1; ds3_gcmd = offset & 1; - cpu_triggerint(Machine, hdcpu_adsp); + cpu_triggerint(machine, hdcpu_adsp); update_ds3_irq(); } @@ -1343,13 +1343,13 @@ WRITE16_HANDLER( hdds3_special_w ) update_ds3_irq(); /* once we've written data, trigger the main CPU to wake up again */ - cpu_trigger(Machine, DS3_TRIGGER); + cpu_trigger(machine, DS3_TRIGGER); break; case 1: logerror("%04X:ADSP sets interrupt = %d\n", activecpu_get_previouspc(), (data >> 1) & 1); adsp_irq_state = (data >> 1) & 1; - hd68k_update_interrupts(Machine); + hd68k_update_interrupts(machine); break; case 2: @@ -1456,11 +1456,11 @@ WRITE16_HANDLER( hd68k_dsk_control_w ) switch (offset & 7) { case 0: /* DSPRESTN */ - cpunum_set_input_line(Machine, hdcpu_dsp32, INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_dsp32, INPUT_LINE_RESET, val ? CLEAR_LINE : ASSERT_LINE); break; case 1: /* DSPZN */ - cpunum_set_input_line(Machine, hdcpu_dsp32, INPUT_LINE_HALT, val ? CLEAR_LINE : ASSERT_LINE); + cpunum_set_input_line(machine, hdcpu_dsp32, INPUT_LINE_HALT, val ? CLEAR_LINE : ASSERT_LINE); break; case 2: /* ZW1 */ @@ -1798,7 +1798,7 @@ WRITE16_HANDLER( hdgsp_speedup1_w ) /* if $ffff is written, send an "interrupt" trigger to break us out of the spin loop */ if (hdgsp_speedup_addr[0][offset] == 0xffff) - cpu_triggerint(Machine, hdcpu_gsp); + cpu_triggerint(machine, hdcpu_gsp); } @@ -1808,7 +1808,7 @@ WRITE16_HANDLER( hdgsp_speedup2_w ) /* if $ffff is written, send an "interrupt" trigger to break us out of the spin loop */ if (hdgsp_speedup_addr[1][offset] == 0xffff) - cpu_triggerint(Machine, hdcpu_gsp); + cpu_triggerint(machine, hdcpu_gsp); } @@ -1841,7 +1841,7 @@ WRITE16_HANDLER( rdgsp_speedup1_w ) { COMBINE_DATA(&hdgsp_speedup_addr[0][offset]); if (cpu_getactivecpu() != hdcpu_gsp) - cpu_triggerint(Machine, hdcpu_gsp); + cpu_triggerint(machine, hdcpu_gsp); } @@ -1875,7 +1875,7 @@ WRITE16_HANDLER( hdmsp_speedup_w ) { COMBINE_DATA(&hdmsp_speedup_addr[offset]); if (offset == 0 && hdmsp_speedup_addr[offset] != 0) - cpu_triggerint(Machine, hdcpu_msp); + cpu_triggerint(machine, hdcpu_msp); } diff --git a/src/mame/video/atarig1.c b/src/mame/video/atarig1.c index be9dc4be1f5..1dbdcd076a8 100644 --- a/src/mame/video/atarig1.c +++ b/src/mame/video/atarig1.c @@ -154,7 +154,7 @@ WRITE16_HANDLER( atarig1_mo_control_w ) } -void atarig1_scanline_update(running_machine *machine, int scrnum, int scanline) +void atarig1_scanline_update(const device_config *screen, int scanline) { UINT16 *base = &atarigen_alpha[(scanline / 8) * 64 + 48]; int i; @@ -164,7 +164,7 @@ void atarig1_scanline_update(running_machine *machine, int scrnum, int scanline) /* keep in range */ if (base >= &atarigen_alpha[0x800]) return; - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); /* update the playfield scrolls */ for (i = 0; i < 8; i++) @@ -178,7 +178,7 @@ void atarig1_scanline_update(running_machine *machine, int scrnum, int scanline) int newscroll = ((word >> 6) + pfscroll_xoffset) & 0x1ff; if (newscroll != playfield_xscroll) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll = newscroll; } @@ -192,13 +192,13 @@ void atarig1_scanline_update(running_machine *machine, int scrnum, int scanline) int newbank = word & 7; if (newscroll != playfield_yscroll) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll = newscroll; } if (newbank != playfield_tile_bank) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); playfield_tile_bank = newbank; } diff --git a/src/mame/video/atarig42.c b/src/mame/video/atarig42.c index dbebf89f19e..1ac0302bdd4 100644 --- a/src/mame/video/atarig42.c +++ b/src/mame/video/atarig42.c @@ -157,7 +157,7 @@ WRITE16_HANDLER( atarig42_mo_control_w ) } -void atarig42_scanline_update(running_machine *machine, int scrnum, int scanline) +void atarig42_scanline_update(const device_config *screen, int scanline) { UINT16 *base = &atarigen_alpha[(scanline / 8) * 64 + 48]; int i; @@ -180,13 +180,13 @@ void atarig42_scanline_update(running_machine *machine, int scrnum, int scanline int newbank = word & 0x1f; if (newscroll != playfield_xscroll) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll = newscroll; } if (newbank != playfield_color_bank) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); playfield_color_bank = newbank; } @@ -199,13 +199,13 @@ void atarig42_scanline_update(running_machine *machine, int scrnum, int scanline int newbank = word & 7; if (newscroll != playfield_yscroll) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll = newscroll; } if (newbank != playfield_tile_bank) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); playfield_tile_bank = newbank; } diff --git a/src/mame/video/atarigt.c b/src/mame/video/atarigt.c index d7d28a606e5..7edb73d192e 100644 --- a/src/mame/video/atarigt.c +++ b/src/mame/video/atarigt.c @@ -221,7 +221,7 @@ UINT16 atarigt_colorram_r(offs_t address) * *************************************/ -void atarigt_scanline_update(running_machine *machine, int scrnum, int scanline) +void atarigt_scanline_update(const device_config *screen, int scanline) { UINT32 *base = &atarigen_alpha32[(scanline / 8) * 32 + 24]; int i; @@ -241,13 +241,13 @@ void atarigt_scanline_update(running_machine *machine, int scrnum, int scanline) int newbank = (word >> 16) & 0x1f; if (newscroll != playfield_xscroll) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll = newscroll; } if (newbank != playfield_color_bank) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_palette_offset(atarigen_playfield_tilemap, (newbank & 0x1f) << 8); playfield_color_bank = newbank; } @@ -259,13 +259,13 @@ void atarigt_scanline_update(running_machine *machine, int scrnum, int scanline) int newbank = word & 15; if (newscroll != playfield_yscroll) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll = newscroll; } if (newbank != playfield_tile_bank) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); playfield_tile_bank = newbank; } diff --git a/src/mame/video/atarigx2.c b/src/mame/video/atarigx2.c index 4ba32120bd8..3ac74fc6397 100644 --- a/src/mame/video/atarigx2.c +++ b/src/mame/video/atarigx2.c @@ -157,7 +157,7 @@ WRITE16_HANDLER( atarigx2_mo_control_w ) } -void atarigx2_scanline_update(running_machine *machine, int scrnum, int scanline) +void atarigx2_scanline_update(const device_config *screen, int scanline) { UINT32 *base = &atarigen_alpha32[(scanline / 8) * 32 + 24]; int i; @@ -179,13 +179,13 @@ void atarigx2_scanline_update(running_machine *machine, int scrnum, int scanline int newbank = (word >> 16) & 0x1f; if (newscroll != playfield_xscroll) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll = newscroll; } if (newbank != playfield_color_bank) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); playfield_color_bank = newbank; } @@ -197,13 +197,13 @@ void atarigx2_scanline_update(running_machine *machine, int scrnum, int scanline int newbank = word & 15; if (newscroll != playfield_yscroll) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll = newscroll; } if (newbank != playfield_tile_bank) { - video_screen_update_partial(machine->primary_screen, scanline + i - 1); + video_screen_update_partial(screen, scanline + i - 1); tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); playfield_tile_bank = newbank; } diff --git a/src/mame/video/batman.c b/src/mame/video/batman.c index 0d92242cab7..821084c00af 100644 --- a/src/mame/video/batman.c +++ b/src/mame/video/batman.c @@ -128,10 +128,10 @@ VIDEO_START( batman ) * *************************************/ -void batman_scanline_update(running_machine *machine, int scrnum, int scanline) +void batman_scanline_update(const device_config *screen, int scanline) { /* update the scanline parameters */ - if (scanline <= machine->screen[scrnum].visarea.max_y && atarivc_state.rowscroll_enable) + if (scanline <= video_screen_get_visible_area(screen)->max_y && atarivc_state.rowscroll_enable) { UINT16 *base = &atarigen_alpha[scanline / 8 * 64 + 48]; int scan, i; @@ -143,13 +143,13 @@ void batman_scanline_update(running_machine *machine, int scrnum, int scanline) switch (data & 15) { case 9: - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); atarivc_state.mo_xscroll = (data >> 7) & 0x1ff; atarimo_set_xscroll(0, atarivc_state.mo_xscroll); break; case 10: - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); atarivc_state.pf1_xscroll_raw = (data >> 7) & 0x1ff; atarivc_update_pf_xscrolls(); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, atarivc_state.pf0_xscroll); @@ -157,26 +157,26 @@ void batman_scanline_update(running_machine *machine, int scrnum, int scanline) break; case 11: - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); atarivc_state.pf0_xscroll_raw = (data >> 7) & 0x1ff; atarivc_update_pf_xscrolls(); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, atarivc_state.pf0_xscroll); break; case 13: - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); atarivc_state.mo_yscroll = (data >> 7) & 0x1ff; atarimo_set_yscroll(0, atarivc_state.mo_yscroll); break; case 14: - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); atarivc_state.pf1_yscroll = (data >> 7) & 0x1ff; tilemap_set_scrolly(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_yscroll); break; case 15: - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); atarivc_state.pf0_yscroll = (data >> 7) & 0x1ff; tilemap_set_scrolly(atarigen_playfield_tilemap, 0, atarivc_state.pf0_yscroll); break; diff --git a/src/mame/video/blstroid.c b/src/mame/video/blstroid.c index 3612e13d8aa..00bb75ba58f 100644 --- a/src/mame/video/blstroid.c +++ b/src/mame/video/blstroid.c @@ -107,11 +107,11 @@ static TIMER_CALLBACK( irq_on ) { /* generate the interrupt */ atarigen_scanline_int_gen(machine, 0); - atarigen_update_interrupts(); + atarigen_update_interrupts(machine); } -void blstroid_scanline_update(running_machine *machine, int scrnum, int scanline) +void blstroid_scanline_update(const device_config *screen, int scanline) { int offset = (scanline / 8) * 64 + 40; @@ -119,6 +119,7 @@ void blstroid_scanline_update(running_machine *machine, int scrnum, int scanline if (offset < 0x1000) if (atarigen_playfield[offset] & 0x8000) { + int width, vpos; attotime period_on; attotime period_off; @@ -129,8 +130,10 @@ void blstroid_scanline_update(running_machine *machine, int scrnum, int scanline /* set a timer to turn the interrupt on at HBLANK of the 7th scanline */ /* and another to turn it off one scanline later */ - period_on = video_screen_get_time_until_pos_scrnum(scrnum, video_screen_get_vpos_scrnum(scrnum) + 7, machine->screen[scrnum].width * 0.9); - period_off = video_screen_get_time_until_pos_scrnum(scrnum, video_screen_get_vpos_scrnum(scrnum) + 8, machine->screen[scrnum].width * 0.9); + width = video_screen_get_width(screen); + vpos = video_screen_get_vpos(screen); + period_on = video_screen_get_time_until_pos(screen, vpos + 7, width * 0.9); + period_off = video_screen_get_time_until_pos(screen, vpos + 8, width * 0.9); timer_set(period_on, NULL, 0, irq_on); timer_set(period_off, NULL, 0, irq_off); diff --git a/src/mame/video/capbowl.c b/src/mame/video/capbowl.c index d832e4100b6..942886d2334 100644 --- a/src/mame/video/capbowl.c +++ b/src/mame/video/capbowl.c @@ -28,7 +28,7 @@ static void generate_interrupt(running_machine *machine, int state) static const struct tms34061_interface tms34061intf = { - 0, /* the screen we are acting on */ + "main", /* the screen we are acting on */ 8, /* VRAM address is (row << rowshift) | col */ 0x10000, /* size of video RAM */ generate_interrupt /* interrupt gen callback */ @@ -67,7 +67,7 @@ WRITE8_HANDLER( capbowl_tms34061_w ) col ^= 2; /* Row address (RA0-RA8) is not dependent on the offset */ - tms34061_w(machine, col, *capbowl_rowaddress, func, data); + tms34061_w(col, *capbowl_rowaddress, func, data); } @@ -82,7 +82,7 @@ READ8_HANDLER( capbowl_tms34061_r ) col ^= 2; /* Row address (RA0-RA8) is not dependent on the offset */ - return tms34061_r(machine, col, *capbowl_rowaddress, func); + return tms34061_r(col, *capbowl_rowaddress, func); } diff --git a/src/mame/video/cyberbal.c b/src/mame/video/cyberbal.c index 04d03d8593b..54f6bc5c18f 100644 --- a/src/mame/video/cyberbal.c +++ b/src/mame/video/cyberbal.c @@ -5,7 +5,6 @@ ****************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "cyberbal.h" @@ -31,8 +30,6 @@ UINT16 *cyberbal_paletteram_1; * *************************************/ -static UINT8 current_screen; -static UINT8 total_screens; static UINT16 current_slip[2]; static UINT8 playfield_palette_bank[2]; static UINT16 playfield_xscroll[2]; @@ -198,8 +195,6 @@ static void video_start_cyberbal_common(running_machine* machine, int screens) /* reset statics */ current_slip[0] = 0; current_slip[1] = 0; - total_screens = screens; - current_screen = 0; } @@ -225,25 +220,11 @@ VIDEO_START( cyberb2p ) /************************************* * - * Screen switcher - * - *************************************/ - -void cyberbal_set_screen(int which) -{ - if (which < total_screens) - current_screen = which; -} - - - -/************************************* - * * Palette tweaker * *************************************/ -INLINE void set_palette_entry(int entry, UINT16 value) +INLINE void set_palette_entry(running_machine *machine, int entry, UINT16 value) { int r, g, b; @@ -251,7 +232,7 @@ INLINE void set_palette_entry(int entry, UINT16 value) g = ((value >> 4) & 0x3e) | ((value >> 15) & 1); b = ((value << 1) & 0x3e) | ((value >> 15) & 1); - palette_set_color_rgb(Machine, entry, pal6bit(r), pal6bit(g), pal6bit(b)); + palette_set_color_rgb(machine, entry, pal6bit(r), pal6bit(g), pal6bit(b)); } @@ -265,7 +246,7 @@ INLINE void set_palette_entry(int entry, UINT16 value) WRITE16_HANDLER( cyberbal_paletteram_0_w ) { COMBINE_DATA(&cyberbal_paletteram_0[offset]); - set_palette_entry(offset, cyberbal_paletteram_0[offset]); + set_palette_entry(machine, offset, cyberbal_paletteram_0[offset]); } READ16_HANDLER( cyberbal_paletteram_0_r ) @@ -277,7 +258,7 @@ READ16_HANDLER( cyberbal_paletteram_0_r ) WRITE16_HANDLER( cyberbal_paletteram_1_w ) { COMBINE_DATA(&cyberbal_paletteram_1[offset]); - set_palette_entry(offset + 0x800, cyberbal_paletteram_1[offset]); + set_palette_entry(machine, offset + 0x800, cyberbal_paletteram_1[offset]); } READ16_HANDLER( cyberbal_paletteram_1_r ) @@ -293,16 +274,16 @@ READ16_HANDLER( cyberbal_paletteram_1_r ) * *************************************/ -void cyberbal_scanline_update(running_machine *machine, int scrnum, int scanline) +void cyberbal_scanline_update(const device_config *screen, int scanline) { int i; + const device_config *update_screen; /* loop over screens */ - for (i = 0; i < total_screens; i++) + for (i = 0, update_screen = video_screen_first(screen->machine->config); update_screen != NULL; i++, update_screen = video_screen_next(update_screen)) { UINT16 *vram = i ? atarigen_alpha2 : atarigen_alpha; UINT16 *base = &vram[((scanline - 8) / 8) * 64 + 47]; - int update_screen = i; /* keep in range */ if (base < vram) @@ -315,7 +296,7 @@ void cyberbal_scanline_update(running_machine *machine, int scrnum, int scanline { if (((base[3] >> 1) & 7) != playfield_palette_bank[i]) { - video_screen_update_partial_scrnum(update_screen, scanline - 1); + video_screen_update_partial(update_screen, scanline - 1); playfield_palette_bank[i] = (base[3] >> 1) & 7; tilemap_set_palette_offset(i ? atarigen_playfield2_tilemap : atarigen_playfield_tilemap, playfield_palette_bank[i] << 8); } @@ -325,7 +306,7 @@ void cyberbal_scanline_update(running_machine *machine, int scrnum, int scanline int newscroll = 2 * (((base[4] >> 7) + 4) & 0x1ff); if (newscroll != playfield_xscroll[i]) { - video_screen_update_partial_scrnum(update_screen, scanline - 1); + video_screen_update_partial(update_screen, scanline - 1); tilemap_set_scrollx(i ? atarigen_playfield2_tilemap : atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll[i] = newscroll; } @@ -336,7 +317,7 @@ void cyberbal_scanline_update(running_machine *machine, int scrnum, int scanline int newscroll = ((base[5] >> 7) - (scanline)) & 0x1ff; if (newscroll != playfield_yscroll[i]) { - video_screen_update_partial_scrnum(update_screen, scanline - 1); + video_screen_update_partial(update_screen, scanline - 1); tilemap_set_scrolly(i ? atarigen_playfield2_tilemap : atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll[i] = newscroll; } @@ -345,7 +326,7 @@ void cyberbal_scanline_update(running_machine *machine, int scrnum, int scanline { if (current_slip[i] != base[7]) { - video_screen_update_partial_scrnum(update_screen, scanline - 1); + video_screen_update_partial(update_screen, scanline - 1); current_slip[i] = base[7]; } } diff --git a/src/mame/video/eprom.c b/src/mame/video/eprom.c index 4fd9a302b36..c86f88a3c4c 100644 --- a/src/mame/video/eprom.c +++ b/src/mame/video/eprom.c @@ -163,7 +163,7 @@ VIDEO_START( guts ) * *************************************/ -void eprom_scanline_update(running_machine *machine, int scrnum, int scanline) +void eprom_scanline_update(const device_config *screen, int scanline) { /* update the playfield */ if (scanline == 0) diff --git a/src/mame/video/itech8.c b/src/mame/video/itech8.c index 81aba12327b..53028bd0153 100644 --- a/src/mame/video/itech8.c +++ b/src/mame/video/itech8.c @@ -173,7 +173,7 @@ static void generate_interrupt(running_machine *machine, int state) static const struct tms34061_interface tms34061intf = { - 0, /* the screen we are acting on */ + "main", /* the screen we are acting on */ 8, /* VRAM address is (row << rowshift) | col */ 0x40000, /* size of video RAM */ generate_interrupt /* interrupt gen callback */ @@ -544,7 +544,7 @@ WRITE8_HANDLER( itech8_tms34061_w ) col ^= 2; /* Row address (RA0-RA8) is not dependent on the offset */ - tms34061_w(machine, col, 0xff, func, data); + tms34061_w(col, 0xff, func, data); } @@ -559,7 +559,7 @@ READ8_HANDLER( itech8_tms34061_r ) col ^= 2; /* Row address (RA0-RA8) is not dependent on the offset */ - return tms34061_r(machine, col, 0xff, func); + return tms34061_r(col, 0xff, func); } diff --git a/src/mame/video/midyunit.c b/src/mame/video/midyunit.c index 171d7f3a71d..ef91756644a 100644 --- a/src/mame/video/midyunit.c +++ b/src/mame/video/midyunit.c @@ -5,7 +5,6 @@ **************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "profiler.h" #include "cpu/tms34010/tms34010.h" #include "cpu/tms34010/34010ops.h" @@ -267,7 +266,7 @@ WRITE16_HANDLER( midyunit_paletteram_w ) COMBINE_DATA(&paletteram16[offset]); newword = paletteram16[offset]; - palette_set_color_rgb(Machine, offset & palette_mask, pal5bit(newword >> 10), pal5bit(newword >> 5), pal5bit(newword >> 0)); + palette_set_color_rgb(machine, offset & palette_mask, pal5bit(newword >> 10), pal5bit(newword >> 5), pal5bit(newword >> 0)); } @@ -454,7 +453,7 @@ WRITE16_HANDLER( midyunit_dma_w ) /* high bit triggers action */ command = dma_register[DMA_COMMAND]; - cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE); + cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); if (!(command & 0x8000)) return; diff --git a/src/mame/video/toobin.c b/src/mame/video/toobin.c index 54fe6a7da86..12a1f64e40c 100644 --- a/src/mame/video/toobin.c +++ b/src/mame/video/toobin.c @@ -5,7 +5,6 @@ ****************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "toobin.h" @@ -128,11 +127,11 @@ WRITE16_HANDLER( toobin_paletteram_w ) if (green) green += 38; if (blue) blue += 38; - palette_set_color(Machine, offset & 0x3ff, MAKE_RGB(red, green, blue)); + palette_set_color(machine, offset & 0x3ff, MAKE_RGB(red, green, blue)); if (!(newword & 0x8000)) - palette_set_brightness(Machine, offset & 0x3ff, brightness); + palette_set_brightness(machine, offset & 0x3ff, brightness); else - palette_set_brightness(Machine, offset & 0x3ff, 1.0); + palette_set_brightness(machine, offset & 0x3ff, 1.0); } } @@ -147,7 +146,7 @@ WRITE16_HANDLER( toobin_intensity_w ) for (i = 0; i < 0x400; i++) if (!(paletteram16[i] & 0x8000)) - palette_set_brightness(Machine, i, brightness); + palette_set_brightness(machine, i, brightness); } } diff --git a/src/mame/video/vindictr.c b/src/mame/video/vindictr.c index fd5d7186051..de345a91768 100644 --- a/src/mame/video/vindictr.c +++ b/src/mame/video/vindictr.c @@ -5,7 +5,6 @@ ****************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "machine/atarigen.h" #include "vindictr.h" #include "thunderj.h" @@ -132,7 +131,7 @@ WRITE16_HANDLER( vindictr_paletteram_w ) int g = ((data >> 4) & 15) * i; int b = ((data >> 0) & 15) * i; - palette_set_color(Machine,offset + c*2048,MAKE_RGB(r,g,b)); + palette_set_color(machine,offset + c*2048,MAKE_RGB(r,g,b)); } } @@ -144,7 +143,7 @@ WRITE16_HANDLER( vindictr_paletteram_w ) * *************************************/ -void vindictr_scanline_update(running_machine *machine, int scrnum, int scanline) +void vindictr_scanline_update(const device_config *screen, int scanline) { UINT16 *base = &atarigen_alpha[((scanline - 8) / 8) * 64 + 42]; int x; @@ -165,7 +164,7 @@ void vindictr_scanline_update(running_machine *machine, int scrnum, int scanline case 2: /* /PFB */ if (playfield_tile_bank != (data & 7)) { - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); playfield_tile_bank = data & 7; tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); } @@ -174,7 +173,7 @@ void vindictr_scanline_update(running_machine *machine, int scrnum, int scanline case 3: /* /PFHSLD */ if (playfield_xscroll != (data & 0x1ff)) { - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, data); playfield_xscroll = data & 0x1ff; } @@ -183,7 +182,7 @@ void vindictr_scanline_update(running_machine *machine, int scrnum, int scanline case 4: /* /MOHS */ if (atarimo_get_xscroll(0) != (data & 0x1ff)) { - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); atarimo_set_xscroll(0, data & 0x1ff); } break; @@ -192,19 +191,20 @@ void vindictr_scanline_update(running_machine *machine, int scrnum, int scanline break; case 6: /* /VIRQ */ - atarigen_scanline_int_gen(machine, 0); + atarigen_scanline_int_gen(screen->machine, 0); break; case 7: /* /PFVS */ { /* a new vscroll latches the offset into a counter; we must adjust for this */ int offset = scanline; - if (offset > machine->screen[0].visarea.max_y) - offset -= machine->screen[0].visarea.max_y + 1; + const rectangle *visible_area = video_screen_get_visible_area(screen); + if (offset > visible_area->max_y) + offset -= visible_area->max_y + 1; if (playfield_yscroll != ((data - offset) & 0x1ff)) { - video_screen_update_partial(machine->primary_screen, scanline - 1); + video_screen_update_partial(screen, scanline - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, data - offset); atarimo_set_yscroll(0, (data - offset) & 0x1ff); } |