

program MediumCharacters;

var   Letter : char;
      Colr   : integer;

{-----------------------------------------------------------------------------}
function BitSet (InByte : byte; WhichBit : integer) : boolean;

begin  if ((InByte div WhichBit) mod 2) = 1 then BitSet := true
                                            else BitSet := false;
end;
{-----------------------------------------------------------------------------}
procedure PlotMedChar (NextChar : char);

const PelSeg = $F000; PelStart = $FA6E;            { this procedure plots a  }
                                                   { double size char with a }
var   CharNum,Offset,i,x,y : integer;              { transparent background  }
      InByte       : byte;

{----------------------------------------------------}
procedure MedPlot (a,b : integer);

var   p,q : integer;

begin p := x+a; q := y+(2*b);

      Plot (p,q-1,Colr); Plot (p+1,q-1,Colr);
      Plot (p,q,Colr);   Plot (p+1,q,Colr);
end;
{----------------------------------------------------}

begin
     CharNum := ord (NextChar);

     if CharNum in [65..77]  then                             { A..M }
       begin x := ((CharNum - 65) * 16) + 40; y := 4;  end;
     if CharNum in [97..109] then                             { a..m }
       begin x := ((CharNum - 97) * 16) + 40; y := 4;  end;
     if CharNum in [78..90]  then                             { N..Z }
       begin x := ((CharNum - 78) * 16) + 40; y := 24; end;
     if CharNum in [110..122] then                            { n..z }
       begin x := ((CharNum -110) * 16) + 40; y := 24; end;

     Offset := PelStart + (CharNum * 8);

     for i := 0 to 7 do begin

          InByte := Mem [PelSeg:Offset+i];

          if BitSet (InByte,128) then MedPlot (1,i);
          if BitSet (InByte, 64) then MedPlot (3,i);
          if BitSet (InByte, 32) then MedPlot (5,i);
          if BitSet (InByte, 16) then MedPlot (7,i);
          if BitSet (InByte,  8) then MedPlot (9,i);
          if BitSet (InByte,  4) then MedPlot (11,i);
          if BitSet (InByte,  2) then MedPlot (13,i);
          if BitSet (InByte,  1) then MedPlot (15,i);

     end;

end;
{-----------------------------------------------------------------------------}


BEGIN
      AuxOutPtr := Ofs (PlotMedChar);

      GraphColorMode; GraphBackGround (1); Palette (2);
      Colr := 0;

      delay (500);
      for Letter := 'A' to 'Z' do
         begin Colr := Colr + 1;
               if Colr = 4 then Colr := 1;
               {PlotMedChar (Letter);}
               write (Aux,Letter);
         end;

      read (Kbd,Letter);

      GraphColorMode; GraphBackGround (1); Palette (2);
      Colr := 0;

      delay (500);
      for Letter := 'a' to 'z' do
         begin Colr := Colr + 1;
               if Colr = 4 then Colr := 1;
               {PlotMedChar (Letter);}
               write (Aux,Letter);
         end;

      read (Kbd,Letter);

      TextMode (c80);

END.