Small .NET interpreter
Dot Net Anywhere is a interpreted .NET CIL runtime.
However! The code was used in initial prototypes of Blazor IL-in-a-browser project :)
The runtime itself is written in C and has been designed to be as small and portable as possible, allowing .NET software to be used on resource-constrained devices where it is not possible to run a full .NET runtime (e.g. Mono).
The simplest way to build Dot Net Anywhere is using Visual Studio 2011 on Windows. Open and build both the solutions:
This will create a 'Build/Debug/' directory which contains:
When at a command prompt in the Build/Debug directory:
dna.exe  
So, to run the included snake game:
The Dot Net Anywhere interpreter can show all two levels of verbosity. Using the -v option shows initial .NET module load data and garbage collection information. Using -vv also shows all methods that are being JITted.
Of course, the Snake.exe is a completely standard .NET executable file, so it can just be run using the normal Microsoft .NET runtime:
This game was originally written to run on some custom hardware that did not have a standard keyboard, hence the controls are little odd:
The interpreter and corlib currently implement the following .NET 2.0 CLR and language features:
Currently unsupported features
The Dot Net Anywhere interpreter JITs each method as required into an internal format, which is then interpreted using a direct-threaded interpreter. The JIT stage does a full stack-type analysis and explicitly stores type information within the internal format's opcodes, allowing considerably more efficient interpretation that if the CIL was directly interpreted.
Dot Net Anywhere has been designed to be fairly simple to port to custom platforms.
dna.exe and libIGraph.dll will need to be built for the platform. These are both written in C, and should build with most C compilers without problems. Two non-standard features are used:
The only customisation that will generally be required is in the UI/input subsystem: The CustomDevice.dll managed library and the libIGraph.dll native library.
The embedded device that has been used for development has a 320x240 4-bit grey-scale screen and a 12-key keypad. This is all handled within the CustomDevice and libIGraph libraries, and will need to be customised for a device configuration.
To access the screen of the device, the CustomDevice class contains a method GetScreen() that returns a Graphics object that is the screen. If the device has a screen that is not a simple 2-D array of pixels then you will need to implement this differently.