Author Topic: nasm:fatal:unable to open output file 'ex05.com'  (Read 34863 times)

Offline filxy

  • Jr. Member
  • *
  • Posts: 8
nasm:fatal:unable to open output file 'ex05.com'
« on: October 13, 2012, 12:47:17 PM »
when i type the command nasm ex05.asm -o ex05.com -l ex05.lst
i get this error how to resolve this  .i am using windows 7 32bit.

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #1 on: October 13, 2012, 01:28:54 PM »
The only thing I can think of off the top of my head is that either your disk is full or you do not have write privileges in the directory where you are trying to create the output file.

To test:
Code: [Select]
C:> copy con test.txt
Hello, world.
^Z

That ^Z is a Control-Z key combination.  If you then do a dir *.txt in the same directory do you see the test.txt file?

Offline filxy

  • Jr. Member
  • *
  • Posts: 8
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #2 on: October 13, 2012, 01:36:01 PM »
it says z is not recognized as an internal or external command.operable program or batch file

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #3 on: October 13, 2012, 02:34:59 PM »
That's weird! You understand that "^z" means to hold down the control key while typing 'z', right?

As another test to see if you've got write permission, try editing "ex05.asm" - just add a comment, or just a space - and see if you can save it. I don't know how to get write permission in Windows if you haven't got it.

Unlikely that your disk is full, but just "dir" should tell you that... I can't think of anything else either.

Best,
Frank


Offline filxy

  • Jr. Member
  • *
  • Posts: 8
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #4 on: October 13, 2012, 02:40:54 PM »
ok i got it but i couldn't get dir *.txt or it didn't find test.txt

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #5 on: October 13, 2012, 07:59:28 PM »
First, let's make sure you are in a directory that you CAN write to.

From the DOS prompt execute the following command:

Code: [Select]
C:> CD %USERPROFILE%

That will move you to your "home" directory where you do have write priveleges.
Using Windows File Explorer - copy the ex05.asm file to that same directory.
Now attempt to assemble the file.  What happens?
 

Offline filxy

  • Jr. Member
  • *
  • Posts: 8
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #6 on: October 13, 2012, 08:55:17 PM »
still the same error  output file unable to open 'ex05.com'

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #7 on: October 13, 2012, 09:15:37 PM »
filxy,
take a screenshot of just the DOS window that shows where you are in the directory structure, the command line where you execute nasm, and the resulting error.  Attach the screenshot here so we can see the results.  Hopefully that will give us a clearer picture to help resolve for you.

ps: Do you happen to already have a file named ex05.com in the directory you are trying to assemble in?  If you do, and that file is write protected, that would also explain the problem.  In that case you would need to do the following to remove write-protection:
Code: [Select]
attrib -r ex05.com
« Last Edit: October 13, 2012, 09:19:46 PM by Rob Neff »

Offline filxy

  • Jr. Member
  • *
  • Posts: 8
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #8 on: October 14, 2012, 10:27:35 AM »
 i created the file ex05.asm by using edit ex05.asm and i wrote a code over there .

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #9 on: October 14, 2012, 02:35:32 PM »
Ok.  Let's try and get to the bottom of this.
Attach the source file ex05.asm and the output of the following:

Code: [Select]
C:\assembly> where nasm

C:\assembly> nasm -v

C:\assembly> dir ex05.*

C:\assembly> attrib *.*

I'll try to recreate the exact scenario.

Offline filxy

  • Jr. Member
  • *
  • Posts: 8
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #10 on: October 14, 2012, 06:12:10 PM »
here is the output of which you told and the ex05.asm file

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #11 on: October 14, 2012, 07:07:46 PM »
Three items of note:

1. Your source is missing a space between [org 0x100].

2. That is an OLD version of Nasm.  I don't even have a copy laying around to test with.
Can you download and install the latest version of Nasm v2.10.05 and let me know your results?
You can download from here: http://www.nasm.us/pub/nasm/releasebuilds/2.10.05/

3. Unless you also have a DOS emulator installed you will not be able to actually run DOS programs from Windows 7 even though Nasm will generate them.  Backward compatibility of 16-bit DOS executables does not exist in Win7.
Unless you have a very specific need to program a DOS app might I suggest that you invest your time learning 32-bit programming instead.

Offline filxy

  • Jr. Member
  • *
  • Posts: 8
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #12 on: October 15, 2012, 12:46:46 PM »
Thank you so much it is working now  :) can you also tell me i want to use MASM so what should i install and from where ?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #13 on: October 15, 2012, 01:41:38 PM »
Well, you can get it from MicroSoft, of course. Probably the easiest way to get what you need for 32-bit Windows programming is the MASM32 package. http://www.masm32.com/

What did you do to get Nasm working?

Best,
Frank


Offline filxy

  • Jr. Member
  • *
  • Posts: 8
Re: nasm:fatal:unable to open output file 'ex05.com'
« Reply #14 on: October 15, 2012, 05:08:26 PM »
i just downloaded nasm 2.10.05 and copied it to assembly folder and it worked !