开发者

Converting Assembly Code To Machine Code

My Question is How can I know the exchangea开发者_运维问答ble machine code of the instructions of the assembly code? And how to write a binary file that can be executed? Thanks.


If you have a piece of assembly code and want to execute it, you will first need to run it through an assembler to produce a binary. There are a number of assemblers available, I would recommend starting with NASM since it's pretty popular and runs on several platforms.

Then, to assemble/link your program, just run:

nasm -o object.o your-source-file.asm
ld -s -o your-output-executable object.o


What assembly language are you using? That will determine the program you use to compile the assembly code into machine code. If you post a snippet of your assembly code, someone may be able to identify it for you.


If you Using Windows just do the next: Go to Run and write cmd then write debug write a100 then write any assembly instruction then press enter, write r , then machine code of your assembly instruction will appear on the left side of the black Dos screen. I hope it help some.


Use cc -S file_name.c

It will populate you assembly code of your c program

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜