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 - bytetosegoff() poke a byte value at segment/offset address http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 bytetosegoff()      Poke a byte value at segment/offset address
------------------------------------------------------------------------------
 Declaration
   memory.hdr

 Syntax
   proc bytetosegoff extern
   param value byte bValue, ;
         value uint uSegment, ;
         value uint uOffset

 Arguments
   bValue is the value to place in memory.
   uSegment is the target segment address.
   uOffset is the target offset address.

 Return
   None.

 Description
   This procedure copies a byte value into the specified memory location.

   The procedure is included for compatibility with earlier Force versions.
   Use the ptr() data type in conjunction with the & and * operators for
   directly writing to explicit memory addresses.

 Example
   #define EXAMPLE_MEMORY
   #include example.hdr

   proc Test_bytetosegoff
   vardef
      ptr( byte ) pMem        // pointer
      uint        nSeg, nOff  // segment and offset
   enddef
   pMem := malloc( 1000 )     // allocate working space
   splitptr( nSeg, nOff, pMem ) // obtain segment and offset values
   ? *pMem                    // prints accidental value
   bytetosegoff( 100, nSeg, nOff ) // write a byte to memory via function call
   ? *pMem                    // prints 100
   *pMem := 111               // write a byte to memory via pointer
   ? *pMem                    // prints 111
   free( pMem )               // free allocation
   endproc

   proc main
   Test_bytetosegoff()
   endproc

See Also: bytetoptr() chartoptr() chartoptr() chartosegoff() chartosegoff() poke() uinttoptr() uinttosegoff() ulongtoptr() ulongtosegoff()

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