示例#1
0
文件: wwfsstar.c 项目: nitrologic/emu
static TIMER_DEVICE_CALLBACK( wwfsstar_scanline )
{
	int scanline = param;

	/* Vblank is lowered on scanline 0 */
	if (scanline == 0)
	{
		vblank = 0;
	}
	/* Hack */
	else if (scanline == (240-1))		/* -1 is an hack needed to avoid deadlocks */
	{
		vblank = 1;
	}

	/* An interrupt is generated every 16 scanlines */
	if (scanline % 16 == 0)
	{
		if (scanline > 0)
			video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
		cputag_set_input_line(timer->machine, "maincpu", 5, ASSERT_LINE);
	}

	/* Vblank is raised on scanline 240 */
	if (scanline == 240)
	{
		video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
		cputag_set_input_line(timer->machine, "maincpu", 6, ASSERT_LINE);
	}
}
示例#2
0
static INTERRUPT_GEN( m107_raster_interrupt )
{
	int line = 256 - cpu_getiloops();

	if (code_pressed_memory(KEYCODE_F1)) {
		raster_enable ^= 1;
		if (raster_enable)
			popmessage("Raster IRQ enabled");
		else
			popmessage("Raster IRQ disabled");
	}

	/* Raster interrupt */
	if (raster_enable && line==m107_raster_irq_position) {
		video_screen_update_partial(0, line);
		cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, m107_IRQ_2);
	}

	/* Kludge to get Fire Barrel running */
	else if (line==118)
	{
		cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, m107_IRQ_3);
	}

	/* Redraw screen, then set vblank and trigger the VBL interrupt */
	else if (line==248) {
		video_screen_update_partial(0, 248);
		m107_vblank=1;
		cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, m107_IRQ_0);
	}

	/* End of vblank */
	else if (line==255)
		m107_vblank=0;
}
示例#3
0
void atarig1_scanline_update(running_device *screen, int scanline)
{
	atarig1_state *state = (atarig1_state *)screen->machine->driver_data;
	UINT16 *base = &state->atarigen.alpha[(scanline / 8) * 64 + 48];
	int i;

	//if (scanline == 0) logerror("-------\n");

	/* keep in range */
	if (base >= &state->atarigen.alpha[0x800])
		return;
	video_screen_update_partial(screen, MAX(scanline - 1, 0));

	/* update the playfield scrolls */
	for (i = 0; i < 8; i++)
	{
		UINT16 word;

		/* first word controls horizontal scroll */
		word = *base++;
		if (word & 0x8000)
		{
			int newscroll = ((word >> 6) + state->pfscroll_xoffset) & 0x1ff;
			if (newscroll != state->playfield_xscroll)
			{
				video_screen_update_partial(screen, MAX(scanline + i - 1, 0));
				tilemap_set_scrollx(state->atarigen.playfield_tilemap, 0, newscroll);
				state->playfield_xscroll = newscroll;
			}
		}

		/* second word controls vertical scroll and tile bank */
		word = *base++;
		if (word & 0x8000)
		{
			int newscroll = ((word >> 6) - (scanline + i)) & 0x1ff;
			int newbank = word & 7;
			if (newscroll != state->playfield_yscroll)
			{
				video_screen_update_partial(screen, MAX(scanline + i - 1, 0));
				tilemap_set_scrolly(state->atarigen.playfield_tilemap, 0, newscroll);
				state->playfield_yscroll = newscroll;
			}
			if (newbank != state->playfield_tile_bank)
			{
				video_screen_update_partial(screen, MAX(scanline + i - 1, 0));
				tilemap_mark_all_tiles_dirty(state->atarigen.playfield_tilemap);
				state->playfield_tile_bank = newbank;
			}
		}
示例#4
0
void atarig1_scanline_update(int scanline)
{
	UINT16 *base = &atarigen_alpha[(scanline / 8) * 64 + 48];
	int i;

	//if (scanline == 0) logerror("-------\n");

	/* keep in range */
	if (base >= &atarigen_alpha[0x800])
		return;

	/* update the playfield scrolls */
	for (i = 0; i < 8; i++)
	{
		UINT16 word;

		/* first word controls horizontal scroll */
		word = *base++;
		if (word & 0x8000)
		{
			int newscroll = ((word >> 6) + pfscroll_xoffset) & 0x1ff;
			if (newscroll != playfield_xscroll)
			{
				video_screen_update_partial(0, scanline + i - 1);
				tilemap_set_scrollx(atarigen_playfield_tilemap, 0, newscroll);
				playfield_xscroll = newscroll;
			}
		}

		/* second word controls vertical scroll and tile bank */
		word = *base++;
		if (word & 0x8000)
		{
			int newscroll = ((word >> 6) - (scanline + i)) & 0x1ff;
			int newbank = word & 7;
			if (newscroll != playfield_yscroll)
			{
				video_screen_update_partial(0, 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);
				tilemap_mark_all_tiles_dirty(atarigen_playfield_tilemap);
				playfield_tile_bank = newbank;
			}
		}
示例#5
0
static void capbowl_update(int scan)
{
	video_screen_update_partial(0, scan - 1);
	scan += 32;
	if (scan > 240) scan = 32;
	timer_set(cpu_getscanlinetime(scan), scan, capbowl_update);
}
示例#6
0
static TIMER_CALLBACK( capbowl_update )
{
	int scanline = param;

	video_screen_update_partial(machine->primary_screen, scanline - 1);
	scanline += 32;
	if (scanline > 240) scanline = 32;
	timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, capbowl_update);
}
示例#7
0
void system18_set_grayscale(running_machine *machine, int enable)
{
	enable = (enable != 0);
	if (enable != grayscale_enable)
	{
		video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen));
		grayscale_enable = enable;
//      mame_printf_debug("Grayscale = %02X\n", enable);
	}
}
示例#8
0
void system18_set_grayscale(int enable)
{
	enable = (enable != 0);
	if (enable != grayscale_enable)
	{
		video_screen_update_partial(0, cpu_getscanline());
		grayscale_enable = enable;
//      mame_printf_debug("Grayscale = %02X\n", enable);
	}
}
示例#9
0
void system18_set_vdp_mixing(int mixing)
{
	if (mixing != vdp_mixing)
	{
		video_screen_update_partial(0, cpu_getscanline());
		vdp_mixing = mixing;
#if DEBUG_VDP
		mame_printf_debug("VDP mixing = %02X\n", mixing);
#endif
	}
}
示例#10
0
void system18_set_vdp_mixing(running_machine *machine, int mixing)
{
	if (mixing != vdp_mixing)
	{
		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);
#endif
	}
}
示例#11
0
void system18_set_vdp_enable(int enable)
{
	enable = (enable != 0);
	if (enable != vdp_enable)
	{
		video_screen_update_partial(0, cpu_getscanline());
		vdp_enable = enable;
#if DEBUG_VDP
		mame_printf_debug("VDP enable = %02X\n", enable);
#endif
	}
}
示例#12
0
void system18_set_vdp_enable(running_machine *machine, int enable)
{
	enable = (enable != 0);
	if (enable != vdp_enable)
	{
		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);
#endif
	}
}
示例#13
0
static WRITE8_HANDLER( register_w )
{
	int regnum = offset >> 2;

	/* certain registers affect the display directly */
	if ((regnum >= TMS34061_HORENDSYNC && regnum <= TMS34061_DISPSTART) ||
		(regnum == TMS34061_CONTROL2))
		video_screen_update_partial(0, cpu_getscanline());

	/* store the hi/lo half */
	if (offset & 0x02)
		tms34061.regs[regnum] = (tms34061.regs[regnum] & 0x00ff) | (data << 8);
	else
		tms34061.regs[regnum] = (tms34061.regs[regnum] & 0xff00) | data;

	/* log it */
	if (VERBOSE) logerror("%04X:tms34061 %s = %04X\n", activecpu_get_pc(), regnames[regnum], tms34061.regs[regnum]);

	/* update the state of things */
	switch (regnum)
	{
		/* vertical interrupt: adjust the timer */
		case TMS34061_VERINT:
			timer_adjust(tms34061.timer, get_verint_scanline_time(), 0, 0);
			break;

		/* XY offset: set the X and Y masks */
		case TMS34061_XYOFFSET:
			switch (tms34061.regs[TMS34061_XYOFFSET] & 0x00ff)
			{
				case 0x01:	tms34061.yshift = 2;	break;
				case 0x02:	tms34061.yshift = 3;	break;
				case 0x04:	tms34061.yshift = 4;	break;
				case 0x08:	tms34061.yshift = 5;	break;
				case 0x10:	tms34061.yshift = 6;	break;
				case 0x20:	tms34061.yshift = 7;	break;
				case 0x40:	tms34061.yshift = 8;	break;
				case 0x80:	tms34061.yshift = 9;	break;
				default:	logerror("Invalid value for XYOFFSET = %04x\n", tms34061.regs[TMS34061_XYOFFSET]);	break;
			}
			tms34061.xmask = (1 << tms34061.yshift) - 1;
			break;

		/* CONTROL1: they could have turned interrupts on */
		case TMS34061_CONTROL1:
			update_interrupts();
			break;

		/* other supported registers */
		case TMS34061_XYADDRESS:
			break;
	}
}
示例#14
0
static void clock_irq(int param)
{
	/* assert the IRQ if not already asserted */
	if (!irq_state)
	{
		cpunum_set_input_line(0, 0, ASSERT_LINE);
		irq_state = 1;
	}

	/* force an update now */
	video_screen_update_partial(0, video_screen_get_vpos(0));

	/* find the next edge */
	schedule_next_irq(param);
}
示例#15
0
static void interrupt_common(void)
{
	int i,next;

	video_screen_update_partial(0, CurrentScan);

	next = (CurrentScan + 1) % MAX_INT_PER_FRAME;
	for (i = 0;i < 8;i++)
		colors[next][i] = colors[CurrentScan][i];
	for (i = 0;i < 4;i++)
		sparkle[next][i] = sparkle[CurrentScan][i];
	colorsplit[next] = colorsplit[CurrentScan];

	CurrentScan = next;
}
示例#16
0
static TIMER_CALLBACK( clock_irq )
{
    /* assert the IRQ if not already asserted */
    if (!irq_state)
    {
        cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
        irq_state = 1;
    }

    /* force an update now */
    video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen));

    /* find the next edge */
    schedule_next_irq(machine, param);
}
示例#17
0
static TIMER_CALLBACK( namcos2_68k_slave_posirq )
{
	video_screen_update_partial(0, param);
	cpunum_set_input_line(CPU_SLAVE , namcos2_68k_slave_C148[NAMCOS2_C148_POSIRQ] , ASSERT_LINE);
}
示例#18
0
ADDRESS_MAP_END


static TIMER_CALLBACK( rjammer_scanline_callback )
{
	int scanline = param;

curr_scanline = scanline;//for debugging


	/* CPU #0 interrupt */
	/* activates at the start of VBLANK signal which happens at the beginning of scaline number 240 */
	if (scanline==240)
	{
		logerror("VBLANK CPU#0\n");
		cpunum_set_input_line(0, 0, ASSERT_LINE);
	}


	/* CPU #1 interrupt */
	/* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
	if (scanline==16)
	{
		logerror("/VBLANK CPU#1\n");
		cpunum_set_input_line(1, 0, HOLD_LINE);
	}


	/* CPU #3 MS2010-A NMI */
	/* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
	if (scanline==16)
	{
		logerror("/nmi CPU#3\n");
		tubep_vblank_end(); /* switch buffered sprite RAM page */
		cpunum_set_input_line(3, INPUT_LINE_NMI, ASSERT_LINE);
	}
	/* CPU #3 MS2010-A NMI */
	/* deactivates at the start of VBLANK signal which happens at the beginning of scanline number 240*/
	if (scanline==240)
	{
		logerror("CPU#3 nmi clear\n");
		cpunum_set_input_line(3, INPUT_LINE_NMI, CLEAR_LINE);
	}


	/* sound CPU interrupt */
	/* activates whenever line V6 from video part goes lo->hi that is when the scanline becomes 64 and 192 */
	if ((scanline==64) || (scanline==192))
	{
		cpunum_set_input_line(2,0,ASSERT_LINE);	/* sound cpu interrupt (music tempo) */
	}


	video_screen_update_partial(0, video_screen_get_vpos(0));

logerror("scanline=%3i scrgetvpos(0)=%3i\n",scanline,video_screen_get_vpos(0));

	scanline ++;
	if (scanline>=264)
		scanline=0;

	timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline, attotime_zero);
}
示例#19
0
static INTERRUPT_GEN( m107_interrupt )
{
	m107_vblank=0;
	video_screen_update_partial(0, 248+128);
	cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, m107_IRQ_0); /* VBL */
}
示例#20
0
void batman_scanline_update(const device_config *screen, int scanline)
{
	/* update the scanline parameters */
	if (scanline <= video_screen_get_visible_area(screen)->max_y && atarivc_state.rowscroll_enable)
	{
		UINT16 *base = &atarigen_alpha[scanline / 8 * 64 + 48];
		int scan, i;

		for (scan = 0; scan < 8; scan++, scanline++)
			for (i = 0; i < 2; i++)
			{
				int data = *base++;
				switch (data & 15)
				{
					case 9:
						if (scanline > 0)
							video_screen_update_partial(screen, scanline - 1);
						atarivc_state.mo_xscroll = (data >> 7) & 0x1ff;
						atarimo_set_xscroll(0, atarivc_state.mo_xscroll);
						break;

					case 10:
						if (scanline > 0)
							video_screen_update_partial(screen, scanline - 1);
						atarivc_state.pf1_xscroll_raw = (data >> 7) & 0x1ff;
						atarivc_update_pf_xscrolls();
						tilemap_set_scrollx(atarigen_playfield_tilemap, 0, atarivc_state.pf0_xscroll);
						tilemap_set_scrollx(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_xscroll);
						break;

					case 11:
						if (scanline > 0)
							video_screen_update_partial(screen, scanline - 1);
						atarivc_state.pf0_xscroll_raw = (data >> 7) & 0x1ff;
						atarivc_update_pf_xscrolls();
						tilemap_set_scrollx(atarigen_playfield_tilemap, 0, atarivc_state.pf0_xscroll);
						break;

					case 13:
						if (scanline > 0)
							video_screen_update_partial(screen, scanline - 1);
						atarivc_state.mo_yscroll = (data >> 7) & 0x1ff;
						atarimo_set_yscroll(0, atarivc_state.mo_yscroll);
						break;

					case 14:
						if (scanline > 0)
							video_screen_update_partial(screen, scanline - 1);
						atarivc_state.pf1_yscroll = (data >> 7) & 0x1ff;
						tilemap_set_scrolly(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_yscroll);
						break;

					case 15:
						if (scanline > 0)
							video_screen_update_partial(screen, scanline - 1);
						atarivc_state.pf0_yscroll = (data >> 7) & 0x1ff;
						tilemap_set_scrolly(atarigen_playfield_tilemap, 0, atarivc_state.pf0_yscroll);
						break;
				}
			}
	}
示例#21
0
void video_frame_update(void)
{
	int skipped_it = video_skip_this_frame();
	int paused = mame_is_paused(Machine);
	int phase = mame_get_phase(Machine);
	int livemask;
	int scrnum;

	/* only render sound and video if we're in the running phase */
	if (phase == MAME_PHASE_RUNNING)
	{
		/* update sound */
		sound_frame_update();

		/* finish updating the screens */
		for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++)
			if (Machine->drv->screen[scrnum].tag != NULL)
				video_screen_update_partial(scrnum, Machine->screen[scrnum].visarea.max_y);

		/* now add the quads for all the screens */
		livemask = render_get_live_screens_mask();
		for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) {
			if (livemask & (1 << scrnum))
			{
				internal_screen_info *screen = &scrinfo[scrnum];

				/* only update if empty and not a vector game; otherwise assume the driver did it directly */
				if (render_container_is_empty(render_container_get_screen(scrnum)) && !(Machine->drv->video_attributes & VIDEO_TYPE_VECTOR))
				{
					mame_bitmap *bitmap = screen->bitmap[screen->curbitmap];
					if (!skipping_this_frame && screen->changed)
					{
						rectangle fixedvis = Machine->screen[scrnum].visarea;
						fixedvis.max_x++;
						fixedvis.max_y++;
						render_texture_set_bitmap(screen->texture, bitmap, &fixedvis, Machine->drv->screen[scrnum].palette_base, screen->format);
						screen->curbitmap = 1 - screen->curbitmap;
					}
					render_screen_add_quad(scrnum, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), screen->texture, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
				}
			}
        }

		/* update our movie recording state */
		if (!paused)
			movie_record_frame(0);

		/* reset the screen changed flags */
		for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++)
			scrinfo[scrnum].changed = 0;
	}

	/* draw any crosshairs */
	crosshair_render();

	/* draw the user interface */
	ui_update_and_render();

	/* call the OSD to update */
	skipping_this_frame = osd_update(mame_timer_get_time());

	/* empty the containers */
	for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++)
		if (Machine->drv->screen[scrnum].tag != NULL)
			render_container_empty(render_container_get_screen(scrnum));

	/* update FPS */
	recompute_fps(skipped_it);

	/* call the end-of-frame callback */
	if (phase == MAME_PHASE_RUNNING)
	{
		/* reset partial updates if we're paused or if the debugger is active */
		if (paused || mame_debug_is_active())
			video_reset_partial_updates();

		/* otherwise, call the video EOF callback */
		else if (Machine->drv->video_eof != NULL)
		{
			profiler_mark(PROFILER_VIDEO);
			(*Machine->drv->video_eof)(Machine);
			profiler_mark(PROFILER_END);
		}
	}
}
示例#22
0
static TIMER_CALLBACK( namcos2_68k_gpu_posirq )
{
	//printf( "namcos2_68k_gpu_posirq(%d)\n", param );
	video_screen_update_partial(0, param);
	cpunum_set_input_line(CPU_GPU, namcos2_68k_gpu_C148[NAMCOS2_C148_POSIRQ] , ASSERT_LINE);
}
示例#23
0
/* set the display enable bit */
void segac2_enable_display(int enable)
{
	if (!cpu_getvblank())
		video_screen_update_partial(0, cpu_getscanline());
	display_enable = enable;
}