Question

COSC 2325.S01 Program Nine Problem: Write an assembly procedure to sort the following array into numerical order and print th
Assembly for x86 please.
Thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1
;Bubble sort 10 numbers in place
.model tiny
.data
nums db 3,7,9,1,8,2,4,5,3,6,10
count equ 9 ; One less than count of the array.
.code
.startup
mov dx, count
oloop:
mov cx, count
lea si, nums
iloop:
mov al, [si] ; Because compare can't have both memory
cmp al, [si+1]
jl common ; if al is less than [si+1] Skip the below two lines for swapping.
xchg al, [si+1]
mov [si], al ; Coz we can't use two memory locations in xchg directly.
common:
INC si
loop iloop
dec dx
jnz oloop
.exit

end

Add a comment
Know the answer?
Add Answer to:
Assembly for x86 please. Thank you COSC 2325.S01 Program Nine Problem: Write an assembly procedure to sort the following array into numerical order and print the resulting array 5.8.6.3.4.1,0,9.2.7...
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
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