コード例 #1
0
ファイル: crtc6845.c プロジェクト: broftkd/historic-mame
static void update_timer(crtc6845_state *chip)
{
	INT16 next_y;
	UINT16 next_x;
	attotime duration;

	if (chip->has_valid_parameters && (chip->display_enable_changed_timer != 0))
	{
		if (is_display_enabled(chip))
		{
			/* we are in a display region,
               get the location of the next blanking start */

			/* normally, it's at end the current raster line */
			next_y = video_screen_get_vpos(chip->intf->scrnum);
			next_x = chip->last_max_x + 1;

			/* but if visible width = horiz_total, then we need
               to go to the beginning of VBLANK */
			if (next_x == chip->last_horiz_total)
			{
				next_y = chip->last_max_y + 1;
				next_x = 0;

				/* abnormal case, no vertical blanking, either */
				if (next_y == chip->last_vert_total)
					next_y = -1;
			}
		}
		else
		{
			/* we are in a blanking region,
               get the location of the next display start */
			next_x = 0;
			next_y = (video_screen_get_vpos(chip->intf->scrnum) + 1) % chip->last_vert_total;

			/* if we would now fall in the vertical blanking, we need
               to go to the top of the screen */
			if (next_y > chip->last_max_y)
				next_y = 0;
		}

		if (next_y != -1)
			duration = video_screen_get_time_until_pos(chip->intf->scrnum, next_y, next_x);
		else
			duration = attotime_never;

		timer_adjust(chip->display_enable_changed_timer, duration, 0, attotime_never);
	}
}
コード例 #2
0
ファイル: wolfpack.c プロジェクト: AltimorTASDK/shmupmametgm
static READ8_HANDLER( wolfpack_misc_r )
{
	running_device *device = devtag_get_device(space->machine, "speech");
	UINT8 val = 0;

	/* BIT0 => SPEECH BUSY */
	/* BIT1 => COMP SIREN  */
	/* BIT2 => SPARE       */
	/* BIT3 => SPARE       */
	/* BIT4 => COL DETECT  */
	/* BIT5 => UNUSED      */
	/* BIT6 => UNUSED      */
	/* BIT7 => VBLANK      */

	if (!s14001a_bsy_r(device))
        val |= 0x01;

	if (!wolfpack_collision)
		val |= 0x10;

	if (video_screen_get_vpos(space->machine->primary_screen) >= 240)
		val |= 0x80;

	return val;
}
コード例 #3
0
ファイル: redalert.c プロジェクト: nitrologic/emu
static READ8_HANDLER( redalert_interrupt_clear_r )
{
	cputag_set_input_line(space->machine, "maincpu", M6502_IRQ_LINE, CLEAR_LINE);

	/* the result never seems to be actually used */
	return video_screen_get_vpos(space->machine->primary_screen);
}
コード例 #4
0
ファイル: crtc6845.c プロジェクト: broftkd/historic-mame
UINT16 crtc6845_get_ma(int which)
{
	crtc6845_state *chip = &crtc6845;

	UINT16 ret;

	if (chip->has_valid_parameters)
	{
		/* get the current raster positions and clamp them to the visible region */
		int y = video_screen_get_vpos(0);
		int x = video_screen_get_hpos(0);

		/* since the MA counter stops in the blanking regions, if we are in a
           VBLANK, both X and Y are at their max */
		if ((y > chip->last_max_y) || (x > chip->last_max_x))
			x = chip->last_max_x;

		if (y > chip->last_max_y)
			y = chip->last_max_y;

		ret = (chip->start_addr +
			   (y / (chip->max_ras_addr + 1)) * chip->horiz_disp +
			   (x / chip->intf->hpixels_per_column)) & 0x3fff;
	}
	else
		ret = 0;

	return ret;
}
コード例 #5
0
ファイル: crtc6845.c プロジェクト: broftkd/historic-mame
static int is_display_enabled(crtc6845_state *chip)
{
	UINT16 y = video_screen_get_vpos(chip->intf->scrnum);
	UINT16 x = video_screen_get_hpos(chip->intf->scrnum);

	return (y <= chip->last_max_y) && (x <= chip->last_max_x);
}
コード例 #6
0
ファイル: wolfpack.c プロジェクト: broftkd/historic-mame
static READ8_HANDLER( wolfpack_misc_r )
{
	UINT8 val = 0;

	/* BIT0 => SPEECH BUSY */
	/* BIT1 => COMP SIREN  */
	/* BIT2 => SPARE       */
	/* BIT3 => SPARE       */
	/* BIT4 => COL DETECT  */
	/* BIT5 => UNUSED      */
	/* BIT6 => UNUSED      */
	/* BIT7 => VBLANK      */

	if (!S14001A_bsy_0_r())
	{
	        val |= 0x01;
	}
	if (!wolfpack_collision)
	{
		val |= 0x10;
	}
	if (video_screen_get_vpos(0) >= 240)
	{
		val |= 0x80;
	}

	return val;
}
コード例 #7
0
ファイル: boxer.c プロジェクト: nitrologic/emu
static READ8_HANDLER( boxer_misc_r )
{
	UINT8 val = 0;

	switch (offset & 3)
	{
	case 0:
		val = pot_state & pot_latch;
		break;

	case 1:
		val = video_screen_get_vpos(space->machine->primary_screen);
		break;

	case 2:
		val = input_port_read(space->machine, "IN1");
		break;

	case 3:
		val = input_port_read(space->machine, "IN2");
		break;
	}

	return val ^ 0x3f;
}
コード例 #8
0
ファイル: tms34061.c プロジェクト: cdenix/ps3-mame-0125
static UINT8 register_r(offs_t offset)
{
    int regnum = offset >> 2;
    UINT16 result;

    /* extract the correct portion of the register */
    result = tms34061.regs[regnum];

    /* special cases: */
    switch (regnum)
    {
    /* status register: a read here clears it */
    case TMS34061_STATUS:
        tms34061.regs[TMS34061_STATUS] = 0;
        update_interrupts();
        break;

    /* vertical count register: return the current scanline */
    case TMS34061_VERCOUNTER:
        result = (video_screen_get_vpos(tms34061.screen)+ tms34061.regs[TMS34061_VERENDBLNK]) % tms34061.regs[TMS34061_VERTOTAL];
        break;
    }

    /* log it */
    if (VERBOSE) logerror("%04X:tms34061 %s read = %04X\n", activecpu_get_pc(), regnames[regnum], result);
    return (offset & 0x02) ? (result >> 8) : result;
}
コード例 #9
0
ファイル: changela.c プロジェクト: nitrologic/emu
static READ8_HANDLER( changela_2d_r )
{
	/* the schems are unreadable - i'm not sure it is V8 (page 74, SOUND I/O BOARD SCHEMATIC 1 OF 2, FIGURE 24 - in the middle on the right side) */
	int v8 = 0;
	int gas;

	if ((video_screen_get_vpos(space->machine->primary_screen) & 0xf8)==0xf8)
		v8 = 1;

	/* Gas pedal is made up of 2 switches, 1 active low, 1 active high */
	switch(input_port_read(space->machine, "IN1") & 0x03)
	{
		case 0x02:
			gas = 0x80;
			break;
		case 0x01:
			gas = 0x00;
			break;
		default:
			gas = 0x40;
			break;
	}

	return (input_port_read(space->machine, "IN1") & 0x20) | gas | (v8<<4);
}
コード例 #10
0
ファイル: blstroid.c プロジェクト: cdenix/ps3-mame-0125
void blstroid_scanline_update(const device_config *screen, int scanline)
{
	int offset = (scanline / 8) * 64 + 40;

	/* check for interrupts */
	if (offset < 0x1000)
		if (atarigen_playfield[offset] & 0x8000)
		{
			int width, vpos;
			attotime period_on;
			attotime period_off;

			/* FIXME: - the only thing this IRQ does it tweak the starting MO link */
			/* unfortunately, it does it too early for the given MOs! */
			/* perhaps it is not actually hooked up on the real PCB... */
			return;

			/* set a timer to turn the interrupt on at HBLANK of the 7th scanline */
			/* and another to turn it off one scanline later */
			width = video_screen_get_width(screen);
			vpos  = video_screen_get_vpos(screen);
			period_on  = video_screen_get_time_until_pos(screen, vpos + 7, width * 0.9);
			period_off = video_screen_get_time_until_pos(screen, vpos + 8, width * 0.9);

			timer_set(period_on, NULL,  0, irq_on);
			timer_set(period_off, NULL, 0, irq_off);
		}
}
コード例 #11
0
ファイル: sprint2.c プロジェクト: Paulodx/sdl-mame-wii
static READ8_HANDLER( sprint2_sync_r )
{
	UINT8 val = 0;

	if (attract != 0)
		val |= 0x10;

	if (video_screen_get_vpos(space->machine->primary_screen) == 261)
		val |= 0x20; /* VRESET */

	if (video_screen_get_vpos(space->machine->primary_screen) >= 224)
		val |= 0x40; /* VBLANK */

	if (video_screen_get_vpos(space->machine->primary_screen) >= 131)
		val |= 0x80; /* 60 Hz? */

	return val;
}
コード例 #12
0
ファイル: boxer.c プロジェクト: nitrologic/emu
static READ8_HANDLER( boxer_input_r )
{
	UINT8 val = input_port_read(space->machine, "IN0");

	if (input_port_read(space->machine, "IN3") < video_screen_get_vpos(space->machine->primary_screen))
		val |= 0x02;

	return (val << ((offset & 7) ^ 7)) & 0x80;
}
コード例 #13
0
ファイル: homerun.c プロジェクト: cdenix/ps3-mame-0125
	AM_RANGE(0xc000, 0xdfff) AM_RAM
ADDRESS_MAP_END

static READ8_HANDLER(homerun_40_r)
{
	if(video_screen_get_vpos(machine->primary_screen)>116)
		return input_port_read_indexed(machine, 0)|0x40;
	else
		return input_port_read_indexed(machine, 0);
}
コード例 #14
0
ファイル: homerun.c プロジェクト: broftkd/historic-mame
	AM_RANGE(0xc000, 0xdfff) AM_RAM
ADDRESS_MAP_END

static READ8_HANDLER(homerun_40_r)
{
	if(video_screen_get_vpos(0)>116)
		return input_port_0_r(0)|0x40;
	else
		return input_port_0_r(0);
}
コード例 #15
0
ファイル: segas18.c プロジェクト: Paulodx/sdl-mame-wii
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);
	}
}
コード例 #16
0
ファイル: segas18.c プロジェクト: Paulodx/sdl-mame-wii
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
	}
}
コード例 #17
0
ファイル: segas18.c プロジェクト: Paulodx/sdl-mame-wii
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
	}
}
コード例 #18
0
ファイル: skullxbo.c プロジェクト: broftkd/historic-mame
static void alpha_row_update(running_machine *machine, int scrnum, int scanline)
{
	UINT16 *check = &atarigen_alpha[(scanline / 8) * 64 + 42];

	/* check for interrupts in the alpha ram */
	/* 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);
		timer_set(period, NULL, 0, irq_gen);
	}

	/* update the playfield and motion objects */
	skullxbo_scanline_update(scanline);
}
コード例 #19
0
ファイル: cloud9.c プロジェクト: broftkd/historic-mess
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);
}
コード例 #20
0
ファイル: cloud9.c プロジェクト: cdenix/ps3-mame-0125
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);
}
コード例 #21
0
ファイル: neogeo.c プロジェクト: nitrologic/emu
static TIMER_CALLBACK( vblank_interrupt_callback )
{
	const device_config *upd4990a = devtag_get_device(machine, "upd4990a");

	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 */
	upd4990a_addretrace(upd4990a);

	vblank_interrupt_pending = 1;

	update_interrupts(machine);

	/* set timer for next screen */
	timer_adjust_oneshot(vblank_interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, NEOGEO_VBSTART, 0), 0);
}
コード例 #22
0
ファイル: neogeo.c プロジェクト: nitrologic/emu
static TIMER_CALLBACK( display_position_interrupt_callback )
{
	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(machine->primary_screen), video_screen_get_hpos(machine->primary_screen));
		display_position_interrupt_pending = 1;

		update_interrupts(machine);
	}

	if (display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_REPEAT)
	{
		if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_REPEAT ");
		adjust_display_position_interrupt_timer(machine);
	}
}
コード例 #23
0
ファイル: timer.c プロジェクト: cdenix/ps3-mame-0125
static TIMER_CALLBACK( scanline_timer_device_timer_callback )
{
	int next_vpos;
	const device_config *timer = ptr;
	timer_state *state = get_safe_token(timer);
	timer_config *config = timer->inline_config;

	/* get the screen device and verify it */
	const device_config *screen = device_list_find_by_tag(timer->machine->config->devicelist, VIDEO_SCREEN, config->screen);
	assert(screen != NULL);

	/* first time, start with the first scanline, but do not call the callback */
	if (state->first_time)
	{
		next_vpos = config->first_vpos;

		/* indicate that we are done with the first call */
		state->first_time = FALSE;
	}

	/* not the first time */
	else
	{
		int vpos = video_screen_get_vpos(screen);

		/* call the real callback */
		config->callback(timer, state->ptr, vpos);

		/* if the increment is 0 or the next scanline is larger than the screen size,
           go back to the first one */
        if ((config->increment == 0) ||
            ((vpos + config->increment) >= video_screen_get_height(screen)))
			next_vpos = config->first_vpos;

		/* otherwise, increment */
		else
			next_vpos = vpos + config->increment;
	}

	/* adjust the timer */
	timer_adjust_oneshot(state->timer, video_screen_get_time_until_pos(screen, next_vpos, 0), 0);
}
コード例 #24
0
ファイル: crtc6845.c プロジェクト: broftkd/historic-mame
UINT8 crtc6845_get_ra(int which)
{
	crtc6845_state *chip = &crtc6845;

	UINT8 ret;

	if (chip->has_valid_parameters)
	{
		/* get the current vertical raster position and clamp it to the visible region */
		int y = video_screen_get_vpos(0);

		if (y > chip->last_max_y)
			y = chip->last_max_y;

		ret = y % (chip->max_ras_addr + 1);
	}
	else
		ret = 0;

	return ret;
}
コード例 #25
0
ファイル: destroyr.c プロジェクト: Paulodx/sdl-mame-wii
static READ8_HANDLER( destroyr_scanline_r )
{
	return video_screen_get_vpos(space->machine->primary_screen);
}
コード例 #26
0
ファイル: m10.c プロジェクト: Paulodx/sdl-mame-wii
static WRITE8_DEVICE_HANDLER(ic8j1_output_changed)
{
	LOG(("ic8j1: %d %d\n", data, video_screen_get_vpos(device->machine->primary_screen)));
	cputag_set_input_line(device->machine, "maincpu", 0, !data ? CLEAR_LINE : ASSERT_LINE);
}
コード例 #27
0
ファイル: cloud9.c プロジェクト: cdenix/ps3-mame-0125
static CUSTOM_INPUT( get_vblank )
{
    int scanline = video_screen_get_vpos(machine->primary_screen);
    return (~syncprom[scanline & 0xff] >> 1) & 1;
}
コード例 #28
0
int video_screen_get_vblank(int scrnum)
{
	int vpos = video_screen_get_vpos(scrnum);
	return (vpos < Machine->screen[scrnum].visarea.min_y || vpos > Machine->screen[scrnum].visarea.max_y);
}
コード例 #29
0
ファイル: flyball.c プロジェクト: Paulodx/sdl-mame-wii
static READ8_HANDLER( flyball_scanline_r )
{
	return video_screen_get_vpos(space->machine->primary_screen) & 0x3f;
}
コード例 #30
0
ファイル: cloud9.c プロジェクト: broftkd/historic-mess
static UINT32 get_vblank(void *param)
{
	int scanline = video_screen_get_vpos(0);
	return (~syncprom[scanline & 0xff] >> 1) & 1;
}