home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / mswindo / programm / misc / 1058 < prev    next >
Encoding:
Text File  |  1992-07-28  |  2.1 KB  |  60 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!mcsun!fuug!kiae!csoft!news-server
  3. From:  dema@metal.dnepropetrovsk.ua (D.V.Uzhakov)
  4. Subject: Re:[HELP] documentation __AnIncr
  5. Reply-To: dema%metal.dnepropetrovsk.ua@ussr.eu.net
  6. Organization: Dneprometal
  7. Date: Tue, 28 Jul 92 16:09:57 -0500 
  8. Message-ID: <AALcQTg4h4@metal.dnepropetrovsk.ua>
  9. Lines: 47
  10. Keywords: __AnIncr, __AhShift
  11. Sender: news-server@cs.kiev.ua
  12.  
  13. > Also, from reading Petzold, I understand that if I have allocated a
  14. > very large block using GlobalAlloc() (>64K bytes), then I cannot use a
  15. > huge pointer and step from byte 0xffff to 0x10000 by simply adding 1.
  16. > There is some magic about protected mode and adding 8 to the segment
  17. > register that is not clear.  Any ideas?
  18.  
  19. ???????????????????????????????????????????????????????????????????????????
  20.  __ahIncr  = 8          ? These constants are defined in kernel. You can use
  21.  __ahShift = 3 = log  8 ? them to address next selectors in a large block of
  22.                     2   ? memory ( > 64 KB ) .They are added to the current
  23.                         ? selector.
  24. ???????????????????????????????????????????????????????????????????????????
  25.                                 Example for TPW :
  26. uses WinCrt   ,
  27.      WinTypes ,
  28.      WinProcs ;
  29. const LONGBLOCK = 100000 ;
  30. type buf  = array [ 0 .. 0 ] of BYTE ;
  31.      pbuf = ^ buf ;
  32. var  hMem ,
  33.      wCount    : WORD ;
  34.      pMem      : pbuf ;
  35. begin
  36.         hMem := GlobalAlloc ( GMEM_FIXED , LONGBLOCK) ;
  37.         pMem := GlobalLock  ( hMem ) ;
  38.  
  39.         for wCount := 0 to $FFFF
  40.           do pMem ^ [ wCount ] := wCount mod $FF ;
  41.  
  42.         hMem := hMem + 8 ; (* __AHINCR *)
  43.         pMem := GlobalLock ( hMem ) ;
  44.  
  45.         for wCount := 0 to LONGBLOCK-$FFFF
  46.           do pMem ^ [ wCount ] := wCount mod $FF ;
  47.  
  48.         GlobalUnLock ( hMem ) ;
  49.         GlobalFree   ( hMem ) ;
  50.         hMem := hMem - 8 ; (* __AHINCR *)
  51.         GlobalUnLock ( hMem ) ;
  52.         GlobalFree   ( hMem ) ;
  53. end .
  54.  
  55.            Cygankov Sergey        Dnepropetrovsk State University
  56.            Uzhakov Dementiy       UKRAINE ( 7-0562 ) -39-12-85
  57.                                                      -26-17-51
  58.  
  59.  
  60.