Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When reading from PRA ($f001\$f00f) the data direction register should be considered for all bits. #450

Open
Yazwh0 opened this issue Nov 3, 2022 · 0 comments

Comments

@Yazwh0
Copy link

Yazwh0 commented Nov 3, 2022

It only looks like it's considered for the I2C bits, not the joystick data.

In via.c:

case 1: // PA
case 15:
	i2c_step();
	if (!debug) via_clear_pra_irqs(&via[0]);
	if (via[0].registers[11] & 1) {
		// CA1 is currently not connected to anything (?)
		return 0;
	} else {
		return (~via[0].registers[3] & i2c_port.data_out) |					//I2C Data: PA0=1 if DDR bit is 0 (input) and data_out is 1; usage of data_out and data_in is a bit confusing...
			(via[0].registers[3] & i2c_port.data_in) |						//I2C Data: PA0=1 if DDR bit is 1 (output) and data_in is 1
			(~via[0].registers[3] & I2C_CLK_MASK ) |						//I2C Clock: PA1=1 if DDR bit is 0 (input), simulating an input pull-up
			(via[0].registers[3] & i2c_port.clk_in) |						//I2C Clock: PA1=1 if DDR bit is 1 (output) and clk_in is 1, simulating a pin driven by the VIA 
			Joystick_data;
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant