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 - ptrtobyte() read a byte from a memory address http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ptrtobyte()         Read a byte from a memory address
------------------------------------------------------------------------------
 Declaration
   memory.hdr

 Syntax
   func byte ptrtobyte extern
   param value _POINTER pMem

 Arguments
   pMem is a memory address.

 Return
   A byte value.

 Description
   This function returns the byte located at the specified memory address.

   The function 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

   // address in BIOS data area where number of hard disks is stored
   #define BIOS_NUMDISKS 0x00400075
   
   proc Test_ptrtobyte
   vardef
      ptr( byte ) pMem
   enddef
   ? ptrtobyte( BIOS_NUMDISKS ) // get value using function call
   pMem := BIOS_NUMDISKS        // get value using pointer
   ? *pMem
   endproc

   proc main
   Test_ptrtobyte()
   endproc

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