Program Interrupts;
var
TVI : array [0..$FF] of Pointer absolute $0000:$0000;
i, N : Word;
{[][][][][][][][][][][][][][][][][][][]}
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;
Function HexW(X: Word): String;
{Возвращает 16-ричное написание Х}
const
HS: array [0..15] of Char = '0123456789ABCDEF';
var
S: String;
k: Byte;
begin
S := '';
for k := 3 downto 0 do
S := S+HS[(X shr (k*4)) and 15];
HexW := S
end; {HexW}
{=+=+=+=+=+=+=+=+=+=++=+=+=+=+=+=+}
var
f : file;
Sn, Se : String;
k : Word;
{Buffer : array[0..$0FFF] of Byte;}
begin
N := 1;
for i := 0 to $FF do if TVI[i] <> NIL then
begin
WriteLn('int ', HexB(i),'h : Segment> ', HexW( Seg( TVI[i]^ ) ),'; Offset> ', HexW( Ofs( TVI[i]^ ) ));
N := N + 1;
if N>24 then
begin
ReadLn;
N := 1;
end;
end;
WriteLn('Создаём файлы векторов перерывания...');
for i := 0 to $FF do if TVI[i] <> NIL then
begin
Str(i, Se);
Se :='.'+ Se;
Sn := 'int_0' + HexB(Byte(i)) + 'h';
Write('Файл ', Sn+Se, '...');
Assign(f, Sn+Se);
Rewrite(f,1);
BlockWrite( f, Mem[ Seg( TVI[i]^ ) : Ofs( TVI[i]^ ) ], $1000, k);
if k=$1000 then WriteLn('O''Key') else WriteLn('Не создан!');
Close(f);
ReadLn;
end;
ReadLn;
end.