home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / SORT10.ASM < prev    next >
Assembly Source File  |  1994-11-03  |  2KB  |  60 lines

  1. ;***************************** SORT10.ASM ***********************************
  2.  
  3. LIBSEG           segment byte public "LIB"
  4.         assume cs:LIBSEG , ds:nothing
  5.  
  6. ;----------------------------------------------------------------------------
  7. .xlist
  8.     include  mac.inc
  9.     include  common.inc
  10.  
  11.     extrn    selection_sort:near
  12.     extrn    buffer_sort:near
  13.     
  14.     extrn    sort_engine:word
  15.     extrn    buffer_off:word
  16.     extrn    buffer_seg:word
  17.     extrn    buffer_len:word
  18.     extrn    fixed_record_len:word
  19.     extrn    rec_term_char:byte
  20.     extrn    sort_field_len:word
  21.     extrn    sort_column:word
  22.  
  23. .list
  24. comment 
  25. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  SORT   )
  26. SELECTION_SORT_BUFFER - selection sort of buffer in memory
  27. ;
  28. ; inputs:  es:di = ptr to buffer with data to be sorted
  29. ;             cx = length of buffer in bytes
  30. ;             bx = record length if fixed, else zero if variable length record
  31. ;             al = variable lenght record separator, else zero if fixed record
  32. ;             dx = starting column for sort
  33. ;             ah = length of sort field
  34. ; output:    carry set if insufficient memory to do sort  
  35. ;          
  36. ;* * * * * * * * * * * * * *
  37. 
  38.     extrn    selection_sort:near
  39.     
  40.     PUBLIC    SELECTION_SORT_BUFFER
  41. SELECTION_SORT_BUFFER    PROC    FAR
  42.     push    bp
  43.     mov    bp,offset selection_sort
  44.     mov    cs:sort_engine,bp
  45.     mov    cs:buffer_off,di
  46.     mov    cs:buffer_seg,es
  47.     mov    cs:buffer_len,cx
  48.     mov    cs:fixed_record_len,bx
  49.     mov    cs:rec_term_char,al
  50.     mov    byte ptr cs:sort_field_len,ah
  51.     mov    cs:sort_column,dx
  52.     call    buffer_sort
  53.     pop    bp
  54.     retf
  55. SELECTION_SORT_BUFFER    ENDP    
  56.  
  57. LIBSEG    ENDS
  58.     end
  59.