-
Notifications
You must be signed in to change notification settings - Fork 2k
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
add support for 2nd RM Nimbus joystick #11867
Conversation
src/mame/rm/rmnimbus.h
Outdated
required_ioport m_io_joystick0; | ||
required_ioport m_io_joystick1; | ||
required_ioport m_io_mouse_button; | ||
required_ioport m_io_mousex; | ||
required_ioport m_io_mousey; | ||
ioport_port* m_io_selected_js; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a pointer makes it harder to implement save state support. Please use a required_ioport_array<2>
for the joystick ports and keep an index for the selected port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I have now done that.
src/mame/rm/rmnimbus.h
Outdated
void nimbus_select_joystick0(uint8_t data); | ||
void nimbus_select_joystick1(uint8_t data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you actually need two of these? Couldn’t you have a single write handler across the range, and get the selected joystick from the offset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After trying it out I think you are right so have made this change with another commit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cuavas, one thing I've noticed is that writing to address 0xa1 and 0xa3 now also changes the selected joystick. Do you think that is a problem? I could change the data type to uint8_t and then check for an even offset, e.g.
void rmnimbus_state::nimbus_joystick_select(offs_t offset, uint8_t data)
{
/* NB joystick 0 is selected by writing to address 0xa0, and
joystick 1 is selected by writing to address 0xa2 */
if (offset % 2 == 0)
{
m_selected_js_idx = offset >> 1;
}
}
When I step through in debug a byte is always sent to the even address:
F8A38 out 0A2h,al E6 A2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can either change to uint8_t like that or add the mem_mask parameter and use the byte lane selection tests like if (ACCESSING_BITS_0_7)
/ if (ACCESSING_BITS_8_15)
. The uint8_t is probably a little cleaner if ports 0xa1/0xa3 aren't actually used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the info. 0xa1/0xa3 are not used so I've pushed another commit with the unit8_t solution so that only even addresses are used. I think everything should be fine now.
This PR adds support for a second joystick on the RM Nimbus. I decided to do this after discovering the RM Basic demo program that covers joystick support. It's basically a two player paint program with two brushes (each controlled by a different joystick). To run the demo start RM Basic and type
(then wait until it asks about having a joystick before pressing a key to begin).
Interestingly this demo makes it obvious that each joystick should actually only have one button! This fits with the description of using an Atari style joystick, given in the service manual, as those joysticks only had one button. Hence the button data returned via the mouse data port actually relates to the button status of both joysticks.
Questions and comments welcome.