Running The Emulator On Linux Command Line Only

Get technical support from the community & developers with specific X16 programs if you can't find the solution elsewhere
(for general non-support related chat about programs please comment directly under the program in the software library)
john_e79
Posts: 22
Joined: Thu Aug 26, 2021 6:31 am

Running The Emulator On Linux Command Line Only

Post by john_e79 »


Since we're talking about Ubuntu here, I set up Ubuntu 64-bit today on a NUC i5.

The apt packages for cc65 were not recognizing cx16 as a system so I downloaded sources from github and it works now.

I was able to compile Matt Heffernan's demos, and the tiles demo works fine in the X16 emulator at 60fps. ?

However, lesson 17 the YM2151 demo outputs no sound. ?

Lesson 13 PIANO.PRG and PSG.PRG the VERA PSG sounds do work though. ?

This isn't an issue on my Windows 10 laptop only on Linux.

It did the same on me last time I tried to run on a RPi4, PSG would work but not YM2151. It was also slow with the tiles demo on a RPi4B it looked like. ?

If I try to run x16emu with sudo it starts complaining about can't open ALSA no such file or directory so I just run as a normal user.

 

Anyone get YM2151 working on Linux X16 emulator and have some ideas?

User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

Running The Emulator On Linux Command Line Only

Post by kliepatsch »


This is really strange. From what I can tell, the different audio sources are treated equally. Look at the following line of code, which mixes the VERA PCM, VERA PSG and YM2151:

https://github.com/commanderx16/x16-emulator/blob/master/src/audio.c#L170

I can only report that for me everything works, and I seem to have the same setup as you: Ubuntu 20.04, cc65 cloned and compiled from git (I put the path to its binary into .profile so I can type cc65 in any directory), cloned the demos from Matt Heffernan's github, ran the build.sh, and there is sound for the YM2151 demo. No sudo needed. Oh, and I am using the official x16emu binary, and I am guessing that is what you are also doing...

Sorry, I have no ideas what might be going on ?

john_e79
Posts: 22
Joined: Thu Aug 26, 2021 6:31 am

Running The Emulator On Linux Command Line Only

Post by john_e79 »



On 11/2/2021 at 6:05 AM, kliepatsch said:




This is really strange. From what I can tell, the different audio sources are treated equally. Look at the following line of code, which mixes the VERA PCM, VERA PSG and YM2151:

https://github.com/commanderx16/x16-emulator/blob/master/src/audio.c#L170



I can only report that for me everything works, and I seem to have the same setup as you: Ubuntu 20.04, cc65 cloned and compiled from git (I put the path to its binary into .profile so I can type cc65 in any directory), cloned the demos from Matt Heffernan's github, ran the build.sh, and there is sound for the YM2151 demo. No sudo needed. Oh, and I am using the official x16emu binary, and I am guessing that is what you are also doing...



Sorry, I have no ideas what might be going on ?



Nope, I built the x16 emu from github sources, that may be my issue, if that's the case there might be a regression bug somewhere.

Also ZeroByte's Sonic demo works fine on Ubuntu and plays sound, just not Matt Heffernan's Lesson 17, I asked him about it on YouTube and he doesn't know.

Yep, that's the issue. Just tried from the release build and it works fine. It's not working when built from github sources for some reason.

EDIT: Talked to Matt Heffernan and he let me know the YM2151 registers were changing in the next version so now it all makes sense.

TomXP411
Posts: 1760
Joined: Tue May 19, 2020 8:49 pm

Running The Emulator On Linux Command Line Only

Post by TomXP411 »



On 11/2/2021 at 12:59 PM, john_e79 said:




Yep, that's the issue. Just tried from the release build and it works fine. It's not working when built from github sources for some reason.



EDIT: Talked to Matt Heffernan and he let me know the YM2151 registers were changing in the next version so now it all makes sense.



Yeah, the emulator is in a bad place right now - some registers and memory addresses have changed, but Mike never released a new version, so people are still coding against the last officially released one. This means you can't actually build from GitHub and expect it to work right. The emulator does work with the latest ROMs, when also built from source, but most of the software on the forum here will only run correctly on the last officially released emulator version. 

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

Running The Emulator On Linux Command Line Only

Post by ZeroByte »


I submitted a PR to Matt's XCI engine repo for x16.inc which includes a conditional define from the commandline that allows you to use R38 or R39 values for the constants having to do with BANK addresses and YM2151 addresses.

if you build with the cmdline argument --asm-define REV=39 it will use the R39+ values, else it will use R38 values.

It creates a definition: EMU_VERSION X16_VERSION which is equal to 38 or 39 as well, so your project can also use conditional building.

 

Post Reply