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

  1. ;***************************** SORT20.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    merge_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. MERGE_SORT_BUFFER - merge 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.     
  39.     PUBLIC    MERGE_SORT_BUFFER
  40. MERGE_SORT_BUFFER    PROC    FAR
  41.     push    bp
  42.     mov    bp,offset merge_sort
  43.     mov    cs:sort_engine,bp
  44.     mov    cs:buffer_off,di
  45.     mov    cs:buffer_seg,es
  46.     mov    cs:buffer_len,cx
  47.     mov    cs:fixed_record_len,bx
  48.     mov    cs:rec_term_char,al
  49.     mov    byte ptr cs:sort_field_len,ah
  50.     mov    cs:sort_column,dx
  51.     call    buffer_sort
  52.     pop    bp
  53.     retf
  54. MERGE_SORT_BUFFER    ENDP    
  55.  
  56. LIBSEG    ENDS
  57.     end
  58.