diff options
| author | 2008-03-09 15:41:17 +0000 | |
|---|---|---|
| committer | 2008-03-09 15:41:17 +0000 | |
| commit | ac9778cdb0cb5e8b8cbb4e5c4a123f18919b9a40 (patch) | |
| tree | 19fe60bf58a2725b54cf62aa7ad92d3a4e7591e5 /src | |
| parent | 681b413bcef187d58b3a18450c55baed21459d55 (diff) | |
Changes first argument of video_screen_* functions to take a device_config
All callers that used 0 for the screen number now use machine->primary_screen
As a gap meassure, Where necessary, create a parallel set of video_screen_*_scrnum functions that take scrnum
All callers that specified a specific screen number now call the *_scrnum versions
Changed game info screen and overlay UI to display the screen tag instead of screen number
Diffstat (limited to 'src')
272 files changed, 1200 insertions, 1298 deletions
diff --git a/src/emu/cheat.c b/src/emu/cheat.c index 7c0c19ebdc4..6c35586bc31 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -1500,7 +1500,7 @@ void cheat_init(running_machine *machine) InitStringTable(); periodic_timer = timer_alloc(cheat_periodic, NULL); - timer_adjust_periodic(periodic_timer, video_screen_get_frame_period(0), 0, video_screen_get_frame_period(0)); + timer_adjust_periodic(periodic_timer, video_screen_get_frame_period(machine->primary_screen), 0, video_screen_get_frame_period(machine->primary_screen)); add_exit_callback(machine, cheat_exit); } @@ -9427,7 +9427,7 @@ static void HandleLocalCommandCheat(running_machine *machine, UINT32 type, UINT3 refresh /= 65536.0; - video_screen_configure(0, state->width, state->height, &state->visarea, HZ_TO_ATTOSECONDS(refresh)); + video_screen_configure(machine->primary_screen, state->width, state->height, &state->visarea, HZ_TO_ATTOSECONDS(refresh)); } break; } @@ -11403,7 +11403,7 @@ static void cheat_periodicAction(running_machine *machine, CheatAction * action) /* ----- keep if one shot + restore prevous value + delay !=0 ----- */ cheat_periodicOperation(action); - if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds))) + if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds))) { action->frameTimer = 0; @@ -11415,7 +11415,7 @@ static void cheat_periodicAction(running_machine *machine, CheatAction * action) else { /* ----- otherwise, delay ----- */ - if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds))) + if(action->frameTimer >= (parameter * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds))) { action->frameTimer = 0; @@ -11454,7 +11454,7 @@ static void cheat_periodicAction(running_machine *machine, CheatAction * action) if(currentValue != action->lastValue) { - action->frameTimer = parameter * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds); + action->frameTimer = parameter * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds); action->flags |= kActionFlag_WasModified; } diff --git a/src/emu/cpu/tms34010/34010gfx.c b/src/emu/cpu/tms34010/34010gfx.c index 4d4fa570555..ab14442c0d1 100644 --- a/src/emu/cpu/tms34010/34010gfx.c +++ b/src/emu/cpu/tms34010/34010gfx.c @@ -24,7 +24,7 @@ static void line(void) state.st |= STBIT_P; TEMP = (state.op & 0x80) ? 1 : 0; /* boundary value depends on the algorithm */ - LOGGFX(("%08X(%3d):LINE (%d,%d)-(%d,%d)\n", PC, video_screen_get_vpos(state.config->scrnum), DADDR_X, DADDR_Y, DADDR_X + DYDX_X, DADDR_Y + DYDX_Y)); + LOGGFX(("%08X(%3d):LINE (%d,%d)-(%d,%d)\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DADDR_X, DADDR_Y, DADDR_X + DYDX_X, DADDR_Y + DYDX_Y)); } if (COUNT > 0) @@ -902,7 +902,7 @@ static void pixblt_b_l(void) int trans = (IOREG(REG_CONTROL) & 0x20) >> 5; int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT B,L (%dx%d) depth=%d\n", PC, video_screen_get_vpos(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT B,L (%dx%d) depth=%d\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); pixel_op = pixel_op_table[rop]; pixel_op_timing = pixel_op_timing_table[rop]; (*pixblt_b_op_table[ix])(1); @@ -914,7 +914,7 @@ static void pixblt_b_xy(void) int trans = (IOREG(REG_CONTROL) & 0x20) >> 5; int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT B,XY (%d,%d) (%dx%d) depth=%d\n", PC, video_screen_get_vpos(state.config->scrnum), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT B,XY (%d,%d) (%dx%d) depth=%d\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); pixel_op = pixel_op_table[rop]; pixel_op_timing = pixel_op_timing_table[rop]; (*pixblt_b_op_table[ix])(0); @@ -927,7 +927,7 @@ static void pixblt_l_l(void) int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int pbh = (IOREG(REG_CONTROL) >> 8) & 1; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT L,L (%dx%d) depth=%d\n", PC, video_screen_get_vpos(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT L,L (%dx%d) depth=%d\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); pixel_op = pixel_op_table[rop]; pixel_op_timing = pixel_op_timing_table[rop]; if (!pbh) @@ -943,7 +943,7 @@ static void pixblt_l_xy(void) int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int pbh = (IOREG(REG_CONTROL) >> 8) & 1; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT L,XY (%d,%d) (%dx%d) depth=%d\n", PC, video_screen_get_vpos(state.config->scrnum), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT L,XY (%d,%d) (%dx%d) depth=%d\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); pixel_op = pixel_op_table[rop]; pixel_op_timing = pixel_op_timing_table[rop]; if (!pbh) @@ -959,7 +959,7 @@ static void pixblt_xy_l(void) int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int pbh = (IOREG(REG_CONTROL) >> 8) & 1; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT XY,L (%dx%d) depth=%d\n", PC, video_screen_get_vpos(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT XY,L (%dx%d) depth=%d\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); pixel_op = pixel_op_table[rop]; pixel_op_timing = pixel_op_timing_table[rop]; if (!pbh) @@ -975,7 +975,7 @@ static void pixblt_xy_xy(void) int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int pbh = (IOREG(REG_CONTROL) >> 8) & 1; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT XY,XY (%dx%d) depth=%d\n", PC, video_screen_get_vpos(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG) LOGGFX(("%08X(%3d):PIXBLT XY,XY (%dx%d) depth=%d\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); pixel_op = pixel_op_table[rop]; pixel_op_timing = pixel_op_timing_table[rop]; if (!pbh) @@ -990,7 +990,7 @@ static void fill_l(void) int trans = (IOREG(REG_CONTROL) & 0x20) >> 5; int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG) LOGGFX(("%08X(%3d):FILL L (%dx%d) depth=%d\n", PC, video_screen_get_vpos(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG) LOGGFX(("%08X(%3d):FILL L (%dx%d) depth=%d\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); pixel_op = pixel_op_table[rop]; pixel_op_timing = pixel_op_timing_table[rop]; (*fill_op_table[ix])(1); @@ -1002,7 +1002,7 @@ static void fill_xy(void) int trans = (IOREG(REG_CONTROL) & 0x20) >> 5; int rop = (IOREG(REG_CONTROL) >> 10) & 0x1f; int ix = trans | (rop << 1) | (psize << 6); - if (!P_FLAG) LOGGFX(("%08X(%3d):FILL XY (%d,%d) (%dx%d) depth=%d\n", PC, video_screen_get_vpos(state.config->scrnum), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); + if (!P_FLAG) LOGGFX(("%08X(%3d):FILL XY (%d,%d) (%dx%d) depth=%d\n", PC, video_screen_get_vpos_scrnum(state.config->scrnum), DADDR_X, DADDR_Y, DYDX_X, DYDX_Y, IOREG(REG_PSIZE) ? IOREG(REG_PSIZE) : 32)); pixel_op = pixel_op_table[rop]; pixel_op_timing = pixel_op_timing_table[rop]; (*fill_op_table[ix])(0); diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index cee18854f19..48bb334bb95 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -951,7 +951,7 @@ static TIMER_CALLBACK( scanline_callback ) if (!master) { vtotal = MIN(screen->height - 1, vtotal); - vcount = video_screen_get_vpos(state.config->scrnum); + vcount = video_screen_get_vpos_scrnum(state.config->scrnum); } /* update the VCOUNT */ @@ -1012,7 +1012,7 @@ static TIMER_CALLBACK( scanline_callback ) if (width != screen->width || height != screen->height || visarea.min_y != screen->visarea.min_y || visarea.max_y != screen->visarea.max_y || (state.hblank_stable > 2 && (visarea.min_x != screen->visarea.min_x || visarea.max_x != screen->visarea.max_x))) { - video_screen_configure(state.config->scrnum, width, height, &visarea, refresh); + video_screen_configure_scrnum(state.config->scrnum, width, height, &visarea, refresh); } state.hblank_stable++; } @@ -1029,7 +1029,7 @@ static TIMER_CALLBACK( scanline_callback ) /* force a partial update within the visible area */ if (vcount >= screen->visarea.min_y && vcount <= screen->visarea.max_y && state.config->scanline_callback != NULL) - video_screen_update_partial(state.config->scrnum, vcount); + video_screen_update_partial_scrnum(state.config->scrnum, vcount); /* if we are in the visible area, increment DPYADR by DUDATE */ if (vcount >= veblnk && vcount < vsblnk) @@ -1065,7 +1065,7 @@ static TIMER_CALLBACK( scanline_callback ) /* note that we add !master (0 or 1) as a attoseconds value; this makes no practical difference */ /* but helps ensure that masters are updated first before slaves */ - timer_adjust_oneshot(state.scantimer, attotime_add_attoseconds(video_screen_get_time_until_pos(state.config->scrnum, vcount, 0), !master), cpunum | (vcount << 8)); + timer_adjust_oneshot(state.scantimer, attotime_add_attoseconds(video_screen_get_time_until_pos_scrnum(state.config->scrnum, vcount, 0), !master), cpunum | (vcount << 8)); /* restore the context */ cpuintrf_pop_context(); @@ -1283,7 +1283,7 @@ WRITE16_HANDLER( tms34010_io_register_w ) } if (LOG_CONTROL_REGS) - logerror("CPU#%d@%08X: %s = %04X (%d)\n", cpunum, activecpu_get_pc(), ioreg_name[offset], IOREG(offset), video_screen_get_vpos(state.config->scrnum)); + logerror("CPU#%d@%08X: %s = %04X (%d)\n", cpunum, activecpu_get_pc(), ioreg_name[offset], IOREG(offset), video_screen_get_vpos_scrnum(state.config->scrnum)); } @@ -1320,7 +1320,7 @@ WRITE16_HANDLER( tms34020_io_register_w ) IOREG(offset) = data; if (LOG_CONTROL_REGS) - logerror("CPU#%d@%08X: %s = %04X (%d)\n", cpunum, activecpu_get_pc(), ioreg020_name[offset], IOREG(offset), video_screen_get_vpos(state.config->scrnum)); + logerror("CPU#%d@%08X: %s = %04X (%d)\n", cpunum, activecpu_get_pc(), ioreg020_name[offset], IOREG(offset), video_screen_get_vpos_scrnum(state.config->scrnum)); switch (offset) { @@ -1485,7 +1485,7 @@ READ16_HANDLER( tms34010_io_register_r ) { case REG_HCOUNT: /* scale the horizontal position from screen width to HTOTAL */ - result = video_screen_get_hpos(state.config->scrnum); + result = video_screen_get_hpos_scrnum(state.config->scrnum); total = IOREG(REG_HTOTAL) + 1; result = result * total / Machine->screen[state.config->scrnum].width; @@ -1528,7 +1528,7 @@ READ16_HANDLER( tms34020_io_register_r ) { case REG020_HCOUNT: /* scale the horizontal position from screen width to HTOTAL */ - result = video_screen_get_hpos(state.config->scrnum); + result = video_screen_get_hpos_scrnum(state.config->scrnum); total = IOREG(REG020_HTOTAL) + 1; result = result * total / Machine->screen[state.config->scrnum].width; diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c index 647d9f79327..bc2d034536c 100644 --- a/src/emu/cpuexec.c +++ b/src/emu/cpuexec.c @@ -830,7 +830,7 @@ static void on_vblank(const device_config *device, int vblank_state) if ((config->vblank_interrupts_per_frame > 1) && !(cpu[cpunum].suspend & SUSPEND_REASON_DISABLE)) { - cpu[cpunum].partial_frame_period = attotime_div(video_screen_get_frame_period(0), config->vblank_interrupts_per_frame); + cpu[cpunum].partial_frame_period = attotime_div(video_screen_get_frame_period(device->machine->primary_screen), config->vblank_interrupts_per_frame); timer_adjust_oneshot(cpu[cpunum].partial_frame_timer, cpu[cpunum].partial_frame_period, cpunum); } } @@ -951,7 +951,7 @@ static void cpu_inittimers(running_machine *machine) ipf = machine->config->cpu_slices_per_frame; if (ipf <= 0) ipf = 1; - refresh_attosecs = (numscreens == 0) ? HZ_TO_ATTOSECONDS(60) : video_screen_get_frame_period(0).attoseconds; + refresh_attosecs = (numscreens == 0) ? HZ_TO_ATTOSECONDS(60) : video_screen_get_frame_period(machine->primary_screen).attoseconds; timeslice_period = attotime_make(0, refresh_attosecs / ipf); timeslice_timer = timer_alloc(cpu_timeslicecallback, NULL); timer_adjust_periodic(timeslice_timer, timeslice_period, 0, timeslice_period); diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 1d175f5f8d1..3600dc563a4 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -657,7 +657,7 @@ static UINT64 get_logunmap(UINT32 ref) static UINT64 get_beamx(UINT32 ref) { - return video_screen_get_hpos(ref); + return video_screen_get_hpos_scrnum(ref); } @@ -667,7 +667,7 @@ static UINT64 get_beamx(UINT32 ref) static UINT64 get_beamy(UINT32 ref) { - return video_screen_get_vpos(ref); + return video_screen_get_vpos_scrnum(ref); } diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 334eaa98c81..ec4028e609c 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -1123,12 +1123,12 @@ static void registers_update(debug_view *view) case MAX_REGS + 2: if (video_screen_exists(scrnum)) - sprintf(dummy, "beamx:%3d", video_screen_get_hpos(scrnum)); + sprintf(dummy, "beamx:%3d", video_screen_get_hpos_scrnum(scrnum)); break; case MAX_REGS + 3: if (video_screen_exists(scrnum)) - sprintf(dummy, "beamy:%3d", video_screen_get_vpos(scrnum)); + sprintf(dummy, "beamy:%3d", video_screen_get_vpos_scrnum(scrnum)); break; case MAX_REGS + 4: diff --git a/src/emu/inptport.c b/src/emu/inptport.c index 15258cd50d1..4c87faac3e3 100644 --- a/src/emu/inptport.c +++ b/src/emu/inptport.c @@ -3466,7 +3466,7 @@ UINT32 readinputport(int port) result = (result & ~portinfo->vblank) | (portinfo->defvalue & portinfo->vblank); /* toggle VBLANK if we're in a VBLANK state */ - if (video_screen_get_vblank(0)) + if (video_screen_get_vblank(Machine->primary_screen)) result ^= portinfo->vblank; } return result; diff --git a/src/emu/mame.c b/src/emu/mame.c index 0039d5f7dda..5742ece9c57 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -49,6 +49,7 @@ - calls watchdog_init() [watchdog.c] to initialize the watchdog system - calls cpuint_init() [cpuint.c] to initialize the CPU interrupts - calls the driver's DRIVER_INIT callback + - calls device_list_start() [devintrf.c] to start any devices - calls video_init() [video.c] to start the video system - calls sound_init() [sound.c] to start the audio system - calls mame_debug_init() [debugcpu.c] to set up the debugger @@ -1573,12 +1574,12 @@ static void init_machine(running_machine *machine) if (machine->gamedrv->driver_init != NULL) (*machine->gamedrv->driver_init)(machine); - /* start the video and audio hardware */ - video_init(machine); - /* start up the devices */ device_list_start(machine); + /* start the video and audio hardware */ + video_init(machine); + sound_init(machine); input_port_post_init(machine); diff --git a/src/emu/profiler.c b/src/emu/profiler.c index ef113a56092..70932d9e9cf 100644 --- a/src/emu/profiler.c +++ b/src/emu/profiler.c @@ -174,7 +174,7 @@ const char *profiler_get_text(void) } if (computed || showdelay[i]) { - if (computed) showdelay[i] = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds); + if (computed) showdelay[i] = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds); showdelay[i]--; if (i < PROFILER_PROFILER) diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index 59d3dbe5575..4c9c332a660 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -677,9 +677,9 @@ static void *nesapu_start(int sndindex, int clock, const void *config) memset(info, 0, sizeof(*info)); /* Initialize global variables */ - info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds); + info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds); info->buffer_size = info->samps_per_sync; - info->real_rate = info->samps_per_sync * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds); + info->real_rate = info->samps_per_sync * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds); info->apu_incsize = (float) (clock / (float) info->real_rate); /* Use initializer calls */ diff --git a/src/emu/ui.c b/src/emu/ui.c index adea62e9ece..8065f8a1254 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -1044,7 +1044,6 @@ static int sprintf_warnings(char *buffer) int sprintf_game_info(char *buffer) { int scrcount = video_screen_count(Machine->config); - const device_config *device; char *bufptr = buffer; int cpunum, sndnum; int count; @@ -1112,13 +1111,15 @@ int sprintf_game_info(char *buffer) buffer += sprintf(bufptr, "None\n"); else { - for (device = video_screen_first(Machine->config); device != NULL; device = video_screen_next(device)) + const device_config *screen; + + for (screen = video_screen_first(Machine->config); screen != NULL; screen = video_screen_next(screen)) { - int index = device_list_index(Machine->config->devicelist, VIDEO_SCREEN, device->tag); - const screen_config *scrconfig = device->inline_config; + int index = device_list_index(Machine->config->devicelist, VIDEO_SCREEN, screen->tag); + const screen_config *scrconfig = screen->inline_config; if (scrcount > 1) - bufptr += sprintf(bufptr, "Screen %d: ", index + 1); + bufptr += sprintf(bufptr, "%s: ", slider_get_screen_desc(index)); if (scrconfig->type == SCREEN_TYPE_VECTOR) bufptr += sprintf(bufptr, "Vector\n"); @@ -1127,7 +1128,7 @@ int sprintf_game_info(char *buffer) Machine->screen[index].visarea.max_x - Machine->screen[index].visarea.min_x + 1, Machine->screen[index].visarea.max_y - Machine->screen[index].visarea.min_y + 1, (Machine->gamedrv->flags & ORIENTATION_SWAP_XY) ? "V" : "H", - ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds)); + ATTOSECONDS_TO_HZ(video_screen_get_frame_period(screen).attoseconds)); } } @@ -1311,14 +1312,14 @@ static UINT32 handler_ingame(running_machine *machine, UINT32 state) /* toggle movie recording */ if (input_ui_pressed(IPT_UI_RECORD_MOVIE)) { - if (!video_is_movie_active(Machine, 0)) + if (!video_is_movie_active(Machine->primary_screen)) { - video_movie_begin_recording(Machine, 0, NULL); + video_movie_begin_recording(Machine->primary_screen, NULL); popmessage("REC START"); } else { - video_movie_end_recording(Machine, 0); + video_movie_end_recording(Machine->primary_screen); popmessage("REC STOP"); } } @@ -1742,10 +1743,10 @@ static INT32 slider_refresh(running_machine *machine, INT32 newval, char *buffer if (buffer != NULL) { screen_state *state = &Machine->screen[arg]; - video_screen_configure(arg, state->width, state->height, &state->visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001)); - sprintf(buffer, "%s Refresh rate %.3f", slider_get_screen_desc(arg), ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds)); + video_screen_configure_scrnum(arg, state->width, state->height, &state->visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001)); + sprintf(buffer, "%s Refresh rate %.3f", slider_get_screen_desc(arg), ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds)); } - refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds); + refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds); return floor((refresh - defrefresh) * 1000.0f + 0.5f); } @@ -1907,11 +1908,12 @@ static INT32 slider_beam(running_machine *machine, INT32 newval, char *buffer, i static char *slider_get_screen_desc(int arg) { + const device_config *screen = device_list_find_by_index(Machine->config->devicelist, VIDEO_SCREEN, arg); int screen_count = video_screen_count(Machine->config); static char descbuf[256]; if (screen_count > 1) - sprintf(descbuf, "Screen #%d", arg); + sprintf(descbuf, "Screen '%s'", screen->tag); else strcpy(descbuf, "Screen"); diff --git a/src/emu/video.c b/src/emu/video.c index 150563d0c7b..3d4ee9908ab 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -38,6 +38,7 @@ #define SUBSECONDS_PER_SPEED_UPDATE (ATTOSECONDS_PER_SECOND / 4) #define PAUSED_REFRESH_RATE (30) #define MAX_VBL_CB (10) +#define DEFAULT_FRAME_PEIOD ATTOTIME_IN_HZ(60) @@ -189,7 +190,7 @@ static int finish_screen_updates(running_machine *machine); /* throttling/frameskipping/performance */ static void update_throttle(running_machine *machine, attotime emutime); static osd_ticks_t throttle_until_ticks(running_machine *machine, osd_ticks_t target_ticks); -static void update_frameskip(void); +static void update_frameskip(running_machine *machine); static void recompute_speed(running_machine *machine, attotime emutime); /* screen snapshots */ @@ -197,7 +198,7 @@ static void create_snapshot_bitmap(running_machine *machine, int scrnum); static file_error mame_fopen_next(running_machine *machine, const char *pathoption, const char *extension, mame_file **file); /* movie recording */ -static void movie_record_frame(running_machine *machine, int scrnum); +static void movie_record_frame(const device_config *screen); /* crosshair rendering */ static void crosshair_init(running_machine *machine); @@ -234,10 +235,10 @@ INLINE screen_state *get_safe_token(const device_config *device) forward -------------------------------------------------*/ -INLINE int effective_autoframeskip(void) +INLINE int effective_autoframeskip(running_machine *machine) { /* if we're fast forwarding or paused, autoframeskip is disabled */ - if (global.fastforward || mame_is_paused(Machine)) + if (global.fastforward || mame_is_paused(machine)) return FALSE; /* otherwise, it's up to the user */ @@ -268,10 +269,10 @@ INLINE int effective_frameskip(void) forward and user interface -------------------------------------------------*/ -INLINE int effective_throttle(void) +INLINE int effective_throttle(running_machine *machine) { /* if we're paused, or if the UI is active, we always throttle */ - if (mame_is_paused(Machine) || ui_is_menu_active() || ui_is_slider_active()) + if (mame_is_paused(machine) || ui_is_menu_active() || ui_is_slider_active()) return TRUE; /* if we're fast forwarding, we don't throttle */ @@ -294,7 +295,7 @@ INLINE int effective_throttle(void) void video_init(running_machine *machine) { - const device_config *device; + const device_config *screen; const char *filename; /* reset our global state */ @@ -317,14 +318,14 @@ void video_init(running_machine *machine) /* set the first screen device as the primary - this will set NULL if screenless */ machine->primary_screen = video_screen_first(machine->config); - for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device)) + for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen)) { char unique_tag[40]; - int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, device->tag); + int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, screen->tag); render_container *container = render_container_get_screen(scrnum); - screen_config *config = device->inline_config; + screen_config *config = screen->inline_config; screen_state *state = &machine->screen[scrnum]; /* allocate the private state and hook it up to the public structure */ @@ -333,19 +334,19 @@ void video_init(running_machine *machine) state->private_data = internal_state; /* allocate the VBLANK timers */ - internal_state->vblank_begin_timer = timer_alloc(vblank_begin_callback, state); - internal_state->vblank_end_timer = timer_alloc(vblank_end_callback, internal_state); + internal_state->vblank_begin_timer = timer_alloc(vblank_begin_callback, (void *)screen); + internal_state->vblank_end_timer = timer_alloc(vblank_end_callback, (void *)screen); /* allocate a timer to reset partial updates */ - internal_state->scanline0_timer = timer_alloc(scanline0_callback, internal_state); + internal_state->scanline0_timer = timer_alloc(scanline0_callback, (void *)screen); /* save some cross-reference information that makes our life easier */ internal_state->scrnum = scrnum; - internal_state->device = device; + internal_state->device = screen; /* configure the screen with the default parameters */ state->format = config->format; - video_screen_configure(scrnum, config->width, config->height, &config->visarea, config->refresh); + video_screen_configure(screen, config->width, config->height, &config->visarea, config->refresh); /* configure the default cliparea */ if (config->xoffset != 0) @@ -363,13 +364,13 @@ void video_init(running_machine *machine) /* allocate a timer to generate per-scanline updates */ if (machine->config->video_attributes & VIDEO_UPDATE_SCANLINE) { - internal_state->scanline_timer = timer_alloc(scanline_update_callback, state); - timer_adjust_oneshot(internal_state->scanline_timer, video_screen_get_time_until_pos(scrnum, 0, 0), scrnum); + internal_state->scanline_timer = timer_alloc(scanline_update_callback, (void *)screen); + timer_adjust_oneshot(internal_state->scanline_timer, video_screen_get_time_until_pos(screen, 0, 0), 0); } /* register for save states */ - assert(strlen(device->tag) < 30); - state_save_combine_module_and_tag(unique_tag, "video_screen", device->tag); + assert(strlen(screen->tag) < 30); + state_save_combine_module_and_tag(unique_tag, "video_screen", screen->tag); state_save_register_item(unique_tag, 0, internal_state->vblank_start_time.seconds); state_save_register_item(unique_tag, 0, internal_state->vblank_start_time.attoseconds); @@ -411,8 +412,8 @@ void video_init(running_machine *machine) /* start recording movie if specified */ filename = options_get_string(mame_options(), OPTION_MNGWRITE); - if (filename[0] != 0) - video_movie_begin_recording(machine, 0, filename); + if ((filename[0] != 0) && (machine->primary_screen != NULL)) + video_movie_begin_recording(machine->primary_screen, filename); } @@ -422,23 +423,26 @@ void video_init(running_machine *machine) static void video_exit(running_machine *machine) { - int scrnum; + const device_config *screen; int i; /* free crosshairs */ crosshair_free(); /* stop recording any movie */ - video_movie_end_recording(machine, 0); + if (machine->primary_screen != NULL) + video_movie_end_recording(machine->primary_screen); /* free all the graphics elements */ for (i = 0; i < MAX_GFX_ELEMENTS; i++) freegfx(machine->gfx[i]); /* free all the textures and bitmaps */ - for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) + for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen)) { - internal_screen_state *internal_state = get_internal_state(machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; + if (internal_state->texture[0] != NULL) render_texture_free(internal_state->texture[0]); if (internal_state->texture[1] != NULL) @@ -685,20 +689,28 @@ static void decode_graphics(running_machine *machine, const gfx_decode_entry *gf of a screen -------------------------------------------------*/ -void video_screen_configure(int scrnum, int width, int height, const rectangle *visarea, attoseconds_t frame_period) +void video_screen_configure(const device_config *screen, int width, int height, const rectangle *visarea, attoseconds_t frame_period) { - const screen_config *scrconfig = device_list_find_by_index(Machine->config->devicelist, VIDEO_SCREEN, scrnum)->inline_config; - screen_state *state = &Machine->screen[scrnum]; - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; + screen_config *config = screen->inline_config; + + /* validate arguments */ + assert(width > 0); + assert(height > 0); + assert(visarea != NULL); + assert(frame_period > 0); /* reallocate bitmap if necessary */ - if (scrconfig->type != SCREEN_TYPE_VECTOR) + if (config->type != SCREEN_TYPE_VECTOR) { int curwidth = 0, curheight = 0; /* reality checks */ - if (visarea->min_x < 0 || visarea->min_y < 0 || visarea->max_x >= width || visarea->max_y >= height) - fatalerror("video_screen_configure(): visible area must be contained within the width/height!"); + assert(visarea->min_x >= 0); + assert(visarea->min_y >= 0); + assert(visarea->min_x < width); + assert(visarea->min_y < height); /* extract the current width/height from the bitmap */ if (internal_state->bitmap[0] != NULL) @@ -737,9 +749,9 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle * /* allocate bitmaps */ internal_state->bitmap[0] = bitmap_alloc(curwidth, curheight, screen_format); - bitmap_set_palette(internal_state->bitmap[0], Machine->palette); + bitmap_set_palette(internal_state->bitmap[0], screen->machine->palette); internal_state->bitmap[1] = bitmap_alloc(curwidth, curheight, screen_format); - bitmap_set_palette(internal_state->bitmap[1], Machine->palette); + bitmap_set_palette(internal_state->bitmap[1], screen->machine->palette); /* allocate textures */ internal_state->texture[0] = render_texture_alloc(NULL, NULL); @@ -761,10 +773,10 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle * /* if there has been no VBLANK time specified in the MACHINE_DRIVER, compute it now from the visible area, otherwise just used the supplied value */ - if ((scrconfig->vblank == 0) && !scrconfig->oldstyle_vblank_supplied) + if ((config->vblank == 0) && !config->oldstyle_vblank_supplied) internal_state->vblank_period = (frame_period / height) * (height - (visarea->max_y + 1 - visarea->min_y)); else - internal_state->vblank_period = scrconfig->vblank; + internal_state->vblank_period = config->vblank; /* adjust speed if necessary */ if (global.refresh_speed) @@ -784,13 +796,19 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle * /* if we are on scanline 0 already, reset the update timer immediately */ /* otherwise, defer until the next scanline 0 */ - if (video_screen_get_vpos(scrnum) == 0) - timer_adjust_oneshot(internal_state->scanline0_timer, attotime_zero, scrnum); + if (video_screen_get_vpos(screen) == 0) + timer_adjust_oneshot(internal_state->scanline0_timer, attotime_zero, 0); else - timer_adjust_oneshot(internal_state->scanline0_timer, video_screen_get_time_until_pos(scrnum, 0, 0), scrnum); + timer_adjust_oneshot(internal_state->scanline0_timer, video_screen_get_time_until_pos(screen, 0, 0), 0); /* start the VBLANK timer */ - timer_adjust_oneshot(internal_state->vblank_begin_timer, video_screen_get_time_until_vblank_start(scrnum), 0); + timer_adjust_oneshot(internal_state->vblank_begin_timer, video_screen_get_time_until_vblank_start(screen), 0); +} + +void video_screen_configure_scrnum(int scrnum, int width, int height, const rectangle *visarea, attoseconds_t frame_period) +{ + internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + video_screen_configure(internal_state->device, width, height, visarea, frame_period); } @@ -799,10 +817,10 @@ void video_screen_configure(int scrnum, int width, int height, const rectangle * of a screen -------------------------------------------------*/ -void video_screen_set_visarea(int scrnum, int min_x, int max_x, int min_y, int max_y) +void video_screen_set_visarea(const device_config *screen, int min_x, int max_x, int min_y, int max_y) { - screen_state *state = &Machine->screen[scrnum]; - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; rectangle visarea; visarea.min_x = min_x; @@ -810,7 +828,13 @@ void video_screen_set_visarea(int scrnum, int min_x, int max_x, int min_y, int m visarea.min_y = min_y; visarea.max_y = max_y; - video_screen_configure(scrnum, state->width, state->height, &visarea, internal_state->frame_period); + video_screen_configure(screen, state->width, state->height, &visarea, internal_state->frame_period); +} + +void video_screen_set_visarea_scrnum(int scrnum, int min_x, int max_x, int min_y, int max_y) +{ + internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + video_screen_set_visarea(internal_state->device, min_x, max_x, min_y, max_y); } @@ -844,16 +868,16 @@ static internal_screen_state *get_internal_state(running_machine *machine, int s including the specified scanline -------------------------------------------------*/ -void video_screen_update_partial(int scrnum, int scanline) +void video_screen_update_partial(const device_config *screen, int scanline) { - screen_state *state = &Machine->screen[scrnum]; - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; rectangle clip = state->visarea; - LOG_PARTIAL_UPDATES(("Partial: video_screen_update_partial(%d,%d): ", scrnum, scanline)); + LOG_PARTIAL_UPDATES(("Partial: video_screen_update_partial(%s, %d): ", screen->tag, scanline)); /* these two checks only apply if we're allowed to skip frames */ - if (!(Machine->config->video_attributes & VIDEO_ALWAYS_UPDATE)) + if (!(screen->machine->config->video_attributes & VIDEO_ALWAYS_UPDATE)) { /* if skipping this frame, bail */ if (global.skipping_this_frame) @@ -863,7 +887,7 @@ void video_screen_update_partial(int scrnum, int scanline) } /* skip if this screen is not visible anywhere */ - if (!(render_get_live_screens_mask() & (1 << scrnum))) + if (!(render_get_live_screens_mask() & (1 << internal_state->scrnum))) { LOG_PARTIAL_UPDATES(("skipped because screen not live\n")); return; @@ -891,8 +915,8 @@ void video_screen_update_partial(int scrnum, int scanline) profiler_mark(PROFILER_VIDEO); LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y)); - if (Machine->config->video_update != NULL) - flags = (*Machine->config->video_update)(internal_state->device, scrnum, internal_state->bitmap[internal_state->curbitmap], &clip); + if (screen->machine->config->video_update != NULL) + flags = (*screen->machine->config->video_update)(screen, internal_state->scrnum, internal_state->bitmap[internal_state->curbitmap], &clip); global.partial_updates_this_frame++; profiler_mark(PROFILER_END); @@ -904,18 +928,24 @@ void video_screen_update_partial(int scrnum, 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_partial - perform an update + video_screen_update_now - perform an update from the last beam position up to the current beam position -------------------------------------------------*/ -void video_screen_update_now(int scrnum) +void video_screen_update_now(const device_config *screen) { - screen_state *state = &Machine->screen[scrnum]; - int current_vpos = video_screen_get_vpos(scrnum); - int current_hpos = video_screen_get_hpos(scrnum); + screen_state *state = get_safe_token(screen); + int current_vpos = video_screen_get_vpos(screen); + int current_hpos = video_screen_get_hpos(screen); /* since we can currently update only at the scanline level, we are trying to do the right thing by @@ -928,7 +958,7 @@ void video_screen_update_now(int scrnum) if ((current_hpos < (state->width / 2)) && (current_vpos > 0)) current_vpos = current_vpos - 1; - video_screen_update_partial(scrnum, current_vpos); + video_screen_update_partial(screen, current_vpos); } @@ -938,10 +968,10 @@ void video_screen_update_now(int scrnum) screen -------------------------------------------------*/ -int video_screen_get_vpos(int scrnum) +int video_screen_get_vpos(const device_config *screen) { - screen_state *state = &Machine->screen[scrnum]; - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; attoseconds_t delta = attotime_to_attoseconds(attotime_sub(timer_get_time(), internal_state->vblank_start_time)); int vpos; @@ -955,6 +985,12 @@ int video_screen_get_vpos(int scrnum) return (state->visarea.max_y + 1 + vpos) % state->height; } +int video_screen_get_vpos_scrnum(int scrnum) +{ + internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + return video_screen_get_vpos(internal_state->device); +} + /*------------------------------------------------- video_screen_get_hpos - returns the current @@ -962,9 +998,10 @@ int video_screen_get_vpos(int scrnum) screen -------------------------------------------------*/ -int video_screen_get_hpos(int scrnum) +int video_screen_get_hpos(const device_config *screen) { - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; attoseconds_t delta = attotime_to_attoseconds(attotime_sub(timer_get_time(), internal_state->vblank_start_time)); int vpos; @@ -981,15 +1018,22 @@ int video_screen_get_hpos(int scrnum) return delta / internal_state->pixeltime; } +int video_screen_get_hpos_scrnum(int scrnum) +{ + internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + return video_screen_get_hpos(internal_state->device); +} + /*------------------------------------------------- video_screen_get_vblank - returns the VBLANK state of a given screen -------------------------------------------------*/ -int video_screen_get_vblank(int scrnum) +int video_screen_get_vblank(const device_config *screen) { - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; return internal_state->vblank_state; } @@ -999,10 +1043,10 @@ int video_screen_get_vblank(int scrnum) state of a given screen -------------------------------------------------*/ -int video_screen_get_hblank(int scrnum) +int video_screen_get_hblank(const device_config *screen) { - screen_state *state = &Machine->screen[scrnum]; - int hpos = video_screen_get_hpos(scrnum); + screen_state *state = get_safe_token(screen); + int hpos = video_screen_get_hpos(screen); return (hpos < state->visarea.min_x || hpos > state->visarea.max_x); } @@ -1013,10 +1057,10 @@ int video_screen_get_hblank(int scrnum) at the given hpos,vpos -------------------------------------------------*/ -attotime video_screen_get_time_until_pos(int scrnum, int vpos, int hpos) +attotime video_screen_get_time_until_pos(const device_config *screen, int vpos, int hpos) { - screen_state *state = &Machine->screen[scrnum]; - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; attoseconds_t curdelta = attotime_to_attoseconds(attotime_sub(timer_get_time(), internal_state->vblank_start_time)); attoseconds_t targetdelta; @@ -1037,6 +1081,12 @@ attotime video_screen_get_time_until_pos(int scrnum, int vpos, int hpos) 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 - @@ -1044,9 +1094,11 @@ attotime video_screen_get_time_until_pos(int scrnum, int vpos, int hpos) the next VBLANK period start -------------------------------------------------*/ -attotime video_screen_get_time_until_vblank_start(int scrnum) +attotime video_screen_get_time_until_vblank_start(const device_config *screen) { - return video_screen_get_time_until_pos(scrnum, Machine->screen[scrnum].visarea.max_y + 1, 0); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; + return video_screen_get_time_until_pos(screen, screen->machine->screen[internal_state->scrnum].visarea.max_y + 1, 0); } @@ -1057,9 +1109,11 @@ attotime video_screen_get_time_until_vblank_start(int scrnum) or the end of the next VBLANK -------------------------------------------------*/ -attotime video_screen_get_time_until_vblank_end(int scrnum) +attotime video_screen_get_time_until_vblank_end(const device_config *screen) { - return video_screen_get_time_until_pos(scrnum, Machine->screen[scrnum].visarea.min_y, 0); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; + return video_screen_get_time_until_pos(screen, screen->machine->screen[internal_state->scrnum].visarea.min_y, 0); } @@ -1069,12 +1123,12 @@ attotime video_screen_get_time_until_vblank_end(int scrnum) the next VBLANK period start -------------------------------------------------*/ -attotime video_screen_get_time_until_update(int scrnum) +attotime video_screen_get_time_until_update(const device_config *screen) { - if (Machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) - return video_screen_get_time_until_vblank_end(scrnum); + if (screen->machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) + return video_screen_get_time_until_vblank_end(screen); else - return video_screen_get_time_until_vblank_start(scrnum); + return video_screen_get_time_until_vblank_start(screen); } @@ -1084,9 +1138,10 @@ attotime video_screen_get_time_until_update(int scrnum) scanline -------------------------------------------------*/ -attotime video_screen_get_scan_period(int scrnum) +attotime video_screen_get_scan_period(const device_config *screen) { - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; return attotime_make(0, internal_state->scantime); } @@ -1097,10 +1152,28 @@ attotime video_screen_get_scan_period(int scrnum) complete frame -------------------------------------------------*/ -attotime video_screen_get_frame_period(int scrnum) +attotime video_screen_get_frame_period(const device_config *screen) +{ + attotime ret; + + /* a lot of modules want to the period of the primary screen, so + if we are screenless, return something reasonable so that we don't fall over */ + if (screen == NULL) + ret = DEFAULT_FRAME_PEIOD; + else + { + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; + ret = attotime_make(0, internal_state->frame_period); + } + + return ret; +} + +attotime video_screen_get_frame_period_scrnum(int scrnum) { internal_screen_state *internal_state = get_internal_state(Machine, scrnum); - return attotime_make(0, internal_state->frame_period); + return video_screen_get_frame_period(internal_state->device); } @@ -1110,9 +1183,10 @@ attotime video_screen_get_frame_period(int scrnum) emulated machine -------------------------------------------------*/ -UINT64 video_screen_get_frame_number(int scrnum) +UINT64 video_screen_get_frame_number(const device_config *screen) { - internal_screen_state *internal_state = get_internal_state(Machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; return internal_state->frame_number; } @@ -1256,7 +1330,8 @@ DEVICE_GET_INFO( video_screen ) static TIMER_CALLBACK( vblank_begin_callback ) { int i; - screen_state *state = ptr; + const device_config *screen = ptr; + screen_state *state = get_safe_token(screen); internal_screen_state *internal_state = (internal_screen_state *)state->private_data; /* reset the starting VBLANK time */ @@ -1267,20 +1342,23 @@ static TIMER_CALLBACK( vblank_begin_callback ) /* call the screen specific callbacks */ for (i = 0; internal_state->vbl_cbs[i] != NULL; i++) - internal_state->vbl_cbs[i](internal_state->device, TRUE); + internal_state->vbl_cbs[i](screen, TRUE); - /* for the first screen, call the global callbacks */ - if (internal_state->scrnum == 0) + /* for the first screen */ + if (screen == machine->primary_screen) + { + /* call the global callbacks */ for (i = 0; global.vbl_cbs[i] != NULL; i++) global.vbl_cbs[i](machine, TRUE); - /* do we update the screen now? - only do it for the first screen */ - if (!(machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) && (internal_state->scrnum == 0)) - video_frame_update(machine, FALSE); + /* do we update the screen now? */ + if (!(machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) + video_frame_update(machine, FALSE); + } /* reset the timers */ timer_adjust_oneshot(internal_state->vblank_begin_timer, attotime_make(0, internal_state->frame_period), 0); - timer_adjust_oneshot(internal_state->vblank_end_timer, attotime_make(0, internal_state->vblank_period), 0); + timer_adjust_oneshot(internal_state->vblank_end_timer, video_screen_get_time_until_vblank_end(screen), 0); } @@ -1292,24 +1370,29 @@ static TIMER_CALLBACK( vblank_begin_callback ) static TIMER_CALLBACK( vblank_end_callback ) { int i; - internal_screen_state *internal_state = ptr; - - /* update the first screen if we didn't before */ - if ((machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) && (internal_state->scrnum == 0)) - video_frame_update(machine, FALSE); + const device_config *screen = ptr; + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; /* mark as not being in VBLANK */ internal_state->vblank_state = FALSE; /* call the screen specific callbacks */ for (i = 0; internal_state->vbl_cbs[i] != NULL; i++) - internal_state->vbl_cbs[i](internal_state->device, FALSE); + internal_state->vbl_cbs[i](screen, FALSE); - /* for the first screen, call the global callbacks */ - if (internal_state->scrnum == 0) + /* for the first screen */ + if (screen == machine->primary_screen) + { + /* call the global callbacks */ for (i = 0; global.vbl_cbs[i] != NULL; i++) global.vbl_cbs[i](machine, FALSE); + /* update if we handn't already */ + if (machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) + video_frame_update(machine, FALSE); + } + /* increment the frame number counter */ internal_state->frame_number++; } @@ -1322,13 +1405,15 @@ static TIMER_CALLBACK( vblank_end_callback ) static TIMER_CALLBACK( scanline0_callback ) { - internal_screen_state *internal_state = ptr; + const device_config *screen = ptr; + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; /* reset partial updates */ internal_state->last_partial_scan = 0; global.partial_updates_this_frame = 0; - timer_adjust_oneshot(internal_state->scanline0_timer, video_screen_get_time_until_pos(internal_state->scrnum, 0, 0), 0); + timer_adjust_oneshot(internal_state->scanline0_timer, video_screen_get_time_until_pos(screen, 0, 0), 0); } @@ -1339,18 +1424,19 @@ static TIMER_CALLBACK( scanline0_callback ) static TIMER_CALLBACK( scanline_update_callback ) { - screen_state *state = ptr; + const device_config *screen = ptr; + screen_state *state = get_safe_token(screen); internal_screen_state *internal_state = (internal_screen_state *)state->private_data; int scanline = param; /* force a partial update to the current scanline */ - video_screen_update_partial(internal_state->scrnum, scanline); + video_screen_update_partial(screen, scanline); /* compute the next visible scanline */ scanline++; if (scanline > state->visarea.max_y) scanline = state->visarea.min_y; - timer_adjust_oneshot(internal_state->scanline_timer, video_screen_get_time_until_pos(internal_state->scrnum, scanline, 0), scanline); + timer_adjust_oneshot(internal_state->scanline_timer, video_screen_get_time_until_pos(screen, scanline, 0), scanline); } @@ -1384,7 +1470,7 @@ void video_frame_update(running_machine *machine, int debug) ui_update_and_render(machine); /* if we're throttling, synchronize before rendering */ - if (!debug && !skipped_it && effective_throttle()) + if (!debug && !skipped_it && effective_throttle(machine)) update_throttle(machine, current_time); /* ask the OSD to update */ @@ -1398,7 +1484,7 @@ void video_frame_update(running_machine *machine, int debug) /* update frameskipping */ if (!debug) - update_frameskip(); + update_frameskip(machine); /* update speed computations */ if (!debug && !skipped_it) @@ -1409,7 +1495,7 @@ void video_frame_update(running_machine *machine, int debug) { /* reset partial updates if we're paused or if the debugger is active */ if (video_screen_exists(0) && (mame_is_paused(machine) || debug || mame_debug_is_active())) - scanline0_callback(machine, Machine->screen[0].private_data, 0); + scanline0_callback(machine, machine->screen[0].private_data, 0); /* otherwise, call the video EOF callback */ else if (machine->config->video_eof != NULL) @@ -1429,31 +1515,31 @@ void video_frame_update(running_machine *machine, int debug) static int finish_screen_updates(running_machine *machine) { - const device_config *device; + const device_config *screen; int anything_changed = FALSE; int livemask; /* finish updating the screens */ - for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device)) + for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen)) { - int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, device->tag); - video_screen_update_partial(scrnum, machine->screen[scrnum].visarea.max_y); + int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, screen->tag); + video_screen_update_partial(screen, machine->screen[scrnum].visarea.max_y); } /* now add the quads for all the screens */ livemask = render_get_live_screens_mask(); - for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device)) + for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen)) { - int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, device->tag); + int scrnum = device_list_index(machine->config->devicelist, VIDEO_SCREEN, screen->tag); internal_screen_state *internal_state = get_internal_state(machine, scrnum); /* only update if live */ if (livemask & (1 << scrnum)) { - const screen_config *scrconfig = device_list_find_by_index(machine->config->devicelist, VIDEO_SCREEN, scrnum)->inline_config; + const screen_config *config = device_list_find_by_index(machine->config->devicelist, VIDEO_SCREEN, scrnum)->inline_config; /* only update if empty and not a vector game; otherwise assume the driver did it directly */ - if (scrconfig->type != SCREEN_TYPE_VECTOR && (machine->config->video_attributes & VIDEO_SELF_RENDER) == 0) + if (config->type != SCREEN_TYPE_VECTOR && (machine->config->video_attributes & VIDEO_SELF_RENDER) == 0) { /* if we're not skipping the frame and if the screen actually changed, then update the texture */ if (!global.skipping_this_frame && internal_state->changed) @@ -1474,7 +1560,7 @@ static int finish_screen_updates(running_machine *machine) /* update our movie recording state */ if (!mame_is_paused(machine)) - movie_record_frame(machine, scrnum); + movie_record_frame(screen); } /* reset the screen changed flags */ @@ -1547,7 +1633,7 @@ const char *video_get_speed_text(void) dest += sprintf(dest, "fast "); /* if we're auto frameskipping, display that plus the level */ - else if (effective_autoframeskip()) + else if (effective_autoframeskip(Machine)) dest += sprintf(dest, "auto%2d/%d", effective_frameskip(), MAX_FRAMESKIP); /* otherwise, just display the frameskip plus the level */ @@ -1820,7 +1906,7 @@ static osd_ticks_t throttle_until_ticks(running_machine *machine, osd_ticks_t ta /* we're allowed to sleep via the OSD code only if we're configured to do so and we're not frameskipping due to autoframeskip, or if we're paused */ allowed_to_sleep = mame_is_paused(machine) || - (global.sleep && (!effective_autoframeskip() || effective_frameskip() == 0)); + (global.sleep && (!effective_autoframeskip(machine) || effective_frameskip() == 0)); /* loop until we reach our target */ profiler_mark(PROFILER_IDLE); @@ -1872,10 +1958,10 @@ static osd_ticks_t throttle_until_ticks(running_machine *machine, osd_ticks_t ta counters and periodically update autoframeskip -------------------------------------------------*/ -static void update_frameskip(void) +static void update_frameskip(running_machine *machine) { /* if we're throttling and autoframeskip is on, adjust */ - if (effective_throttle() && effective_autoframeskip() && global.frameskip_counter == 0) + if (effective_throttle(machine) && effective_autoframeskip(machine) && global.frameskip_counter == 0) { double speed = global.speed * 0.01; @@ -2135,9 +2221,10 @@ static file_error mame_fopen_next(running_machine *machine, const char *pathopti is currently being recorded -------------------------------------------------*/ -int video_is_movie_active(running_machine *machine, int scrnum) +int video_is_movie_active(const device_config *screen) { - internal_screen_state *internal_state = get_internal_state(machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; return (internal_state->movie_file != NULL); } @@ -2147,20 +2234,21 @@ int video_is_movie_active(running_machine *machine, int scrnum) of a MNG movie -------------------------------------------------*/ -void video_movie_begin_recording(running_machine *machine, int scrnum, const char *name) +void video_movie_begin_recording(const device_config *screen, const char *name) { - internal_screen_state *internal_state = get_internal_state(machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; file_error filerr; /* close any existing movie file */ if (internal_state->movie_file != NULL) - video_movie_end_recording(machine, scrnum); + video_movie_end_recording(screen); /* create a new movie file and start recording */ if (name != NULL) filerr = mame_fopen(SEARCHPATH_MOVIE, name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &internal_state->movie_file); else - filerr = mame_fopen_next(machine, SEARCHPATH_MOVIE, "mng", &internal_state->movie_file); + filerr = mame_fopen_next(screen->machine, SEARCHPATH_MOVIE, "mng", &internal_state->movie_file); internal_state->movie_frame = 0; } @@ -2170,9 +2258,10 @@ void video_movie_begin_recording(running_machine *machine, int scrnum, const cha a MNG movie -------------------------------------------------*/ -void video_movie_end_recording(running_machine *machine, int scrnum) +void video_movie_end_recording(const device_config *screen) { - internal_screen_state *internal_state = get_internal_state(machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; /* close the file if it exists */ if (internal_state->movie_file != NULL) @@ -2190,9 +2279,10 @@ void video_movie_end_recording(running_machine *machine, int scrnum) movie -------------------------------------------------*/ -static void movie_record_frame(running_machine *machine, int scrnum) +static void movie_record_frame(const device_config *screen) { - internal_screen_state *internal_state = get_internal_state(machine, scrnum); + screen_state *state = get_safe_token(screen); + internal_screen_state *internal_state = (internal_screen_state *)state->private_data; const rgb_t *palette; /* only record if we have a file */ @@ -2204,7 +2294,7 @@ static void movie_record_frame(running_machine *machine, int scrnum) profiler_mark(PROFILER_MOVIE_REC); /* create the bitmap */ - create_snapshot_bitmap(machine, scrnum); + create_snapshot_bitmap(screen->machine, internal_state->scrnum); /* track frames */ if (internal_state->movie_frame++ == 0) @@ -2214,7 +2304,7 @@ static void movie_record_frame(running_machine *machine, int scrnum) /* set up the text fields in the movie info */ sprintf(text, APPNAME " %s", build_version); png_add_text(&pnginfo, "Software", text); - sprintf(text, "%s %s", machine->gamedrv->manufacturer, machine->gamedrv->description); + sprintf(text, "%s %s", screen->machine->gamedrv->manufacturer, screen->machine->gamedrv->description); png_add_text(&pnginfo, "System", text); /* start the capture */ @@ -2222,18 +2312,18 @@ static void movie_record_frame(running_machine *machine, int scrnum) if (error != PNGERR_NONE) { png_free(&pnginfo); - video_movie_end_recording(machine, scrnum); + video_movie_end_recording(screen); return; } } /* write the next frame */ - palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL; - error = mng_capture_frame(mame_core_file(internal_state->movie_file), &pnginfo, global.snap_bitmap, machine->config->total_colors, palette); + palette = (screen->machine->palette != NULL) ? palette_entry_list_adjusted(screen->machine->palette) : NULL; + error = mng_capture_frame(mame_core_file(internal_state->movie_file), &pnginfo, global.snap_bitmap, screen->machine->config->total_colors, palette); png_free(&pnginfo); if (error != PNGERR_NONE) { - video_movie_end_recording(machine, scrnum); + video_movie_end_recording(screen); return; } diff --git a/src/emu/video.h b/src/emu/video.h index 2688c27bedc..2c346710a42 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -116,45 +116,52 @@ void video_init(running_machine *machine); /* ----- screen management ----- */ /* set the resolution of a screen */ -void video_screen_configure(int scrnum, int width, int height, const rectangle *visarea, attoseconds_t refresh); +void video_screen_configure(const device_config *screen, int width, int height, const rectangle *visarea, attoseconds_t refresh); +void video_screen_configure_scrnum(int scrnum, int width, int height, const rectangle *visarea, attoseconds_t refresh); /* set the visible area of a screen; this is a subset of video_screen_configure */ -void video_screen_set_visarea(int scrnum, int min_x, int max_x, int min_y, int max_y); +void video_screen_set_visarea(const device_config *screen, int min_x, int max_x, int min_y, int max_y); +void video_screen_set_visarea_scrnum(int scrnum, int min_x, int max_x, int min_y, int max_y); /* force a partial update of the screen up to and including the requested scanline */ -void video_screen_update_partial(int scrnum, int 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(int scrnum); +void video_screen_update_now(const device_config *screen); /* return the current vertical or horizontal position of the beam for a screen */ -int video_screen_get_vpos(int scrnum); -int video_screen_get_hpos(int scrnum); +int video_screen_get_vpos(const device_config *screen); +int video_screen_get_vpos_scrnum(int scrnum); +int video_screen_get_hpos(const device_config *screen); +int video_screen_get_hpos_scrnum(int scrnum); /* return the current vertical or horizontal blanking state for a screen */ -int video_screen_get_vblank(int scrnum); -int video_screen_get_hblank(int scrnum); +int video_screen_get_vblank(const device_config *screen); +int video_screen_get_hblank(const device_config *screen); /* return the time when the beam will reach a particular H,V position */ -attotime video_screen_get_time_until_pos(int scrnum, int vpos, int hpos); +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(int scrnum); +attotime video_screen_get_time_until_vblank_start(const device_config *screen); /* return the time when the beam will reach the end of VBLANK */ -attotime video_screen_get_time_until_vblank_end(int scrnum); +attotime video_screen_get_time_until_vblank_end(const device_config *screen); /* return the time when the VIDEO_UPDATE function will be called */ -attotime video_screen_get_time_until_update(int scrnum); +attotime video_screen_get_time_until_update(const device_config *screen); /* return the amount of time the beam takes to draw one scan line */ -attotime video_screen_get_scan_period(int scrnum); +attotime video_screen_get_scan_period(const device_config *screen); /* return the amount of time the beam takes to draw one complete frame */ -attotime video_screen_get_frame_period(int scrnum); +attotime video_screen_get_frame_period(const device_config *screen); +attotime video_screen_get_frame_period_scrnum(int scrnum); /* return the current frame number -- this is always increasing */ -UINT64 video_screen_get_frame_number(int scrnum); +UINT64 video_screen_get_frame_number(const device_config *screen); /* returns whether a given screen exists */ int video_screen_exists(int scrnum); @@ -173,7 +180,6 @@ void video_screen_register_global_vbl_cb(vblank_state_changed_global_func vbl_cb DEVICE_GET_INFO( video_screen ); - /* ----- global rendering ----- */ /* update the screen, handling frame skipping and rendering */ @@ -216,10 +222,9 @@ void video_save_active_screen_snapshots(running_machine *machine); /* ----- movie recording ----- */ -/* Movie recording */ -int video_is_movie_active(running_machine *machine, int scrnum); -void video_movie_begin_recording(running_machine *machine, int scrnum, const char *name); -void video_movie_end_recording(running_machine *machine, int scrnum); +int video_is_movie_active(const device_config *screen); +void video_movie_begin_recording(const device_config *screen, const char *name); +void video_movie_end_recording(const device_config *screen); /* ----- crosshair rendering ----- */ diff --git a/src/emu/video/generic.c b/src/emu/video/generic.c index 082c2ac6e17..c5b8c95550d 100644 --- a/src/emu/video/generic.c +++ b/src/emu/video/generic.c @@ -472,7 +472,7 @@ static void updateflip(void) visarea.max_y = temp; } - video_screen_configure(0, state->width, state->height, &visarea, video_screen_get_frame_period(0).attoseconds); + video_screen_configure(Machine->primary_screen, state->width, state->height, &visarea, video_screen_get_frame_period(Machine->primary_screen).attoseconds); } diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index fc77ab32921..000f527a43b 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -142,7 +142,7 @@ READ8_DEVICE_HANDLER( mc6845_status_r ) /* VBLANK bit */ if (supports_status_reg_d5[mc6845->device_type] && - (video_screen_get_vpos(mc6845->intf->scrnum) > mc6845->max_visible_y)) + (video_screen_get_vpos_scrnum(mc6845->intf->scrnum) > mc6845->max_visible_y)) ret = ret | 0x20; /* light pen latched */ @@ -274,7 +274,7 @@ static void recompute_parameters(mc6845_t *mc6845, int postload) if (LOG) logerror("M6845 config screen: HTOTAL: 0x%x VTOTAL: 0x%x MAX_X: 0x%x MAX_Y: 0x%x HSYNC: 0x%x-0x%x VSYNC: 0x%x-0x%x Freq: %ffps\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); - video_screen_configure(mc6845->intf->scrnum, horiz_pix_total, vert_pix_total, &visarea, refresh); + video_screen_configure_scrnum(mc6845->intf->scrnum, horiz_pix_total, vert_pix_total, &visarea, refresh); mc6845->has_valid_parameters = TRUE; } @@ -300,8 +300,8 @@ static void recompute_parameters(mc6845_t *mc6845, int postload) static int is_display_enabled(mc6845_t *mc6845) { - UINT16 y = video_screen_get_vpos(mc6845->intf->scrnum); - UINT16 x = video_screen_get_hpos(mc6845->intf->scrnum); + UINT16 y = video_screen_get_vpos_scrnum(mc6845->intf->scrnum); + UINT16 x = video_screen_get_hpos_scrnum(mc6845->intf->scrnum); return (y <= mc6845->max_visible_y) && (x <= mc6845->max_visible_x); } @@ -319,7 +319,7 @@ static void update_de_changed_timer(mc6845_t *mc6845) if (is_display_enabled(mc6845)) { /* normally, it's at end the current raster line */ - next_y = video_screen_get_vpos(mc6845->intf->scrnum); + next_y = video_screen_get_vpos_scrnum(mc6845->intf->scrnum); next_x = mc6845->max_visible_x + 1; /* but if visible width = horiz_pix_total, then we need @@ -339,7 +339,7 @@ static void update_de_changed_timer(mc6845_t *mc6845) else { next_x = 0; - next_y = (video_screen_get_vpos(mc6845->intf->scrnum) + 1) % mc6845->vert_pix_total; + next_y = (video_screen_get_vpos_scrnum(mc6845->intf->scrnum) + 1) % mc6845->vert_pix_total; /* if we would now fall in the vertical blanking, we need to go to the top of the screen */ @@ -348,7 +348,7 @@ static void update_de_changed_timer(mc6845_t *mc6845) } if (next_y != -1) - duration = video_screen_get_time_until_pos(mc6845->intf->scrnum, next_y, next_x); + duration = video_screen_get_time_until_pos_scrnum(mc6845->intf->scrnum, next_y, next_x); else duration = attotime_never; @@ -364,19 +364,19 @@ static void update_hsync_changed_timers(mc6845_t *mc6845) UINT16 next_y; /* we are before the HSYNC position, we trigger on the current line */ - if (video_screen_get_hpos(mc6845->intf->scrnum) < mc6845->hsync_on_pos) - next_y = video_screen_get_vpos(mc6845->intf->scrnum); + if (video_screen_get_hpos_scrnum(mc6845->intf->scrnum) < mc6845->hsync_on_pos) + next_y = video_screen_get_vpos_scrnum(mc6845->intf->scrnum); /* trigger on the next line */ else - next_y = (video_screen_get_vpos(mc6845->intf->scrnum) + 1) % mc6845->vert_pix_total; + next_y = (video_screen_get_vpos_scrnum(mc6845->intf->scrnum) + 1) % mc6845->vert_pix_total; /* if the next line is not in the visible region, go to the beginning of the screen */ if (next_y > mc6845->max_visible_y) next_y = 0; - timer_adjust_oneshot(mc6845->hsync_on_timer, video_screen_get_time_until_pos(mc6845->intf->scrnum, next_y, mc6845->hsync_on_pos) , 0); - timer_adjust_oneshot(mc6845->hsync_off_timer, video_screen_get_time_until_pos(mc6845->intf->scrnum, next_y, mc6845->hsync_off_pos), 0); + timer_adjust_oneshot(mc6845->hsync_on_timer, video_screen_get_time_until_pos_scrnum(mc6845->intf->scrnum, next_y, mc6845->hsync_on_pos) , 0); + timer_adjust_oneshot(mc6845->hsync_off_timer, video_screen_get_time_until_pos_scrnum(mc6845->intf->scrnum, next_y, mc6845->hsync_off_pos), 0); } } @@ -385,8 +385,8 @@ static void update_vsync_changed_timers(mc6845_t *mc6845) { if (mc6845->has_valid_parameters && (mc6845->vsync_on_timer != NULL)) { - timer_adjust_oneshot(mc6845->vsync_on_timer, video_screen_get_time_until_pos(mc6845->intf->scrnum, mc6845->vsync_on_pos, 0), 0); - timer_adjust_oneshot(mc6845->vsync_off_timer, video_screen_get_time_until_pos(mc6845->intf->scrnum, mc6845->vsync_off_pos, 0), 0); + timer_adjust_oneshot(mc6845->vsync_on_timer, video_screen_get_time_until_pos_scrnum(mc6845->intf->scrnum, mc6845->vsync_on_pos, 0), 0); + timer_adjust_oneshot(mc6845->vsync_off_timer, video_screen_get_time_until_pos_scrnum(mc6845->intf->scrnum, mc6845->vsync_off_pos, 0), 0); } } @@ -456,8 +456,8 @@ UINT16 mc6845_get_ma(const device_config *device) if (mc6845->has_valid_parameters) { /* clamp Y/X to the visible region */ - int y = video_screen_get_vpos(mc6845->intf->scrnum); - int x = video_screen_get_hpos(mc6845->intf->scrnum); + int y = video_screen_get_vpos_scrnum(mc6845->intf->scrnum); + int x = video_screen_get_hpos_scrnum(mc6845->intf->scrnum); /* since the MA counter stops in the blanking regions, if we are in a VBLANK, both X and Y are at their max */ @@ -486,7 +486,7 @@ UINT8 mc6845_get_ra(const device_config *device) if (mc6845->has_valid_parameters) { /* get the current vertical raster position and clamp it to the visible region */ - int y = video_screen_get_vpos(mc6845->intf->scrnum); + int y = video_screen_get_vpos_scrnum(mc6845->intf->scrnum); if (y > mc6845->max_visible_y) y = mc6845->max_visible_y; @@ -520,8 +520,8 @@ void mc6845_assert_light_pen_input(const device_config *device) if (mc6845->has_valid_parameters) { /* get the current pixel coordinates */ - y = video_screen_get_vpos(mc6845->intf->scrnum); - x = video_screen_get_hpos(mc6845->intf->scrnum); + y = video_screen_get_vpos_scrnum(mc6845->intf->scrnum); + x = video_screen_get_hpos_scrnum(mc6845->intf->scrnum); /* compute the pixel coordinate of the NEXT character -- this is when the light pen latches */ char_x = x / mc6845->intf->hpixels_per_column; @@ -538,7 +538,7 @@ void mc6845_assert_light_pen_input(const device_config *device) } /* set the timer that will latch the display address into the light pen registers */ - timer_adjust_oneshot(mc6845->light_pen_latch_timer, video_screen_get_time_until_pos(mc6845->intf->scrnum, y, x), 0); + timer_adjust_oneshot(mc6845->light_pen_latch_timer, video_screen_get_time_until_pos_scrnum(mc6845->intf->scrnum, y, x), 0); } } diff --git a/src/emu/video/tms34061.c b/src/emu/video/tms34061.c index 6f188b2a553..bf8a0c396ea 100644 --- a/src/emu/video/tms34061.c +++ b/src/emu/video/tms34061.c @@ -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(tms34061.intf.scrnum), 0); + timer_adjust_oneshot(tms34061.timer, video_screen_get_frame_period_scrnum(tms34061.intf.scrnum), 0); /* set the interrupt bit in the status reg */ tms34061.regs[TMS34061_STATUS] |= 1; @@ -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(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_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(tms34061.intf.scrnum, scanline, tms34061.regs[TMS34061_HORSTARTBLNK]), 0); + timer_adjust_oneshot(tms34061.timer, video_screen_get_time_until_pos_scrnum(tms34061.intf.scrnum, scanline, tms34061.regs[TMS34061_HORSTARTBLNK]), 0); break; /* XY offset: set the X and Y masks */ @@ -251,7 +251,7 @@ static READ8_HANDLER( register_r ) /* vertical count register: return the current scanline */ case TMS34061_VERCOUNTER: - result = (video_screen_get_vpos(0)+ tms34061.regs[TMS34061_VERENDBLNK]) % tms34061.regs[TMS34061_VERTOTAL]; + result = (video_screen_get_vpos(machine->primary_screen)+ tms34061.regs[TMS34061_VERENDBLNK]) % tms34061.regs[TMS34061_VERTOTAL]; break; } diff --git a/src/emu/video/tms9928a.c b/src/emu/video/tms9928a.c index e7e0d7baad6..395ccf17ec3 100644 --- a/src/emu/video/tms9928a.c +++ b/src/emu/video/tms9928a.c @@ -195,7 +195,7 @@ static void TMS9928A_start (running_machine *machine, const TMS9928a_interface * /* configure the screen if we weren't overridden */ if (machine->screen[0].width == LEFT_BORDER+32*8+RIGHT_BORDER && machine->screen[0].height == TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ) - video_screen_configure(0, LEFT_BORDER + 32*8 + RIGHT_BORDER, tms.top_border + 24*8 + tms.bottom_border, &tms.visarea, video_screen_get_frame_period(0).attoseconds); + video_screen_configure(machine->primary_screen, LEFT_BORDER + 32*8 + RIGHT_BORDER, tms.top_border + 24*8 + tms.bottom_border, &tms.visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); /* Video RAM */ tms.vramsize = intf->vram; diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index 825be009882..3c751463eee 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -969,10 +969,10 @@ static void swap_buffers(voodoo_state *v) { int count; - if (LOG_VBLANK_SWAP) logerror("--- swap_buffers @ %d\n", video_screen_get_vpos(v->scrnum)); + if (LOG_VBLANK_SWAP) logerror("--- swap_buffers @ %d\n", video_screen_get_vpos_scrnum(v->scrnum)); /* force a partial update */ - video_screen_update_partial(v->scrnum, video_screen_get_vpos(v->scrnum)); + video_screen_update_partial_scrnum(v->scrnum, video_screen_get_vpos_scrnum(v->scrnum)); v->fbi.video_changed = TRUE; /* keep a history of swap intervals */ @@ -1082,11 +1082,11 @@ static void swap_buffers(voodoo_state *v) static void adjust_vblank_timer(voodoo_state *v) { - attotime vblank_period = video_screen_get_time_until_pos(v->scrnum, v->fbi.vsyncscan, 0); + attotime vblank_period = video_screen_get_time_until_pos_scrnum(v->scrnum, v->fbi.vsyncscan, 0); /* if zero, adjust to next frame, otherwise we may get stuck in an infinite loop */ if (attotime_compare(vblank_period, attotime_zero) == 0) - vblank_period = video_screen_get_frame_period(v->scrnum); + vblank_period = video_screen_get_frame_period_scrnum(v->scrnum); timer_adjust_oneshot(v->fbi.vblank_timer, vblank_period, 0); } @@ -1135,7 +1135,7 @@ static TIMER_CALLBACK( vblank_callback ) swap_buffers(v); /* set a timer for the next off state */ - timer_set(video_screen_get_time_until_pos(v->scrnum, 0, 0), v, 0, vblank_off_callback); + timer_set(video_screen_get_time_until_pos_scrnum(v->scrnum, 0, 0), v, 0, vblank_off_callback); /* set internal state and call the client */ v->fbi.vblank = TRUE; @@ -2610,7 +2610,7 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) int vvis = (v->reg[videoDimensions].u >> 16) & 0x3ff; int hbp = (v->reg[backPorch].u & 0xff) + 2; int vbp = (v->reg[backPorch].u >> 16) & 0xff; - attoseconds_t refresh = video_screen_get_frame_period(v->scrnum).attoseconds; + attoseconds_t refresh = video_screen_get_frame_period_scrnum(v->scrnum).attoseconds; attoseconds_t stdperiod, medperiod, vgaperiod; attoseconds_t stddiff, meddiff, vgadiff; rectangle visarea; @@ -2645,17 +2645,17 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) /* configure the screen based on which one matches the closest */ if (stddiff < meddiff && stddiff < vgadiff) { - video_screen_configure(v->scrnum, htotal, vtotal, &visarea, stdperiod); + video_screen_configure_scrnum(v->scrnum, htotal, vtotal, &visarea, stdperiod); mame_printf_debug("Standard resolution, %f Hz\n", ATTOSECONDS_TO_HZ(stdperiod)); } else if (meddiff < vgadiff) { - video_screen_configure(v->scrnum, htotal, vtotal, &visarea, medperiod); + video_screen_configure_scrnum(v->scrnum, htotal, vtotal, &visarea, medperiod); mame_printf_debug("Medium resolution, %f Hz\n", ATTOSECONDS_TO_HZ(medperiod)); } else { - video_screen_configure(v->scrnum, htotal, vtotal, &visarea, vgaperiod); + video_screen_configure_scrnum(v->scrnum, htotal, vtotal, &visarea, vgaperiod); mame_printf_debug("VGA resolution, %f Hz\n", ATTOSECONDS_TO_HZ(vgaperiod)); } @@ -3851,7 +3851,7 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) /* return the current scanline for now */ case vRetrace: - result = video_screen_get_vpos(v->scrnum); + result = video_screen_get_vpos_scrnum(v->scrnum); break; /* reserved area in the TMU read by the Vegas startup sequence */ @@ -4538,7 +4538,7 @@ static void banshee_io_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem v->fbi.width = data & 0xfff; if (data & 0xfff000) v->fbi.height = (data >> 12) & 0xfff; - video_screen_set_visarea(v->scrnum, 0, v->fbi.width - 1, 0, v->fbi.height - 1); + video_screen_set_visarea_scrnum(v->scrnum, 0, v->fbi.width - 1, 0, v->fbi.height - 1); adjust_vblank_timer(v); if (LOG_REGISTERS) logerror("%08X:banshee_io_w(%s) = %08X & %08X\n", activecpu_get_pc(), banshee_io_reg_name[offset], data, ~mem_mask); diff --git a/src/mame/audio/cchasm.c b/src/mame/audio/cchasm.c index 27d84ad55dd..e118fb7ba91 100644 --- a/src/mame/audio/cchasm.c +++ b/src/mame/audio/cchasm.c @@ -181,7 +181,7 @@ SOUND_START( cchasm ) ctc_intf.baseclock = cpunum_get_clock(1); z80ctc_init (0, &ctc_intf); - timer_pulse(video_screen_get_frame_period(0), NULL, 0, cchasm_sh_update); + timer_pulse(video_screen_get_frame_period(machine->primary_screen), NULL, 0, cchasm_sh_update); } diff --git a/src/mame/audio/cinemat.c b/src/mame/audio/cinemat.c index 4febaa4d2be..86b6f0f6f02 100644 --- a/src/mame/audio/cinemat.c +++ b/src/mame/audio/cinemat.c @@ -871,14 +871,14 @@ static void starcas_sound_w(UINT8 sound_val, UINT8 bits_changed) target_pitch = 0x10000 + (target_pitch << 12); /* once per frame slide the pitch toward the target */ - if (video_screen_get_frame_number(0) > last_frame) + if (video_screen_get_frame_number(Machine->primary_screen) > last_frame) { if (current_pitch > target_pitch) current_pitch -= 300; if (current_pitch < target_pitch) current_pitch += 200; sample_set_freq(4, current_pitch); - last_frame = video_screen_get_frame_number(0); + last_frame = video_screen_get_frame_number(Machine->primary_screen); } /* remember the previous value */ @@ -974,7 +974,7 @@ static void solarq_sound_w(UINT8 sound_val, UINT8 bits_changed) target_volume = 0; /* ramp the thrust volume */ - if (sample_playing(2) && video_screen_get_frame_number(0) > last_frame) + if (sample_playing(2) && video_screen_get_frame_number(Machine->primary_screen) > last_frame) { if (current_volume > target_volume) current_volume -= 0.078f; @@ -984,7 +984,7 @@ static void solarq_sound_w(UINT8 sound_val, UINT8 bits_changed) sample_set_volume(2, current_volume); else sample_stop(2); - last_frame = video_screen_get_frame_number(0); + last_frame = video_screen_get_frame_number(Machine->primary_screen); } /* fire - falling edge */ @@ -1251,14 +1251,14 @@ static void wotw_sound_w(UINT8 sound_val, UINT8 bits_changed) target_pitch = 0x10000 + (target_pitch << 12); /* once per frame slide the pitch toward the target */ - if (video_screen_get_frame_number(0) > last_frame) + if (video_screen_get_frame_number(Machine->primary_screen) > last_frame) { if (current_pitch > target_pitch) current_pitch -= 300; if (current_pitch < target_pitch) current_pitch += 200; sample_set_freq(4, current_pitch); - last_frame = video_screen_get_frame_number(0); + last_frame = video_screen_get_frame_number(Machine->primary_screen); } /* remember the previous value */ @@ -1363,14 +1363,14 @@ static void wotwc_sound_w(UINT8 sound_val, UINT8 bits_changed) target_pitch = 0x10000 + (target_pitch << 12); /* once per frame slide the pitch toward the target */ - if (video_screen_get_frame_number(0) > last_frame) + if (video_screen_get_frame_number(Machine->primary_screen) > last_frame) { if (current_pitch > target_pitch) current_pitch -= 300; if (current_pitch < target_pitch) current_pitch += 200; sample_set_freq(4, current_pitch); - last_frame = video_screen_get_frame_number(0); + last_frame = video_screen_get_frame_number(Machine->primary_screen); } /* remember the previous value */ diff --git a/src/mame/audio/galaxian.c b/src/mame/audio/galaxian.c index 985aedae6be..5f78e8d8a67 100644 --- a/src/mame/audio/galaxian.c +++ b/src/mame/audio/galaxian.c @@ -365,7 +365,7 @@ static void galaxian_sh_start(void) lfotimer = timer_alloc(lfo_timer_cb, NULL); - timer_pulse(video_screen_get_frame_period(0), NULL, 0, galaxian_sh_update); + timer_pulse(video_screen_get_frame_period(Machine->primary_screen), NULL, 0, galaxian_sh_update); state_save_register_global(freq); state_save_register_global(noise_enable); diff --git a/src/mame/audio/senjyo.c b/src/mame/audio/senjyo.c index b17f5db9d05..04922d7c442 100644 --- a/src/mame/audio/senjyo.c +++ b/src/mame/audio/senjyo.c @@ -84,5 +84,5 @@ void senjyo_sh_start(void) sample_set_volume(0,0); sample_start_raw(0,_single,SINGLE_LENGTH,single_rate,1); - timer_pulse(video_screen_get_frame_period(0), NULL, 0, senjyo_sh_update); + timer_pulse(video_screen_get_frame_period(Machine->primary_screen), NULL, 0, senjyo_sh_update); } diff --git a/src/mame/drivers/acefruit.c b/src/mame/drivers/acefruit.c index 6ae2b3fe7ee..892fd593afe 100644 --- a/src/mame/drivers/acefruit.c +++ b/src/mame/drivers/acefruit.c @@ -36,14 +36,14 @@ static emu_timer *acefruit_refresh_timer; static TIMER_CALLBACK( acefruit_refresh ) { - int vpos = video_screen_get_vpos( 0 ); + int vpos = video_screen_get_vpos(machine->primary_screen); - video_screen_update_partial( 0, vpos ); + video_screen_update_partial(machine->primary_screen, vpos ); acefruit_update_irq(machine, vpos ); vpos = ( ( vpos / 8 ) + 1 ) * 8; - timer_adjust_oneshot( acefruit_refresh_timer, video_screen_get_time_until_pos( 0, vpos, 0 ), 0 ); + timer_adjust_oneshot( acefruit_refresh_timer, video_screen_get_time_until_pos(machine->primary_screen, vpos, 0 ), 0 ); } static VIDEO_START( acefruit ) diff --git a/src/mame/drivers/astinvad.c b/src/mame/drivers/astinvad.c index 6330812935f..85c37723476 100644 --- a/src/mame/drivers/astinvad.c +++ b/src/mame/drivers/astinvad.c @@ -186,7 +186,7 @@ static TIMER_CALLBACK( kamizake_int_gen ) /* interrupts are asserted on every state change of the 128V line */ cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); param ^= 128; - timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(0, param, 0), param); + timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(machine->primary_screen, param, 0), param); /* an RC circuit turns the interrupt off after a short amount of time */ timer_set(double_to_attotime(300 * 0.1e-6), NULL, 0, kamikaze_int_off); @@ -197,7 +197,7 @@ static MACHINE_START( kamikaze ) { ppi8255_init(&ppi8255_intf); int_timer = timer_alloc(kamizake_int_gen, NULL); - timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(0, 128, 0), 128); + timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(machine->primary_screen, 128, 0), 128); } diff --git a/src/mame/drivers/astrof.c b/src/mame/drivers/astrof.c index 303319c2150..0664ebd1be3 100644 --- a/src/mame/drivers/astrof.c +++ b/src/mame/drivers/astrof.c @@ -100,7 +100,7 @@ static TIMER_CALLBACK( irq_callback ) { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, VBSTART, 0), 0); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, VBSTART, 0), 0); } @@ -110,9 +110,9 @@ static void create_irq_timer(void) } -static void start_irq_timer(void) +static void start_irq_timer(running_machine *machine) { - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, VBSTART, 0), 0); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, VBSTART, 0), 0); } @@ -248,7 +248,7 @@ static WRITE8_HANDLER( video_control_1_w ) /* D2 - not connected in the schematics, but at one point Astro Fighter sets it to 1 */ /* D3-D7 - not connected */ - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); } @@ -269,7 +269,7 @@ static void astrof_set_video_control_2(UINT8 data) static WRITE8_HANDLER( astrof_video_control_2_w ) { astrof_set_video_control_2(data); - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); } @@ -287,7 +287,7 @@ static void spfghmk2_set_video_control_2(UINT8 data) static WRITE8_HANDLER( spfghmk2_video_control_2_w ) { spfghmk2_set_video_control_2(data); - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); } @@ -304,7 +304,7 @@ static void tomahawk_set_video_control_2(UINT8 data) static WRITE8_HANDLER( tomahawk_video_control_2_w ) { tomahawk_set_video_control_2(data); - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); } @@ -486,7 +486,7 @@ static MACHINE_START( tomahawk ) static MACHINE_RESET( astrof ) { - start_irq_timer(); + start_irq_timer(machine); } diff --git a/src/mame/drivers/atetris.c b/src/mame/drivers/atetris.c index 396cb5ac02f..9f99a5ce43c 100644 --- a/src/mame/drivers/atetris.c +++ b/src/mame/drivers/atetris.c @@ -87,7 +87,7 @@ static TIMER_CALLBACK( interrupt_gen ) scanline += 32; if (scanline >= 256) scanline -= 256; - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -130,7 +130,7 @@ static MACHINE_RESET( atetris ) reset_bank(); /* start interrupts going (32V clocked by 16V) */ - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, 48, 0), 48); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 48, 0), 48); } diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c index 31a49a6851b..ed01c85f7f9 100644 --- a/src/mame/drivers/backfire.c +++ b/src/mame/drivers/backfire.c @@ -104,7 +104,7 @@ static void draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectang y = backfire_spriteram32[offs]&0xffff; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = backfire_spriteram32[offs+2]&0xffff; colour = (x >>9) & 0x1f; diff --git a/src/mame/drivers/batman.c b/src/mame/drivers/batman.c index fe78bba9493..be794e76565 100644 --- a/src/mame/drivers/batman.c +++ b/src/mame/drivers/batman.c @@ -100,7 +100,7 @@ static WRITE16_HANDLER( latch_w ) /* alpha bank is selected by the upper 4 bits */ if ((oldword ^ latch_data) & 0x7000) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); tilemap_mark_all_tiles_dirty(atarigen_alpha_tilemap); batman_alpha_tile_bank = (latch_data >> 12) & 7; } diff --git a/src/mame/drivers/beaminv.c b/src/mame/drivers/beaminv.c index e9288d6c625..c5f955d481e 100644 --- a/src/mame/drivers/beaminv.c +++ b/src/mame/drivers/beaminv.c @@ -87,7 +87,7 @@ static TIMER_CALLBACK( interrupt_callback ) next_interrupt_number = (interrupt_number + 1) % INTERRUPTS_PER_FRAME; next_vpos = interrupt_lines[next_interrupt_number]; - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, next_vpos, 0), next_interrupt_number); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, next_vpos, 0), next_interrupt_number); } @@ -97,10 +97,10 @@ static void create_interrupt_timer(void) } -static void start_interrupt_timer(void) +static void start_interrupt_timer(running_machine *machine) { int vpos = interrupt_lines[0]; - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, vpos, 0), 0); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, vpos, 0), 0); } @@ -129,7 +129,7 @@ static MACHINE_START( beaminv ) static MACHINE_RESET( beaminv ) { - start_interrupt_timer(); + start_interrupt_timer(machine); } @@ -168,7 +168,7 @@ static VIDEO_UPDATE( beaminv ) static READ8_HANDLER( v128_r ) { - return (video_screen_get_vpos(0) >> 7) & 0x01; + return (video_screen_get_vpos(machine->primary_screen) >> 7) & 0x01; } diff --git a/src/mame/drivers/beathead.c b/src/mame/drivers/beathead.c index ac6c976c256..a7cfdc884ac 100644 --- a/src/mame/drivers/beathead.c +++ b/src/mame/drivers/beathead.c @@ -157,7 +157,7 @@ static TIMER_CALLBACK( scanline_callback ) update_interrupts(machine); /* set the timer for the next one */ - timer_set(double_to_attotime(attotime_to_double(video_screen_get_time_until_pos(0, scanline, 0)) - hblank_offset), NULL, scanline, scanline_callback); + timer_set(double_to_attotime(attotime_to_double(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0)) - hblank_offset), NULL, scanline, scanline_callback); } @@ -173,8 +173,8 @@ static MACHINE_RESET( beathead ) memcpy(ram_base, rom_base, 0x40); /* compute the timing of the HBLANK interrupt and set the first timer */ - hblank_offset = attotime_to_double(video_screen_get_scan_period(0)) * ((455. - 336. - 25.) / 455.); - timer_set(double_to_attotime(attotime_to_double(video_screen_get_time_until_pos(0, 0, 0)) - hblank_offset), NULL, 0, scanline_callback); + hblank_offset = attotime_to_double(video_screen_get_scan_period(machine->primary_screen)) * ((455. - 336. - 25.) / 455.); + timer_set(double_to_attotime(attotime_to_double(video_screen_get_time_until_pos(machine->primary_screen, 0, 0)) - hblank_offset), NULL, 0, scanline_callback); /* reset IRQs */ irq_line_state = CLEAR_LINE; diff --git a/src/mame/drivers/berzerk.c b/src/mame/drivers/berzerk.c index a56e6cea70d..fb2f66b647f 100644 --- a/src/mame/drivers/berzerk.c +++ b/src/mame/drivers/berzerk.c @@ -167,7 +167,7 @@ static TIMER_CALLBACK( irq_callback ) next_v256 = irq_trigger_v256s[next_irq_number]; next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_v256); - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, next_vpos, 0), next_irq_number); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, next_vpos, 0), next_irq_number); } @@ -177,10 +177,10 @@ static void create_irq_timer(void) } -static void start_irq_timer(void) +static void start_irq_timer(running_machine *machine) { int vpos = vysnc_chain_counter_to_vpos(irq_trigger_counts[0], irq_trigger_v256s[0]); - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, vpos, 0), 0); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, vpos, 0), 0); } @@ -244,7 +244,7 @@ static TIMER_CALLBACK( nmi_callback ) next_v256 = nmi_trigger_v256s[next_nmi_number]; next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_v256); - timer_adjust_oneshot(nmi_timer, video_screen_get_time_until_pos(0, next_vpos, 0), next_nmi_number); + timer_adjust_oneshot(nmi_timer, video_screen_get_time_until_pos(machine->primary_screen, next_vpos, 0), next_nmi_number); } @@ -254,10 +254,10 @@ static void create_nmi_timer(void) } -static void start_nmi_timer(void) +static void start_nmi_timer(running_machine *machine) { int vpos = vysnc_chain_counter_to_vpos(nmi_trigger_counts[0], nmi_trigger_v256s[0]); - timer_adjust_oneshot(nmi_timer, video_screen_get_time_until_pos(0, vpos, 0), 0); + timer_adjust_oneshot(nmi_timer, video_screen_get_time_until_pos(machine->primary_screen, vpos, 0), 0); } @@ -296,8 +296,8 @@ static MACHINE_RESET( berzerk ) set_led_status(0, 0); magicram_control = 0; - start_irq_timer(); - start_nmi_timer(); + start_irq_timer(machine); + start_nmi_timer(machine); } @@ -377,7 +377,7 @@ static READ8_HANDLER( intercept_v256_r ) UINT8 counter; UINT8 v256; - vpos_to_vysnc_chain_counter(video_screen_get_vpos(0), &counter, &v256); + vpos_to_vysnc_chain_counter(video_screen_get_vpos(machine->primary_screen), &counter, &v256); return (!intercept << 7) | v256; } diff --git a/src/mame/drivers/bishjan.c b/src/mame/drivers/bishjan.c index 4b1a6ba6065..d3022eb07fc 100644 --- a/src/mame/drivers/bishjan.c +++ b/src/mame/drivers/bishjan.c @@ -208,7 +208,7 @@ static READ16_HANDLER( bishjan_unk_r ) (mame_rand(Machine) & 0x9800) | // bit 7 eeprom? (((bishjan_sel==0x12) ? 0x40:0x00) << 8) | // (mame_rand() & 0xff); -// (((video_screen_get_frame_number(0)%60)==0)?0x18:0x00); +// (((video_screen_get_frame_number(machine->primary_screen)%60)==0)?0x18:0x00); 0x18; } @@ -228,7 +228,7 @@ static READ16_HANDLER( bishjan_input_r ) return (res << 8) | readinputport(3) | - ((bishjan_hopper && !(video_screen_get_frame_number(0)%10)) ? 0x00 : 0x04) // bit 2: hopper sensor + ((bishjan_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0x00 : 0x04) // bit 2: hopper sensor ; } diff --git a/src/mame/drivers/boxer.c b/src/mame/drivers/boxer.c index ad5577053a6..b667fdbf2c2 100644 --- a/src/mame/drivers/boxer.c +++ b/src/mame/drivers/boxer.c @@ -53,12 +53,8 @@ static TIMER_CALLBACK( periodic_callback ) mask[readinputport(8)] |= 0x20; for (i = 1; i < 256; i++) - { if (mask[i] != 0) - { - timer_set(video_screen_get_time_until_pos(0, i, 0), NULL, mask[i], pot_interrupt); - } - } + timer_set(video_screen_get_time_until_pos(machine->primary_screen, i, 0), NULL, mask[i], pot_interrupt); pot_state = 0; } @@ -66,11 +62,9 @@ static TIMER_CALLBACK( periodic_callback ) scanline += 64; if (scanline >= 262) - { scanline = 0; - } - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, periodic_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, periodic_callback); } @@ -86,7 +80,7 @@ static PALETTE_INIT( boxer ) static MACHINE_RESET( boxer ) { - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, periodic_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, periodic_callback); pot_latch = 0; } @@ -96,10 +90,8 @@ static READ8_HANDLER( boxer_input_r ) { UINT8 val = readinputport(0); - if (readinputport(9) < video_screen_get_vpos(0)) - { + if (readinputport(9) < video_screen_get_vpos(machine->primary_screen)) val |= 0x02; - } return (val << ((offset & 7) ^ 7)) & 0x80; } @@ -116,7 +108,7 @@ static READ8_HANDLER( boxer_misc_r ) break; case 1: - val = video_screen_get_vpos(0); + val = video_screen_get_vpos(machine->primary_screen); break; case 2: diff --git a/src/mame/drivers/capbowl.c b/src/mame/drivers/capbowl.c index 7d2a421b8ee..33a333b0d08 100644 --- a/src/mame/drivers/capbowl.c +++ b/src/mame/drivers/capbowl.c @@ -127,16 +127,16 @@ static TIMER_CALLBACK( capbowl_update ) { int scanline = param; - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); scanline += 32; if (scanline > 240) scanline = 32; - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, capbowl_update); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, capbowl_update); } static MACHINE_RESET( capbowl ) { - timer_set(video_screen_get_time_until_pos(0, 32, 0), NULL, 32, capbowl_update); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 32, 0), NULL, 32, capbowl_update); } diff --git a/src/mame/drivers/cball.c b/src/mame/drivers/cball.c index f453d7e254c..b4ccedfc16e 100644 --- a/src/mame/drivers/cball.c +++ b/src/mame/drivers/cball.c @@ -60,17 +60,15 @@ static TIMER_CALLBACK( interrupt_callback ) scanline = scanline + 32; if (scanline >= 262) - { scanline = 16; - } - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, interrupt_callback); } static MACHINE_RESET( cball ) { - timer_set(video_screen_get_time_until_pos(0, 16, 0), NULL, 16, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 16, 0), NULL, 16, interrupt_callback); } diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c index 50b3a9d7bae..19f47fb2be0 100644 --- a/src/mame/drivers/ccastles.c +++ b/src/mame/drivers/ccastles.c @@ -157,7 +157,7 @@ int ccastles_vblank_end; * *************************************/ -INLINE void schedule_next_irq(int curscanline) +INLINE void schedule_next_irq(running_machine *machine, int curscanline) { /* scan for a rising edge on the IRQCK signal */ for (curscanline++; ; curscanline = (curscanline + 1) & 0xff) @@ -165,7 +165,7 @@ INLINE void schedule_next_irq(int curscanline) break; /* next one at the start of this scanline */ - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, curscanline, 0), curscanline); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, curscanline, 0), curscanline); } @@ -179,16 +179,16 @@ static TIMER_CALLBACK( clock_irq ) } /* force an update now */ - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* find the next edge */ - schedule_next_irq(param); + schedule_next_irq(machine, param); } static CUSTOM_INPUT( get_vblank ) { - int scanline = video_screen_get_vpos(0); + int scanline = video_screen_get_vpos(machine->primary_screen); return syncprom[scanline & 0xff] & 1; } @@ -227,7 +227,7 @@ static MACHINE_START( ccastles ) visarea.max_x = 255; visarea.min_y = ccastles_vblank_end; visarea.max_y = ccastles_vblank_start - 1; - video_screen_configure(0, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); + video_screen_configure(machine->primary_screen, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); /* configure the ROM banking */ memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0xa000, 0x6000); @@ -235,7 +235,7 @@ static MACHINE_START( ccastles ) /* create a timer for IRQs and set up the first callback */ irq_timer = timer_alloc(clock_irq, NULL); irq_state = 0; - schedule_next_irq(0); + schedule_next_irq(machine, 0); /* allocate backing memory for the NVRAM */ generic_nvram = auto_malloc(generic_nvram_size); diff --git a/src/mame/drivers/centiped.c b/src/mame/drivers/centiped.c index 9ec514a2fd1..5130ddb6ded 100644 --- a/src/mame/drivers/centiped.c +++ b/src/mame/drivers/centiped.c @@ -449,14 +449,14 @@ static TIMER_CALLBACK( generate_interrupt ) cpunum_set_input_line(machine, 0, 0, ((scanline - 1) & 32) ? ASSERT_LINE : CLEAR_LINE); /* do a partial update now to handle sprite multiplexing (Maze Invaders) */ - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); /* call back again after 16 scanlines */ scanline += 16; if (scanline >= 256) scanline = 0; - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -471,7 +471,7 @@ static MACHINE_START( centiped ) static MACHINE_RESET( centiped ) { interrupt_timer = timer_alloc(generate_interrupt, NULL); - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); dsw_select = 0; control_select = 0; diff --git a/src/mame/drivers/changela.c b/src/mame/drivers/changela.c index 03377aef374..a56a9b80169 100644 --- a/src/mame/drivers/changela.c +++ b/src/mame/drivers/changela.c @@ -217,7 +217,7 @@ static READ8_HANDLER( changela_2d_r ) int v8 = 0; int gas; - if ((video_screen_get_vpos(0) & 0xf8)==0xf8) + if ((video_screen_get_vpos(machine->primary_screen) & 0xf8)==0xf8) v8 = 1; /* Gas pedal is made up of 2 switches, 1 active low, 1 active high */ @@ -462,9 +462,9 @@ static const struct AY8910interface ay8910_interface_2 = { static INTERRUPT_GEN( chl_interrupt ) { - int vector = video_screen_get_vblank(0) ? 0xdf : 0xcf; /* 4 irqs per frame: 3 times 0xcf, 1 time 0xdf */ + int vector = video_screen_get_vblank(machine->primary_screen) ? 0xdf : 0xcf; /* 4 irqs per frame: 3 times 0xcf, 1 time 0xdf */ -// video_screen_update_partial(0, video_screen_get_vpos(0)); +// video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, vector); diff --git a/src/mame/drivers/cinemat.c b/src/mame/drivers/cinemat.c index f597fa2a441..aa9fe324347 100644 --- a/src/mame/drivers/cinemat.c +++ b/src/mame/drivers/cinemat.c @@ -268,8 +268,8 @@ static READ8_HANDLER( boxingb_dial_r ) static READ8_HANDLER( qb3_frame_r ) { - attotime next_update = video_screen_get_time_until_update(0); - attotime frame_period = video_screen_get_frame_period(0); + attotime next_update = video_screen_get_time_until_update(machine->primary_screen); + attotime frame_period = video_screen_get_frame_period(machine->primary_screen); int percent = next_update.attoseconds / (frame_period.attoseconds / 100); /* note this is just an approximation... */ diff --git a/src/mame/drivers/cliffhgr.c b/src/mame/drivers/cliffhgr.c index 86f1e9e90dd..4bf9ee06b85 100644 --- a/src/mame/drivers/cliffhgr.c +++ b/src/mame/drivers/cliffhgr.c @@ -252,7 +252,7 @@ static TIMER_CALLBACK( cliff_irq_callback ) if ( phillips_code & 0x800000 ) cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, param, 0), param); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, param, 0), param); } static void vdp_interrupt (int state) @@ -272,7 +272,7 @@ static MACHINE_RESET( cliffhgr ) { port_bank = 0; phillips_code = 0; - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, 17, 0), 17); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, 17, 0), 17); } /********************************************************/ diff --git a/src/mame/drivers/cloud9.c b/src/mame/drivers/cloud9.c index 6574535693d..4226d9c6590 100644 --- a/src/mame/drivers/cloud9.c +++ b/src/mame/drivers/cloud9.c @@ -126,13 +126,13 @@ int cloud9_vblank_end; * *************************************/ -INLINE void schedule_next_irq(int curscanline) +INLINE void schedule_next_irq(running_machine *machine, int curscanline) { /* IRQ is clocked by /32V, so every 64 scanlines */ curscanline = (curscanline + 64) & 255; /* next one at the start of this scanline */ - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, curscanline, 0), curscanline); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, curscanline, 0), curscanline); } @@ -146,16 +146,16 @@ static TIMER_CALLBACK( clock_irq ) } /* force an update now */ - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* find the next edge */ - schedule_next_irq(param); + schedule_next_irq(machine, param); } static CUSTOM_INPUT( get_vblank ) { - int scanline = video_screen_get_vpos(0); + int scanline = video_screen_get_vpos(machine->primary_screen); return (~syncprom[scanline & 0xff] >> 1) & 1; } @@ -194,12 +194,12 @@ static MACHINE_START( cloud9 ) visarea.max_x = 255; visarea.min_y = cloud9_vblank_end + 1; visarea.max_y = cloud9_vblank_start; - video_screen_configure(0, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); + video_screen_configure(machine->primary_screen, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); /* create a timer for IRQs and set up the first callback */ irq_timer = timer_alloc(clock_irq, NULL); irq_state = 0; - schedule_next_irq(0-64); + schedule_next_irq(machine, 0-64); /* allocate backing memory for the NVRAM */ generic_nvram = auto_malloc(generic_nvram_size); diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c index b74c028f030..aa9d663e39a 100644 --- a/src/mame/drivers/cninja.c +++ b/src/mame/drivers/cninja.c @@ -121,7 +121,7 @@ static WRITE16_HANDLER( cninja_irq_w ) case 1: /* Raster IRQ scanline position, only valid for values between 1 & 239 (0 and 240-256 do NOT generate IRQ's) */ cninja_scanline=data&0xff; if ((cninja_irq_mask&0x2)==0 && cninja_scanline>0 && cninja_scanline<240) - timer_adjust_oneshot(raster_irq_timer, video_screen_get_time_until_pos(0, cninja_scanline, 0), cninja_scanline); + timer_adjust_oneshot(raster_irq_timer, video_screen_get_time_until_pos(machine->primary_screen, cninja_scanline, 0), cninja_scanline); else timer_adjust_oneshot(raster_irq_timer,attotime_never,0); return; diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c index abd787a57e9..f61af4071be 100644 --- a/src/mame/drivers/cosmic.c +++ b/src/mame/drivers/cosmic.c @@ -252,7 +252,7 @@ static READ8_HANDLER( cosmicg_port_0_r ) { /* The top four address lines from the CRTC are bits 0-3 */ - return (input_port_0_r(machine,0) & 0xf0) | ((video_screen_get_vpos(0) & 0xf0) >> 4); + return (input_port_0_r(machine,0) & 0xf0) | ((video_screen_get_vpos(machine->primary_screen) & 0xf0) >> 4); } static READ8_HANDLER( magspot_coinage_dip_r ) diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c index 87f305e2ce3..786ee17d815 100644 --- a/src/mame/drivers/cps2.c +++ b/src/mame/drivers/cps2.c @@ -660,7 +660,7 @@ static INTERRUPT_GEN( cps2_interrupt ) cps1_output[0x50/2] = 0; cpunum_set_input_line(machine, 0, 4, HOLD_LINE); cps2_set_sprite_priorities(); - video_screen_update_partial(0, 16 - 10 + scancount); /* visarea.min_y - [first visible line?] + scancount */ + video_screen_update_partial(machine->primary_screen, 16 - 10 + scancount); /* visarea.min_y - [first visible line?] + scancount */ cps1_scancalls++; // popmessage("IRQ4 scancounter = %04i",scancount); } @@ -671,7 +671,7 @@ static INTERRUPT_GEN( cps2_interrupt ) cps1_output[0x52/2] = 0; cpunum_set_input_line(machine, 0, 4, HOLD_LINE); cps2_set_sprite_priorities(); - video_screen_update_partial(0, 16 - 10 + scancount); /* visarea.min_y - [first visible line?] + scancount */ + video_screen_update_partial(machine->primary_screen, 16 - 10 + scancount); /* visarea.min_y - [first visible line?] + scancount */ cps1_scancalls++; // popmessage("IRQ4 scancounter = %04i",scancount); } @@ -684,7 +684,7 @@ static INTERRUPT_GEN( cps2_interrupt ) if(cps1_scancalls) { cps2_set_sprite_priorities(); - video_screen_update_partial(0, 256); + video_screen_update_partial(machine->primary_screen, 256); } cps2_objram_latch(); } diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 4e1649fa216..212edc718df 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -1054,7 +1054,7 @@ static VIDEO_UPDATE(cps3) cps3_screenwidth = 496; visarea.min_x = 0; visarea.max_x = 496-1; visarea.min_y = 0; visarea.max_y = 224-1; - video_screen_configure(0, 496, 224, &visarea, video_screen_get_frame_period(0).attoseconds); + video_screen_configure(screen, 496, 224, &visarea, video_screen_get_frame_period(screen).attoseconds); } } else @@ -1066,7 +1066,7 @@ static VIDEO_UPDATE(cps3) cps3_screenwidth = 384; visarea.min_x = 0; visarea.max_x = 384-1; visarea.min_y = 0; visarea.max_y = 224-1; - video_screen_configure(0, 384, 224, &visarea, video_screen_get_frame_period(0).attoseconds); + video_screen_configure(screen, 384, 224, &visarea, video_screen_get_frame_period(screen).attoseconds); } } @@ -1241,7 +1241,7 @@ static VIDEO_UPDATE(cps3) if (current_ypos&0x200) current_ypos-=0x400; - //if ( (whichbpp) && (video_screen_get_frame_number(0) & 1)) continue; + //if ( (whichbpp) && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; /* use the palette value from the main list or the sublists? */ if (whichpal) diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c index c184dea6d64..172c8e6ec8a 100644 --- a/src/mame/drivers/dblewing.c +++ b/src/mame/drivers/dblewing.c @@ -62,7 +62,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram16[offs]; flash=y&0x1000; xsize = y&0x0800; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c index 107213bafc3..5099dc3c4e1 100644 --- a/src/mame/drivers/ddenlovr.c +++ b/src/mame/drivers/ddenlovr.c @@ -2931,7 +2931,7 @@ static UINT8 hgokou_hopper; static UINT8 hgokou_player_r(int player) { - UINT8 hopper_bit = ((hgokou_hopper && !(video_screen_get_frame_number(0)%10)) ? 0 : (1<<6)); + UINT8 hopper_bit = ((hgokou_hopper && !(video_screen_get_frame_number(Machine->primary_screen)%10)) ? 0 : (1<<6)); if (!(ddenlovr_select2 & 0x01)) return readinputport(player * 5 + 1) | hopper_bit; if (!(ddenlovr_select2 & 0x02)) return readinputport(player * 5 + 2) | hopper_bit; diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index 313d35b81df..b61b06a9e0a 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -145,7 +145,7 @@ static TIMER_CALLBACK( ddragon_scanline_callback ) int vcount = scanline_to_vcount(scanline); /* update to the current point */ - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); /* on the rising edge of VBLK (vcount == F8), signal an NMI */ if (vcount == 0xf8) @@ -158,7 +158,7 @@ static TIMER_CALLBACK( ddragon_scanline_callback ) /* adjust for next scanline */ if (++scanline >= machine->screen[0].height) scanline = 0; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -192,7 +192,7 @@ static MACHINE_RESET( ddragon ) { dd_sub_cpu_busy = 1; adpcm_idle[0] = adpcm_idle[1] = 1; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } diff --git a/src/mame/drivers/deco156.c b/src/mame/drivers/deco156.c index 358735cacf7..8d7644e19e2 100644 --- a/src/mame/drivers/deco156.c +++ b/src/mame/drivers/deco156.c @@ -74,7 +74,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram32[offs]&0xffff; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram32[offs+2]&0xffff; colour = (x >>9) & 0x1f; diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index f2e4c411e3c..9d4770eb296 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -248,7 +248,7 @@ extern void decrypt156(void); static TIMER_CALLBACK( interrupt_gen ) { /* Save state of scroll registers before the IRQ */ - deco32_raster_display_list[deco32_raster_display_position++]=video_screen_get_vpos(0); + deco32_raster_display_list[deco32_raster_display_position++]=video_screen_get_vpos(machine->primary_screen); deco32_raster_display_list[deco32_raster_display_position++]=deco32_pf12_control[1]&0xffff; deco32_raster_display_list[deco32_raster_display_position++]=deco32_pf12_control[2]&0xffff; deco32_raster_display_list[deco32_raster_display_position++]=deco32_pf12_control[3]&0xffff; @@ -278,9 +278,9 @@ static READ32_HANDLER( deco32_irq_controller_r ) Bit 7: */ - /* ZV03082007 - video_screen_get_vblank(0) doesn't work for Captain America, as it expects + /* ZV03082007 - video_screen_get_vblank() doesn't work for Captain America, as it expects that this bit is NOT set in rows 0-7. */ - vblank = video_screen_get_vpos(0) > Machine->screen[0].visarea.max_y; + vblank = video_screen_get_vpos(machine->primary_screen) > machine->screen[0].visarea.max_y; if (vblank) return 0xffffff80 | 0x1 | 0x10; /* Assume VBL takes priority over possible raster/lightgun irq */ @@ -305,7 +305,7 @@ static WRITE32_HANDLER( deco32_irq_controller_w ) case 1: /* Raster IRQ scanline position, only valid for values between 1 & 239 (0 and 240-256 do NOT generate IRQ's) */ scanline=(data&0xff); if (raster_enable && scanline>0 && scanline<240) - timer_adjust_oneshot(raster_irq_timer,video_screen_get_time_until_pos(0, scanline-1, 320),0); + timer_adjust_oneshot(raster_irq_timer,video_screen_get_time_until_pos(machine->primary_screen, scanline-1, 320),0); else timer_adjust_oneshot(raster_irq_timer,attotime_never,0); break; diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c index fe35b70fe47..a34990043c3 100644 --- a/src/mame/drivers/deco_mlc.c +++ b/src/mame/drivers/deco_mlc.c @@ -199,20 +199,20 @@ static READ32_HANDLER( decomlc_vbl_r ) static READ32_HANDLER( mlc_scanline_r ) { -// logerror("read scanline counter (%d)\n", video_screen_get_vpos(0)); - return video_screen_get_vpos(0); +// logerror("read scanline counter (%d)\n", video_screen_get_vpos(machine->primary_screen)); + return video_screen_get_vpos(machine->primary_screen); } static TIMER_CALLBACK( interrupt_gen ) { -// logerror("hit scanline IRQ %d (%08x)\n", video_screen_get_vpos(0), info.i); +// logerror("hit scanline IRQ %d (%08x)\n", video_screen_get_vpos(machine->primary_screen), info.i); cpunum_set_input_line(machine, 0, mainCpuIsArm ? ARM_IRQ_LINE : 1, HOLD_LINE); } static WRITE32_HANDLER( mlc_irq_w ) { static int lastScanline[9]={ 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int scanline=video_screen_get_vpos(0); + int scanline=video_screen_get_vpos(machine->primary_screen); irq_ram[offset]=data&0xffff; switch (offset*4) @@ -222,8 +222,8 @@ static WRITE32_HANDLER( mlc_irq_w ) return; break; case 0x14: /* Prepare scanline interrupt */ - timer_adjust_oneshot(raster_irq_timer,video_screen_get_time_until_pos(0, irq_ram[0x14/4], 0),0); - //logerror("prepare scanline to fire at %d (currently on %d)\n", irq_ram[0x14/4], video_screen_get_vpos(0)); + timer_adjust_oneshot(raster_irq_timer,video_screen_get_time_until_pos(machine->primary_screen, irq_ram[0x14/4], 0),0); + //logerror("prepare scanline to fire at %d (currently on %d)\n", irq_ram[0x14/4], video_screen_get_vpos(machine->primary_screen)); return; break; case 0x18: diff --git a/src/mame/drivers/destroyr.c b/src/mame/drivers/destroyr.c index 651041ab394..b62633b8a53 100644 --- a/src/mame/drivers/destroyr.c +++ b/src/mame/drivers/destroyr.c @@ -50,14 +50,14 @@ static TIMER_CALLBACK( destroyr_frame_callback ) /* PCB supports two dials, but cab has only got one */ - timer_set(video_screen_get_time_until_pos(0, readinputport(3), 0), NULL, 0, destroyr_dial_callback); - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, destroyr_frame_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, readinputport(3), 0), NULL, 0, destroyr_dial_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, destroyr_frame_callback); } static MACHINE_RESET( destroyr ) { - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, destroyr_frame_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, destroyr_frame_callback); } @@ -160,7 +160,7 @@ static READ8_HANDLER( destroyr_input_r ) static READ8_HANDLER( destroyr_scanline_r ) { - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); } diff --git a/src/mame/drivers/dorachan.c b/src/mame/drivers/dorachan.c index 7cdee427291..ea8ee5ec2e4 100644 --- a/src/mame/drivers/dorachan.c +++ b/src/mame/drivers/dorachan.c @@ -119,7 +119,7 @@ static CUSTOM_INPUT( dorachan_v128_r ) { /* to avoid resetting (when player 2 starts) bit 0 need to be inverted when screen is flipped */ - return ((video_screen_get_vpos(0) >> 7) & 0x01) ^ dorachan_flip_screen; + return ((video_screen_get_vpos(machine->primary_screen) >> 7) & 0x01) ^ dorachan_flip_screen; } diff --git a/src/mame/drivers/dragrace.c b/src/mame/drivers/dragrace.c index d0a6ccfd454..8caa55bfd34 100644 --- a/src/mame/drivers/dragrace.c +++ b/src/mame/drivers/dragrace.c @@ -37,7 +37,7 @@ static TIMER_CALLBACK( dragrace_frame_callback ) static MACHINE_RESET( dragrace ) { - timer_pulse(video_screen_get_frame_period(0), NULL, 0, dragrace_frame_callback); + timer_pulse(video_screen_get_frame_period(machine->primary_screen), NULL, 0, dragrace_frame_callback); } static void dragrace_update_misc_flags(running_machine *machine) @@ -165,7 +165,7 @@ static READ8_HANDLER( dragrace_steering_r ) static READ8_HANDLER( dragrace_scanline_r ) { - return (video_screen_get_vpos(0) ^ 0xf0) | 0x0f; + return (video_screen_get_vpos(machine->primary_screen) ^ 0xf0) | 0x0f; } diff --git a/src/mame/drivers/dunhuang.c b/src/mame/drivers/dunhuang.c index 9afbf74bd5c..e985111a152 100644 --- a/src/mame/drivers/dunhuang.c +++ b/src/mame/drivers/dunhuang.c @@ -346,7 +346,7 @@ static WRITE8_HANDLER( dunhuang_input_w ) { dunhuang_input = data; } static READ8_HANDLER( dunhuang_service_r ) { return readinputport(5) - | ((dunhuang_hopper && !(video_screen_get_frame_number(0)%10)) ? 0x00 : 0x08) // bit 3: hopper sensor + | ((dunhuang_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0x00 : 0x08) // bit 3: hopper sensor | 0x80 // bit 7 low -> tiles block transferrer busy ; } diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index d2c7a049a4a..0278f6a9d9d 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -1078,7 +1078,7 @@ static READ8_HANDLER( htengoku_coin_r ) { case 0x00: return readinputport(0); case 0x01: return 0xff; //? - case 0x02: return 0xbf | ((htengoku_hopper && !(video_screen_get_frame_number(0)%10)) ? 0 : (1<<6));; // bit 7 = blitter busy, bit 6 = hopper + case 0x02: return 0xbf | ((htengoku_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0 : (1<<6));; // bit 7 = blitter busy, bit 6 = hopper case 0x03: return htengoku_coins; } logerror("%04x: coin_r with select = %02x\n",activecpu_get_pc(),htengoku_select); diff --git a/src/mame/drivers/enigma2.c b/src/mame/drivers/enigma2.c index 30c7a61bb41..bc8d82bb70a 100644 --- a/src/mame/drivers/enigma2.c +++ b/src/mame/drivers/enigma2.c @@ -96,7 +96,7 @@ static TIMER_CALLBACK( interrupt_assert_callback ) int next_vpos; /* compute vector and set the interrupt line */ - int vpos = video_screen_get_vpos(0); + int vpos = video_screen_get_vpos(machine->primary_screen); UINT16 counter = vpos_to_vysnc_chain_counter(vpos); UINT8 vector = 0xc7 | ((counter & 0x80) >> 3) | ((~counter & 0x80) >> 4); cpunum_set_input_line_and_vector(machine, 0, 0, ASSERT_LINE, vector); @@ -108,8 +108,8 @@ static TIMER_CALLBACK( interrupt_assert_callback ) next_counter = INT_TRIGGER_COUNT_1; next_vpos = vysnc_chain_counter_to_vpos(next_counter); - timer_adjust_oneshot(interrupt_assert_timer, video_screen_get_time_until_pos(0, next_vpos, 0), 0); - timer_adjust_oneshot(interrupt_clear_timer, video_screen_get_time_until_pos(0, vpos + 1, 0), 0); + timer_adjust_oneshot(interrupt_assert_timer, video_screen_get_time_until_pos(machine->primary_screen, next_vpos, 0), 0); + timer_adjust_oneshot(interrupt_clear_timer, video_screen_get_time_until_pos(machine->primary_screen, vpos + 1, 0), 0); } @@ -120,10 +120,10 @@ static void create_interrupt_timers(void) } -static void start_interrupt_timers(void) +static void start_interrupt_timers(running_machine *machine) { int vpos = vysnc_chain_counter_to_vpos(INT_TRIGGER_COUNT_1); - timer_adjust_oneshot(interrupt_assert_timer, video_screen_get_time_until_pos(0, vpos, 0), 0); + timer_adjust_oneshot(interrupt_assert_timer, video_screen_get_time_until_pos(machine->primary_screen, vpos, 0), 0); } @@ -141,7 +141,7 @@ static MACHINE_RESET( enigma2 ) engima2_flip_screen = 0; - start_interrupt_timers(); + start_interrupt_timers(machine); } diff --git a/src/mame/drivers/fantland.c b/src/mame/drivers/fantland.c index 0e425abd6ee..f1b585b9278 100644 --- a/src/mame/drivers/fantland.c +++ b/src/mame/drivers/fantland.c @@ -190,7 +190,7 @@ static READ8_HANDLER( borntofi_inputs_r ) x = readinputport(13 + offset * 2); y = readinputport(12 + offset * 2); - f = video_screen_get_frame_number(0); + f = video_screen_get_frame_number(machine->primary_screen); ret[offset] = (ret[offset] & 0x14) | (readinputport(2 + offset) & 0xc3); diff --git a/src/mame/drivers/fgoal.c b/src/mame/drivers/fgoal.c index 5bc0b35a675..a05670fed5c 100644 --- a/src/mame/drivers/fgoal.c +++ b/src/mame/drivers/fgoal.c @@ -87,26 +87,22 @@ static TIMER_CALLBACK( interrupt_callback ) cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); if (!coin && prev_coin) - { cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE); - } prev_coin = coin; - scanline = video_screen_get_vpos(0) + 128; + scanline = video_screen_get_vpos(machine->primary_screen) + 128; if (scanline > 256) - { scanline = 0; - } - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, 0, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, 0, interrupt_callback); } static MACHINE_RESET( fgoal ) { - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, interrupt_callback); } @@ -124,14 +120,10 @@ static READ8_HANDLER( fgoal_analog_r ) static READ8_HANDLER( fgoal_switches_r ) { - if (video_screen_get_vpos(0) & 0x80) - { + if (video_screen_get_vpos(machine->primary_screen) & 0x80) return readinputport(1) | 0x80; - } else - { return readinputport(1); - } } diff --git a/src/mame/drivers/filetto.c b/src/mame/drivers/filetto.c index 2198810995e..6de02343b42 100644 --- a/src/mame/drivers/filetto.c +++ b/src/mame/drivers/filetto.c @@ -75,7 +75,7 @@ AH visarea.max_x = _x_-1; \ visarea.min_y = 0; \ visarea.max_y = _y_-1; \ - video_screen_configure(0, _x_, _y_, &visarea, video_screen_get_frame_period(0).attoseconds ); \ + video_screen_configure(machine->primary_screen, _x_, _y_, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds ); \ } \ diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index fe910721e42..4b755b98adc 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -606,7 +606,7 @@ static void GCU_w(int chip, UINT32 offset, UINT32 data, UINT32 mem_mask) // only try and update the screen if the driver says we have one if (screen < numscreens) - video_screen_configure(screen, visarea.max_x + 1, visarea.max_y + 1, &visarea, video_screen_get_frame_period(0).attoseconds); + video_screen_configure_scrnum(screen, visarea.max_x + 1, visarea.max_y + 1, &visarea, video_screen_get_frame_period(Machine->primary_screen).attoseconds); } break; } diff --git a/src/mame/drivers/firetrk.c b/src/mame/drivers/firetrk.c index 6d0c31079a5..246eae48213 100644 --- a/src/mame/drivers/firetrk.c +++ b/src/mame/drivers/firetrk.c @@ -76,7 +76,7 @@ static TIMER_CALLBACK( periodic_callback ) if (scanline > 262) scanline = 0; - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, periodic_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, periodic_callback); } diff --git a/src/mame/drivers/flyball.c b/src/mame/drivers/flyball.c index 4eb738115da..3615f096600 100644 --- a/src/mame/drivers/flyball.c +++ b/src/mame/drivers/flyball.c @@ -47,17 +47,13 @@ static TIMER_CALLBACK( flyball_quarter_callback ) potsense[readinputport(4)] |= 8; for (i = 0; i < 64; i++) - { if (potsense[i] != 0) - { - timer_set(video_screen_get_time_until_pos(0, scanline + i, 0), NULL, potsense[i], flyball_joystick_callback); - } - } + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline + i, 0), NULL, potsense[i], flyball_joystick_callback); scanline += 0x40; scanline &= 0xff; - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, flyball_quarter_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, flyball_quarter_callback); flyball_potsense = 0; flyball_potmask = 0; @@ -75,7 +71,7 @@ static MACHINE_RESET( flyball ) for (i = 0; i < 0x1000; i++) rombase[i] = ROM[i ^ 0x1ff]; - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, flyball_quarter_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, flyball_quarter_callback); } @@ -88,7 +84,7 @@ static READ8_HANDLER( flyball_input_r ) static READ8_HANDLER( flyball_scanline_r ) { - return video_screen_get_vpos(0) & 0x3f; + return video_screen_get_vpos(machine->primary_screen) & 0x3f; } static READ8_HANDLER( flyball_potsense_r ) diff --git a/src/mame/drivers/foodf.c b/src/mame/drivers/foodf.c index ec9dca497b6..f3c72a6c20e 100644 --- a/src/mame/drivers/foodf.c +++ b/src/mame/drivers/foodf.c @@ -146,7 +146,7 @@ static TIMER_CALLBACK( scanline_update ) scanline = 0; /* set a timer for it */ - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -160,7 +160,7 @@ static MACHINE_START( foodf ) static MACHINE_RESET( foodf ) { atarigen_interrupt_reset(update_interrupts); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } diff --git a/src/mame/drivers/fuukifg2.c b/src/mame/drivers/fuukifg2.c index e0e4440a05c..e2627c8ff14 100644 --- a/src/mame/drivers/fuukifg2.c +++ b/src/mame/drivers/fuukifg2.c @@ -70,7 +70,7 @@ static WRITE16_HANDLER( fuuki16_vregs_w ) UINT16 new_data = COMBINE_DATA(&fuuki16_vregs[offset]); if ((offset == 0x1c/2) && old_data != new_data) { - timer_adjust_periodic(raster_interrupt_timer, video_screen_get_time_until_pos(0, new_data, Machine->screen[0].visarea.max_x + 1), 0, video_screen_get_frame_period(0)); + timer_adjust_periodic(raster_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, new_data, Machine->screen[0].visarea.max_x + 1), 0, video_screen_get_frame_period(machine->primary_screen)); } } @@ -523,22 +523,22 @@ static const struct YM3812interface fuuki16_ym3812_intf = static TIMER_CALLBACK( level_1_interrupt_callback ) { cpunum_set_input_line(machine, 0, 1, PULSE_LINE); - timer_set(video_screen_get_time_until_pos(0, 248, 0), NULL, 0, level_1_interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 248, 0), NULL, 0, level_1_interrupt_callback); } static TIMER_CALLBACK( vblank_interrupt_callback ) { cpunum_set_input_line(machine, 0, 3, PULSE_LINE); // VBlank IRQ - timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); } static TIMER_CALLBACK( raster_interrupt_callback ) { cpunum_set_input_line(machine, 0, 5, PULSE_LINE); // Raster Line IRQ - video_screen_update_partial(0, video_screen_get_vpos(0)); - timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_frame_period(0), 0); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); + timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_frame_period(machine->primary_screen), 0); } @@ -550,9 +550,9 @@ static MACHINE_START( fuuki16 ) static MACHINE_RESET( fuuki16 ) { - timer_set(video_screen_get_time_until_pos(0, 248, 0), NULL, 0, level_1_interrupt_callback); - timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); - timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_time_until_pos(0, 0, machine->screen[0].visarea.max_x + 1), 0); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 248, 0), NULL, 0, level_1_interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); + timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, machine->screen[0].visarea.max_x + 1), 0); } diff --git a/src/mame/drivers/fuukifg3.c b/src/mame/drivers/fuukifg3.c index c1155afc78f..5bbb801b453 100644 --- a/src/mame/drivers/fuukifg3.c +++ b/src/mame/drivers/fuukifg3.c @@ -259,7 +259,7 @@ static WRITE32_HANDLER( fuuki32_vregs_w ) COMBINE_DATA(&fuuki32_vregs[offset]); if (offset == 0x1c/4) { - timer_adjust_periodic(raster_interrupt_timer, video_screen_get_time_until_pos(0, fuuki32_vregs[0x1c/4]>>16, Machine->screen[0].visarea.max_x + 1), 0, video_screen_get_frame_period(0)); + timer_adjust_periodic(raster_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, fuuki32_vregs[0x1c/4]>>16, Machine->screen[0].visarea.max_x + 1), 0, video_screen_get_frame_period(machine->primary_screen)); } } } @@ -549,22 +549,22 @@ GFXDECODE_END static TIMER_CALLBACK( level_1_interrupt_callback ) { cpunum_set_input_line(machine, 0, 1, PULSE_LINE); - timer_set(video_screen_get_time_until_pos(0, 248, 0), NULL, 0, level_1_interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 248, 0), NULL, 0, level_1_interrupt_callback); } static TIMER_CALLBACK( vblank_interrupt_callback ) { cpunum_set_input_line(machine, 0, 3, PULSE_LINE); // VBlank IRQ - timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); } static TIMER_CALLBACK( raster_interrupt_callback ) { cpunum_set_input_line(machine, 0, 5, PULSE_LINE); // Raster Line IRQ - video_screen_update_partial(0, video_screen_get_vpos(0)); - timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_frame_period(0), 0); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); + timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_frame_period(machine->primary_screen), 0); } @@ -576,9 +576,9 @@ static MACHINE_START( fuuki32 ) static MACHINE_RESET( fuuki32 ) { - timer_set(video_screen_get_time_until_pos(0, 248, 0), NULL, 0, level_1_interrupt_callback); - timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); - timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_time_until_pos(0, 0, machine->screen[0].visarea.max_x + 1), 0); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 248, 0), NULL, 0, level_1_interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); + timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, machine->screen[0].visarea.max_x + 1), 0); } diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c index 967fa1f7f66..b35f5eda24d 100644 --- a/src/mame/drivers/galaga.c +++ b/src/mame/drivers/galaga.c @@ -814,7 +814,7 @@ static TIMER_CALLBACK( cpu3_interrupt_callback ) scanline = 64; /* the vertical synch chain is clocked by H256 -- this is probably not important, but oh well */ - timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -845,7 +845,7 @@ static MACHINE_RESET( bosco ) NAMCOIO_NONE, NULL, NAMCOIO_NONE, NULL); - timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64); + timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), 64); } static MACHINE_RESET( galaga ) @@ -862,7 +862,7 @@ static MACHINE_RESET( galaga ) NAMCOIO_NONE, NULL, NAMCOIO_54XX, NULL); - timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64); + timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), 64); } static MACHINE_RESET( xevious ) @@ -879,7 +879,7 @@ static MACHINE_RESET( xevious ) NAMCOIO_50XX, NULL, NAMCOIO_54XX, NULL); - timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64); + timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), 64); } static MACHINE_RESET( battles ) @@ -892,7 +892,7 @@ static MACHINE_RESET( battles ) battles_customio_init(); - timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64); + timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), 64); } static MACHINE_RESET( digdug ) @@ -909,7 +909,7 @@ static MACHINE_RESET( digdug ) NAMCOIO_NONE, NULL, NAMCOIO_NONE, NULL); - timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64); + timer_adjust_oneshot(cpu3_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), 64); } diff --git a/src/mame/drivers/genesis.c b/src/mame/drivers/genesis.c index 7ac64cdc8d0..f0c839fd786 100644 --- a/src/mame/drivers/genesis.c +++ b/src/mame/drivers/genesis.c @@ -104,7 +104,7 @@ static TIMER_CALLBACK( vdp_reload_counter ) { scanline_int = 1; update_interrupts(machine); - timer_set(video_screen_get_time_until_pos(0, scanline + 1, 0), NULL, 0, vdp_int4_off); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline + 1, 0), NULL, 0, vdp_int4_off); } /* advance to the next scanline */ @@ -115,7 +115,7 @@ static TIMER_CALLBACK( vdp_reload_counter ) scanline = 0; /* set a timer */ - timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(0, scanline, 320), scanline); + timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 320), scanline); } @@ -135,7 +135,7 @@ INTERRUPT_GEN( genesis_vblank_interrupt ) update_interrupts(machine); /* set a timer to turn it off */ - timer_set(video_screen_get_time_until_pos(0, video_screen_get_vpos(0), 22), NULL, 0, vdp_int6_off); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, video_screen_get_vpos(machine->primary_screen), 22), NULL, 0, vdp_int6_off); } @@ -174,7 +174,7 @@ MACHINE_RESET( genesis ) /* set the first scanline 0 timer to go off */ scan_timer = timer_alloc(vdp_reload_counter, NULL); - timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(0, 0, 320), 0); + timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 320), 0); } diff --git a/src/mame/drivers/ghosteo.c b/src/mame/drivers/ghosteo.c index 7a69a787fec..662708aaac2 100644 --- a/src/mame/drivers/ghosteo.c +++ b/src/mame/drivers/ghosteo.c @@ -216,7 +216,7 @@ static READ32_HANDLER( lcd_control_r ) { case 0x00/4: { - int line_val = video_screen_get_vpos(0) & 0x3ff; + int line_val = video_screen_get_vpos(machine->primary_screen) & 0x3ff; return (lcd_control[offset] & ~(0x3ff << 18)) | ((lcd.line_val - line_val) << 18); } @@ -245,7 +245,7 @@ static WRITE32_HANDLER( lcd_control_w ) { case 0x00/4: { - int line_val = video_screen_get_vpos(0) & 0x3ff; + int line_val = video_screen_get_vpos(machine->primary_screen) & 0x3ff; int bpp_mode = (lcd_control[offset] & 0x1e) >> 1; int screen_type = (lcd_control[offset] & 0x60) >> 5; diff --git a/src/mame/drivers/grchamp.c b/src/mame/drivers/grchamp.c index 95e552618c6..4d3d15cd029 100644 --- a/src/mame/drivers/grchamp.c +++ b/src/mame/drivers/grchamp.c @@ -342,7 +342,7 @@ INLINE UINT8 get_pc3259_bits(grchamp_state *state, int offs) int bits; /* force a partial update to the current position */ - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); /* get the relevant 4 bits */ bits = (state->collide >> (offs*4)) & 0x0f; diff --git a/src/mame/drivers/gridlee.c b/src/mame/drivers/gridlee.c index 3d82f16cf04..33524e3a90c 100644 --- a/src/mame/drivers/gridlee.c +++ b/src/mame/drivers/gridlee.c @@ -119,15 +119,15 @@ static TIMER_CALLBACK( irq_timer ) { /* next interrupt after scanline 256 is scanline 64 */ if (param == 256) - timer_set(video_screen_get_time_until_pos(0, 64, 0), NULL, 64, irq_timer); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 64, 0), NULL, 64, irq_timer); else - timer_set(video_screen_get_time_until_pos(0, param + 64, 0), NULL, param + 64, irq_timer); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, param + 64, 0), NULL, param + 64, irq_timer); /* IRQ starts on scanline 0, 64, 128, etc. */ cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, ASSERT_LINE); /* it will turn off on the next HBLANK */ - timer_set(video_screen_get_time_until_pos(0, param, BALSENTE_HBSTART), NULL, 0, irq_off); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, param, BALSENTE_HBSTART), NULL, 0, irq_off); } @@ -140,21 +140,21 @@ static TIMER_CALLBACK( firq_off ) static TIMER_CALLBACK( firq_timer ) { /* same time next frame */ - timer_set(video_screen_get_time_until_pos(0, FIRQ_SCANLINE, 0), NULL, 0, firq_timer); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, 0), NULL, 0, firq_timer); /* IRQ starts on scanline FIRQ_SCANLINE? */ cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, ASSERT_LINE); /* it will turn off on the next HBLANK */ - timer_set(video_screen_get_time_until_pos(0, FIRQ_SCANLINE, BALSENTE_HBSTART), NULL, 0, firq_off); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, BALSENTE_HBSTART), NULL, 0, firq_off); } static MACHINE_RESET( gridlee ) { /* start timers to generate interrupts */ - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, irq_timer); - timer_set(video_screen_get_time_until_pos(0, FIRQ_SCANLINE, 0), NULL, 0, firq_timer); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, irq_timer); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, 0), NULL, 0, firq_timer); /* create the polynomial tables */ poly17_init(); diff --git a/src/mame/drivers/hitme.c b/src/mame/drivers/hitme.c index a5db3800eab..f56fd102db8 100644 --- a/src/mame/drivers/hitme.c +++ b/src/mame/drivers/hitme.c @@ -15,7 +15,6 @@ */ #include "driver.h" -#include "deprecat.h" #include "hitme.h" #include "sound/discrete.h" @@ -136,10 +135,10 @@ static UINT8 read_port_and_t0(int port) } -static UINT8 read_port_and_t0_and_hblank(int port) +static UINT8 read_port_and_t0_and_hblank(running_machine *machine, int port) { UINT8 val = read_port_and_t0(port); - if (video_screen_get_hpos(0) < (Machine->screen[0].width * 9 / 10)) + if (video_screen_get_hpos(machine->primary_screen) < (machine->screen[0].width * 9 / 10)) val ^= 0x04; return val; } @@ -147,7 +146,7 @@ static UINT8 read_port_and_t0_and_hblank(int port) static READ8_HANDLER( hitme_port_0_r ) { - return read_port_and_t0_and_hblank(0); + return read_port_and_t0_and_hblank(machine, 0); } @@ -159,7 +158,7 @@ static READ8_HANDLER( hitme_port_1_r ) static READ8_HANDLER( hitme_port_2_r ) { - return read_port_and_t0_and_hblank(2); + return read_port_and_t0_and_hblank(machine, 2); } diff --git a/src/mame/drivers/homerun.c b/src/mame/drivers/homerun.c index 0f4cba29b6a..1db44b13158 100644 --- a/src/mame/drivers/homerun.c +++ b/src/mame/drivers/homerun.c @@ -91,10 +91,10 @@ ADDRESS_MAP_END static READ8_HANDLER(homerun_40_r) { - if(video_screen_get_vpos(0)>116) - return input_port_0_r(machine,0)|0x40; + if(video_screen_get_vpos(machine->primary_screen)>116) + return readinputport(0)|0x40; else - return input_port_0_r(machine,0); + return readinputport(0); } static ADDRESS_MAP_START( homerun_iomap, ADDRESS_SPACE_IO, 8 ) diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c index 4be0e4cf1c5..83cc79be2d7 100644 --- a/src/mame/drivers/itech32.c +++ b/src/mame/drivers/itech32.c @@ -302,7 +302,7 @@ static INTERRUPT_GEN( generate_int1 ) { /* signal the NMI */ itech32_update_interrupts(1, -1, -1); - if (FULL_LOGGING) logerror("------------ VBLANK (%d) --------------\n", video_screen_get_vpos(0)); + if (FULL_LOGGING) logerror("------------ VBLANK (%d) --------------\n", video_screen_get_vpos(machine->primary_screen)); } @@ -393,7 +393,7 @@ static READ32_HANDLER( trackball32_4bit_r ) static attotime lasttime; attotime curtime = timer_get_time(); - if (attotime_compare(attotime_sub(curtime, lasttime), video_screen_get_scan_period(0)) > 0) + if (attotime_compare(attotime_sub(curtime, lasttime), video_screen_get_scan_period(machine->primary_screen)) > 0) { int upper, lower; int dx, dy; @@ -432,7 +432,7 @@ static READ32_HANDLER( trackball32_4bit_p2_r ) static attotime lasttime; attotime curtime = timer_get_time(); - if (attotime_compare(attotime_sub(curtime, lasttime), video_screen_get_scan_period(0)) > 0) + if (attotime_compare(attotime_sub(curtime, lasttime), video_screen_get_scan_period(machine->primary_screen)) > 0) { int upper, lower; int dx, dy; diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c index dd206fbee3f..19d8bcf5215 100644 --- a/src/mame/drivers/itech8.c +++ b/src/mame/drivers/itech8.c @@ -586,7 +586,7 @@ static INTERRUPT_GEN( generate_nmi ) itech8_update_interrupts(machine, 1, -1, -1); itech8_update_interrupts(machine, 0, -1, -1); - if (FULL_LOGGING) logerror("------------ VBLANK (%d) --------------\n", video_screen_get_vpos(0)); + if (FULL_LOGGING) logerror("------------ VBLANK (%d) --------------\n", video_screen_get_vpos(machine->primary_screen)); } @@ -623,7 +623,7 @@ static MACHINE_START( sstrike ) MACHINE_START_CALL(itech8); /* we need to update behind the beam as well */ - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 32, behind_the_beam_update); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 32, behind_the_beam_update); } static MACHINE_RESET( itech8 ) @@ -649,7 +649,7 @@ static MACHINE_RESET( itech8 ) /* set the visible area */ if (visarea) { - video_screen_set_visarea(0, visarea->min_x, visarea->max_x, visarea->min_y, visarea->max_y); + video_screen_set_visarea(machine->primary_screen, visarea->min_x, visarea->max_x, visarea->min_y, visarea->max_y); visarea = NULL; } } @@ -668,14 +668,14 @@ static TIMER_CALLBACK( behind_the_beam_update ) int interval = param & 0xff; /* force a partial update to the current scanline */ - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); /* advance by the interval, and wrap to 0 */ scanline += interval; if (scanline >= 256) scanline = 0; /* set a new timer */ - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, (scanline << 8) + interval, behind_the_beam_update); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, (scanline << 8) + interval, behind_the_beam_update); } diff --git a/src/mame/drivers/jedi.c b/src/mame/drivers/jedi.c index 36995af631d..c8bed6a1c2a 100644 --- a/src/mame/drivers/jedi.c +++ b/src/mame/drivers/jedi.c @@ -136,7 +136,7 @@ static TIMER_CALLBACK( generate_interrupt ) scanline += 32; if (scanline > 256) scanline = 32; - timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -159,7 +159,7 @@ static MACHINE_START( jedi ) /* set a timer to run the interrupts */ state->interrupt_timer = timer_alloc(generate_interrupt, NULL); - timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(0, 32, 0), 32); + timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 32, 0), 32); /* configure the banks */ memory_configure_bank(1, 0, 3, memory_region(REGION_CPU1) + 0x10000, 0x4000); diff --git a/src/mame/drivers/laserbas.c b/src/mame/drivers/laserbas.c index c1927f9986f..a1b6dd299ff 100644 --- a/src/mame/drivers/laserbas.c +++ b/src/mame/drivers/laserbas.c @@ -121,7 +121,7 @@ INPUT_PORTS_END static INTERRUPT_GEN( laserbas_interrupt ) { - if(video_screen_get_vblank(0)) + if(video_screen_get_vblank(machine->primary_screen)) cpunum_set_input_line(machine, 0, 0, HOLD_LINE); else cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); diff --git a/src/mame/drivers/legionna.c b/src/mame/drivers/legionna.c index e6e0e9cfa63..5b8818a31cd 100644 --- a/src/mame/drivers/legionna.c +++ b/src/mame/drivers/legionna.c @@ -264,7 +264,7 @@ static UINT32 hit_check_x,hit_check_y; visarea.max_x = _x_-1; \ visarea.min_y = 0; \ visarea.max_y = _y_-1; \ - video_screen_configure(0, _x_, _y_, &visarea, video_screen_get_frame_period(0).attoseconds ); \ + video_screen_configure(machine->primary_screen, _x_, _y_, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds ); \ flip_screen_set(_flip_); \ } \ diff --git a/src/mame/drivers/m10.c b/src/mame/drivers/m10.c index fbceb4ddb4f..19187609b3d 100644 --- a/src/mame/drivers/m10.c +++ b/src/mame/drivers/m10.c @@ -410,14 +410,14 @@ static WRITE8_HANDLER( m15_a100_w ) static READ8_HANDLER( m10_a700_r ) { - //printf("rd:%d\n",video_screen_get_vpos(0)); + //printf("rd:%d\n",video_screen_get_vpos(machine->primary_screen)); cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE); return 0x00; } static READ8_HANDLER( m11_a700_r ) { - //printf("rd:%d\n",video_screen_get_vpos(0)); + //printf("rd:%d\n",video_screen_get_vpos(machine->primary_screen)); return 0x00; } @@ -439,12 +439,12 @@ static TIMER_CALLBACK( interrupt_callback ) if (param==0) { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+16, 0), NULL, 1,interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, IREMM10_VBSTART+16, 0), NULL, 1,interrupt_callback); } if (param==1) { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+24, 0), NULL, 2,interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, IREMM10_VBSTART+24, 0), NULL, 2,interrupt_callback); } if (param==-1) cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); @@ -454,7 +454,7 @@ static TIMER_CALLBACK( interrupt_callback ) static INTERRUPT_GEN( m11_interrupt ) { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, IREMM10_VBEND, 0), NULL, -1,interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, IREMM10_VBEND, 0), NULL, -1,interrupt_callback); } static INTERRUPT_GEN( m10_interrupt ) @@ -465,7 +465,7 @@ static INTERRUPT_GEN( m10_interrupt ) static INTERRUPT_GEN( m15_interrupt ) { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+1, 80), NULL, -1,interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, IREMM10_VBSTART+1, 80), NULL, -1,interrupt_callback); } /************************************* diff --git a/src/mame/drivers/m107.c b/src/mame/drivers/m107.c index 773427a47b1..4c5b418067f 100644 --- a/src/mame/drivers/m107.c +++ b/src/mame/drivers/m107.c @@ -52,7 +52,7 @@ static MACHINE_START( m107 ) static MACHINE_RESET( m107 ) { - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } /*****************************************************************************/ @@ -64,21 +64,21 @@ static TIMER_CALLBACK( m107_scanline_interrupt ) /* raster interrupt */ if (scanline == m107_raster_irq_position) { - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, M107_IRQ_2); } /* VBLANK interrupt */ else if (scanline == machine->screen[0].visarea.max_y + 1) { - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, M107_IRQ_0); } /* adjust for next scanline */ if (++scanline >= machine->screen[0].height) scanline = 0; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } diff --git a/src/mame/drivers/m72.c b/src/mame/drivers/m72.c index 3d95d0bc4c1..ab36f9cae10 100644 --- a/src/mame/drivers/m72.c +++ b/src/mame/drivers/m72.c @@ -101,21 +101,21 @@ static MACHINE_RESET( m72 ) { m72_irq_base = 0x20; MACHINE_RESET_CALL(m72_sound); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } static MACHINE_RESET( xmultipl ) { m72_irq_base = 0x08; MACHINE_RESET_CALL(m72_sound); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } static MACHINE_RESET( kengo ) { m72_irq_base = 0x18; MACHINE_RESET_CALL(m72_sound); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } static TIMER_CALLBACK( m72_scanline_interrupt ) @@ -125,21 +125,21 @@ static TIMER_CALLBACK( m72_scanline_interrupt ) /* raster interrupt - visible area only? */ if (scanline < 256 && scanline == m72_raster_irq_position - 128) { - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, m72_irq_base + 2); } /* VBLANK interrupt */ else if (scanline == 256) { - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, m72_irq_base + 0); } /* adjust for next scanline */ if (++scanline >= machine->screen[0].height) scanline = 0; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c index 9677968c91a..e6f1fa79def 100644 --- a/src/mame/drivers/m92.c +++ b/src/mame/drivers/m92.c @@ -232,7 +232,7 @@ static MACHINE_START( m92 ) static MACHINE_RESET( m92 ) { - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } /*****************************************************************************/ @@ -244,21 +244,21 @@ static TIMER_CALLBACK( m92_scanline_interrupt ) /* raster interrupt */ if (scanline == m92_raster_irq_position) { - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, M92_IRQ_2); } /* VBLANK interrupt */ else if (scanline == machine->screen[0].visarea.max_y + 1) { - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, M92_IRQ_0); } /* adjust for next scanline */ if (++scanline >= machine->screen[0].height) scanline = 0; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } /*****************************************************************************/ diff --git a/src/mame/drivers/magmax.c b/src/mame/drivers/magmax.c index 11c97036e38..dd56bc58020 100644 --- a/src/mame/drivers/magmax.c +++ b/src/mame/drivers/magmax.c @@ -69,7 +69,7 @@ static TIMER_CALLBACK( scanline_callback ) scanline += 128; scanline &= 255; - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } static MACHINE_START( magmax ) @@ -86,7 +86,7 @@ static MACHINE_START( magmax ) static MACHINE_RESET( magmax ) { - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), 64); #if 0 { diff --git a/src/mame/drivers/malzak.c b/src/mame/drivers/malzak.c index 0c27bfd1a71..90aa03438da 100644 --- a/src/mame/drivers/malzak.c +++ b/src/mame/drivers/malzak.c @@ -70,7 +70,7 @@ static WRITE8_HANDLER( saa5050_w ) static READ8_HANDLER( fake_VRLE_r ) { - return (malzak_s2636_0_ram[0xcb] & 0x3f) + (video_screen_get_vblank(0)*0x40); + return (malzak_s2636_0_ram[0xcb] & 0x3f) + (video_screen_get_vblank(machine->primary_screen)*0x40); } static READ8_HANDLER( ram_mirror_r ) diff --git a/src/mame/drivers/marinedt.c b/src/mame/drivers/marinedt.c index f1325217850..febb4d05bf8 100644 --- a/src/mame/drivers/marinedt.c +++ b/src/mame/drivers/marinedt.c @@ -278,7 +278,7 @@ static WRITE8_HANDLER( marinedt_pf_w ) //if(data&0xf0) // logerror("pf:%02x %d\n",marinedt_pf); -//logerror("pd:%02x %d\n",marinedt_pd, video_screen_get_frame_number(0)); +//logerror("pd:%02x %d\n",marinedt_pd, video_screen_get_frame_number(machine->primary_screen)); } diff --git a/src/mame/drivers/mcr3.c b/src/mame/drivers/mcr3.c index 4004eb14c1b..8a2117b33d6 100644 --- a/src/mame/drivers/mcr3.c +++ b/src/mame/drivers/mcr3.c @@ -422,7 +422,7 @@ static READ8_HANDLER( turbotag_ip2_r ) if (input_mux) return readinputportbytag("SSIO.IP2.ALT"); - return readinputportbytag("SSIO.IP2") + 5 * (video_screen_get_frame_number(0) & 1); + return readinputportbytag("SSIO.IP2") + 5 * (video_screen_get_frame_number(machine->primary_screen) & 1); } diff --git a/src/mame/drivers/meadows.c b/src/mame/drivers/meadows.c index 9bfff19868a..15d0d683b82 100644 --- a/src/mame/drivers/meadows.c +++ b/src/mame/drivers/meadows.c @@ -146,21 +146,21 @@ static UINT8 audio_sense_state; static READ8_HANDLER( hsync_chain_r ) { - UINT8 val = video_screen_get_hpos(0); + UINT8 val = video_screen_get_hpos(machine->primary_screen); return BITSWAP8(val,0,1,2,3,4,5,6,7); } static READ8_HANDLER( vsync_chain_hi_r ) { - UINT8 val = video_screen_get_vpos(0); + UINT8 val = video_screen_get_vpos(machine->primary_screen); return ((val >> 1) & 0x08) | ((val >> 3) & 0x04) | ((val >> 5) & 0x02) | (val >> 7); } static READ8_HANDLER( vsync_chain_lo_r ) { - UINT8 val = video_screen_get_vpos(0); + UINT8 val = video_screen_get_vpos(machine->primary_screen); return val & 0x0f; } diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index 49b104d33dc..5b6983e656b 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -219,7 +219,7 @@ static void draw_framebuffer(running_machine *machine, bitmap_t *bitmap, const r visarea.min_x = visarea.min_y = 0; visarea.max_x = width - 1; visarea.max_y = height - 1; - video_screen_configure(0, width, height * 262 / 240, &visarea, video_screen_get_frame_period(0).attoseconds); + video_screen_configure(machine->primary_screen, width, height * 262 / 240, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); } if (disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode @@ -329,10 +329,8 @@ static READ32_HANDLER( disp_ctrl_r ) case DC_TIMING_CFG: r |= 0x40000000; - if (video_screen_get_vpos(0) >= frame_height) - { + if (video_screen_get_vpos(machine->primary_screen) >= frame_height) r &= ~0x40000000; - } #if SPEEDUP_HACKS // wait for vblank speedup diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index 0750e524c57..2b0d1fd8ba5 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -4517,7 +4517,7 @@ int megadrive_z80irq_hpos = 320; visarea.min_y = 0; visarea.max_y = megadrive_visible_scanlines-1; - video_screen_configure(0, scr_width, megadrive_visible_scanlines, &visarea, HZ_TO_ATTOSECONDS(megadriv_framerate)); + video_screen_configure(machine->primary_screen, scr_width, megadrive_visible_scanlines, &visarea, HZ_TO_ATTOSECONDS(megadriv_framerate)); #if 0 { diff --git a/src/mame/drivers/mgolf.c b/src/mame/drivers/mgolf.c index fb0471ca991..e104e269e69 100644 --- a/src/mame/drivers/mgolf.c +++ b/src/mame/drivers/mgolf.c @@ -103,11 +103,9 @@ static TIMER_CALLBACK( interrupt_callback ) scanline = scanline + 32; if (scanline >= 262) - { scanline = 16; - } - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, interrupt_callback); } @@ -119,7 +117,7 @@ static double calc_plunger_pos(void) static MACHINE_RESET( mgolf ) { - timer_set(video_screen_get_time_until_pos(0, 16, 0), NULL, 16, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 16, 0), NULL, 16, interrupt_callback); } diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index 86c4f01641a..085992c6bbe 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -517,7 +517,7 @@ static void update_gun_irq(running_machine *machine) static TIMER_CALLBACK( invasn_gun_callback ) { int player = param; - int beamy = video_screen_get_vpos(0); + int beamy = video_screen_get_vpos(machine->primary_screen); /* set the appropriate IRQ in the internal gun control and update */ gun_irq_state |= 0x01 << player; @@ -526,7 +526,7 @@ static TIMER_CALLBACK( invasn_gun_callback ) /* generate another interrupt on the next scanline while we are within the BEAM_DY */ beamy++; if (beamy <= machine->screen[0].visarea.max_y && beamy <= gun_y[player] + BEAM_DY) - timer_adjust_oneshot(gun_timer[player], video_screen_get_time_until_pos(0, beamy, MAX(0, gun_x[player] - BEAM_DX)), player); + timer_adjust_oneshot(gun_timer[player], video_screen_get_time_until_pos(machine->primary_screen, beamy, MAX(0, gun_x[player] - BEAM_DX)), player); } @@ -555,7 +555,7 @@ static WRITE32_HANDLER( invasn_gun_w ) }; gun_x[player] = readinputportbytag(names[player][0]) * (visarea->max_x + 1 - visarea->min_x) / 255 + visarea->min_x + BEAM_XOFFS; gun_y[player] = readinputportbytag(names[player][1]) * (visarea->max_y + 1 - visarea->min_y) / 255 + visarea->min_y; - timer_adjust_oneshot(gun_timer[player], video_screen_get_time_until_pos(0, MAX(0, gun_y[player] - BEAM_DY), MAX(0, gun_x[player] - BEAM_DX)), player); + timer_adjust_oneshot(gun_timer[player], video_screen_get_time_until_pos(machine->primary_screen, MAX(0, gun_y[player] - BEAM_DY), MAX(0, gun_x[player] - BEAM_DX)), player); } } } @@ -563,8 +563,8 @@ static WRITE32_HANDLER( invasn_gun_w ) static READ32_HANDLER( invasn_gun_r ) { - int beamx = video_screen_get_hpos(0); - int beamy = video_screen_get_vpos(0); + int beamx = video_screen_get_hpos(machine->primary_screen); + int beamy = video_screen_get_vpos(machine->primary_screen); UINT32 result = 0xffff; int player; diff --git a/src/mame/drivers/mirage.c b/src/mame/drivers/mirage.c index ff9f4935665..fb92e7885e9 100644 --- a/src/mame/drivers/mirage.c +++ b/src/mame/drivers/mirage.c @@ -52,7 +52,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index 49fb8cec89c..25d7329a745 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -295,7 +295,7 @@ INLINE int v_to_scanline(int v) } -INLINE void schedule_next_irq(int curv) +INLINE void schedule_next_irq(running_machine *machine, int curv) { /* IRQ = /32V, clocked by /16V ^ flip */ /* When not flipped, clocks on 0, 64, 128, 192 */ @@ -306,7 +306,7 @@ INLINE void schedule_next_irq(int curv) curv = ((curv + 32) & 0xff) & ~0x10; /* next one at the start of this scanline */ - timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(0, v_to_scanline(curv), 0), curv); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, v_to_scanline(curv), 0), curv); } @@ -319,16 +319,16 @@ static TIMER_CALLBACK( clock_irq ) cpunum_set_input_line(machine, 0, 0, irq_state ? ASSERT_LINE : CLEAR_LINE); /* force an update while we're here */ - video_screen_update_partial(0, v_to_scanline(curv)); + video_screen_update_partial(machine->primary_screen, v_to_scanline(curv)); /* find the next edge */ - schedule_next_irq(curv); + schedule_next_irq(machine, curv); } static CUSTOM_INPUT( get_vblank ) { - int v = scanline_to_v(video_screen_get_vpos(0)); + int v = scanline_to_v(video_screen_get_vpos(machine->primary_screen)); return v < 24; } @@ -352,7 +352,7 @@ static TIMER_CALLBACK( adjust_cpu_speed ) /* scanline for the next run */ curv ^= 224; - timer_adjust_oneshot(cpu_timer, video_screen_get_time_until_pos(0, v_to_scanline(curv), 0), curv); + timer_adjust_oneshot(cpu_timer, video_screen_get_time_until_pos(machine->primary_screen, v_to_scanline(curv), 0), curv); } @@ -393,12 +393,12 @@ static MACHINE_START( missile ) /* create a timer to speed/slow the CPU */ cpu_timer = timer_alloc(adjust_cpu_speed, NULL); - timer_adjust_oneshot(cpu_timer, video_screen_get_time_until_pos(0, v_to_scanline(0), 0), 0); + timer_adjust_oneshot(cpu_timer, video_screen_get_time_until_pos(machine->primary_screen, v_to_scanline(0), 0), 0); /* create a timer for IRQs and set up the first callback */ irq_timer = timer_alloc(clock_irq, NULL); irq_state = 0; - schedule_next_irq(-32); + schedule_next_irq(machine, -32); /* setup for save states */ state_save_register_global(irq_state); diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c index 8ca72bafbbd..cafeffa01c5 100644 --- a/src/mame/drivers/model2.c +++ b/src/mame/drivers/model2.c @@ -483,7 +483,7 @@ static READ32_HANDLER(fifoctl_r) static READ32_HANDLER(videoctl_r) { - return (video_screen_get_frame_number(0) & 1)<<2; + return (video_screen_get_frame_number(machine->primary_screen) & 1)<<2; } diff --git a/src/mame/drivers/n8080.c b/src/mame/drivers/n8080.c index 0e8742cde25..04613ebd885 100644 --- a/src/mame/drivers/n8080.c +++ b/src/mame/drivers/n8080.c @@ -36,7 +36,7 @@ static READ8_HANDLER( n8080_shift_r ) static INTERRUPT_GEN( interrupt ) { - if (video_screen_get_vblank(0)) + if (video_screen_get_vblank(machine->primary_screen)) cpunum_set_input_line_and_vector(machine, 0, 0, PULSE_LINE, 0xcf); /* RST $08 */ else cpunum_set_input_line_and_vector(machine, 0, 0, PULSE_LINE, 0xd7); /* RST $10 */ diff --git a/src/mame/drivers/namcofl.c b/src/mame/drivers/namcofl.c index befc473cd2f..f40001cfafc 100644 --- a/src/mame/drivers/namcofl.c +++ b/src/mame/drivers/namcofl.c @@ -183,7 +183,7 @@ static WRITE32_HANDLER( namcofl_paletteram_w ) UINT16 v = paletteram32[offset] >> 16; UINT16 triggerscanline=(((v>>8)&0xff)|((v&0xff)<<8))-(32+1); - timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_time_until_pos(0, triggerscanline, 0), 0); + timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, triggerscanline, 0), 0); } } @@ -315,22 +315,22 @@ GFXDECODE_END static TIMER_CALLBACK( network_interrupt_callback ) { cpunum_set_input_line(machine, 0, I960_IRQ0, ASSERT_LINE); - timer_set(video_screen_get_frame_period(0), NULL, 0, network_interrupt_callback); + timer_set(video_screen_get_frame_period(machine->primary_screen), NULL, 0, network_interrupt_callback); } static TIMER_CALLBACK( vblank_interrupt_callback ) { cpunum_set_input_line(machine, 0, I960_IRQ2, ASSERT_LINE); - timer_set(video_screen_get_frame_period(0), NULL, 0, vblank_interrupt_callback); + timer_set(video_screen_get_frame_period(machine->primary_screen), NULL, 0, vblank_interrupt_callback); } static TIMER_CALLBACK( raster_interrupt_callback ) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); cpunum_set_input_line(machine, 0, I960_IRQ1, ASSERT_LINE); - timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_frame_period(0), 0); + timer_adjust_oneshot(raster_interrupt_timer, video_screen_get_frame_period(machine->primary_screen), 0); } @@ -342,8 +342,8 @@ static MACHINE_START( namcofl ) static MACHINE_RESET( namcofl ) { - timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 3, 0), NULL, 0, network_interrupt_callback); - timer_set(video_screen_get_time_until_pos(0, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, machine->screen[0].visarea.max_y + 3, 0), NULL, 0, network_interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, machine->screen[0].visarea.max_y + 1, 0), NULL, 0, vblank_interrupt_callback); } diff --git a/src/mame/drivers/namconb1.c b/src/mame/drivers/namconb1.c index 0d1da183a38..8f42068ab1d 100644 --- a/src/mame/drivers/namconb1.c +++ b/src/mame/drivers/namconb1.c @@ -296,14 +296,14 @@ GetCPURegister(int which) static TIMER_CALLBACK( namconb1_TriggerPOSIRQ ) { int irqlevel = GetCPURegister(0x04)>>4; - video_screen_update_partial(0, param); + video_screen_update_partial(machine->primary_screen, param); cpunum_set_input_line(machine, 0, irqlevel, PULSE_LINE); } static TIMER_CALLBACK( namconb2_TriggerPOSIRQ ) { int irqlevel = GetCPURegister(0x02); - video_screen_update_partial(0, param); + video_screen_update_partial(machine->primary_screen, param); cpunum_set_input_line(machine, 0, irqlevel, PULSE_LINE); } /* namconb2_TriggerPOSIRQ */ @@ -343,13 +343,10 @@ static INTERRUPT_GEN( namconb2_interrupt ) cpunum_set_input_line(machine, 0, irqlevel, HOLD_LINE); if( scanline<0 ) - { scanline = 0; - } + if( scanline < NAMCONB1_VBSTART ) - { - timer_set( video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, namconb2_TriggerPOSIRQ ); - } + timer_set( video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, namconb2_TriggerPOSIRQ ); } /* namconb2_interrupt */ static INTERRUPT_GEN( namconb1_interrupt ) { @@ -396,7 +393,7 @@ static INTERRUPT_GEN( namconb1_interrupt ) } if( scanline < NAMCONB1_VBSTART ) { - timer_set( video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, namconb1_TriggerPOSIRQ ); + timer_set( video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, namconb1_TriggerPOSIRQ ); } } /* namconb1_interrupt */ diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c index 35a14207c72..97f4ce0ff1c 100644 --- a/src/mame/drivers/neogeo.c +++ b/src/mame/drivers/neogeo.c @@ -163,7 +163,7 @@ static void adjust_display_position_interrupt_timer(void) if ((display_counter + 1) != 0) { attotime period = attotime_mul(ATTOTIME_IN_HZ(NEOGEO_PIXEL_CLOCK), display_counter + 1); - if (LOG_VIDEO_SYSTEM) logerror("adjust_display_position_interrupt_timer current y: %02x current x: %02x target y: %x target x: %x\n", video_screen_get_vpos(0), video_screen_get_hpos(0), (display_counter + 1) / NEOGEO_HTOTAL, (display_counter + 1) % NEOGEO_HTOTAL); + if (LOG_VIDEO_SYSTEM) logerror("adjust_display_position_interrupt_timer current y: %02x current x: %02x target y: %x target x: %x\n", video_screen_get_vpos(Machine->primary_screen), video_screen_get_hpos(Machine->primary_screen), (display_counter + 1) / NEOGEO_HTOTAL, (display_counter + 1) % NEOGEO_HTOTAL); timer_adjust_oneshot(display_position_interrupt_timer, period, 0); } @@ -227,10 +227,10 @@ void neogeo_acknowledge_interrupt(UINT16 data) static TIMER_CALLBACK( display_position_interrupt_callback ) { - if (LOG_VIDEO_SYSTEM) logerror("--- Scanline @ %d,%d\n", video_screen_get_vpos(0), video_screen_get_hpos(0)); + if (LOG_VIDEO_SYSTEM) logerror("--- Scanline @ %d,%d\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); if (display_position_interrupt_control & IRQ2CTRL_ENABLE) { - if (LOG_VIDEO_SYSTEM) logerror("*** Scanline interrupt (IRQ2) *** y: %02x x: %02x\n", video_screen_get_vpos(0), video_screen_get_hpos(0)); + if (LOG_VIDEO_SYSTEM) logerror("*** Scanline interrupt (IRQ2) *** y: %02x x: %02x\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); display_position_interrupt_pending = 1; update_interrupts(machine); @@ -253,13 +253,13 @@ static TIMER_CALLBACK( display_position_vblank_callback ) } /* set timer for next screen */ - timer_adjust_oneshot(display_position_vblank_timer, video_screen_get_time_until_pos(0, NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0); + timer_adjust_oneshot(display_position_vblank_timer, video_screen_get_time_until_pos(machine->primary_screen, NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0); } static TIMER_CALLBACK( vblank_interrupt_callback ) { - if (LOG_VIDEO_SYSTEM) logerror("+++ VBLANK @ %d,%d\n", video_screen_get_vpos(0), video_screen_get_hpos(0)); + if (LOG_VIDEO_SYSTEM) logerror("+++ VBLANK @ %d,%d\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); /* add a timer tick to the pd4990a */ calendar_clock(); @@ -269,7 +269,7 @@ static TIMER_CALLBACK( vblank_interrupt_callback ) update_interrupts(machine); /* set timer for next screen */ - timer_adjust_oneshot(vblank_interrupt_timer, video_screen_get_time_until_pos(0, NEOGEO_VBSTART, 0), 0); + timer_adjust_oneshot(vblank_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, NEOGEO_VBSTART, 0), 0); } @@ -281,10 +281,10 @@ static void create_interrupt_timers(void) } -static void start_interrupt_timers(void) +static void start_interrupt_timers(running_machine *machine) { - timer_adjust_oneshot(vblank_interrupt_timer, video_screen_get_time_until_pos(0, NEOGEO_VBSTART, 0), 0); - timer_adjust_oneshot(display_position_vblank_timer, video_screen_get_time_until_pos(0, NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0); + timer_adjust_oneshot(vblank_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, NEOGEO_VBSTART, 0), 0); + timer_adjust_oneshot(display_position_vblank_timer, video_screen_get_time_until_pos(machine->primary_screen, NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS), 0); } @@ -1012,7 +1012,7 @@ static MACHINE_RESET( neogeo ) neogeo_reset_rng(); - start_interrupt_timers(); + start_interrupt_timers(machine); /* trigger the IRQ3 that was set by MACHINE_START */ update_interrupts(machine); diff --git a/src/mame/drivers/nyny.c b/src/mame/drivers/nyny.c index a551d1adebf..4709788b2d1 100644 --- a/src/mame/drivers/nyny.c +++ b/src/mame/drivers/nyny.c @@ -449,7 +449,7 @@ static WRITE8_HANDLER( nyny_ay8910_37_port_a_w ) { /* not sure what this does */ - /*logerror("%x PORT A write %x at Y=%x X=%x\n", safe_activecpu_get_pc(), data, video_screen_get_vpos(0), video_screen_get_hpos(0));*/ + /*logerror("%x PORT A write %x at Y=%x X=%x\n", safe_activecpu_get_pc(), data, video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen));*/ } diff --git a/src/mame/drivers/pkscram.c b/src/mame/drivers/pkscram.c index 671e952340f..481c2714c2c 100644 --- a/src/mame/drivers/pkscram.c +++ b/src/mame/drivers/pkscram.c @@ -212,14 +212,14 @@ static TIMER_CALLBACK( scanline_callback ) { if (out&0x2000) cpunum_set_input_line(machine, 0, 1, ASSERT_LINE); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, param+1, 0), param+1); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, param+1, 0), param+1); interrupt_line_active = 1; } else { if (interrupt_line_active) cpunum_set_input_line(machine, 0, 1, CLEAR_LINE); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, interrupt_scanline, 0), interrupt_scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, interrupt_scanline, 0), interrupt_scanline); interrupt_line_active = 0; } } @@ -275,7 +275,7 @@ static MACHINE_RESET( pkscramble) out = 0; interrupt_line_active=0; scanline_timer = timer_alloc(scanline_callback, NULL); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, interrupt_scanline, 0), interrupt_scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, interrupt_scanline, 0), interrupt_scanline); state_save_register_global(out); state_save_register_global(interrupt_line_active); diff --git a/src/mame/drivers/polepos.c b/src/mame/drivers/polepos.c index 7ac541956cb..a4f92490a5e 100644 --- a/src/mame/drivers/polepos.c +++ b/src/mame/drivers/polepos.c @@ -309,7 +309,7 @@ static READ8_HANDLER( polepos_ready_r ) { int ret = 0xff; - if (video_screen_get_vpos(0) >= 128) + if (video_screen_get_vpos(machine->primary_screen) >= 128) ret ^= 0x02; ret ^= 0x08; /* ADC End Flag */ diff --git a/src/mame/drivers/policetr.c b/src/mame/drivers/policetr.c index efa8082e8ec..b2289be5fcb 100644 --- a/src/mame/drivers/policetr.c +++ b/src/mame/drivers/policetr.c @@ -128,7 +128,7 @@ static TIMER_CALLBACK( irq5_gen ) static INTERRUPT_GEN( irq4_gen ) { cpunum_set_input_line(machine, 0, R3000_IRQ4, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, irq5_gen); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, irq5_gen); } diff --git a/src/mame/drivers/redalert.c b/src/mame/drivers/redalert.c index b4c2c209b4b..f74d6a7fb2d 100644 --- a/src/mame/drivers/redalert.c +++ b/src/mame/drivers/redalert.c @@ -99,7 +99,7 @@ static READ8_HANDLER( redalert_interrupt_clear_r ) cpunum_set_input_line(Machine, 0, M6502_IRQ_LINE, CLEAR_LINE); /* the result never seems to be actually used */ - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); } diff --git a/src/mame/drivers/rotaryf.c b/src/mame/drivers/rotaryf.c index 593d387517a..aeeb93850aa 100644 --- a/src/mame/drivers/rotaryf.c +++ b/src/mame/drivers/rotaryf.c @@ -28,7 +28,7 @@ static size_t rotaryf_videoram_size; static INTERRUPT_GEN( rotaryf_interrupt ) { - if (video_screen_get_vblank(0)) + if (video_screen_get_vblank(machine->primary_screen)) cpunum_set_input_line(machine, 0, I8085_RST55_LINE, HOLD_LINE); else cpunum_set_input_line(machine, 0, I8085_RST75_LINE, HOLD_LINE); diff --git a/src/mame/drivers/runaway.c b/src/mame/drivers/runaway.c index 60b597dfef8..7f8d2529251 100644 --- a/src/mame/drivers/runaway.c +++ b/src/mame/drivers/runaway.c @@ -38,17 +38,15 @@ static TIMER_CALLBACK( interrupt_callback ) scanline += 32; if (scanline >= 263) - { scanline = 16; - } - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, interrupt_callback); } static MACHINE_RESET( runaway ) { - timer_set(video_screen_get_time_until_pos(0, 16, 0), NULL, 16, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 16, 0), NULL, 16, interrupt_callback); } diff --git a/src/mame/drivers/sbowling.c b/src/mame/drivers/sbowling.c index 715aea484cd..285be7749ea 100644 --- a/src/mame/drivers/sbowling.c +++ b/src/mame/drivers/sbowling.c @@ -133,7 +133,7 @@ static READ8_HANDLER( pix_data_r ) static INTERRUPT_GEN( sbw_interrupt ) { - int vector = video_screen_get_vblank(0) ? 0xcf : 0xd7; /* RST 08h/10h */ + int vector = video_screen_get_vblank(machine->primary_screen) ? 0xcf : 0xd7; /* RST 08h/10h */ cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, vector); } diff --git a/src/mame/drivers/sbrkout.c b/src/mame/drivers/sbrkout.c index 935c885d0f8..ba409fa0938 100644 --- a/src/mame/drivers/sbrkout.c +++ b/src/mame/drivers/sbrkout.c @@ -97,7 +97,7 @@ static MACHINE_START( sbrkout ) static MACHINE_RESET( sbrkout ) { - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } @@ -113,7 +113,7 @@ static TIMER_CALLBACK( scanline_callback ) int scanline = param; /* force a partial update before anything happens */ - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); /* if this is a rising edge of 16V, assert the CPU interrupt */ if (scanline % 32 == 16) @@ -126,14 +126,14 @@ static TIMER_CALLBACK( scanline_callback ) if (scanline == machine->screen[0].visarea.max_y + 1) { UINT8 potvalue = readinputportbytag("PADDLE"); - timer_adjust_oneshot(pot_timer, video_screen_get_time_until_pos(0, 72 + (potvalue / 2), (potvalue % 2) * 128), 0); + timer_adjust_oneshot(pot_timer, video_screen_get_time_until_pos(machine->primary_screen, 72 + (potvalue / 2), (potvalue % 2) * 128), 0); } /* call us back in 4 scanlines */ scanline += 4; if (scanline >= machine->screen[0].height) scanline = 0; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -258,9 +258,9 @@ static WRITE8_HANDLER( coincount_w ) static READ8_HANDLER( sync_r ) { - int hpos = video_screen_get_hpos(0); - sync2_value = (hpos >= 128 && hpos <= Machine->screen[0].visarea.max_x); - return video_screen_get_vpos(0); + int hpos = video_screen_get_hpos(machine->primary_screen); + sync2_value = (hpos >= 128 && hpos <= machine->screen[0].visarea.max_x); + return video_screen_get_vpos(machine->primary_screen); } diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c index 51598d34cb0..7787737ecdf 100644 --- a/src/mame/drivers/segac2.c +++ b/src/mame/drivers/segac2.c @@ -453,7 +453,7 @@ static WRITE16_HANDLER( io_chip_w ) newbank = data & 3; if (newbank != palbank) { - video_screen_update_partial(0, video_screen_get_vpos(0) + 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) + 1); palbank = newbank; recompute_palette_tables(); } @@ -551,11 +551,11 @@ static WRITE16_HANDLER( prot_w ) /* if the palette changed, force an update */ if (new_sp_palbase != sp_palbase || new_bg_palbase != bg_palbase) { - video_screen_update_partial(0, video_screen_get_vpos(0) + 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) + 1); sp_palbase = new_sp_palbase; bg_palbase = new_bg_palbase; recompute_palette_tables(); - if (LOG_PALETTE) logerror("Set palbank: %d/%d (scan=%d)\n", bg_palbase, sp_palbase, video_screen_get_vpos(0)); + if (LOG_PALETTE) logerror("Set palbank: %d/%d (scan=%d)\n", bg_palbase, sp_palbase, video_screen_get_vpos(machine->primary_screen)); } } diff --git a/src/mame/drivers/segae.c b/src/mame/drivers/segae.c index d9f691b1752..8a073745311 100644 --- a/src/mame/drivers/segae.c +++ b/src/mame/drivers/segae.c @@ -1440,7 +1440,7 @@ static void end_of_frame(struct sms_vdp *chip) visarea.min_y = 0; visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1; - if (chip->chip_id==3) video_screen_configure(0, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); + if (chip->chip_id==3) video_screen_configure(Machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); } else /* 160x144 */ diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index f32460037fe..d7defcdff69 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -214,7 +214,7 @@ static TIMER_CALLBACK( scanline_callback ) case 65: case 129: case 193: - timer_set(video_screen_get_time_until_pos(0, scanline, machine->screen[0].visarea.max_x + 1), NULL, 0, irq2_gen); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, machine->screen[0].visarea.max_x + 1), NULL, 0, irq2_gen); next_scanline = scanline + 1; break; @@ -245,7 +245,7 @@ static TIMER_CALLBACK( scanline_callback ) update_main_irqs(machine); /* come back at the next targeted scanline */ - timer_set(video_screen_get_time_until_pos(0, next_scanline, 0), NULL, next_scanline, scanline_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, next_scanline, 0), NULL, next_scanline, scanline_callback); } @@ -276,7 +276,7 @@ static MACHINE_RESET( outrun ) cpunum_set_info_fct(0, CPUINFO_PTR_M68K_RESET_CALLBACK, (genf *)outrun_reset); /* start timers to track interrupts */ - timer_set(video_screen_get_time_until_pos(0, 223, 0), NULL, 223, scanline_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 223, 0), NULL, 223, scanline_callback); } diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c index bbe6168b62b..411ec6ad1fc 100644 --- a/src/mame/drivers/segas32.c +++ b/src/mame/drivers/segas32.c @@ -572,7 +572,7 @@ static INTERRUPT_GEN( start_of_vblank_int ) { signal_v60_irq(MAIN_IRQ_VBSTART); system32_set_vblank(1); - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, end_of_vblank_int); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, end_of_vblank_int); if (system32_prot_vblank) (*system32_prot_vblank)(); } diff --git a/src/mame/drivers/segaxbd.c b/src/mame/drivers/segaxbd.c index 82e6abe6de7..3f63ba3c932 100644 --- a/src/mame/drivers/segaxbd.c +++ b/src/mame/drivers/segaxbd.c @@ -151,7 +151,7 @@ static TIMER_CALLBACK( scanline_callback ) update_main_irqs(); /* come back in 2 scanlines */ - timer_set(video_screen_get_time_until_pos(0, next_scanline, 0), NULL, next_scanline, scanline_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, next_scanline, 0), NULL, next_scanline, scanline_callback); } @@ -223,7 +223,7 @@ static MACHINE_RESET( xboard ) segaic16_compare_timer_init(1, NULL, NULL); /* start timers to track interrupts */ - timer_set(video_screen_get_time_until_pos(0, 1, 0), NULL, 1, scanline_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 1, 0), NULL, 1, scanline_callback); } diff --git a/src/mame/drivers/segaybd.c b/src/mame/drivers/segaybd.c index c0baf8a1c40..b2a5589c3e5 100644 --- a/src/mame/drivers/segaybd.c +++ b/src/mame/drivers/segaybd.c @@ -164,7 +164,7 @@ static TIMER_CALLBACK( scanline_callback ) update_main_irqs(); /* come back at the next appropriate scanline */ - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); #if TWEAK_IRQ2_SCANLINE if (scanline == 223) @@ -186,7 +186,7 @@ static TIMER_CALLBACK( scanline_callback ) static MACHINE_RESET( yboard ) { interrupt_timer = timer_alloc(scanline_callback, NULL); - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, 223, 0), 223); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 223, 0), 223); state_save_register_global_array(misc_io_data); state_save_register_global_array(analog_data); diff --git a/src/mame/drivers/shanghai.c b/src/mame/drivers/shanghai.c index bf759d6cabd..2c896657470 100644 --- a/src/mame/drivers/shanghai.c +++ b/src/mame/drivers/shanghai.c @@ -638,9 +638,7 @@ static READ16_HANDLER( HD63484_data_r ) int res; if (regno == 0x80) - { - res = video_screen_get_vpos(0); - } + res = video_screen_get_vpos(machine->primary_screen); else if (regno == 0) { logerror("%05x: HD63484 read FIFO\n",activecpu_get_pc()); diff --git a/src/mame/drivers/skullxbo.c b/src/mame/drivers/skullxbo.c index 4fe01080418..3b19cb26f6b 100644 --- a/src/mame/drivers/skullxbo.c +++ b/src/mame/drivers/skullxbo.c @@ -63,7 +63,7 @@ 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, video_screen_get_vpos(scrnum) + 6, machine->screen[scrnum].width * 0.9); + attotime period = video_screen_get_time_until_pos_scrnum(scrnum, video_screen_get_vpos_scrnum(scrnum) + 6, machine->screen[scrnum].width * 0.9); timer_set(period, NULL, 0, irq_gen); } diff --git a/src/mame/drivers/spacefb.c b/src/mame/drivers/spacefb.c index c8252b60f98..3f498841d44 100644 --- a/src/mame/drivers/spacefb.c +++ b/src/mame/drivers/spacefb.c @@ -125,7 +125,7 @@ static TIMER_CALLBACK( interrupt_callback ) int next_vpos; /* compute vector and set the interrupt line */ - int vpos = video_screen_get_vpos(0); + int vpos = video_screen_get_vpos(machine->primary_screen); UINT8 vector = 0xc7 | ((vpos & 0x40) >> 2) | ((~vpos & 0x40) >> 3); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, vector); @@ -135,7 +135,7 @@ static TIMER_CALLBACK( interrupt_callback ) else next_vpos = SPACEFB_INT_TRIGGER_COUNT_1; - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, next_vpos, 0), 0); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, next_vpos, 0), 0); } @@ -145,43 +145,9 @@ static void create_interrupt_timer(void) } -static void start_interrupt_timer(void) +static void start_interrupt_timer(running_machine *machine) { - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, SPACEFB_INT_TRIGGER_COUNT_1, 0), 0); -} - - - -/************************************* - * - * Output port writes - * - *************************************/ - -static WRITE8_HANDLER( spacefb_port_0_w ) -{ - spacefb_set_flip_screen((data >> 0) & 0x01); - - spacefb_set_gfx_bank((data >> 5) & 0x01); - - spacefb_set_palette_bank((data >> 6) & 0x01); -} - - -static WRITE8_HANDLER( spacefb_port_2_w ) -{ - spacefb_set_color_contrast_r((data >> 0) & 0x01); - - spacefb_set_color_contrast_g((data >> 1) & 0x01); - - spacefb_set_color_contrast_b((data >> 2) & 0x01); - - spacefb_set_background_red((data >> 3) & 0x01); - - spacefb_set_background_blue((data >> 4) & 0x01); - - spacefb_set_disable_star_field((data >> 7) & 0x01); - + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, SPACEFB_INT_TRIGGER_COUNT_1, 0), 0); } @@ -212,7 +178,7 @@ static MACHINE_RESET( spacefb ) spacefb_port_1_w(machine, 0, 0); spacefb_port_2_w(machine, 0, 0); - start_interrupt_timer(); + start_interrupt_timer(machine); } diff --git a/src/mame/drivers/sprint2.c b/src/mame/drivers/sprint2.c index 35eeb0f3034..ffd6b27118a 100644 --- a/src/mame/drivers/sprint2.c +++ b/src/mame/drivers/sprint2.c @@ -166,21 +166,16 @@ static READ8_HANDLER( sprint2_sync_r ) UINT8 val = 0; if (attract != 0) - { val |= 0x10; - } - if (video_screen_get_vpos(0) == 261) - { + + if (video_screen_get_vpos(machine->primary_screen) == 261) val |= 0x20; /* VRESET */ - } - if (video_screen_get_vpos(0) >= 224) - { + + if (video_screen_get_vpos(machine->primary_screen) >= 224) val |= 0x40; /* VBLANK */ - } - if (video_screen_get_vpos(0) >= 131) - { + + if (video_screen_get_vpos(machine->primary_screen) >= 131) val |= 0x80; /* 60 Hz? */ - } return val; } diff --git a/src/mame/drivers/sprint4.c b/src/mame/drivers/sprint4.c index 80b9ef8ee58..01d433aeb9f 100644 --- a/src/mame/drivers/sprint4.c +++ b/src/mame/drivers/sprint4.c @@ -120,13 +120,13 @@ static TIMER_CALLBACK( nmi_callback ) if (readinputport(0) & 0x40) cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, nmi_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, nmi_callback); } static MACHINE_RESET( sprint4 ) { - timer_set(video_screen_get_time_until_pos(0, 32, 0), NULL, 32, nmi_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 32, 0), NULL, 32, nmi_callback); memset(steer_FF1, 0, sizeof steer_FF1); memset(steer_FF2, 0, sizeof steer_FF2); diff --git a/src/mame/drivers/sprint8.c b/src/mame/drivers/sprint8.c index af1f05a9918..598e0810a6e 100644 --- a/src/mame/drivers/sprint8.c +++ b/src/mame/drivers/sprint8.c @@ -59,7 +59,7 @@ static MACHINE_RESET( sprint8 ) collision_reset = 0; collision_index = 0; - timer_pulse(video_screen_get_frame_period(0), NULL, 0, input_callback); + timer_pulse(video_screen_get_frame_period(machine->primary_screen), NULL, 0, input_callback); } diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c index 7ffa69794b9..18d13715d98 100644 --- a/src/mame/drivers/suna8.c +++ b/src/mame/drivers/suna8.c @@ -960,7 +960,7 @@ static WRITE8_HANDLER( sparkman_rombank_w ) static READ8_HANDLER( sparkman_c0a3_r ) { - return (video_screen_get_frame_number(0) & 1) ? 0x80 : 0; + return (video_screen_get_frame_number(machine->primary_screen) & 1) ? 0x80 : 0; } static ADDRESS_MAP_START( sparkman_readmem, ADDRESS_SPACE_PROGRAM, 8 ) diff --git a/src/mame/drivers/thunderj.c b/src/mame/drivers/thunderj.c index 83052f787a2..a4a5890be2e 100644 --- a/src/mame/drivers/thunderj.c +++ b/src/mame/drivers/thunderj.c @@ -103,7 +103,7 @@ static WRITE16_HANDLER( latch_w ) /* bits 2-5 are the alpha bank */ if (thunderj_alpha_tile_bank != ((data >> 2) & 7)) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); tilemap_mark_all_tiles_dirty(atarigen_alpha_tilemap); thunderj_alpha_tile_bank = (data >> 2) & 7; } diff --git a/src/mame/drivers/tickee.c b/src/mame/drivers/tickee.c index 4748a01ae35..d4a8d662147 100644 --- a/src/mame/drivers/tickee.c +++ b/src/mame/drivers/tickee.c @@ -72,7 +72,7 @@ static TIMER_CALLBACK( setup_gun_interrupts ) int beamx, beamy; /* set a timer to do this again next frame */ - timer_adjust_oneshot(setup_gun_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(setup_gun_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); /* only do work if the palette is flashed */ if (!tickee_control[2]) @@ -80,13 +80,13 @@ static TIMER_CALLBACK( setup_gun_interrupts ) /* generate interrupts for player 1's gun */ get_crosshair_xy(machine, 0, &beamx, &beamy); - timer_set(video_screen_get_time_until_pos(0, beamy, beamx + 50), NULL, 0, trigger_gun_interrupt); - timer_set(video_screen_get_time_until_pos(0, beamy + 1, beamx + 50), NULL, 0, clear_gun_interrupt); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, beamy, beamx + 50), NULL, 0, trigger_gun_interrupt); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, beamy + 1, beamx + 50), NULL, 0, clear_gun_interrupt); /* generate interrupts for player 2's gun */ get_crosshair_xy(machine, 1, &beamx, &beamy); - timer_set(video_screen_get_time_until_pos(0, beamy, beamx + 50), NULL, 1, trigger_gun_interrupt); - timer_set(video_screen_get_time_until_pos(0, beamy + 1, beamx + 50), NULL, 1, clear_gun_interrupt); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, beamy, beamx + 50), NULL, 1, trigger_gun_interrupt); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, beamy + 1, beamx + 50), NULL, 1, clear_gun_interrupt); } @@ -101,7 +101,7 @@ static VIDEO_START( tickee ) { /* start a timer going on the first scanline of every frame */ setup_gun_timer = timer_alloc(setup_gun_interrupts, NULL); - timer_adjust_oneshot(setup_gun_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(setup_gun_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c index 1d4913ac9cb..d574351f0c6 100644 --- a/src/mame/drivers/toaplan2.c +++ b/src/mame/drivers/toaplan2.c @@ -579,7 +579,7 @@ static DRIVER_INIT( bbakradu ) static READ16_HANDLER( toaplan2_inputport_0_word_r ) { - return ((video_screen_get_vpos(0) + 15) % 262) >= 245; + return ((video_screen_get_vpos(machine->primary_screen) + 15) % 262) >= 245; } @@ -588,15 +588,15 @@ static TIMER_CALLBACK( toaplan2_raise_irq ) cpunum_set_input_line(machine, 0, param, HOLD_LINE); } -static void toaplan2_vblank_irq(int irq_line) +static void toaplan2_vblank_irq(running_machine *machine, int irq_line) { /* the IRQ appears to fire at line 0xe6 */ - timer_set(video_screen_get_time_until_pos(0, 0xe6, 0), NULL, irq_line, toaplan2_raise_irq); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0xe6, 0), NULL, irq_line, toaplan2_raise_irq); } -static INTERRUPT_GEN( toaplan2_vblank_irq1 ) { toaplan2_vblank_irq(1); } -static INTERRUPT_GEN( toaplan2_vblank_irq2 ) { toaplan2_vblank_irq(2); } -static INTERRUPT_GEN( toaplan2_vblank_irq4 ) { toaplan2_vblank_irq(4); } +static INTERRUPT_GEN( toaplan2_vblank_irq1 ) { toaplan2_vblank_irq(machine, 1); } +static INTERRUPT_GEN( toaplan2_vblank_irq2 ) { toaplan2_vblank_irq(machine, 2); } +static INTERRUPT_GEN( toaplan2_vblank_irq4 ) { toaplan2_vblank_irq(machine, 4); } static READ16_HANDLER( video_count_r ) { @@ -606,8 +606,8 @@ static READ16_HANDLER( video_count_r ) /* +---------+---------+--------+---------------------------+ */ /*************** Control Signals are active low ***************/ - int hpos = video_screen_get_hpos(0); - int vpos = video_screen_get_vpos(0); + int hpos = video_screen_get_hpos(machine->primary_screen); + int vpos = video_screen_get_vpos(machine->primary_screen); video_status = 0xff00; /* Set signals inactive */ vpos = (vpos + 15) % 262; @@ -623,7 +623,7 @@ static READ16_HANDLER( video_count_r ) else video_status |= 0xff; -// logerror("VC: vpos=%04x hpos=%04x VBL=%04x\n",vpos,hpos,video_screen_get_vblank(0)); +// logerror("VC: vpos=%04x hpos=%04x VBL=%04x\n",vpos,hpos,video_screen_get_vblank(machine->primary_screen)); return video_status; } diff --git a/src/mame/drivers/tubep.c b/src/mame/drivers/tubep.c index 7af3bbbe129..c520f40dc73 100644 --- a/src/mame/drivers/tubep.c +++ b/src/mame/drivers/tubep.c @@ -320,16 +320,16 @@ curr_scanline = scanline;//for debugging } - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); //debug -logerror("scanline=%3i scrgetvpos(0)=%3i\n",scanline,video_screen_get_vpos(0)); +logerror("scanline=%3i scrgetvpos(0)=%3i\n",scanline,video_screen_get_vpos(machine->primary_screen)); scanline ++; if (scanline>=264) scanline=0; - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -361,7 +361,7 @@ static MACHINE_START( tubep ) static MACHINE_RESET( tubep ) { - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } @@ -502,15 +502,15 @@ curr_scanline = scanline;//for debugging } - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); -logerror("scanline=%3i scrgetvpos(0)=%3i\n",scanline,video_screen_get_vpos(0)); +logerror("scanline=%3i scrgetvpos(0)=%3i\n",scanline,video_screen_get_vpos(machine->primary_screen)); scanline ++; if (scanline>=264) scanline=0; - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -524,7 +524,7 @@ static MACHINE_START( rjammer ) static MACHINE_RESET( rjammer ) { - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } diff --git a/src/mame/drivers/tugboat.c b/src/mame/drivers/tugboat.c index bce8ce68877..b4763ece653 100644 --- a/src/mame/drivers/tugboat.c +++ b/src/mame/drivers/tugboat.c @@ -168,7 +168,7 @@ static const pia6821_interface pia1_intf = static TIMER_CALLBACK( interrupt_gen ) { cpunum_set_input_line(machine, 0, 0, HOLD_LINE); - timer_set(video_screen_get_frame_period(0), NULL, 0, interrupt_gen); + timer_set(video_screen_get_frame_period(machine->primary_screen), NULL, 0, interrupt_gen); } static MACHINE_START( tugboat ) @@ -180,7 +180,7 @@ static MACHINE_START( tugboat ) static MACHINE_RESET( tugboat ) { pia_reset(); - timer_set(video_screen_get_time_until_pos(0, 30*8+4, 0), NULL, 0, interrupt_gen); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 30*8+4, 0), NULL, 0, interrupt_gen); } diff --git a/src/mame/drivers/turbo.c b/src/mame/drivers/turbo.c index 55adc6ff47f..531e8f2da4b 100644 --- a/src/mame/drivers/turbo.c +++ b/src/mame/drivers/turbo.c @@ -545,7 +545,7 @@ static WRITE8_HANDLER( turbo_8279_w ) static READ8_HANDLER( turbo_collision_r ) { turbo_state *state = Machine->driver_data; - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); return readinputport(3) | (state->turbo_collision & 15); } @@ -553,7 +553,7 @@ static READ8_HANDLER( turbo_collision_r ) static WRITE8_HANDLER( turbo_collision_clear_w ) { turbo_state *state = Machine->driver_data; - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); state->turbo_collision = 0; } diff --git a/src/mame/drivers/ultratnk.c b/src/mame/drivers/ultratnk.c index c6a3cd418d1..4159504643e 100644 --- a/src/mame/drivers/ultratnk.c +++ b/src/mame/drivers/ultratnk.c @@ -48,26 +48,22 @@ static TIMER_CALLBACK( nmi_callback ) int scanline = param + 64; if (scanline >= VTOTAL) - { scanline = 32; - } /* NMI and watchdog are disabled during service mode */ watchdog_enable(machine, readinputport(0) & 0x40); if (readinputport(0) & 0x40) - { cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); - } - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, nmi_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, nmi_callback); } static MACHINE_RESET( ultratnk ) { - timer_set(video_screen_get_time_until_pos(0, 32, 0), NULL, 32, nmi_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 32, 0), NULL, 32, nmi_callback); } diff --git a/src/mame/drivers/unico.c b/src/mame/drivers/unico.c index eeecdebe7d4..cfd242ec863 100644 --- a/src/mame/drivers/unico.c +++ b/src/mame/drivers/unico.c @@ -134,7 +134,7 @@ static READ16_HANDLER( unico_gunx_0_msb_r ) if (x<0x160) x=0x30 + (x*0xd0/0x15f); else x=((x-0x160) * 0x20)/0x1f; - return ((x&0xff) ^ (video_screen_get_frame_number(0)&1))<<8; + return ((x&0xff) ^ (video_screen_get_frame_number(machine->primary_screen)&1))<<8; } static READ16_HANDLER( unico_guny_0_msb_r ) @@ -143,7 +143,7 @@ static READ16_HANDLER( unico_guny_0_msb_r ) y=0x18+((y*0xe0)/0xff); - return ((y&0xff) ^ (video_screen_get_frame_number(0)&1))<<8; + return ((y&0xff) ^ (video_screen_get_frame_number(machine->primary_screen)&1))<<8; } static READ16_HANDLER( unico_gunx_1_msb_r ) @@ -154,7 +154,7 @@ static READ16_HANDLER( unico_gunx_1_msb_r ) if (x<0x160) x=0x30 + (x*0xd0/0x15f); else x=((x-0x160) * 0x20)/0x1f; - return ((x&0xff) ^ (video_screen_get_frame_number(0)&1))<<8; + return ((x&0xff) ^ (video_screen_get_frame_number(machine->primary_screen)&1))<<8; } static READ16_HANDLER( unico_guny_1_msb_r ) @@ -163,7 +163,7 @@ static READ16_HANDLER( unico_guny_1_msb_r ) y=0x18+((y*0xe0)/0xff); - return ((y&0xff) ^ (video_screen_get_frame_number(0)&1))<<8; + return ((y&0xff) ^ (video_screen_get_frame_number(machine->primary_screen)&1))<<8; } static ADDRESS_MAP_START( readmem_zeropnt, ADDRESS_SPACE_PROGRAM, 16 ) diff --git a/src/mame/drivers/vicdual.c b/src/mame/drivers/vicdual.c index 04347cf990a..d64642c9253 100644 --- a/src/mame/drivers/vicdual.c +++ b/src/mame/drivers/vicdual.c @@ -96,7 +96,7 @@ static CUSTOM_INPUT( vicdual_read_coin_status ) cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE); /* simulate the coin switch being closed for a while */ - timer_set(double_to_attotime(4 * attotime_to_double(video_screen_get_frame_period(0))), NULL, 0, clear_coin_status); + timer_set(double_to_attotime(4 * attotime_to_double(video_screen_get_frame_period(machine->primary_screen))), NULL, 0, clear_coin_status); } last_coin_input = coin_input; @@ -129,13 +129,13 @@ static UINT32 timer_value; #define TIMER_HALF_PERIOD ATTOTIME_IN_MSEC(4 / 2) /* 4Mhz square wave */ -static int get_vcounter(void) +static int get_vcounter(running_machine *machine) { - int vcounter = video_screen_get_vpos(0); + int vcounter = video_screen_get_vpos(machine->primary_screen); /* the vertical synch counter gets incremented at the end of HSYNC, compensate for this */ - if (video_screen_get_hpos(0) >= VICDUAL_HSEND) + if (video_screen_get_hpos(machine->primary_screen) >= VICDUAL_HSEND) vcounter = (vcounter + 1) % VICDUAL_VTOTAL; return vcounter; @@ -144,19 +144,19 @@ static int get_vcounter(void) static CUSTOM_INPUT( vicdual_get_64v ) { - return (get_vcounter() >> 6) & 0x01; + return (get_vcounter(machine) >> 6) & 0x01; } static CUSTOM_INPUT( vicdual_get_vblank_comp ) { - return (get_vcounter() < VICDUAL_VBSTART); + return (get_vcounter(machine) < VICDUAL_VBSTART); } static CUSTOM_INPUT( vicdual_get_composite_blank_comp ) { - return (vicdual_get_vblank_comp(machine, 0) && !video_screen_get_hblank(0)); + return (vicdual_get_vblank_comp(machine, 0) && !video_screen_get_hblank(machine->primary_screen)); } diff --git a/src/mame/drivers/videopin.c b/src/mame/drivers/videopin.c index 852ef73e420..826a15c2133 100644 --- a/src/mame/drivers/videopin.c +++ b/src/mame/drivers/videopin.c @@ -58,17 +58,15 @@ static TIMER_CALLBACK( interrupt_callback ) scanline = scanline + 32; if (scanline >= 263) - { scanline = 32; - } - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, interrupt_callback); } static MACHINE_RESET( videopin ) { - timer_set(video_screen_get_time_until_pos(0, 32, 0), NULL, 32, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 32, 0), NULL, 32, interrupt_callback); /* both output latches are cleared on reset */ @@ -113,7 +111,7 @@ static READ8_HANDLER( videopin_misc_r ) static WRITE8_HANDLER( videopin_led_w ) { - int i = (video_screen_get_vpos(0) >> 5) & 7; + int i = (video_screen_get_vpos(machine->primary_screen) >> 5) & 7; static const char *const matrix[8][4] = { { "LED26", "LED18", "LED11", "LED13" }, diff --git a/src/mame/drivers/wolfpack.c b/src/mame/drivers/wolfpack.c index af836199c2d..168faef9020 100644 --- a/src/mame/drivers/wolfpack.c +++ b/src/mame/drivers/wolfpack.c @@ -44,17 +44,15 @@ static TIMER_CALLBACK( periodic_callback ) scanline += 64; if (scanline >= 262) - { scanline = 0; - } - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, periodic_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, periodic_callback); } static MACHINE_RESET( wolfpack ) { - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, periodic_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, periodic_callback); } @@ -89,17 +87,13 @@ static READ8_HANDLER( wolfpack_misc_r ) /* BIT7 => VBLANK */ if (!S14001A_bsy_0_r()) - { - val |= 0x01; - } + val |= 0x01; + if (!wolfpack_collision) - { val |= 0x10; - } - if (video_screen_get_vpos(0) >= 240) - { + + if (video_screen_get_vpos(machine->primary_screen) >= 240) val |= 0x80; - } return val; } diff --git a/src/mame/drivers/wwfsstar.c b/src/mame/drivers/wwfsstar.c index 48734169cd5..90faf4809b2 100644 --- a/src/mame/drivers/wwfsstar.c +++ b/src/mame/drivers/wwfsstar.c @@ -192,14 +192,14 @@ static INTERRUPT_GEN( wwfsstars_interrupt ) /* Vblank is raised on scanline 240 (248) */ else if (scanline==240) { - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); cpunum_set_input_line(machine, 0, 6, ASSERT_LINE); } /* An interrupt is generated every 16 scanlines */ if (scanline%16 == 0) { - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); cpunum_set_input_line(machine, 0, 5, ASSERT_LINE); } } diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c index cf9f607a092..565c0e482e8 100644 --- a/src/mame/drivers/xexex.c +++ b/src/mame/drivers/xexex.c @@ -153,7 +153,7 @@ static void xexex_objdma(int limiter) UINT16 *src, *dst; counter = frame; - frame = video_screen_get_frame_number(0); + frame = video_screen_get_frame_number(Machine->primary_screen); if (limiter && counter == frame) return; // make sure we only do DMA transfer once per frame K053247_export_config(&dst, 0, 0, 0, &counter); diff --git a/src/mame/includes/spacefb.h b/src/mame/includes/spacefb.h index 2b0a9688ee1..1ff86172168 100644 --- a/src/mame/includes/spacefb.h +++ b/src/mame/includes/spacefb.h @@ -34,7 +34,6 @@ READ8_HANDLER( spacefb_audio_t1_r ); WRITE8_HANDLER( spacefb_port_1_w ); - /*----------- defined in video/spacefb.c -----------*/ extern UINT8 *spacefb_videoram; @@ -43,12 +42,5 @@ extern size_t spacefb_videoram_size; VIDEO_START( spacefb ); VIDEO_UPDATE( spacefb ); -void spacefb_set_flip_screen(UINT8 data); -void spacefb_set_gfx_bank(UINT8 data); -void spacefb_set_palette_bank(UINT8 data); -void spacefb_set_background_red(UINT8 data); -void spacefb_set_background_blue(UINT8 data); -void spacefb_set_disable_star_field(UINT8 data); -void spacefb_set_color_contrast_r(UINT8 data); -void spacefb_set_color_contrast_g(UINT8 data); -void spacefb_set_color_contrast_b(UINT8 data); +WRITE8_HANDLER( spacefb_port_0_w ); +WRITE8_HANDLER( spacefb_port_2_w ); diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index 1040082d3c6..e69413fd980 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -353,7 +353,7 @@ MACHINE_RESET( amiga ) (*amiga_intf->reset_callback)(); /* start the scanline timer */ - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, scanline_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, scanline_callback); } @@ -389,14 +389,14 @@ static TIMER_CALLBACK( scanline_callback ) if (scanline < machine->screen[0].visarea.min_y) amiga_render_scanline(machine, NULL, scanline); else - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); /* force a sound update */ amiga_audio_update(); /* set timer for next line */ scanline = (scanline + 1) % machine->screen[0].height; - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, scanline_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, scanline_callback); } diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c index 80fd9b9b5a9..b50923ba0d5 100644 --- a/src/mame/machine/atarigen.c +++ b/src/mame/machine/atarigen.c @@ -171,7 +171,7 @@ void atarigen_update_interrupts(void) void atarigen_scanline_int_set(int scrnum, int scanline) { - timer_adjust_oneshot(scanline_interrupt_timer, video_screen_get_time_until_pos(scrnum, scanline, 0), scrnum); + timer_adjust_oneshot(scanline_interrupt_timer, video_screen_get_time_until_pos_scrnum(scrnum, scanline, 0), scrnum); } @@ -275,7 +275,7 @@ static TIMER_CALLBACK( scanline_interrupt_callback ) 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(param), param); + timer_adjust_oneshot(scanline_interrupt_timer, video_screen_get_frame_period_scrnum(param), param); } @@ -853,7 +853,7 @@ 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, 0, 0), (scrnum << 16) | 0); + timer_adjust_oneshot(scanline_timer[scrnum], video_screen_get_time_until_pos_scrnum(scrnum, 0, 0), (scrnum << 16) | 0); } @@ -876,7 +876,7 @@ static TIMER_CALLBACK( scanline_timer_callback ) scanline += scanlines_per_callback; if (scanline >= machine->screen[scrnum].height) scanline = 0; - timer_adjust_oneshot(scanline_timer[scrnum], video_screen_get_time_until_pos(scrnum, scanline, 0), (scrnum << 16) | scanline); + timer_adjust_oneshot(scanline_timer[scrnum], video_screen_get_time_until_pos_scrnum(scrnum, scanline, 0), (scrnum << 16) | scanline); } } @@ -913,7 +913,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, 0, 0), scrnum); + timer_adjust_oneshot(atarivc_eof_update_timer[scrnum], video_screen_get_time_until_pos_scrnum(scrnum, 0, 0), scrnum); /* use this for debugging the video controller values */ #if 0 @@ -954,7 +954,7 @@ void atarivc_reset(int scrnum, UINT16 *eof_data, int playfields) /* 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, 0, 0), scrnum); + timer_adjust_oneshot(atarivc_eof_update_timer[scrnum], video_screen_get_time_until_pos_scrnum(scrnum, 0, 0), scrnum); } @@ -1013,7 +1013,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, video_screen_get_vpos(scrnum)); + video_screen_update_partial_scrnum(scrnum, video_screen_get_vpos_scrnum(scrnum)); atarivc_state.palette_bank = ((newword & 0x0400) >> 10) ^ 1; } break; @@ -1095,7 +1095,7 @@ READ16_HANDLER( atarivc_r ) /* also sets bit 0x4000 if we're in VBLANK */ if (offset == 0) { - int result = video_screen_get_vpos(0); /* need to support scrum */ + int result = video_screen_get_vpos(machine->primary_screen); /* need to support scrum */ if (result > 255) result = 255; @@ -1289,7 +1289,7 @@ WRITE16_HANDLER( atarigen_playfield2_latched_msb_w ) int atarigen_get_hblank(running_machine *machine, int scrnum) { - return (video_screen_get_hpos(scrnum) > (machine->screen[scrnum].width * 9 / 10)); + return (video_screen_get_hpos_scrnum(scrnum) > (machine->screen[scrnum].width * 9 / 10)); } @@ -1301,7 +1301,7 @@ int atarigen_get_hblank(running_machine *machine, int scrnum) WRITE16_HANDLER( atarigen_halt_until_hblank_0_w ) { /* halt the CPU until the next HBLANK */ - int hpos = video_screen_get_hpos(0); /* need to support scrnum */ + int hpos = video_screen_get_hpos(machine->primary_screen); /* need to support scrnum */ int hblank = Machine->screen[0].width * 9 / 10; double fraction; @@ -1311,7 +1311,7 @@ WRITE16_HANDLER( atarigen_halt_until_hblank_0_w ) /* halt and set a timer to wake up */ fraction = (double)(hblank - hpos) / (double)Machine->screen[0].width; - timer_set(double_to_attotime(attotime_to_double(video_screen_get_scan_period(0)) * fraction), NULL, 0, unhalt_cpu); + 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); } diff --git a/src/mame/machine/balsente.c b/src/mame/machine/balsente.c index 75b7d626c0d..aa9f5359eab 100644 --- a/src/mame/machine/balsente.c +++ b/src/mame/machine/balsente.c @@ -111,15 +111,15 @@ static TIMER_CALLBACK( interrupt_timer ) { /* next interrupt after scanline 256 is scanline 64 */ if (param == 256) - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 64, 0), 64); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), 64); else - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, param + 64, 0), param + 64); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, param + 64, 0), param + 64); /* IRQ starts on scanline 0, 64, 128, etc. */ cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, ASSERT_LINE); /* it will turn off on the next HBLANK */ - timer_set(video_screen_get_time_until_pos(0, param, BALSENTE_HBSTART), NULL, 0, irq_off); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, param, BALSENTE_HBSTART), NULL, 0, irq_off); /* if this is Grudge Match, update the steering */ if (grudge_steering_result & 0x80) @@ -192,7 +192,7 @@ MACHINE_RESET( balsente ) /* start a timer to generate interrupts */ scanline_timer = timer_alloc(interrupt_timer, NULL); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); /* register for saving */ for (i = 0; i < 3; i++) @@ -1204,7 +1204,7 @@ static void update_grudge_steering(void) READ8_HANDLER( grudge_steering_r ) { - logerror("%04X:grudge_steering_r(@%d)\n", activecpu_get_pc(), video_screen_get_vpos(0)); + logerror("%04X:grudge_steering_r(@%d)\n", activecpu_get_pc(), video_screen_get_vpos(machine->primary_screen)); grudge_steering_result |= 0x80; return grudge_steering_result; } diff --git a/src/mame/machine/galaxian.c b/src/mame/machine/galaxian.c index f19ea83f87b..411490fed17 100644 --- a/src/mame/machine/galaxian.c +++ b/src/mame/machine/galaxian.c @@ -64,13 +64,13 @@ static TIMER_CALLBACK( interrupt_timer ) param = (param + 0x10) & 0xff; - timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(0, param, 0), param); + timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(machine->primary_screen, param, 0), param); TTL7474_update(0); } -static void machine_reset_common( int line ) +static void machine_reset_common(running_machine *machine, int line) { irq_line = line; @@ -86,17 +86,17 @@ static void machine_reset_common( int line ) /* start a timer to generate interrupts */ int_timer = timer_alloc(interrupt_timer, NULL); - timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } MACHINE_RESET( galaxian ) { - machine_reset_common(INPUT_LINE_NMI); + machine_reset_common(machine, INPUT_LINE_NMI); } MACHINE_RESET( devilfsg ) { - machine_reset_common(0); + machine_reset_common(machine, 0); } diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index e3ecf4db0c7..530c7917474 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -738,7 +738,7 @@ WRITE16_HANDLER( hdgsp_io_w ) /* detect changes to HEBLNK and HSBLNK and force an update before they change */ if ((offset == REG_HEBLNK || offset == REG_HSBLNK) && data != tms34010_io_register_r(machine, offset, 0)) - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); tms34010_io_register_w(machine, offset, data, mem_mask); } diff --git a/src/mame/machine/irobot.c b/src/mame/machine/irobot.c index 1f8f25ef38b..a9eef3f8a05 100644 --- a/src/mame/machine/irobot.c +++ b/src/mame/machine/irobot.c @@ -5,8 +5,8 @@ ***************************************************************************/ #include "driver.h" -#include "profiler.h" #include "deprecat.h" +#include "profiler.h" #include "cpu/m6809/m6809.h" #include "irobot.h" @@ -27,7 +27,7 @@ #define IR_CPU_STATE \ logerror(\ - "pc: %4x, scanline: %d\n", activecpu_get_previouspc(), video_screen_get_vpos(0)) + "pc: %4x, scanline: %d\n", activecpu_get_previouspc(), video_screen_get_vpos(Machine->primary_screen)) UINT8 irobot_vg_clear; @@ -186,7 +186,7 @@ static TIMER_CALLBACK( scanline_callback ) /* set a callback for the next 32-scanline increment */ scanline += 32; if (scanline >= 256) scanline = 0; - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, scanline_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, scanline_callback); } static TIMER_CALLBACK( irmb_done_callback ); @@ -207,7 +207,7 @@ MACHINE_RESET( irobot ) irmb_timer = timer_alloc(irmb_done_callback, NULL); /* set an initial timer to go off on scanline 0 */ - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, scanline_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, scanline_callback); irobot_rom_banksel_w(machine,0,0); irobot_out0_w(machine,0,0); diff --git a/src/mame/machine/leland.c b/src/mame/machine/leland.c index c7fbaf4dbb4..cfec1cde6a8 100644 --- a/src/mame/machine/leland.c +++ b/src/mame/machine/leland.c @@ -368,7 +368,7 @@ MACHINE_START( leland ) MACHINE_RESET( leland ) { - timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(0, 8, 0), 8); + timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(machine->primary_screen, 8, 0), 8); /* reset globals */ leland_gfx_control = 0x00; @@ -422,7 +422,7 @@ MACHINE_START( ataxx ) MACHINE_RESET( ataxx ) { memset(extra_tram, 0, ATAXX_EXTRA_TRAM_SIZE); - timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(0, 8, 0), 8); + timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(machine->primary_screen, 8, 0), 8); /* initialize the XROM */ xrom_length = memory_region_length(REGION_USER1); @@ -474,7 +474,7 @@ static TIMER_CALLBACK( leland_interrupt_callback ) scanline += 16; if (scanline > 248) scanline = 8; - timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -486,7 +486,7 @@ static TIMER_CALLBACK( ataxx_interrupt_callback ) cpunum_set_input_line(machine, 0, 0, HOLD_LINE); /* set a timer for the next one */ - timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -1271,7 +1271,7 @@ WRITE8_HANDLER( ataxx_master_output_w ) break; case 0x08: /* */ - timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(0, data + 1, 0), data + 1); + timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(machine->primary_screen, data + 1, 0), data + 1); break; default: @@ -1456,7 +1456,7 @@ WRITE8_HANDLER( ataxx_slave_banksw_w ) READ8_HANDLER( leland_raster_r ) { - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); } diff --git a/src/mame/machine/mcr.c b/src/mame/machine/mcr.c index f7c2400b09a..ed2b71036ef 100644 --- a/src/mame/machine/mcr.c +++ b/src/mame/machine/mcr.c @@ -500,7 +500,7 @@ static TIMER_CALLBACK( mcr68_493_callback ) { v493_irq_state = 1; update_mcr68_interrupts(); - timer_set(video_screen_get_scan_period(0), NULL, 0, mcr68_493_off_callback); + timer_set(video_screen_get_scan_period(machine->primary_screen), NULL, 0, mcr68_493_off_callback); logerror("--- (INT1) ---\n"); } @@ -621,7 +621,7 @@ static TIMER_CALLBACK( zwackery_493_off_callback ) static TIMER_CALLBACK( zwackery_493_callback ) { pia_2_ca1_w(machine, 0, 1); - timer_set(video_screen_get_scan_period(0), NULL, 0, zwackery_493_off_callback); + timer_set(video_screen_get_scan_period(machine->primary_screen), NULL, 0, zwackery_493_off_callback); } diff --git a/src/mame/machine/mw8080bw.c b/src/mame/machine/mw8080bw.c index 156525c84e6..3b3bbbbc6a2 100644 --- a/src/mame/machine/mw8080bw.c +++ b/src/mame/machine/mw8080bw.c @@ -63,7 +63,7 @@ static TIMER_CALLBACK( mw8080bw_interrupt_callback ) int next_vblank; /* compute vector and set the interrupt line */ - int vpos = video_screen_get_vpos(0); + int vpos = video_screen_get_vpos(machine->primary_screen); UINT8 counter = vpos_to_vysnc_chain_counter(vpos); UINT8 vector = 0xc7 | ((counter & 0x40) >> 2) | ((~counter & 0x40) >> 3); cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, vector); @@ -81,7 +81,7 @@ static TIMER_CALLBACK( mw8080bw_interrupt_callback ) } next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_vblank); - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, next_vpos, 0), 0); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, next_vpos, 0), 0); } @@ -91,10 +91,10 @@ static void mw8080bw_create_interrupt_timer(void) } -static void mw8080bw_start_interrupt_timer(void) +static void mw8080bw_start_interrupt_timer(running_machine *machine) { int vpos = vysnc_chain_counter_to_vpos(MW8080BW_INT_TRIGGER_COUNT_1, MW8080BW_INT_TRIGGER_VBLANK_1); - timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(0, vpos, 0), 0); + timer_adjust_oneshot(interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, vpos, 0), 0); } @@ -121,5 +121,5 @@ MACHINE_START( mw8080bw ) MACHINE_RESET( mw8080bw ) { - mw8080bw_start_interrupt_timer(); + mw8080bw_start_interrupt_timer(machine); } diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c index dc8194e09ce..23c7f82eb0a 100644 --- a/src/mame/machine/n64.c +++ b/src/mame/machine/n64.c @@ -586,7 +586,7 @@ READ32_HANDLER( n64_vi_reg_r ) return n64_vi_intr; case 0x10/4: // VI_CURRENT_REG - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); case 0x14/4: // VI_BURST_REG return n64_vi_burst; @@ -632,7 +632,7 @@ WRITE32_HANDLER( n64_vi_reg_w ) screen_state *state = &Machine->screen[0]; rectangle visarea = state->visarea; visarea.max_y = (data & 0x40) ? 479 : 239; - video_screen_configure(0, state->width, visarea.max_y + 1, &visarea, video_screen_get_frame_period(0).attoseconds); + video_screen_configure(machine->primary_screen, state->width, visarea.max_y + 1, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); } n64_vi_control = data; break; @@ -647,7 +647,7 @@ WRITE32_HANDLER( n64_vi_reg_w ) screen_state *state = &Machine->screen[0]; rectangle visarea = state->visarea; visarea.max_x = data-1; - video_screen_configure(0, visarea.max_x + 1, state->height, &visarea, video_screen_get_frame_period(0).attoseconds); + video_screen_configure(machine->primary_screen, visarea.max_x + 1, state->height, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); } n64_vi_width = data; fb_width = data; diff --git a/src/mame/machine/namcoio.c b/src/mame/machine/namcoio.c index 675c78a022e..15618c9b15b 100644 --- a/src/mame/machine/namcoio.c +++ b/src/mame/machine/namcoio.c @@ -351,7 +351,7 @@ static UINT8 namcoio_51XX_read(running_machine *machine, int chip) if (io[chip].mode == 1) { - int on = (video_screen_get_frame_number(0) & 0x10) >> 4; + int on = (video_screen_get_frame_number(machine->primary_screen) & 0x10) >> 4; if (io[chip].credits >= 2) WRITE_PORT(machine,0,0x0c | 3*on); // lamps diff --git a/src/mame/machine/namcos2.c b/src/mame/machine/namcos2.c index 309d8e85b3c..a3f48b282e4 100644 --- a/src/mame/machine/namcos2.c +++ b/src/mame/machine/namcos2.c @@ -652,7 +652,7 @@ READ16_HANDLER( namcos2_68k_gpu_C148_r ) static TIMER_CALLBACK( namcos2_68k_master_posirq ) { - video_screen_update_partial(0, param); + video_screen_update_partial(machine->primary_screen, param); cpunum_set_input_line(machine, CPU_MASTER , namcos2_68k_master_C148[NAMCOS2_C148_POSIRQ] , ASSERT_LINE); } @@ -668,14 +668,14 @@ INTERRUPT_GEN( namcos2_68k_master_vblank ) if( IsSystem21()==0 && namcos2_68k_master_C148[NAMCOS2_C148_POSIRQ] ) { int scanline = GetPosIRQScanline(); - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, namcos2_68k_master_posirq ); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, namcos2_68k_master_posirq ); } cpunum_set_input_line(machine, CPU_MASTER, namcos2_68k_master_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE); } static TIMER_CALLBACK( namcos2_68k_slave_posirq ) { - video_screen_update_partial(0, param); + video_screen_update_partial(machine->primary_screen, param); cpunum_set_input_line(machine, CPU_SLAVE , namcos2_68k_slave_C148[NAMCOS2_C148_POSIRQ] , ASSERT_LINE); } @@ -684,7 +684,7 @@ INTERRUPT_GEN( namcos2_68k_slave_vblank ) if( IsSystem21()==0 && namcos2_68k_slave_C148[NAMCOS2_C148_POSIRQ] ) { int scanline = GetPosIRQScanline(); - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, namcos2_68k_slave_posirq ); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, namcos2_68k_slave_posirq ); } cpunum_set_input_line(machine, CPU_SLAVE, namcos2_68k_slave_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE); } @@ -692,7 +692,7 @@ INTERRUPT_GEN( namcos2_68k_slave_vblank ) static TIMER_CALLBACK( namcos2_68k_gpu_posirq ) { //printf( "namcos2_68k_gpu_posirq(%d)\n", param ); - video_screen_update_partial(0, param); + video_screen_update_partial(machine->primary_screen, param); cpunum_set_input_line(machine, CPU_GPU, namcos2_68k_gpu_C148[NAMCOS2_C148_POSIRQ] , ASSERT_LINE); } @@ -702,7 +702,7 @@ INTERRUPT_GEN( namcos2_68k_gpu_vblank ) if( namcos2_68k_gpu_C148[NAMCOS2_C148_POSIRQ] ) { int scanline = 0x50+0x89; /* HACK for Winning Run */ - timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, namcos2_68k_gpu_posirq ); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, namcos2_68k_gpu_posirq ); } cpunum_set_input_line(machine, CPU_GPU, namcos2_68k_gpu_C148[NAMCOS2_C148_VBLANKIRQ], HOLD_LINE); } diff --git a/src/mame/machine/playch10.c b/src/mame/machine/playch10.c index 6464946b2da..757d6b03625 100644 --- a/src/mame/machine/playch10.c +++ b/src/mame/machine/playch10.c @@ -49,7 +49,7 @@ MACHINE_RESET( pc10 ) RP5H01_enable_w( 0, 1 ); /* reset the ppu */ - ppu2c0x_reset( 0, /* video_screen_get_scan_period(0) * */ 1 ); + ppu2c0x_reset( 0, /* video_screen_get_scan_period(machine->primary_screen) * */ 1 ); ppu2c0x_set_mirroring( 0, mirroring ); } @@ -113,7 +113,7 @@ WRITE8_HANDLER( pc10_GAMESTOP_w ) WRITE8_HANDLER( pc10_PPURES_w ) { if ( data & 1 ) - ppu2c0x_reset( 0, /* video_screen_get_scan_period(0) * */ 1 ); + ppu2c0x_reset( 0, /* video_screen_get_scan_period(machine->primary_screen) * */ 1 ); } READ8_HANDLER( pc10_detectclr_r ) diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 6f34db95c97..ed0326ebe11 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -61,14 +61,11 @@ static struct UINT8 oldrol; } joypad[4]; -// quick extern to fix missing header -extern attotime video_screen_get_time_until_pos(int scrnum, int vpos, int hpos); - // utility function - latches the H/V counters. Used by IRQ, writes to WRIO, etc. static void snes_latch_counters(void) { - snes_ppu.beam.current_horz = video_screen_get_hpos(0) / snes_htmult; - snes_ppu.beam.latch_vert = video_screen_get_vpos(0); + snes_ppu.beam.current_horz = video_screen_get_hpos(Machine->primary_screen) / snes_htmult; + snes_ppu.beam.latch_vert = video_screen_get_vpos(Machine->primary_screen); snes_ppu.beam.latch_horz = snes_ppu.beam.current_horz; snes_ram[STAT78] |= 0x40; // indicate we latched read_ophct = read_opvct = 0; // clear read flags @@ -108,7 +105,7 @@ static TIMER_CALLBACK( snes_scanline_tick ) cpuintrf_push_context(0); /* Increase current line - we want to latch on this line during it, not after it */ - snes_ppu.beam.current_vert = video_screen_get_vpos(0); + snes_ppu.beam.current_vert = video_screen_get_vpos(machine->primary_screen); // not in hblank snes_ram[HVBJOY] &= ~0x40; @@ -148,7 +145,7 @@ static TIMER_CALLBACK( snes_scanline_tick ) } else { - timer_adjust_oneshot(snes_hirq_timer, video_screen_get_time_until_pos(0, snes_ppu.beam.current_vert, pixel*snes_htmult), 0); + timer_adjust_oneshot(snes_hirq_timer, video_screen_get_time_until_pos(machine->primary_screen, snes_ppu.beam.current_vert, pixel*snes_htmult), 0); } } } @@ -230,7 +227,7 @@ static TIMER_CALLBACK( snes_scanline_tick ) cpuintrf_pop_context(); timer_adjust_oneshot(snes_scanline_timer, attotime_never, 0); - timer_adjust_oneshot(snes_hblank_timer, video_screen_get_time_until_pos(0, snes_ppu.beam.current_vert, hblank_offset*snes_htmult), 0); + timer_adjust_oneshot(snes_hblank_timer, video_screen_get_time_until_pos(machine->primary_screen, snes_ppu.beam.current_vert, hblank_offset*snes_htmult), 0); } /* This is called at the start of hblank *before* the scanline indicated in current_vert! */ @@ -238,7 +235,7 @@ static TIMER_CALLBACK( snes_hblank_tick ) { int nextscan; - snes_ppu.beam.current_vert = video_screen_get_vpos(0); + snes_ppu.beam.current_vert = video_screen_get_vpos(machine->primary_screen); /* make sure we halt */ timer_adjust_oneshot(snes_hblank_timer, attotime_never, 0); @@ -249,15 +246,13 @@ static TIMER_CALLBACK( snes_hblank_tick ) /* draw a scanline */ if (snes_ppu.beam.current_vert <= snes_ppu.beam.last_visible_line) { - if (video_screen_get_vpos(0) > 0) + if (video_screen_get_vpos(machine->primary_screen) > 0) { /* Do HDMA */ if( snes_ram[HDMAEN] ) - { snes_hdma(); - } - video_screen_update_partial(0, snes_ppu.beam.current_vert-1); + video_screen_update_partial(machine->primary_screen, snes_ppu.beam.current_vert-1); } } @@ -273,7 +268,7 @@ static TIMER_CALLBACK( snes_hblank_tick ) nextscan = 0; } - timer_adjust_oneshot(snes_scanline_timer, video_screen_get_time_until_pos(0, nextscan, 0), 0); + timer_adjust_oneshot(snes_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, nextscan, 0), 0); } static void snes_init_ram(running_machine *machine) @@ -330,13 +325,13 @@ static void snes_init_ram(running_machine *machine) // SNES hcounter has a 0-339 range. hblank starts at counter 260. // clayfighter sets an HIRQ at 260, apparently it wants it to be before hdma kicks off, so we'll delay 2 pixels. hblank_offset = 268; - timer_adjust_oneshot(snes_hblank_timer, video_screen_get_time_until_pos(0, ((snes_ram[STAT78] & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC-1 : SNES_VTOTAL_PAL-1, hblank_offset), 0); + timer_adjust_oneshot(snes_hblank_timer, video_screen_get_time_until_pos(machine->primary_screen, ((snes_ram[STAT78] & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC-1 : SNES_VTOTAL_PAL-1, hblank_offset), 0); // check if DSP1 is present (maybe not 100%?) has_dsp1 = ((snes_r_bank1(machine,0xffd6) >= 3) && (snes_r_bank1(machine,0xffd6) <= 5)) ? 1 : 0; // init frame counter so first line is 0 - if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds) >= 59 ) + if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) >= 59 ) { snes_ppu.beam.current_vert = SNES_VTOTAL_NTSC; } @@ -379,9 +374,9 @@ MACHINE_RESET( snes ) snes_init_ram(machine); /* Set STAT78 to NTSC or PAL */ - if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds) >= 59.0f ) + if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) >= 59.0f ) snes_ram[STAT78] = SNES_NTSC; - else /* if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds) == 50.0f ) */ + else /* if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) == 50.0f ) */ snes_ram[STAT78] = SNES_PAL; // reset does this to these registers @@ -910,7 +905,7 @@ READ8_HANDLER( snes_r_io ) return value; case HVBJOY: /* H/V blank and joypad controller enable */ // electronics test says hcounter 272 is start of hblank, which is beampos 363 -// if (video_screen_get_hpos(0) >= 363) snes_ram[offset] |= 0x40; +// if (video_screen_get_hpos(machine->primary_screen) >= 363) snes_ram[offset] |= 0x40; // else snes_ram[offset] &= ~0x40; return snes_ram[offset]; case RDIO: /* Programmable I/O port - echos back what's written to WRIO */ @@ -1109,13 +1104,9 @@ WRITE8_HANDLER( snes_w_io ) } if ((snes_ram[STAT78] & 0x10) == SNES_NTSC) - { - video_screen_configure(0, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_NTSC, &visarea, video_screen_get_frame_period(0).attoseconds); - } + video_screen_configure(machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_NTSC, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); else - { - video_screen_configure(0, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_PAL, &visarea, video_screen_get_frame_period(0).attoseconds); - } + video_screen_configure(machine->primary_screen, SNES_HTOTAL*snes_htmult, SNES_VTOTAL_PAL, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); } snes_ppu.layer[0].tile_size = (data >> 4) & 0x1; diff --git a/src/mame/machine/tx1.c b/src/mame/machine/tx1.c index f3cf262470a..71e2457bccf 100644 --- a/src/mame/machine/tx1.c +++ b/src/mame/machine/tx1.c @@ -65,7 +65,7 @@ INLINE UINT8 reverse_nibble(UINT8 nibble) static TIMER_CALLBACK( interrupt_callback ) { cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xff); - timer_set(video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback); } /* @@ -1478,7 +1478,7 @@ MACHINE_START( tx1 ) prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1); /* /CUDISP CRTC interrupt */ - timer_set(video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback); } MACHINE_START( buggyboy ) @@ -1489,7 +1489,7 @@ MACHINE_START( buggyboy ) prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1); /* /CUDISP CRTC interrupt */ - timer_set(video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback); } MACHINE_START( buggybjr ) @@ -1498,5 +1498,5 @@ MACHINE_START( buggybjr ) prom = (UINT16*)memory_region(REGION_USER1) + (0x8000 >> 1); /* /CUDISP CRTC interrupt */ - timer_set(video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), NULL, 0, interrupt_callback); } diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c index 17838deed5f..2f5379446fb 100644 --- a/src/mame/machine/williams.c +++ b/src/mame/machine/williams.c @@ -273,7 +273,7 @@ static TIMER_CALLBACK( williams_va11_callback ) /* set a timer for the next update */ scanline += 0x20; if (scanline >= 256) scanline = 0; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -290,10 +290,10 @@ static TIMER_CALLBACK( williams_count240_callback ) pia_1_ca1_w(machine, 0, 1); /* set a timer to turn it off once the scanline counter resets */ - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, williams_count240_off_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, williams_count240_off_callback); /* set a timer for next frame */ - timer_adjust_oneshot(scan240_timer, video_screen_get_time_until_pos(0, 240, 0), 0); + timer_adjust_oneshot(scan240_timer, video_screen_get_time_until_pos(machine->primary_screen, 240, 0), 0); } @@ -354,7 +354,7 @@ static void tshoot_main_irq(int state) * *************************************/ -static void williams_common_init(void) +static MACHINE_RESET( williams_common ) { /* reset the PIAs */ pia_reset(); @@ -364,11 +364,11 @@ static void williams_common_init(void) /* set a timer to go off every 16 scanlines, to toggle the VA11 line and update the screen */ scanline_timer = timer_alloc(williams_va11_callback, NULL); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); /* also set a timer to go off on scanline 240 */ scan240_timer = timer_alloc(williams_count240_callback, NULL); - timer_adjust_oneshot(scan240_timer, video_screen_get_time_until_pos(0, 240, 0), 0); + timer_adjust_oneshot(scan240_timer, video_screen_get_time_until_pos(machine->primary_screen, 240, 0), 0); state_save_register_global(vram_bank); } @@ -376,7 +376,7 @@ static void williams_common_init(void) MACHINE_RESET( williams ) { - williams_common_init(); + MACHINE_RESET_CALL(williams_common); /* configure the memory bank */ memory_configure_bank(1, 0, 1, williams_videoram, 0); @@ -402,7 +402,7 @@ static TIMER_CALLBACK( williams2_va11_callback ) /* set a timer for the next update */ scanline += 0x20; if (scanline >= 256) scanline = 0; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -419,10 +419,10 @@ static TIMER_CALLBACK( williams2_endscreen_callback ) pia_0_ca1_w(machine, 0, 0); /* set a timer to turn it off once the scanline counter resets */ - timer_set(video_screen_get_time_until_pos(0, 8, 0), NULL, 0, williams2_endscreen_off_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 8, 0), NULL, 0, williams2_endscreen_off_callback); /* set a timer for next frame */ - timer_adjust_oneshot(scan254_timer, video_screen_get_time_until_pos(0, 254, 0), 0); + timer_adjust_oneshot(scan254_timer, video_screen_get_time_until_pos(machine->primary_screen, 254, 0), 0); } @@ -453,11 +453,11 @@ MACHINE_RESET( williams2 ) /* set a timer to go off every 16 scanlines, to toggle the VA11 line and update the screen */ scanline_timer = timer_alloc(williams2_va11_callback, NULL); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); /* also set a timer to go off on scanline 254 */ scan254_timer = timer_alloc(williams2_endscreen_callback, NULL); - timer_adjust_oneshot(scan254_timer, video_screen_get_time_until_pos(0, 254, 0), 0); + timer_adjust_oneshot(scan254_timer, video_screen_get_time_until_pos(machine->primary_screen, 254, 0), 0); state_save_register_global(vram_bank); state_save_register_func_postload(williams2_postload); @@ -719,7 +719,7 @@ static void defender_postload(void) MACHINE_RESET( defender ) { - williams_common_init(); + MACHINE_RESET_CALL(williams_common); /* configure the banking and make sure it is reset to 0 */ memory_configure_bank(1, 0, 9, &memory_region(REGION_CPU1)[0x10000], 0x1000); @@ -815,7 +815,7 @@ WRITE8_HANDLER( sinistar_vram_select_w ) MACHINE_RESET( blaster ) { - williams_common_init(); + MACHINE_RESET_CALL(williams_common); /* banking is different for blaster */ memory_configure_bank(1, 0, 1, williams_videoram, 0); diff --git a/src/mame/video/actfancr.c b/src/mame/video/actfancr.c index 7ae638d0f6a..2f922b3d936 100644 --- a/src/mame/video/actfancr.c +++ b/src/mame/video/actfancr.c @@ -174,7 +174,7 @@ VIDEO_UPDATE( actfancr ) x = buffered_spriteram[offs+4]+(buffered_spriteram[offs+5]<<8); colour = ((x & 0xf000) >> 12); flash=x&0x800; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(screen) & 1)) continue; fx = y & 0x2000; fy = y & 0x4000; @@ -259,7 +259,7 @@ VIDEO_UPDATE( triothep ) x = buffered_spriteram[offs+4]+(buffered_spriteram[offs+5]<<8); colour = ((x & 0xf000) >> 12); flash=x&0x800; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(screen) & 1)) continue; fx = y & 0x2000; fy = y & 0x4000; diff --git a/src/mame/video/amiga.c b/src/mame/video/amiga.c index 5ade3035c96..c3275531777 100644 --- a/src/mame/video/amiga.c +++ b/src/mame/video/amiga.c @@ -7,6 +7,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "includes/amiga.h" @@ -167,7 +168,7 @@ VIDEO_START( amiga ) UINT32 amiga_gethvpos(void) { - UINT32 hvpos = (last_scanline << 8) | (video_screen_get_hpos(0) >> 2); + UINT32 hvpos = (last_scanline << 8) | (video_screen_get_hpos(Machine->primary_screen) >> 2); UINT32 latchedpos = readinputportbytag_safe("HVPOS", 0); /* if there's no latched position, or if we are in the active display area */ @@ -921,7 +922,7 @@ void amiga_render_scanline(running_machine *machine, bitmap_t *bitmap, int scanl } #if 0 - if ( video_screen_get_frame_number(0) % 64 == 0 && scanline == 100 ) + if ( video_screen_get_frame_number(machine->primary_screen) % 64 == 0 && scanline == 100 ) { const char *m_lores = "LORES"; const char *m_hires = "HIRES"; @@ -960,7 +961,7 @@ void amiga_render_scanline(running_machine *machine, bitmap_t *bitmap, int scanl CUSTOM_REG(REG_COLOR00) = save_color0; #if GUESS_COPPER_OFFSET - if (video_screen_get_frame_number(0) % 64 == 0 && scanline == 0) + if (video_screen_get_frame_number(machine->primary_screen) % 64 == 0 && scanline == 0) { if (input_code_pressed(KEYCODE_Q)) popmessage("%d", wait_offset -= 1); diff --git a/src/mame/video/astrocde.c b/src/mame/video/astrocde.c index c44c894fbff..bf79a322555 100644 --- a/src/mame/video/astrocde.c +++ b/src/mame/video/astrocde.c @@ -223,7 +223,7 @@ VIDEO_START( astrocde ) { /* allocate a per-scanline timer */ scanline_timer = timer_alloc(scanline_callback, NULL); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 1, 0), 1); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, 0), 1); /* register for save states */ init_savestate(); @@ -238,7 +238,7 @@ VIDEO_START( profpac ) { /* allocate a per-scanline timer */ scanline_timer = timer_alloc(scanline_callback, NULL); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 1, 0), 1); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, 0), 1); /* allocate videoram */ profpac_videoram = auto_malloc(0x4000 * 4 * sizeof(*profpac_videoram)); @@ -309,7 +309,7 @@ VIDEO_UPDATE( astrocde ) /* compute the starting point of sparkle for the current frame */ if (astrocade_video_config & AC_STARS) - sparklebase = (video_screen_get_frame_number(0) * (UINT64)(screen->machine->screen[0].width * screen->machine->screen[0].height)) % RNG_PERIOD; + sparklebase = (video_screen_get_frame_number(screen) * (UINT64)(screen->machine->screen[0].width * screen->machine->screen[0].height)) % RNG_PERIOD; /* iterate over scanlines */ for (y = cliprect->min_y; y <= cliprect->max_y; y++) @@ -465,7 +465,7 @@ static TIMER_CALLBACK( scanline_callback ) int astrocade_scanline = mame_vpos_to_astrocade_vpos(scanline); /* force an update against the current scanline */ - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); /* generate a scanline interrupt if it's time */ if (astrocade_scanline == interrupt_scanline && (interrupt_enable & 0x08) != 0) @@ -490,7 +490,7 @@ static TIMER_CALLBACK( scanline_callback ) scanline++; if (scanline >= machine->screen[0].height) scanline = 0; - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } diff --git a/src/mame/video/atari.c b/src/mame/video/atari.c index c1b12247401..79a07ffe402 100644 --- a/src/mame/video/atari.c +++ b/src/mame/video/atari.c @@ -1057,12 +1057,12 @@ static void antic_linerefresh(void) static int cycle(void) { - return video_screen_get_hpos(0) * CYCLES_PER_LINE / Machine->screen[0].width; + return video_screen_get_hpos(Machine->primary_screen) * CYCLES_PER_LINE / Machine->screen[0].width; } static void after(int cycles, timer_fired_func function, const char *funcname) { - attotime duration = attotime_make(0, attotime_to_attoseconds(video_screen_get_scan_period(0)) * cycles / CYCLES_PER_LINE); + attotime duration = attotime_make(0, attotime_to_attoseconds(video_screen_get_scan_period(Machine->primary_screen)) * cycles / CYCLES_PER_LINE); (void)funcname; LOG((" after %3d (%5.1f us) %s\n", cycles, attotime_to_double(duration) * 1.0e6, funcname)); timer_set(duration, NULL, 0, function); diff --git a/src/mame/video/atarig1.c b/src/mame/video/atarig1.c index e13fb9ddf77..be9dc4be1f5 100644 --- a/src/mame/video/atarig1.c +++ b/src/mame/video/atarig1.c @@ -147,7 +147,7 @@ VIDEO_START( atarig1 ) WRITE16_HANDLER( atarig1_mo_control_w ) { - logerror("MOCONT = %d (scan = %d)\n", data, video_screen_get_vpos(0)); + logerror("MOCONT = %d (scan = %d)\n", data, video_screen_get_vpos(machine->primary_screen)); /* set the control value */ COMBINE_DATA(¤t_control); @@ -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(0, scanline - 1); + video_screen_update_partial(machine->primary_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(0, scanline + i - 1); + video_screen_update_partial(machine->primary_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(0, scanline + i - 1); + video_screen_update_partial(machine->primary_screen, scanline + i - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll = newscroll; } if (newbank != playfield_tile_bank) { - video_screen_update_partial(0, scanline + i - 1); + video_screen_update_partial(machine->primary_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 f016dbe1261..dbebf89f19e 100644 --- a/src/mame/video/atarig42.c +++ b/src/mame/video/atarig42.c @@ -150,7 +150,7 @@ VIDEO_START( atarig42 ) WRITE16_HANDLER( atarig42_mo_control_w ) { - logerror("MOCONT = %d (scan = %d)\n", data, video_screen_get_vpos(0)); + logerror("MOCONT = %d (scan = %d)\n", data, video_screen_get_vpos(machine->primary_screen)); /* set the control value */ COMBINE_DATA(¤t_control); @@ -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(0, scanline + i - 1); + video_screen_update_partial(machine->primary_screen, scanline + i - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll = newscroll; } if (newbank != playfield_color_bank) { - video_screen_update_partial(0, scanline + i - 1); + video_screen_update_partial(machine->primary_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(0, scanline + i - 1); + video_screen_update_partial(machine->primary_screen, scanline + i - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll = newscroll; } if (newbank != playfield_tile_bank) { - video_screen_update_partial(0, scanline + i - 1); + video_screen_update_partial(machine->primary_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 c1c02f10f88..d7d28a606e5 100644 --- a/src/mame/video/atarigt.c +++ b/src/mame/video/atarigt.c @@ -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(0, scanline + i - 1); + video_screen_update_partial(machine->primary_screen, scanline + i - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll = newscroll; } if (newbank != playfield_color_bank) { - video_screen_update_partial(0, scanline + i - 1); + video_screen_update_partial(machine->primary_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(0, scanline + i - 1); + video_screen_update_partial(machine->primary_screen, scanline + i - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll = newscroll; } if (newbank != playfield_tile_bank) { - video_screen_update_partial(0, scanline + i - 1); + video_screen_update_partial(machine->primary_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 f15de581bd4..4ba32120bd8 100644 --- a/src/mame/video/atarigx2.c +++ b/src/mame/video/atarigx2.c @@ -150,7 +150,7 @@ VIDEO_START( atarigx2 ) WRITE16_HANDLER( atarigx2_mo_control_w ) { - logerror("MOCONT = %d (scan = %d)\n", data, video_screen_get_vpos(0)); + logerror("MOCONT = %d (scan = %d)\n", data, video_screen_get_vpos(machine->primary_screen)); /* set the control value */ COMBINE_DATA(¤t_control); @@ -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(0, scanline + i - 1); + video_screen_update_partial(machine->primary_screen, scanline + i - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll = newscroll; } if (newbank != playfield_color_bank) { - video_screen_update_partial(0, scanline + i - 1); + video_screen_update_partial(machine->primary_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(0, scanline + i - 1); + video_screen_update_partial(machine->primary_screen, scanline + i - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll = newscroll; } if (newbank != playfield_tile_bank) { - video_screen_update_partial(0, scanline + i - 1); + video_screen_update_partial(machine->primary_screen, scanline + i - 1); tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); playfield_tile_bank = newbank; } diff --git a/src/mame/video/atarimo.c b/src/mame/video/atarimo.c index 933c9a1c4ae..a818e793754 100644 --- a/src/mame/video/atarimo.c +++ b/src/mame/video/atarimo.c @@ -318,12 +318,12 @@ static TIMER_CALLBACK( force_update ) int scanline = param; if (scanline > 0) - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); scanline += 64; if (scanline >= machine->screen[0].visarea.max_y) scanline = 0; - timer_adjust_oneshot(force_update_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(force_update_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } /*--------------------------------------------------------------- @@ -445,7 +445,7 @@ void atarimo_init(running_machine *machine, int map, const struct atarimo_desc * /* start a timer to update a few times during refresh */ force_update_timer = timer_alloc(force_update, NULL); - timer_adjust_oneshot(force_update_timer,video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(force_update_timer,video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); init_savestate(map, mo); diff --git a/src/mame/video/atarirle.c b/src/mame/video/atarirle.c index 88f53a724fe..b556f7451d8 100644 --- a/src/mame/video/atarirle.c +++ b/src/mame/video/atarirle.c @@ -382,7 +382,7 @@ void atarirle_init(int map, const atarirle_desc *desc) void atarirle_control_w(int map, UINT8 bits) { atarirle_data *mo = &atarirle[map]; - int scanline = video_screen_get_vpos(0); + int scanline = video_screen_get_vpos(Machine->primary_screen); int oldbits = mo->control_bits; //logerror("atarirle_control_w(%d)\n", bits); @@ -392,7 +392,7 @@ void atarirle_control_w(int map, UINT8 bits) return; /* force a partial update first */ - video_screen_update_partial(0, scanline); + video_screen_update_partial(Machine->primary_screen, scanline); /* if the erase flag was set, erase the front map */ if (oldbits & ATARIRLE_CONTROL_ERASE) diff --git a/src/mame/video/atarisy1.c b/src/mame/video/atarisy1.c index 3ce515e2dd5..cb51bbe8519 100644 --- a/src/mame/video/atarisy1.c +++ b/src/mame/video/atarisy1.c @@ -106,7 +106,7 @@ static const gfx_layout objlayout_6bpp = * *************************************/ -static void update_timers(int scanline); +static void update_timers(running_machine *machine, int scanline); static void decode_gfx(running_machine *machine, UINT16 *pflookup, UINT16 *molookup); static int get_bank(running_machine *machine, UINT8 prom1, UINT8 prom2, int bpp); static TIMER_CALLBACK( int3_callback ); @@ -240,7 +240,7 @@ WRITE16_HANDLER( atarisy1_bankselect_w ) { UINT16 oldselect = *atarisy1_bankselect; UINT16 newselect = oldselect, diff; - int scanline = video_screen_get_vpos(0); + int scanline = video_screen_get_vpos(machine->primary_screen); /* update memory */ COMBINE_DATA(&newselect); @@ -255,11 +255,11 @@ WRITE16_HANDLER( atarisy1_bankselect_w ) /* if MO or playfield banks change, force a partial update */ if (diff & 0x003c) - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); /* motion object bank select */ atarimo_set_bank(0, (newselect >> 3) & 7); - update_timers(scanline); + update_timers(machine, scanline); /* playfield bank select */ if (diff & 0x0004) @@ -288,7 +288,7 @@ WRITE16_HANDLER( atarisy1_priority_w ) /* force a partial update in case this changes mid-screen */ COMBINE_DATA(&newpens); if (oldpens != newpens) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); playfield_priority_pens = newpens; } @@ -308,7 +308,7 @@ WRITE16_HANDLER( atarisy1_xscroll_w ) /* force a partial update in case this changes mid-screen */ COMBINE_DATA(&newscroll); if (oldscroll != newscroll) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* set the new scroll value */ tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll); @@ -335,12 +335,12 @@ WRITE16_HANDLER( atarisy1_yscroll_w ) { UINT16 oldscroll = *atarigen_yscroll; UINT16 newscroll = oldscroll; - int scanline = video_screen_get_vpos(0); + int scanline = video_screen_get_vpos(machine->primary_screen); int adjusted_scroll; /* force a partial update in case this changes mid-screen */ COMBINE_DATA(&newscroll); - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); /* because this latches a new value into the scroll base, we need to adjust for the scanline */ @@ -351,7 +351,7 @@ WRITE16_HANDLER( atarisy1_yscroll_w ) /* but since we've adjusted it, we must reset it to the normal value once we hit scanline 0 again */ - timer_adjust_oneshot(yscroll_reset_timer, video_screen_get_time_until_pos(0, 0, 0), newscroll); + timer_adjust_oneshot(yscroll_reset_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), newscroll); /* update the data */ *atarigen_yscroll = newscroll; @@ -381,7 +381,7 @@ WRITE16_HANDLER( atarisy1_spriteram_w ) { /* if the timer is in the active bank, update the display list */ atarimo_0_spriteram_w(machine, offset, data, 0); - update_timers(video_screen_get_vpos(0)); + update_timers(machine, video_screen_get_vpos(machine->primary_screen)); } /* if we're about to modify data in the active sprite bank, make sure the video is up-to-date */ @@ -389,7 +389,7 @@ WRITE16_HANDLER( atarisy1_spriteram_w ) /* renders the next scanline's sprites to the line buffers, but Road Runner still glitches */ /* without the extra +1 */ else - video_screen_update_partial(0, video_screen_get_vpos(0) + 2); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) + 2); } /* let the MO handler do the basic work */ @@ -419,11 +419,11 @@ static TIMER_CALLBACK( int3_callback ) atarigen_scanline_int_gen(machine, 0); /* set a timer to turn it off */ - timer_adjust_oneshot(int3off_timer, video_screen_get_scan_period(0), 0); + timer_adjust_oneshot(int3off_timer, video_screen_get_scan_period(machine->primary_screen), 0); /* determine the time of the next one */ next_timer_scanline = -1; - update_timers(scanline); + update_timers(machine, scanline); } @@ -447,7 +447,7 @@ READ16_HANDLER( atarisy1_int3state_r ) * *************************************/ -static void update_timers(int scanline) +static void update_timers(running_machine *machine, int scanline) { UINT16 *base = &atarimo_0_spriteram[atarimo_get_bank(0) * 64 * 4]; int link = 0, best = scanline, found = 0; @@ -498,7 +498,7 @@ static void update_timers(int scanline) /* set a new one */ if (best != -1) - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, best, 0), best); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, best, 0), best); else timer_adjust_oneshot(scanline_timer, attotime_never, 0); } diff --git a/src/mame/video/atarisy2.c b/src/mame/video/atarisy2.c index 6f90aff664c..239a1620d68 100644 --- a/src/mame/video/atarisy2.c +++ b/src/mame/video/atarisy2.c @@ -159,7 +159,7 @@ WRITE16_HANDLER( atarisy2_xscroll_w ) /* if anything has changed, force a partial update */ if (newscroll != oldscroll) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* update the playfield scrolling - hscroll is clocked on the following scanline */ tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll >> 6); @@ -190,13 +190,13 @@ WRITE16_HANDLER( atarisy2_yscroll_w ) /* if anything has changed, force a partial update */ if (newscroll != oldscroll) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* if bit 4 is zero, the scroll value is clocked in right away */ if (!(newscroll & 0x10)) - tilemap_set_scrolly(atarigen_playfield_tilemap, 0, (newscroll >> 6) - video_screen_get_vpos(0)); + tilemap_set_scrolly(atarigen_playfield_tilemap, 0, (newscroll >> 6) - video_screen_get_vpos(machine->primary_screen)); else - timer_adjust_oneshot(yscroll_reset_timer, video_screen_get_time_until_pos(0, 0, 0), newscroll >> 6); + timer_adjust_oneshot(yscroll_reset_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), newscroll >> 6); /* update the playfield banking */ if (playfield_tile_bank[1] != (newscroll & 0x0f) * 0x400) @@ -301,7 +301,7 @@ WRITE16_HANDLER( atarisy2_videoram_w ) { /* force an update if the link of object 0 is about to change */ if (offs == 0x0c03) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); atarimo_0_spriteram_w(machine, offs - 0x0c00, data, mem_mask); } diff --git a/src/mame/video/attckufo.c b/src/mame/video/attckufo.c index 609391bee73..42a99a92a4f 100644 --- a/src/mame/video/attckufo.c +++ b/src/mame/video/attckufo.c @@ -85,7 +85,7 @@ WRITE8_HANDLER ( attckufo_port_w ) case 5: case 0xe: case 0xf: - video_screen_update_partial(0, rasterline); + video_screen_update_partial(machine->primary_screen, rasterline); break; } attckufo_regs[offset] = data; diff --git a/src/mame/video/badlands.c b/src/mame/video/badlands.c index f2faac50797..5064fa2e1ac 100644 --- a/src/mame/video/badlands.c +++ b/src/mame/video/badlands.c @@ -101,7 +101,7 @@ WRITE16_HANDLER( badlands_pf_bank_w ) if (ACCESSING_LSB) if (playfield_tile_bank != (data & 1)) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); playfield_tile_bank = data & 1; tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); } diff --git a/src/mame/video/balsente.c b/src/mame/video/balsente.c index f37fb202ea4..aa968ddb530 100644 --- a/src/mame/video/balsente.c +++ b/src/mame/video/balsente.c @@ -82,11 +82,11 @@ WRITE8_HANDLER( balsente_palette_select_w ) if (palettebank_vis != (data & 3)) { /* update the scanline palette */ - video_screen_update_partial(0, video_screen_get_vpos(0) - 1 + BALSENTE_VBEND); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1 + BALSENTE_VBEND); palettebank_vis = data & 3; } - logerror("balsente_palette_select_w(%d) scanline=%d\n", data & 3, video_screen_get_vpos(0)); + logerror("balsente_palette_select_w(%d) scanline=%d\n", data & 3, video_screen_get_vpos(machine->primary_screen)); } @@ -123,7 +123,7 @@ WRITE8_HANDLER( shrike_sprite_select_w ) if( sprite_data != sprite_bank[(data & 0x80 >> 7) ^ 1 ]) { logerror( "shrike_sprite_select_w( 0x%02x )\n", data ); - video_screen_update_partial(0, video_screen_get_vpos(0) - 1 + BALSENTE_VBEND); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1 + BALSENTE_VBEND); sprite_data = sprite_bank[(data & 0x80 >> 7) ^ 1]; } diff --git a/src/mame/video/batman.c b/src/mame/video/batman.c index 355a71a4ac9..0d92242cab7 100644 --- a/src/mame/video/batman.c +++ b/src/mame/video/batman.c @@ -143,13 +143,13 @@ void batman_scanline_update(running_machine *machine, int scrnum, int scanline) switch (data & 15) { case 9: - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(machine->primary_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(0, scanline - 1); + video_screen_update_partial(machine->primary_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(0, scanline - 1); + video_screen_update_partial(machine->primary_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(0, scanline - 1); + video_screen_update_partial(machine->primary_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(0, scanline - 1); + video_screen_update_partial(machine->primary_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(0, scanline - 1); + video_screen_update_partial(machine->primary_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/battlera.c b/src/mame/video/battlera.c index bfdf4d98b32..cd03b838fc7 100644 --- a/src/mame/video/battlera.c +++ b/src/mame/video/battlera.c @@ -391,14 +391,14 @@ INTERRUPT_GEN( battlera_interrupt ) /* If raster interrupt occurs, refresh screen _up_ to this point */ if (rcr_enable && (current_scanline+56)==HuC6270_registers[6]) { - video_screen_update_partial(0, current_scanline); + video_screen_update_partial(machine->primary_screen, current_scanline); cpunum_set_input_line(machine, 0, 0, HOLD_LINE); /* RCR interrupt */ } /* Start of vblank */ else if (current_scanline==240) { bldwolf_vblank=1; - video_screen_update_partial(0, 240); + video_screen_update_partial(machine->primary_screen, 240); if (irq_enable) cpunum_set_input_line(machine, 0, 0, HOLD_LINE); /* VBL */ } diff --git a/src/mame/video/beathead.c b/src/mame/video/beathead.c index d4691a2cadf..652365c51d5 100644 --- a/src/mame/video/beathead.c +++ b/src/mame/video/beathead.c @@ -112,9 +112,9 @@ WRITE32_HANDLER( beathead_finescroll_w ) UINT32 newword = COMBINE_DATA(&finescroll); /* if VBLANK is going off on a scanline other than the last, suspend time */ - if ((oldword & 8) && !(newword & 8) && video_screen_get_vpos(0) != 261) + if ((oldword & 8) && !(newword & 8) && video_screen_get_vpos(machine->primary_screen) != 261) { - logerror("Suspending time! (scanline = %d)\n", video_screen_get_vpos(0)); + logerror("Suspending time! (scanline = %d)\n", video_screen_get_vpos(machine->primary_screen)); cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, ASSERT_LINE); } } diff --git a/src/mame/video/blockade.c b/src/mame/video/blockade.c index 5c3ad65bb83..0039957066c 100644 --- a/src/mame/video/blockade.c +++ b/src/mame/video/blockade.c @@ -10,7 +10,7 @@ WRITE8_HANDLER( blockade_videoram_w ) if (input_port_3_r(machine,0) & 0x80) { - logerror("blockade_videoram_w: scanline %d\n", video_screen_get_vpos(0)); + logerror("blockade_videoram_w: scanline %d\n", video_screen_get_vpos(machine->primary_screen)); cpu_spinuntil_int(); } } diff --git a/src/mame/video/blstroid.c b/src/mame/video/blstroid.c index a95b75b0844..3612e13d8aa 100644 --- a/src/mame/video/blstroid.c +++ b/src/mame/video/blstroid.c @@ -129,8 +129,8 @@ 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, video_screen_get_vpos(scrnum) + 7, machine->screen[scrnum].width * 0.9); - period_off = video_screen_get_time_until_pos(scrnum, video_screen_get_vpos(scrnum) + 8, machine->screen[scrnum].width * 0.9); + 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); timer_set(period_on, NULL, 0, irq_on); timer_set(period_off, NULL, 0, irq_off); diff --git a/src/mame/video/boogwing.c b/src/mame/video/boogwing.c index 53711b39e2a..215583dc8a9 100644 --- a/src/mame/video/boogwing.c +++ b/src/mame/video/boogwing.c @@ -16,7 +16,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram_base[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram_base[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/video/btoads.c b/src/mame/video/btoads.c index f29e25029b5..9bfbf10b7b3 100644 --- a/src/mame/video/btoads.c +++ b/src/mame/video/btoads.c @@ -87,7 +87,7 @@ WRITE16_HANDLER( btoads_display_control_w ) if (ACCESSING_MSB) { /* allow multiple changes during display */ - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); /* bit 15 controls which page is rendered and which page is displayed */ if (data & 0x8000) @@ -117,7 +117,7 @@ WRITE16_HANDLER( btoads_display_control_w ) WRITE16_HANDLER( btoads_scroll0_w ) { /* allow multiple changes during display */ - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); /* upper bits are Y scroll, lower bits are X scroll */ if (ACCESSING_MSB) @@ -130,7 +130,7 @@ WRITE16_HANDLER( btoads_scroll0_w ) WRITE16_HANDLER( btoads_scroll1_w ) { /* allow multiple changes during display */ - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); /* upper bits are Y scroll, lower bits are X scroll */ if (ACCESSING_MSB) diff --git a/src/mame/video/bwing.c b/src/mame/video/bwing.c index 5cc67ac0e57..ede656581bd 100644 --- a/src/mame/video/bwing.c +++ b/src/mame/video/bwing.c @@ -118,7 +118,7 @@ WRITE8_HANDLER( bwing_scrollreg_w ) } #if BW_DEBUG - logerror("(%1d)%04x: w=%02x a=%04x f=%d\n",cpu_getactivecpu(),activecpu_get_pc(),data,0x1b00+offset,video_screen_get_frame_number(0)); + logerror("(%1d)%04x: w=%02x a=%04x f=%d\n",cpu_getactivecpu(),activecpu_get_pc(),data,0x1b00+offset,video_screen_get_frame_number(machine->primary_screen)); #endif break; } diff --git a/src/mame/video/cbuster.c b/src/mame/video/cbuster.c index b9f571d47e4..da10cf690c7 100644 --- a/src/mame/video/cbuster.c +++ b/src/mame/video/cbuster.c @@ -87,7 +87,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta if (x&0x2000) colour+=64; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; fx = y & 0x2000; fy = y & 0x4000; diff --git a/src/mame/video/ccastles.c b/src/mame/video/ccastles.c index 0473b8b3ba2..5dd5af523ae 100644 --- a/src/mame/video/ccastles.c +++ b/src/mame/video/ccastles.c @@ -72,7 +72,7 @@ VIDEO_START( ccastles ) WRITE8_HANDLER( ccastles_hscroll_w ) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); hscroll = data; } diff --git a/src/mame/video/changela.c b/src/mame/video/changela.c index bfbf904f17c..59b77d16d0d 100644 --- a/src/mame/video/changela.c +++ b/src/mame/video/changela.c @@ -48,7 +48,7 @@ VIDEO_START( changela ) tree1_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); changela_scanline_timer = timer_alloc(changela_scanline_callback, NULL); - timer_adjust_oneshot(changela_scanline_timer, video_screen_get_time_until_pos(0, 30, 0), 30); + timer_adjust_oneshot(changela_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 30, 0), 30); state_save_register_global(slopeROM_bank); state_save_register_global(tree_en); @@ -738,7 +738,7 @@ static TIMER_CALLBACK( changela_scanline_callback ) sy++; if(sy > 256) sy = 30; - timer_adjust_oneshot(changela_scanline_timer, video_screen_get_time_until_pos(0, sy, 0), sy); + timer_adjust_oneshot(changela_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, sy, 0), sy); } VIDEO_UPDATE( changela ) diff --git a/src/mame/video/cloak.c b/src/mame/video/cloak.c index d2281493d49..df31a30381e 100644 --- a/src/mame/video/cloak.c +++ b/src/mame/video/cloak.c @@ -103,7 +103,7 @@ static void set_current_bitmap_videoram_pointer(void) WRITE8_HANDLER( cloak_clearbmp_w ) { - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); bitmap_videoram_selected = data & 0x01; set_current_bitmap_videoram_pointer(); diff --git a/src/mame/video/cninja.c b/src/mame/video/cninja.c index 36c2530ae57..889abcb29c5 100644 --- a/src/mame/video/cninja.c +++ b/src/mame/video/cninja.c @@ -173,7 +173,7 @@ static void cninja_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons y = buffered_spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; colour = (x >> 9) &0x1f; fx = y & 0x2000; @@ -241,7 +241,7 @@ static void robocop2_draw_sprites(running_machine *machine, bitmap_t *bitmap, co y = buffered_spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; colour = (x >> 9) &0x1f; fx = y & 0x2000; @@ -339,7 +339,7 @@ static void mutantf_draw_sprites(running_machine *machine, bitmap_t *bitmap, con w = (spriteptr[offs+2]&0x0f00)>> 8; sy = spriteptr[offs]; - if ((sy&0x2000) && (video_screen_get_frame_number(0) & 1)) { + if ((sy&0x2000) && (video_screen_get_frame_number(machine->primary_screen) & 1)) { offs+=inc; continue; } diff --git a/src/mame/video/cosmic.c b/src/mame/video/cosmic.c index 89978274d51..a99108379f5 100644 --- a/src/mame/video/cosmic.c +++ b/src/mame/video/cosmic.c @@ -314,7 +314,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta } -static void cosmica_draw_starfield(bitmap_t *bitmap, const rectangle *cliprect) +static void cosmica_draw_starfield(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect) { UINT8 y = 0; UINT8 map = 0; @@ -333,9 +333,9 @@ static void cosmica_draw_starfield(bitmap_t *bitmap, const rectangle *cliprect) int hc, hb_; if (flip_screen_get()) - x1 = x - video_screen_get_frame_number(0); + x1 = x - video_screen_get_frame_number(screen); else - x1 = x + video_screen_get_frame_number(0); + x1 = x + video_screen_get_frame_number(screen); hc = (x1 >> 2) & 0x01; hb_ = (x >> 5) & 0x01; /* not a bug, this one is the real x */ @@ -421,10 +421,10 @@ static void devzone_draw_grid(bitmap_t *bitmap, const rectangle *cliprect) } -static void nomnlnd_draw_background(bitmap_t *bitmap, const rectangle *cliprect) +static void nomnlnd_draw_background(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect) { UINT8 y = 0; - UINT8 water = video_screen_get_frame_number(0); + UINT8 water = video_screen_get_frame_number(screen); UINT8 *PROM = memory_region(REGION_USER2); /* all positioning is via logic gates: @@ -563,7 +563,7 @@ VIDEO_UPDATE( panic ) VIDEO_UPDATE( cosmica ) { fillbitmap(bitmap, 0, cliprect); - cosmica_draw_starfield(bitmap, cliprect); + cosmica_draw_starfield(screen, bitmap, cliprect); draw_bitmap(bitmap, cliprect); draw_sprites(screen->machine, bitmap, cliprect, 0x0f, 0); return 0; @@ -602,7 +602,7 @@ VIDEO_UPDATE( nomnlnd ) draw_sprites(screen->machine, bitmap, cliprect, 0x07, 0); if (background_enable) - nomnlnd_draw_background(bitmap, cliprect); + nomnlnd_draw_background(screen, bitmap, cliprect); return 0; } diff --git a/src/mame/video/cps1.c b/src/mame/video/cps1.c index a08ff97b982..1254b85fd75 100644 --- a/src/mame/video/cps1.c +++ b/src/mame/video/cps1.c @@ -1691,7 +1691,7 @@ static void cps2_render_sprites(running_machine *machine, bitmap_t *bitmap,const -static void cps1_render_stars(bitmap_t *bitmap,const rectangle *cliprect) +static void cps1_render_stars(const device_config *screen, bitmap_t *bitmap,const rectangle *cliprect) { int offs; UINT8 *stars_rom = memory_region(REGION_GFX2); @@ -1721,7 +1721,7 @@ static void cps1_render_stars(bitmap_t *bitmap,const rectangle *cliprect) sy = 255 - sy; } - col = ((col & 0xe0) >> 1) + (video_screen_get_frame_number(0)/16 & 0x0f); + col = ((col & 0xe0) >> 1) + (video_screen_get_frame_number(screen)/16 & 0x0f); if (sx >= cliprect->min_x && sx <= cliprect->max_x && sy >= cliprect->min_y && sy <= cliprect->max_y) @@ -1747,7 +1747,7 @@ static void cps1_render_stars(bitmap_t *bitmap,const rectangle *cliprect) sy = 255 - sy; } - col = ((col & 0xe0) >> 1) + (video_screen_get_frame_number(0)/16 & 0x0f); + col = ((col & 0xe0) >> 1) + (video_screen_get_frame_number(screen)/16 & 0x0f); if (sx >= cliprect->min_x && sx <= cliprect->max_x && sy >= cliprect->min_y && sy <= cliprect->max_y) @@ -1847,7 +1847,7 @@ VIDEO_UPDATE( cps1 ) /* Blank screen */ fillbitmap(bitmap,4095,cliprect); - cps1_render_stars(bitmap,cliprect); + cps1_render_stars(screen, bitmap,cliprect); /* Draw layers (0 = sprites, 1-3 = tilemaps) */ l0 = (layercontrol >> 0x06) & 03; diff --git a/src/mame/video/crospang.c b/src/mame/video/crospang.c index 660a03b8ba5..2fb9846fdc2 100644 --- a/src/mame/video/crospang.c +++ b/src/mame/video/crospang.c @@ -139,7 +139,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0xf; diff --git a/src/mame/video/cyberbal.c b/src/mame/video/cyberbal.c index 2f45b114f7b..04d03d8593b 100644 --- a/src/mame/video/cyberbal.c +++ b/src/mame/video/cyberbal.c @@ -315,7 +315,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(update_screen, scanline - 1); + video_screen_update_partial_scrnum(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 +325,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(update_screen, scanline - 1); + video_screen_update_partial_scrnum(update_screen, scanline - 1); tilemap_set_scrollx(i ? atarigen_playfield2_tilemap : atarigen_playfield_tilemap, 0, newscroll); playfield_xscroll[i] = newscroll; } @@ -336,7 +336,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(update_screen, scanline - 1); + video_screen_update_partial_scrnum(update_screen, scanline - 1); tilemap_set_scrolly(i ? atarigen_playfield2_tilemap : atarigen_playfield_tilemap, 0, newscroll); playfield_yscroll[i] = newscroll; } @@ -345,7 +345,7 @@ void cyberbal_scanline_update(running_machine *machine, int scrnum, int scanline { if (current_slip[i] != base[7]) { - video_screen_update_partial(update_screen, scanline - 1); + video_screen_update_partial_scrnum(update_screen, scanline - 1); current_slip[i] = base[7]; } } diff --git a/src/mame/video/darkseal.c b/src/mame/video/darkseal.c index 09caac481c6..a3f3ad54f9d 100644 --- a/src/mame/video/darkseal.c +++ b/src/mame/video/darkseal.c @@ -179,7 +179,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const recta x = buffered_spriteram16[offs+2]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; colour = (x >> 9) &0x1f; diff --git a/src/mame/video/dassault.c b/src/mame/video/dassault.c index b10d68280f1..c51167549c0 100644 --- a/src/mame/video/dassault.c +++ b/src/mame/video/dassault.c @@ -45,7 +45,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const recta y = spritebase[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; colour = (x >> 9) &0x1f; if (y&0x8000) colour+=32; diff --git a/src/mame/video/dc.c b/src/mame/video/dc.c index 42a5bc94808..5dcb6b76072 100644 --- a/src/mame/video/dc.c +++ b/src/mame/video/dc.c @@ -4,6 +4,7 @@ */ #include "driver.h" +#include "deprecat.h" #include "dc.h" #include "cpu/sh4/sh4.h" @@ -105,7 +106,7 @@ READ64_HANDLER( pvr_ta_r ) switch (reg) { case SPG_STATUS: - pvrta_regs[reg] = (video_screen_get_vblank(0) << 13) | (video_screen_get_hblank(0) << 12) | (video_screen_get_vpos(0) & 0x3ff); + pvrta_regs[reg] = (video_screen_get_vblank(machine->primary_screen) << 13) | (video_screen_get_hblank(machine->primary_screen) << 12) | (video_screen_get_vpos(machine->primary_screen) & 0x3ff); break; } @@ -666,6 +667,6 @@ void dc_vblank(void) dc_sysctrl_regs[SB_ISTNRM] |= IST_VBL_IN; // V Blank-in interrupt update_interrupt_status(); - timer_adjust_oneshot(vbout_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(vbout_timer, video_screen_get_time_until_pos(Machine->primary_screen, 0, 0), 0); } diff --git a/src/mame/video/dcheese.c b/src/mame/video/dcheese.c index 4f813d0328f..7dab419e70a 100644 --- a/src/mame/video/dcheese.c +++ b/src/mame/video/dcheese.c @@ -64,7 +64,7 @@ PALETTE_INIT( dcheese ) * *************************************/ -static void update_scanline_irq(void) +static void update_scanline_irq(running_machine *machine) { /* if not in range, don't bother */ if (blitter_vidparam[0x22/2] <= blitter_vidparam[0x1e/2]) @@ -78,9 +78,9 @@ static void update_scanline_irq(void) effscan += blitter_vidparam[0x1e/2]; /* determine the time; if it's in this scanline, bump to the next frame */ - time = video_screen_get_time_until_pos(0, effscan, 0); - if (attotime_compare(time, video_screen_get_scan_period(0)) < 0) - time = attotime_add(time, video_screen_get_frame_period(0)); + time = video_screen_get_time_until_pos(machine->primary_screen, effscan, 0); + if (attotime_compare(time, video_screen_get_scan_period(machine->primary_screen)) < 0) + time = attotime_add(time, video_screen_get_frame_period(machine->primary_screen)); timer_adjust_oneshot(blitter_timer, time, 0); } } @@ -89,7 +89,7 @@ static void update_scanline_irq(void) static TIMER_CALLBACK( blitter_scanline_callback ) { dcheese_signal_irq(3); - update_scanline_irq(); + update_scanline_irq(machine); } @@ -153,7 +153,7 @@ VIDEO_UPDATE( dcheese ) * *************************************/ -static void do_clear(void) +static void do_clear(running_machine *machine) { int y; @@ -162,11 +162,11 @@ static void do_clear(void) memset(BITMAP_ADDR16(dstbitmap, y % DSTBITMAP_HEIGHT, 0), 0, DSTBITMAP_WIDTH * 2); /* signal an IRQ when done (timing is just a guess) */ - timer_set(video_screen_get_scan_period(0), NULL, 1, dcheese_signal_irq_callback); + timer_set(video_screen_get_scan_period(machine->primary_screen), NULL, 1, dcheese_signal_irq_callback); } -static void do_blit(void) +static void do_blit(running_machine *machine) { INT32 srcminx = blitter_xparam[0] << 12; INT32 srcmaxx = blitter_xparam[1] << 12; @@ -216,7 +216,7 @@ static void do_blit(void) } /* signal an IRQ when done (timing is just a guess) */ - timer_set(attotime_make(0, attotime_to_attoseconds(video_screen_get_scan_period(0)) / 2), NULL, 2, dcheese_signal_irq_callback); + timer_set(attotime_make(0, attotime_to_attoseconds(video_screen_get_scan_period(machine->primary_screen)) / 2), NULL, 2, dcheese_signal_irq_callback); /* these extra parameters are written but they are always zero, so I don't know what they do */ if (blitter_xparam[8] != 0 || blitter_xparam[9] != 0 || blitter_xparam[10] != 0 || blitter_xparam[11] != 0 || @@ -280,7 +280,7 @@ WRITE16_HANDLER( madmax_blitter_vidparam_w ) break; case 0x22/2: /* scanline interrupt */ - update_scanline_irq(); + update_scanline_irq(machine); break; case 0x24/2: /* writes here after writing to 0x28 */ @@ -292,11 +292,11 @@ WRITE16_HANDLER( madmax_blitter_vidparam_w ) break; case 0x38/2: /* blit */ - do_blit(); + do_blit(machine); break; case 0x3e/2: /* clear */ - do_clear(); + do_clear(machine); break; default: diff --git a/src/mame/video/dec0.c b/src/mame/video/dec0.c index ada5430376f..8add8801f31 100644 --- a/src/mame/video/dec0.c +++ b/src/mame/video/dec0.c @@ -164,7 +164,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan if ((colour & pri_mask) != pri_val) continue; flash=x&0x800; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; fx = y & 0x2000; fy = y & 0x4000; diff --git a/src/mame/video/dec8.c b/src/mame/video/dec8.c index f57c9699f0e..584138fe8c1 100644 --- a/src/mame/video/dec8.c +++ b/src/mame/video/dec8.c @@ -319,7 +319,7 @@ static void draw_sprites2(running_machine* machine, bitmap_t *bitmap, const rect x = buffered_spriteram[offs+5]+(buffered_spriteram[offs+4]<<8); colour = ((x & 0xf000) >> 12); flash=x&0x800; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; if (priority==1 && (colour&4)) continue; if (priority==2 && !(colour&4)) continue; diff --git a/src/mame/video/deco32.c b/src/mame/video/deco32.c index 7362f6a3094..2f272298b45 100644 --- a/src/mame/video/deco32.c +++ b/src/mame/video/deco32.c @@ -232,7 +232,7 @@ static void captaven_draw_sprites(running_machine* machine, bitmap_t *bitmap, co sx = spritedata[offs+1]; - if ((sy&0x2000) && (video_screen_get_frame_number(0) & 1)) continue; + if ((sy&0x2000) && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; colour = (spritedata[offs+2] >>0) & 0x1f; @@ -291,7 +291,7 @@ static void fghthist_draw_sprites(running_machine* machine, bitmap_t *bitmap, co y = spritedata[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; trans=TRANSPARENCY_PEN; x = spritedata[offs+2]; @@ -407,7 +407,7 @@ static void nslasher_draw_sprites(running_machine* machine, bitmap_t *bitmap, co y = spritedata[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; trans=TRANSPARENCY_PEN; x = spritedata[offs+2]; diff --git a/src/mame/video/deco_mlc.c b/src/mame/video/deco_mlc.c index d1a13d1755a..b604c1a1d17 100644 --- a/src/mame/video/deco_mlc.c +++ b/src/mame/video/deco_mlc.c @@ -252,7 +252,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan { if ((mlc_spriteram[offs+0]&0x8000)==0) continue; - if ((mlc_spriteram[offs+1]&0x2000) && (video_screen_get_frame_number(0) & 1)) + if ((mlc_spriteram[offs+1]&0x2000) && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; /* diff --git a/src/mame/video/dietgo.c b/src/mame/video/dietgo.c index 20d05129eaf..51fb31de7ca 100644 --- a/src/mame/video/dietgo.c +++ b/src/mame/video/dietgo.c @@ -14,7 +14,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/video/diverboy.c b/src/mame/video/diverboy.c index 4c065e4c5a5..36073c24cd5 100644 --- a/src/mame/video/diverboy.c +++ b/src/mame/video/diverboy.c @@ -31,7 +31,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const recta bank = (source[1]&0x0002) >> 1; - if (!flash || (video_screen_get_frame_number(0) & 1)) + if (!flash || (video_screen_get_frame_number(machine->primary_screen) & 1)) { drawgfx(bitmap,machine->gfx[bank], number, diff --git a/src/mame/video/dkong.c b/src/mame/video/dkong.c index 26a15475c77..d9519333535 100644 --- a/src/mame/video/dkong.c +++ b/src/mame/video/dkong.c @@ -828,7 +828,7 @@ static TIMER_CALLBACK( scanline_callback ) counter++; scanline = (scanline+1) % VTOTAL; /* come back at the next appropriate scanline */ - timer_adjust_oneshot(state->scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(state->scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } static void check_palette(running_machine *machine) @@ -896,7 +896,7 @@ VIDEO_START( dkong ) case HARDWARE_TRS02: state->bg_bits = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); state->scanline_timer = timer_alloc(scanline_callback, NULL); - timer_adjust_oneshot(state->scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(state->scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); /* fall through */ case HARDWARE_TKG04: case HARDWARE_TKG02: @@ -910,7 +910,7 @@ VIDEO_START( dkong ) state->bg_bits = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); state->scanline_timer = timer_alloc(scanline_callback, NULL); - timer_adjust_oneshot(state->scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(state->scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); break; default: fatalerror("Invalid hardware type in dkong_video_start"); diff --git a/src/mame/video/dotrikun.c b/src/mame/video/dotrikun.c index e1596f3f77c..31b25eb4b22 100644 --- a/src/mame/video/dotrikun.c +++ b/src/mame/video/dotrikun.c @@ -16,9 +16,8 @@ static UINT8 color; WRITE8_HANDLER( dotrikun_color_w ) { + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); color = data; - - video_screen_update_partial(0, video_screen_get_vpos(0)); } diff --git a/src/mame/video/exerion.c b/src/mame/video/exerion.c index 5471658defb..564c69f0c5f 100644 --- a/src/mame/video/exerion.c +++ b/src/mame/video/exerion.c @@ -209,9 +209,8 @@ WRITE8_HANDLER( exerion_videoreg_w ) WRITE8_HANDLER( exerion_video_latch_w ) { + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); background_latches[offset] = data; - - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); } @@ -220,13 +219,13 @@ READ8_HANDLER( exerion_video_timing_r ) /* bit 0 is the SNMI signal, which is the negated value of H6, if H7=1 & H8=1 & VBLANK=0, otherwise 1 */ /* bit 1 is VBLANK */ - UINT16 hcounter = video_screen_get_hpos(0) + EXERION_HCOUNT_START; + UINT16 hcounter = video_screen_get_hpos(machine->primary_screen) + EXERION_HCOUNT_START; UINT8 snmi = 1; - if (((hcounter & 0x180) == 0x180) && !video_screen_get_vblank(0)) + if (((hcounter & 0x180) == 0x180) && !video_screen_get_vblank(machine->primary_screen)) snmi = !((hcounter >> 6) & 0x01); - return (video_screen_get_vblank(0) << 1) | snmi; + return (video_screen_get_vblank(machine->primary_screen) << 1) | snmi; } diff --git a/src/mame/video/exidy.c b/src/mame/video/exidy.c index b1d0e581092..1743f733c01 100644 --- a/src/mame/video/exidy.c +++ b/src/mame/video/exidy.c @@ -350,7 +350,7 @@ static void check_collision(running_machine *machine) /* if we got one, trigger an interrupt */ if ((current_collision_mask & collision_mask) && (count++ < 128)) - timer_set(video_screen_get_time_until_pos(0, org_1_x + sx, org_1_y + sy), NULL, current_collision_mask, collision_irq_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, org_1_x + sx, org_1_y + sy), NULL, current_collision_mask, collision_irq_callback); } if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != 0xff) @@ -358,7 +358,7 @@ static void check_collision(running_machine *machine) /* check for background collision (M2CHAR) */ if (*BITMAP_ADDR16(background_bitmap, org_2_y + sy, org_2_x + sx) != 0) if ((collision_mask & 0x08) && (count++ < 128)) - timer_set(video_screen_get_time_until_pos(0, org_2_x + sx, org_2_y + sy), NULL, 0x08, collision_irq_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, org_2_x + sx, org_2_y + sy), NULL, 0x08, collision_irq_callback); } } } diff --git a/src/mame/video/exidy440.c b/src/mame/video/exidy440.c index 3d57c73f7d4..4b33249a160 100644 --- a/src/mame/video/exidy440.c +++ b/src/mame/video/exidy440.c @@ -170,7 +170,7 @@ READ8_HANDLER( exidy440_vertical_pos_r ) * caused by collision or beam, ORed together with CHRCLK, * which probably goes off once per scanline; for now, we just * always return the current scanline */ - result = video_screen_get_vpos(0); + result = video_screen_get_vpos(machine->primary_screen); return (result < 255) ? result : 255; } @@ -184,7 +184,7 @@ READ8_HANDLER( exidy440_vertical_pos_r ) WRITE8_HANDLER( exidy440_spriteram_w ) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); spriteram[offset] = data; } @@ -307,7 +307,8 @@ static TIMER_CALLBACK( collide_firq_callback ) * *************************************/ -static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int scroll_offset, int check_collision) +static void draw_sprites(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect, + int scroll_offset, int check_collision) { int i; @@ -374,7 +375,7 @@ static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int scroll /* check the collisions bit */ if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128)) - timer_set(video_screen_get_time_until_pos(0, yoffs, currx), NULL, currx, collide_firq_callback); + timer_set(video_screen_get_time_until_pos(screen, yoffs, currx), NULL, currx, collide_firq_callback); } currx++; @@ -387,7 +388,7 @@ static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int scroll /* check the collisions bit */ if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128)) - timer_set(video_screen_get_time_until_pos(0, yoffs, currx), NULL, currx, collide_firq_callback); + timer_set(video_screen_get_time_until_pos(screen, yoffs, currx), NULL, currx, collide_firq_callback); } currx++; } @@ -406,7 +407,8 @@ static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int scroll * *************************************/ -static void update_screen(bitmap_t *bitmap, const rectangle *cliprect, int scroll_offset, int check_collision) +static void update_screen(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect, + int scroll_offset, int check_collision) { int y, sy; @@ -423,7 +425,7 @@ static void update_screen(bitmap_t *bitmap, const rectangle *cliprect, int scrol } /* draw the sprites */ - draw_sprites(bitmap, cliprect, scroll_offset, check_collision); + draw_sprites(screen, bitmap, cliprect, scroll_offset, check_collision); } @@ -437,7 +439,7 @@ static void update_screen(bitmap_t *bitmap, const rectangle *cliprect, int scrol static VIDEO_UPDATE( exidy440 ) { /* redraw the screen */ - update_screen(bitmap, cliprect, 0, TRUE); + update_screen(screen, bitmap, cliprect, 0, TRUE); /* generate an interrupt once/frame for the beam */ if (cliprect->max_y == screen->machine->screen[scrnum].visarea.max_y) @@ -453,8 +455,8 @@ static VIDEO_UPDATE( exidy440 ) From this, it appears that they are expecting to get beams over a 12 scanline period, and trying to pick roughly the middle one. This is how it is implemented. */ - attoseconds_t increment = attotime_to_attoseconds(video_screen_get_scan_period(0)); - attotime time = attotime_sub(video_screen_get_time_until_pos(0, beamy, beamx), attotime_make(0, increment * 6)); + attoseconds_t increment = attotime_to_attoseconds(video_screen_get_scan_period(screen)); + attotime time = attotime_sub(video_screen_get_time_until_pos(screen, beamy, beamx), attotime_make(0, increment * 6)); for (i = 0; i <= 12; i++) { timer_set(time, NULL, beamx, beam_firq_callback); @@ -469,7 +471,7 @@ static VIDEO_UPDATE( exidy440 ) static VIDEO_UPDATE( topsecex ) { /* redraw the screen */ - update_screen(bitmap, cliprect, *topsecex_yscroll, FALSE); + update_screen(screen, bitmap, cliprect, *topsecex_yscroll, FALSE); return 0; } diff --git a/src/mame/video/fromance.c b/src/mame/video/fromance.c index 1bbe5aef9c8..07645909219 100644 --- a/src/mame/video/fromance.c +++ b/src/mame/video/fromance.c @@ -295,7 +295,7 @@ static TIMER_CALLBACK( crtc_interrupt_gen ) { cpunum_set_input_line(machine, 1, 0, HOLD_LINE); if (param != 0) - timer_adjust_periodic(crtc_timer, attotime_div(video_screen_get_frame_period(0), param), 0, attotime_div(video_screen_get_frame_period(0), param)); + timer_adjust_periodic(crtc_timer, attotime_div(video_screen_get_frame_period(machine->primary_screen), param), 0, attotime_div(video_screen_get_frame_period(machine->primary_screen), param)); } @@ -307,7 +307,7 @@ WRITE8_HANDLER( fromance_crtc_data_w ) { /* only register we know about.... */ case 0x0b: - timer_adjust_oneshot(crtc_timer, video_screen_get_time_until_pos(0, Machine->screen[0].visarea.max_y + 1, 0), (data > 0x80) ? 2 : 1); + timer_adjust_oneshot(crtc_timer, video_screen_get_time_until_pos(machine->primary_screen, Machine->screen[0].visarea.max_y + 1, 0), (data > 0x80) ? 2 : 1); break; default: diff --git a/src/mame/video/funkyjet.c b/src/mame/video/funkyjet.c index 47779760775..085520582c8 100644 --- a/src/mame/video/funkyjet.c +++ b/src/mame/video/funkyjet.c @@ -26,7 +26,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/video/gaelco3d.c b/src/mame/video/gaelco3d.c index 62a209c2966..1a3efdbc218 100644 --- a/src/mame/video/gaelco3d.c +++ b/src/mame/video/gaelco3d.c @@ -374,7 +374,7 @@ void gaelco3d_render(void) #if DISPLAY_STATS { - int scan = video_screen_get_vpos(0); + int scan = video_screen_get_vpos(machine->primary_screen); popmessage("Polys = %4d Timeleft = %3d", polygons, (lastscan < scan) ? (scan - lastscan) : (scan + (lastscan - Machine->screen[0].visarea.max_y))); } #endif @@ -411,7 +411,7 @@ WRITE32_HANDLER( gaelco3d_render_w ) } #if DISPLAY_STATS - lastscan = video_screen_get_vpos(0); + lastscan = video_screen_get_vpos(machine->primary_screen); #endif } diff --git a/src/mame/video/gaiden.c b/src/mame/video/gaiden.c index 3091879c32b..f7389a1955e 100644 --- a/src/mame/video/gaiden.c +++ b/src/mame/video/gaiden.c @@ -316,7 +316,7 @@ static void gaiden_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons int ypos = source[3] & 0x01ff; int xpos = source[4] & 0x01ff; - if ((attributes & 0x20) && (video_screen_get_frame_number(0) & 1)) + if ((attributes & 0x20) && (video_screen_get_frame_number(machine->primary_screen) & 1)) goto skip_sprite; color = (color >> 4) & 0x0f; diff --git a/src/mame/video/galaxian.c b/src/mame/video/galaxian.c index d055173d1b0..317782d59d3 100644 --- a/src/mame/video/galaxian.c +++ b/src/mame/video/galaxian.c @@ -114,7 +114,7 @@ static void rescue_draw_stars(running_machine *machine, bitmap_t *bitmap); static void mariner_draw_stars(running_machine *machine, bitmap_t *bitmap); static void jumpbug_draw_stars(running_machine *machine, bitmap_t *bitmap); static void start_stars_blink_timer(double ra, double rb, double c); -static void start_stars_scroll_timer(void); +static void start_stars_scroll_timer(running_machine *machine); /* bullets circuit */ static UINT8 darkplnt_bullet_color; @@ -1803,7 +1803,7 @@ void galaxian_draw_stars(running_machine *machine, bitmap_t *bitmap) if (!timer_adjusted) { - start_stars_scroll_timer(); + start_stars_scroll_timer(machine); timer_adjusted = 1; } @@ -1921,7 +1921,7 @@ static void mariner_draw_stars(running_machine *machine, bitmap_t *bitmap) if (!timer_adjusted) { - start_stars_scroll_timer(); + start_stars_scroll_timer(machine); timer_adjusted = 1; } @@ -1956,7 +1956,7 @@ static void jumpbug_draw_stars(running_machine *machine, bitmap_t *bitmap) if (!timer_adjusted) { start_stars_blink_timer(100000, 10000, 0.00001); - start_stars_scroll_timer(); + start_stars_scroll_timer(machine); timer_adjusted = 1; } @@ -2023,9 +2023,9 @@ static TIMER_CALLBACK( stars_scroll_callback ) } } -static void start_stars_scroll_timer() +static void start_stars_scroll_timer(running_machine *machine) { - timer_adjust_periodic(stars_scroll_timer, video_screen_get_frame_period(0), 0, video_screen_get_frame_period(0)); + timer_adjust_periodic(stars_scroll_timer, video_screen_get_frame_period(machine->primary_screen), 0, video_screen_get_frame_period(machine->primary_screen)); } diff --git a/src/mame/video/galspnbl.c b/src/mame/video/galspnbl.c index c6f9295e379..5d7381b47d9 100644 --- a/src/mame/video/galspnbl.c +++ b/src/mame/video/galspnbl.c @@ -55,7 +55,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta int col,row; attr = spriteram16[offs]; - if ((attr & 0x0004) && ((attr & 0x0040) == 0 || (video_screen_get_frame_number(0) & 1)) + if ((attr & 0x0004) && ((attr & 0x0040) == 0 || (video_screen_get_frame_number(machine->primary_screen) & 1)) // && ((attr & 0x0030) >> 4) == priority) && ((attr & 0x0020) >> 5) == priority) { diff --git a/src/mame/video/gameplan.c b/src/mame/video/gameplan.c index ee6d4ac8d2e..f30fd51b86d 100644 --- a/src/mame/video/gameplan.c +++ b/src/mame/video/gameplan.c @@ -268,9 +268,9 @@ static TIMER_CALLBACK( via_0_ca1_timer_callback ) via_0_ca1_w(machine, 0, (UINT8)param); if (param) - timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos(0, VBSTART, 0), 0); + timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos(machine->primary_screen, VBSTART, 0), 0); else - timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos(0, VBEND, 0), 1); + timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos(machine->primary_screen, VBEND, 0), 1); } @@ -282,7 +282,7 @@ static void create_via_0_timer(gameplan_state *state) static void start_via_0_timer(gameplan_state *state) { - timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos(0, VBSTART, 0), 0); + timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos(Machine->primary_screen, VBSTART, 0), 0); } diff --git a/src/mame/video/gauntlet.c b/src/mame/video/gauntlet.c index 645129fbed2..6bcc50ab833 100644 --- a/src/mame/video/gauntlet.c +++ b/src/mame/video/gauntlet.c @@ -140,7 +140,7 @@ WRITE16_HANDLER( gauntlet_xscroll_w ) /* if something changed, force a partial update */ if (*atarigen_xscroll != oldxscroll) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* adjust the scrolls */ tilemap_set_scrollx(atarigen_playfield_tilemap, 0, *atarigen_xscroll); @@ -164,7 +164,7 @@ WRITE16_HANDLER( gauntlet_yscroll_w ) /* if something changed, force a partial update */ if (*atarigen_yscroll != oldyscroll) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* if the bank changed, mark all tiles dirty */ if (playfield_tile_bank != (*atarigen_yscroll & 3)) diff --git a/src/mame/video/genesis.c b/src/mame/video/genesis.c index 8076deaa356..595ea050d1f 100644 --- a/src/mame/video/genesis.c +++ b/src/mame/video/genesis.c @@ -252,8 +252,7 @@ void start_system18_vdp(void) /* set the display enable bit */ void segac2_enable_display(int enable) { - if (!video_screen_get_vblank(0)) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); display_enable = enable; } @@ -348,8 +347,8 @@ READ16_HANDLER( genesis_vdp_r ) case 0x06: case 0x07: { - int xpos = video_screen_get_hpos(0); - int ypos = video_screen_get_vpos(0); + int xpos = video_screen_get_hpos(machine->primary_screen); + int ypos = video_screen_get_vpos(machine->primary_screen); /* adjust for the weird counting rules */ if (xpos > 0xe9) xpos -= (342 - 0x100); @@ -468,11 +467,10 @@ static void vdp_data_w(int data) { case 0x01: /* VRAM write */ - /* if the hscroll RAM is changing during screen refresh, force an update */ - if (!video_screen_get_vblank(0) && - vdp_address >= vdp_hscrollbase && + /* if the hscroll RAM is changing, force an update */ + if (vdp_address >= vdp_hscrollbase && vdp_address < vdp_hscrollbase + vdp_hscrollsize) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); /* write to VRAM */ if (vdp_address & 1) @@ -490,9 +488,8 @@ static void vdp_data_w(int data) case 0x05: /* VSRAM write */ - /* if the vscroll RAM is changing during screen refresh, force an update */ - if (!video_screen_get_vblank(0)) - video_screen_update_partial(0, video_screen_get_vpos(0)); + /* vscroll RAM is changing, force an update */ + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); /* write to VSRAM */ if (vdp_address & 1) @@ -554,11 +551,11 @@ static int vdp_control_r(void) vdp_cmdpart = 0; /* set the VBLANK bit */ - if (video_screen_get_vblank(0)) + if (video_screen_get_vblank(Machine->primary_screen)) status |= 0x0008; /* set the HBLANK bit */ - if (video_screen_get_hblank(0)) + if (video_screen_get_hblank(Machine->primary_screen)) status |= 0x0004; return (status); @@ -572,7 +569,7 @@ static void vdp_control_w(int data) { /* if 10xxxxxx xxxxxxxx this is a register setting command */ if ((data & 0xc000) == 0x8000) - vdp_register_w(data, video_screen_get_vblank(0)); + vdp_register_w(data, video_screen_get_vblank(Machine->primary_screen)); /* otherwise this is the First part of a mode setting command */ else @@ -604,10 +601,9 @@ static void vdp_register_w(int data, int vblank) genesis_vdp_regs[regnum] = regdat; - /* these are mostly important writes; force an update if they */ - /* are written during a screen refresh */ - if (!vblank && is_important[regnum]) - video_screen_update_partial(0, video_screen_get_vpos(0)); + /* these are mostly important writes; force an update if they written */ + if (is_important[regnum]) + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); /* For quite a few of the registers its a good idea to set a couple of variable based upon the writes here */ @@ -672,11 +668,11 @@ static void vdp_register_w(int data, int vblank) { screen_state *state = &Machine->screen[genesis_screen_number]; rectangle visarea = state->visarea; - attoseconds_t refresh = video_screen_get_frame_period(genesis_screen_number).attoseconds; + attoseconds_t refresh = video_screen_get_frame_period_scrnum(genesis_screen_number).attoseconds; /* this gets called from the init! */ visarea.max_x = scrwidth*8-1; - video_screen_configure(genesis_screen_number, scrwidth*8, state->height, &visarea, refresh); + video_screen_configure_scrnum(genesis_screen_number, scrwidth*8, state->height, &visarea, refresh); } break; diff --git a/src/mame/video/gridlee.c b/src/mame/video/gridlee.c index a989567c9bc..870a9bd49af 100644 --- a/src/mame/video/gridlee.c +++ b/src/mame/video/gridlee.c @@ -111,11 +111,8 @@ WRITE8_HANDLER( gridlee_videoram_w ) WRITE8_HANDLER( gridlee_palette_select_w ) { /* update the scanline palette */ - if (palettebank_vis != (data & 0x3f)) - { - video_screen_update_partial(0, video_screen_get_vpos(0) - 1 + BALSENTE_VBEND); - palettebank_vis = data & 0x3f; - } + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1 + BALSENTE_VBEND); + palettebank_vis = data & 0x3f; } diff --git a/src/mame/video/gtia.c b/src/mame/video/gtia.c index b4a4228206d..ae3409f62b4 100644 --- a/src/mame/video/gtia.c +++ b/src/mame/video/gtia.c @@ -145,9 +145,9 @@ static void gtia_state(void) -static int is_ntsc(void) +static int is_ntsc(running_machine *machine) { - return ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds) > 55; + return ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) > 55; } @@ -159,7 +159,7 @@ static void gtia_reset(running_machine *machine) for (i = 0; i < 32; i++) atari_gtia_w(machine,i,0); memset(>ia.r, 0, sizeof(gtia.r)); - if (is_ntsc()) + if (is_ntsc(machine)) gtia.r.pal = 0xff; else gtia.r.pal = 0xf1; diff --git a/src/mame/video/gyruss.c b/src/mame/video/gyruss.c index f17d3fac874..fa97e0c7b81 100644 --- a/src/mame/video/gyruss.c +++ b/src/mame/video/gyruss.c @@ -101,7 +101,7 @@ PALETTE_INIT( gyruss ) WRITE8_HANDLER( gyruss_spriteram_w ) { - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); gyruss_spriteram[offset] = data; } @@ -130,7 +130,7 @@ VIDEO_START( gyruss ) READ8_HANDLER( gyruss_scanline_r ) { /* reads 1V - 128V */ - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); } diff --git a/src/mame/video/harddriv.c b/src/mame/video/harddriv.c index c7e9ec75372..fac8d1fb39d 100644 --- a/src/mame/video/harddriv.c +++ b/src/mame/video/harddriv.c @@ -211,11 +211,8 @@ void hdgsp_read_from_shiftreg(UINT32 address, UINT16 *shiftreg) static void update_palette_bank(int newbank) { - if (gfx_palettebank != newbank) - { - video_screen_update_partial(0, video_screen_get_vpos(0)); - gfx_palettebank = newbank; - } + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); + gfx_palettebank = newbank; } @@ -276,11 +273,8 @@ WRITE16_HANDLER( hdgsp_control_hi_w ) case 0x01: data = data & (15 >> hdgsp_multisync); - if (gfx_finescroll != data) - { - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); - gfx_finescroll = data; - } + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); + gfx_finescroll = data; break; case 0x02: diff --git a/src/mame/video/homedata.c b/src/mame/video/homedata.c index 4823a51022e..2fdfd7f833a 100644 --- a/src/mame/video/homedata.c +++ b/src/mame/video/homedata.c @@ -709,7 +709,7 @@ VIDEO_UPDATE( mrokumei ) width = 54; break; } - video_screen_set_visarea(0, 0*8, width*8-1, 2*8, 30*8-1); + video_screen_set_visarea(screen, 0*8, width*8-1, 2*8, 30*8-1); tilemap_set_scrollx(bg_tilemap[homedata_visible_page][0],0,homedata_vreg[0xc] << 1); @@ -847,24 +847,24 @@ VIDEO_UPDATE( pteacher ) if (homedata_vreg[0x4] == 0xae || homedata_vreg[0x4] == 0xb8) { /* kludge for mjkinjas */ - video_screen_set_visarea(0, 0*8, 42*8-1, 2*8, 30*8-1); + video_screen_set_visarea(screen, 0*8, 42*8-1, 2*8, 30*8-1); scroll_low = 0; } else { if (homedata_vreg[0x3] == 0xa6) - video_screen_set_visarea(0, 0*8, 33*8-1, 2*8, 30*8-1); + video_screen_set_visarea(screen, 0*8, 33*8-1, 2*8, 30*8-1); else - video_screen_set_visarea(0, 0*8, 35*8-1, 2*8, 30*8-1); + video_screen_set_visarea(screen, 0*8, 35*8-1, 2*8, 30*8-1); scroll_low = (11 - (homedata_vreg[0x4] & 0x0f)) * 8 / 12; } } else { if (homedata_vreg[0x3] == 0xa6) - video_screen_set_visarea(0, 0*8, 51*8-1, 2*8, 30*8-1); + video_screen_set_visarea(screen, 0*8, 51*8-1, 2*8, 30*8-1); else - video_screen_set_visarea(0, 0*8, 54*8-1, 2*8, 30*8-1); + video_screen_set_visarea(screen, 0*8, 54*8-1, 2*8, 30*8-1); scroll_low = 7 - (homedata_vreg[0x4] & 0x0f); } scroll_high = homedata_vreg[0xb] >> 2; diff --git a/src/mame/video/homerun.c b/src/mame/video/homerun.c index 60d35af822a..6e218b3e3f8 100644 --- a/src/mame/video/homerun.c +++ b/src/mame/video/homerun.c @@ -12,7 +12,7 @@ UINT8 *homerun_videoram; WRITE8_HANDLER(homerun_banking_w) { - if(video_screen_get_vpos(0)>half_screen) + if(video_screen_get_vpos(machine->primary_screen)>half_screen) homerun_gc_down=data&3; else homerun_gc_up=data&3; diff --git a/src/mame/video/itech32.c b/src/mame/video/itech32.c index 44226494cf8..2734c152da7 100644 --- a/src/mame/video/itech32.c +++ b/src/mame/video/itech32.c @@ -479,10 +479,10 @@ static void update_interrupts(int fast) static TIMER_CALLBACK( scanline_interrupt ) { /* set timer for next frame */ - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, VIDEO_INTSCANLINE, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, VIDEO_INTSCANLINE, 0), 0); /* set the interrupt bit in the status reg */ - logerror("-------------- (DISPLAY INT @ %d) ----------------\n", video_screen_get_vpos(0)); + logerror("-------------- (DISPLAY INT @ %d) ----------------\n", video_screen_get_vpos(machine->primary_screen)); VIDEO_INTSTATE |= VIDEOINT_SCANLINE; /* update the interrupt state */ @@ -1347,7 +1347,7 @@ WRITE16_HANDLER( itech32_video_w ) break; case 0x2c/2: /* VIDEO_INTSCANLINE */ - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, VIDEO_INTSCANLINE, 0), 0); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, VIDEO_INTSCANLINE, 0), 0); break; case 0x32/2: /* VIDEO_VTOTAL */ @@ -1379,7 +1379,7 @@ WRITE16_HANDLER( itech32_video_w ) logerror("Configure Screen: HTOTAL: %x HBSTART: %x HBEND: %x VTOTAL: %x VBSTART: %x VBEND: %x\n", VIDEO_HTOTAL, VIDEO_HBLANK_START, VIDEO_HBLANK_END, VIDEO_VTOTAL, VIDEO_VBLANK_START, VIDEO_VBLANK_END); - video_screen_configure(0, VIDEO_HTOTAL, VIDEO_VTOTAL, &visarea, HZ_TO_ATTOSECONDS(VIDEO_CLOCK) * VIDEO_HTOTAL * VIDEO_VTOTAL); + video_screen_configure(machine->primary_screen, VIDEO_HTOTAL, VIDEO_VTOTAL, &visarea, HZ_TO_ATTOSECONDS(VIDEO_CLOCK) * VIDEO_HTOTAL * VIDEO_VTOTAL); } break; } @@ -1394,7 +1394,7 @@ READ16_HANDLER( itech32_video_r ) } else if (offset == 3) { - return 0xef;/*video_screen_get_vpos(0) - 1;*/ + return 0xef;/*video_screen_get_vpos(machine->primary_screen) - 1;*/ } return itech32_video[offset]; diff --git a/src/mame/video/itech8.c b/src/mame/video/itech8.c index 08eef3d0bf4..81aba12327b 100644 --- a/src/mame/video/itech8.c +++ b/src/mame/video/itech8.c @@ -167,7 +167,7 @@ static void generate_interrupt(running_machine *machine, int state) { itech8_update_interrupts(machine, -1, state, -1); - if (FULL_LOGGING && state) logerror("------------ DISPLAY INT (%d) --------------\n", video_screen_get_vpos(0)); + if (FULL_LOGGING && state) logerror("------------ DISPLAY INT (%d) --------------\n", video_screen_get_vpos(machine->primary_screen)); } @@ -226,8 +226,8 @@ WRITE8_HANDLER( itech8_palette_w ) WRITE8_HANDLER( itech8_page_w ) { - video_screen_update_partial(0, video_screen_get_vpos(0)); - logerror("%04x:display_page = %02X (%d)\n", activecpu_get_pc(), data, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); + logerror("%04x:display_page = %02X (%d)\n", activecpu_get_pc(), data, video_screen_get_vpos(machine->primary_screen)); page_select = data; } @@ -325,7 +325,7 @@ static void perform_blit(running_machine *machine) /* debugging */ if (FULL_LOGGING) logerror("Blit: scan=%d src=%06x @ (%05x) for %dx%d ... flags=%02x\n", - video_screen_get_vpos(0), + video_screen_get_vpos(machine->primary_screen), (*itech8_grom_bank << 16) | (BLITTER_ADDRHI << 8) | BLITTER_ADDRLO, tms_state.regs[TMS34061_XYADDRESS] | ((tms_state.regs[TMS34061_XYOFFSET] & 0x300) << 8), BLITTER_WIDTH, BLITTER_HEIGHT, BLITTER_FLAGS); @@ -446,7 +446,7 @@ static TIMER_CALLBACK( blitter_done ) blit_in_progress = 0; itech8_update_interrupts(machine, -1, -1, 1); - if (FULL_LOGGING) logerror("------------ BLIT DONE (%d) --------------\n", video_screen_get_vpos(0)); + if (FULL_LOGGING) logerror("------------ BLIT DONE (%d) --------------\n", video_screen_get_vpos(machine->primary_screen)); } diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c index 0afbc89368b..ac94b570354 100644 --- a/src/mame/video/jaguar.c +++ b/src/mame/video/jaguar.c @@ -292,7 +292,7 @@ INLINE int adjust_object_timer(running_machine *machine, int vc) return FALSE; /* adjust the timer */ - timer_adjust_oneshot(object_timer, video_screen_get_time_until_pos(0, vc / 2, hdb), vc | (hdb << 16)); + timer_adjust_oneshot(object_timer, video_screen_get_time_until_pos(machine->primary_screen, vc / 2, hdb), vc | (hdb << 16)); return TRUE; } @@ -631,10 +631,10 @@ READ16_HANDLER( jaguar_tom_regs_r ) return cpu_irq_state; case HC: - return video_screen_get_hpos(0) % (Machine->screen[0].width / 2); + return video_screen_get_hpos(machine->primary_screen) % (machine->screen[0].width / 2); case VC: - return video_screen_get_vpos(0) * 2 + gpu_regs[VBE]; + return video_screen_get_vpos(machine->primary_screen) * 2 + gpu_regs[VBE]; } @@ -686,7 +686,7 @@ WRITE16_HANDLER( jaguar_tom_regs_w ) visarea.max_x = hbstart / 2 - 1; visarea.min_y = vbend / 2; visarea.max_y = vbstart / 2 - 1; - video_screen_configure(0, hperiod / 2, vperiod / 2, &visarea, HZ_TO_ATTOSECONDS((double)COJAG_PIXEL_CLOCK * 2 / hperiod / vperiod)); + video_screen_configure(machine->primary_screen, hperiod / 2, vperiod / 2, &visarea, HZ_TO_ATTOSECONDS((double)COJAG_PIXEL_CLOCK * 2 / hperiod / vperiod)); } break; } diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c index 1ee2adfc2cf..33561a61485 100644 --- a/src/mame/video/konamiic.c +++ b/src/mame/video/konamiic.c @@ -1149,6 +1149,7 @@ Registers (word-wise): ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "video/konamiic.h" #define VERBOSE 0 @@ -7465,7 +7466,7 @@ void K053250_dma(int chip, int limiter) chip_ptr = &K053250_info.chip[chip]; - current_frame = video_screen_get_frame_number(0); + current_frame = video_screen_get_frame_number(Machine->primary_screen); last_frame = chip_ptr->frame; if (limiter && current_frame == last_frame) return; // make sure we only do DMA transfer once per frame diff --git a/src/mame/video/leland.c b/src/mame/video/leland.c index 1cf965b82ac..61bfd486fe4 100644 --- a/src/mame/video/leland.c +++ b/src/mame/video/leland.c @@ -7,6 +7,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "leland.h" @@ -85,22 +86,22 @@ WRITE8_HANDLER( leland_scroll_w ) switch (offset) { case 0: - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); xscroll = (xscroll & 0xff00) | (data & 0x00ff); break; case 1: - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); xscroll = (xscroll & 0x00ff) | ((data << 8) & 0xff00); break; case 2: - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); yscroll = (yscroll & 0xff00) | (data & 0x00ff); break; case 3: - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); yscroll = (yscroll & 0x00ff) | ((data << 8) & 0xff00); break; @@ -113,7 +114,7 @@ WRITE8_HANDLER( leland_scroll_w ) WRITE8_HANDLER( leland_gfx_port_w ) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); gfxbank = data; } @@ -199,7 +200,7 @@ static void leland_vram_port_w(int offset, int data, int num) /* don't fully understand why this is needed. Isn't the video RAM just one big RAM? */ - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen) - 1); if (LOG_COMM && addr >= 0xf000) logerror("%04X:%s comm write %04X = %02X\n", activecpu_get_previouspc(), num ? "slave" : "master", addr, data); @@ -450,7 +451,7 @@ static VIDEO_UPDATE( leland ) /* set a timer to go off at the top of the frame */ if (cliprect->max_y == screen->machine->screen[scrnum].visarea.max_y) - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, dac_reset); + timer_set(video_screen_get_time_until_pos(screen, 0, 0), NULL, 0, dac_reset); return 0; } @@ -526,7 +527,7 @@ static VIDEO_UPDATE( ataxx ) /* set a timer to go off at the top of the frame */ if (cliprect->max_y == screen->machine->screen[scrnum].visarea.max_y) - timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, dac_reset); + timer_set(video_screen_get_time_until_pos(screen, 0, 0), NULL, 0, dac_reset); return 0; } diff --git a/src/mame/video/lemmings.c b/src/mame/video/lemmings.c index 07ded3d931e..70e195e6ef9 100644 --- a/src/mame/video/lemmings.c +++ b/src/mame/video/lemmings.c @@ -38,7 +38,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta y = spritedata[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spritedata[offs+2]; colour = (x >>9) & 0xf; diff --git a/src/mame/video/lockon.c b/src/mame/video/lockon.c index e9fc52abba5..671d5cd5d30 100644 --- a/src/mame/video/lockon.c +++ b/src/mame/video/lockon.c @@ -118,7 +118,7 @@ static TIMER_CALLBACK( cursor_callback ) if (lockon_main_inten) cpunum_set_input_line_and_vector(machine, MAIN_CPU, 0, HOLD_LINE, 0xff); - timer_adjust_oneshot(cursor_timer, video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), 0); + timer_adjust_oneshot(cursor_timer, video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), 0); } /************************************* @@ -950,7 +950,7 @@ VIDEO_START( lockon ) /* Timer for the CRTC cursor pulse */ cursor_timer = timer_alloc(cursor_callback, NULL); - timer_adjust_oneshot(cursor_timer, video_screen_get_time_until_pos(0, CURSOR_YPOS, CURSOR_XPOS), 0); + timer_adjust_oneshot(cursor_timer, video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), 0); } VIDEO_UPDATE( lockon ) diff --git a/src/mame/video/madmotor.c b/src/mame/video/madmotor.c index fae7756509a..d1849048f69 100644 --- a/src/mame/video/madmotor.c +++ b/src/mame/video/madmotor.c @@ -243,7 +243,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan for (y = 0;y < h;y++) { if ((color & pri_mask) == pri_val && - (!flash || (video_screen_get_frame_number(0) & 1))) + (!flash || (video_screen_get_frame_number(machine->primary_screen) & 1))) drawgfx(bitmap,machine->gfx[3], code - y * incy + h * x, color, diff --git a/src/mame/video/meadows.c b/src/mame/video/meadows.c index e2ebee5dea8..a6d5295159c 100644 --- a/src/mame/video/meadows.c +++ b/src/mame/video/meadows.c @@ -63,7 +63,7 @@ WRITE8_HANDLER( meadows_videoram_w ) WRITE8_HANDLER( meadows_spriteram_w ) { - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); spriteram[offset] = data; } diff --git a/src/mame/video/midvunit.c b/src/mame/video/midvunit.c index ab17a586a0a..d9966f6a86f 100644 --- a/src/mame/video/midvunit.c +++ b/src/mame/video/midvunit.c @@ -61,7 +61,7 @@ static TIMER_CALLBACK( scanline_timer_cb ) if (scanline != -1) { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline + 1, 0), scanline); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline + 1, 0), scanline); timer_set(ATTOTIME_IN_HZ(25000000), NULL, -1, scanline_timer_cb); } else @@ -421,7 +421,7 @@ WRITE32_HANDLER( midvunit_page_control_w ) video_changed = TRUE; if (LOG_DMA && input_code_pressed(KEYCODE_L)) logerror("##########################################################\n"); - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); } page_control = data; } @@ -449,7 +449,7 @@ WRITE32_HANDLER( midvunit_video_control_w ) /* update the scanline timer */ if (offset == 0) - timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, (data & 0x1ff) + 1, 0), data & 0x1ff); + timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, (data & 0x1ff) + 1, 0), data & 0x1ff); /* if something changed, update our parameters */ if (old != video_regs[offset] && video_regs[6] != 0 && video_regs[11] != 0) @@ -461,14 +461,14 @@ WRITE32_HANDLER( midvunit_video_control_w ) visarea.max_x = (video_regs[6] + video_regs[2] - video_regs[5]) % video_regs[6]; visarea.min_y = 0; visarea.max_y = (video_regs[11] + video_regs[7] - video_regs[10]) % video_regs[11]; - video_screen_configure(0, video_regs[6], video_regs[11], &visarea, HZ_TO_ATTOSECONDS(MIDVUNIT_VIDEO_CLOCK / 2) * video_regs[6] * video_regs[11]); + video_screen_configure(machine->primary_screen, video_regs[6], video_regs[11], &visarea, HZ_TO_ATTOSECONDS(MIDVUNIT_VIDEO_CLOCK / 2) * video_regs[6] * video_regs[11]); } } READ32_HANDLER( midvunit_scanline_r ) { - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); } diff --git a/src/mame/video/midyunit.c b/src/mame/video/midyunit.c index 8797137b1b0..d29a8b92a56 100644 --- a/src/mame/video/midyunit.c +++ b/src/mame/video/midyunit.c @@ -582,5 +582,5 @@ void midyunit_scanline_update(running_machine *machine, int screen, bitmap_t *bi /* if this is the last update of the screen, set a timer to clear out the final line */ /* (since we update one behind) */ if (scanline == machine->screen[0].visarea.max_y) - timer_set(video_screen_get_time_until_pos(0, scanline + 1, 0), NULL, params->rowaddr, autoerase_line); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline + 1, 0), NULL, params->rowaddr, autoerase_line); } diff --git a/src/mame/video/midzeus.c b/src/mame/video/midzeus.c index 2f0fef5610a..e687497fbc8 100644 --- a/src/mame/video/midzeus.c +++ b/src/mame/video/midzeus.c @@ -373,18 +373,18 @@ READ32_HANDLER( zeus_r ) switch (offset & ~1) { case 0xf0: - result = video_screen_get_hpos(0); + result = video_screen_get_hpos(machine->primary_screen); logit = 0; break; case 0xf2: - result = video_screen_get_vpos(0); + result = video_screen_get_vpos(machine->primary_screen); logit = 0; break; case 0xf4: result = 6; - if (video_screen_get_vblank(0)) + if (video_screen_get_vblank(machine->primary_screen)) result |= 0x800; logit = 0; break; @@ -526,7 +526,7 @@ static void zeus_register16_w(offs_t offset, UINT16 data, int logit) { /* writes to register $CC need to force a partial update */ if ((offset & ~1) == 0xcc) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); /* write to high part on odd addresses */ if (offset & 1) @@ -550,7 +550,7 @@ static void zeus_register32_w(offs_t offset, UINT32 data, int logit) { /* writes to register $CC need to force a partial update */ if ((offset & ~1) == 0xcc) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); /* always write to low word? */ zeusbase[offset & ~1] = data; @@ -717,7 +717,7 @@ static void zeus_register_update(offs_t offset) case 0xc6: case 0xc8: case 0xca: - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); { int vtotal = zeusbase[0xca] >> 16; int htotal = zeusbase[0xc6] >> 16; @@ -729,7 +729,7 @@ static void zeus_register_update(offs_t offset) visarea.max_y = zeusbase[0xc8] & 0xffff; if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) { - video_screen_configure(0, htotal, vtotal, &visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 8.0 / (htotal * vtotal))); + video_screen_configure(Machine->primary_screen, htotal, vtotal, &visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 8.0 / (htotal * vtotal))); zeus_cliprect = visarea; zeus_cliprect.max_x -= zeus_cliprect.min_x; zeus_cliprect.min_x = 0; @@ -738,7 +738,7 @@ static void zeus_register_update(offs_t offset) break; case 0xcc: - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); log_fifo = input_code_pressed(KEYCODE_L); break; diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c index 373ec6f9369..a0c31606c36 100644 --- a/src/mame/video/midzeus2.c +++ b/src/mame/video/midzeus2.c @@ -5,6 +5,7 @@ **************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "eminline.h" #include "cpu/tms32031/tms32031.h" #include "includes/midzeus.h" @@ -440,7 +441,7 @@ READ32_HANDLER( zeus2_r ) /* bits $00080000 is tested in a loop until 0 */ /* bit $00000004 is tested for toggling; probably VBLANK */ result = 0x00; - if (video_screen_get_vblank(0)) + if (video_screen_get_vblank(machine->primary_screen)) result |= 0x04; break; @@ -451,7 +452,7 @@ READ32_HANDLER( zeus2_r ) case 0x54: /* both upper 16 bits and lower 16 bits seem to be used as vertical counters */ - result = (video_screen_get_vpos(0) << 16) | video_screen_get_vpos(0); + result = (video_screen_get_vpos(machine->primary_screen) << 16) | video_screen_get_vpos(machine->primary_screen); break; } @@ -510,7 +511,7 @@ if (regdata_count[offset] < 256) /* writes to register $CC need to force a partial update */ // if ((offset & ~1) == 0xcc) -// video_screen_update_partial(0, video_screen_get_vpos(0)); +// video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* always write to low word? */ zeusbase[offset] = data; @@ -561,7 +562,7 @@ static void zeus_register_update(offs_t offset, UINT32 oldval, int logit) case 0x35: case 0x36: case 0x37: - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); { int vtotal = zeusbase[0x37] & 0xffff; int htotal = zeusbase[0x34] >> 16; @@ -573,7 +574,7 @@ static void zeus_register_update(offs_t offset, UINT32 oldval, int logit) visarea.max_y = zeusbase[0x35] & 0xffff; if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) { - video_screen_configure(0, htotal, vtotal, &visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); + video_screen_configure(Machine->primary_screen, htotal, vtotal, &visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); zeus_cliprect = visarea; zeus_cliprect.max_x -= zeus_cliprect.min_x; zeus_cliprect.min_x = 0; @@ -585,7 +586,7 @@ static void zeus_register_update(offs_t offset, UINT32 oldval, int logit) { UINT32 temp = zeusbase[0x38]; zeusbase[0x38] = oldval; - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); log_fifo = input_code_pressed(KEYCODE_L); zeusbase[0x38] = temp; } diff --git a/src/mame/video/model1.c b/src/mame/video/model1.c index 4392d0b57b4..861fac46a1e 100644 --- a/src/mame/video/model1.c +++ b/src/mame/video/model1.c @@ -1151,9 +1151,9 @@ static int get_list_number(void) return listctl[0] & 0x40 ? 0 : 1; } -static void end_frame(void) +static void end_frame(running_machine *machine) { - if((listctl[0] & 4) && (video_screen_get_frame_number(0) & 1)) + if((listctl[0] & 4) && (video_screen_get_frame_number(machine->primary_screen) & 1)) listctl[0] ^= 0x40; } @@ -1526,6 +1526,6 @@ VIDEO_UPDATE(model1) VIDEO_EOF(model1) { tgp_scan(); - end_frame(); + end_frame(machine); LOG_TGP(("TGP: vsync\n")); } diff --git a/src/mame/video/mystston.c b/src/mame/video/mystston.c index a0dc3ec3b39..97c59af615c 100644 --- a/src/mame/video/mystston.c +++ b/src/mame/video/mystston.c @@ -57,7 +57,7 @@ static TIMER_CALLBACK( interrupt_callback ) scanline = FIRST_INT_VPOS; /* the vertical synch chain is clocked by H256 -- this is probably not important, but oh well */ - timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(0, scanline - 1, INT_HPOS), scanline); + timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline - 1, INT_HPOS), scanline); } @@ -242,7 +242,7 @@ static VIDEO_RESET( mystston ) { mystston_state *state = machine->driver_data; - timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(0, FIRST_INT_VPOS - 1, INT_HPOS), FIRST_INT_VPOS); + timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, FIRST_INT_VPOS - 1, INT_HPOS), FIRST_INT_VPOS); } diff --git a/src/mame/video/n8080.c b/src/mame/video/n8080.c index 7aa7ee2c97e..93aac6626c5 100644 --- a/src/mame/video/n8080.c +++ b/src/mame/video/n8080.c @@ -193,7 +193,7 @@ VIDEO_UPDATE( spacefev ) 6, /* cyan */ }; - int cycle = video_screen_get_frame_number(0) / 32; + int cycle = video_screen_get_frame_number(screen) / 32; color = ufo_color[cycle % 6]; } @@ -368,7 +368,7 @@ VIDEO_UPDATE( helifire ) VIDEO_EOF( helifire ) { - int n = (video_screen_get_frame_number(0) >> 1) % sizeof helifire_LSFR; + int n = (video_screen_get_frame_number(machine->primary_screen) >> 1) % sizeof helifire_LSFR; int i; @@ -385,7 +385,7 @@ VIDEO_EOF( helifire ) G |= B; } - if (video_screen_get_frame_number(0) & 0x04) + if (video_screen_get_frame_number(machine->primary_screen) & 0x04) { R |= G; } diff --git a/src/mame/video/nbmj9195.c b/src/mame/video/nbmj9195.c index 8b55a0cac37..a049de9db75 100644 --- a/src/mame/video/nbmj9195.c +++ b/src/mame/video/nbmj9195.c @@ -132,7 +132,7 @@ static void nbmj9195_blitter_w(int vram, int offset, int data) break; case 0x01: nbmj9195_scrollx[vram] = (nbmj9195_scrollx[vram] & 0x0100) | data; break; case 0x02: nbmj9195_scrollx[vram] = (nbmj9195_scrollx[vram] & 0x00ff) | ((data << 8) & 0x0100); - new_line = video_screen_get_vpos(0); + new_line = video_screen_get_vpos(Machine->primary_screen); if (nbmj9195_flipscreen[vram]) { for ( ; nbmj9195_scanline[vram] < new_line; nbmj9195_scanline[vram]++) diff --git a/src/mame/video/neogeo.c b/src/mame/video/neogeo.c index edd67e5840e..6415dc26126 100644 --- a/src/mame/video/neogeo.c +++ b/src/mame/video/neogeo.c @@ -245,13 +245,12 @@ static TIMER_CALLBACK( auto_animation_timer_callback ) if (auto_animation_frame_counter == 0) { auto_animation_frame_counter = auto_animation_speed; - auto_animation_counter = auto_animation_counter + 1; } else auto_animation_frame_counter = auto_animation_frame_counter - 1; - timer_adjust_oneshot(auto_animation_timer, video_screen_get_time_until_pos(0, NEOGEO_VSSTART, 0), 0); + timer_adjust_oneshot(auto_animation_timer, video_screen_get_time_until_pos(machine->primary_screen, NEOGEO_VSSTART, 0), 0); } @@ -261,9 +260,9 @@ static void create_auto_animation_timer(void) } -static void start_auto_animation_timer(void) +static void start_auto_animation_timer(running_machine *machine) { - timer_adjust_oneshot(auto_animation_timer, video_screen_get_time_until_pos(0, NEOGEO_VSSTART, 0), 0); + timer_adjust_oneshot(auto_animation_timer, video_screen_get_time_until_pos(machine->primary_screen, NEOGEO_VSSTART, 0), 0); } @@ -666,14 +665,14 @@ static TIMER_CALLBACK( sprite_line_timer_callback ) /* we are at the beginning of a scanline - we need to draw the previous scanline and parse the sprites on the current one */ if (scanline != 0) - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); parse_sprites(scanline); /* let's come back at the beginning of the next line */ scanline = (scanline + 1) % NEOGEO_VTOTAL; - timer_adjust_oneshot(sprite_line_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline); + timer_adjust_oneshot(sprite_line_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), scanline); } @@ -683,9 +682,9 @@ static void create_sprite_line_timer(void) } -static void start_sprite_line_timer(void) +static void start_sprite_line_timer(running_machine *machine) { - timer_adjust_oneshot(sprite_line_timer, video_screen_get_time_until_pos(0, 0, 0), 0); + timer_adjust_oneshot(sprite_line_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); } @@ -751,7 +750,7 @@ static void optimize_sprite_data(void) * *************************************/ -static UINT16 get_video_control(void) +static UINT16 get_video_control(running_machine *machine) { UINT16 ret; UINT16 v_counter; @@ -778,7 +777,7 @@ static UINT16 get_video_control(void) */ /* the vertical counter chain goes from 0xf8 - 0x1ff */ - v_counter = video_screen_get_vpos(0) + 0x100; + v_counter = video_screen_get_vpos(machine->primary_screen) + 0x100; if (v_counter >= 0x200) v_counter = v_counter - NEOGEO_VTOTAL; @@ -818,7 +817,7 @@ READ16_HANDLER( neogeo_video_register_r ) case 0x00: case 0x01: ret = get_videoram_data(); break; case 0x02: ret = get_videoram_modulo(); break; - case 0x03: ret = get_video_control(); break; + case 0x03: ret = get_video_control(machine); break; } } @@ -913,8 +912,8 @@ VIDEO_START( neogeo ) VIDEO_RESET( neogeo ) { - start_sprite_line_timer(); - start_auto_animation_timer(); + start_sprite_line_timer(machine); + start_auto_animation_timer(machine); } diff --git a/src/mame/video/pktgaldx.c b/src/mame/video/pktgaldx.c index 4543b9f98d8..50046b4a34d 100644 --- a/src/mame/video/pktgaldx.c +++ b/src/mame/video/pktgaldx.c @@ -19,7 +19,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/video/ppu2c0x.c b/src/mame/video/ppu2c0x.c index 11134060bff..cd1915e066d 100644 --- a/src/mame/video/ppu2c0x.c +++ b/src/mame/video/ppu2c0x.c @@ -25,6 +25,7 @@ NES-specific: ******************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "profiler.h" #include "video/ppu2c0x.h" @@ -855,7 +856,7 @@ static TIMER_CALLBACK( scanline_callback ) /* increment our scanline count */ this_ppu->scanline++; -//logerror("starting scanline %d (MAME %d, beam %d)\n", this_ppu->scanline, video_screen_get_vpos(0), video_screen_get_hpos(0)); +//logerror("starting scanline %d (MAME %d, beam %d)\n", this_ppu->scanline, video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); /* Note: this is called at the _end_ of each scanline */ if (this_ppu->scanline == PPU_VBLANK_FIRST_SCANLINE) @@ -925,7 +926,7 @@ logerror("vlbank ending\n"); timer_adjust_oneshot(this_ppu->hblank_timer, ATTOTIME_IN_CYCLES(86.67, 0), num); // ??? FIXME - hardcoding NTSC, need better calculation // trigger again at the start of the next scanline - timer_adjust_oneshot(this_ppu->scanline_timer, video_screen_get_time_until_pos(0, next_scanline * this_ppu->scan_scale, 0), num); + timer_adjust_oneshot(this_ppu->scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, next_scanline * this_ppu->scan_scale, 0), num); } /************************************* @@ -956,7 +957,7 @@ void ppu2c0x_reset(int num, int scan_scale ) timer_adjust_oneshot(chips[num].hblank_timer, ATTOTIME_IN_CYCLES(86.67, 0), num); // ??? FIXME - hardcoding NTSC, need better calculation // Call us back at the start of the next scanline - timer_adjust_oneshot(chips[num].scanline_timer, video_screen_get_time_until_pos(0, 1, 0), num); + timer_adjust_oneshot(chips[num].scanline_timer, video_screen_get_time_until_pos(Machine->primary_screen, 1, 0), num); /* reset the callbacks */ chips[num].scanline_callback_proc = 0; @@ -1103,7 +1104,7 @@ void ppu2c0x_w( int num, offs_t offset, UINT8 data ) #ifdef MAME_DEBUG if (this_ppu->scanline <= PPU_BOTTOM_VISIBLE_SCANLINE) - logerror(" PPU register %d write %02x during non-vblank scanline %d (MAME %d, beam pos: %d)\n", offset, data, this_ppu->scanline, video_screen_get_vpos(0), video_screen_get_hpos(0)); + logerror(" PPU register %d write %02x during non-vblank scanline %d (MAME %d, beam pos: %d)\n", offset, data, this_ppu->scanline, video_screen_get_vpos(Machine->primary_screen), video_screen_get_hpos(Machine->primary_screen)); #endif switch( offset & 7 ) diff --git a/src/mame/video/psx.c b/src/mame/video/psx.c index 28f3f046317..f650f941aec 100644 --- a/src/mame/video/psx.c +++ b/src/mame/video/psx.c @@ -418,51 +418,39 @@ static void DebugMeshEnd( void ) static void DebugCheckKeys( void ) { if( input_code_pressed_once( KEYCODE_M ) ) - { m_b_debugmesh = !m_b_debugmesh; - } + if( input_code_pressed_once( KEYCODE_V ) ) - { m_b_debugtexture = !m_b_debugtexture; - } + if( m_b_debugmesh || m_b_debugtexture ) - { - video_screen_set_visarea(0, 0, Machine->screen[0].width - 1, 0, Machine->screen[0].height - 1 ); - } + video_screen_set_visarea(Machine->primary_screen, 0, Machine->screen[0].width - 1, 0, Machine->screen[0].height - 1 ); else - { - video_screen_set_visarea(0, 0, m_n_screenwidth - 1, 0, m_n_screenheight - 1 ); - } + video_screen_set_visarea(Machine->primary_screen, 0, m_n_screenwidth - 1, 0, m_n_screenheight - 1 ); if( input_code_pressed_once( KEYCODE_I ) ) { if( m_b_debugtexture ) { m_n_debuginterleave++; + if( m_n_debuginterleave == 2 ) - { m_n_debuginterleave = -1; - } + if( m_n_debuginterleave == -1 ) - { popmessage( "interleave off" ); - } else if( m_n_debuginterleave == 0 ) - { popmessage( "4 bit interleave" ); - } else if( m_n_debuginterleave == 1 ) - { popmessage( "8 bit interleave" ); - } } else { m_n_debugskip++; + if( m_n_debugskip > 15 ) - { m_n_debugskip = 0; - } + popmessage( "debug skip %d", m_n_debugskip ); } } @@ -474,12 +462,8 @@ static void DebugCheckKeys( void ) int n_x; f = fopen( "dump.txt", "w" ); for( n_y = 256; n_y < 512; n_y++ ) - { for( n_x = 640; n_x < 1024; n_x++ ) - { fprintf( f, "%04u,%04u = %04x\n", n_y, n_x, m_p_p_vram[ n_y ][ n_x ] ); - } - } fclose( f ); } if( input_code_pressed_once( KEYCODE_S ) ) @@ -488,9 +472,7 @@ static void DebugCheckKeys( void ) popmessage( "saving..." ); f = fopen( "VRAM.BIN", "wb" ); for( n_y = 0; n_y < 1024; n_y++ ) - { fwrite( m_p_p_vram[ n_y ], 1024 * 2, 1, f ); - } fclose( f ); } if( input_code_pressed_once( KEYCODE_L ) ) @@ -499,9 +481,7 @@ static void DebugCheckKeys( void ) popmessage( "loading..." ); f = fopen( "VRAM.BIN", "rb" ); for( n_y = 0; n_y < 1024; n_y++ ) - { fread( m_p_p_vram[ n_y ], 1024 * 2, 1, f ); - } fclose( f ); } #endif @@ -624,7 +604,7 @@ static void updatevisiblearea( void ) visarea.min_x = visarea.min_y = 0; visarea.max_x = m_n_screenwidth - 1; visarea.max_y = m_n_screenheight - 1; - video_screen_configure(0, m_n_screenwidth, m_n_screenheight, &visarea, HZ_TO_ATTOSECONDS(refresh)); + video_screen_configure(Machine->primary_screen, m_n_screenwidth, m_n_screenheight, &visarea, HZ_TO_ATTOSECONDS(refresh)); } static void psx_gpu_init( void ) diff --git a/src/mame/video/qix.c b/src/mame/video/qix.c index dfe83be0ce9..fa699322903 100644 --- a/src/mame/video/qix.c +++ b/src/mame/video/qix.c @@ -125,7 +125,7 @@ static WRITE8_HANDLER( qix_videoram_w ) /* update the screen in case the game is writing "behind" the beam - Zookeeper likes to do this */ - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); /* add in the upper bit of the address latch */ offset += (state->videoram_address[0] & 0x80) << 8; @@ -141,7 +141,7 @@ static WRITE8_HANDLER( slither_videoram_w ) /* update the screen in case the game is writing "behind" the beam - Zookeeper likes to do this */ - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); /* add in the upper bit of the address latch */ offset += (state->videoram_address[0] & 0x80) << 8; @@ -182,7 +182,7 @@ static WRITE8_HANDLER( qix_addresslatch_w ) qix_state *state = machine->driver_data; /* update the screen in case the game is writing "behind" the beam */ - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); /* compute the value at the address latch */ offset = (state->videoram_address[0] << 8) | state->videoram_address[1]; @@ -197,7 +197,7 @@ static WRITE8_HANDLER( slither_addresslatch_w ) qix_state *state = machine->driver_data; /* update the screen in case the game is writing "behind" the beam */ - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); /* compute the value at the address latch */ offset = (state->videoram_address[0] << 8) | state->videoram_address[1]; @@ -229,7 +229,7 @@ static WRITE8_HANDLER( qix_paletteram_w ) /* trigger an update if a currently visible pen has changed */ if (((offset >> 8) == state->palette_bank) && (old_data != data)) - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); } @@ -240,7 +240,7 @@ WRITE8_HANDLER( qix_palettebank_w ) /* set the bank value */ if (state->palette_bank != (data & 3)) { - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); state->palette_bank = data & 3; } diff --git a/src/mame/video/rohga.c b/src/mame/video/rohga.c index 6a3376afb1c..ae05dc27ee8 100644 --- a/src/mame/video/rohga.c +++ b/src/mame/video/rohga.c @@ -91,7 +91,7 @@ static void rohga_draw_sprites(running_machine *machine, bitmap_t *bitmap, const y = spriteptr[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; // Sprite colour is different between Rohga (6bpp) and Schmeisr (4bpp plus wire mods on pcb) if (is_schmeisr) @@ -190,7 +190,7 @@ static void wizdfire_draw_sprites(running_machine *machine, bitmap_t *bitmap, co y = spriteptr[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; colour = (x >> 9) &0x1f; if (bank==4 && colour&0x10) { @@ -297,7 +297,7 @@ Sprites 2: w = (spriteptr[offs+2]&0x0f00)>> 8; sy = spriteptr[offs]; - if ((sy&0x2000) && (video_screen_get_frame_number(0) & 1)) { + if ((sy&0x2000) && (video_screen_get_frame_number(machine->primary_screen) & 1)) { offs+=inc; continue; } diff --git a/src/mame/video/rpunch.c b/src/mame/video/rpunch.c index 53bee97bf5e..2dcf9c2769e 100644 --- a/src/mame/video/rpunch.c +++ b/src/mame/video/rpunch.c @@ -79,7 +79,7 @@ static TIMER_CALLBACK( crtc_interrupt_gen ) { cpunum_set_input_line(machine, 0, 1, HOLD_LINE); if (param != 0) - timer_adjust_periodic(crtc_timer, attotime_div(video_screen_get_frame_period(0), param), 0, attotime_div(video_screen_get_frame_period(0), param)); + timer_adjust_periodic(crtc_timer, attotime_div(video_screen_get_frame_period(machine->primary_screen), param), 0, attotime_div(video_screen_get_frame_period(machine->primary_screen), param)); } @@ -165,7 +165,7 @@ WRITE16_HANDLER( rpunch_crtc_data_w ) { /* only register we know about.... */ case 0x0b: - timer_adjust_oneshot(crtc_timer, video_screen_get_time_until_pos(0, Machine->screen[0].visarea.max_y + 1, 0), (data == 0xc0) ? 2 : 1); + timer_adjust_oneshot(crtc_timer, video_screen_get_time_until_pos(machine->primary_screen, machine->screen[0].visarea.max_y + 1, 0), (data == 0xc0) ? 2 : 1); break; default: diff --git a/src/mame/video/segag80r.c b/src/mame/video/segag80r.c index c66621907b0..b871e15ea71 100644 --- a/src/mame/video/segag80r.c +++ b/src/mame/video/segag80r.c @@ -351,7 +351,7 @@ WRITE8_HANDLER( segag80r_video_port_w ) READ8_HANDLER( spaceod_back_port_r ) { /* force an update to get the current detection value */ - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); return 0xfe | spaceod_bg_detect; } @@ -404,7 +404,7 @@ WRITE8_HANDLER( spaceod_back_port_w ) /* port 3: clears the background detection flag */ case 3: - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); spaceod_bg_detect = 0; break; diff --git a/src/mame/video/segaic16.c b/src/mame/video/segaic16.c index 2cabf418a33..b9a75008965 100644 --- a/src/mame/video/segaic16.c +++ b/src/mame/video/segaic16.c @@ -498,7 +498,7 @@ void segaic16_set_display_enable(int enable) enable = (enable != 0); if (segaic16_display_enable != enable) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); segaic16_display_enable = enable; } } @@ -1179,14 +1179,14 @@ static TIMER_CALLBACK( segaic16_tilemap_16b_latch_values ) } /* set a timer to do this again next frame */ - timer_set(video_screen_get_time_until_pos(0, 261, 0), NULL, param, segaic16_tilemap_16b_latch_values); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, 261, 0), NULL, param, segaic16_tilemap_16b_latch_values); } static void segaic16_tilemap_16b_reset(struct tilemap_info *info) { /* set a timer to latch values on scanline 261 */ - timer_set(video_screen_get_time_until_pos(0, 261, 0), NULL, info->index, segaic16_tilemap_16b_latch_values); + timer_set(video_screen_get_time_until_pos(Machine->primary_screen, 261, 0), NULL, info->index, segaic16_tilemap_16b_latch_values); } @@ -1347,7 +1347,7 @@ void segaic16_tilemap_set_bank(int which, int banknum, int offset) if (info->bank[banknum] != offset) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); info->bank[banknum] = offset; tilemap_mark_all_tiles_dirty(NULL); } @@ -1369,7 +1369,7 @@ void segaic16_tilemap_set_flip(int which, int flip) flip = (flip != 0); if (info->flip != flip) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); info->flip = flip; tilemap_set_flip(info->textmap, flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); for (pagenum = 0; pagenum < info->numpages; pagenum++) @@ -1392,7 +1392,7 @@ void segaic16_tilemap_set_rowscroll(int which, int enable) enable = (enable != 0); if (info->rowscroll != enable) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); info->rowscroll = enable; } } @@ -1412,7 +1412,7 @@ void segaic16_tilemap_set_colscroll(int which, int enable) enable = (enable != 0); if (info->colscroll != enable) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); info->colscroll = enable; } } @@ -1436,7 +1436,7 @@ WRITE16_HANDLER( segaic16_textram_0_w ) { /* certain ranges need immediate updates */ if (offset >= 0xe80/2) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); COMBINE_DATA(&segaic16_textram_0[offset]); tilemap_mark_tile_dirty(bg_tilemap[0].textmap, offset); @@ -2761,7 +2761,7 @@ void segaic16_sprites_set_bank(int which, int banknum, int offset) if (info->bank[banknum] != offset) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); info->bank[banknum] = offset; } } @@ -2781,7 +2781,7 @@ void segaic16_sprites_set_flip(int which, int flip) flip = (flip != 0); if (info->flip != flip) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); info->flip = flip; } } @@ -2801,7 +2801,7 @@ void segaic16_sprites_set_shadow(int which, int shadow) shadow = (shadow != 0); if (info->shadow != shadow) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); info->shadow = shadow; } } diff --git a/src/mame/video/segas18.c b/src/mame/video/segas18.c index cbcb3d2f176..7d154325079 100644 --- a/src/mame/video/segas18.c +++ b/src/mame/video/segas18.c @@ -5,6 +5,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" #include "segaic16.h" #include "includes/system16.h" @@ -82,7 +83,7 @@ void system18_set_grayscale(int enable) enable = (enable != 0); if (enable != grayscale_enable) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); grayscale_enable = enable; // mame_printf_debug("Grayscale = %02X\n", enable); } @@ -94,7 +95,7 @@ void system18_set_vdp_enable(int enable) enable = (enable != 0); if (enable != vdp_enable) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); vdp_enable = enable; #if DEBUG_VDP mame_printf_debug("VDP enable = %02X\n", enable); @@ -107,7 +108,7 @@ void system18_set_vdp_mixing(int mixing) { if (mixing != vdp_mixing) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen)); vdp_mixing = mixing; #if DEBUG_VDP mame_printf_debug("VDP mixing = %02X\n", mixing); diff --git a/src/mame/video/segas32.c b/src/mame/video/segas32.c index 204a0370b22..439ab934ea9 100644 --- a/src/mame/video/segas32.c +++ b/src/mame/video/segas32.c @@ -2448,9 +2448,9 @@ VIDEO_UPDATE( system32 ) /* update the visible area */ if (system32_videoram[0x1ff00/2] & 0x8000) - video_screen_set_visarea(scrnum, 0, 52*8-1, 0, 28*8-1); + video_screen_set_visarea(screen, 0, 52*8-1, 0, 28*8-1); else - video_screen_set_visarea(scrnum, 0, 40*8-1, 0, 28*8-1); + video_screen_set_visarea(screen, 0, 40*8-1, 0, 28*8-1); /* if the display is off, punt */ if (!system32_displayenable[scrnum]) @@ -2627,9 +2627,9 @@ VIDEO_UPDATE( multi32 ) /* update the visible area */ if (system32_videoram[0x1ff00/2] & 0x8000) - video_screen_set_visarea(scrnum, 0, 52*8-1, 0, 28*8-1); + video_screen_set_visarea(screen, 0, 52*8-1, 0, 28*8-1); else - video_screen_set_visarea(scrnum, 0, 40*8-1, 0, 28*8-1); + video_screen_set_visarea(screen, 0, 40*8-1, 0, 28*8-1); /* if the display is off, punt */ if (!system32_displayenable[scrnum]) diff --git a/src/mame/video/simpl156.c b/src/mame/video/simpl156.c index fe22a7c021b..54345ed578f 100644 --- a/src/mame/video/simpl156.c +++ b/src/mame/video/simpl156.c @@ -50,7 +50,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram32[offs]&0xffff; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram32[offs+2]&0xffff; colour = (x >>9) & 0x1f; diff --git a/src/mame/video/skullxbo.c b/src/mame/video/skullxbo.c index a7ecbefff35..9ea2e55b5eb 100644 --- a/src/mame/video/skullxbo.c +++ b/src/mame/video/skullxbo.c @@ -111,7 +111,7 @@ WRITE16_HANDLER( skullxbo_xscroll_w ) /* if something changed, force an update */ if (oldscroll != newscroll) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* adjust the actual scrolls */ tilemap_set_scrollx(atarigen_playfield_tilemap, 0, 2 * (newscroll >> 7)); @@ -125,7 +125,7 @@ WRITE16_HANDLER( skullxbo_xscroll_w ) WRITE16_HANDLER( skullxbo_yscroll_w ) { /* combine data */ - int scanline = video_screen_get_vpos(0); + int scanline = video_screen_get_vpos(machine->primary_screen); UINT16 oldscroll = *atarigen_yscroll; UINT16 newscroll = oldscroll; UINT16 effscroll; @@ -133,7 +133,7 @@ WRITE16_HANDLER( skullxbo_yscroll_w ) /* if something changed, force an update */ if (oldscroll != newscroll) - video_screen_update_partial(0, scanline); + video_screen_update_partial(machine->primary_screen, scanline); /* adjust the effective scroll for the current scanline */ if (scanline > Machine->screen[0].visarea.max_y) @@ -158,7 +158,7 @@ WRITE16_HANDLER( skullxbo_yscroll_w ) WRITE16_HANDLER( skullxbo_mobmsb_w ) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); atarimo_set_bank(0, (offset >> 9) & 1); } @@ -213,7 +213,7 @@ void skullxbo_scanline_update(int scanline) int newscroll = ((data >> 7) - scanline) & 0x1ff; /* force a partial update with the previous scroll */ - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(Machine->primary_screen, scanline - 1); /* update the new scroll */ tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll); diff --git a/src/mame/video/spacefb.c b/src/mame/video/spacefb.c index 88b0b187035..6d50c2d308c 100644 --- a/src/mame/video/spacefb.c +++ b/src/mame/video/spacefb.c @@ -12,17 +12,9 @@ UINT8 *spacefb_videoram; size_t spacefb_videoram_size; - static UINT8 *object_present_map; -static UINT8 flipscreen; -static UINT8 gfx_bank; -static UINT8 palette_bank; -static UINT8 background_red; -static UINT8 background_blue; -static UINT8 disable_star_field; -static UINT8 color_contrast_r; -static UINT8 color_contrast_g; -static UINT8 color_contrast_b; +static UINT8 port_0; +static UINT8 port_2; static UINT32 star_shift_reg; static double color_weights_rg[3], color_weights_b[2]; @@ -31,79 +23,21 @@ static double color_weights_rg[3], color_weights_b[2]; /************************************* * - * Port bit setters + * Port setters * *************************************/ -void spacefb_set_flip_screen(UINT8 data) -{ - flipscreen = data; - - video_screen_update_now(0); -} - - -void spacefb_set_gfx_bank(UINT8 data) -{ - gfx_bank = data; - - video_screen_update_now(0); -} - - -void spacefb_set_palette_bank(UINT8 data) -{ - palette_bank = data; - - video_screen_update_now(0); -} - - -void spacefb_set_background_red(UINT8 data) -{ - background_red = data; - - video_screen_update_now(0); -} - - -void spacefb_set_background_blue(UINT8 data) -{ - background_blue = data; - - video_screen_update_now(0); -} - - -void spacefb_set_disable_star_field(UINT8 data) -{ - disable_star_field = data; - - video_screen_update_now(0); -} - - -void spacefb_set_color_contrast_r(UINT8 data) -{ - color_contrast_r = data; - - video_screen_update_now(0); -} - - -void spacefb_set_color_contrast_g(UINT8 data) +WRITE8_HANDLER( spacefb_port_0_w ) { - color_contrast_g = data; - - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); + port_0 = data; } -void spacefb_set_color_contrast_b(UINT8 data) +WRITE8_HANDLER( spacefb_port_2_w ) { - color_contrast_b = data; - - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); + port_2 = data; } @@ -184,14 +118,21 @@ static void get_starfield_pens(pen_t *pens) /* generate the pens based on the various enable bits */ int i; + int color_contrast_r = port_2 & 0x01; + int color_contrast_g = port_2 & 0x02; + int color_contrast_b = port_2 & 0x04; + int background_red = port_2 & 0x08; + int background_blue = port_2 & 0x10; + int disable_star_field = port_2 & 0x80; + for (i = 0; i < NUM_STARFIELD_PENS; i++) { - UINT8 gb = ((i >> 0) & 0x01) & color_contrast_g & !disable_star_field; - UINT8 ga = ((i >> 1) & 0x01) & !disable_star_field; - UINT8 bb = ((i >> 2) & 0x01) & color_contrast_b & !disable_star_field; - UINT8 ba = (((i >> 3) & 0x01) | background_blue) & !disable_star_field; - UINT8 ra = (((i >> 4) & 0x01) | background_red) & !disable_star_field; - UINT8 rb = ((i >> 5) & 0x01) & color_contrast_r & !disable_star_field; + UINT8 gb = ((i >> 0) & 0x01) && color_contrast_g && !disable_star_field; + UINT8 ga = ((i >> 1) & 0x01) && !disable_star_field; + UINT8 bb = ((i >> 2) & 0x01) && color_contrast_b && !disable_star_field; + UINT8 ba = (((i >> 3) & 0x01) || background_blue) && !disable_star_field; + UINT8 ra = (((i >> 4) & 0x01) || background_red) && !disable_star_field; + UINT8 rb = ((i >> 5) & 0x01) && color_contrast_r && !disable_star_field; UINT8 r = combine_3_weights(color_weights_rg, 0, rb, ra); UINT8 g = combine_3_weights(color_weights_rg, 0, gb, ga); @@ -199,7 +140,6 @@ static void get_starfield_pens(pen_t *pens) pens[i] = MAKE_RGB(r, g, b); } - } @@ -282,7 +222,7 @@ static void get_sprite_pens(pen_t *pens) for (i = 0; i < NUM_SPRITE_PENS; i++) { - UINT8 data = memory_region(REGION_PROMS)[(palette_bank << 4) | (i & 0x0f)]; + UINT8 data = memory_region(REGION_PROMS)[((port_0 & 0x40) >> 2) | (i & 0x0f)]; UINT8 r0 = (data >> 0) & 0x01; UINT8 r1 = (data >> 1) & 0x01; @@ -314,7 +254,7 @@ static void get_sprite_pens(pen_t *pens) } -static void draw_bullet(offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_bullet(offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangle *cliprect, int flip) { UINT8 sy; @@ -330,7 +270,7 @@ static void draw_bullet(offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangl UINT8 data = gfx[(code << 2) | sy]; UINT8 x = spacefb_videoram[offs + 0x0000]; - if (flipscreen) + if (flip) dy = ~y; else dy = y; @@ -343,7 +283,7 @@ static void draw_bullet(offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangl { UINT16 dx; - if (flipscreen) + if (flip) dx = (255 - x) * 2; else dx = x * 2; @@ -365,7 +305,7 @@ static void draw_bullet(offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangl } -static void draw_sprite(offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprite(offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectangle *cliprect, int flip) { UINT8 sy; @@ -384,7 +324,7 @@ static void draw_sprite(offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectan UINT8 x = spacefb_videoram[offs + 0x0000] - 3; - if (flipscreen) + if (flip) dy = ~y; else dy = y; @@ -397,7 +337,7 @@ static void draw_sprite(offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectan UINT8 data; pen_t pen; - if (flipscreen) + if (flip) dx = (255 - x) * 2; else dx = x * 2; @@ -426,7 +366,8 @@ static void draw_objects(bitmap_t *bitmap, const rectangle *cliprect) { pen_t sprite_pens[NUM_SPRITE_PENS]; - offs_t offs = gfx_bank ? 0x80 : 0x00; + offs_t offs = (port_0 & 0x20) ? 0x80 : 0x00; + int flip = port_0 & 0x01; /* since the way the schematics show the bullet color connected is impossible, just use pure red for now */ @@ -439,9 +380,9 @@ static void draw_objects(bitmap_t *bitmap, const rectangle *cliprect) while (1) { if (spacefb_videoram[offs + 0x0300] & 0x20) - draw_bullet(offs, bullet_pen, bitmap, cliprect); + draw_bullet(offs, bullet_pen, bitmap, cliprect, flip); else if (spacefb_videoram[offs + 0x0300] & 0x40) - draw_sprite(offs, sprite_pens, bitmap, cliprect); + draw_sprite(offs, sprite_pens, bitmap, cliprect, flip); /* next object */ offs = offs + 1; diff --git a/src/mame/video/spdodgeb.c b/src/mame/video/spdodgeb.c index b29850817c5..8f6c4155e37 100644 --- a/src/mame/video/spdodgeb.c +++ b/src/mame/video/spdodgeb.c @@ -99,12 +99,12 @@ INTERRUPT_GEN( spdodgeb_interrupt ) if (iloop > 1 && iloop < 32) { cpunum_set_input_line(machine, 0, M6502_IRQ_LINE, HOLD_LINE); - video_screen_update_partial(0, scanline+7); + video_screen_update_partial(machine->primary_screen, scanline+7); } else if (!iloop) { cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); - video_screen_update_partial(0, 256); + video_screen_update_partial(machine->primary_screen, 256); } } diff --git a/src/mame/video/sprint8.c b/src/mame/video/sprint8.c index d6dee438c03..dda2b9e68e9 100644 --- a/src/mame/video/sprint8.c +++ b/src/mame/video/sprint8.c @@ -193,7 +193,7 @@ VIDEO_EOF( sprint8 ) for (x = machine->screen[0].visarea.min_x; x <= machine->screen[0].visarea.max_x; x++) if (p1[x] != 0x20 && p2[x] == 0x23) - timer_set(video_screen_get_time_until_pos(0, y + 24, x), NULL, + timer_set(video_screen_get_time_until_pos(machine->primary_screen, y + 24, x), NULL, colortable_entry_get_value(machine->colortable, p1[x]), sprint8_collision_callback); } diff --git a/src/mame/video/sshangha.c b/src/mame/video/sshangha.c index e00e152f96a..f6d9453d833 100644 --- a/src/mame/video/sshangha.c +++ b/src/mame/video/sshangha.c @@ -71,7 +71,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta y = spritesrc[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spritesrc[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/video/ssv.c b/src/mame/video/ssv.c index 4e868284cdb..c50ca58b1cf 100644 --- a/src/mame/video/ssv.c +++ b/src/mame/video/ssv.c @@ -370,7 +370,7 @@ char eaglshot_dirty, *eaglshot_dirty_tile; READ16_HANDLER( ssv_vblank_r ) { - if (video_screen_get_vblank(0)) + if (video_screen_get_vblank(machine->primary_screen)) return 0x2000 | 0x1000; else return 0x0000; diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c index 52b253de646..f85552445aa 100644 --- a/src/mame/video/st0016.c +++ b/src/mame/video/st0016.c @@ -470,13 +470,13 @@ VIDEO_START( st0016 ) switch(st0016_game&0x3f) { case 0: //renju kizoku - video_screen_set_visarea(0, 0, 40*8-1, 0, 30*8-1); + video_screen_set_visarea(machine->primary_screen, 0, 40*8-1, 0, 30*8-1); spr_dx=0; spr_dy=0; break; case 1: //neratte chu! - video_screen_set_visarea(0, 8,41*8-1,0,30*8-1); + video_screen_set_visarea(machine->primary_screen, 8,41*8-1,0,30*8-1); spr_dx=0; spr_dy=8; break; @@ -486,15 +486,15 @@ VIDEO_START( st0016 ) break; case 4: //mayjinsen 1&2 - video_screen_set_visarea(0, 0,32*8-1,0,28*8-1); + video_screen_set_visarea(machine->primary_screen, 0,32*8-1,0,28*8-1); break; case 10: - video_screen_set_visarea(0, 0,383,0,255); + video_screen_set_visarea(machine->primary_screen, 0,383,0,255); break; case 11: - video_screen_set_visarea(0, 0,383,0,383); + video_screen_set_visarea(machine->primary_screen, 0,383,0,383); break; } diff --git a/src/mame/video/stadhero.c b/src/mame/video/stadhero.c index 6c80a41188d..42e8a7d828e 100644 --- a/src/mame/video/stadhero.c +++ b/src/mame/video/stadhero.c @@ -36,7 +36,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan if ((colour & pri_mask) != pri_val) continue; flash=x&0x800; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; fx = y & 0x2000; fy = y & 0x4000; diff --git a/src/mame/video/starfire.c b/src/mame/video/starfire.c index d39948f6678..2dcf9aac09b 100644 --- a/src/mame/video/starfire.c +++ b/src/mame/video/starfire.c @@ -79,7 +79,7 @@ WRITE8_HANDLER( starfire_colorram_w ) /* don't modify the palette unless the TRANS bit is set */ if (starfire_vidctrl1 & 0x40) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); starfire_colors[palette_index] = ((((data << 1) & 0x06) | ((offset >> 8) & 0x01)) << 6) | (((data >> 5) & 0x07) << 3) | diff --git a/src/mame/video/starshp1.c b/src/mame/video/starshp1.c index f0388d366fe..d39f483ac56 100644 --- a/src/mame/video/starshp1.c +++ b/src/mame/video/starshp1.c @@ -115,8 +115,8 @@ VIDEO_START( starshp1 ) READ8_HANDLER( starshp1_rng_r ) { - int x = video_screen_get_hpos(0); - int y = video_screen_get_vpos(0); + int x = video_screen_get_hpos(machine->primary_screen); + int y = video_screen_get_vpos(machine->primary_screen); /* the LFSR is only running in the non-blank region of the screen, so this is not quite right */ diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index f5219da4f48..6f4aa46b73d 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -5338,7 +5338,7 @@ static void stv_vdp2_dynamic_res_change() case 7: horz = 704; vert = 480; break; } - video_screen_set_visarea(0, 0*8, horz-1,0*8, vert-1); + video_screen_set_visarea(Machine->primary_screen, 0*8, horz-1,0*8, vert-1); //if(LOG_VDP2) popmessage("%04d %04d",horz-1,vert-1); } diff --git a/src/mame/video/supbtime.c b/src/mame/video/supbtime.c index 85d12eb00fd..dac657bdbe1 100644 --- a/src/mame/video/supbtime.c +++ b/src/mame/video/supbtime.c @@ -30,7 +30,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/video/tank8.c b/src/mame/video/tank8.c index 2a7565e8f33..0cad5b3db1b 100644 --- a/src/mame/video/tank8.c +++ b/src/mame/video/tank8.c @@ -234,7 +234,7 @@ VIDEO_EOF( tank8 ) const UINT16* p2 = BITMAP_ADDR16(helper2, y, 0); const UINT16* p3 = BITMAP_ADDR16(helper3, y, 0); - if (y % 2 != video_screen_get_frame_number(0) % 2) + if (y % 2 != video_screen_get_frame_number(machine->primary_screen) % 2) continue; /* video display is interlaced */ for (x = clip->min_x; x <= clip->max_x; x++) @@ -293,7 +293,7 @@ VIDEO_EOF( tank8 ) index |= 0x80; /* collision on right side */ } - timer_set(video_screen_get_time_until_pos(0, y, x), NULL, index, tank8_collision_callback); + timer_set(video_screen_get_time_until_pos(machine->primary_screen, y, x), NULL, index, tank8_collision_callback); state = 1; } diff --git a/src/mame/video/tceptor.c b/src/mame/video/tceptor.c index b399fb73160..e7a73960935 100644 --- a/src/mame/video/tceptor.c +++ b/src/mame/video/tceptor.c @@ -561,7 +561,7 @@ VIDEO_UPDATE( tceptor ) if (screen) { - int frame = video_screen_get_frame_number(scrnum); + int frame = video_screen_get_frame_number(screen); if ((frame & 1) == 1 && scrnum == 1) return UPDATE_HAS_NOT_CHANGED; diff --git a/src/mame/video/timeplt.c b/src/mame/video/timeplt.c index 20a71eece4b..02d7c15d085 100644 --- a/src/mame/video/timeplt.c +++ b/src/mame/video/timeplt.c @@ -146,7 +146,7 @@ WRITE8_HANDLER( timeplt_flipscreen_w ) READ8_HANDLER( timeplt_scanline_r ) { - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); } diff --git a/src/mame/video/toaplan1.c b/src/mame/video/toaplan1.c index 8e4ff505fdd..6718ebac9e8 100644 --- a/src/mame/video/toaplan1.c +++ b/src/mame/video/toaplan1.c @@ -430,7 +430,7 @@ VIDEO_START( toaplan1 ) READ16_HANDLER( toaplan1_frame_done_r ) { - return video_screen_get_vblank(0); + return video_screen_get_vblank(machine->primary_screen); } WRITE16_HANDLER( toaplan1_tile_offsets_w ) diff --git a/src/mame/video/toki.c b/src/mame/video/toki.c index ac85ef05a7f..f920a207802 100644 --- a/src/mame/video/toki.c +++ b/src/mame/video/toki.c @@ -32,9 +32,8 @@ remove all the code writing the $a0000 area.) WRITE16_HANDLER( toki_control_w ) { + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen) - 1); COMBINE_DATA(&toki_scrollram16[offset]); - - video_screen_update_partial(0, video_screen_get_vpos(0) - 1); } VIDEO_EOF( toki ) diff --git a/src/mame/video/toobin.c b/src/mame/video/toobin.c index 64537ebc7f9..54fe6a7da86 100644 --- a/src/mame/video/toobin.c +++ b/src/mame/video/toobin.c @@ -167,7 +167,7 @@ WRITE16_HANDLER( toobin_xscroll_w ) /* if anything has changed, force a partial update */ if (newscroll != oldscroll) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* update the playfield scrolling - hscroll is clocked on the following scanline */ tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll >> 6); @@ -186,7 +186,7 @@ WRITE16_HANDLER( toobin_yscroll_w ) /* if anything has changed, force a partial update */ if (newscroll != oldscroll) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* if bit 4 is zero, the scroll value is clocked in right away */ tilemap_set_scrolly(atarigen_playfield_tilemap, 0, newscroll >> 6); @@ -212,7 +212,7 @@ WRITE16_HANDLER( toobin_slip_w ) /* if the SLIP is changing, force a partial update first */ if (oldslip != newslip) - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); /* update the data */ atarimo_0_slipram_w(machine, offset, data, mem_mask); diff --git a/src/mame/video/tp84.c b/src/mame/video/tp84.c index 620db66a60d..3c54243d14c 100644 --- a/src/mame/video/tp84.c +++ b/src/mame/video/tp84.c @@ -116,7 +116,7 @@ PALETTE_INIT( tp84 ) WRITE8_HANDLER( tp84_spriteram_w ) { /* the game multiplexes the sprites, so update now */ - video_screen_update_now(0); + video_screen_update_now(machine->primary_screen); tp84_spriteram[offset] = data; } @@ -124,7 +124,7 @@ WRITE8_HANDLER( tp84_spriteram_w ) READ8_HANDLER( tp84_scanline_r ) { /* reads 1V - 128V */ - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); } diff --git a/src/mame/video/triplhnt.c b/src/mame/video/triplhnt.c index 238d9054ec9..4f9515a4db1 100644 --- a/src/mame/video/triplhnt.c +++ b/src/mame/video/triplhnt.c @@ -63,9 +63,7 @@ static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const recta int code = triplhnt_code_ram[j] ^ 255; if (hpos == 255) - { continue; - } /* sprite placement might be wrong */ @@ -119,18 +117,14 @@ static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const recta } if (a != 1) - { *BITMAP_ADDR16(bitmap, y, x) = a; - } } } } } if (hit_line != 999 && hit_code != 999) - { - timer_set(video_screen_get_time_until_pos(0, hit_line, 0), NULL, hit_code, triplhnt_hit_callback); - } + timer_set(video_screen_get_time_until_pos(machine->primary_screen, hit_line, 0), NULL, hit_code, triplhnt_hit_callback); } diff --git a/src/mame/video/tumbleb.c b/src/mame/video/tumbleb.c index 40eaff15c78..8215f21706e 100644 --- a/src/mame/video/tumbleb.c +++ b/src/mame/video/tumbleb.c @@ -42,7 +42,7 @@ static void tumblepb_draw_sprites(running_machine *machine, bitmap_t *bitmap,con y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0xf; @@ -104,7 +104,7 @@ static void jumpkids_draw_sprites(running_machine *machine, bitmap_t *bitmap,con y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0xf; @@ -166,7 +166,7 @@ static void fncywld_draw_sprites(running_machine *machine, bitmap_t *bitmap,cons y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0x3f; diff --git a/src/mame/video/tumblep.c b/src/mame/video/tumblep.c index 6f51123f230..c52141b422a 100644 --- a/src/mame/video/tumblep.c +++ b/src/mame/video/tumblep.c @@ -29,7 +29,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan y = spriteram16[offs]; flash=y&0x1000; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; x = spriteram16[offs+2]; colour = (x >>9) & 0x1f; diff --git a/src/mame/video/turbo.c b/src/mame/video/turbo.c index 4a086ba4a16..d935a03d842 100644 --- a/src/mame/video/turbo.c +++ b/src/mame/video/turbo.c @@ -209,7 +209,7 @@ WRITE8_HANDLER( turbo_videoram_w ) state->videoram[offset] = data; if (offset < 0x400) { - video_screen_update_partial(0, video_screen_get_vpos(0)); + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); tilemap_mark_tile_dirty(state->fg_tilemap, offset); } } diff --git a/src/mame/video/vaportra.c b/src/mame/video/vaportra.c index 64b61843b88..bf8ba02cd13 100644 --- a/src/mame/video/vaportra.c +++ b/src/mame/video/vaportra.c @@ -98,7 +98,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta if (!pri && !(colour>=priority_value)) continue; flash=x&0x800; - if (flash && (video_screen_get_frame_number(0) & 1)) continue; + if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue; fx = y & 0x2000; fy = y & 0x4000; diff --git a/src/mame/video/vicdual.c b/src/mame/video/vicdual.c index 5d15189267f..33b85a25bc8 100644 --- a/src/mame/video/vicdual.c +++ b/src/mame/video/vicdual.c @@ -26,8 +26,7 @@ static const pen_t pens_from_color_prom[] = WRITE8_HANDLER( vicdual_palette_bank_w ) { - video_screen_update_partial(0, video_screen_get_vpos(0)); - + video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen)); palette_bank = data & 3; } diff --git a/src/mame/video/victory.c b/src/mame/video/victory.c index de260bac5cf..dbbe1394f1e 100644 --- a/src/mame/video/victory.c +++ b/src/mame/video/victory.c @@ -198,7 +198,7 @@ READ8_HANDLER( victory_video_control_r ) result |= (~fgcoll & 1) << 6; result |= (~vblank_irq & 1) << 5; result |= (~bgcoll & 1) << 4; - result |= (video_screen_get_vpos(0) & 0x100) >> 5; + result |= (video_screen_get_vpos(machine->primary_screen) & 0x100) >> 5; if (LOG_COLLISION) logerror("%04X:5STAT read = %02X\n", activecpu_get_previouspc(), result); return result; @@ -1126,7 +1126,7 @@ VIDEO_UPDATE( victory ) int bpix = bg[(x + scrollx) & 255]; scanline[x] = bpix | (fpix << 3); if (fpix && (bpix & bgcollmask) && count++ < 128) - timer_set(video_screen_get_time_until_pos(0, y, x), NULL, x | (y << 8), bgcoll_irq_callback); + timer_set(video_screen_get_time_until_pos(screen, y, x), NULL, x | (y << 8), bgcoll_irq_callback); } /* draw the scanline */ diff --git a/src/mame/video/vindictr.c b/src/mame/video/vindictr.c index 87ad4e80a29..fd5d7186051 100644 --- a/src/mame/video/vindictr.c +++ b/src/mame/video/vindictr.c @@ -165,7 +165,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(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); playfield_tile_bank = data & 7; tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap); } @@ -174,7 +174,7 @@ void vindictr_scanline_update(running_machine *machine, int scrnum, int scanline case 3: /* /PFHSLD */ if (playfield_xscroll != (data & 0x1ff)) { - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, data); playfield_xscroll = data & 0x1ff; } @@ -183,7 +183,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(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); atarimo_set_xscroll(0, data & 0x1ff); } break; @@ -204,7 +204,7 @@ void vindictr_scanline_update(running_machine *machine, int scrnum, int scanline if (playfield_yscroll != ((data - offset) & 0x1ff)) { - video_screen_update_partial(0, scanline - 1); + video_screen_update_partial(machine->primary_screen, scanline - 1); tilemap_set_scrolly(atarigen_playfield_tilemap, 0, data - offset); atarimo_set_yscroll(0, (data - offset) & 0x1ff); } diff --git a/src/mame/video/williams.c b/src/mame/video/williams.c index 71e42a9b903..42317789958 100644 --- a/src/mame/video/williams.c +++ b/src/mame/video/williams.c @@ -398,13 +398,13 @@ WRITE8_HANDLER( williams2_fg_select_w ) READ8_HANDLER( williams_video_counter_r ) { - return video_screen_get_vpos(0) & 0xfc; + return video_screen_get_vpos(machine->primary_screen) & 0xfc; } READ8_HANDLER( williams2_video_counter_r ) { - return video_screen_get_vpos(0); + return video_screen_get_vpos(machine->primary_screen); } @@ -582,7 +582,7 @@ WRITE8_HANDLER( williams_blitter_w ) /* Log blits */ logerror("%04X:Blit @ %3d : %02X%02X -> %02X%02X, %3dx%3d, mask=%02X, flags=%02X, icount=%d, win=%d\n", - activecpu_get_pc(), video_screen_get_vpos(0), + activecpu_get_pc(), video_screen_get_vpos(machine->primary_screen), blitterram[2], blitterram[3], blitterram[4], blitterram[5], blitterram[6], blitterram[7], diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c index 083425a6d23..05c186714b4 100644 --- a/src/mame/video/ygv608.c +++ b/src/mame/video/ygv608.c @@ -764,7 +764,7 @@ VIDEO_UPDATE( ygv608 ) #ifdef _ENABLE_SCREEN_RESIZE // hdw should be scaled by 16, not 8 // - is it something to do with double dot-clocks??? - video_screen_set_visarea(0, 0, ((int)(ygv608.regs.s.hdw)<<3/*4*/)-1, + video_screen_set_visarea(screen, 0, ((int)(ygv608.regs.s.hdw)<<3/*4*/)-1, 0, ((int)(ygv608.regs.s.vdw)<<3)-1 ); #endif diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index 11145e2b2bb..c1805de19dc 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -1238,7 +1238,7 @@ static int get_adapter_for_monitor(d3d_info *d3d, win_monitor_info *monitor) static void pick_best_mode(win_window_info *window) { - double target_refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds); + double target_refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds); INT32 target_width, target_height; d3d_info *d3d = window->drawdata; INT32 minwidth, minheight; diff --git a/src/osd/windows/drawdd.c b/src/osd/windows/drawdd.c index 53bc572fe68..2492e2dce79 100644 --- a/src/osd/windows/drawdd.c +++ b/src/osd/windows/drawdd.c @@ -1304,7 +1304,7 @@ static void pick_best_mode(win_window_info *window) // use those as the target for now einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale); einfo.target_height = einfo.minimum_height * MAX(1, video_config.prescale); - einfo.target_refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(0).attoseconds); + einfo.target_refresh = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds); // if we're not stretching, allow some slop on the minimum since we can handle it if (!video_config.hwstretch) |
