Question

In Nasm: In the following code what it's needed to sort the array in ascending order:...

In Nasm:

In the following code what it's needed to sort the array in ascending order:

;;;;;;;;;;;;;;;;;;;;   MACRO DEFINITIONS   ;;;;;;;;;;;;;;;;;;;;

; A macro with two parameters

; Implements the write system call

   %macro writestring 2

       mov eax, 4 ;sys_write system call number

       mov ebx, 1 ;file descriptor std_out

       mov ecx, %1 ;message to write from parameter 1

       mov edx, %2 ;message length from parameter 2

       int 0x80

   %endmacro

;;;;;;;;;;;;;;;;;;;;   DATA SEGMENT   ;;;;;;;;;;;;;;;;;;;;

section   .data

msg1 db 'Before sorting: '

lenmsg1 equ $-msg1

msg2 db 'After sorting: '

lenmsg2 equ $-msg2

asciinums db '7','3','2','1','0','5','6','4','8','9'

lenasciinums equ $-asciinums

crlf db 0x0d, 0x0a

lencrlf   equ   $ - crlf              

section   .text

   global _start

_start:

writestring msg1, lenmsg1

   writestring asciinums, lenasciinums

   writestring crlf, lencrlf

   ;fill in missing lines of code here

  

writestring msg2, lenmsg2

   writestring asciinums, lenasciinums

   writestring crlf, lencrlf

   mov   eax, 1           ;terminate program

   int   0x80

  

0 0
Add a comment Improve this question Transcribed image text
Answer #1

section   .data

msg1 db 'Before sorting: '

lenmsg1 equ $-msg1

msg2 db 'After sorting: '

lenmsg2 equ $-msg2

asciinums db '7','3','2','1','0','5','6','4','8','9'

lenasciinums equ $-asciinums

crlf db 0x0d, 0x0a

lencrlf   equ   $ - crlf              

section   .text

   global _start

_start:

writestring msg1, lenmsg1

   writestring asciinums, lenasciinums

   writestring crlf, lencrlf

   ;fill in missing lines of code here

  

writestring msg2, lenmsg2

   writestring asciinums, lenasciinums

   writestring crlf, lencrlf

   mov   eax, 1           ;terminate program

   int   0x80

  

Add a comment
Know the answer?
Add Answer to:
In Nasm: In the following code what it's needed to sort the array in ascending order:...
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
  • Assembly Language NASM create a substring ASSIGNMENT INSTRUCTIONS: Create the Substring from the Given string, beginIndex...

    Assembly Language NASM create a substring ASSIGNMENT INSTRUCTIONS: Create the Substring from the Given string, beginIndex and endIndex The program should create a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex – 1. Thus the length of the substring is endIndex-beginIndex. In other words you can say that beginIndex is inclusive and endIndex is exclusive while getting the substring. Initialize the following values in...

  • X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code...

    X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code INCLUDE Irvine32.inc         .data       KeyPrompt BYTE "Enter the passphrase: ",0       TextPrompt BYTE "Enter the plaintest: ",0           str1 BYTE "The passphrase has length:",0           str2 BYTE "The plaintest has length:",0       KeyIs BYTE "The passphrase: ",0       PlainTextIs BYTE "The plaintext: ",0       CipherTextIs BYTE "The ciphertext: ",0       KMAX = 64                        ; passphrase buffer maximum size       BMAX = 128                       ; test...

  • I need help creating this code. Write an assembly program (MASM and Irvine's libraries) that calculates...

    I need help creating this code. Write an assembly program (MASM and Irvine's libraries) that calculates and prints out the first five Fibonacci numbers FO=0; F1=1; F2=1; F3=F1+F2; F4=F3+F2; F5=F4+F3 If we use 0, 1 and initial conditions the sequence would be: 0, 1, 1, 2, 3 Use the ebx, eax, and ecx registers. Note WriteHex, Writelnt, WriteDec, all use eax So use ebx for first and eax for second and ecx for temporary The calculation could go something like...

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