0

If the first address of data segment in an 8086 assembly program is 0000, then what is the last address (in hex)?

If that depends on the amount of ram installed, then I'm talking about dosbox.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    Your question is a bit confusing. There is no single data segment on the 8086. You can use any segment you like by pointing the segment registers at it. Please try to clarify your question. Note that you can ask the BIOS how much RAM you have using [`int 12h`](http://www.ctyme.com/intr/rb-0598.htm). – fuz Apr 19 '18 at 13:00

2 Answers2

3

A segment in the 8086 is always just 65536 bytes.
Therefore the highest address in the data segment is 65535 or 0FFFFh in hexadecimal.

This does not depend on the amount of RAM installed!

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
Fifoernik
  • 9,779
  • 1
  • 21
  • 27
  • 2
    But the validity of address does depend upon where the physical address points to, i.e. using `9F00:C000` on PC with 256kB RAM will not work (properly). It's just unrelated to the `segment:offset` scheme, that one always takes two 16 bit values (0000-FFFF) – Ped7g Apr 19 '18 at 12:31
  • The technical term for that part of an address is the "offset" (i.e. offset relative to the segment base). And yes 0xFFFFh is the highest possible offset for actual 8086, but a 386 in real mode can have higher segment limits (aka "unreal" mode). [Segment size in x86 real mode](//stackoverflow.com/q/17786357), possibly a duplicate. – Peter Cordes Apr 19 '18 at 13:16
1

8086 architecture can address 1MB of ram which starts at 0x00000 and ends at 0xfffff.

What's important is, that you cannot access whole address space at once with single segment. When you use ds segment register (or any other) you can manipulate up to 64kB of RAM at once.

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
Michał Walenciak
  • 4,257
  • 4
  • 33
  • 61
  • And the 0000 page is reserved in 16b for interrupt vector/handler table, then some pages are used by BIOS, drivers, DOS, then the executable is loaded, and the executable can find in the PSP area the maximum page usable by the app, usually 9FFF, but can be less. Pages at A000-C000 are usually used to map VGA video memory, and somewhere above the BIOS has some further data and/or shadow copy, so the actual usable range for DOS app from that 1MB is roughly around 0400-9F00 (~620kB), to use full 1MiB of RAM you need to use "high-memory" managers like XMS/EMS or 32b mode. – Ped7g Apr 19 '18 at 12:29