Previous Thread
Next Thread
Print Thread
Page 2 of 2 1 2
Joined: Mar 2013
Posts: 82
D
Member
Member
D Offline
Joined: Mar 2013
Posts: 82
Originally Posted by R. Belmont
oss.c is specific to Linux. You can't build it at all on a Mac.

Ok, thank you.

Apologies if this question is stupid... If SDL is used (on a Mac) won't it talk directly to the sound hardware via Core Audio, so the SDL routines on their own should be sufficient? The point I'm trying to make is: can I just take the oss.cpp file and remove most of the code apart from the SDL-specific routines and that should get me fairly close to a working solution?

Joined: Mar 2001
Posts: 17,294
Likes: 272
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,294
Likes: 272
In theory, but the SDL routines there almost certainly aren't for SDL 2.x as far as I remember (I'm not sure 2.x *existed* at that time) so they won't build against current SDL 2.30 (or the 3.0 preview).

Basically what I'm saying is that the source drop you found is self-service. That was true in 2010 when I still remembered any of it, but it's way more true 14 years later.

Joined: Mar 2013
Posts: 82
D
Member
Member
D Offline
Joined: Mar 2013
Posts: 82
Ok, understood and thank you again for your help - I appreciate you are busy with new projects and M1 was a very long time ago. I did think SDL 2 would be too recent, and using SDL 1 probably won't work on the later OSs so I will have to rewrite the SDL routines.

If I make any meaningful progress I will post here again. If any Mac users are interested in working on this please PM me.

Joined: Mar 2013
Posts: 82
D
Member
Member
D Offline
Joined: Mar 2013
Posts: 82
Update: I've managed to get the command line version built and working, sort of:

[Linked Image from i.imgur.com]

I've tested with Hot Chase, Cyberbots, Aggressors of Dark Kombat and Godzilla (pinball machine) so far and only the first songs as the key commands don't appear to be working, but I definitely hear some sound! I had to comment-out some code in roms.c that was causing an illegal hardware instruction error, and also remove the reference to the lasound library in the make file before it would build. I only have SDL 2 on my machine but this doesn't seem to be an issue. Using pulseaudio didn't work even though I have the library installed, so I'll stick with SDL for the moment.

Batman - Revenge of the Joker (Genesis game) gives me a segmentation fault. The fm2612.c file does not appear to be being included in the build, so I'll ignore these games for the moment as I presume it's related to this file.

Last edited by Dodg; 07/22/24 03:48 PM.
Joined: Mar 2013
Posts: 82
D
Member
Member
D Offline
Joined: Mar 2013
Posts: 82
I've identified the cause of the segfaulting on the Genesis games, which is due to the YM2151 driver code when run on a 64-bit system (I think). This also affects Atari System 1 boards and various other games. It appears that the key code (KC) channel/register needs to be initialized when the chip is started/reset - I found this out by looking at the MAME 0.100 source code.

In the M1 code, open sound/ym2151.c and find the YM2151ResetChip function, then where you have this line

chip->oper[i].volume = MAX_ATT_INDEX;

immediately after it add

chip->oper[i].kc_i = 768; /* min kc_i value */

Hope that helps someone. I do not claim to understand anything about the YM2151 chip, I just copied-and-pasted the code.

Joined: Apr 2011
Posts: 33
Likes: 1
N
Member
Member
N Offline
Joined: Apr 2011
Posts: 33
Likes: 1
Originally Posted by Dodg
I've identified the cause of the segfaulting on the Genesis games, which is due to the YM2151 driver code when run on a 64-bit system (I think). This also affects Atari System 1 boards and various other games. It appears that the key code (KC) channel/register needs to be initialized when the chip is started/reset - I found this out by looking at the MAME 0.100 source code.

In the M1 code, open sound/ym2151.c and find the YM2151ResetChip function, then where you have this line

chip->oper[i].volume = MAX_ATT_INDEX;

immediately after it add

chip->oper[i].kc_i = 768; /* min kc_i value */

Hope that helps someone. I do not claim to understand anything about the YM2151 chip, I just copied-and-pasted the code.

This fixes YM2151 games on my Android port also. I can listen to MERCS and Magic Sword again. Thanks!

1 member likes this: Dodg
Joined: Mar 2013
Posts: 82
D
Member
Member
D Offline
Joined: Mar 2013
Posts: 82
Thanks for your feedback! I'm still getting intermittent crashes on some games, so I think there may be other values that need to be initialized but I haven't had time to look at M1 recently. The crashes usually happen once you've switched between different games. There is a newer version of the Genesis driver in the source code but when I swapped it with the old driver I didn't get any sound. Arcade games that use the YM2151 chip usually play fine now, it's the Genesis games that are not working reliably.

Joined: Mar 2003
Posts: 30
Member
Member
Joined: Mar 2003
Posts: 30
I'm wondering if R. Belmont and Richard Bannister would consider open sourcing M1 and especially the Mac port to Github to allow others to take on continuing it.

Joined: Dec 1969
Posts: 921
Likes: 3
R
Senior Member
Senior Member
R Offline
Joined: Dec 1969
Posts: 921
Likes: 3
I don't know how many times I need to say this – I get someone asking about it every few months – but the Mac port of M1 was open-sourced a very long time ago.

You can download it here.

The code isn't massively useful, mind, insofar as it is written in Carbon and that doesn't build or run on current machines.

Last edited by Richard Bannister; 06/11/25 06:34 AM.
Page 2 of 2 1 2

Moderated by  R. Belmont 

Link Copied to Clipboard
Who's Online Now
2 members (AJR, Kale), 238 guests, and 4 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,381
Posts122,712
Members5,085
Most Online1,529
Jun 7th, 2025
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0