home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18862 < prev    next >
Encoding:
Text File  |  1992-12-24  |  1.5 KB  |  37 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!psinntp!ptsys1!mliu
  3. From: mliu@pt.com (Fred Liu)
  4. Subject: Re: Peek/Poke in C
  5. Message-ID: <1992Dec24.141443.6191@pt.com>
  6. Organization: Performance Technologies, Incorporated
  7. References: <pal.724673747@regent.e-technik.tu-muenchen.de> <mLF0VB1w165w@wozzle.linet.org>
  8. Date: Thu, 24 Dec 1992 14:14:43 GMT
  9. Lines: 26
  10.  
  11. In article <mLF0VB1w165w@wozzle.linet.org> alane@wozzle.linet.org (J. Alan Eldridge) writes:
  12. >pal@regent.e-technik.tu-muenchen.dbp.de (Peter Loibl) writes:
  13. >
  14. >> ericwebb@blackwlf.gwinnett.com (eric webb) writes:
  15. >> 
  16. >> >Hi again.. does anyone know how to do equivalent of BASIC's PEEK & POKE
  17. >> >statements in C?
  18. >> 
  19. >> I am sorry for my ignorance, but what are PEEK and POKE doing? If you
  20. >> describe their task, then this would be lots of help for all the
  21. >> "C-Gurus" here.
  22. >
  23. >peek and poke are to access absolute memory addresses under DOS.
  24.  
  25. There is peek() and poke() available on Sun systems for writing
  26. device drivers.  They are kernel routines and can only be used
  27. by device drivers.  Peek() and poke() are not standard C functions.
  28. However, if you are writing a standalone program, you will be
  29. able to access physical addresses using assignment statements.
  30. Here is an example:  *(char *)0xABCDEF00 = 0xAB; or if your
  31. compiler does not allow this, you could try: (char *)ptr = 0xABCDEF00;
  32. *ptr = 0xAB;
  33.  
  34. -- 
  35. Fred Liu, Performance Technologies Incorporated        mliu@pt.com
  36. 315 Science Parkway, Rochester, New York 14620        uupsi!ptsys1!mliu
  37.