13

After trying out FS-UAE on my Fedora Linux system, which worked quite nicely, I got to thinking. Even though when the Amiga was originally released in the middle 1980s, it was revolutionary in its graphics and sound capabilities, not all Amiga programs need them. As a specific case, C compilers on the Amiga have no need of the computer's graphics and sound capabilities. (I mean the compilers themselves don't, the programs they produce as compiled output may well do.)

So it seems to me that firing up a fully emulated Amiga just to compile C code on it is overkill. Would it be technically possible to have an emulator that has an emulated Motorola 680x0 CPU and the Amiga operating system ROM running, maps the Amiga's file system to the host computer's like FS-UAE does, but instead of implementing a full Amiga GUI only interacts with the user through standard stdio? That way it could run in a Linux terminal and be faster, more efficient and less error-prone to use. The emulator could just skip all system calls or direct chip instructions that use graphics or sound.

What I am looking for here is some kind of system that would allow me to run this kind of program:

#include <stdio.h>
int main(void) {
  printf("Hello world!\n");
}

in a Linux terminal, but with the actual program being in Motorola 608x0 machine code using the AmigaOS system libraries.

This would allow me to write programs such as:

#include <exec/types.h>
#include <exec/memory.h>
#include <libraries/dos.h>
int main(void) {
  BPTR lock;
  lock = Lock("DF0:Stuff", ACCESS_READ);
  AssignLock("Stuff:", lock);
}

which will (if I remember my AmigaOS correctly) assign "Stuff:" to "DF0:Stuff", all in AmigaOS code, but with the emulator never actually starting up an Amiga GUI, but instead doing the whole thing in a Linux terminal. Note that exec/types.h, exec/memory.h and libraries/dos.h are AmigaOS library headers, not Linux library headers.

Is this kind of thing possible? And if it is, does something like it exist and has anyone else thought about it?

9
  • 5
    The Amiga graphics chips don't have a text mode. It's all bitmaps, all the time.
    – Tim Locke
    Nov 15 '20 at 1:36
  • 1
    That's not what I am asking about. AmigaOS has stdin and stdout just like Linux has. What I am after here is an Amiga emulator that maps the AmigaOS stdin and stdout to Linux stdin and stdout, not to the Amiga graphics chips. The entire system would not have to care about the Amiga graphics chips at all.
    – user53739
    Nov 15 '20 at 1:46
  • 2
    Maybe don’t phrase it as ‘text-only’ then. Call it ‘seamless’ (as in the VirtualBox mode), ‘rootless’ (as in X servers) or ‘Wine-like’ (as in, provides the AmigaOS API on the host OS just like Wine provides the Win32 API, instead of virtualising the whole machine). Nov 15 '20 at 6:42
  • 2
    Also, Wine Is Not an Emulator. I was a little confused about what you are asking, but it sounds like a relatively simple compatibility layer should meet your needs. Nov 15 '20 at 7:21
  • 3
    While your question is on-topic here, please also be aware of our software recommendations sister site Nov 15 '20 at 10:08
24

A solution like that already exists: it's called vamos (Virtual AMiga OS) and emulates a 68k CPU and a bunch of libraries - enough to get terminal only programs (like compilers and assemblers) running:

https://github.com/cnvogelg/amitools

Not all that easy to setup though.

6
  • I got amitools to work simply by installing python-pip and python3-devel, downloading the zip package from GitHub and running "sudo pip install amitools". So far I have only tried vamos on only a few simple text-only programs I wrote in the days when I still had a working real Amiga. The programs worked all OK so far. It seems that the emulated Amiga vamos runs has one megabyte of memory. My last working real Amiga had 48 megabytes, my current Linux system has 16 gigabytes. Is there a configuration option in vamos to set how much memory it can use?
    – user53739
    Nov 16 '20 at 0:51
  • The example config file doesn't mention such an option. But one of the developers working on it mostly uses it to run SAS/C, I can't imagine there's a hard limit at 1 MB.
    – Venner
    Nov 16 '20 at 14:12
  • vamos seems to work all OK for stand-alone programs, but trying to open a shell with "vamos -x Shell-Seg" crashes vamos. I don't even know if it's a bug in vamos or an AmigaOS error. Is there any other way of running an Amiga shell in vamos? Or should I resort to writing my own crude minimal shell that just loops with calling fgets() and then system() with whatever it gets as input, until it runs out of input?
    – user53739
    Nov 16 '20 at 21:28
  • 1
    vamos is super slow and fails to run lha for instance. Too bad as it was promising. Maybe it can be improved. Jun 3 at 13:17
  • 2
    note that compilers & assemblers have their cross counterparts: gcc and vasm run well on windows and you don't want to go back to the old amigaos native tools Jun 3 at 13:18
5

If you want to compile amiga programs so they run on Linux (because you have the source code), you can use a native compiler and AROS (amiga research OS) development files (includes and libraries)

You'll get a Linux executable but with AROS OS simulation layer. You may stumble into endianness issues but since your question was "can I emulate AmigaOS without an Amiga emulator" it seems to answer pretty well.

(Just to prove that it's serious stuff, AROS is so complete that a M68K ROM was built over it. It is 1MB instead of 512k, also slow, but allows to boot WinUAE or real machines without copyright issues)

2

Seems what you want is actually a cross-compiler (native binaries on native system targetted at foreign system and cpu) not an emulator with a compiler running on it. I could be wrong, but it seems the former is actually less work than the latter. Of course, there is value in a general compatibility layer that works for the cli, but compilers are arguably a special case. https://github.com/bebbo/amigaos-cross-toolchain

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.