x86
x86

Reputation: 41

Converting Assembly Code To Machine Code

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.

Upvotes: 4

Views: 3057

Answers (4)

AlgoNotation
AlgoNotation

Reputation: 1

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.

Upvotes: 0

linyaa
linyaa

Reputation: 892

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.

Upvotes: 0

Martin
Martin

Reputation: 38329

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

Upvotes: 4

Pavunkumar
Pavunkumar

Reputation: 5345

Use cc -S file_name.c

It will populate you assembly code of your c program

Upvotes: -1

Related Questions