Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>movedata() copy characters to a different segment</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 movedata()              Copy Characters to a Different Segment

 #include   <memory.h>                   Required for declarations only
 #include   <string.h>                   Use either string.h or memory.h

 void       movedata(srcseg,srcoff,destseg,destoff,nbytes);
 unsigned int srcseg;                    Segment address of source
 unsigned int srcoff;                    Segment offset of source
 unsigned int destseg;                   Ssegment address of destination
 unsigned int destoff;                   Segment offset of destination
 unsigned     nbytes;                    Number of bytes to copy

    movedata() copies 'nbytes' characters from a buffer in one segment to
    a buffer in another.  The source address is srcseg:srcoff and the
    destination address is destseg:destoff.  movedata() is used to move
    far data in small or medium models where the buffers may be in
    different segments and the segment addresses of data are not
    implicitly known.

    Returns:    No return value.

      Notes:    Because segment addresses are implicitly known in large
                model programs, you can use memcpy() instead of
                movedata() when programming large models.

                Either the segread() function or the FP_SEG() macro can
                be used to get segment values for 'srcseg' and 'destseg'.
                The IP_OFF macro can be used to get the offset values for
                'srcoff' and 'destoff'.

                Sometimes, parts of the destination and source areas
                share common memory.  In such cases (overlapping moves),
                movedata() does not always handle the move correctly;
                memmove() does.

 Portability:   Applies to MS DOS only.

   -------------------------------- Example ---------------------------------

    This example moves 1024 bytes of data from the source buffer to the
    destination buffer.

           #include <memory.h>
           #include <dos.h>

           char far *source;
           char far *dest;
           unsigned int srce_seg_val;
           unsigned int srce_off_val;
           unsigned int dest_seg_val;
           unsigned int dest_off_val;

           main()
           {
               srce_seg_val = FP_SEG(source);
               srce_off_val = FP_OFF(source);
               dest_seg_val = FP_SEG(dest);
               dest_off_val = FP_OFF(dest);
               movedata(srce_seg_val,srce_off_val,dest_seg_val,
                        dest_off_val,1024);
           }


See Also: segread() FP_SEG()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson