WA5 - mov esi,source mov edi,target add edi,5 cld rep movsb...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 cld c mov esi,OFFSET source mov edi,OFFSET dest mov ecx, 2 rep movsb r shl dest,16 mov esi,OFFSET source2 mov edi,OFFSET dest mov ecx, 2 rep movsb mov eax, dest call WriteHex call Crlf ----------- TITLE String Concatenate (StrConcat.asm) INCLUDE Irvine32.inc INCLUDE Bsearch.inc STRING_SIZE = 10 S Str_concat PROTO, source:PTR BYTE, target:PTR BYTE .data targetStr BYTE "ABCDE",10 DUP(0)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 sourceStr BYTE "FGH",0 .code main PROC mov edx,OFFSET targetStr call WriteString call Crlf call WaitMsg mov eax,LENGTHOF sourceStr INVOKE Str_concat, ADDR sourceStr, ADDR targetStr mov edx,OFFSET targetStr call WriteString c call Crlf exit main ENDP FillString PROC USES eax edi ecx edx, pString:PTR DWORD, Count:DWORD, string_1:SDWORD, string_2:SDWORD mov edi,pString mov ecx,Count mov edx,string_1 sub edx,string_2 L1:mov eax,edx add eax,string_2 stosd loop L1 ret FillString ENDP Str_concat PROC USES eax ecx esi edi, source:PTR BYTE,
Background image of page 2
Sheet1 Page 3 target:PTR BYTE mov ecx,eax
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: mov esi,source mov edi,target add edi,5 cld rep movsb ret Str_concat ENDP END main Sheet1 Page 4 clear direction flag. write the hex value of eax This program concatenates a source string to the end of a target string. source string target string Sheet1 Page 5 Display------------------------------------------------------------pointer to array number of elements ABCDE FGH Fills the string with "ABCDE", then concatenates, "FGH" onto it. Returns: nothing------------------------------------------------------------EDI points to the string loop counter EDX = absolute range (0. .n) get absolute range bias the result store EAX into [edi]------------------------------------------------------------source string Sheet1 Page 6 target string------------------------------------------------------------EAX = length source direction = forward copy the string...
View Full Document

Page1 / 6

WA5 - mov esi,source mov edi,target add edi,5 cld rep movsb...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online