NEW HERE? USE "AFORUM20" TO GET GET 20 % OFF CLAIM OFFER

UK: +44 748 007-0908 USA: +1 917 810-5386
My Orders
Register
Order Now

Hack Assembly and Machine

  You have to write down both Hack Assembly and Machine instructions for the following code snippets. Properly document using comments. ● x = 7 y = 12 z = x * y ● x = 9 y = 3 z = x / y ● x[5] = {1, 5, 9, 3, 6}; for(i = 0; i < 5; i++){ x[i] = x[i] + 1; } ● a = 8 b = 9 x = a + b y = (x + a) * b ● if (x ==1) x = x+1; else x=0; You have to write down Hack Assembly Code for the following tasks: ● Write down a program that computes max out of two numbers. For example if RAM[0] = 2 && RAM[1] = 3 then max = 3 RAM[0] and RAM[1] will be used to take numbers which will be compared later. And the result will be stored in the variable called max. ● Write down a program that finds a value in an array and writes the index to RAM[3]. Value to be searched will be in RAM[0] and array size will be in RAM[1]. Read the following example for better understanding. RAM[0] = 4 RAM[1] = 5 Array = {0,6,8,4,1} Result: RAM[3] = 3