DF是什么计算机语言,x86汇编语言中的CLD和STD是什么? DF做什么?

(汇编并与section .text

global main

main:

mov ecx, len

mov esi, s1

mov edi, s2

cld ; redundant because DF is already guaranteed to be 0 on function entry

; but included for illustration purposes

loop_here:

lodsb ; AL=[esi], ESI+=1 (because DF=0, otherwise ESI-=1)

add al, 02

stosb ; [edi]=AL, EDI+=1 (because DF=0, otherwise EDI-=1)

loop loop_here ; like dec ecx / jnz but without setting flags

; ECX=0, EDI and ESI pointing to the end of their buffers

mov edx, len-1 ;message length, not including the terminating 0 byte

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)

xor ebx,ebx

int 0x80 ;call kernel: sys_exit(0)

section .data

s1: db 'password', 0 ; source buffer

len equ $-s1

section .bss

s2: resb len ; destination buffer链接。或者,如果需要,可以将其链接为静态文件nasm -felf32 caesar.asm && gcc -no-pie -m32 caesar.o -o caesar而不是_start的可执行文件。)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值