Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!spool.mu.edu!snorkelwacker.mit.edu!mit-eddie!uw-beaver!ubc-cs!alberta!herald.usask.ca!lowey From: lowey@herald.usask.ca (Kevin Lowey) Newsgroups: comp.lang.pascal Subject: Re: arrays larger than 64k? Message-ID: <1991Feb26.230955.29880@herald.usask.ca> Date: 26 Feb 91 23:09:55 GMT References: <26146@adm.brl.mil> Organization: University of Saskatchewan Lines: 31 From article <26146@adm.brl.mil>, by Mark@hamster.business.uwo.ca: > I have a program that uses a large array. I would like to have more than > 64k available. Is this possible? About 128k would be nice. I would even > accept 64k if it did not decrease the memory for normal variables. I have > tp6.0. Turbo Pascal is limited in that it works in the real mode of Intel x86 processors. It uses 64K segments, which means that no one data structure can be larger than 64K. Here is a trick that I use. Remember that a two dimensional array is really conceptually an "array of arrays". Using this principle, I can have an array of POINTERS. Each pointer can point to a 64K array. I can then access element 25,3 of this array with something like VARIABLE[23]^[3]. For example (from memory, so forgive minor mistakes): Program Test; TYPE largearray : array [1..60000] of byte; large_ptr : ^largearray; VAR The_Big_Array [array [1..20] of large_ptr; Don't forget to use "New" to allocate the arrays pointed to by The_Big_Array, and use "Dispose" when it is no longer necessary. - Kevin Lowey