Write a subroutine called addabc that performs the


Question: Write a subroutine called, ADDABC, that performs the operation c : A + B. The three variables A, B, and C are all word (i.e., 16-bit) values. Test your program on the 68000 simulator. Your calling code and subroutine should have the following features:

• The parameters A and B should be passed on the stack to the procedure by reference (i.e., by address).

• Since parameters A and B are adjacent in memory, you need to pass only the address of parameter A to the subroutine (because the address of parameter B is 2 bytes on from parameter A).

• Parameter C should be passed back to the calling program on the stack by value.

• Before you call the subroutine, make room on the stack for the returned parameter (i.e., parameter C).

• After calling the subroutine, read the parameter off the stack into data register DO (i.e., DO should end up containing the value of A + B).

• The subroutine ADDABC must not corrupt any registers. Save all working registers on the stack on entry to the subroutine, and restore them before returning from the subroutine.

• When you write your code, preset the stack pointer to a value such as $1500 (by using either MOVEA L 11$ 15 00 , A7 or LEA $1500,10). Doing this will make it easier to follow the movement of the stack while your program is running.

• Make certain that you are operating with the correct operand sizes. Use .w for data values and for addresses and pointers.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a subroutine called addabc that performs the
Reference No:- TGS02326665

Expected delivery within 24 Hours