-
Notifications
You must be signed in to change notification settings - Fork 44
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
Joystick data on the VIA doesn't consider DDR bits #84
Comments
This is tricky because port A of the VIA is different from port B, in that it will give you the logic levels seen on the pins regardless of DDR. (For comparison, port B will always read the programmatic setting of output pins and not the physical level at the pin itself) Hypothetically, if you connected a joystick that drives the pins more strongly than the 65C22's output drive, you'd see the joystick data no matter whether the pins were configured as inputs or outputs. I don't know how likely that is, but it implies programmers might not be able to rely on a particular behavior here, and more weirdly, that the emulator is currently simulating a situation which is still actually possible. :P (I got this info from page 9 of the W65C22 datasheet) |
Which emulator behavior would cause the least confusion in the majority of cases? The joystick_scan routine always sets the direction. The emulator does check to see whether the clock and latch are configured as outputs. If the emulator checked the direction of the data pins, then it would potentially be different than hardware behavior, possibly most of the time. |
I think first of all, make sure the documentation for the VIA makes the difference between Port A and Port B clear, and advise that developers must set the correct direction when manually reading the joysticks vs. using the kernal routine to do so, otherwise, the behavior is undefined. Second, it might help to know what happens on real hardware. If the joysticks work most commonly, or they stop working most commonly, that might be what the emulator should do. If we wanted to provide a strict, "make sure my stuff works on real hardware" environment, then I'd say to make the joysticks stop reading back when the direction is incorrect. |
The bits for the joysticks do not check the DDR bits at all, unlike the i2c bits.
The text was updated successfully, but these errors were encountered: