Меняет цветовую палитру — Pascal(Паскаль)

program SetColors; {$M $800,0,0}
uses Dos;
var KbdIntVec : Procedure;

{$F+}
procedure Keyclick; interrupt;
const
		{ Альтернативная палитра: }
  mas1 : array [0..16] of byte =
    (0,8,2,3,4,5,$14,38,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f,56);
		{ Стандартная палитра: }
  mas2 : array [0..16] of byte =
    (0,1,2,3,4,5,$14,7,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f,0);
var
  pq : Byte;
  segm, offs : Word;
begin
  pq := Port[$60];
  if (pq=87) or (pq=88) then
  begin
    case pq of
      87: begin
	{ Альтернативная палитра - F11 }
	segm:=seg(mas1); offs:=ofs(mas1)
      end;
      88: begin
	{ Стандартная палитра - F12 }
	segm:=seg(mas2); offs:=ofs(mas2)
      end
    end;
    asm
	mov	ah,10h
	mov	al,2
	mov	es,segm
	mov	dx,offs
	int	10h
    end
  end;
  inline($9C); KbdIntVec
end;
{$F-}

begin
  GetIntVec($9,@KbdIntVec); 
  SetIntVec($9,Addr(Keyclick)); 
  Keep(0)
end { SetColors }.

Leave a Comment

− 8 = 2