I am trying to modify this HLA program so the function returns true if two of the values are the same. Right now it only returns true if all the values are the same number.
program Same;
#include("stdlib.hhf");
procedure hasDuplicates(x: int16; y: int16; z: int16); @nodisplay; @noframe;
begin hasDuplicates;
pop(EDX); // Return Address
pop(z);
pop(y);
pop(x);
push(EDX); // Return Address
mov(z, BX);
cmp(y, BX); // Compare z & y
jne ReturnZero;
mov(y, BX);
cmp(x, BX); // Compare y & x
jne ReturnZero;
mov(1, AL);
jmp ExitSequence;
ReturnZero:
mov(0, AL);
ExitSequence:
ret();
end hasDuplicates;
begin Same;
stdout.put("Feed Me X: ");
stdin.geti16();
push(AX);
stdout.put("Feed Me Y: ");
stdin.geti16();
push(AX);
stdout.put("Feed Me Z: ");
stdin.geti16();
push(AX);
call hasDuplicates;
cmp(AL, 1);
jne NumbersAreDifferent;
stdout.put("Same. AL = 1");
jmp EndProgram;
NumbersAreDifferent:
stdout.put("Not the same. AL = 0");
EndProgram:
end Same;
I know that the comparing logic needs to be changed. I don't know much about HLA in general.