Chapter 4 · Simulation

Segment:Offset Calculator

← Chapter 4
Correct 0 / 0
Segment registers and offset
Physical address = segment × 10h + offset

Segment:Offset Calculator

Goal: See how the 8086 reaches a 20-bit (1 MB) address space with 16-bit registers: physical address = segment × 16 + offset.

How to use it

  • Type hexadecimal values (up to 4 digits) into the four segment registers (CS, DS, ES, SS) and the offset. The button carrying a register's name selects the segment register used in the calculation.
  • The calculation card shows the addition digit by digit: the segment value shifts left by one digit (a 0 is appended, × 10h) and is added to the offset.
  • The left of the map shows the 1 MB address space and the 64 KB regions of the four segments; the right shows the window of the selected segment and the position of the address.
  • The pair buttons load other segment:offset pairs that point to the same physical address.
  • Try it yourself: type the physical address, or the offset that is needed, in hexadecimal.

Reminder

  • A segment is a 64 KB window that starts at address segment × 16. Segments start on 16-byte boundaries and may overlap; in .COM programs CS = DS = ES = SS, so all four are the same region.
  • The same physical address can be written with many segment:offset pairs (up to 4096 pairs): if the segment grows by 1 and the offset shrinks by 16, the address stays the same.
  • The 8086 has 20 address lines; if the sum exceeds FFFFFh, the 21st bit is lost and the address wraps around: FFFF:0010 = 00000h. (In later processors this behavior is controlled by the A20 line.)
  • Default segments: instructions CS:IP, the stack SS:SP, addresses containing BP use SS, other data accesses DS, the string destination ES:DI.

Related slides: Chapter 4.1 · Memory Access (segment and offset, segment prefix) and Chapter 2.1 · 8086 Architecture (segmented memory architecture, same address with different segment:offset).