/apricot.pas
unit Apricot;
interface
type
ScreenModeT = (ScreenModeText, ScreenModeGfx);
{ Standard Crt-like functions }
: Char;
: Boolean;
(const ms: Word);
{ Screen }
{ true if screen is on; false otherwise }
: Boolean;
{ Mode 0: Text, Mode 1: Graphics }
(const mode: ScreenModeT);
(const on: Boolean);
var CurrentScreenMode: ScreenModeT;
implementation
uses Dos;
(cmd: Byte): Byte;
var r: Registers;
begin
r.AX := cmd shl 8;
Intr($21, r);
IntDos1 := Byte(r.AX);
end;
: Char;
begin
ReadKey := Char(IntDos1(8));
end;
: Boolean;
begin
KeyPressed := Boolean(IntDos1($0B));
end;
(const ms: Word);
var t0, t1: Longint;
h, m, s, t: Word;
begin
GetTime(h, m, s, t);
t1 := h * 360000 + m * 6000 + s * 100 + t + Longint(ms div 10);
repeat
GetTime(h, m, s, t);
t0 := h * 360000 + m * 6000 + s * 100 + t;
until t0 >= t1;
end;
(dev, com, dat: Word): Word;
var r: Registers;
begin
r.BX := dev;
r.CX := com;
r.DX := dat;
Intr($FC, r);
Control := r.AX;
end;
: Boolean;
begin
ScreenIsOn := not Boolean(Control($31, 0, 0));
end;
(const mode: ScreenModeT);
begin
Control($31, 1, Word(mode));
CurrentScreenMode := mode;
end;
(const on: Boolean);
begin
Control($31, 2, Word(not on));
end;
end.