You work for a software company and, one day, your manager comes and says:
"We have large databases with a lot of numbers. In our software, many times they are being handled as matrices. As you may already know, we end up doing matrix operations on these large, memory hog, arrays. Therefore, we decided that some operations be done in assembly, so that they are handled more efficiently. Here is what I need you to do." And he explains you the project:
Create an assembly program that takes two arrays. To prove that the program works, ask the user to input 2 arrays, each of 8 elements. Do not hard code the number eight. Use SIZEOF, LENGTHOF and other techniques to make your program adaptable to any array size.
Calculate the sum of the two arrays, by adding element by element and deposit the result in the first array memory location.
Calculate the difference of the two arrays, by subtracting the first array from the second, element by element, and deposit the result in the second array.
Print out both arrays in two columns, side by side, with a few spaces between them. Each array has to be in a different color other than the screen default which is lightGray. Choose any colors you wish. The columns have to have headers showing "sum" and "difference". Also, output a message to indicate that the following columns are the sum and difference. Make sure you do not leave the screen in a different color other than lightGray. When your program exits, the color has to return back to lightGray. Choose the colors carefully. For example, one cannot read numbers which are blue on black or black on black. If you want to use blue as an example, set the background to white or anything else that makes the numbers readable.
Your manager tells you that he does not want you to create new arrays for this process, because he wants you to preserve memory resources, especially when your program will be used to calculate large arrays. He gives you one week for this project.
You go off and start your project. To change the text color, call the SetTextColor procedure from the book's link library. Any colors may be chosen, but you may find it easiest to change the foreground color.
Very important: Do not hardcode numbers in your procedures. Do not increment the arrays with hard numbers.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
;// .model flat,stdcall
;// .stack 4096
ARRAY_SIZE = 8
.data ;// write your data in this section
array1 DWORD ARRAY_SIZE DUP(0)
array2 DWORD ARRAY_SIZE DUP(0)
msg1 BYTE "Enter ", 0
msg2 BYTE " numbers for first array", 0
msg3 BYTE " numbers for second array", 0
msg4 BYTE "The sum and difference of the entered arrays are ", 0dh, 0ah, 0dh, 0ah, 0
msg5 BYTE "sum ", 0
msg6 BYTE "difference", 0dh, 0ah, 0
msg7 BYTE " ", 0...
This is only a preview of the solution. Please use the purchase button to see the entire solution