home *** CD-ROM | disk | FTP | other *** search
/ TopWare Tools / TOOLS.iso / tools / top1318 / gepackt.exe / UTILITY / SOURCE / SETRAM.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1991-03-21  |  1.8 KB  |  67 lines

  1. {$m 5000,2000,10000}
  2. program setram;
  3.  
  4.   uses
  5.     autocopy,umcb;
  6.  
  7.   var
  8.     mcb                                : mcbtyp;
  9.     min,max                            : word;
  10.     endseg                             : word;
  11.     w,i                                : word;
  12.     j                                  : integer;
  13.     s                                  : string[5];
  14.  
  15.   begin
  16.     if paramcount<2 then begin
  17.       writeln('setram nnnn mmmm');
  18.       writeln('n Anfangssegment des zusätzlichen Ramspeichers.');
  19.       writeln('m Endsegment des zusätzlichen Ramspeichers.');
  20.       writeln('Angaben als Hex-Zahlen.');
  21.       writeln('Bitte keinen EMS-Speicherbereich angeben!');
  22.       halt(1);
  23.     end;
  24.     s:=paramstr(1);
  25.     if upcase(s[ord(s[0])])='H' then dec(s[0]);
  26.     if s[1]<>'$' then s:='$'+s;
  27.     val(s,min,j);
  28.     if j<>0 then halt(1);
  29.     s:=paramstr(2);
  30.     if upcase(s[ord(s[0])])='H' then dec(s[0]);
  31.     if s[1]<>'$' then s:='$'+s;
  32.     val(s,max,j);
  33.     if j<>0 then halt(1);
  34.     w:=min;
  35.     repeat
  36.       i:=not memw[w:0];
  37.       memw[w:0]:=i;
  38.       if memw[w:0]<>i then min:=w+$100;
  39.       inc(w,$100);
  40.     until (w>=max) or (i=memw[w-$100:0]);
  41.     repeat
  42.       i:=not memw[w:0];
  43.       memw[w:0]:=i;
  44.       if memw[w:0]<>i then max:=w;
  45.       inc(w,$100);
  46.     until (w>=max) or (i<>memw[w-$100:0]);
  47.     if min=max then halt(1);
  48.     with mcb do begin
  49.       init;
  50.       while (id<>#0) and next do;
  51.       endseg:=mcbseg+succ(len);
  52.       if seg(mcb^)>endseg then exit;
  53.       if seg(mcb^)<>pred(endseg) then begin
  54.         dec(mcb^.len);
  55.         mcb^.id:='M';
  56.         if next then;
  57.       end;
  58.       mcb^.id:='M';
  59.       mcb^.psp:=8;
  60.       mcb^.len:=min-endseg;
  61.       if next then;
  62.       mcb^.psp:=0;
  63.       mcb^.id:='Z';
  64.       mcb^.len:=pred(max-min);
  65.     end;
  66.   end.
  67.