-1

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?

1
  • Quit and save the file (hit the escape key then type :wq) from vim. Then run the assembler (probably nasm hello_worldd.asm) Commented Sep 25, 2017 at 0:25

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

thank you, but when I do ./outfile, I get permission denied
This answer is incorrect. nasm will only compile (assume ELF) to an object . You'll have to link it with LD (or GCC) first.
can you elaborate please?
@MichaelPetch Is that better? Thanks for the catch.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.