Str_compare proc Str_length PROC Str_copy PROC

来源:互联网 发布:网络动画视频 编辑:程序博客网 时间:2024/06/17 22:32
;Str_CompareINVOKE Str_compare,ADDR string1,ADDR string2Str_compare PROC uses eax edx esi edi,string1:ptr bytestring2:ptr byte;;compare two strings;return nothing,but the zero and carry flags are affected;exactly as they world be by the cmp instructionmov esi,string1mov edi,string2L1:mov al,[esi]mov dl,[edi]cmp al,0jne L2cmp dl,0jne L2jmp L3L2:inc esiinc edicmp al,dlje L1L3: retStr_compare ENDP




Str_length PROC USES EDI,pString:PTR BYTEmov edi,pStringmov eax,0L1:cmp byte ptr [edi],0je L2inc ediinc eaxjmp L1L2:retStr_lengh ENDP


Str_copy PROC USES eax ecx esi edi,source:ptr bytetarget:ptr byte;;requires:the target string must contain enough;space to hold a copy of  the source stringinvoke Str_length,sourcemov ecx,eaxinc ecxmov esi,sourcemov edi,targetcldrep movsbretStr_copy ENDP


0 0