Path: utzoo!mnetor!uunet!husc6!think!ames!lll-lcc!pyramid!voder!apple!goldman From: goldman@Apple.COM (Phil Goldman) Newsgroups: comp.sys.mac.programmer Subject: Re: MultiFinder and TopMem() question Message-ID: <7668@apple.Apple.Com> Date: 14 Mar 88 06:02:03 GMT References: <730008@hpcilzb.HP.COM> Reply-To: goldman@apple.UUCP (Phil Goldman) Organization: Apple Computer Inc, Cupertino, CA Lines: 46 In article <730008@hpcilzb.HP.COM> tedj@hpcilzb.HP.COM (Ted Johnson) writes: > >What is the proper way to check for the total amount of >RAM? Under 4.1/5.5 the following works: > > long totalRAM; > > totalRAM = (long)TopMem()/1024; > >But under MultiFinder this gives me too small a number (i.e., 179 >instead of 1024). MultiFinder changes low memory variable MemTop (accesses by routine TopMem()) to a number *approximately* equal to the size of system heap + the size of the current (i.e. calling) application's partition. The rationale behind this is to "convince" older apps that this is the size of the machine. Note that this changes MemTop to be a size rather than a pointer; the 2 were equivalent before because RAM starts at 0, but most apps used it as a size. Hopefully an application does not need to know the real value of MemTop, or even a fake one, but if it does it should only need it for purposes of displaying machine information. Anyway...it seems that we were remiss in the first release of the MultiFinder Development Package. There *is* a MF temp memory call for MemTop, as follows: /* MultiFinder dispatch trap */ #define OSDISPATCH 0xA88F /* Routine selector value */ #define mfMemTopSel 22 /* Macro that the gets put into your source code */ #define MFMemTop() \ cTWMemTop(mfMemTopSel) /* And the actual trap that gets called */ pascal Ptr cMFMemTop(SW) short SW; extern OSDISPATCH; This info will be put in the MultiFinder documentation ASAP, along with the corresponding interfaces for Pascal and assembler. -Phil Goldman Apple Computer