Someone
public text v1 · immutable// -- 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");
}