【发布时间】:2017-04-08 09:47:38
【问题描述】:
我有一个字符串,并试图找到它的长度。我正在使用 rw32-2017。我尝试使用repe scasb 扫描字符串,但它根本没有改变 ZF。
有没有更简单的方法来查找字符串的长度?
我的程序:
%include "rw32-2017.inc"
section .data
; write your data here
string1 db "how long is this string",0
section .text
main:
mov ebp, esp
; write your code here
mov esi,string1
mov eax,0
mov ecx,50 ;max length of string is 50
mov ebx,ecx
cld
repe scasb
sub ebx, ecx
mov eax,ebx
call WriteUInt8
ret
【问题讨论】: