Beginner to assembly programming for x86. I have a simple asm file which I assemble using nasm version – NASM version 2.10rc6 compiled on Jun 6 2011, for windows(My windows is Windowa-7 64 bit). NASM is downloaded from here ( nasm-2.10rc6-win32.zip).
ORG 100
USE16
mov ah, 09
mov dx, msg
int 21h
mov ah, 01
int 21h
mov ah, 4ch
int 21h
msg db 'Hello assembly', 0Ah, '$'
Then I assemble using command –
nasm -f bin hello.asm -o hello.com
Then I run the generated executable hello.com using Dosbox(Dos emulator for 64 bit OS Windows-7).
When it runs the output output on the console has my string ‘Hello assembly’ plus some junk characters/control characters printed before it, as shown below:

What is the reason for this. Anything wrong in the code?
What do I need to do to fix this?
EDIT: When i tried to give a option -f to nasm to generate a specific type of executable output , e.g. Win32 or Win64 output i keep getting error saying:
nasm -f win64 hello.asm -o hello.com
hello.asm:1: error: parser: instruction expected
What is it expecting? How can i generate a win32/win64 executable using nasm? or for that matter any other executable like elf32/coff, which nasm says it supports?
The problem is:
which should be:
The binary is a
.COMso will load and run at100hregardless; the error means that the address calculated by the assembler formsgwill be 156 bytes earlier than it should be, hence the extra junk.The
ORGdirective is for thebinformat only. Other executable formats have sections (or segments). (See the “Output Formats” section of the NASM manual.)