Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   I need Help please (http://www.go4expert.com/forums/i-help-t19511/)

valley 22Sep2009 18:12

I need Help please
 
can u send me a program for sorting of numbers in assembly language for 8051 microprocessor

SaswatPadhi 22Sep2009 18:53

Re: I need Help please
 
No we can't.

How far have you reached and where are you stuck ??
Show us some code and we will help you advance. We can't do the whole thing for you.

Well, to help you get started, here is a MASM code sort an array of len DWORDS :
Code: asm

bs proc array:DWORD,len:DWORD
    mov ecx,len
    mov edx,array
    bs_o:
    xor ebp,ebp
    bs_i:
    mov eax,DWORD PTR [edx+ebp*4+4]
    cmp DWORD PTR [edx+ebp*4],eax
    jb @F
    xchg eax,DWORD PTR [edx+ebp*4]
    mov DWORD PTR [edx+ebp*4+4],eax
    @@:
    add ebp,1
    cmp ebp,ecx
    jb bs_i
    loop bs_o
    pop ebp
    retn 8
bs endp


valley 25Sep2009 22:27

Re: I need Help please
 
What i did is that:

CSEG AT 20
?C_START:MOV A,0x40
CJNE A, #255, NOTEQUAL
jmp loop
NOTEQUAL: INC R3
MOV A,0x41
CJNE A, #255, NOTEQUAL2
jmp Final
NOTEQUAL2: INC R3
MOV A,0x42
CJNE A, #255, NOTEQUAL3
jmp Final
NOTEQUAL3: INC R3
MOV A,0x43
CJNE A, #255, NOTEQUAL4
jmp Final
NOTEQUAL4: INC R3
MOV A,0x44
CJNE A, #255, NOTEQUAL5
jmp Final
NOTEQUAL5: INC R3
Final: mov R0,#0x40
mov a,@R0
mov 0x60, a
INC R0
mov a, @R0
SUB a,0x60
JC Final

LOOP: ljmp loop
PUBLIC ?C_START
END

can you fixed it and where I make my mestake


All times are GMT +5.5. The time now is 11:38.