Question
computer organization Write this code using x86 assembly language using the irvine32 library
10) In write a procedure that swaps to different values (Do NOT use the XCHG instruction). (7pts )
0 0
Add a comment Improve this question Transcribed image text
Answer #1

swap function to swap two integers in X86-64 GCC 87.2 code:

swap(int, int):

push rbp

mov rbp, rsp

mov DWORD PTR [rbp-20], edi

mov DWORD PTR [rbp-24], esi

mov eax, DWORD PTR [rbp-20]

mov DWORD PTR [rbp-4], eax

mov eax, DWORD PTR [rbp-24]

mov DWORD PTR [rbp-20], eax

mov eax, DWORD PTR [rbp-4]

mov DWORD PTR [rbp-24], eax

nop

pop rbp

ret

if you like the answer please provide a thumbs up.

Add a comment
Know the answer?
Add Answer to:
computer organization Write this code using x86 assembly language using the irvine32 library 10) In write a procedure that swaps to different values (Do NOT use the XCHG instruction). (7pts )...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write this code using x86 assembly language using the irvine32 library

    Write this code using x86 assembly language using the irvine32 library Create a procedure that fills an array of doublewords with N random integers, making sure the values fall within the range j...k, inclusive. When calling the procedure, pass a pointer to the array that will hold the data, pass N, and pass the values of j and k. Preserve all register values between calls to the procedure. Write a test program that calls the procedure twice, using different values...

  • Write an assembly language code Irvine32.inc x86 for the following pseudo code. Use Conditional jump If...

    Write an assembly language code Irvine32.inc x86 for the following pseudo code. Use Conditional jump If (op1 == op2)                         X=1; Else                         X=2; While (EAX < EBX)         EAX = EAX + 1 ;

  • Please use X86 Assembly Language, Irvine32 Declare a double word array of size 10 and initialize...

    Please use X86 Assembly Language, Irvine32 Declare a double word array of size 10 and initialize it with some numbers. Find the number of even numbers and the number of odd numbers in this array and save them in locations called oddCount and evenCount.

  • This is a question from Assembly Language for x86 7th Edition by Kip Irvine, but the...

    This is a question from Assembly Language for x86 7th Edition by Kip Irvine, but the solution is not there. Programming exercise 12.7 #2. The code must be in assembly language for Intel using Kip Irvine library. An example of the source code would be: INCLUDE Irvine32.inc .code main PROC mov ax,4000h mov bx,1000h mov cx,1500h sub ax,bx sub ax,cx call DumpRegs exit main ENDP END main Question: Write a procedure that receives a single-precision floating-point binary value and displays...

  • Use Assembly (Masm and Irvine32 library) to write a complete program that: 1. Asks the user...

    Use Assembly (Masm and Irvine32 library) to write a complete program that: 1. Asks the user to enter 2 numbers. Assume that the user enters unsigned 32-bit integers only. 2. Displays the product of the two numbers. Assume that the result will never be larger than 32 bits. 3. This process will continue till the user enters 0 for both inputs. You can’t use mul instruction in your program: You need to use shifting and addition only. Your program must...

  • Write a NASM assembly language(run it on DOSBOX) procedure using string instruction. Given two strings, S1...

    Write a NASM assembly language(run it on DOSBOX) procedure using string instruction. Given two strings, S1 and S2, determine if S2 is a sub string of S1. Sub string example: S1: ‘I am happy today’, S2: ‘happy’, S2 is a substring of S1. S1: ‘I am happy today’, S2: ‘sad’, S2 is not a substring of S1. Call above procedure in an assembly language program and show the result of the procedure.

  • Any help with this computer Organization and Architecture question It's on assembly language procedure Please use...

    Any help with this computer Organization and Architecture question It's on assembly language procedure Please use TASM 3. Write a procedure called divides that takes two parameters in BX and CX. Assume unsigned integers. It should print to the screen "EVENLY" if CX divides BX evenly. Otherwise, it should print "NOT EVENLY." DO NOT USE THE DIV OR IDIV COMMANDS. Use repeated subtraction to determine whether BX is divided evenly (no remainder.) Before printing clear entire screen with red background...

  • INTEL 80x86 ASSEMBLY LANGUAGE CODE Write a windows32 assembly language program that utilizes a recursive procedure....

    INTEL 80x86 ASSEMBLY LANGUAGE CODE Write a windows32 assembly language program that utilizes a recursive procedure. The main (_MainProc) procedure should: accept, from the user, a positive integer. Guard against non-positive integers being entered using a loop. call the sumseries sub-procedure using the cdecl protocol, receive the results of the sub-procedure, and display the results. The sumseries sub-procedure should: recursively find the sum of the series: 1*2 + 2*3 + 3*4 + ... + i*(i+1) (This is an iterative definition....

  • X86 Assembly language lab: TITLE Lab 3: assembly language fundamentals               ;;;;; Q1: Don't...

    X86 Assembly language lab: TITLE Lab 3: assembly language fundamentals               ;;;;; Q1: Don't forget to document your program            ; Name:Yuyan Wang ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; Answer each question below by writing code at the APPROPRIATE places in the file. ;;;;; Hint: the appropriate place is not always right below the question. ;;;;; Q2: Write the directive to bring in the IO library           ;;;;; Q3: Create a constant called MAX and initialize it to 150...

  • MASM Assembly Language x86 Processor. Must use windows32 framework Write a non-recursive algorithm to find the...

    MASM Assembly Language x86 Processor. Must use windows32 framework Write a non-recursive algorithm to find the greatest common divisor of two positive numbers. . • Your program should read the two positive integers using dialog boxes. If they are not positive, a message box should be displayed with an appropriate message. • Your program needs to have a procedure that takes two positive integers as parameters. • You need to follow cdecl protocol for parameter passing. • Display the valid...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT