Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hpcvca!scott From: scott@hpcvca.CV.HP.COM (Scott Linn) Newsgroups: comp.lang.c Subject: Re: Large arrays in MSDOS Message-ID: <4010006@hpcvca.CV.HP.COM> Date: 26 Oct 89 16:48:43 GMT References: <4010005@hpcvca.CV.HP.COM> Organization: Hewlett-Packard Co., Corvallis, Oregon Lines: 28 / hpcvca:comp.lang.c / readdm@walt.cc.utexas.edu (David M. Read) / 10:36 am Oct 25, 1989 / >In article <4010005@hpcvca.CV.HP.COM> scott@hpcvca.CV.HP.COM writes: >> >>Hello, >> >>I've been having a problem trying to use an array greater than 64k on >>an msdos machine. What I have is the following: >> >Remember that the 80x86 processors use segmented architecture, so 64K is >a kind of barrier. The way to get around the barrier is with use of the >'huge' keyword. Read the manuals closely, for there are some limitations >on what you can do with it. Yes, this was the problem. I realize that the architecture is segmented, but I was under the (mistaken!) impression that far pointers would be able to address more than 64k. The problem seems to be that the pointer arithmetic only applies to the offset, and not the segment. Thus, wrapping occurs. My compiler (Datalight) does not have the Huge model, so I'm kind of hosed. I will probably address the array using two pointers, where the second pointer is composed by the first one cast to a long, the correct offset added, then cast back to a far pointer. This should solve the arithmetic problem. Thanks to all who replied in notes or mail. Scott Linn hplabs!scott@hpcvcbh