Exemple #1
0
static void set_mode(const device_config *device, UINT8 data)
{
	i8255a_t *i8255a = get_safe_token(device);

	i8255a->control = data;

	/* group A */
	i8255a->output[PORT_A] = 0;
	i8255a->input[PORT_A] = 0;
	i8255a->ibf[PORT_A] = 0;
	i8255a->obf[PORT_A] = 1;
	i8255a->inte[PORT_A] = 0;
	i8255a->inte1 = 0;
	i8255a->inte2 = 0;

	if (LOG) logerror("8255A '%s' Group A Mode: %u\n", device->tag, group_mode(i8255a, GROUP_A));
	if (LOG) logerror("8255A '%s' Port A Mode: %s\n", device->tag, (port_mode(i8255a, PORT_A) == MODE_OUTPUT) ? "output" : "input");
	if (LOG) logerror("8255A '%s' Port C Upper Mode: %s\n", device->tag, (port_c_upper_mode(i8255a) == MODE_OUTPUT) ? "output" : "input");
	if (LOG) logerror("8255A '%s' Group B Mode: %u\n", device->tag, group_mode(i8255a, GROUP_B));
	if (LOG) logerror("8255A '%s' Port B Mode: %s\n", device->tag, (port_mode(i8255a, PORT_B) == MODE_OUTPUT) ? "output" : "input");
	if (LOG) logerror("8255A '%s' Port C Lower Mode: %s\n", device->tag, (port_c_lower_mode(i8255a) == MODE_OUTPUT) ? "output" : "input");

	/* group B */
	i8255a->output[PORT_B] = 0;
	i8255a->input[PORT_B] = 0;
	i8255a->ibf[PORT_B] = 0;
	i8255a->obf[PORT_B] = 1;
	i8255a->inte[PORT_B] = 0;

	i8255a->output[PORT_C] = 0;
	i8255a->input[PORT_C] = 0;

	output_pc(i8255a);
}
Exemple #2
0
static void set_pc_bit(const device_config *device, int bit, int state)
{
	i8255a_t *i8255a = get_safe_token(device);

	/* set output latch bit */
	i8255a->output[PORT_C] &= ~(1 << bit);
	i8255a->output[PORT_C] |= state << bit;

	switch (group_mode(i8255a, GROUP_A))
	{
	case MODE_1:
		if (port_mode(i8255a, PORT_A) == MODE_OUTPUT)
		{
			switch (bit)
			{
			case 3: set_intr(i8255a, PORT_A, state); break;
			case 6: set_inte(i8255a, PORT_A, state); break;
			case 7: set_obf(i8255a, PORT_A, state); break;
			}
		}
		else
		{
			switch (bit)
			{
			case 3: set_intr(i8255a, PORT_A, state); break;
			case 4: set_inte(i8255a, PORT_A, state); break;
			case 5: set_ibf(i8255a, PORT_A, state); break;
			}
		}
		break;

	case MODE_2:
		switch (bit)
		{
		case 3: set_intr(i8255a, PORT_A, state); break;
		case 4: set_inte2(i8255a, state); break;
		case 5: set_ibf(i8255a, PORT_A, state); break;
		case 6: set_inte1(i8255a, state); break;
		case 7: set_obf(i8255a, PORT_A, state); break;
		}
		break;
	}

	if (group_mode(i8255a, GROUP_B) == MODE_1)
	{
		switch (bit)
		{
		case 0: set_intr(i8255a, PORT_B, state); break;
		case 1:
			if (port_mode(i8255a, PORT_B) == MODE_OUTPUT)
				set_obf(i8255a, PORT_B, state);
			else
				set_ibf(i8255a, PORT_B, state);
			break;
		case 2: set_inte(i8255a, PORT_B, state); break;
		}
	}

	output_pc(i8255a);
}
Exemple #3
0
static void write_pc(i8255a_t *i8255a, UINT8 data)
{
	int changed = 0;

	if (group_mode(i8255a, GROUP_A) == MODE_0)
	{
		/* PC upper */
		if (port_c_upper_mode(i8255a) == MODE_OUTPUT)
		{
			i8255a->output[PORT_C] = (data & 0xf0) | (i8255a->output[PORT_C] & 0x0f);
			changed = 1;
		}

		/* PC lower */
		if (port_c_lower_mode(i8255a) == MODE_OUTPUT)
		{
			i8255a->output[PORT_C] = (i8255a->output[PORT_C] & 0xf0) | (data & 0x0f);
			changed = 1;
		}
	}

	if (changed)
	{
		output_pc(i8255a);
	}
}
Exemple #4
0
inline void i8255_device::set_intr(int port, int state)
{
	if (LOG) logerror("I8255 '%s' Port %c INTR: %u\n", tag(), 'A' + port, state);

	m_intr[port] = state;

	output_pc();
}
Exemple #5
0
static void set_intr(i8255a_t *i8255a, int port, int state)
{
	if (LOG) logerror("8255A Port %c INTR: %u\n", 'A' + port, state);

	i8255a->intr[port] = state;

	output_pc(i8255a);
}
Exemple #6
0
inline void i8255_device::set_intr(int port, int state)
{
	LOG("I8255 Port %c INTR: %u\n", 'A' + port, state);

	m_intr[port] = state;

	output_pc();
}
Exemple #7
0
void i8255_device::set_mode(uint8_t data)
{
	m_control = data;

	// group A
	m_output[PORT_A] = 0;
	m_input[PORT_A] = 0;
	m_ibf[PORT_A] = 0;
	m_obf[PORT_A] = 1;
	m_inte[PORT_A] = 0;
	m_inte1 = 0;
	m_inte2 = 0;

	if (port_mode(PORT_A) == MODE_OUTPUT)
	{
		m_out_pa_cb((offs_t)0, m_output[PORT_A]);
	}
	else
	{
		// TTL inputs float high
		m_out_pa_cb((offs_t)0, 0xff);
	}

	if (LOG)
	{
		logerror("I8255 '%s' Group A Mode: %u\n", tag(), group_mode(GROUP_A));
		logerror("I8255 '%s' Port A Mode: %s\n", tag(), (port_mode(PORT_A) == MODE_OUTPUT) ? "output" : "input");
		logerror("I8255 '%s' Port C Upper Mode: %s\n", tag(), (port_c_upper_mode() == MODE_OUTPUT) ? "output" : "input");
		logerror("I8255 '%s' Group B Mode: %u\n", tag(), group_mode(GROUP_B));
		logerror("I8255 '%s' Port B Mode: %s\n", tag(), (port_mode(PORT_B) == MODE_OUTPUT) ? "output" : "input");
		logerror("I8255 '%s' Port C Lower Mode: %s\n", tag(), (port_c_lower_mode() == MODE_OUTPUT) ? "output" : "input");
	}

	// group B
	m_output[PORT_B] = 0;
	m_input[PORT_B] = 0;
	m_ibf[PORT_B] = 0;
	m_obf[PORT_B] = 1;
	m_inte[PORT_B] = 0;

	if (port_mode(PORT_B) == MODE_OUTPUT)
	{
		m_out_pb_cb((offs_t)0, m_output[PORT_B]);
	}
	else
	{
		// TTL inputs float high
		m_out_pb_cb((offs_t)0, 0xff);
	}

	m_output[PORT_C] = 0;
	m_input[PORT_C] = 0;

	output_pc();
}
Exemple #8
0
void i8255_device::set_mode(uint8_t data)
{
	m_control = data;

	// group A
	m_output[PORT_A] = 0;
	m_input[PORT_A] = 0;
	m_ibf[PORT_A] = 0;
	m_obf[PORT_A] = 1;
	m_inte[PORT_A] = 0;
	m_inte1 = 0;
	m_inte2 = 0;

	if (port_mode(PORT_A) == MODE_OUTPUT)
	{
		m_out_pa_cb((offs_t)0, m_output[PORT_A]);
	}
	else
	{
		// TTL inputs floating
		m_out_pa_cb((offs_t)0, m_tri_pa_cb(0));
	}

	LOG("I8255 Group A Mode: %u\n", group_mode(GROUP_A));
	LOG("I8255 Port A Mode: %s\n", (port_mode(PORT_A) == MODE_OUTPUT) ? "output" : "input");
	LOG("I8255 Port C Upper Mode: %s\n", (port_c_upper_mode() == MODE_OUTPUT) ? "output" : "input");
	LOG("I8255 Group B Mode: %u\n", group_mode(GROUP_B));
	LOG("I8255 Port B Mode: %s\n", (port_mode(PORT_B) == MODE_OUTPUT) ? "output" : "input");
	LOG("I8255 Port C Lower Mode: %s\n", (port_c_lower_mode() == MODE_OUTPUT) ? "output" : "input");

	// group B
	m_output[PORT_B] = 0;
	m_input[PORT_B] = 0;
	m_ibf[PORT_B] = 0;
	m_obf[PORT_B] = 1;
	m_inte[PORT_B] = 0;

	if (port_mode(PORT_B) == MODE_OUTPUT)
	{
		m_out_pb_cb((offs_t)0, m_output[PORT_B]);
	}
	else
	{
		// TTL inputs floating
		m_out_pb_cb((offs_t)0, m_tri_pb_cb(0));
	}

	m_output[PORT_C] = 0;
	m_input[PORT_C] = 0;

	output_pc();
}
Exemple #9
0
static void check_interrupt(i8255a_t *i8255a, int port)
{
	switch (group_mode(i8255a, port))
	{
	case MODE_1:
		switch (port_mode(i8255a, port))
		{
		case MODE_INPUT:
			if (i8255a->inte[port] && i8255a->ibf[port])
			{
				if (LOG) logerror("8255A Port %c INTR: 1\n", 'A' + port);

				i8255a->intr[port] = 1;
			}
			break;

		case MODE_OUTPUT:
			if (i8255a->inte[port] && i8255a->obf[port])
			{
				if (LOG) logerror("8255A Port %c INTR: 1\n", 'A' + port);

				i8255a->intr[port] = 1;
			}
			break;
		}
		break;

	case MODE_2:
		if ((i8255a->inte1 && i8255a->obf[port]) || (i8255a->inte2 && i8255a->ibf[port]))
		{
			if (LOG) logerror("8255A Port %c INTR: 1\n", 'A' + port);

			i8255a->intr[port] = 1;
		}
		break;
	}

	output_pc(i8255a);
}
Exemple #10
0
void i8255_device::set_pc_bit(int bit, int state)
{
	// set output latch bit
	m_output[PORT_C] &= ~(1 << bit);
	m_output[PORT_C] |= state << bit;

	switch (group_mode(GROUP_A))
	{
	case MODE_1:
		if (port_mode(PORT_A) == MODE_OUTPUT)
		{
			switch (bit)
			{
			case 3: set_intr(PORT_A, state); break;
			case 6: set_inte(PORT_A, state); break;
			case 7: set_obf(PORT_A, state); break;
			default: break;
			}
		}
		else
		{
			switch (bit)
			{
			case 3: set_intr(PORT_A, state); break;
			case 4: set_inte(PORT_A, state); break;
			case 5: set_ibf(PORT_A, state); break;
			default: break;
			}
		}
		break;

	case MODE_2:
		switch (bit)
		{
		case 3: set_intr(PORT_A, state); break;
		case 4: set_inte2(state); break;
		case 5: set_ibf(PORT_A, state); break;
		case 6: set_inte1(state); break;
		case 7: set_obf(PORT_A, state); break;
		default: break;
		}
		break;
	}

	if (group_mode(GROUP_B) == MODE_1)
	{
		switch (bit)
		{
		case 0: set_intr(PORT_B, state); break;
		case 1:
			if (port_mode(PORT_B) == MODE_OUTPUT)
				set_obf(PORT_B, state);
			else
				set_ibf(PORT_B, state);
			break;
		case 2: set_inte(PORT_B, state); break;
		default: break;
		}
	}

	output_pc();
}