Question

In: Computer Science

hack assembly language code for eq(equal), gt(greater than) and lt(less than).

hack assembly language code for eq(equal), gt(greater than) and lt(less than).

Solutions

Expert Solution

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>>>>


Related Solutions

Write hack assembly language code for eq lt gt
Write hack assembly language code for eq lt gt
Write hack assembly language code for function (declaration) call (a function) return (from a function)
Write hack assembly language code for function (declaration) call (a function) return (from a function)
How to write fill.asm code (hack assembly)
How to write fill.asm code (hack assembly)
For each of the following, fill in the blanks with "Less than", "Greater than", or "Equal...
For each of the following, fill in the blanks with "Less than", "Greater than", or "Equal to" *) A gas flows through a one-inlet, one-exit control volume operating at steady state with no internal irreversibilities, Qcv = 0. Heat transfer at a rate Qcv takes place only at a location on the boundary where the temperature is Tb. The specific entropy of the gas at the exit is _____ than the specific entropy of the gas at the inlet. *)...
For each, indicate whether the first item is (greater than, equal to, less than) the second...
For each, indicate whether the first item is (greater than, equal to, less than) the second item oxygen content in the pulmonary veins      ___________       oxygen content in the carotid arteries Answer 1Choose...greater thanequal toless than maximum pressure in the aorta ___________     maximum pressure in the left atrium   Answer 2Choose...greater thanequal toless than blood flow through the lungs ____________ blood flow through the kidneys Answer 3Choose...greater thanequal toless than flow of blood through a dilated vessel _____________ flow of blood through...
Is the total relativistic energy in 1 kg of 238U greater than, equal to, or less...
Is the total relativistic energy in 1 kg of 238U greater than, equal to, or less than the total energy in 1 kg of 12C? You’re in a park listening to a concert that’s 70 m away. The music is faint, and you want the sound intensity to be a factor of 4 times higher. How far from the stage do you need to be?
2012 Corporate Tax Rate Schedule (partial) Taxable Income Greater Than But Less Than Or Equal To...
2012 Corporate Tax Rate Schedule (partial) Taxable Income Greater Than But Less Than Or Equal To Tax Is Of the amount exceeding $0 $50,000 15% $0 $50,000 $75,000 $7,500 + 25% $50,000 $75,000 $100,000 $13,750 + 34% $75,000 $100,000 $335,000 $22,250 + 39% $100,000 JKEB Corporation has the following revenues and expenses for the current tax year: Sales revenue, net of returns . . . . . . . . . . . . . . . . . ....
prove that 2/pi is less than or equal to (sinx)/x which is less than or equal...
prove that 2/pi is less than or equal to (sinx)/x which is less than or equal to 1. for x is in (0,pi/2]
Consider the following hypothesis test: H0: n greater than or equal to 20 Ha: n less...
Consider the following hypothesis test: H0: n greater than or equal to 20 Ha: n less than 20 a sample of 45 provided a sample mean of 19.6. the population standard deviation is 1.8 a.  Compute the value of the test statistic (to 2 decimals). Enter negative value as negative number. _______ b. what is the p-value? (3 decimals) d. using a=0.05, what is the critical value for the test statistic (to 3 decimals)? Enter negative value as negative number. ________...
Why is assembly language considered more user friendly than machine language?
Why is assembly language considered more user friendly than machine language?  How does a low-level programming language differ from a high-level programming language?  Discuss five protocols that people use when communicating with each other over the internet.  What steps would you take to safeguard your computer against computer viruses?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT