Question: *1 void swap (int *a, int *b) * Parameter a is at 8(A6) * Parameter b is at 12(A6) * Variable temp is at -2(A6)

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

* Parameter a is at 8(A6)

* Parameter b is at 12(A6)

* Variable temp is at -2(A6)

_swap

LINK A6,#-2

*2 {

*3 int temp;

*4 temp = *a;

MOVEA.L 8(A6),A4

MOVE (A4),-2(A6)

*5 *a = *b;

MOVEA.L 12(A6),A0

MOVE (A0),(A4)

*6 *b = temp;

MOVEA.L 12(A6),A4

MOVE -2(A6),(A4)

*7 }

UNLK A6

RTS

* Function size = 30

*8 main ()

* Variable x is at -2(A6)

* Variable y is at -4(A6)

_main

LINK A6,#-4

*9 {

*10 int x = 2, y = 3;

MOVE #2,-2(A6)

MOVE #3,-4(A6)

*11 swap (&x, &y);

PEA -4(A6)

PEA -2(A6)

JSR _swap

*12 }

UNLK A6

RTS

Explain each line of this code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!