home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / TS / ASM / REPMEM.ASM < prev    next >
Encoding:
Assembly Source File  |  1987-08-07  |  1.1 KB  |  61 lines

  1. ;                **************
  2. ;                * REPMEM.asm *
  3. ;               *******************************************
  4. ;               * Copyright TimeSlice, Inc. 1985, 86, 87. *
  5. ;               *******************************************
  6. ;
  7. ;
  8. ;
  9. include ts.inc
  10. ;
  11. start_data
  12. end_data
  13. ;
  14. start_code
  15. ;
  16. ;
  17. ;****
  18. ;* REPMEM( TO, TMPL, TSIZE, NTMPL )
  19. ;****
  20. start_struct
  21. mbr    rmbp    d_int
  22. mbr    rmret    d_ret
  23. mbr    rmto    d_ptr
  24. mbr    rmtmpl    d_ptr
  25. mbr    rmtsize    d_int
  26. mbr    rmntmpl    d_int
  27. end_struct rmstk
  28. ;
  29. routine    repmem
  30.     push    bp            ;save bp, si, di, es
  31.     mov    bp,sp            ;reset base pointer
  32.     push_sdi
  33.     push    ds
  34.     push    es
  35.     cld
  36.     ldptr    ds,si,[bp].rmtmpl,d    ;load tmplate
  37.     ldptr    es,di,[bp].rmto,d    ;load destination
  38.     ldint    cx,[bp].rmtsize        ;load tmplate length (in bytes)
  39.     repz    movsb
  40.     ldptr    ds,si,[bp].rmto,d    ;load destination
  41.     ldint    ax,[bp].rmntmpl
  42.     dec    ax
  43.     ldint    bx,[bp].rmtsize
  44.     imul    bx
  45.     mov    cx,ax
  46.     test    cx,1            ;odd number of bytes to move???
  47.     jz    repm0            ;if yes move 1 byte alone
  48.     movsb
  49. repm0:    shr    cx,1            ;compute LEN in number of words
  50.     repz    movsw            ;move LEN words
  51.     pop    es
  52.     pop    ds
  53.     pop_sdi
  54.     pop    bp
  55. return    repmem
  56. ;
  57. end_code
  58.  
  59.  
  60.  
  61.