RosettaCodeData/Task/String-length/X86-Assembly/string-length.x86

25 lines
391 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
.data
string: .asciz "Test"
.text
.globl main
main:
pushl %ebp
movl %esp, %ebp
pushl %edi
xorb %al, %al
movl $-1, %ecx
movl $string, %edi
cld
repne scasb
not %ecx
dec %ecx
popl %edi
;; string length is stored in %ecx register
leave
ret