Assembler mov issue

前端 未结 3 1488
庸人自扰
庸人自扰 2021-01-25 08:24

I have the next code:

mov  ax,@data
mov  ds,ax

Why I can not write just like this?

mov ds,@data

All source:

3条回答
  •  盖世英雄少女心
    2021-01-25 08:56

    General purpose register as the 'ax' is designed to hold the 16 bit number pointing to the data (in your case the string inside the DATA)

    So if you try to directly pass the data to the special register (ds or data segment here) it will not work correctly as it does not know to accept data that way. So we first get that 'number' or the point in memory location where data starts & pass that point to ds register.

提交回复
热议问题