Computing length of a string using Linux assembly


1) Write a function in Linux assembly that computes the length of a string, called my_strlen. The function needs to take the pointer to a string as its only argument and return the number of characters in the string. You may assume that all strings are zero-terminated. Do not count the zero byte. You may not use the rep* or scas* instructions for this part of the assignment.

2) Write a Linux assembly program that prints out a string to the console, followed by a new line that contains the number of characters in the string (excluding any zero-character at the end of the string). The string should be "hard-coded" in your .data section as follows and be exactly like that: string: .ascii "Hello, world!\n\0" Your routine should first compute the length of the string using your my_strlen function from Task 1, then print out the string, and then print out that length. You may not use any additional items in your .data section or any additional sections other than .text and .data. Strings can be of arbitrary length (i.e. you cannot assume that the string length has a maximum number of digits). You may not overwrite the string. You may not use C library functions.

Request for Solution File

Ask an Expert for Answer!!
Assembly Language: Computing length of a string using Linux assembly
Reference No:- TGS053

Expected delivery within 24 Hours