Question: e had an intern working on our thermometer data storage and he messed it up . The readings are good, but the order is reversed.

e had an intern working on our thermometer data storage and he messed it up. The readings are good, but the order is reversed. We need you to write us a efficient little MASM program to read in the temperature measurements from a file, and print them out with their order corrected! This program must perform the following tasks (as always, be sure to check the Requirements section):
Implement and test three macros for I/O. These macros should use Irvines ReadString to get input from the user, and WriteString and WriteChar procedures to display output.
mGetString: Display a prompt (input, reference), then get the users keyboard input into a memory location (output, reference). You may also need to provide acount (input, value) for the length of input string you can accommodate and provide a number of bytes read (output, value) by the macro.mDisplayString: Print the string which is stored in a specified memory location (input, reference).mDisplayChar: Print an ASCII-formatted character which is provided as an immediate or constant (input; immediate, constant, or register).
Implement and test the following two procedures which use string primitive instructions
ParseTempsFromString: {parameters:fileBuffer (reference, input), tempArray (reference, output)}
fileBuffer will contain a number (TEMPS_PER_DAY(CONSTANT)) of string-formatted integer values, separated by a delimiter. The DELIMITER must be defined as a character CONSTANT so that we can change it during testing.
TEMPS_PER_DAY should be initially set to 24DELIMITER should be initially set to the comma character ,
Convert (using string primitives) the string of ascii-formatted numbers to their numeric value representations. Some values will be negative and others will be positive.Store the converted temperatures in an SDWORD array (output parameter, by reference).
WriteTempsReverse:{parameters:tempArray (reference, input)}
Print an SDWORD integer array to the screen, separated by a CONSTANT-defined DELIMITERcharacter.The integers must be printed in the reverse order that they are stored in the array.Invoke the mDisplayChar macro to print the DELIMITER character.
Write a test program (in main) which uses the ParseTempsFromStringand WriteTempsReverseprocedures above to:
Invoke the mGetString macro (see parameter requirements above) to get a file name from the user.Open this file and read the contents into a file buffer (BYTE array). File formatting follows...
The file will contain a series of positive or negative ASCII-format integers, separated by a DELIMITER.Each line of numbers will have TEMPS_PER_DAYvalues.The last number of each line also has a DELIMITERafter it.
Use ParseTempsFromString to parse the first line of temperature readings, convert them from ASCII to numeric value, and store the numeric values in an array.Use WriteTempsReverse to print the temperature values in the reverse order that they were stored in the file (print to the terminal window). Crazy interns!

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 Programming Questions!