鱼C论坛

 找回密码
 立即注册
查看: 2621|回复: 3

[已解决]小白求助 关于 movs和stos 的增减方向问题

[复制链接]
发表于 2020-5-6 18:38:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
问题:
movs 指令在D标志位为0的时候  edi和esi都是加地址数吗?在D标志位为1的时候 使用movs edi  和 esi都是加地址数?
stos指令 在D标志寄存器为0的时候 edi是加地址数?D标志位为1的时候 减地址数?
最佳答案
2020-5-15 13:25:35
本帖最后由 xie1234abc 于 2020-5-15 13:53 编辑

        mov ax,data1
        mov ds,ax
        mov si,0
       
        mov ax,data2
        mov es,ax
        mov di,0
       
        cld                                          ;将DF置0,正序传送。
        movs byte ptr es:[di],ds:[si]       ;传第0个,后将si/di加1
        movs byte ptr es:[di],ds:[si]       ;这时si/di为1,所为是传第1个,后将si/di加1

        mov si,15
        mov di,15
        std                                       ;将DF置1,逆序传送。
        movs byte ptr es:[di],ds:[si]   ;传第15个,后将si/di减1
        movs byte ptr es:[di],ds:[si]    ;这时si/di为14,所为是传第14个,后将si/di减1
手打的,很累,望采纳!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-5-6 22:21:07 | 显示全部楼层
MOVS - Move String (Byte or Word)
        Usage:  MOVS    dest,src
                MOVSB
                MOVSW
                MOVSD  (386+)
        Modifies flags: None
        Copies data from addressed by DS:SI (even if operands are given) to
        the location ES:DI destination and updates SI and DI based on the
        size of the operand or instruction used.  SI and DI are incremented
        when the Direction Flag is cleared and decremented when the Direction
        Flag is Set.  Use with REP prefixes.

                                 Clocks                              Size
        Operands     808x  286  386  486          Bytes
        dest,src          18    5     7     7             1   (W88=26)


STOS - Store String  (Byte, Word or Doubleword)
        Usage:  STOS    dest
                STOSB
                STOSW
                STOSD
        Modifies flags: None
        Stores value in accumulator to location at ES:(E)DI (even if operand
        is given).  (E)DI is incremented/decremented based on the size of
        the operand (or instruction format) and the state of the Direction
        Flag.   Use with REP prefixes.

                                 Clocks                 Size
        Operands     808x  286   386   486          Bytes
        dest              11    3     4     5             1  (W88=15)


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-5-7 16:46:52 | 显示全部楼层
上善若水··· 发表于 2020-5-6 22:21
MOVS - Move String (Byte or Word)
        Usage:  MOVS    dest,src
                MOVSB

看不懂啊 大佬
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-5-15 13:25:35 | 显示全部楼层    本楼为最佳答案   
本帖最后由 xie1234abc 于 2020-5-15 13:53 编辑

        mov ax,data1
        mov ds,ax
        mov si,0
       
        mov ax,data2
        mov es,ax
        mov di,0
       
        cld                                          ;将DF置0,正序传送。
        movs byte ptr es:[di],ds:[si]       ;传第0个,后将si/di加1
        movs byte ptr es:[di],ds:[si]       ;这时si/di为1,所为是传第1个,后将si/di加1

        mov si,15
        mov di,15
        std                                       ;将DF置1,逆序传送。
        movs byte ptr es:[di],ds:[si]   ;传第15个,后将si/di减1
        movs byte ptr es:[di],ds:[si]    ;这时si/di为14,所为是传第14个,后将si/di减1
手打的,很累,望采纳!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-9-27 21:19

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表