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 - pokew() write a word to a memory address http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 pokew()             Write a word to a memory address
------------------------------------------------------------------------------
 Declaration
   memory.hdr

 Syntax
   proc pokew extern
   param value uint uSegment, ;
         value uint uOffset, ;
         value uint uValue

 Arguments
   uSegment is the
   uOffset is the
   uValue is the

 Return
   None.

 Description
   The pokew() procedure writes the value passed in uValue to the memory
   word with the address specified by the parameters uSegment and uOffset.

   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_pokew
   vardef
      ptr( uint ) pMem
   enddef
   // Write a color 'A' character to the upper left corner of the screen
   // using function call
   pokew( scrseg(), 0, 0x3041 )
   
   // Write a color 'b' next to the 'A' using pointer
   pMem := makeptr( scrseg(), 4 )
   *pMem := 0x1f62
   getkey()                          // wait for keypress
   endproc

   proc main
   Test_pokew()
   endproc

See Also: & peek() peekw() poke() ptr()

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