movedata () recoded in 80x86 assembly

cs106132 cs106132 at umbc5.umbc.edu
Fri Feb 15 09:15:54 AEST 1991


   Hi,
I was wondering if anyone out there show me an example of coding a
routine that will do the equivalent of Turbo C's "movedata()" function.
In other words, a routine that will copy  a block of memory from any
segment:offset to any segment:offset.  The important thing is that it does not
use any interrupt calls.  I would like to see an implementation using
inline assembly capability of Turbo C.  If you have such a routine or know
where I can find one, please let me know either by e-mail or post here.


    Something like:

    void  my_movedata (unsigned src_seg, unsigned src_off,
                       unsigned dst_seg, unsigned dst_off,
                       unsigned count) {

      asm  push es
      asm  push ds
      asm  mov  ax, src_seg
      asm  mov  es, 
      asm  mov  si, src_off
      asm  mov  ax, dst_seg
      asm  mov  ds, ax
      asm  mov  di, dst_off
      asm  mov  cx, count/2
      asm  cld
      asm  rep movsw
    }


  I am not really familiar with the assemler, so any help will be appreciated.

Regards,
Tark



More information about the Comp.lang.c mailing list