LAB5 Implementation of String Instructions
LAB5 Implementation of String Instructions
Objective
Linking Irvine64 with the Visual Studio code
s
Learning available strings’ functions in Irvine64
o Basic Syntax, Semantics and default registers
o Str_compare, Str_copy, Strjlength
Implementation of strings using Irvine64 library functions
Although this library is much smaller than the 32-bit link library, it still contains many important
tools to make the program more interactive. With the deepening of learning, you can use your
own code to expand this link library. The Irvine64 link library will retain the RBX, RBP, RDI,
RSI, R12, R13, R14, and R15 register values. On the contrary, the RAX, RCX, RDX, R8, R9,
R10 and R11 register values will not be retained.
Practice Code:
ExitProcess proto
WriteString proto
WriteInt64 proto
Str_copy proto
Str_compare proto
Str_length proto
Crlf proto
.data
String1 db "This is my first string",0
String2 db "This is my second string",0
String3 db "Test the length of string",0 ;25 characters
string4 db "Total number of characters in a string: ",0
source_string db "This string is being copied", 0
dest_string db 100 dup(?) ;input buffer for string
total_length dq ?
.code
main proc
;*************************WRITE STRING**********************************
mov rdx, offset string1 ;pass the address of the string to be written in the rdx
call Crlf
call WriteString ;write string to the console
call Crlf ;line ending sequence
Practice Code:
;*************************WRITE STRING**********************************
mov rdx, offset string2 ;pass the address of the string in the rdx
call Crlf
call WriteString ;write string to the console
call Crlf ;line ending sequence
Output:
Perform the following tasks.
1. Find out the total length of a string.
Output:
2. Write a program to check whether two strings are equal or not. Display message
“Both strings are equal, if equal. Otherwise display “Both strings are not equal”.
Output:
Equal
Not equal: