Question: Implement and test three macros for I / O . These macros should use Irvine s ReadString to get input from the user, and WriteString
Implement and test three macros for IO 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 a count 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 ASCIIformatted 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 TEMPSPERDAY CONSTANT of stringformatted integer values, separated by a delimiter. The DELIMITER must be defined as a character CONSTANT so that we can change it during testing. TEMPSPERDAY should be initially set to DELIMITER should be initially set to the comma character Convert using string primitives the string of asciiformatted 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 CONSTANTdefined DELIMITER character. 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 ParseTempsFromString and WriteTempsReverse procedures 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 ASCIIformat integers, separated by a DELIMITER. Each line of numbers will have TEMPSPERDAY values. The last number of each line also has a DELIMITER after 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! Program Requirements Irvine is the only import WriteInt may be used to print the SDWORD array. mDisplayString must be used to display all strings. Conversion routines must appropriately use the LODSB andor STOSB operators for dealing with strings. You may not use ParseInteger or other similar prewritten procedures to parse the temperatures. All procedure parameters must be passed on the runtime stack using the STDCall calling convention see Module Exploration Passing Parameters on the Stack Strings also must be passed by reference. Prompts, identifying strings, and other memory locations must be passed by address to the macros. Used registers must be saved and restored by the called procedures and macros. The stack frame must be cleaned up by the called procedure. Procedures except main must not reference data segment variables by name. There is a significant penalty attached to violations of this rule. Some global constants properly defined using EQU, or TEXTEQU and not redefined are allowed. These must fit the proper role of a constant in a program nominally static values used throughout a program which may dictate its execution method, similar to MINTEMP and MAXTEMP in Project The program must use Register Indirect addressing or string primitives eg STOSD for integer SDWORD array elements, and BaseOffset addressing for accessing parameters on the runtime stack. Procedures may use local variables when appropriate.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
