Question description

1. Write the AL application code that support the following pseudo-code
 Assume a procedure GetInteger exists. It returns in EAX an integer value input by the
user.
 Assume a procedure PutInteger exists. It displays on the screen an integer value passed to
it in EAX.
 Assume a procedure NewLine exists. It performs a CR-LF function for the screen display
cursor when called.
 Assume a procedure PutString exists. It displays on the screen a text or character string
whose address is passed in EDX, and count is passed in ECX.
 Declare variables to support six doubleword integers as input data. Initialize each
variable to a particular value.
 Declare variables to support up to ten results. Initially the value of each result variable is
unknown.
 Display a Greeting to the user
 Prompt the user to input six integer values. Read the values and save them in memory.
 Call MinVal procedure , as many times as needed, to find the minimum of the input data.
Store the result in memory.
 Call MaxVal procedure, as many times as needed, to find the maximum of the input data.
Store the result in memory.
 Call AvgVal procedure, as many times as needed, to find the average of the input data.
Store the result in memory.
 Call OnList procedure to determine if the integer 69 is on the list of input data. Store the
result in memory.
 Write the procedure MinVal.
Behavior: Find the minimum of 2 values.
Inputs: passed in the registers: EBX,EDX.
Output: passed in EAX
 Write the procedure MaxVal.
Behavior: Find the maximum of 2 values.
Inputs: passed on Stack.
Output: passed in EAX
Uses: ECX and EDX registers.
Uses: 3 local variables.
 Write the procedure AvgVal.
Behavior: Find the average of 2 values.
Inputs: passed in the registers: EBX,EDX.
Output: passed on Stack
 Write the procedure OnList
Behavior: Determine if a given value is on list of integers.
Inputs: passed on stack: the value and the address of the array of values
Output: passed in ECX
If you need any other functionality, besides the ones mentioned above, assume it is
embodied as a built-in procedure supplied in the library package you are using.
2. Trace the execution of your code. Show ALL changes in the Stack, Registers and Memory
Locations. Assume that you able to observe the code execution and flow of control inside the
AL code you wrote, but NOT of the pre-built procedures supplied in the library package you
are using

Published by
Ace Tutors
View all posts