hi there friends
i'm trying to sort words by the abc in assembly
for the first run it goes well but in the second it misses up and goes in non ended loop.
if any one can help i will be thankful for him.

mov 	cl,[act]
check:	
	mov	bx,0   ; the string index   (it makes the problem)
cont:
	mov	al,[byte bx + si]	;#1
	mov	dl,[byte bx + si + 4]	;#2
	cmp 	dl,al
	jb	switch
	add	bx,4
	sub	cl,4
	jmp	cont
switch:                            ; switch the letters
	mov	ah,al
	xchg	dl,[byte bx + si]
	xchg	[byte bx + si + 4],ah
	inc 	bx
	mov	al,[byte bx + si]	
	mov	dl,[byte bx + si + 4]
	cmp	dl,13
	je	check
	loop	switch
	inc	bx
	jmp	check

thanks a lot

What's in the registers?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.