home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11736 < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.5 KB  |  55 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!cs.utexas.edu!uwm.edu!csd4.csd.uwm.edu!pegasus
  3. From: pegasus@csd4.csd.uwm.edu (David R Hucke)
  4. Subject: re: converting Borland peekb and pokeb to Microsoft
  5. Message-ID: <1992Jul30.024656.11608@uwm.edu>
  6. Originator: pegasus@csd4.csd.uwm.edu
  7. Sender: news@uwm.edu (USENET News System)
  8. Organization: Computing Services Division, University of Wisconsin - Milwaukee
  9. Date: Thu, 30 Jul 1992 02:46:56 GMT
  10. Lines: 43
  11.  
  12. Hope this helps...
  13.  
  14. I don't know what pokeb and peekb do, but they sound like they put
  15. a value to a memory address and check a memory address...
  16.  
  17. If this is the case you can do something like this:
  18.  
  19. char far *MemPtr
  20. #include <stdio.h>
  21.  
  22. main()
  23. {
  24.  
  25.     char far *MemPtr;      /* Ptr to a byte in memory */
  26.     char data;
  27.  
  28.     MemPtr = (char far *) 0xB8000000L;
  29.         /* this points to address in memory you want to work on.
  30.         In the above  B800 is the segment and 0000 is the
  31.         offset */
  32.     data = *MemPtr;
  33.     /*  This line should be equal to peekb(address) where the address
  34.      was set by the first line.  Your function could then return the
  35.      value of data. */
  36.  
  37.     *MemPtr = 112;
  38.     /*  This is equivalent then to pokeb(address,112).
  39.     You could in the pointer to the memory location instead
  40.     of how I did it here.  */
  41. }
  42.  
  43.  
  44. This code was written for Microsoft Quick C v 2.5 and should work on any
  45. Microsoft C compiler.  (Note:  turn pointer checks off)
  46.  
  47. Please let me know if this helps you out...
  48.  
  49. ===
  50. pegasus@csd4.csd.uwm.edu
  51. -- 
  52. pegasus@csd4.csd.uwm.edu                David R. Hucke
  53.                                         UW-Milwaukee Film Major
  54. --
  55.