home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / mswindo / programm / misc / 5301 < prev    next >
Encoding:
Text File  |  1993-01-23  |  1.4 KB  |  39 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!jas37876
  3. From: jas37876@uxa.cso.uiuc.edu (John A. Slagel)
  4. Subject: Re: Memory I/O operation in windows. How?
  5. References: <C132Cs.Cpp@newsserver.technet.sg> <1993Jan22.181056.26438@ibr.cs.tu-bs.de>
  6. Message-ID: <C1BEwK.9zF@news.cso.uiuc.edu>
  7. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  8. Organization: University of Illinois at Urbana
  9. Date: Sat, 23 Jan 1993 16:24:19 GMT
  10. Lines: 27
  11.  
  12.     To access the memory at segment D000, you need to use a predefined
  13.     selecter.  Here's how to clear the segement located at D000. 
  14.     Once you make the MyMemory pointer, you can just access it like
  15.     any other array.
  16.  
  17.     #include "windows.h"
  18.  
  19.     extern WORD PASCAL __D000H;
  20.  
  21.     #define MY_SEGMENT (&__D000H)
  22.  
  23.     main()
  24.     {
  25.      long i;
  26.      BYTE FAR * MyMemory;
  27.  
  28.      MyMemory = (BYTE FAR *)MAKELONG( 0, MY_SEGMENT );
  29.  
  30.          for (i=0; i<0xFFFF; i++ )  {
  31.          MyMemory[i] = 0;
  32.          }
  33.      }
  34. -- 
  35. -----------------------------------------------------------------------------
  36.  John A. Slagel              "My old man used to tell me, before he left this
  37.  j-slagel1@uiuc.edu           shitty world, never chase buses or women- you
  38.  (217) 337-7930               always get left behind." -The Marlboro Man
  39.