From 83accb5bba38146bbbf470348aa9a3c14fb802ba Mon Sep 17 00:00:00 2001 From: sjs Date: Sun, 24 May 2009 14:05:40 -0700 Subject: [PATCH] [NEW] x86_inc instruction with some binary encoding. --- compiler.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/compiler.rb b/compiler.rb index a714db5..95ee45a 100644 --- a/compiler.rb +++ b/compiler.rb @@ -671,6 +671,21 @@ class Compiler emit("idiv #{op}") end + def x86_inc(op) + emit("inc #{op}") + + asm do + if register?(op) + emit_byte(0x40 + regnum(op)) + elsif rm32?(op) + emit_byte(0xff) + emit_modrm( + else + raise "unsupported op #{op}, wanted r32 or r/m32" + end + end + end + def x86_push(reg) emit("push #{reg}") end