Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - segofftomem() copy from segment/offset address to an object http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 segofftomem()       Copy from segment/offset address to an object
------------------------------------------------------------------------------
 Declaration
   memory.hdr

 Syntax
   proc segofftomem extern
   param value uint    uSegment, ;
         value uint    uOffset, ;
               untyped xObject, ;
         value uint    uLength

 Arguments
   uSegment is the source segment address.
   uOffset is the source offset address.
   xObject is the destination memory object.
   uLength is the length of the copy operation.

 Return
   None.

 Description
   The procedure copies uLength bytes from the memory contents
   starting at the address specified by the segment/offset pair to the
   address of xObject. The procedure can be used, as an example, to
   copy the contents of arrays to some other place.

   Use this procedure with extreme care, as it may overwrite important
   memory areas if called with an invalid address, or an excess length.

 Example
   #define EXAMPLE_MEMORY
   #include example.hdr

   // Copy memory contents (a string) using function calls
   
   proc Test_segofftomem
   vardef
      char cSrc
      char cDest
      uint uSeg, uOff
   enddef
   cSrc := "Force compiler"
   splitptr( uSeg, uOff, &cSrc )
   cDest := ""
   ? cDest
   segofftomem( uSeg, uOff, cDest, len( cSrc ) + 1 )
   ? cDest
   endproc

   proc main
   Test_segofftomem()
   endproc

See Also: memtoptr() memtosegoff() ptrtomem()

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