I am having trouble with bootloaders. The following program should reprogram the first 8 pages (512 bytes or 256 words) of flash. The first byte of each word should be the word address and the second should be the page number. It works in AVR Studio 4.09, but not on the actual hardware. The first page (32 words, 64 bytes) is all 0xFF, as if the page erase worked, but the page write didn't.
Can anyone help?
clr r30 ; Z= 0x0000 for program counter
clr r0 ; r1:r0 = data to write
ldi r16,5 ; page write