Question: Write a program that generates the 50 values 1+1, 2+2, 3+3, ..., 50+50, stores them in an array of doublewords, and writes the doubleword array

Write a program that generates the 50 values 1+1, 2+2, 3+3, ..., 50+50, stores them in an array of doublewords, and writes the doubleword array to a disk file. (You are not required to performany error checking on the file output.) Your output file size should be 200 bytes since each doubleword is 4 bytes. The file contains binary numbers, and therefore you cant view it with an application like Notepad or Word. Use Visual Studio(File>Open>File...), a text editor with more capabilities than Notepad,or the Java program DisplayFileInHex.java to open/inspect the file.

In this assignment, create/useat least one procedure as follows (but please feel free to create additional procedures):

;-------------------------------------------------------------------------------- ; Computes sums of numbers 1+1, 2+2, ... (type DWORD) and stores them in an array ; Receives: ECX = count of numbers whose sums are to be computed ; EDI = offset of array of sums ; Returns: nothing ;-------------------------------------------------------------------------------- computeSums PROC

The main program would first initialize ECX to 50 and EDI to the offset of the array, and then the main program would call compute Sums to fill the array with values. Important:This procedure should not perform any I/O. All I/O should be performed in the main procedure or in a separate procedure. Also, within this procedure,try to reference the array of sums using indirect operands, with EDI as the address the address register; i.e.,try not to reference the array of squares by the name used to declare it in the data segment of your program.

Note: Do not use the USES operator in this program or any programs for this course. Save/restore (push/pop) your registers manually within the procedure. Hint: Create the squares and put them in an array of double words by calling the procedure outlined above. Then use these two procedures from the Irvine library to write the array of numbers to a file. CreateOutputFile WriteToFile

Note that procedure WriteToFile requires a file handle in EAX. How do you get a file handle? ProcedureCreateOutputFileputs one there for you if the file is successfully created.

The essential part of your output should look like the following:

02 00 00 00 04 00 00 00 06 00 00 00 08 00 00 00

0A 00 00 00 0C 00 00 00 0E 00 00 00 10 00 00 00

12 00 00 00 14 00 00 00 16 00 00 00 18 00 00 00

1A 00 00 00 1C 00 00 00 1E 00 00 00 20 00 00 00

22 00 00 00 24 00 00 00 26 00 00 00 28 00 00 00

2A 00 00 00 2C 00 00 00 2E 00 00 00 30 00 00 00

32 00 00 00 34 00 00 00 36 00 00 00 38 00 00 00

3A 00 00 00 3C 00 00 00 3E 00 00 00 40 00 00 00

42 00 00 00 44 00 00 00 46 00 00 00 48 00 00 00

4A 00 00 00 4C 00 00 00 4E 00 00 00 50 00 00 00

52 00 00 00 54 00 00 00 56 00 00 00 58 00 00 00

5A 00 00 00 5C 00 00 00 5E 00 00 00 60 00 00 00

62 00 00 00 64 00 00 00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!