Part 1:
Create a project called Practice 12. Copy RowSum.asm code found in Irvine examples chapter 9. Study the code and understand how a two dimensional array is accessed. The code uses a procedure called calc_row_sum to calculate a row sum. The row number is chosen by the user.
Modify the code so that it will calculate a column sum. For this create a procedure called calc_col_sum, which should look similar with the original procedure calc_row_sum. Use the same registers as calc_row_sum uses, and return the sum in EAX. Display the value in the console.
Your new program should be called Column Sum Calculation, which should be seen in title. As with the original code, ask the user to input a column number, which can only be between 0 and 4. The table is the same as in the original code. Calculate the sum for that column and display it together with the column number.
Here is an example:
![948_Calculate the sum for that column and display.png](https://secure.tutorsglobe.com/CMSImages/948_Calculate%20the%20sum%20for%20that%20column%20and%20display.png)
Requirements:
1.If you need intermediary values to be stored/saved do not use the main memory. Use the stack.
2. Create a procedure called calc_col_sum which uses the same registers as the original procedure EBX ECX EDX ESI.
3. The procedure return value should be in EAX.
4. The program output has to show the sum and the column chosen by the user.
5.You may define constants in the data section like the RowSize or ColSize.
Verify it builds and runs, archive it and upload it in the Student Submissions area.
Part 2:
Create a procedure called replaceChar that will replace the first character found in an array with a specified character. Your procedure should take as parameters the address of a BYTE array to search, the character to search for, and the character to replace with.
In the main program call this procedure until all matching characters are replaced. Every time you replace a character, print the whole array to show the replacement progress. For this, write another procedure called, say, printText which will print your array. printText procedure should take as parameters the address of a BYTE array
Your code should also place in the eax register the number of characters replaced and display this number on screen.
To test your procedure ask the user to input a text of maximum 40 characters. Ask him to also input the character he wants to replace, and the character to replace with. Output any appropriate messages that you feel are needed to make the program clear to the user.
Some specifics:
Your replaceChar procedure should be in it's own .asm file. You should call this procedure from your main procedure in the main.asm file, with INVOKE.
Your printText procedure should be in it's own .asm file. You should call this procedure from your main procedure in the main.asm file, with INVOKE, any time you need to print the text on screen.
Use a .inc file to keep the procedures prototypes and the inclusion of the Irvine procedures.
When the program ends report the number of replacements made.
So, to be clear, for this assignment your project has to have 3 .asm files and one .inc file.
![1000_Calculate the sum for that column and display1.png](https://secure.tutorsglobe.com/CMSImages/1000_Calculate%20the%20sum%20for%20that%20column%20and%20display1.png)