{$f $a0} // fastmul at page $a0 ($a000)

program benchmark;
uses crt, fastgraph, sysutils;

var x, y    : byte;
    y1      : integer;
    bmpAdr  : integer;
    start, stop : cardinal;

begin
  InitGraph(7);
  SetColor(1);
  bmpAdr := dpeek(88);

  start := GetTickCount;
  for y := 0 to 39 do begin
    for x := 0 to 39 do begin
      PutPixel(x,y);
    end;
  end;
  stop := GetTickCount;
  writeln('draw square PutPixel: ', stop - start);

  ReadKey;
  ClrScr;
  
  start := GetTickCount;
  fillchar(pointer(bmpAdr), 1600, 0);
  stop := GetTickCount;
  writeln('clear fillchar: ', stop - start);

  ReadKey;
  ClrScr;
  
  y1 := 0;
  start := GetTickCount;
  repeat
    for x := 0 to 9 do begin
      dpoke(bmpAdr + x + y1, $aa);
    end;
  y1 := y1 + 40;
  until y1 = 1600;
  stop := GetTickCount;
  writeln('draw square dpoke: ', stop - start);

  ReadKey;
  ClrScr;

  start := GetTickCount;
  fillchar(pointer(bmpAdr), 1600, 0);
  stop := GetTickCount;
  writeln('clear fillchar: ', stop - start);

  ReadKey;
  ClrScr;

  start := GetTickCount;
  for y := 0 to 39 do begin
    for x := 0 to 39 do begin
      PutPixel(x,y);
    end;
  end;
  stop := GetTickCount;
  writeln('draw square PutPixel: ', stop - start);

  ReadKey;
  ClrScr;
  
  start := GetTickCount;
  for y := 0 to 79 do begin
    for x := 0 to 9 do begin
      dpoke(bmpAdr + x + (y * 20), 0);
    end;
  end;
  stop := GetTickCount;
  writeln('clear dpoke square: ', stop - start);

  ReadKey;
  ClrScr;

  start := GetTickCount;
  for y := 0 to 39 do begin
    for x := 0 to 39 do begin
      PutPixel(x,y);
    end;
  end;
  stop := GetTickCount;
  writeln('draw square PutPixel: ', stop - start);

  ReadKey;
  ClrScr;
  
  start := GetTickCount;
    for x := 0 to 200 do begin
      dpoke(bmpAdr + x, 0);
      dpoke(bmpAdr + x + 200, 0);
      dpoke(bmpAdr + x + 400, 0);
      dpoke(bmpAdr + x + 600, 0);
      dpoke(bmpAdr + x + 800, 0);
      dpoke(bmpAdr + x + 1000, 0);
      dpoke(bmpAdr + x + 1200, 0);
      dpoke(bmpAdr + x + 1400, 0);
    end;
  stop := GetTickCount;
  writeln('clear dpoke full screen: ', stop - start);

  ReadKey;
  ClrScr;

end.

