Starting from:

$35

CS 3844 -Computer Organization - Lab #08 Solved



Before doing this lab, make sure to do Lab7 since all of the code is the same. In this case, you will complete FUNC2_Student which also finds the length of a string and stores it in the 2nd parameter as before. The difference is that this time, you MUST make use of the string instructions, introduced in Lab #7. Your output should look exactly the same as that from Lab #7.

 

1.     Write an assembly program that finds the length of string using the string instructions. Put this code inside FUNC2_Student and run the program to make sure it works the same as in Lab #7.

 

2.     Modify your program so that it finds the index of an arbitrary character. A 3rd parameter passed in will be a single character and the value put in *par2 is the number of characters before the character X. (Hint: scas).

 

FUNC3_Student( char *par1, int *par2, char X);

 

For example, if we search string n = “Exams are fun!” for ‘!’, the result is 13. I encourage you to trace through your code, try different strings, and different search characters. Pay attention to how the one character value is passed to the stack.

 

Solutions will be posted in the FUNC2_Solution file.  NOTE: We will call FUNC3 directly and not pass through FUNC0.

More products