PROGRAM TextSeiten;

VAR PageOffset,i : WORD;

PROCEDURE SetBlink(On : BOOLEAN); Assembler;
ASM
 mov ax,1003h
 mov bl,On
 int 10h
END;

PROCEDURE TextPage(Nummer : WORD);
BEGIN
 PageOffset := Nummer*2000;
 PORT[$3d4] := $0d;
 PORT[$3d5] := Lo(PageOffset);
 PORT[$3d4] := $0c;
 PORT[$3d5] := Hi(PageOffset);
END;

PROCEDURE WriteXY(x,y,Attribut : WORD; s : STRING);
VAR TextOffset : WORD;
    i          : BYTE;
BEGIN
 TextOffset := PageOffset*2 + (x-1)*2+(y-1)*160;
 Attribut := Attribut SHL 8;
 FOR i := 1 TO Length(s) DO
  MEMW[$b800:TextOffset+(i-1) SHL 1] := Attribut + Ord(s[i]);
END;

PROCEDURE ClearScreen(Attribut : BYTE);
VAR i : WORD;
BEGIN
 FOR i := 0 TO 15999 DO
  MEMW[$b800:i*2] := Attribut SHL 8 + $20;
END;

BEGIN
 SetBlink(FALSE);
 ClearScreen($f0);
 TextPage(0);
 WriteXY(1,1,$f0,'Hallo Welt :) !!!');
 ReadLn;
END.
