Kaleborg
Member level 4
Hello,
I have little difficulty with my routine for sorting list.
My problem is that i'm not sure how to stop sorting. When list is sorted from the lowest value to the highest what should i do to make it jump out of that subroutine.
Please help
Regards
I have little difficulty with my routine for sorting list.
Code:
sortit
btfsc flag,0 ;this is part of problem
goto cont
bsf flag,0
movlw 0x30 ;starts here
movwf FSR
seeifbig
movf INDF,W ;copy value to temp
movwf sTemp1
incf FSR,FILE ;copy next value
movf INDF,W
subwf sTemp1,W ;compare it
; bsf flag,0
btfss STATUS,0 ;if bigger or if zero...
goto seeifbig
btfsc STATUS,2
goto sortit
movf INDF,W
movwf sTemp2 ;...swap it
movf sTemp1,W ;
movwf INDF
decf FSR,FILE ;
movf sTemp2,W
movwf INDF
incf FSR,FILE
;movf FSR,W
;subwf flag,W
bcf flag,0 ;here is my problem
goto sortit
cont return
Please help
Regards