PROGRAM TEXTMODI;
{ (c) 1991 BY HANS-JšRGEN SCHLOáAREK }
USES DOS,CRT;
{-- A --}
VAR
   OK_EGA,OK_VGA:BOOLEAN;
   REGS:REGISTERS;

{-- B --}
PROCEDURE TEXT_8X8;
{ EGA=43 ZEILEN, VGA=50 ZEILEN }
BEGIN
    REGS.AH:=$11; REGS.AL:=$12;
    REGS.BL:=$0; INTR($10,REGS);
END;

PROCEDURE TEXT_8X14;
{ EGA=25 ZEILEN, VGA=28 ZEILEN }
BEGIN
    REGS.AH:=$11; REGS.AL:=$11;
    REGS.BL:=$0; INTR($10,REGS);
END;

PROCEDURE TEXT_8X16;
{ NUR VGA=25 ZEILEN }
BEGIN
    REGS.AH:=$11; REGS.AL:=$14;
    REGS.BL:=$0; INTR($10,REGS);
END;

PROCEDURE CURSOR_SETZEN(A,E:BYTE);
BEGIN
 REGS.AH:=$01;REGS.CH:=A;REGS.CL:=E;INTR($10,REGS);
 REGS.AH:=$02;REGS.BH:=0;REGS.DH:=1;REGS.DL:=1;INTR($10,REGS);
END;

{-- C --}
PROCEDURE EGA_UMSCHALTEN;
BEGIN
 IF (PARAMSTR(1) = '8x8') OR (PARAMSTR(1) = '8X8')
    THEN BEGIN TEXT_8X8;CURSOR_SETZEN(6,7);EXIT; END;
 IF (PARAMSTR(1) = '8x14') OR (PARAMSTR(1) = '8X14')
    THEN TEXT_8X14;CURSOR_SETZEN(12,13);
END;

PROCEDURE VGA_UMSCHALTEN;
BEGIN
 IF (PARAMSTR(1) = '8x8') OR (PARAMSTR(1) = '8X8')
    THEN BEGIN TEXT_8X8;CURSOR_SETZEN(6,7); EXIT; END;
 IF (PARAMSTR(1) = '8x14') OR (PARAMSTR(1) = '8X14')
    THEN BEGIN TEXT_8X14;CURSOR_SETZEN(12,13);EXIT; END;
 IF (PARAMSTR(1) = '8x16') OR (PARAMSTR(1) = '8X16')
    THEN TEXT_8X16;CURSOR_SETZEN(13,15);
END;

{-- D --}
PROCEDURE IST_EGA;
BEGIN
  REGS.AH:=$12; REGS.BL:=$10; INTR($10,REGS);
  IF REGS.BL <> $10 THEN OK_EGA := TRUE;
END;

PROCEDURE IST_VGA;
BEGIN
   REGS.AH:=$1A; REGS.AL:=$0; INTR($10,REGS);
   IF REGS.AL = $1A THEN OK_VGA := TRUE;
END;

{-- E --}
PROCEDURE HILFE;
BEGIN
CLRSCR;
WRITELN('DAS PROGRAMM STELLT DIE ANZAHL DER TEXTZEILEN EIN!');
WRITELN('FOLGENDE AUFRUFE SIND M™GLICH:');
WRITELN('TEXTMODI 8X8  <EGA = 43 ZEILEN, VGA=50 ZEILEN>');
WRITELN('TEXTMODI 8X14 <EGA = 25 ZEILEN, VGA=28 ZEILEN>');
WRITELN('TEXTMODI 8X16 <VAG = 25 ZEILEN>');
WRITELN;
WRITELN('ANZEIGE MIT RETURNTASTE BEENDEN!');
READLN;
END;

BEGIN    { HAUPTPROGRAMM }
OK_EGA:=FALSE;OK_VGA:=FALSE;
IF PARAMCOUNT <> 1 THEN
   BEGIN HILFE; CLRSCR; HALT(0); END;
IST_VGA;
IF NOT OK_VGA THEN IST_EGA;
IF (NOT OK_VGA) AND (NOT OK_EGA) THEN
 BEGIN
  WRITELN('DIESES PROGRAMM BRAUCHT EINE EGA- ODER VGA-KARTE!');
  DELAY(2000);
  CLRSCR;
  HALT(0);
 END;
IF OK_VGA THEN VGA_UMSCHALTEN ELSE
   IF OK_EGA THEN EGA_UMSCHALTEN;
END.
