Program TestXMS; {$X+} { So we don't have to check if successful everytime } { Author: Bean, thitt@igateway.com } { Program to demonstrate use of XMS unit } { Creates an array of 100,000 reals in XMS } { then fills the array with values, then displays the values. } { Creates a 100 by 100 two dimensional array of a 90 byte record } { then fills the array with values, then displays them. } Uses Crt, XMSArray; Type { NOTE I added the filler field because XMS records size must } { be an EVEN number. } TMyRecord = Record Name: String[80]; { 81 bytes } Age: Integer; { 2 bytes } Income: Real; { 6 bytes } Filler: Byte; { 1 bytes } End; { Total=90 bytes } Var TestArray1: PXMSArray; TestArray2: PXMS2DArray; I, J: LongInt; Elements: LongInt; Rows, Columns: LongInt; TempStr: String[5]; Value: Real; MyRecord: TMyRecord; Begin ClrScr; Elements:=100000; { Test with 100,000 reals } New(TestArray1, Init(Elements, SizeOf(Value))); If TestArray1^.Handle > 0 Then Begin For I:=0 to Elements-1 Do Begin Value:=I * 0.01; TestArray1^.SetElement(I, Value); End; For I:=0 to Elements-1 Do Begin TestArray1^.GetElement(I, Value); Write(Value:8:2); End; TestArray1^.Done; End Else WriteLn('Failed to allocate XMS memory...'); { Exercise array of records } Rows:=100; Columns:=100; New(TestArray2, Init(Rows, Columns, SizeOf(MyRecord))); If TestArray2^.Handle > 0 Then Begin For I:=0 to Rows-1 Do Begin For J:=0 to Columns-1 Do Begin Str(I:5, TempStr); MyRecord.Name:='Row = '+TempStr; Str(J:5, TempStr); MyRecord.Name:=MyRecord.Name+' , Column = '+TempStr; MyRecord.Age:=Random(100); MyRecord.Income:=Random(10000) * 10.12; TestArray2^.SetElement(I, J, MyRecord); End; { For J } End; { For I } For I:=0 to Rows-1 Do Begin For J:=0 to Columns-1 Do Begin TestArray2^.GetElement(I, J, MyRecord); WriteLn(MyRecord.Name, ' ', MyRecord.Age:3, ' ', MyRecord.Income:10:2); End; { For J } End; { For I } TestArray2^.Done; End Else WriteLn('Failed to allocate XMS memory...'); End. ---------------------------------------------------------------------------------------- Subject: Turbo Pascal links Date: Mon, 20 Jul 1998 13:17:47 -0400 From: "Bean" To: Franz, Here is a unit that I wrote that allows you to use XMS memory like kind of like an array. Check out the demo program "TESTXMS.PAS". It shows how to make an array of 100,000 reals. Then fills them with values, then displays them on the screen. It makes it much easier to use XMS memory. The other XMS units are under source-code on the 2nd page, It doesn't matter to me where you put it. I do not have home-page for a link though. Let me know what you think, Bean, thitt@igateway.com