Is there a way to write a program using pure x86 intel opcodes instead of the assembly mnemonics and instructions and then compile it w开发者_开发问答ith ML and LINK. For example if I try and write a 55 instead of push ebp ML thinks it is an integer. Does it require a special compiler or how would you write an opcode program and compile it.
You can use db
:
db CDh,19h
calls interrupt 0x19.
Assembler's job is to translate the mnemonix to binary values. x86 is a CISC instruction set with long history, so this translation is quite difficult to do manually.
The linking process is even worse, it creates the final executable, which implies creation of lots of structures. This is much more difficult to do and mentain manually.
If you really want to write something using opcodes, take a hex-editor (or even a notepad, if you know all the ASCII codes :) ) and write a .COM program. Anything more complicated (.exe) would be overkill.
The short answer is that it is possible to write a program using only opcodes. As smilingthax demonstrates, you still need an assembler, or other tool to output the binary values of each opcode.
You are going to need to refer to the Intel documentation in order to find out the opcodes for each assembly memmonic. This information is contained in the Intel(R) Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual.
精彩评论