beginner needs help 
Author Message
 beginner needs help

I'm quite shaky with assembly language and have to code a bubble sort
procedure.  Any help would be appreciated.
Schlotto   12/3/96  5:45 PM



Sat, 22 May 1999 03:00:00 GMT  
 beginner needs help

as you know in bubble sort after each pass you can be sure that the greatest item
is in the end of the array
here you have a proc that sort i assumed you pass 2 parameters first is the
number of items(int=word) to sort ,the other is the address of the array

bub_sort proc near
        mov bp,sp
        mov cx,[bp+4]

loopout:        
        mov si,[bp+2]
        mov bx,0   ;bx is a flag if bx='f' no change was made during the pass
        push cx
loopin:
                mov ax,[si]
                cmp ax,[si+2]
                jng cont
                mov bx,'t'
                xchg ax,[si+2]
                mov [si],ax
        cont:   inc si
                inc si
                loop loopin
        cmp bx,'f'
        pop cx
        loopne loopout
ret 4
bub_sort endp

pay attention if ax,bx,cx,bp,si or flags are important for you make sure to save them
before they are corrupted;

regards and don't be shaky assembler is just a language not a woman!


I'm quite shaky with assembly language and have to code a bubble sort
procedure.  Any help would be appreciated.
Schlotto   12/3/96  5:45 PM
------------------------------------------------   Date: 12/06/96
*** PLEASE ALWAYS INCLUDE ORIGINALS IN REPLY ***   Time: 18:14:07
------------------------------------------------

        This message was sent by Chameleon's Zmail Pro
        **********************************************



Tue, 25 May 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Asm beginner-NEED HELP

2. Beginner needs help with namespaces

3. Beginner needs help!

4. beginner needs help

5. BEGINNER NEED HELP

6. Beginner needs help printing dictionary

7. Beginner needs help with Clarion for Win 2.0

8. Beginner needs help

9. Beginner needs help with Clipper->Windows 3.1 convertion

10. beginners need help

11. beginner needing help

12. Beginner needs help.

 

 
Powered by phpBB® Forum Software