2. Consider the following subroutine (this subroutine adds a data item passed to the subroutine to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2. Consider the following subroutine (this subroutine adds a data item passed to the subroutine to its local RESULT variable): RESULT SUB ORG FCB ORG TSX DATA LDAA ADDA STAA PULX INS PSHX RTS $CFFF 0 ORG FCB $D000 ORG 2,X RESULT RESULT A) Name the parameter passing technique that is utilized (name both methods used: e.g.: call-by-value in register). B) Write the main program segment that will call subroutine SUB and pass DATA to the subroutine using the correct parameter passing technique (do not forget to initialize any crucial processor registers.) You may assume the following data section for your main program: (Subroutine Data Section) $B000 10 (Subroutine Executable Section) $C000 (Main Program Data Section) (Main Program Executable Section) 2 (15 points) Design an assembly language subroutine that receives an array of longword- sized integers (in two's complement representation). The subroutine is to determine how many of the integers in the array are even but not multiples of 4. The input array is to be specified using two parameters: a longword-sized starting address of the array, and a longword-sized number of integers in the array. These two parameters are to be pushed onto the stack (in that order: push address first, and then push the number of integers) before the subroutine is called. The output parameter (i.e., the number of integers that are even but not multiples of 4) of the subroutine is to be returned on the stack and should replace the first input parameter (i.e., starting address of the array). Also write a main program that puts input parameters for an array (which has starting address 0x0006000 and has 400 longword-sized integers) on the stack, calls the subroutine, and retrieves the output parameter from the stack after the subroutine ends. In the main program, the output parameter, which is retrieved from the stack, should be store to data register D3. Note that at the beginning of your main program, you do not know the exact initial value in any data or address register. All registers (except A7) used by the subroutine must be preserved. Hint: For an integer in two's complement representation, if the last two bits (Bit #1 and Bit #0) of the integer's binary format are both zeros, then the integer is a multiple of 4. 2. Consider the following subroutine (this subroutine adds a data item passed to the subroutine to its local RESULT variable): RESULT SUB ORG FCB ORG TSX DATA LDAA ADDA STAA PULX INS PSHX RTS $CFFF 0 ORG FCB $D000 ORG 2,X RESULT RESULT A) Name the parameter passing technique that is utilized (name both methods used: e.g.: call-by-value in register). B) Write the main program segment that will call subroutine SUB and pass DATA to the subroutine using the correct parameter passing technique (do not forget to initialize any crucial processor registers.) You may assume the following data section for your main program: (Subroutine Data Section) $B000 10 (Subroutine Executable Section) $C000 (Main Program Data Section) (Main Program Executable Section) 2 (15 points) Design an assembly language subroutine that receives an array of longword- sized integers (in two's complement representation). The subroutine is to determine how many of the integers in the array are even but not multiples of 4. The input array is to be specified using two parameters: a longword-sized starting address of the array, and a longword-sized number of integers in the array. These two parameters are to be pushed onto the stack (in that order: push address first, and then push the number of integers) before the subroutine is called. The output parameter (i.e., the number of integers that are even but not multiples of 4) of the subroutine is to be returned on the stack and should replace the first input parameter (i.e., starting address of the array). Also write a main program that puts input parameters for an array (which has starting address 0x0006000 and has 400 longword-sized integers) on the stack, calls the subroutine, and retrieves the output parameter from the stack after the subroutine ends. In the main program, the output parameter, which is retrieved from the stack, should be store to data register D3. Note that at the beginning of your main program, you do not know the exact initial value in any data or address register. All registers (except A7) used by the subroutine must be preserved. Hint: For an integer in two's complement representation, if the last two bits (Bit #1 and Bit #0) of the integer's binary format are both zeros, then the integer is a multiple of 4.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these computer network questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
John Deer began a restaraunt consulting company. Below are events and transactions that occurred during the first month of operation. May 1 John Deer invested $38,000 cash to start a consulting...
-
Henri earned a salary of $50,000 in 2001 and $60,000 in 2012. The consumer price index was 177 in 2001 and 225 in 2012. Henri's 2001 salary in 2012 dollars is a. $39,333.33. b. $74,000.00. c....
-
Derive an expression for the equivalent spring constant when two similar springs are connected: (a) in parallel, (b) in series.
-
On the first day of your summer internship, youve been assigned to work with the chief financial officer (CFO) of Carat Designs Corporation. As one of your assignments, you have been asked to...
-
This chapter included an example of a manufacturing firm that had problems with employee theft of tools. The company decided that it would search every employees lunch box at the end of each shift....
-
17. A concave mirror produces a real image 10mm tall, of an object 2.5mm tall placed at 5cm from the mirror. Calculate focal length of the mirror and the position of the image. 18. An object is...
-
Given the following sketches, generate an Excel spreadsheet: 1) Count the total degrees of freedom in the sketch. 2) Count the constraints 3) Provide the number of dimensions that are necessary to...
-
From the following information determine the members of the group for pay-roll tax purposes. You may assume that ownership is control. The Court Nadal 40% Federer 35% Djokovic 20% Murray 5% Seats...
-
The Hertz solution for u is: u_(r) = 2D 00 Pl mJ (mr/1) 4 1+ m m=0 dm The solution for u. due to a load spread over a circle with radius a is: u_(r) = P m=0 Jo(mr/1)J (ma/1) 1+ m 4 -dm (wherein J,...
-
I/O Redirection and Pipe 1.1. Verify that stdout is mapped to your monitor. (Hint usels -aFcommand.) 1.2. . Redirectstdout to a file and observe that nothing is displayed on your monitor. 1.3....
-
Make their work clear and well presented and mention question number clearly in their answer, marks may be reduced for poor presentation. The work should be in your words, copying from students or...
-
Our company is using a hash function to protect customers' personal identification numbers (PINs). Their PINs would be still safe even if the company's system is hacked. Bob: It's so cool. Our...
-
USE THE DATA IN THE TABLE BELOW TO ANSWER THE FOLLOWING 3 QUESTIONS NikoJokic, Inc. Balance Sheets for the Years Ending December 31, (All amounts are in dollars) Cash Accounts receivable Inventory...
-
The financial statements for Castile Products, Inc., are given below: Castile Products, Inc. Balance Sheet December 31 Assets Current assets: Cash.. $ 6,500 35,000 Accounts receivable, net...
-
The company manufactures three products: wooden chairs, tables and dressers. AFC started off as a 'Mom & Pop' shop but has grown rapidly. AFC uses one assembly line to build all three products,...
-
A car is driven 15,000 miles a year and gets x miles per gallon. Assume that the average fuel cost is $3.48 per gallon. Find the annual cost of fuel C as a function of x and use this function to...
-
Evaluate the function at the given value(s) of the independent variable. Simplify the results. f(x) = x = x f(x) - (1) x 1
-
In Exercises find the coordinates of the point. The point is located seven units in front of the yz-plane, two units to the left of the xz-plane, and one unit below the xy-plane.
-
Why does training sometimes fail?
-
What are the three major components in quality training recommended by Juran?
-
The Rocky Flats Plant of Rockwell International is committed to hiring hard-core unemployed people for entry-level positions with the intention of migrating them upward. However, many new employees...
Study smarter with the SolutionInn App