4

My Question is How can I know the exchangeable machine code of the instructions of the assembly code? And how to write a binary file that can be executed? Thanks.

4 Answers 4

4

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
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

0

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.

Comments

-1

Use cc -S file_name.c

It will populate you assembly code of your c program

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.