Page 1 of 1

Nasm: unable to open input file (all of a sudden)

Posted: Tue Jan 25, 2011 10:33 am
by Inflated
Hello,

Amateur programmer starting to work with assembly language, here, and I'm having a bit of a problem.

Whenever I try to create an object file in nasm, I get the error that it was unable to open the input file. However, just a few minutes ago I was up and running without a hitch. I have no idea what happened.

After searching around, I came across this thread: http://forum.osdev.org/viewtopic.php?f= ... open+input

This leads me to believe that notepad is formatting the file in some strange way or something, I just have no idea how to fix it.

I'd really appreciate any help I can get, as this is quite frustrating :shock:

Thanks!

Re: Nasm: unable to open input file (all of a sudden)

Posted: Tue Jan 25, 2011 11:15 am
by Combuster
Hello Inflater,

Do you know where the power button is? I have the idea it might help you (hint) :wink:

Re: Nasm: unable to open input file (all of a sudden)

Posted: Tue Jan 25, 2011 12:48 pm
by Inflated
Thanks for the quick response, but I'm afraid restarting didn't help.

Here's a bit more info if it helps:

When I run nasm16.exe, I get the response that it doesn't have an input file. Okay, that's good.

Then, I try: nasm16 -f obj hello.asm -o hello.obj

And get: nasm: unable to open file 'hello.nasm'.

I'm currently looking for an editor other than notepad, so hopefully that'll help.

EDIT: Same problem with another editor. Arghh.

Re: Nasm: unable to open input file (all of a sudden)

Posted: Tue Jan 25, 2011 1:18 pm
by Inflated
Holy **** I got it working.

I'm not exactly sure what was wrong. After changing the directories around, I was getting a new error saying label or instruction expected at the start of the line.'

Turns out there was a space before the [BITS 16] instruction, and after deleting that, viola.

Thanks for responding, and hopefully this will help somebody in the future (though I kinda doubt it :p)

Re: Nasm: unable to open input file (all of a sudden)

Posted: Tue Jan 25, 2011 3:58 pm
by Kieran
You could post this as a bug on the nasm site, as this may be an error handling bug.

First try the latest nasm build to see if it does the same.

Re: Nasm: unable to open input file (all of a sudden)

Posted: Tue Jan 25, 2011 6:28 pm
by shahadat
did u checked the file extension.
sometimes notepad saves a file named as example.asm.txt instead of example.asm.

Re: Nasm: unable to open input file (all of a sudden)

Posted: Tue Jan 25, 2011 7:01 pm
by Firestryke31
Seeing that you're using Windows, you might consider Programmer's Notepad 2. It has syntax highlighting for x86 ASM (among many others), and can run NASM (or my preferred assembler, YASM) if you set it up to. Also, it lets you choose the extension rather than just adding .txt.