rim luck
rim luck

Reputation: 145

How to run assembly code. I have it in a text file but I don't know how to run it

I have assembly code in a text file and I don't know how to run it. I wish you can help me with detailed explanation. Thank you

Upvotes: 9

Views: 90290

Answers (1)

AnnoyinC
AnnoyinC

Reputation: 496

Warning: never run code you don't know. In the case of assembly it can crash your system, or worse.

Assuming your assembly code is x86, And assuming it doesn't look like only rows of "01101010" or "de876f1a6bc37" And assuming that you are on Windows,

  1. Set up your development environment: https://ccm.net/faq/1559-compiling-an-assembly-program-with-nasm#compiling-an-assembly-program-with-nasm-for-windows
  2. Copy the assembly code
  3. Open notepad
  4. Paste the code
  5. Save on your desktop as "assembly.asm"
  6. Hold shift, right click on your desktop, select "Open command window here" from the dropdown
  7. Enter the following two commands:
  8. nasm -f win32 assembly.asm -o test.o
  9. ld test.o -o assembly.exe

Again, be careful with assembly. You also might not get output, so you won't know the output of your program.

Upvotes: 9

Related Questions