Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:00, kmsg2000
Program description: a c# app is to be created to produce morse code. the morse code assigns a series of dots and dashes to each letter of the alphabet, each digit, and a few special characters (such as period, comma, colon, and semicolon). in sound-oriented systems, the dot represents a short sound and the dash represents a long sound. separation between words is indicated by a space, or, quite simply, the absence of a dot or dash. in a sound-oriented system, a space is indicated by a short period of time during which no sound is transmitted. the international version of the morse code is stored in the data file morse. txt.
Answers: 3
image
Computers and Technology, 22.06.2019 21:30, mjweed2456
Nathan wants to create multiple worksheet containing common formatting styles for his team members. which file extension him to save these worksheets? nathan to create multiple worksheets with common styles. he needs to save them with the extension.
Answers: 1
image
Computers and Technology, 24.06.2019 08:50, bo4isbad
Write a program that will compute the volume of ice cream served in a cone. as you can see in the diagram below, the ice cream is served as a hemisphere of frozen deliciousness on top of a cone, which is also packed with frozen deliciousness. thus, the total volume of ice cream sold is the volume of the hemisphere plus the volume of the cone. the example shows an ice cream cone in which the hemisphere and cone have a radius of 10 inches and the cone has a height of 15 inches. your program must instead prompt for these two values, which are taken from the keyboard as integers: • the hemisphere/cone radius in inches, and
Answers: 3
image
Computers and Technology, 24.06.2019 10:00, wwwcarolynzouowficz
3. what do the terms multipotentialite, polymath, or scanner mean?
Answers: 2
Do you know the correct answer?
The following code gives an example of a C program that calls a function. void adder(int a, int *b...

Questions in other subjects:

Konu
Mathematics, 01.01.2020 08:31
Konu
Physics, 01.01.2020 08:31