2

I'm new to Assembly, and reading my school books I noticed it said MOV AX, data followed by MOV DS, AX was to initialise the Data Segment register (which I fully understand), but what confuses me is in the first instruction, MOV AX, data moves the content of 'data' to AX, but shouldn't it be it's adress?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Tarmius
  • 31
  • 2
  • 2
    Yes, the assembler knows `data` is a segment so it loads the proper segment value. This is different from a normal variable. – Jester May 04 '20 at 22:22
  • 2
    `data` is special as it is the name of a segment (EMU8086 is rather lax, other assemblers usually force you to use `@data` or `seg data` to be clearer that one is dealing with a segment). When generating a DOS EXE these segments are added to a table in the EXE (a fixup table). They are fixed up after DOS loads the executable in memory as the segment isn't known until the program is loaded in memory and ready to run. – Michael Petch May 04 '20 at 22:30

0 Answers0