Subject Computer Science Assembly Language Programming

Question

Create the standard swap functions using pass-by-reference implemented with pointers. Your functions must be equivalent to the following C/C++ code.

void swap_int(int *a,int *b)
{
   int t = *a;
   *a = *b;
   *b = t;
}

void swap_short(short *a,short *b)
{
   short t = *a;
   *a = *b;
   *b = t;
}

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

SECTION .text

GLOBAL assert

assert:
; prolog
push ebp ; save old base pointer
mov ebp,esp ; setup new base pointer
push ebx ; preserve EBX for caller...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Get help from a qualified tutor
Live Chats