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

add support for 2nd RM Nimbus joystick #11867

Merged
merged 4 commits into from
Dec 26, 2023

Conversation

RobinSergeant
Copy link
Contributor

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

load "mousedem"
run

(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.

Comment on lines 107 to 112
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;
Copy link
Member

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.

Copy link
Contributor Author

@RobinSergeant RobinSergeant Dec 25, 2023

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.

Comment on lines 156 to 157
void nimbus_select_joystick0(uint8_t data);
void nimbus_select_joystick1(uint8_t data);
Copy link
Member

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?

Copy link
Contributor Author

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!

Copy link
Contributor Author

@RobinSergeant RobinSergeant Dec 26, 2023

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

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@rb6502 rb6502 merged commit 8c32868 into mamedev:master Dec 26, 2023
5 checks passed
@RobinSergeant RobinSergeant deleted the nimbus_2nd_joystick branch January 2, 2024 14:29
einstein95 pushed a commit to einstein95/mame that referenced this pull request Mar 2, 2024
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

Successfully merging this pull request may close these issues.

3 participants