鱼C论坛

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

小白求助 关于汇编指令 stos的问题

[复制链接]
发表于 2020-5-15 19:04:46 | 显示全部楼层 |阅读模式

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

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

x


问题描述:
mov al,0xff
mov edi,0x12ffdc
stos byte ptr es:[edi]  //将al 寄存器中的数据拷贝到edi(12ffdc)后   edi的值 会增加或者减少

然后再次执行
mov ax,0xAAAA
stos word ptr es:[edi] //为啥还是往12ffdc中拷贝数据 前面的edi的值不是变化了吗?
stos疑问.PNG
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-5-15 19:05:26 | 显示全部楼层
图和上面数据不一样 大家伙将就着看吧
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-5-18 10:23:13 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-5-25 18:12:33 | 显示全部楼层
https://www.tutorialspoint.com/a ... tos_instruction.htm

The STOS instruction copies the data item from AL (for bytes - STOSB), AX (for words - STOSW) or EAX (for doublewords - STOSD) to the destination string, pointed to by ES:DI in memory.

The following example demonstrates use of the LODS and STOS instruction to convert an upper case string to its lower case value −
section        .text
   global _start        ;must be declared for using gcc
        
_start:                        ;tell linker entry point
   mov    ecx, len
   mov    esi, s1
   mov    edi, s2
        
loop_here:
   lodsb
   or      al, 20h
   stosb
   loop    loop_here        
   cld
   rep        movsb
        
   mov        edx,20                ;message length
   mov        ecx,s2                ;message to write
   mov        ebx,1                ;file descriptor (stdout)
   mov        eax,4                ;system call number (sys_write)
   int        0x80                ;call kernel
        
   mov        eax,1                ;system call number (sys_exit)
   int        0x80                ;call kernel
        
section        .data
s1 db 'HELLO, WORLD', 0 ;source
len equ $-s1

section        .bss
s2 resb 20              ;destination
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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