1 Replies - 606 Views - Last Post: 07 November 2009 - 12:27 AM

#1 emerald_gal  Icon User is offline

  • D.I.C Head

Reputation: -9
  • View blog
  • Posts: 64
  • Joined: 21-November 08

finding the largerst from some numbers

Post icon  Posted 06 November 2009 - 02:05 AM

Hello!

I have written this code for finding the largest num from an array of numbers, the code compiles fine, but when i run it in debugger the register values do not change at all. Kindly check whats wrong with this code.

[org 0x0100]

jmp start
		  
Array:
		 db 2,8,9,1,7,4,1,6,8,5,9
				  
noAction:
 mov ax,0x4c00
 int 0x21
									 
TheLoop:
				  
cmp bx,10
jb increment
ja noAction
									
increment:
add bx,1
									 
Maximum:
cmp dx,[Array+bx]
ja SetMax
jbe TheLoop
									

SetMax:
mov dx,[Array+bx]
jmp TheLoop
									
start:
mov bx,0
mov dx,[Array+0]
call Maximum
									 
mov ax,0x4c00
int 0x21
			   



Is This A Good Question/Topic? 0
  • +

Replies To: finding the largerst from some numbers

#2 hackterr  Icon User is offline

  • D.I.C Regular

Reputation: 21
  • View blog
  • Posts: 293
  • Joined: 13-August 09

Re: finding the largerst from some numbers

Posted 07 November 2009 - 12:27 AM

put array as
Array db 2,8,9,1,7,4,1,6,8,5,9


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1