Category : Recently Uploaded Files
Archive   : 80XXX_94.ZIP
Filename : SORT.ASM

 
Output of file : SORT.ASM contained in archive : 80XXX_94.ZIP
;selection_sort_arrayw - sort word array (integers)
; inputs: ds/es:si - ptr to array of words
; dx - number of items in array (range 0-32767)
; direction flag is in CLD state.
; Output: array is sorted in descending order
; Registers ax,bx,cx,dx,si,di are modified
; Note: code size is 29 bytes.

do_swap: lea bx,ds:[di-2] ;get [di-2]
mov ax,ds:[bx] ;get new smallest
dec cx ;do not put "jmp" here, too slow
jcxz tail ;jmp if one pass done
loop1: scasw ;compare
ja do_swap ;jmp if new smallest
loop loop1 ;jmp if more data
tail: xchg ax,ds:[si-2] ;put smallest
mov [bx],ax ; at top
selection_sort_arrayw:
mov bx,si ;set smallest ptr -bx-
lodsw ;get smallest
mov di,si ;set moving compare ptr
dec dx ;adjust loop count
mov cx,dx
jg loop1 ;loop till done
ret



  3 Responses to “Category : Recently Uploaded Files
Archive   : 80XXX_94.ZIP
Filename : SORT.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/