Segmentation notation
Asked Answered
G

1

0

I am trying to understand some of the programs that were written for MS DOS. Does the instruction mov ax, ds:4Ch move the value of ds*16 + 4Ch or does it move the value stored at the address ds*16 + 4Ch?

Germanium answered 23/1, 2019 at 20:58 Comment(1)
The latter. In fact, there is no direct way to load the value ds*16 + 4Ch.Biblio
M
1

It's a memory operand because it uses ds:. MASM-style Intel syntax doesn't require [] around memory operands.

Also, there's no single machine instruction that will calculate a linear address in an integer register. The whole point of segmentation is to deal with linear addresses that are too big for a single register. You can do it manually if you want if you're in real mode (where the segment register value is the base, like mov ax, ds / shl ax, 4), but not as easily if the segment register value is just a selector. 286/386 protected mode, or Unreal mode.

lea ax, [es: bx + si + 12] for example only deals with offset calculations, ignoring the segment base.

Malinin answered 23/1, 2019 at 21:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.