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 - __psp psp segment address http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 __psp               PSP segment address
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   uint __psp

 Default
   Not initialized.

 Description
   The __psp system variable holds the segment address of the application's
   program segment prefix (PSP).

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   proc Test_psp
   // List all environment variables
   vardef
      ptr( byte ) pPSP
      ptr( byte ) pByte
      ptr( uint ) pUint
      byte        j, k
   enddef
   pPSP := makeptr( __psp, 0 )   // program's PSP
   ? "Program environment:"
   ?; ?
   k := 1                        // non-zero temporary value
   pUint := pPSP + 0x2c
   pByte := makeptr( *pUint, 0 ) // start of program's environment
   do while .t.
      j := *pByte
      if j == 0
         ?                       // start new line
      else
         ?? chr( j )
      endif
      if j == 0 .and. k == 0     // detect double null at end of environment
         exit
      endif
      k := j
      pByte++                    // increment pointer
   enddo
   endproc

   proc main
   Test_psp()
   endproc

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