鱼C论坛

 找回密码
 立即注册
查看: 3121|回复: 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 −

  1. section        .text
  2.    global _start        ;must be declared for using gcc
  3.        
  4. _start:                        ;tell linker entry point
  5.    mov    ecx, len
  6.    mov    esi, s1
  7.    mov    edi, s2
  8.        
  9. loop_here:
  10.    lodsb
  11.    or      al, 20h
  12.    stosb
  13.    loop    loop_here       
  14.    cld
  15.    rep        movsb
  16.        
  17.    mov        edx,20                ;message length
  18.    mov        ecx,s2                ;message to write
  19.    mov        ebx,1                ;file descriptor (stdout)
  20.    mov        eax,4                ;system call number (sys_write)
  21.    int        0x80                ;call kernel
  22.        
  23.    mov        eax,1                ;system call number (sys_exit)
  24.    int        0x80                ;call kernel
  25.        
  26. section        .data
  27. s1 db 'HELLO, WORLD', 0 ;source
  28. len equ $-s1

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-3-29 00:40

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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