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
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