1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
love history [14]
3 years ago
7

Write an assembly code to implement the y=(x1+x2)*(x3+x4) expression on 2-address machine, and then display the value of y on th

e screen. Assume that the values of the variables are known. Hence, do not worry about their values in your code.
The assembly instructions that are available in this machine are the following:
Load b, a Load the value of a to b
Add b, a Add the value of a to the value of b and place the result in b
Subt b, a Subtract the value of a from the value of b and place the result in b
Mult b, a Multiply the values found in a and b and place the result in b
Store b, a Store the value of a in b.
Output a Display the value of a on the screen
Halt Stop the program
Note that a or b could be either a register or a variable. Moreover, you can use the temporary registers R1 & R2 in your instructions to prevent changing the values of the variables (x1,x2,x3,x4) in the expression.
In accordance with programming language practice, computing the expression should not change the values of its operand.
Computers and Technology
1 answer:
Ratling [72]3 years ago
7 0

mbly code to implement the y=(x1+x2)*(x3+x4) expression on 2-address machine, and then display the value of y on the screen. Assume that the values of the variables are known. Hence, do not worry about their values in your code.

The assembly instructions that are available in this machine are the following:

Load b, a Load the value of a to b

Add b, a Add the value of a to the value of b and pla

You might be interested in
A 'array palindrome' is an array which, when its elements are reversed, remains the same (i.e., the elements of the array are sa
tia_tia [17]

Answer:

Here is the JAVA program:

class Main {    

static boolean isPalindrome(int array[], int starting, int ending) {  /*a boolean method that takes an integer-valued array, and a pair of integers representing the starting and ending indexes of the portion of the array to be tested for being a palindrome */

   if (starting >= ending) {  //base case

       return true;     }  //returns true

   if (array[starting] == array[ending]) {  //recursive case

       return isPalindrome(array, starting + 1, ending - 1);     }  //calls isPalindrome recursively to find out palindrome

   else {  

       return false;    }  }  //returns false if array is not palindrome

 

   public static void main (String[] args) {  //start of main function

   int array[] = { 1,2,3,2,1};  //creates an array

   int size = array.length;   //computes the size of array

 System.out.print(isPalindrome(array, 0, size - 1));    } } //calls method to test array for being  a palindrome

Explanation:

The program works as follows:

array = { 1,2,3,2,1}

starting = 0

ending = size-1 = 5-1 = 4

if (starting >= ending) condition evaluates to false because starting i.e. 0 is not greater or equal to ending i.e. 4. So the program moves to the next if part

if (array[starting] == array[ending])

This becomes:

if (array[0] == array[4])

The element at 0th index is the first element of the array i.e. 1 and the element at 4th index of array is the last element of array i.e. 1. So both these elements are equal so the following statement executes:

return isPalindrome(array, starting + 1, ending - 1);

Now the starting and ending become:

starting+1 = 0+1 = 1

ending-1 = 3

if (starting >= ending) base condition evaluates to false because starting  is not greater or equal to ending. So the program moves to the next if part

if (array[starting] == array[ending])

This becomes:

if (array[1] == array[3])

The element at 1st index is 2 and the element at 3rd index of array is 2. So both these elements are equal so the following statement executes:

return isPalindrome(array, starting + 1, ending - 1);

Now the starting and ending become:

starting+1 = 1+1 = 2

ending-1 = 2

if (starting >= ending) base condition evaluates to true because starting  is  equal to ending. So the following statement executes:

       return true;    

This means the function returns true and this shows that array is a palindrome.

The screenshot of the program and its output is attached.

8 0
3 years ago
What food does swiss eat on christmas?
UkoKoshka [18]
The main Christmas meal is eaten on Christmas Eve and popular foods include a Christmas ham and scalloped potatoes with melted cheese and milk baked into it. Desert is often a walnut cake and Christmas cookies.
7 0
3 years ago
Michael needs to ensure that those items that are automatically archived are still easily accessible within Outlook. Which optio
rjkz [21]

Answer:

D.   Show archive folder in folder list

Explanation:

Other dude is wrong

8 0
2 years ago
Read 2 more answers
If the pc­doctor software is installed on a computer's hard drive, what two different ways can the program be started?
xeze [42]
<span> The PC-doctor software is system information tool used to diagnose and  test the computer and determine its configuration.</span>
If the PC-­doctor software is installed on a computer's hard drive, you should start the program in two different ways:<span>
1. Press function key during startup sequence
2. Start menu shortcut</span>


8 0
3 years ago
Choose the false statement below. The content that displays in the browser is contained in the head section. The content that di
aivan3 [116]

Answer:

The content that displays in the browser is contained in the head section.

Explanation:

The content that displays in the browser is contained in the head section, this is the false statement because the The HTML head is the contents of the <head> element.

The head's content is not displayed on the page. Instead, the head's job is to contain metadata about the document.

3 0
3 years ago
Other questions:
  • Which service is enabled on a cisco router by default that can reveal significant information about the router and potentially m
    10·1 answer
  • A modern information-processing model that views memories as emerging from particular activation patterns within neural networks
    6·1 answer
  • In the file MajorSalary, data have been collected from 111 College of Business graduates on their monthly starting salaries. The
    15·1 answer
  • For each of these statements find a domain for which the statement is true and a domain for which the statement is false. a) Eve
    13·1 answer
  • You work as an IT Technician for uCertify Inc. David, a user, has recently purchased a laptop computer. He is now complaining th
    14·1 answer
  • The profile picture that you plan to use to market your professional brand on social media networks should feature you only.
    12·1 answer
  • Please answer this simple (hard) question for me lol
    13·2 answers
  • Which is a benefit of peer-to-peer networking?
    12·1 answer
  • A file manager is used for all of the following except ____.
    12·1 answer
  • Which statement is true about the energy of electromagnetic radiation?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!