nasmwindows-xp-sp2

NASM Error, Unrecognized output format


I'm learning NASM and DEBUG using Windows XP (32-bit) for academic purposes. I'm struggling to get my first simple HelloWorld program to work. It's called prog1.asm.

Here is the code for my prog1.asm file:

     bits 16
         org 0x100      ; Start program at offset 100h
         jmp main       ; Jump to main program
message:     db 'Hello world',0ah, 0dh,'$'
main:    mov dx,message ; Start address of message
         mov ah,09      ; Prepare for screen display
         int 21h        ; DOS interrupt 21h
         int 20h        ; Terminate program

This code above is just written out from the book that I've been using to study, as you're probably aware I'm like brand new to this. I have nasm.exe in the directory that I'm working with here.

When I'm in my directory, I run nasm -f prog1.asm -o progm1.com -l prog1.lst in an attempt to use the prog1.asm file to create the executable file prog1.com that is created by NASM and an output listing file prog1.lst also produced by NASM.

Running this command gives me the following error:

nasm: fatal: unrecognized output format 'prog1.asm' - use -hf for a list
type 'nasm -h'for help

If anyone is familiar with this problem and can help, it'd be much appreciated, let me know if more details are required.


Solution

  • -f option selects output format. Try this:

    nasm prog1.asm -f bin -o progm1.com -l prog1.lst