开发者

Converting Assembly Code To Machine Code

开发者 https://www.devze.com 2022-12-21 15:54 出处:网络
My Question is How can I know the exchangea开发者_运维问答ble machine code of the instructions of the assembly 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

精彩评论

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

关注公众号