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 - splitptr() convert a pointer to segment/offset http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 splitptr()          Convert a pointer to segment/offset
------------------------------------------------------------------------------
 Declaration
   memory.hdr

 Syntax
   proc splitptr extern
   param       uint     uSegment, ;
               uint     uOffset, ;
         value _POINTER pMem

 Arguments
   uSegment receives a segment address.
   uOffset receives an offset address.
   pMem is a 32-bit memory address.

 Return
   None.

 Description
   The splitptr() procedure converts a pointer value passed in pMem into
   a segment/offset pair. The result can be retrieved from the variables
   passed as the uSegment and uOffset parameters after the call.

 Example
   #define EXAMPLE_MEMORY
   #include example.hdr

   proc Test_splitptr
   vardef
      uint nSeg, nOff
   enddef
   
   // Determine data segment from the segment address of a public variable
   splitptr( nSeg, nOff, &__syscolor[] )
   ? "Data segment is", right( dechex( nSeg ), 4 )
   
   // Determine data segment from the DS register's value
   getregs()
   ? "DS  register is ", right( dechex( __regs.ds ), 4 )
   endproc

   proc main
   Test_splitptr()
   endproc

See Also: makeptr()

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