Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I just wanted to say THANKS for the forum. The knowledge I gain from your site is invaluable..."

Geography

Where in the world do Tek-Tips members come from?
99drew99 (Programmer)
22 Apr 11 18:35
I've made ​​some changes to the algorithm BubbleSort, dividing the array to be ordered in n array consisting of 10 elements. The code should order the first n array and then all the main array and display the content, but I do not get any results. Any suggestions?


CODE

.data
array SDWORD 10 DUP(10009h, 10002h, 10003h, 10004h, 10001h, 10006h, 10007h, 10008h, 10005h, 10010h)
len DWORD lengthof array

.code
MAIN PROC
INVOKE BBSORT, ADDR array, len
mov esi, offset array
call Funzione che visualizza parte della memoria
MAIN ENDP

BBSORT PROC USES eax ecx esi, aarr: PTR SDWORD, larr: DWORD
LOCAL part: DWORD, cloop: BYTE
mov edx, 0
mov eax, larr
mov ebx, 10
div ebx
mov ecx, 2
push edx
mov part, 0
mov cloop, 0
lp:
push ecx
mov eax, 0
cmp part, 0
je ls  
mov edx, 0
mov eax, part
mul ebx
shl eax, 2
mov edx, eax
ls:
dec ecx
cmp ecx, 0
je lr
l1:
push ecx
mov ecx, ebx
dec ecx
mov esi, aarr
add esi, edx
l2:
call DumpRegs
mov eax, [esi]
cmp [esi + 4], eax
jg l3
xchg eax, [esi + 4]
mov [esi], eax
l3:
add esi, 4
loop l2
pop ecx
loop l1
mov esi, aarr
add esi, edx
inc part
pop ecx
loop lp
jmp lr
cmp cloop, 2
je lr
cmp cloop, 1
je la
pop edx
mov ecx, edx
mov part, 0
mov cloop, 1
jmp lp
la:
mov ecx, 100
mov part, 0
mov cloop, 2
jmp lp
lr:
ret
BBSORT ENDP
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close