home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / peekbyte.c < prev    next >
C/C++ Source or Header  |  1993-10-14  |  1KB  |  63 lines

  1. /*
  2.  * File......: PEEKBYTE.C
  3.  * Author....: David Pearson
  4.  * BBS.......: The Dark Knight Returns
  5.  * Net/Node..: 050/069
  6.  * User Name.: Dave Pearson
  7.  * Date......: 30/03/93
  8.  * Revision..: 1.0
  9.  *
  10.  * This is an original work by Dave Pearson and is placed in the public
  11.  * domain.
  12.  *
  13.  * Modification history:
  14.  * ---------------------
  15.  *
  16.  * $Log$
  17.  *
  18.  */
  19.  
  20. #include "GT_Mem.H"
  21. #include <Extend.H>
  22.  
  23. /*
  24.  *  $DOC$
  25.  *  $FUNCNAME$
  26.  *      GT_PEEKB()
  27.  *  $CATEGORY$
  28.  *      Memory
  29.  *  $ONELINER$
  30.  *      Return the contents of a byte in memory.
  31.  *  $SYNTAX$
  32.  *      GT_PeekB(<nSegment>,<nOffset>) --> nByte
  33.  *  $ARGUMENTS$
  34.  *      <nSegment> is the segment of the byte in memory.
  35.  *
  36.  *      <nOffset> is the offset of the byte in memory.
  37.  *  $RETURNS$
  38.  *      The numeric content of the specified byte in memory.
  39.  *  $DESCRIPTION$
  40.  *      GT_PeekB() can be used for getting numeric byte values from
  41.  *      specific locations in memory.
  42.  *  $EXAMPLES$
  43.  *      // Check if Caps Lock is active.
  44.  *
  45.  *      nKeyboard := GT_PeekB(0,1047)
  46.  *      ? "Caps Lock is "+if(GT_And(nKeyboard,64) == 0,"Off","On")
  47.  *  $SEEALSO$
  48.  *      GT_PEEKW()
  49.  *  $END$
  50.  */
  51.  
  52. CLIPPER GT_PeekB()
  53. {
  54.         if (PCOUNT == 2 && ISNUM(1) && ISNUM(2))
  55.         {
  56.                 _retni((unsigned char)_GT_peekb(_parnl(1),_parnl(2)));
  57.         }
  58.         else
  59.         {
  60.                 _retni(0);
  61.         }
  62. }
  63.