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 9: 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 1 in AL when two or more parameters are identical; 0 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: int16; y: int16; z: int16); @nodisplay; @noframe;
Feed Me x: 5
Feed Me y: 13
Feed Me z: 10
AL =0
Feed Me x: 35
Feed Me y: 5
Feed Me z: 5
AL =1
Feed Me x: 5
Feed Me y: 5
Feed Me z: 5
AL =1
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: int16; // Declare variable x
y: int16; // Declare variable y
z: int16; // Declare variable z
// Procedure declaration
procedure hasDuplicates( x: int16; y: int16; z: int16); @nodisplay; @noframe;
begin hasDuplicates; // Procedure start
push(ebx);
push(ecx);
mov(x, bx); // Move value of x into bx
mov(y, cx); // Move value of y into cx
cmp(bx, cx); // Compare x and y
je duplicatesFound; // If equal, jump to duplicatesFound
mov(x, bx); // Move value of x into bx
mov(z, cx); // Move value of z into cx
cmp(bx, cx); // Compare x and z
je duplicatesFound; // If equal, jump to duplicatesFound
mov(y, bx); // Move value of y into bx
mov(z, cx); // Move value of z into cx
cmp(bx, cx); // Compare y and z
je duplicatesFound; // If equal, jump to duplicatesFound
// If no duplicates found, set AL to 0
mov(0, al); // Set AL to 0
jmp endProc; // Jump to endProc
duplicatesFound:
mov(1, al); // Set AL to 1
endProc:
pop(ecx); // Restore ecx
pop(ebx); // Restore ebx
ret(); // Return from procedure
end hasDuplicates; // End of procedure
begin hasDuplicatesProgram; // Main program start
stdout.put("Feed Me x: ");
stdin.get(x); // Read integer input into x
stdout.put("Feed Me y: ");
stdin.get(y); // Read integer input into y
stdout.put("Feed Me z: ");
stdin.get(z); // Read integer input into z
call hasDuplicates; // Call the function
stdout.put("AL ="); // Display result
stdout.puti8(al);
end hasDuplicatesProgram;

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!