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

Sample Solution

the theft of their land. In New Zealand, evidence shows agreements being made between the ‘Natives’ as they were called, and white settlers, such as the sale of land by the chief Rawiri Waiaua, demarcated by a clearly staked out line that the future Governors’ settlements could not cross (10). The sale of this land was however strongly opposed by people from surrounding villages, ultimately resulting in Rawiri’s murder. In New Zealand, the Maori population was particularly violent in their opposition of white settlers in comparison to other areas of the South Pacific, and following failed military efforts, it was this fear that prompted Europeans to attempt negotiation, as elsewhere they had facilitated new settlements through violence. New Zealand is consistently differentiated by British authority in its partial deference to Maori culture. An edition of the New Zealand Gazette published on February 12th 1858 makes reference to “conflicts between armed parties of Aboriginal Natives…to the danger and alarm of Her Majesty’s Subjects” and “therefore I, the Governor, of New Zealand, do hereby proclaim that all persons whosoever who shall unlawfully assemble with Arms…will…be treated as persons in Arms against the Queen’s Authority”. The British government is therefore attempting to create legitimacy for future conflict with indigenous people in the area, having issued a warning, as perhaps uniquely, each article in the New Zealand Gazette is printed both in English and a written form of the Maori language, demonstrating the beginnings of cultural cohesion.

Difficulties arose for the settlers as it was discovered that few Pacific languages use possessive pronouns, instead denoting ownership through activity, thus he who carves a canoe owns it (11). The early settlers had not made sufficient enough effort to learn local languages in ord

This question has been answered.

Get Answer
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
👋 Hi, Welcome to Compliant Papers.