+ -
当前位置:首页 → 问答吧 → 如果有了assume sg:stack,还需要mov ax,sg;mov ss,ax这样的语句么?

如果有了assume sg:stack,还需要mov ax,sg;mov ss,ax这样的语句么?

时间:2011-09-17

来源:互联网

我知道assume ds:data的含义,如果mov语句用寄存器寻址[bx],那么这句assume就默认了ds是段寄存器ds:[bx]
但是对于堆栈段我感觉是多余的。因为: 既然sg的定义是:

sg segment
...

那么还需要
mov ax,sg
mov ss,ax

这样的语句么?
----------------------------------------------------
(1) assume了以后,pop/push就是把sg作为堆栈段操作啊
为什么还要设置ss/sp寄存器呢?

(2) -->换句话说,既然有了mov ax,sg; mov ss,ax这两句话,那么已经保证了pop/push不会出错,那还需要在程序头部去assume一下sg呢?
感觉多次一举

作者: asserw   发布时间: 2011-09-17

The "ASSUME segregister:seglocation" syntax is used to inform the
  assembler of the current value of <segregister>. The assembler
  uses this information to calculate offsets correctly and to guard
  against segment selection errors. This directive does not generate
  code to change the value of <segregister>. The ASSUME directive is
  not necessary for the CS register, since CS is assumed to the

  current segment or group automatically. The <seglocation> can be any
  segment or group name, or an equivalent expression.

如果问题解决就请及时结帖,谢谢:)

作者: s11ss   发布时间: 2011-09-17

热门下载

更多