[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] 68k userland emulator, part #2



Howdy,

I've updated my experimental 68k userland emulator for freemint. Again, it only runs on a 060 so the whole project is fairly pointless at this stage :) I hope to try it on my ColdFire EVB in the near future.

I decided to change CPU core. The CaSTaway core had some pretty nasty bugs which prevented working code from executing properly. I now use the proven Musashi core, which apart from being a lot more accurate also supports 020 instructions (I haven't enabled this in the emulator at this stage, since I will need to make sure stack frames etc are handled correctly first).

Speed is a bit slower now, since I evaluate every memory access, including instruction fetch etc. I will change this in the future, but I try to focus on compatibility first.

I've rewritten the internals to simplify porting. Instead of assembly wrappers and tunneling of OS calls, I now interpret each access to GEMDOS/XGEMDOS/BIOS/XBIOS and call the appropriate system call in source. This shouldn't be slower than the previous approach, and should ease porting a lot. There is some 68000 code in the project needed for the emulated CPU. I'm not quite sure how to handle that atm, but it should be possible to create the same effect in C by manipulating the CPU core.

Internally the emulator should be much cleaner now. Instead of intercepting TRAP exceptions I now use 68k handlers on the emulated side and trigger OS calls by means of the TAS-callback in the Musashi core. This means that apps can manipulate trap vectors freely, while still being able to call the original handler.

Compatibility is much better now, it seems like most well behaved stuff runs properly (but slow as a snail on valium). Pexec "GO"-modes are blocked at the moment. It is however possible to load a binary in to memory and to create a basepage.

Link: http://hem.passagen.se/shoggoth/misc/emu68k.ttp

Usage: ./emu68k.ttp <name of app> <commandline to app>

best regards

-- Peter