-2

I am using terminal on mac. I did 'vim hello_worldd.asm' and it created a place for me to write my code.

But I don't know how to exit and run it. Is there a command to do so?

Cœur
  • 37,241
  • 25
  • 195
  • 267
newguuy
  • 1
  • 2
  • Quit and save the file (hit the escape key then type :wq) from vim. Then run the assembler (probably `nasm hello_worldd.asm`) – Kevin Sep 25 '17 at 00:25

1 Answers1

2

To exit Vim, hit the ESC key to go to normal mode and then type: :wq to exit and save changes.

For NASM, use:

nasm -f elf file.asm to compile it.

Then you must link it so you can use:

ld -s -o outfile file.o

Then run with: ./outfile.

If you can't run ./outfile. You probably have a permission issue. Which you can fix by using chmod doing: chmod +x outfile.

Rivasa
  • 6,510
  • 3
  • 35
  • 64