Organizing 64k heap-memory segments in real mode. 
Author Message
 Organizing 64k heap-memory segments in real mode.

Jan,

to allocated all available heap and assign its address to a pointer P,
simply write:

P := HeapPtr ;
HeapPtr := HeapEnd ;

However this throws up another problem. By dereferencing P, you cannot
access more than 64kBytes. You'll have to go to BASM code and use 32bit
offset addressing which is available for 386 and upward processors.

It is far easier, and less error-prone, to use code like this:

FOR i := 0 TO 3 DO GetMem (P [i], 32768) ;

To allocate 128kBytes of heap - and when accessing the heap storage, first
find out which P [i] is actually pointing to the location you need.

Can you make some of this?
           -  Hans
--------------------------------------------------------------------------------
Hans Schleichert
Institut fuer Medizinische Psychologie und Verhaltensneurobiologie
(Institute of Medical Psychology and Behavioural Neurobiology)
Eberhard-Karls-University
Gartenstrasse 29
D-72074 Tuebingen, Germany
Voice      (+49-7071) 29-75997  NEW!
Fax        (+49-7071) 29-5956

CompuServe [100031,775]



Wed, 18 Jun 1902 08:00:00 GMT  
 Organizing 64k heap-memory segments in real mode.

Hi there.
In my program I want to use all possible heap-memory when sorting,searching
and accessing files.

I have scanned trough many tp-tutors/and c-tutors without finding
examples/algorithms how above is done.(oranizing more than one heap 64kb segment)

Yes,examples that nicely fits into memory is no problem to find but dealing
with many memorysegments seemes like a BIG secret ;)

Can anyone give a helping hand to guide me further on.

Here's an example of problem:

outer loop begin
get a key;
inner loop begin
           search for key and get its belonging data trough a file;
           {this file contains, AT MOST, 1000000 longints}
           do something with belongingdata;
           end;{inner loop}
      end;{outer loop}

Thank You
regards
-je-

--

www  : http://www.sn.no/home/janeik/
ftp  : ftp.sn.no/user/janeik/



Wed, 18 Jun 1902 08:00:00 GMT  
 Organizing 64k heap-memory segments in real mode.

Quote:

>Hi there.
>In my program I want to use all possible heap-memory when sorting,searching
>and accessing files.
>I have scanned trough many tp-tutors/and c-tutors without finding
>examples/algorithms how above is done.(oranizing more than one heap 64kb
>segment)

Most tutorials would probably only cover simple applications, such as how to
allocate a single block on the heap, and search a single area of memory.  
From what you want to do, it sounds like a more advanced application that
could use a little ingenuity to accomplish.

Quote:
>Yes,examples that nicely fits into memory is no problem to find but dealing
>with many memorysegments seemes like a BIG secret ;)
>Can anyone give a helping hand to guide me further on.
>Here's an example of problem:
>outer loop begin
>get a key;
>inner loop begin
>           search for key and get its belonging data trough a file;
>           {this file contains, AT MOST, 1000000 longints}
>           do something with belongingdata;
>           end;{inner loop}
>      end;{outer loop}

Within the last couple months, I know I posted an example of how to create a
huge array using an array of pointers to arrays.  That type of code would
probably be a good place to start.  I don't have the code, but if you go to
Deja News and set a filter with my e-mail address and c.l.p.b as a group,
you ought to be able to find it there (if you're not familiar with Deja
News, drop me a line and I'll be glad to see if I can fish it out for you).

Quote:
>Thank You
>regards
>-je-
>--

>www  : http://www.sn.no/home/janeik/
>ftp  : ftp.sn.no/user/janeik/

--
Scott Earnest          | We now return you to our regularly scheduled |



Wed, 18 Jun 1902 08:00:00 GMT  
 Organizing 64k heap-memory segments in real mode.


Quote:

>Jan,
>However this throws up another problem. By dereferencing P, you cannot
>access more than 64kBytes.

So is the real life :)

Quote:
>It is far easier, and less error-prone, to use code like this:
>FOR i := 0 TO 3 DO GetMem (P [i], 32768) ;
Yepp.
>To allocate 128kBytes of heap - and when accessing the heap storage, first
>find out which P [i] is actually pointing to the location you need.
>Can you make some of this?

I will try,thank You.
-je-
--

www  : http://www.sn.no/home/janeik/
ftp  : ftp.sn.no/user/janeik/


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Big Heap in Real Mode

2. Real mode memory allocation and forced $0 offsets in BP7.0

3. Real Mode Flat memory of 4 GIG????

4. Help DPMI 64K Segment size

5. 64k Data segment limit

6. BPW: data segment cannot exceed 64k

7. 64K Data Size Limits and CTE 49 {Data Segment}

8. tspa357c.zip Turbo Pascal 7.0 real mode units for (real:-) programmers

9. tspa3570.zip Turbo Pascal 7.0 real mode units for (real:-) programmers

10. tspa3570.zip Turbo Pascal 7.0 real mode units for (real:-) programmers

11. Protected mode VS Real mode ???

12. Real Mode from Protected Mode: Accessing an RMode TSR from PMode

 

 
Powered by phpBB® Forum Software