Jump to content

i need help with code in assembly 8086

- - - - -

  • Please log in to reply
8 replies to this topic

#1
petno

petno

    Newbie

  • Members
  • Pip
  • 3 posts
hello
i am a student and i need help with the code in assembly 8086
the program below have to get the numbers in array A and sort the numbers from the less to the biggest in array C... its not working, what the problem in the code?

thank you for looking :)
data segment
		A dw 100 dup(1,7,0bh,1,4,8,4,2)
		B dw 100 dup(?)
		c dw 100 dup(?)
		N db 8
data ends
code segment
	assume cs:code,ds:data
start:	mov ax,data
		mov ds,ax
		mov si,0
		xor di,di
		xor ax,ax
		xor bx,bx
		mov cl,N
		xor ch,ch
		
again:	mov ax,A[di]
        inc di
		mov bx,A[di]
		mov bl,bh
		xor bh,bh
		cmp ax,bx
		jl new
		cmp al,0
		jz sof
		loop again
		
new:    mov c[si],ax
        inc si
		inc di
		xor ax,ax	
		loop again
		
sof:    mov ah,4ch
        int 21h
    code ends
end start

Edited by WingedPanther, 10 January 2010 - 12:31 PM.
add code tags (the # button)


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,822 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
In what sense is it not working? Also, please use code tags (the # button) when posting code.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
petno

petno

    Newbie

  • Members
  • Pip
  • 3 posts
the code is not doing what it's have to do... he dosent work

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,822 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
What does it do?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
petno

petno

    Newbie

  • Members
  • Pip
  • 3 posts
its have to sort the numbers from 1,7,0bh,1,4,8,4,2 to 1,1,2,4,4,8,0bh

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,822 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
So the problem is that it drops the 7?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Is there any particular reason why you're reading two numbers into AX but only one into BX? By the way, you set BX to zero initially and never touch BH again so you can change this:
mov bx,A[di]
mov bl,bh
xor bh,bh
to this:
mov bl, A[di]

What sorting algorithm are you trying to implement?
sudo rm -rf /

#8
jigar jain

jigar jain

    Newbie

  • Members
  • Pip
  • 1 posts
i want 8086 tasm code for merge sort urgently......

#9
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
This urgency leads me to believe that this is a homework assignment, yes?
sudo rm -rf /




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users