Amiga.org

The "Not Quite Amiga but still computer related category" => Amiga Emulation => Topic started by: bloodline on February 23, 2017, 07:30:13 PM

Title: New type of Amiga Emulator for macOS
Post by: bloodline on February 23, 2017, 07:30:13 PM
As promised here is an early alpha of my new amiga emulator.
For those of you who have used my ADFBench, you will be aware that I set about trying to get my ADF browser to actually run the amiga executables it can read on ADF files.

Well, after quite a bit of effort, I have a working alpha of the emulation engine running.

I decided to build this separately from ADFBench for now, so I can et it working properly before I reintegrate back in.

Working so far:
Exec can schedule tasks and task swap.
Allocate RAM/Free RAM.  
Allows task to send and receive signals, but the message passing system is not really working yet.
The minimal DOS library currently just access the Mac file system, and is only able to loadSeg executables into memory, and then CreateProc them into the multitasking system.

Other libraries are just Stubbs right now, which do little except report which function has been called.

The emulator allocates 16Meg of ram, of which the lower 2Mb is treated as Chip Ram, and the next 8Meg is treated as Fast Ram. The rest of the ram isn't available to my exec emulation and currently does nothing.

It doesn't really do much at the moment, so I've included a 68000 disassembler, so you can watch the instructions execute. So why not point it at an Amiga executable and see what it does :)
 
Also it has a stupid name. :laugh1:

https://drive.google.com/open?id=0B3CMG5yqFK4jeVN2WHdXcHJtWlU
Title: Re: New type of Amiga Emulator for macOS
Post by: HaukeVB on February 24, 2017, 01:47:39 PM
Cool, will try asap... :)
Title: Re: New type of Amiga Emulator for macOS
Post by: apsturk on February 24, 2017, 09:29:10 PM
@bloodline (http://www.amiga.org/forums/member.php?u=298)

Wow great work!!! good job. I am constantly amazed by the inventive ways people come up with cool stuff!!!!!
Title: Re: New type of Amiga Emulator for macOS
Post by: bloodline on February 26, 2017, 10:09:34 AM
Cheers guys.

As explained, I am trying a different approach to Amiga Emulation.

Instead of simply emulating the whole Amiga architecture, I trap application calls to Exec, Dos (and other hardware hitting libraries, devices, and resources) then handling them with the host operating system. Essentially how Wine works when running Windows

This approach is hampered by four things:

1. The 68k CPU, not to much of a problem, but obviously requires an emulator (which reduces the performance).

2. The endian problem... all data structures on the Amiga are big endian, so all multibyte memory access needs to be byte swapped when the host operating needs to manipulate them. I solved this by building a set of classes which map over the Amiga operating system data structures and handle the endian issues.

3. The address space... this is something which I didn't originally think about, but the Host Operating system uses a 64bit address space, and Amiga Apps are stuck in a 32bit space. This is the biggest issue as it means all memory access must be mapped... I had originally hoped to let the 68k have full access to the memory, but instead I have to limit it to a 4gig single allocation.

4. The Amiga hardware, many Amiga programs assume the custom chips will be present. I have reserved the Amiga chipset address space in the emulator's memory so I can emulate any required hardware.
Title: Re: New type of Amiga Emulator for macOS
Post by: apsturk on February 26, 2017, 12:54:44 PM
I applaud your work. I think this is a very interesting way to come at the problem. Keep up the good work and let me know if there is anything the Amiga On The Lake to do for you.
Title: Re: New type of Amiga Emulator for macOS
Post by: kamelito on February 26, 2017, 03:58:29 PM
@Bloodline
Do%&$#?@!you plan to make it cycle exact?
Any plan for PowerPC support?

Nice project.
Kamelito
Title: Re: New type of Amiga Emulator for macOS
Post by: bloodline on February 26, 2017, 05:22:35 PM
Quote from: kamelito;822757
@Bloodline
Do%&$#?@!you plan to make it cycle exact?
Any plan for PowerPC support?

Nice project.
Kamelito
Since I intend for this to be like Wine, where Amiga apps will essentially run like native apps (this is really for applications, rather than games) cycle exact emulation isn't necessary... that said, I have make sure chipset emulation could be added easily, the 68k is free running so it can be locked to any timing required.

As for PPC support... that would be difficult, since I would have support all the different AmigaPPC ABI/API (PowerUP, WarpOS, AOS4 and MOS)... I will be putting this on GitHub within the week so someone can help me out :)
Title: Re: New type of Amiga Emulator for macOS
Post by: Romanujan on February 26, 2017, 07:29:23 PM
Quote from: bloodline;822754
Instead of simply emulating the whole Amiga architecture, I trap application calls to Exec, Dos (and other hardware hitting libraries, devices, and resources) then handling them with the host operating system.

What is the difference between your approach and the one VAMOS uses?
Title: Re: New type of Amiga Emulator for macOS
Post by: bloodline on February 26, 2017, 10:23:31 PM
Quote from: Romanujan;822762
What is the difference between your approach and the one VAMOS uses?

The concept is very similar to VAMOS, and I have used Chris's "reset instruction" callback trick to trap application calls to exec style libraries. The difference is that I have used C (well this first version uses obj-c) so it should be much faster and portable than VAMOS, secondly I have focused on creating a working exec.library (with message passing and multitasking) so while VAMOS is great for running CLI applications, I want to get intuition (workbench launched) apps working... as a side effect CLI apps should work fine too, though I need to get my console working better.
Title: Re: New type of Amiga Emulator for macOS
Post by: nicholas on December 09, 2017, 04:53:12 PM
I'm all Hackintoshed with an i7-7700K now Matt, I see the last commit was in March.  Did you hit a roadblock?