Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6058855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:38:44+00:00 2026-05-23T08:38:44+00:00

Beginner to assembly programming for x86. I have a simple asm file which I

  • 0

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:

enter image description here

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:38:45+00:00Added an answer on May 23, 2026 at 8:38 am

    The problem is:

    ORG 100
    

    which should be:

    ORG 100h
    

    The binary is a .COM so will load and run at 100h regardless; the error means that the address calculated by the assembler for msg will be 156 bytes earlier than it should be, hence the extra junk.

    The ORG directive is for the bin format only. Other executable formats have sections (or segments). (See the “Output Formats” section of the NASM manual.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner in assembly language and have noticed that the x86 code emitted
I'm Java beginner, but I thought that when using try-catch-finally I don't have to
I have an Assembly final tomorrow. Any one have some ideas for a programming
Beginner programmer here. So bear with me. I have a simple python program. print
Git beginner question: I have a small private webproject which is versioned locally with
CoreData beginner I have a simple problem with CoreData. My model has two entities,
As a complete beginner with no programming experience, I am trying to find beautiful
I'm a complete beginner when it comes to programming. I'm taking a stab at
I'm a beginner to reading assembly language and I'm looking for a good assembly
I'm a beginner learning some assembly, when preserving the ESP register before a function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.