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, 22.06.2019 05:30
Gerard is currently working as an entry-level customer support technician, but he would like to someday become a software developer. what is the best first step to understand what he should do? ask his manager for a new job or at least a job recommendation study graphic design in order to obtain the necessary skills use career resources to investigate what skills and education are required work part-time as an entry-level web developer question 13 (true/false worth 6 points) (08.03 lc) career resources are used to explore career options and find career information. true false question 14(multiple choice worth 6 points) (08.01 mc) classify the following skills: writing html code, evaluating color theory, using design principles. hard skills interpersonal skills people skills soft skills question 15 (true/false worth 6 points) (08.03 lc) a mentor is a person who is advised, trained, or counseled by a trusted mentee. true false
Answers: 2
question
Computers and Technology, 22.06.2019 12:10
1. declare a constant named cents_per_pound and initialize with 25. 2. get the shipping weight from user input storing the weight into shipweightpounds. 3. using flat_fee_cents and cents_per_pound constants, assign shipcostcents with the cost of shipping a package weighing shipweightpounds.
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
Which software would you use to create a print design? a. illustrator b. audacity c. reaper d. dreamweaver
Answers: 2
question
Computers and Technology, 23.06.2019 03:50
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria.what am i?
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, 11.01.2021 22:50
Questions on the website: 13722361