home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / memory / xms / memtest.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1995-07-28  |  2.7 KB  |  103 lines

  1. program Mem_test;
  2.  
  3. uses Memory,crt,gifunit;
  4.  
  5. var xmsh : array[1..2] of XMSHandle;
  6.     emsh : array[1..2] of EMSHandle;
  7.  
  8. procedure xms_test;
  9. var ta : array[1..20] of word;
  10.     li : integer;
  11. begin;
  12.   { Provide array with numbers & and output for testing purposes }
  13.   gotoxy(1,5); write('Original: ');
  14.   for li := 1 to 20 do begin;
  15.     ta[li] := li;
  16.     gotoxy(14,li+4);
  17.     write(ta[li]);
  18.   end;
  19.   readln;
  20.  
  21.   { Store array in XMS, fill with 0 and output }
  22.   gotoxy(21,5); write('Stored in XMS &');
  23.   gotoxy(21,6); write('filled with 0:');
  24.   Getmem_XMS(xmsh[1],40);
  25.   RAM_2_XMS(@ta,xmsh[1],40);
  26.   fillchar(ta,40,0);
  27.   for li := 1 to 20 do begin;
  28.     gotoxy(44,li+4);
  29.     write(ta[li]);
  30.   end;
  31.   readln;
  32.  
  33.   { Copy memory to XMS, restore array from copy in XMS }
  34.   gotoxy(54,5); write('Restored from');
  35.   gotoxy(54,6); write('XMS: ');
  36.   Getmem_XMS(xmsh[2],40);
  37.   XMS_2_XMS(xmsh[1],xmsh[2],40);
  38.   XMS_2_RAM(@ta,xmsh[2],40);
  39.   for li := 1 to 20 do begin;
  40.     gotoxy(74,li+4);
  41.     write(ta[li]);
  42.   end;
  43.   readln;
  44.   Freemem_XMS(xmsH[1]);
  45.   Freemem_XMS(xmsH[2]);
  46. end;
  47.  
  48. procedure Ems_test;
  49. var ta : array[1..20] of word;
  50.     li : integer;
  51.     picptr : pointer;
  52. begin;
  53.   getmem(picptr,64000);
  54.   Init_ModeX;
  55.   blackpal;
  56.   LoadGif('example.gif',picptr,0,0);
  57.   Getmem_EMS(emsh[1],64000);
  58.   RAM_2_EMS(picptr,emsh[1],64000);
  59.   freemem(picptr,64000);
  60.  
  61.   getmem(vscreen,64000);
  62.   fillchar(vscreen^,64000,123);
  63.   EMS_2_RAM(vscreen,emsh[1],64000);
  64.   p13_2_modex(0,16000);
  65.   setpal;
  66.   readln;
  67.  
  68.   freemem(vscreen,64000);
  69.   Freemem_EMS(emsH[1]);
  70.   asm mov ax,0003;  int 10h;  end;
  71. end;
  72.  
  73. begin;
  74.   clrscr;
  75.   writeln('Program for demonstration of the  > MEMORY  < unit');
  76.   writeln('(c) 1994 by DATA BECKER/ABACUS    Author: Boris Bertelsons');
  77.   writeln;
  78.   writeln('Free base memory  : ',Base_Free,' Bytes');
  79.   writeln('Free XMS          : ',XMS_Free,' Bytes');
  80.   writeln('Free EMS          : ',EMS_Free,' Bytes');
  81.   writeln('XMS Version       : ',hi(XMS_Version),'.',lo(XMS_Version));
  82.   writeln('EMS Version       : ',hi(EMS_Version),'.',lo(EMS_Version));
  83.   readln;
  84.   clrscr;
  85.   writeln('Program for demonstration of the  > MEMORY  < unit');
  86.   writeln('(c) 1994 by DATA BECKER/ABACUS    Author: Boris Bertelsons');
  87.   writeln;
  88.   writeln('                     X   M   S     -   T  E  S  T');
  89.   if XMS_Available then
  90.     xms_test
  91.   else
  92.     writeln('No XMS memory available !');
  93.   clrscr;
  94.   writeln('Program for demonstration of the  > MEMORY  < unit');
  95.   writeln('(c) 1994 by DATA BECKER/ABACUS    Author: Boris Bertelsons');
  96.   writeln;
  97.   writeln('                     E   M   S     -   T  E  S  T');
  98.   if EMS_Available then
  99.     ems_test
  100.   else
  101.     writeln('No EMS memory available !');
  102. end.
  103.