Array sorting -- ASAP (2 hr)

Hi there, I need this in two hours.
A program accepts up to 25 numbers.
The procedure in question is supposed to sort 3 and morve entries.
Although it's pseudocode given by teacher, I didn't translate it well.
Please correct me, and explain what's wrong. Now, program goes only in circuls asking for the next number to be entered when I enter the 0 -- exiting value. When I comment out this proc, program works fine.
Here is the code of the fantom procedure:

Sort_numbers PROC

MOV CX, SI ; SI keeps number of entries
A:
MOV Flag, 0
MOV SI, 0 ; INDEX = 0
DEC CX ; CX = (1 number less than how many to sort)
B:
MOV AL, Nums[SI]
INC SI
CMP Nums[SI], AL
JBE C
XCHG AL, Nums[SI]
DEC SI
XCHG AL, Nums[SI]
MOV Flag, 1
C:
INC SI
LOOP B
CMP Flag, 1
JE A
RET

Sort_numbers ENDP
Thanks in advance!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories