Here's a unit that I made that does that and a lot more...
{ QVideo }
{ 10/18/95 }
{ by Jordan Russell }
unit QVideo;
interface
procedure BottomRow (const Number: Byte);
procedure CursorOn;
procedure CursorOff;
procedure CursorNormal;
procedure CursorBig;
function DetectVideo: Byte;
procedure ReadNumber (var Number: Word);
procedure ReadReal (var Number: Real);
implementation
uses Crt;
procedure BottomRow (const Number: Byte);
{ Lets you access the bottom row with out it scrolling off sometimes }
begin
WindMax := (WindMax and 255) + ((Number - 1) * 256);
end;
procedure CursorOn; assembler;
{ Turns the cursor on }
asm
mov ah, 03h
xor bh, bh
int 10h
mov ah, 01h
and ch, 159 { x00xxxxx }
int 10h
end;
procedure CursorOff; assembler;
{ Turns the cursor off }
asm
mov ah, 03h
xor bh, bh
int 10h
mov ah, 01h
and ch, 159 { x00xxxxx }
or ch, 32 { xx1xxxxx }
int 10h
end;
procedure CursorNormal; assembler;
{ Sets the cursor to the normal size }
asm
mov ah, 03h
xor bh, bh
int 10h
mov ah, 01h
and ch, 32 { 00x00000 }
or ch, 6 { xxxxx11x }
mov cl, 7 { 00000111 }
int 10h
end;
procedure CursorBig; assembler;
{ Sets the cursor to the largest size }
asm
mov ah, 03h
xor bh, bh
int 10h
mov ah, 01h
and ch, 32 { 00x00000 }
mov cl, 7 { 00000111 }
int 10h
end;
function DetectVideo: Byte; assembler;
{ Detects the video card the user has
00h no display
01h monochrome adapter w/ monochrome display
02h CGA w/ color display
03h reserved
04h EGA w/ color display
05h EGA w/ monochrome display
06h PGA w/ color display
07h VGA w/ monochrome analog display
08h VGA w/ color analog display
09h reserved
0Ah MCGA w/ digital color display
0Bh MCGA w/ monochrome analog display
0Ch MCGA w/ color analog display
FFh unknown display type }
asm
mov ax, 1A00h
int 10h
cmp al, 1Ah
jne @1
mov al, bl
jmp @5
@1:
mov ah, 12h
mov bx, 10h
int 10h
cmp bx, 10h
je @3
cmp bh, 0
je @2
mov al, 5
jmp @5
@2:
mov al, 4
jmp @5
@3:
int 11h
not al
test al, 30h
jne @4
mov al, 1
jmp @5
@4:
mov al, 2
@5:
end;
procedure ReadNumber (var Number: Word);
{ Reads a integer, protects against Invalid numeric format errors }
var
Temp01: String;
Temp02: Integer;
begin
Readln (Temp01);
Val (Temp01, Number, Temp02);
end;
procedure ReadReal (var Number: Real);
{ Reads a real, protects against Invalid numeric format errors }
var
Temp01: String;
Temp02: Integer;
begin
Readln (Temp01);
Val (Temp01, Number, Temp02);
end;
end.