Quick actions

cmd+k|ctrl+k

Navigation

Languages

very cheap asm

Snippet info

Language

Ruby

Visibility

public

Author

hyrious

Created

2019-01-19T05:18:01Z

Updated

2019-01-19T05:18:01Z

@pos = 0
def push_eax
  puts "push eax"
  @pos += 4
end

def int i
  puts "push $#{i}"
  @pos += 4
end

def add a, b
  puts "mov eax, [esp+#{@pos - a}]"
  puts "add eax, [esp+#{@pos - b}]"
  push_eax
end

def ret a
  puts "mov eax, [esp+#{@pos - a}]"
  puts "sub esp, #{@pos}"
  puts "ret"
end

a = int 3
b = int 5
ret add a, (add a, b)
INFO