binary patch for R/W memory in loop