home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 5.ddi / CLIBSRC2.ZIP / POKE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.1 KB  |  72 lines

  1. /*-------------------------------------------------------------------------*
  2.  * filename - poke.c
  3.  *
  4.  * function(s)
  5.  *        poke - stores value at a given memory location
  6.  *        pokeb - value at memory location
  7.  *--------------------------------------------------------------------------*/
  8.  
  9. /*
  10.  *      C/C++ Run Time Library - Version 5.0
  11.  *
  12.  *      Copyright (c) 1987, 1992 by Borland International
  13.  *      All Rights Reserved.
  14.  *
  15.  */
  16.  
  17.  
  18. #include <dos.h>
  19. #undef  poke
  20. #undef  pokeb
  21.  
  22. /*---------------------------------------------------------------------*
  23.  
  24. Name            poke - stores value at a given memory location
  25.  
  26. Usage           void poke(unsigned segment, unsigned offset, int value);
  27.  
  28. Related
  29. functions usage void pokeb(unsigned segment, unsigned offset, char value);
  30.  
  31. Prototype in    dos.h
  32.  
  33. Description     poke stores the integer value at the memory location
  34.                 segment:offset.
  35.  
  36.                 If these routines are called when dos.h has been included, they
  37.                 will be treated as macros@INDEX[Macros] that  expand to in-line
  38.                 code. If you don't include dos.h (or if you do include it and
  39.                 #undef the routines) you will get the functions rather than the
  40.                 macros.
  41.  
  42.                 pokeb is the same as poke, except that a byte value is
  43.                 deposited instead of an integer.
  44.  
  45. Return value    None
  46.  
  47. *---------------------------------------------------------------------*/
  48. void poke(unsigned segment, unsigned offset, int value)
  49. {
  50.         _ES = segment;
  51.         * (int _es *) offset = value;
  52. }
  53.  
  54.  
  55. /*---------------------------------------------------------------------*
  56.  
  57. Name            pokeb - value at memory location
  58.  
  59. Usage           #include <dos.h>
  60.                 void pokeb(unsigned segment, unsigned offset, char value);
  61.  
  62. Prototype in    dos.h
  63.  
  64. Description     see poke
  65.  
  66. *---------------------------------------------------------------------*/
  67. void pokeb(unsigned segment, unsigned offset, char value)
  68. {
  69.         _ES = segment;
  70.         * (char _es *) offset = value;
  71. }
  72.