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?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
D Kar
  • 31
  • 4

1 Answers1

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.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847