In: Computer Science
hack assembly language code for eq(equal), gt(greater than) and lt(less than).
Given data,
'eq' represents the Equality in Hack Assembly Language
For any two variables x and y, this 'eq' command returns true if x=y and false otherwise.
'lt' represents the less than in Hack Assembly Language
For any two variables x and y, this 'lt' command returns true if x<y and false otherwise.
'gt' represents the greater than in Hack Assembly Language
Let us consider the 'C' Code:
i=3;
j=2;
if(i>j)
printf("%d", i);
Writing this 'C' Code in Hack Assembly Language using 'gt':
push 3
pop i
push 2
pop j
gt
push i
Let us consider the 'C' Code:
i=2;
j=3;
if(i<j)
printf("%d", j);
Writing this 'C' Code in Hack Assembly language using 'lt':
push 2
pop i
push 3
pop j
lt
push j
Let us consider the 'C' Code:
i=3;
j=3;
if(i==j)
printf("EQUAL");
Writing this 'C' Code in Hack Assembly language using 'eq':
push 3
pop i
push 3
pop j
eq
push constant 0
<<<<Please Give Me Like>>>>