X# - Using C# to create an inline X86 assembler
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)
<< Previous Entry Next Entry >>
Use my contact form to contact me directly.
