majid@citycs.UUCP (M Mirmehdi) (09/15/89)
Hi, Can anyone help with the following please: I am writing an application on my 1MB PC-AT, using Microsoft C 5.1, which requires a number of large two-dimensional arrays. Naturally, having soon ran out of space in my conventional memory, I realised that I had to explore the HMA or the EMB, where: ----------------------------------- Top of Memory | | | | Please Note: ----------------------------------- This is a | Possible Extended Memory | very basic | Block (EMB) | representation. ----------------------------------- | | ----------------------------------- 1088K | High Memory Area (HMA) | ___________________________________ 1024K or 1MB ----------------------------------- | | | Upper Memory Block | ----------------------------------- 640K | Conventional Memory | ----------------------------------- 0K I then requested LIMXMS (eXtended Memory Specification, ver 2.0) from Microsoft, who promptly supplied me with a copy. I dismissed the HMA immediately as I realised an extra 64K was not enough, and tried to use the EMBs with the extra 384K available. Using the test programs provided with LIMXMS, I managed to confirm that I had 384K available, but the rest has been an uphill struggle. I have tried to allocate (which seems to work fine) and lock an area of memory (also works fine), and then assign it to an array (code below) . It all works ok, but when I try to initialise the array the whole system locks up. /* Code to assisgn EMB to a 2D array of 100x100 size */ /* This is essentially like mallocing in conventional memory */ long far *start, *base; long far **array; long XMM_memory_start; /* eXtended Memory Manager start of memory */ /* This XMM_memery_start address is available after a LIMXMS procedure call */ start = (long far *)XMM_memory_start; array = (long far **)XMM_memory_start; base = start + 100; for (i=0;i<100;i++) { *start = (long far)&base; start++; base += 100; } /* now use array, but it hangs the system. */ Reading the LIMXMS documentation further, it seems that I have two ways out, but these two methods are far two cumbersome and tedious: 1 - Use the Move Block (function 0Bh) to move blocks of memory around from conventional to extended memory. This would slow down everything so much. 2 - Write driver routines which will exist in HMA which then access the extended memory. No thanks! I am probably wrong about (1) and completely misguided about (2), but if anyone has any suggestions, however remote, please mail me personally if possible. I will try and let the net know how things get on. Has anyone done (1) or (2)? I believe there are some articles in the Microsoft Journal which help you out with this, (any old examples would do), but I haven't managed to get hold of the relevant issues. I believe there are helpful articles in: "Microsoft Systems Journal", volume 10, number 6, November, 1988, article entitled "The High Memory Area: 64KB More Memory in Real Mode", by Chip Anderson, pages 53-57. "Microsoft Systems Journal", volume 4, number 4, July 1989, article entitled "Extended Memory Specification 2.x: Taking Advantage of the 80286 Protected Mode", by Chip Anderson, pages 17-26. (Thanks to Lee Fisher for references.) Photocopies of these articles will be priceless! I have just begun investigating the protected mode documentation that I have so may be that will bring some joy. Anyway, any help would be greatly appreciated. Thanks in advance... Majid. -------------------------------------------------------------------------- Majid Mirmehdi Dept. of Computer Science The City University Northampton Square Tel : +44 1 253 4399 x3718 London Internet: majid%uk.ac.city.cs@nss.cs.ucl.ac.uk EC1V 0HB JANET : majid@uk.ac.city.cs --------------------------------------------------------------------------