The FOR AA loop will erase the same block of flash 32 times.
ERASECODE ignores the lowest 6 bits of the address, and erases the whole 64 byte block.
The rest seems like it should work. As long as you don't have any interrupts going on at the same time.
<br>
Bookmarks