( تعداد نمایش : 507 )

بدست آوردن طول رشته در اسمبلی

با استفاده از کد زیر می توانید طول رشته را در زبان برنامه نویسیassembly به دست اورید

strlen proc      ; find the length of a ASCIIZ string

push cx        ; input : ES:di point to string

push di        ; output: ax =  string length

mov cx,0FFFFh

mov al,0

cld

repnz scasb

dec di

mov ax,di

pop di

sub ax,di

pop cx

ret

strlen endp

دیدگاه خود را بیان کنید.

باید وارد سایت شده باشید برای دیدگاه دادن