I am confused about implementing
eq,
gt and
lt.
I am fairly certain I can see how to do it using
labels and
jumps in assembly.
Obviously these
labels would have to be globally unique.
In Ch 8 however the trouble is taken to explain how to make
labels globally unique when discussing
program flow.
It just strikes me as odd that they would bother doing that there if they had previously expected the
readers to come up with a similar scheme by themselves in Ch 7.
So I'm thinking that maybe we're expected to achieve the translation of
eq,
gt and
lt to assembly
without the use of
labels.
I've been trying to do just that without getting very far. For instance for
lt I can write assembly to evaluate to -1
if X-Y < 0 but I can't guarantee the
same code to evaluate to 0 if X-Y >= 0.
It seems impossible to me without the use of
jumps and hence
labels.
Is this right?
Also in a post above Shimon Schocken says
>>Note that the both the operands and the results of these logical operations
>>are always constant -1 (minus 1) or constant 0, representing true and
>>false, respectively
Is this suggesting that using just
ANDs
ORs
NOTs you can implement
eq,
lt and
gt without using
labels?
It's the getting from any 2 numbers
X,
Y to just
0 or
-1 without the use of
labels that seems impossible to me.