Question: Please help with this HLA program. Look at the hints that are at the end of the program decription, since its really important for the
Please help with this HLA program. Look at the "hints" that are at the end of the program decription, since its really important for the procedure of the program.
PROGRAM : hasDuplicates
Write an HLA Assembly language program that implements a function which correctly identifies whether two or more parameters have identical values and returns a boolean value in AL Return in AL when two or more parameters are identical; otherwise. In order to receive full credit, you should be preventing register corruption by preserving and then restoring the value of any register your function touches. This rule applies to every register except for EAX which is being used to pass an answer back to the calling code. This function should have the following signature:
procedure hasDuplicates x: int; y: int; z: int; @nodisplay; @noframe;
Feed Me x:
Feed Me y:
Feed Me z:
AL
Feed Me x:
Feed Me y:
Feed Me z:
AL
Feed Me x:
Feed Me y:
Feed Me z:
AL
Belowe is the code that I have used to complete this task but so far but its not outputing the desired result of AL
program hasDuplicatesProgram;
#include "stdlib.hhf;
static
x: int; Declare variable x
y: int; Declare variable y
z: int; Declare variable z
Procedure declaration
procedure hasDuplicates x: int; y: int; z: int; @nodisplay; @noframe;
begin hasDuplicates; Procedure start
pushebx;
pushecx;
movx bx; Move value of x into bx
movy cx; Move value of y into cx
cmpbx cx; Compare x and y
je duplicatesFound; If equal, jump to duplicatesFound
movx bx; Move value of x into bx
movz cx; Move value of z into cx
cmpbx cx; Compare x and z
je duplicatesFound; If equal, jump to duplicatesFound
movy bx; Move value of y into bx
movz cx; Move value of z into cx
cmpbx cx; Compare y and z
je duplicatesFound; If equal, jump to duplicatesFound
If no duplicates found, set AL to
mov al; Set AL to
jmp endProc; Jump to endProc
duplicatesFound:
mov al; Set AL to
endProc:
popecx; Restore ecx
popebx; Restore ebx
ret; Return from procedure
end hasDuplicates; End of procedure
begin hasDuplicatesProgram; Main program start
stdout.putFeed Me x: ;
stdin.getx; Read integer input into x
stdout.putFeed Me y: ;
stdin.gety; Read integer input into y
stdout.putFeed Me z: ;
stdin.getz; Read integer input into z
call hasDuplicates; Call the function
stdout.putAL ; Display result
stdout.putial;
end hasDuplicatesProgram;
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
