View Single Post
Old Oct 27th, 2007, 4:06 AM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: tasm sorting 5 integers with array

You're missing the point.
comp:
	mov ah, [bx+si]
	mov al, [bx+di]
	cmp ah, al

	jge swap  If it >= we jump to swap, else we fall through to swap.
swap:               What have you accomplished?

	
	mov [bx+si], al
	mov [bx+di], ah
	jmp disp1   Here you jump where?  Right where you'd go if you removed this

	

;for displaying the array
disp1:
You need to mentally trace your code, asking yourself what happens at every step. Conditionals are the heart of processing. If they don't result in different paths, they're worthless.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote