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

  1. ;                 ************
  2. ;                 * PEEK.asm *
  3. ;               *******************************************
  4. ;               * Copyright TimeSlice, Inc. 1985, 86, 87. *
  5. ;               *******************************************
  6. ;
  7. ;
  8. include ts.inc
  9. ;
  10. start_data
  11. end_data
  12. ;
  13. start_code
  14. ;
  15. start_struct
  16. mbr    pkbp    d_int
  17. mbr    pkret    d_ret
  18. mbr    pkseg    d_int
  19. mbr    pkoff    d_int
  20. mbr    pkbuf    d_ptr
  21. mbr    pklen    d_int
  22. end_struct pkstk
  23. ;
  24. ;****
  25. ;* PEEK( SEG, OFFSET, BUF, LEN )
  26. ;****
  27. routine    peek
  28.     push    bp            ;save bp, si, di, ds
  29.     mov    bp,sp            ;reset base pointer
  30.     push_sdi
  31.     push    ds
  32.     push    es
  33.     cld
  34.     ldint    ds,[bp].pkseg        ;load source segment
  35.     ldint    si,[bp].pkoff        ;load source offset
  36.     ldptr    es,di,[bp].pkbuf,d    ;load destination offset (in DGROUP)
  37.     ldint    cx,[bp].pklen        ;load length (in bytes)
  38.     test    cx,1            ;odd number of bytes to move???
  39.     jz    peek0            ;if yes move 1 byte alone
  40.     movsb
  41. peek0:    shr    cx,1            ;compute LEN in number of words
  42.     repz    movsw            ;move LEN words
  43.     pop    es
  44.     pop    ds            ;restore ds, si, di, bp
  45.     pop_sdi
  46.     pop    bp
  47. return    peek
  48. ;
  49. end_code
  50.