Tuesday, October 25, 2011

Progress Update

It's been a while since I've given any updates about this emulator. Sorry about that. Lately, I had to sit back and think about what's best for the emulator, such as balancing portability with compatibility, as well as the ease of coding burdens in the future. So, I decided to let go of the direct code execution method completely. I was going to keep it for an experimental HLE build, but that didn't turn out nearly as well as I hoped after a few tests, and it was a grim reminder why HLE is far more trouble than it's worth.

Having said that, I've been using libemu for a basic interpreter since it was the same as my intended source licence (GPL) and to save me a bit of time on the CPU issues here. It's a really easy library to implement for your own code, but it does come with a bit of a price, so to speak. Not in dollars or euros, the price of getting it to compile properly with Visual Studio .net, removing the paging table code and replacing it with a flat memory model, adding your own implementations for privileged instructions as well as MMX and SSE, and some of the various bugs that were never fixed or discovered. The first two aren't exactly difficult, but the third and fourth are the most time consuming. Other than that, it was worth the effort I put in so far (as evident in the screen above).

Oh, about that screen shot... it was generated from a tutorial written by Ben_3D on xbdev.net, formerly known as xfactordev.net (see the non-xdk tutorial section). Not too impressive, but I went through hoops getting it to work. "Why is it upside down?" Oh, that's because I used OpenGL's framebuffer manipulation APIs to draw that (glDrawPixels). I just never got around to adding code to change the Y orientation. There are better and more interesting ways than using glDrawPixels to do that, but the point is getting something working, then improve it later on, i.e. the K.I.S.S. rule.

A few other things I wanted to mention is that I'm going to HLE the kernel for the time being until the emulator is further along. I'd much rather use an authentic BIOS, but there's too much missing functionality for that to happen; plus I'd like to keep it as an alternative for a while.

Next task: do some more work on the HLE kernel, integrate some of my old PCI emulation code, get some basic USB emulation going and attempt to emulate the basic features of the AC'97 for sound (PCM). Until next time.


EDIT: Oh, I forgot about emulating threads. This won't be too challenging to implement (at least I hope not) except maybe the stack part, but I'm not too worried about that.