< -->

Program FullMemory;
var
 f : file;
 Sn, Se : String;
 i : Word;
 k  : Word;
 {Buffer : array[0..$0FFF] of Byte;}
Function HexB(b : Byte) : String;
const
  HD: array[0..15] of Char = ('0','1','2','3','4','5','6','7',
  '8','9','A','B','C','D','E','F');
begin
  HexB := HD[b shr 4] + HD[b and $F];
end;
begin
 WriteLn('Создаём файлы памяти...');
 Se :='.mem';
 for i := 0 to $F do
   begin
     Sn := '0'+HexB(Byte(i))+'000h';
     Write('Файл ', Sn+Se, '...');
     Assign(f, Sn+Se);
     Rewrite(f,1);
     BlockWrite(f,Mem[i*$1000:$0000], $FFFF, k);
     BlockWrite(f,Mem[i*$1000:$FFFF], 1);
     if k=$FFFF then WriteLn('O''Key') else WriteLn('Не создан!');
     Close(f);
     ReadLn;
   end;
  Sn := '07C00h';
     Write('Файл ', Sn+Se, '...');
  Assign(f, Sn+Se);
  Rewrite(f,1);
  BlockWrite(f,Mem[$7C00:$0000], $FFFF, k);
  BlockWrite(f,Mem[$7C00:$FFFF], 1);
  if k=$FFFF then WriteLn('O''Key') else WriteLn('Не создан!');
  Close(f);
     ReadLn;
  Sn := '0C800h';
     Write('Файл ', Sn+Se, '...');
  Assign(f, Sn+Se);
  Rewrite(f,1);
  BlockWrite(f,Mem[$C800:$0000], $FFFF, k);
  BlockWrite(f,Mem[$C800:$FFFF], 1);
  if k=$FFFF then WriteLn('O''Key') else WriteLn('Не создан!');
  Close(f);
     ReadLn;
  Sn := '0A000h';
     Write('Файл ', Sn+Se, '...');
  Assign(f, Sn+Se);
  Rewrite(f,1);
  BlockWrite(f,Mem[$A000:$0000], $FFFF, k);
  BlockWrite(f,Mem[$A000:$FFFF], 1);
  if k=$FFFF then WriteLn('O''Key') else WriteLn('Не создан!');
  Close(f);
     ReadLn;
  Sn := '0B800h';
     Write('Файл ', Sn+Se, '...');
  Assign(f, Sn+Se);
  Rewrite(f,1);
  BlockWrite(f,Mem[$B800:$0000], $FFFF, k);
  BlockWrite(f,Mem[$B800:$FFFF], 1);
  if k=$FFFF then WriteLn('O''Key') else WriteLn('Не создан!');
  Close(f);
     ReadLn;
  Sn := 'FFFF0h';
     Write('Файл ', Sn+Se, '...');
  Assign(f, Sn+Se);
  Rewrite(f,1);
  BlockWrite(f,Mem[$F000:$FFF0], $10, k);
  if k=$10 then WriteLn('O''Key') else WriteLn('Не создан!');
  Close(f);
     ReadLn;
end.

Назад