Jump to content
  • 0

Running The Emulator On Linux Command Line Only


iGregory
 Share

Question

I'm not sure if this is the right place for this question...  if it is not, I am very sorry... please point me to a better match.

I have an old laptop that I've installed Ubuntu Server on.  It's basically Linux, but without a GUI layer.  I want to use this to run the X16 emulator... is this possible?  Has anybody done this before?  I don't want to dive down a long rabbit hole only to find out that it's not even possible.  So, I just want to know if it can be done...

Thanks.

Greg

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

I haven't done X redirection in quite a long while, but one thing I found back in the day was that the app (Netscape, if that's any indicator) actually ran FASTER over X because the host machine (a 386 in the Pentium era) didn't have to do all of the graphic stuff like layering the windows. I don't know how an SDL application would fare in these conditions. As far as sound, you'd need to run a remote sound session in parallel to the X session if you want the emu's audio to come through. I did this once with ess - not sure if modern sound stuff like Alsa, PulseAudio, Jack, etc have such hooks, but it wouldn't surprise me.

Accomplishing the X portion shouldn't be hard though - install some kind of X server on your main PC (I don't have any recommendations - it's been ages) and configure it to allow remote connections. Then on the Linux box, before running the emu, just issue the command "export DISPLAY=ip.of.host.pc:0"  - where 0 would be the display ID that your X server uses to refer to monitor 0. The specifics of that would be in the xserver configuration, not the Linux box.

Edited by ZeroByte
added the X commands
Link to comment
Share on other sites

  • 0

Thanks for the feedback...

My idea was to convert an old laptop to one that ran only the X16 emulator.  The laptop I have is way too under powered to run any graphic version of Linux (or at least, too under powered to run Ubuntu...  maybe a more light weight debian distro would work) but it does run Ubuntu server pretty well...

I installed Ubuntu server originally to set up a Minecraft server for my kids -- it worked okay, right up until somebody logged onto it:)  then it really got laggy, so that was scrapped.  But, while I was fiddling with the CLI server, it reminded me of running a very old lap top computer with DOS...

But, it sounds like this will be a pain to get running and may run worse than it would under a graphical environment.

Thanks.

Greg

Link to comment
Share on other sites

  • 0
15 hours ago, iGregory said:

Thanks for the feedback...

My idea was to convert an old laptop to one that ran only the X16 emulator.  The laptop I have is way too under powered to run any graphic version of Linux (or at least, too under powered to run Ubuntu...  maybe a more light weight debian distro would work) but it does run Ubuntu server pretty well...

I installed Ubuntu server originally to set up a Minecraft server for my kids -- it worked okay, right up until somebody logged onto it:)  then it really got laggy, so that was scrapped.  But, while I was fiddling with the CLI server, it reminded me of running a very old lap top computer with DOS...

But, it sounds like this will be a pain to get running and may run worse than it would under a graphical environment.

Thanks.

Greg

I mean, if you want to run it on the server itself without installing a GUI, you can install the X11 and SDL2 library files on their own. I think that's all you really need to run a GUI application.  Whether your machine is powerful enough to actually run the emulator smoothly is another matter.

Link to comment
Share on other sites

  • 0

There are emulators for other computers that run in a terminal e.g. https://atari800.github.io/ and http://rullf2.xs4all.nl/sg/zx81ce.html. The output of x16emu can be sent through a filter program that converts PETSCII to UTF8: https://github.com/mobluse/x16-petscii2utf8

The difficult thing is to get the keys you press (key down and key up events) in the terminal to be sent to x16emu. I once hacked x16emu so that this was possible, but that slowed down the emulator. One would also need to remove the GUI to make it independent of X and SDL.

Link to comment
Share on other sites

  • 0

So I installed LUbuntu.  Now I have a multi-emulator computer -- It runs DOSBox, VICE and X16 really well.  I just need to set up the keyboard mapping and get them to run full screen.

Thanks for the suggestions, folks!!

Greg

  • Like 2
Link to comment
Share on other sites

  • 0

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?

Edited by john_e79
Link to comment
Share on other sites

  • 0

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 😕

Link to comment
Share on other sites

  • 0
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.

Edited by john_e79
  • Like 3
Link to comment
Share on other sites

  • 0
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. 

Edited by TomXP411
Link to comment
Share on other sites

  • 0

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.

 

Edited by ZeroByte
corrected a mistake in the information
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use