Kudzu World

"Programming is an art form that fights back"

Kudzu World  »  Blogspace  »  Kudzu's Tech Blog
English - Română - Русский - عربي

RSS Feed

If you want to more easily stay informed of updates etc you can subscribe to the RSS feed. Just point your RSS reader at this page, auto discovery is enabled.




X# - Using C# to create an inline X86 assembler

4/28/2008

This is from the Cosmos project but could easily be used to generate any X86 code. It's really neat, write C# like code that has 1:1 mapping to X86, and to generate the X86, just run the C# code.

            public void DebugStub(TextWriter aOutputWriter, UInt16 aComAddr) {
                UInt16 xComStatusAddr = (UInt16)(aComAddr + 5);
                Label = "WriteByteToComPort";
                Label = "WriteByteToComPort_Wait";
                DX = xComStatusAddr;
                AL = Port[DX];
                AL.Test(0x20);
                JumpIfEqual("WriteByteToComPort_Wait");
                DX = aComAddr;
                AL = Memory[ESP + 4];
                Port[DX] = AL;
                Return(4);

Notice even the integration between C# and the asssembly? (aComAddr, etc)

More X# info

<< Previous Entry    Next Entry >>

Comments:

Ovidiu Buligan on 6/11/2009 wrote: Very interesting :-? I wonder if java ever thought of enabling such facility (beside the HotSpot witch you do not "have control")

Post a comment

Use my contact form to contact me directly.