subject

The following code gives an example of a C program that calls a function. void adder(int a, int *b)

{

*b = a + *b; }

void main (void)

{

int x = 3, y = 4; adder(x, &y);

}

This 68000 program creates the following output from a compiler. The panel describes some of the instructions that are not obvious.

*1 void adder (int a, int *b)

Parameter a is at 8 (FP)

Parameter b is at 10 (FP)

adder

LINK FP, #0

*2 {

*3 *b = a + *b;

NOVEA. L 10 (FP) , A4

MOVE (A4) , D1

ADD 8 (FP) , D1

MOVE D1 , (A4)

*4 }

*5

*6 void main (void)

Variable x is at -2 (FP)

Variable y is at -4 (FP)

main

LINK FP , #-4

*7 {

*8 int x = 3, y = 4;

MOVE #3, -2 (FP)

MOVE #4, -4 (FP)

*9 adder (x, &y);

PEA -4 (FP)

MOVE #3, - (A7)

JSR adder

*10

*11 }

UNLK FP

RTS

Draw the state of the stack immediately after function adder is called in function main (i. e., the return address is on the top of the stack but no code in adder has yet been executed). Carefully label all items on the stack and give their location with respect to the current value of the frame pointer.

Draw a sequence of diagrams (i. e., memory maps) showing what happens to the stack as function adder is executed. Explain the action of each instruction that modifies the state of the stack. Show how parameters are passed to and from the function and how stack-based values are accessed.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Draw the hierarchy chart and design the logic for a program that calculates service charges for hazel's housecleaning service. the program contains housekeeping, detail loop, and end-of-job modules. the main program declares any needed global variables and constants and calls the other modules. the housekeeping module displays a prompt for and accepts a customer's last name. while the user does not enter for the name, the detail loop accepts the number of bathrooms and the number of other rooms to be cleaned. the service charge is computed as $40 plus $15 for each bathroom and $10 for each of the other rooms. the detail loop also displays the service charge and then prompts the user for the next customer's name. the end-of-job module, which executes after the user enters the sentinel value for the name, displays a message that indicates the program is complete.
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
question
Computers and Technology, 24.06.2019 07:30
Aproject involves many computing systems working together on disjointed task towards a single goal what form of computing would the project be using
Answers: 3
question
Computers and Technology, 24.06.2019 12:30
Select all that apply. what two keys listed below should you use to enter data in an excel worksheet? tab backspace enter right arrow
Answers: 2
You know the right answer?
The following code gives an example of a C program that calls a function. void adder(int a, int *b...
Questions
question
Mathematics, 29.11.2019 07:31
question
Mathematics, 29.11.2019 07:31
Questions on the website: 13722361