webspace hosting reseller hosting| web hosting| blog| forum| dating| free hosting| openhost| report abuse
Internet Fax To Email - Unlimited

Unlimited Faxes, No Fees, Dedicated Phone Number

Free Website Templates

PortableBDVM

This is a quick implementation from scratch of the BD+ virtual machine as described in this Doom9 thread. It's written to be simple, straightforward and readable. It should also be quite easy to use in most environments, as it is written in plain C99 with no endianness assumptions.

It currently does not support any traps. It merely implements a stub for trap 0x110 as an example of how to write further hooks.

I don't really have time to do much further work on this, but I hope it is clean and straightforward enough that anybody could pick it up and continue working on it. The instruction set should be completely emulated, but as it was written in a few hours with just the forum thread as reference there might be some bugs. However, it currently runs the example file from the thread up to the call to trap 0x520, and the memory and register state at that point is identical to the posted example.

The source archive can be downloaded here. It contains a makefile for building with gcc (mingw or cygwin should work under Windows). It should be easy enough to get it to build under any other compiler that supports C99.

As new Doom9 accounts are apparently not allowed to post, I can't post this in the thread itself, so I put it here for now. If you have a question or comment, feel free to use the comment form below to post it.

In response to some comments on Doom9: Yeah, it doesn't do any endianness conversion, in order to be as close to the spec as possible. That makes the code easier to understand and mistakes less likely.

There are many other optimizations that could be done too, but I feel it's better to make a simple implementation without trickery to start with. When the whole system is well understood one can try to optimize it, if needed.

774, Wed Sep 10 17:25:55 2008

Also: Does anyone know if non-aligned reads and writes are allowed? PortableBDVM supports them, but I am not sure if they should be. Implementations that swap endianness likely don't support them, and I don't know if they should throw some kind of exception or what.

774, Wed Sep 10 17:40:06 2008