Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes RM Nimbus joystick emulation by using the correct port address for directional data and setting the correct bits when that address is read. Currently the mouse data port (0xa4) is used for all joystick data, but only the buttons are actually read from this port. The joystick port (0xa0) is used for the directional data as described in chapter 2 of of the service manual (https://www.thenimbus.co.uk/upgrades-and-maintenance/service-manual).
This can be demonstrated/tested by running the following RM Basic program which does not work without my change:
I have also removed the "Input Port 0 Device" config port as this is no longer necessary and prevented the mouse buttons from working properly when set to the wrong value (the original code read joystick data when this was to "mouse", and mouse data when it was set to "joystick"). The mouse and joystick can now co-exist quite happily with joystick buttons doubling as mouse buttons and vice versa.
The wrong bits were also being set for each direction and I have of course corrected these to match those given in the service manual. The above RM Basic program proves that theses are now correct.
The original machine also allowed switching between two joysticks by writing to ports 0xa0 (to select joystick 0) and 0xa2 (to select joystick 1), but I have not implemented this as it seems unnecessary - I have not found any software that makes use of it and I don't think it's possible to test using RM Basic.
Please let me know if you have any questions!