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

Asteroids missing cocktail implementation #1669

Closed
rdagger opened this issue Jan 20, 2024 · 32 comments
Closed

Asteroids missing cocktail implementation #1669

rdagger opened this issue Jan 20, 2024 · 32 comments

Comments

@rdagger
Copy link

rdagger commented Jan 20, 2024

Asteroids and Asteroids Deluxe are missing the cabinet dip switch for cocktail mode and the player 2 controls.
I believe this was fixed in mame v0.198.

image

image

image

image

image

@mahoneyt944
Copy link
Collaborator

mahoneyt944 commented Jan 20, 2024

Here's the relevant commit mamedev/mame@7a0645c

I'm not familiar with PORT_CONFNAME, I assume this might be a physical jumper on the board (Inverter circuit) and not necessarily a dip switch. We could probably set this up with a fake dip though and install a write handler.

@mahoneyt944
Copy link
Collaborator

Found this info as well.

The cocktail model uses the same PCB as the upright model.

The cocktail harness has a jumper wire from J20 Pin7 to Pin 19 that controls the video inverter circuit.

Source:
https://www.arcade-history.com/?n=asteroids-cocktail-model&page=detail&id=36869

@arcadez2003
Copy link
Collaborator

arcadez2003 commented Jan 23, 2024

Here's the relevant commit mamedev/mame@7a0645c

I'm not familiar with PORT_CONFNAME, I assume this might be a physical jumper on the board (Inverter circuit) and not necessarily a dip switch. We could probably set this up with a fake dip though and install a write handler.

Yeah i've not bumped into code such as this before either "just as well likely" as you said fake ports
with a trampoline which hooks to the video code to allow the flip or not toggle is what ya need
most likely.

Easier said than done though eh maybe another driver with a similar scheme might point you in
the correct direction.?? certainly after searching the MAME src i see no other drivers as yet using
this exact same hookup style.

EDIT Sometimes FBN can help give some pointers if this fix has been added there.?? as like us
they'd have to rework the same code to fit within their structure.

@mahoneyt944
Copy link
Collaborator

mahoneyt944 commented Jan 24, 2024

Made a little progress on this. It seems we need to setup flipping for dvg. Avg already has flipping so I hung off of some of that code.... It's hotwired as of now for testing that is. I installed a write handler to catch the player selection bit and read a fake dip switch to enable the flip. As a concept, this is working but the flip from top to bottom is off, cutting off the score header. Just need to figure why it's getting offset then hook up the controller ports and this should be good. Any help on the flip alignment issue would be appreciated.

master...Roid

@grant2258
Copy link
Contributor

grant2258 commented Jan 25, 2024

fix is here https://github.com/grant2258/mame2003-plus-libretro/tree/ast

The reason for the offset was here just wasn't calculating the visible area properly.

MDRV_VISIBLE_AREA(0, 1040, 70, 950)

@mahoneyt944
Copy link
Collaborator

Thanks I'll give it a go, do you think we should change the avg code like you have for all games or just this one case? Not sure if it will impact any other games

@grant2258
Copy link
Contributor

wont break anything just cuts off the invisible area was just done wrong.

@mahoneyt944
Copy link
Collaborator

Sounds like a win win then 👍

@mahoneyt944
Copy link
Collaborator

Btw does current mame even have cocktail controls or are they still sharing the p1 set?

@grant2258
Copy link
Contributor

no sure youll probably need to tie in with @rdagger for the details

@mahoneyt944
Copy link
Collaborator

Added screen flipping for asteroids, not deluxe cab though..haven't found the player selection bit for that one yet. Still sharing one input set, though I think current mame shares too. d850ce5

@mahoneyt944
Copy link
Collaborator

@rdagger can you confirm if current mame has separate controls for cocktail mode? Or did they just enable screen flipping?

@rdagger
Copy link
Author

rdagger commented Jan 26, 2024

@mahoneyt944 as far as I know mame currently doesn't implement separate controls, but it should because the cocktail cabinets had separate controls.

@rdagger
Copy link
Author

rdagger commented Jan 26, 2024

@mahoneyt944 there is a lot of information on this thread:
https://forum.arcadecontrols.com/index.php/topic,168028.0.html

@mahoneyt944
Copy link
Collaborator

Interesting read, yeah it appears that they are sharing a port and using grounding tricks to get the extra buttons or something to that effect. I'll look into hooking up a p2 set.

@mahoneyt944
Copy link
Collaborator

I hooked up cocktail controls for asteroids. Let me know how it works for you. ee4c135

Deluxe still not implemented though.

@rdagger
Copy link
Author

rdagger commented Jan 26, 2024

@mahoneyt944 it works, great job! The screen flips. The player 2 controls work as expected and don't interfere with the other player's ship.

There is 1 very small bug. The start button LEDs no longer function properly. Before when you insert a coin the player 1 LED would blink and if you inserted a second coin the player 2 LED would also blink. Now both LEDs are constantly illuminated.

@mahoneyt944
Copy link
Collaborator

mahoneyt944 commented Jan 27, 2024

Interesting, that might be the bit I'm hooked onto...though I'm not sure what the actual machine does in this odd configuration. I think once i get deluxe working I might have a better method for hooking .

Edit: yes my hook is essentially unhooking the original write after init which is what handles the LEDs. I'll fix that soon.

@mahoneyt944
Copy link
Collaborator

c7bcc47 this should fix the leds

@rdagger
Copy link
Author

rdagger commented Jan 27, 2024

@mahoneyt944 you fixed the LED bug! 🚀 Your contribution made my day. Thanks a ton!

@mahoneyt944
Copy link
Collaborator

No problem, I will try to get the deluxe working as well. Still need to figure out the bits for that cab though to hook properly.

@mahoneyt944
Copy link
Collaborator

For asteroids, I simply found a bit that seems to follow which players turns it is, then used a little logic to read our fake dip switch. For astroids deluxe, it should follow this same method and all the code should pretty much drop in. Problem is I haven't been able to find a bit that toggles with the players turn, there's probably an easy way to find such a bit...maybe in debug, hex editor or cheat engine. @grant2258 , @arcadez2003 do either of you have any ideas to find this bit for deluxe? Maybe we can dump the memory before and after a player turn changes or something?

@grant2258
Copy link
Contributor

looking at the latest mame source its offset 4 bit 7 so address 0x3c04 bit 7 so data & 128 at that address should get you what your looking for.

@mahoneyt944
Copy link
Collaborator

Thanks I'll try it out

@mahoneyt944
Copy link
Collaborator

mahoneyt944 commented Jan 28, 2024

On a second look I think I tried 0x80 already, it's the LED light which flashes when coins go in. I'll plug in everything and retest though since I may not have been in the right port.

@mahoneyt944
Copy link
Collaborator

@grant2258 yup that did the trick, deluxe is now working too 😄 25f3e82

@mahoneyt944
Copy link
Collaborator

Asteroids is "data&0x04" correct? I found this bit without using documentation. I was just looking at deluxe in current mame and I see this:

https://github.com/mamedev/mame/blob/d750435f57639e6e5ed314793595853c2d975b86/src/mame/atari/asteroid.cpp#L908

The <4> is the offset, but how did you get bit 7?

Asteroids would be this:

https://github.com/mamedev/mame/blob/d750435f57639e6e5ed314793595853c2d975b86/src/mame/atari/asteroid.cpp#L850

So 3202? But again how did you verify the bit? I guess 4 since it works.

@rdagger
Copy link
Author

rdagger commented Jan 28, 2024

@mahoneyt944 Asteroids Deluxe works, thanks again!

@grant2258
Copy link
Contributor

I only looked what deluxe is doing bit seven is set here https://github.com/mamedev/mame/blob/d750435f57639e6e5ed314793595853c2d975b86/src/mame/atari/asteroid.cpp#L457.

@mahoneyt944
Copy link
Collaborator

Well I think it's safe to close this, as both games are now fully supported in cocktail mode 👍

@arcadez2003
Copy link
Collaborator

@mahoneyt944 i've been back working with the advanceMAME core again of late and whatya know......
amadvance/advancemame@321fb1a
Wish i'd spotted that earlier as maybe it would have given some pointers and saved ya some time
anyway you got it sorted in the end so no harm done.

@mahoneyt944
Copy link
Collaborator

@arcadez2003 lol thanks. Yeah many ways to get there. But if it works it works . It was fun to figure it out anyhow.

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

4 participants