汇编语言绝对地址和段寄存器 [英] Assembly Language Absolute addresses and segment registers

查看:626
本文介绍了汇编语言绝对地址和段寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

进行审查的问题列出了这些寄存器十六进制:

  CS = ???? SP = 0300 AX = a66a IP = 01cf
DS = 4100 = BP BX 0003 = 1234
SS = 48ee SI = 0100 CX = 00FF
ES = 4cee迪= 1000 DX = 0000


  1. 要执行的下一个指令的绝对地址是40f0f。

      40f0f
    -01cf
    _____
    40d40 / 10 = 40d4 = CS


  2. 是字节数据段总是等于堆栈段减去数据段* 10的尺寸是多少? 48ee - 4100 = 7ee0。同样,在总是等于数据段减去code段* 10字节code段? 48ee - 40d4 = 81a0


  3. 有关 MOV CX,[BX + SI] ,源操作数的绝对地址为42334。

      BX = 1234
    SI = 0100
    _________
         1334DS = 4100 * 10 = 41000 + 1334 = 42334


  4. 有关 MOV CX,[二 - 4]。,源操作数的绝对地址是41ffc

     迪= 1000
          - 4
    _________
         0FFCDS = 4100 * 10 = 41000 + 0ffc = 41ffc


  5. 有关 MOV CX,[BP + SI - 3]。,源操作数的绝对地址是48fe0

      BP = 0003
    SI = 0100
           - 3
    _________
         0100SS = 48ee * 10 = 48ee0 + 0100 = 48fe0


我要对解决这些正确的方法是什么?我怎么知道什么时候使用堆栈段这些计算以及何时使用数据段?


解决方案

有关涉及地址计算 BP SP 或者像弹出段寄存器是隐含 SS ,其他地址 DS 。例外:如果你使用一个字符串指令,目标段寄存器是隐含 ES

a review problem lists these registers in hex:

cs = ????  sp = 0300  ax = a66a  ip = 01cf
ds = 4100  bp = 0003  bx = 1234  
ss = 48ee  si = 0100  cx = 00ff
es = 4cee  di = 1000  dx = 0000

  1. The absolute address of the next instruction to be executed is 40f0f.

    40f0f  
    -01cf
    _____
    40d40 / 10 = 40d4 = cs
    

  2. Is the size of the data segment in bytes always equal to the stack segment minus the data segment * 10? 48ee - 4100 = 7ee0. Likewise, is the code segment in bytes always equal to the data segment minus the code segment * 10? 48ee - 40d4 = 81a0.

  3. For mov cx,[bx + si], the absolute address of the source operand is 42334.

    bx = 1234
    si = 0100
    _________
         1334
    
    ds = 4100 * 10 = 41000 + 1334 = 42334
    

  4. For mov cx,[di - 4], the absolute address of the source operand is 41ffc.

    di = 1000
         -  4
    _________
         0FFC
    
    ds = 4100 * 10 = 41000 + 0ffc = 41ffc
    

  5. For mov cx,[bp + si - 3], the absolute address of the source operand is 48fe0.

    bp = 0003
    si = 0100
          - 3
    _________
         0100
    
    ss = 48ee * 10 = 48ee0 + 0100 = 48fe0
    

Am I going about solving these the right way? How do I know when to use the stack segment for these calculations and when to use the data segment?

解决方案

For address calculations involving bp or sp or stack operations like push or pop the segment register is implicitly ss, for other addresses ds. Exception: If you use a string instruction, the destination segment register is implicitly es.

这篇关于汇编语言绝对地址和段寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆