Пример #1
0
static UINT8 port_a_r(const device_config *device)
{
	pia6821_state *p = get_token(device);

	UINT8 ret = get_in_a_value(device);

	/* IRQ flags implicitly cleared by a read */
	p->irq_a1 = FALSE;
	p->irq_a2 = FALSE;
	update_interrupts(device);

	/* CA2 is configured as output and in read strobe mode */
	if (C2_OUTPUT(p->ctl_a) && C2_STROBE_MODE(p->ctl_a))
	{
		/* this will cause a transition low */
		set_out_ca2(device, FALSE);

		/* if the CA2 strobe is cleared by the E, reset it right away */
		if (STROBE_E_RESET(p->ctl_a))
			set_out_ca2(device, TRUE);
	}

	LOG(("PIA #%s: port A read = %02X\n", device->tag, ret));

	return ret;
}
Пример #2
0
void neogeo_interrupt(void)
{
    raster_line = 0;
    raster_counter = RASTER_COUNTER_START;

    if (!auto_animation_disabled)
    {
        if (auto_animation_frame_counter == 0)
        {
            auto_animation_frame_counter = auto_animation_speed;
            auto_animation_counter++;
        }
        else auto_animation_frame_counter--;
    }

    vblank_interrupt_pending = 1;

    if (hack_irq)
    {
        UINT32 pc = m68000_get_reg(M68K_PC);

        if (pc >= 0xbf00 && pc <= 0xbfff)
            vblank_interrupt_pending = 0;
    }

    update_interrupts();
}
Пример #3
0
void pia6821_device::control_b_w(UINT8 data)
{
	int temp;

	// bit 7 and 6 are read only
	data &= 0x3f;

	LOG(("PIA #%s: control B write = %02X\n", tag(), data));

	// update the control register
	m_ctl_b = data;

	if (C2_SET_MODE(m_ctl_b))
	{
		// set/reset mode - bit value determines the new output
		temp = C2_SET(m_ctl_b);
	}
	else
	{
		// strobe mode - output is always high unless strobed
		temp = TRUE;
	}

	set_out_cb2(temp);

	// update externals
	update_interrupts();
}
Пример #4
0
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;
}
Пример #5
0
UINT8 pia6821_device::port_a_r()
{
	UINT8 ret = get_in_a_value();

	// IRQ flags implicitly cleared by a read
	m_irq_a1 = FALSE;
	m_irq_a2 = FALSE;
	update_interrupts();

	// CA2 is configured as output and in read strobe mode
	if(C2_OUTPUT(m_ctl_a) && C2_STROBE_MODE(m_ctl_a))
	{
		// this will cause a transition low
		set_out_ca2(FALSE);

		// if the CA2 strobe is cleared by the E, reset it right away
		if(STROBE_E_RESET(m_ctl_a))
		{
			set_out_ca2(TRUE);
		}
	}

	LOG(("PIA #%s: port A read = %02X\n", tag(), ret));

	return ret;
}
Пример #6
0
UINT8 tms34061_device::register_r(address_space &space, offs_t offset)
{
	int regnum = offset >> 2;
	UINT16 result;

	/* extract the correct portion of the register */
	if (regnum < ARRAY_LENGTH(m_regs))
		result = m_regs[regnum];
	else
		result = 0xffff;

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

		/* vertical count register: return the current scanline */
		case TMS34061_VERCOUNTER:
			result = (m_screen->vpos()+ m_regs[TMS34061_VERENDBLNK]) % m_regs[TMS34061_VERTOTAL];
			break;
	}

	/* log it */
	if (VERBOSE) logerror("%s:tms34061 %s read = %04X\n", space.machine().describe_context(), regnames[regnum], result);
	return (offset & 0x02) ? (result >> 8) : result;
}
Пример #7
0
static void control_b_w(const device_config *device, UINT8 data)
{
	pia6821_state *p = get_token(device);
	int temp;

	/* bit 7 and 6 are read only */
	data &= 0x3f;

	LOG(("PIA #%s: control B write = %02X\n", device->tag, data));

	/* update the control register */
	p->ctl_b = data;

	if (C2_SET_MODE(p->ctl_b))
		/* set/reset mode - bit value determines the new output */
		temp = C2_SET(p->ctl_b);
	else
		/* strobe mode - output is always high unless strobed */
		temp = TRUE;

	set_out_cb2(device, temp);

	/* update externals */
	update_interrupts(device);
}
Пример #8
0
SLOT_INTERFACE_END

void e01_device::fdc_irq_w(bool state)
{
	m_fdc_irq = state;

	update_interrupts();
}
Пример #9
0
void neogeo_acknowledge_interrupt(running_machine *machine, UINT16 data)
{
	if (data & 0x01) irq3_pending = 0;
	if (data & 0x02) display_position_interrupt_pending = 0;
	if (data & 0x04) vblank_interrupt_pending = 0;

	update_interrupts(machine);
}
Пример #10
0
SLOT_INTERFACE_END

WRITE_LINE_MEMBER( e01_device::fdc_irq_w )
{
	m_fdc_irq = state;

	update_interrupts();
}
Пример #11
0
	FLOPPY_AFS_FORMAT
FLOPPY_FORMATS_END0

WRITE_LINE_MEMBER( econet_e01_device::fdc_irq_w )
{
	m_fdc_irq = state;

	update_interrupts();
}
Пример #12
0
void lk201_device::rcv_complete()
{
	sci_status |= SCSR_RDRF;
	update_interrupts();
	receive_register_extract();

	int data = get_received_char();
	m_kbd_state = data;
//  printf("\nlk201 got %02x\n", m_kbd_state);
}
Пример #13
0
static TIMER_CALLBACK( tms34061_interrupt )
{
    /* set timer for next frame */
    tms34061.timer->adjust(tms34061.screen->frame_period());

    /* set the interrupt bit in the status reg */
    tms34061.regs[TMS34061_STATUS] |= 1;

    /* update the interrupt state */
    update_interrupts();
}
Пример #14
0
static TIMER_CALLBACK( tms34061_interrupt )
{
    /* set timer for next frame */
    timer_adjust_oneshot(tms34061.timer, video_screen_get_frame_period(tms34061.screen), 0);

    /* set the interrupt bit in the status reg */
    tms34061.regs[TMS34061_STATUS] |= 1;

    /* update the interrupt state */
    update_interrupts();
}
Пример #15
0
static void tms34061_interrupt(int param)
{
	/* set timer for next frame */
	timer_adjust(tms34061.timer, get_verint_scanline_time(), 0, 0);

	/* set the interrupt bit in the status reg */
	tms34061.regs[TMS34061_STATUS] |= 1;

	/* update the interrupt state */
	update_interrupts();
}
Пример #16
0
void neogeo_state::neogeo_acknowledge_interrupt( UINT16 data )
{
	if (data & 0x01)
		m_irq3_pending = 0;
	if (data & 0x02)
		m_display_position_interrupt_pending = 0;
	if (data & 0x04)
		m_vblank_interrupt_pending = 0;

	update_interrupts();
}
Пример #17
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;
	}
}
Пример #18
0
void neogeo_acknowledge_interrupt( running_machine *machine, UINT16 data )
{
	neogeo_state *state = (neogeo_state *)machine->driver_data;

	if (data & 0x01)
		state->irq3_pending = 0;
	if (data & 0x02)
		state->display_position_interrupt_pending = 0;
	if (data & 0x04)
		state->vblank_interrupt_pending = 0;

	update_interrupts(machine);
}
Пример #19
0
void neogeo_acknowledge_interrupt( running_machine &machine, UINT16 data )
{
	neogeo_state *state = machine.driver_data<neogeo_state>();

	if (data & 0x01)
		state->m_irq3_pending = 0;
	if (data & 0x02)
		state->m_display_position_interrupt_pending = 0;
	if (data & 0x04)
		state->m_vblank_interrupt_pending = 0;

	update_interrupts(machine);
}
Пример #20
0
void tms34061_interrupt()
{
#if defined FBA_DEBUG
	if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_interrupt called without init\n"));
#endif

	if (tms34061_current_scanline != m_timer) return;

	/* set the interrupt bit in the status reg */
	m_regs[TMS34061_STATUS] |= 1;

	/* update the interrupt state */
	update_interrupts();
}
Пример #21
0
static WRITE32_HANDLER( interrupt_control_w )
{
	int irq = offset & 3;
	int control = (offset >> 2) & 1;

	/* offsets 1-3 seem to be the enable latches for the IRQs */
	if (irq != 0)
		irq_enable[irq - 1] = control;

	/* offset 0 seems to be the interrupt ack */
	else
		irq_state[0] = irq_state[1] = irq_state[2] = 0;

	/* update the current state */
	update_interrupts(space->machine);
}
Пример #22
0
INPUT_PORTS_END

/***************************************************************************
    DEVICE CONFIGURATION
***************************************************************************/

/*-------------------------------------------------
    MC146818_INTERFACE( rtc_intf )
-------------------------------------------------*/

WRITE_LINE_MEMBER( e01_state::rtc_irq_w )
{
    m_rtc_irq = state;

    update_interrupts();
}
Пример #23
0
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);
}
Пример #24
0
static TIMER_CALLBACK( vblank_interrupt_callback )
{
	neogeo_state *state = machine.driver_data<neogeo_state>();

	if (LOG_VIDEO_SYSTEM) logerror("+++ VBLANK @ %d,%d\n", machine.primary_screen->vpos(), machine.primary_screen->hpos());

	/* add a timer tick to the pd4990a */
	upd4990a_addretrace(state->m_upd4990a);

	state->m_vblank_interrupt_pending = 1;

	update_interrupts(machine);

	/* set timer for next screen */
	state->m_vblank_interrupt_timer->adjust(machine.primary_screen->time_until_pos(NEOGEO_VBSTART));
}
Пример #25
0
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);
	}
}
Пример #26
0
void ef9365_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
    switch(id)
    {
    case BUSY_TIMER:
        m_bf = 0;

        if( m_registers[EF936X_REG_CTRL1] & 0x40 )
        {
            m_irq_rdy = 1;
        }

        update_interrupts();

        break;
    }
}
Пример #27
0
static void raster_interrupt_aof2(int line)
{
    raster_line = line;
    if (raster_line == RASTER_LINES) raster_line = 0;

    if (raster_line < RASTER_LINE_RELOAD)
        raster_counter = RASTER_COUNTER_START + raster_line;
    else
        raster_counter = RASTER_COUNTER_RELOAD + raster_line - RASTER_LINE_RELOAD;

    if (display_position_interrupt_counter)
    {
        display_position_interrupt_counter--;

        if (display_position_interrupt_counter == 0)
        {
            if (display_position_interrupt_control & IRQ1CTRL_ENABLE)
            {
                display_position_interrupt_pending = 1;

                if (display_position_interrupt_control & IRQ1CTRL_AUTOLOAD_REPEAT)
                    adjust_display_position_interrupt();
            }
        }
    }

    if (line == RASTER_LINES)
    {
        if (display_position_interrupt_control & IRQ1CTRL_AUTOLOAD_VBLANK)
            adjust_display_position_interrupt();

        if (!auto_animation_disabled)
        {
            if (auto_animation_frame_counter == 0)
            {
                auto_animation_frame_counter = auto_animation_speed;
                auto_animation_counter++;
            }
            else auto_animation_frame_counter--;
        }

        vblank_interrupt_pending = 1;
    }

    update_interrupts();
}
Пример #28
0
void neogeo_vblank_interrupt(void)
{
	raster_counter = RASTER_COUNTER_START;

	pd4990a_addretrace();

	if (!auto_animation_disabled)
	{
		if (auto_animation_frame_counter == 0)
		{
			auto_animation_frame_counter = auto_animation_speed;
			auto_animation_counter++;
		}
		else auto_animation_frame_counter--;
	}

	vblank_interrupt_pending = 1;

	update_interrupts();
}
Пример #29
0
static TIMER_CALLBACK( display_position_interrupt_callback )
{
	neogeo_state *state = machine.driver_data<neogeo_state>();

	if (LOG_VIDEO_SYSTEM) logerror("--- Scanline @ %d,%d\n", machine.primary_screen->vpos(), machine.primary_screen->hpos());

	if (state->m_display_position_interrupt_control & IRQ2CTRL_ENABLE)
	{
		if (LOG_VIDEO_SYSTEM) logerror("*** Scanline interrupt (IRQ2) ***  y: %02x  x: %02x\n", machine.primary_screen->vpos(), machine.primary_screen->hpos());
		state->m_display_position_interrupt_pending = 1;

		update_interrupts(machine);
	}

	if (state->m_display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_REPEAT)
	{
		if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_REPEAT ");
		adjust_display_position_interrupt_timer(machine);
	}
}
Пример #30
0
/* timer callback to handle reloading the H counter and generate IRQ4 */
void vdp_reload_counter(int scanline)
{
	/* generate an int if they're enabled */
	if (genesis_vdp_regs[0] & 0x10)/* && !(misc_io_data[7] & 0x10))*/
		if (scanline != 0 || genesis_vdp_regs[10] == 0)
		{
			scanline_int = 1;
			update_interrupts();
			timer_set(cpu_getscanlinetime(scanline + 1), 0, vdp_int4_off);
		}

	/* advance to the next scanline */
	/* behavior 2: 0 count means interrupt after one scanline */
	/* (this behavior matches the Sega C2 emulator) */
	scanline += genesis_vdp_regs[10] + 1;
	if (scanline >= 224)
		scanline = 0;

	/* set a timer */
	timer_adjust(scan_timer, cpu_getscanlinetime(scanline) + cpu_getscanlineperiod() * (320. / 342.), scanline, 0);
}