anchor.diff:    Address := StartAddress;
     MainForm.ProgressBar.Max := WriteSize div PageSize;
   
  -  try
  -
  -    //Проверяем тип адресации 256+Mbit
  -    if WriteSize > 16777216 then
  -    begin
  -      UsbAsp25_ReadSR(hUSBDev, sreg, $15);
  -      if isBitSet(sreg, 0) then addr32bit4byte := true;
  -      //Сбрасываем регистр адреса
  -      sreg := 0;
  -      UsbAsp25_WriteSR(hUSBDev, sreg, $c5);
  -    end;
  -
  -
  -    while Address < WriteSize do
  -    begin
  -      //Только вначале aai
  -      if (((WriteType = WT_SSTB) or (WriteType = WT_SSTW)) and (Address = StartAddress))
  -        or
  -      //Вначале страницы
  -      (WriteType = WT_PAGE) then UsbAsp25_WREN(hUSBDev);
  -
  -      if (WriteSize - Address) < PageSize then PageSize := (WriteSize - Address);
  -      RomStream.ReadBuffer(DataChunk, PageSize);
  -
  -      if (WriteType = WT_SSTB) then
  +  //Проверяем тип адресации 256+Mbit
  +  if WriteSize > FLASH_SIZE_128MBIT then
  +  begin
  +    UsbAsp25_ReadSR(hUSBDev, sreg, $15);
  +    if isBitSet(sreg, 0) then addr32bit4byte := true;
  +    //Сбрасываем регистр адреса
  +    sreg := 0;
  +    UsbAsp25_WriteSR(hUSBDev, sreg, $c5);
  +  end;
  +
  +
  +  while Address < WriteSize do
  +  begin
  +    //Только вначале aai
  +    if (((WriteType = WT_SSTB) or (WriteType = WT_SSTW)) and (Address = StartAddress)) or
  +    //Вначале страницы
  +    (WriteType = WT_PAGE) then UsbAsp25_WREN(hUSBDev);
  +
  +    if (WriteSize - Address) < PageSize then PageSize := (WriteSize - Address);
  +    RomStream.ReadBuffer(DataChunk, PageSize);
  +
  +    if (WriteType = WT_SSTB) then
         if (Address = StartAddress) then //Пишем первый байт с адресом
           BytesWrite := BytesWrite + UsbAsp25_Write(hUSBDev, $AF, Address, datachunk, PageSize)
           else
           //Пишем остальные(без адреса)
           BytesWrite := BytesWrite + UsbAsp25_WriteSSTB(hUSBDev, $AF, datachunk[0]);
   
  -      if (WriteType = WT_SSTW) then
  +    if (WriteType = WT_SSTW) then
         if (Address = StartAddress) then //Пишем первые два байта с адресом
           BytesWrite := BytesWrite + UsbAsp25_Write(hUSBDev, $AD, Address, datachunk, PageSize)
           else
           //Пишем остальные(без адреса)
           BytesWrite := BytesWrite + UsbAsp25_WriteSSTW(hUSBDev, $AD, datachunk[0], datachunk[1]);
   
  -      if WriteType = WT_PAGE then
  +    if WriteType = WT_PAGE then
  +    begin
  +      if WriteSize > FLASH_SIZE_128MBIT then //Память больше 128Мбит
         begin
  -
  -        if WriteSize > 16777216 then //Память больше 128Мбит
  +        if addr32bit4byte then //4 байтная адресация включена
  +          BytesWrite := BytesWrite + UsbAsp25_Write32bitAddr(hUSBDev, $02, Address, datachunk, PageSize)
  +        else  //3 байтовая адресация включена
           begin
  -          if addr32bit4byte then //4 байтная адресация включена
  -            BytesWrite := BytesWrite + UsbAsp25_Write32bitAddr(hUSBDev, $02, Address, datachunk, PageSize)
  -          else
  +          //старший байт адреса
  +          if Address > FLASH_SIZE_128MBIT then
             begin
  -            //3 байтовая адресация включена
  -
  -            //старший байт адреса
  -            if Address > 16777216 then
  -            begin
  -              UsbAsp25_WriteSR(hUSBDev, hi(hi(Address)), $c5);
  -              UsbAsp25_WREN(hUSBDev);
  -            end;
  -
  -            BytesWrite := BytesWrite + UsbAsp25_Write(hUSBDev, $02, Address, datachunk, PageSize);
  +            UsbAsp25_WriteSR(hUSBDev, hi(hi(Address)), $c5);
  +            UsbAsp25_WREN(hUSBDev);
             end;
  -        end
  -        else
  -          //Память в пределах 128Мбит
  +
             BytesWrite := BytesWrite + UsbAsp25_Write(hUSBDev, $02, Address, datachunk, PageSize);
  -
  -      end;
  -
  -      if not MainForm.MenuIgnoreBusyBit.Checked then  //Игнорировать проверку
  +        end;
  +      end
  +      else //Память в пределах 128Мбит
  +        BytesWrite := BytesWrite + UsbAsp25_Write(hUSBDev, $02, Address, datachunk, PageSize);
  +    end;
  +
  +    if not MainForm.MenuIgnoreBusyBit.Checked then  //Игнорировать проверку
         if UsbAsp25_Busy(hUSBDev) then
         begin
           LogPrint(STR_USER_CANCEL , clRed);
           Break;
         end;
   
  -      if (MainForm.MenuAutoCheck.Checked) and (WriteType = WT_PAGE) then
  -      begin
  +    if (MainForm.MenuAutoCheck.Checked) and (WriteType = WT_PAGE) then
  +    begin
   	  
  -        if WriteSize > 16777216 then
  -          UsbAsp25_Read32bitAddr(hUSBDev, $13, Address, datachunk2, PageSize)
  -        else
  -          UsbAsp25_Read(hUSBDev, $03, Address, datachunk2, PageSize);
  +      if WriteSize > FLASH_SIZE_128MBIT then
  +        UsbAsp25_Read32bitAddr(hUSBDev, $13, Address, datachunk2, PageSize)
  +      else
  +        UsbAsp25_Read(hUSBDev, $03, Address, datachunk2, PageSize);
   		  
  -        for i:=0 to PageSize-1 do
  -          if DataChunk2[i] <> DataChunk[i] then
  -          begin
  -            LogPrint(STR_VERIFY_ERROR+IntToHex(Address+i, 8), clRed);
  -            MainForm.ProgressBar.Position := 0;
  -            Exit;
  -          end;
  -      end;
  -
  -      Inc(Address, PageSize);
  -      MainForm.ProgressBar.Position := MainForm.ProgressBar.Position + 1;
  -      Application.ProcessMessages;
  -    end;
  -
  -    UsbAsp25_Wrdi(hUSBDev); //Для sst
  -
  -  finally
  -  end;
  +      for i:=0 to PageSize-1 do
  +        if DataChunk2[i] <> DataChunk[i] then
  +        begin
  +          LogPrint(STR_VERIFY_ERROR+IntToHex(Address+i, 8), clRed);
  +          MainForm.ProgressBar.Position := 0;
  +          Exit;
  +        end;
  +    end;
  +
  +    Inc(Address, PageSize);
  +    MainForm.ProgressBar.Position := MainForm.ProgressBar.Position + 1;
  +    Application.ProcessMessages;
  +  end;
  +
  +  UsbAsp25_Wrdi(hUSBDev); //Для sst
   
     if BytesWrite <> WriteSize then
       LogPrint(STR_WRONG_BYTES_WRITE, clRed)
     else
       LogPrint(STR_DONE);
  +
     MainForm.ProgressBar.Position := 0;
   end;
   
  
positive.code: 
    if ChunkSize > ChipSize then ChunkSize := ChipSize;
  
    try
      UsbAspMW_EWEN(hUSBDev, AddrBitLen);
  
      while Address < ChipSize div 2 do
      begin
        RomStream.ReadBuffer(DataChunk, ChunkSize);
  
        BytesWrite := BytesWrite + UsbAspMW_Write(hUSBDev, AddrBitLen, Address, datachunk, ChunkSize);
        Inc(Address, ChunkSize div 2);
  
        if Current_HW = CH341 then
          while ch341mw_busy do
          begin
            Application.ProcessMessages;
          end;
  
        if Current_HW = AVRISP then
          while avrisp_mw_busy do
          begin
            Application.ProcessMessages;
          end;
  
        if Current_HW = USBASP then
          while UsbAspMW_Busy(hUSBDev) do
          begin
            Application.ProcessMessages;
          end;
  
        MainForm.ProgressBar.Position := MainForm.ProgressBar.Position + ChunkSize;
        Application.ProcessMessages;
      end;
  
    finally
  
    end;
  
    if BytesWrite <> ChipSize then
      LogPrint(STR_WRONG_BYTES_WRITE, ClRed)
    else
      LogPrint(STR_DONE);
    MainForm.ProgressBar.Position := 0;
  end;
  
  procedure WriteFlash25(var RomStream: TMemoryStream; StartAddress, WriteSize: cardinal; PageSize: word; WriteType: integer);
  var
    DataChunk: array[0..2047] of byte;
    DataChunk2: array[0..2047] of byte;
  
negative.code:   Address := StartAddress;
    MainForm.ProgressBar.Max := DataSize div ChunkSize;
  
    while Address < DataSize do
    begin
      if ChunkSize > (DataSize - Address) then ChunkSize := DataSize - Address;
  
      if DataSize > FLASH_SIZE_128MBIT then
          BytesRead := BytesRead + UsbAsp25_Read32bitAddr(hUSBDev, $13, Address, datachunk, ChunkSize)
        else
          BytesRead := BytesRead + UsbAsp25_Read(hUSBDev, $03, Address, datachunk, ChunkSize);
  