program chessboard;
uses crt, graph;

var i, stop                          : byte;
    rtClock                          : byte absolute 20;
    col1                             : byte absolute 709;
    col2                             : byte absolute 710;
    colB                             : byte absolute 712;
    bmpAdr                           : word absolute 88;

procedure drawBoard;
var i1b, i2b, i3b, x, modLine : byte;
    p                                : PByte;
begin
  p := pointer(bmpAdr);
  modLine := 0;
  for i3b := 1 to 8 do begin
    for i2b := 1 to 24 do begin
      x := 0;
      for i1b := 1 to 8 do begin
        if (i1b and %1 <> modLine) then begin
          p[x] := $ff;
          p[x + 1] := $ff;
          p[x + 2] := $ff; 
        end;
        Inc(x, 3);
      end;
      Inc(p, 40);
    end;
    if (i3b and %1 = 0) then modLine := 0
    else modLine := 1;
  end;
end;

begin
  InitGraph(8+16);
  col1 := 1;
  col2 := 11;
  colB := 12;

  rtClock := 0;
  while (rtClock < 150) do begin
   drawBoard;
   Inc(i);
  end;
  stop := rtClock;
  
  InitGraph(0);
  writeln('Drawing time: ', i);
  ReadKey;
end.
