All pastes #44764 Raw Edit

Someone

public text v1 · immutable
#44764 ·published 2006-03-07 12:13 UTC
rendered paste body
// -- x86 macros -- //

macro "push i8/i16/i32"{
  emit8($68);
  emit32(m0);
}

macro mov "mov r32, i8/i16/i32"{
  emit8($B8 + reg0);
  emit32(m0);
}

<
  .. other simple x86 instructions implemented the 
  same way, with possible optimizations for special
  bitwidths etc. too boring to write
>
  


// -- vm macros -- //

macro "iconst i8/i16/i32"{
  emitmacro("$push m0");  
}

macro "iadd"{
  emitmacro("pop eax");  
  emitmacro("pop edx");  
  emitmacro("add eax, edx");
  emitmacro("push eax");
}