ninjaaa
ninjaaa

Reputation: 293

How to simply get a machine code of exactly one assembly instruction?

How to simply get a code of exactly one assembly instruction?

For example for "mov eax 0x14". I want to get it in linux terminal preferably with gcc or gdm.

Upvotes: 1

Views: 2007

Answers (2)

andreasw
andreasw

Reputation: 521

rasm2 from the radare2 package fits this purpose nicely:

$ rasm2 'nop'
90
$ rasm2 -d '90'
nop

http://radare.org/y/?p=examples&f=rasm

Upvotes: 2

Jester
Jester

Reputation: 58822

$ echo "mov eax, 0x14" | as -o /dev/null -al -msyntax=intel -mnaked-reg
GAS LISTING             page 1


   1 0000 B8140000  mov eax,0x14
   1      00

Upvotes: 6

Related Questions