Counting in EEPROM is tricky. I didn’t want the same byte to get rewritten every time the chip powers on, and I was willing to store numbers inefficiently at the expense of storage utilization. Here’s the explanation to my wear leveling algorithm.
I found I could use a ring buffer to store a big number in a Linear Feedback Shift Register (LFSR). Each count rewrites two bytes. The trick was to have a bit reserved to identify the “head”, and increment the LFSR by the same number of counts as is reserved for the base of the character set used. This way the number of rewrites is kept low. The ring buffer can be arbitrarily larger than the required 8 bytes.
The chip seeks out the lowercase letter, and stuffs it and the following characters into a maximal length Galois LFSR. The chip increments that and writes the result back to the EEPROM, now offset by a byte position.