home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / POKE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  2.5 KB  |  73 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. /*|                                                              |*/
  11. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  12. /*|                                                              |*/
  13. /*|                                                              |*/
  14. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  15. /*|     All Rights Reserved.                                     |*/
  16. /*|                                                              |*/
  17. /*[]------------------------------------------------------------[]*/
  18.  
  19. #include <dos.h>
  20. #undef    poke
  21. #undef    pokeb
  22.  
  23. /*---------------------------------------------------------------------*
  24.  
  25. Name            poke - stores value at a given memory location
  26.  
  27. Usage           void poke(unsigned segment, unsigned offset, int value);
  28.  
  29. Related
  30. functions usage void pokeb(unsigned segment, unsigned offset, char value);
  31.  
  32. Prototype in    dos.h
  33.  
  34. Description     poke stores the integer value at the memory location
  35.                 segment:offset.
  36.  
  37.                 If these routines are called when dos.h has been included, they
  38.                 will be treated as macros@INDEX[Macros] that  expand to in-line
  39.                 code. If you don't include dos.h (or if you do include it and
  40.                 #undef the routines) you will get the functions rather than the
  41.                 macros.
  42.  
  43.                 pokeb is the same as poke, except that a byte value is
  44.                 deposited instead of an integer.
  45.  
  46. Return value    None
  47.  
  48. *---------------------------------------------------------------------*/
  49. void poke(unsigned segment, unsigned offset, int value)
  50. {
  51.     _ES = segment;
  52.     * (int _es *) offset = value;
  53. }
  54.  
  55.  
  56. /*---------------------------------------------------------------------*
  57.  
  58. Name            pokeb - value at memory location
  59.  
  60. Usage           #include <dos.h>
  61.                 void pokeb(unsigned segment, unsigned offset, char value);
  62.  
  63. Prototype in    dos.h
  64.  
  65. Description     see poke
  66.  
  67. *---------------------------------------------------------------------*/
  68. void pokeb(unsigned segment, unsigned offset, char value)
  69. {
  70.     _ES = segment;
  71.     * (char _es *) offset = value;
  72. }
  73.