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 8617929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:59:16+00:00 2026-06-12T05:59:16+00:00

I am reading some assembly for MASM and I have trouble understanding the purpose

  • 0

I am reading some assembly for MASM and I have trouble understanding the purpose of segment directive. How is it different from labels in address computation during the assembly? Assume the form directive as just name segment at addr, I dont much care for those other options it has. What is

BootSeg segment at 0x7c0
BootSeg end

good for if it has nothing within?

What value would you have in ax if you did:

mov ax, BootSeg

?

  • 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-06-12T05:59:17+00:00Added an answer on June 12, 2026 at 5:59 am

    The segment directive is sort of multipurpose.

    The first use is to combine things into segments.

    The second use is to refer to (= calculate address of) objects in various segments properly. Depending on the segment of an object being accessed in your code, the assembler can insert appropriate segment override prefixes (es:, ss:, cs:, fs:, gs:) into the generated code. Likewise when calling a procedure from a different code segment, the assembler can generate the far call instruction instead of the near call. AFAIR, for that you actually need to mark the procedure itself as far (and that will turn all plain rets into far rets in the routine as well).

    The segments are then taken care of by the linker and turned into relocation information that’s consumed by the OS.

    Why do we have these segments? Because the CPU has them and we can’t always ignore their existence. There are DOS .COM programs that fit their code, data and stack into a single segment, in which case the program does not have to be complicated by the notion of segments (except those cases when it needs to access some “foreign” code/data, not from its own segment).

    And yes, the AT thing basically overlays one object on top of the other. So mov ax, BootSeg should get you ax = 0x7c0 just as with any other segment, except here the segment is known at “compile” time.

    Use a debugger, experiment.

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

Sidebar

Related Questions

I have some 8086 assembly code that's going to be calling interrupts for reading
I'm reading in from a text file that contains some assembly instructions that look
I have a question regarding using some features from the System.Linq.Dynamic assembly. I needed
I was reading some assembly tutorial in which there were explained the signed integers
I'm reading The Art of Assembly: The MMX Instruction Set , After executing some
Reading some posts from Jimmy Boggard and wondering - how exactly is it possible
After reading some articles about XSS I have incorporated HTMLPurifier into my zend framework
I am reading some book and I have encountered a piece of code that
So I've never done any assembly programming (although I did some reading/reasoning out the
I've just begun learning some x86 assembly on win32, and I've used masm with

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.